sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
272cfa0b84b4b10c6c51feb901fb08afbab9769a293e414a3e5fc92ed92a3b5b
Python
2,674
94
#!/usr/bin/env python from __future__ import print_function from pddlstream.algorithms.search import solve_from_pddl from pddlstream.algorithms.focused import solve_focused from pddlstream.algorithms.incremental import solve_incremental from pddlstream.language.constants import print_solution, PDDLProblem DOMAIN_PDD...
3629868a452e4c667c7cad2183b0832603f0f3da6b543742796974875e9a495f
Python
2,675
68
import torch from torch_geometric.nn import MessagePassing from torch_geometric.nn import global_add_pool, global_mean_pool, global_max_pool, GlobalAttention, Set2Set import torch.nn.functional as F from torch_geometric.nn.inits import uniform from conv import GNN_node, GNN_node_Virtualnode from torch_scatter import ...
a1824d493011398434de10ca81ce8f15bc84805c47365d82f881359ba41e4a3b
Python
2,675
80
"""Pure resolver for the Atlas Selector. Returns an :class:`AtlasChoice` (an ``AtlasInfo`` plus a 3d/2d mode) without touching Qt. The dialog (:mod:`atlas_selector_ui`) is a thin renderer over this helper; the editor's load paths consume the result. Keeping it pure means unit tests don't need an offscreen Qt plat...
f832d2f4cab81e9c1e9e1ef40ded7a52122b7fa14b161de9909bd640785f1a97
Python
2,675
62
"""Symmetric MERFISH density variant (allen_ccf_merfish_symmetric).""" import numpy as np import pytest def _b(): return pytest.importorskip("scripts.build_symmetric_merfish") def test_denser_hemisphere_picks_the_high_density_side(): b = _b() dens = np.zeros((4, 3, 6), np.float32) dens...
2c909603d4021ba1f314d30555335e44456c97869e9997285eb15f37bbbda83b
Python
2,676
71
#! /usr/bin/env python from lab.parser import Parser parser = Parser() parser.add_pattern('ms_final_size', 'Final transition system size: (\d+)', required=False, type=int) parser.add_pattern('ms_construction_time', 'Done initializing merge-and-shrink heuristic \[(.+)s\]', required=False, type=float) parser.add_patter...
fc699d12c1b6b72a148b6b52ac1f277dfae5dd1e3f5df6a981cf1a10194f694e
Python
2,676
85
"""Constructor for spin-echo-based frequency calibration sequence.""" # %% from math import pi import numpy as np import pypulseq as pp from console.utilities.sequences.system_settings import raster from console.utilities.sequences.system_settings import system as default_system def constructor( n_steps: int = ...
9d19511e3dac72baff50ae87aaa5149305d31a408b37026b6ac8789aca962903
Python
2,678
68
import numpy as np import sys, os, gzip, time from msTools import * msInFileName, demogParamFileName, maxSnps, maxDistBtwnSnps, outFileName = sys.argv[1:] maxSnps = int(maxSnps) maxDistBtwnSnps = float(maxDistBtwnSnps) def combineHapsAndSnpDists(haplotypeMatrices, distsBetweenSnpVectors, maxSnps, maxDistBtwnSnps): ...
1419dcd0504a439e99e91c9eec2218acb7e71e8af9ea73225d6b53966dad7915
Python
2,679
76
'''Command-line tool functionality for `cellmincer preprocess`.''' import yaml import logging import os import sys from cellmincer.cli.base_cli import AbstractCLI from cellmincer.preprocess.main import Preprocess class CLI(AbstractCLI): '''CLI implements AbstractCLI from the cellmincer.cli package.''' def ...
345149e7e752d3949e5a1e0eb58f27af11871d3ff6f6cfcbc9c06afcbd434a7c
Python
2,679
108
# built-in from math import isclose # external import hypothesis import pytest # project import textdistance ALGS = ( textdistance.bag, textdistance.hamming, textdistance.levenshtein, textdistance.damerau_levenshtein, textdistance.jaro, textdistance.jaro_winkler, textdistance.mlipns, ...
3b303f30fd144d796fb7f222f5dee5c17aea55fbd9138b7ea8a7a02c5e3ac4e9
Python
2,679
82
#!/bin/env python3 ''' Define a pool of particles, i.e. a dictionary that keeps track of how many time each quasi-particle shows up. ''' import re from frozendict import frozendict from typing import Callable from .yamlrepr import YAML_String_Representer from .particle import Number class ParticlePool(dict, YAML_Strin...
847e35c24044f3b4681f9c80dd5a9a75eeb72d83ffa9e243b96baca3fb62d93c
Python
2,679
95
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
526d1eb3a6a2743b2138c34359a6ace7ec0df379254eee157993c51d78271034
Python
2,681
93
import json import torch import tqdm import numpy as np import torch.nn as nn from pathlib import Path from typing import Any from ..prixfixe import Trainer, PrixFixeNet, DataProcessor, DEFAULT_METRICS from .dataprocessor import BHIDataProcessor """ 230406 BHITrainer added - RC equivariant - loss for mean of fo...
670d2c5ee6c76002f58d3b24a8e0da7381f4fae03a82dc977b2fe0b2699dad6e
Python
2,682
51
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ht...
fe9a894ed4c29ef96d404d7f92d49af83e73659c10b2e5ca7a0b1344e20c0050
Python
2,682
90
import argparse def add_subparser_args(subparsers: argparse) -> argparse: '''Add tool-specific arguments. Args: subparsers: Parser object before addition of arguments specific to `train`. Returns: parser: Parser object with additional parameters. ''' subparser = subpar...
18c70217ead3e1ffc8e0d247eae0dea16ff084e5b108ec9b15438ee3e4ba936a
Python
2,683
68
import os.path from collections import defaultdict from ckg.graphdb_builder import builder_utils ######################### # RefSeq # ######################### def parser(databases_directory, download=True): config = builder_utils.get_config(config_name="refseqConfig.yml", data_type='databases') ...
053a2f5ff7287828078efb8cad275a8f472a1e51f3dc4f66fc5742532c0a6fbe
Python
2,684
97
import os import sys import cv2 import numpy as np import h5py #,cv2 #conda install h5py, cv2 from scipy import io as sio ''' Example of user/custom movie-reader class for use with APT/movie.py. In this example, the custom class reads image frames from an h5 dataset with key specified by an auxiliary (mat...
96edfd2b3ec596f7aac9c928df34ceecfa0a7c239b1e8d6203079113ed0068a6
Python
2,684
99
from __future__ import annotations import pytest redun = pytest.importorskip("redun") from pathlib import Path from quacc import flow, get_settings, job, redecorate, strip_decorator, subflow from quacc.wflow_tools.customizers import customize_jobs @pytest.fixture def scheduler(): return redun.Scheduler() de...
794a68b8f6c8bd7febc68f0a80bf8c66c7e6e958725dfd82b9a0a1095d530ce8
Python
2,685
61
#! /usr/bin/env python # ============================================================================== # Copyright (c) 2020, Ko Sugawara # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Re...
c370cf7fd135c4349d7ce3514dabafd3073d4ef2af7d2a1e7930b1b00cd8cdb4
Python
2,685
86
from fractions import Fraction import networkx as nx from elasticai.creator_plugins.grouped_filter import ( FilterParameters, GroupedFilterIndexGenerator, ) def build_graph_for_filter_channels( filters: tuple[FilterParameters, ...], ) -> nx.DiGraph: g = nx.DiGraph() def create_idx_generator(cha...
5a93d8481006622b3a4123f34e2e8e58217665b0c3c632329d81a0b3342e90b1
Python
2,686
68
import tempfile import os import unittest from torcheeg.model_selection import TrainValTestSplitGroupbyFolder from .test_utils import _make_dataset class TestTrainValTestSplitGroupbyFolder(unittest.TestCase): _splitter_class = TrainValTestSplitGroupbyFolder _parameters = {} _fold_count = 1 _group_co...
95cdbae0592cf47c76aa5ac09bdc25f388416e36f25b793e04fdc52086e4e861
Python
2,686
66
import argparse import matplotlib.pyplot as plt import numpy as np import os import pandas as pd import plot_likert import seaborn as sns from matplotlib.transforms import ScaledTranslation sns.set_context("paper") sns.set_theme(style='white', palette='vlag') parser = argparse.ArgumentParser() parser.add_argument('...
bb90f0ee22a27373f0d2f509b4be13a0b78193f0ffa0bca34b1837117b228087
Python
2,687
76
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
f5147e45186c9c0c8a5032fafd3a0e015201056ca9f8eb14e9d8bbad21f66360
Python
2,687
78
#!/usr/bin/env python from __future__ import print_function from pybullet_tools.kuka_primitives import BodyPose, BodyConf, Command, get_grasp_gen, \ get_ik_fn, get_free_motion_gen, get_holding_motion_gen from pybullet_tools.utils import WorldSaver, enable_gravity, connect, dump_world, set_pose, \ draw_global_...
ffb163821c68b6839fcd2d00fce26c5dd671162c1ff2316f8a4cd8b2696eef4e
Python
2,687
96
import os import shutil from os.path import join, splitext from pathlib import Path import hashlib def calculate_hash(filename, hash_type="sha256"): """ Calculates the hash of a file. Args: filename: The path to the file. hash_type: The type of hash algorithm to use (e.g., "md5", "sha256", "sha1"). R...
27165228c7b049a0076510653d3d6696341ace7b28a2ab58810e875ed1f95453
Python
2,688
91
from typing import Optional, cast from elasticai.creator.vhdl.code_generation.addressable import calculate_address_width from elasticai.creator.vhdl.code_generation.vhdl_ports import ( template_string_for_port_definition, ) from elasticai.creator.vhdl.design import std_signals as _signals from elasticai.creator.vh...
4228937e4d3fd2509aac8dd1bfad3116bf706431076f41b2cda0973b91140457
Python
2,688
59
#!/usr/bin/env python ## this script creates dataframes from the upper triangle for control distance matrices (age, sex) ## and saves them to a new CSV file ## The dataframes contain the distances values for each pair of subjects. import pandas as pd from pathlib import Path # Load the all pairs list data_dir = Path(...
ef61a88061a7217f0ba51301a5b4bbe0047ef755bd1c4facf483ef957fd6acad
Python
2,688
96
""" Convert an XML particle list into a STAR file Input: - XML particle list - Reference tomogram Output: - A STAR file with particles """ ################# Package import import os import numpy as np import scipy as sp import sys import time from pyorg import pexceptions, sub, disperse_i...
ab83a23e4a975dc5927f333ab7dfeae63fe3b723581caae8828fd79073c74c0b
Python
2,689
75
import pandas as pd import numpy as np from scipy.spatial.distance import pdist, squareform from sklearn.neighbors import NearestNeighbors import itertools as it from multiprocessing import Pool # gastruloid dimensions (as a rectangle) radi = 3. # length = 15. # Mx = 10 My = 20 Mpos = pd.DataFrame([(x,y) for x in np....
25cf07e8c5db7c418b9c99df6005d655c969f6dbeb0b7fe495f270fd39dc24cb
Python
2,690
87
# pylint: disable=too-many-function-args, invalid-name """ ADNI ICA dataset loading script""" import numpy as np import pandas as pd from omegaconf import DictConfig from src.settings import DATA_ROOT def load_data( cfg: DictConfig, dataset_path: str = DATA_ROOT.joinpath("adni/ADNI_data_194.npz"), indic...
739ad644f1a7b000aba9f4965d6c55de12cd77aebec5933fe4e01e081d5c432b
Python
2,690
85
import pytest import os from merlin.core import executor from merlin.core import analysistask def test_task_delete(simple_data, simple_task): simple_data.save_analysis_task(simple_task) assert simple_data.analysis_exists(simple_task) simple_data.delete_analysis(simple_task) assert not simple_data...
c7af753a9abf9a339ff7730ba63954166ca5ddaaafa937bb641edcee56de6252
Python
2,691
66
import torch from .adabound import AdaBound, AdaBoundW from .lars import LARSOptimizer def get_param_list(config, model): if config.train.no_weight_decay_on_bn: param_list = [] for name, params in model.named_parameters(): if 'conv.weight' in name: param_list.append({ ...
ca8b8ea8ba17059736b51c87101ea36468ead9fa39801bee50a6257069e16322
Python
2,691
68
from dataclasses import dataclass, field @dataclass(frozen=True) class Kmer: """ A kmer of length k around a site. """ """ The character used to pad the kmer if it extends past the start or end of the sequence. """ padding: str = field(default="-", init=False) """ The amino acid that kmer is centere...
2854f95b474a83b93b483ee80b4eb756d6cbb61d2cbda7c49a4a50c486e5227e
Python
2,692
88
# Node group ".MN_select_sec_struct" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # Shared by several assets, which import it; not an asset itself. # _build_group() is the source of truth: the docstring, __init__ and accessors are re...
245a8b0cd70364d6f95a89e55cae15f47c0448fa90b0e9121cb0abb9176597a9
Python
2,694
64
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, MaiaEnvironment from common_setup import IssueConfig, IssueExperiment, is_test_run BENCHMARKS_DIR = os.environ["DOWNWARD_BENCHMARKS"] REVISIONS = ["issue535-base", "issue535-v7"] CONFIGS = [ IssueConfig( ...
5b924cd48bf38748e95b4af3de04f9a518b430d403a620e626c5e07453cad368
Python
2,694
79
import torch import torchvision.transforms as transforms from torchvision import datasets from torch.backends import cudnn def CIFAR_data_loaders(args): # Configure device and DataLoader parameters if len(args.gpu_ids) > 0 and torch.cuda.is_available(): cudnn.benchmark = True # Enable cudnn optimizat...
2a64747b83e7b9b059a3b5895342167653bf6efe9061f56bc13b107b9af34bf7
Python
2,695
69
# ********** a running example ********** # initializa a network # and give input to the network # and get the output of the network # and export the data for visualization # commond: python run.py --config /home/zhaomengdi/Project/eworm/Celegans_as_deep_net_net/chemotaxis_net/config.json --randseed 0 import sys sys....
e59400f5977fe293ff08ebc0dcf46f48c5ff23f9868c7122590445ff300c315d
Python
2,695
64
""" Optuna example that demonstrates a pruner for XGBoost. In this example, we optimize the validation accuracy of cancer detection using XGBoost. We optimize both the choice of booster model and their hyperparameters. Throughout training of models, a pruner observes intermediate results and stop unpromising trials. ...
6cc38e02af7e76025c498b099ffebfa0163cf21a22d83febd9a834db981a0209
Python
2,696
98
#!/bin/env python3 ''' Analytical data resembling a spiral excitation wave Alternative implementation by Desmond Kabus Author: Desmond Kabus ''' import numpy as np from typing import List, Tuple from enum import Enum colors = { "SM": "#000000", "SP": "#d9b99b", "UM": "#f5f5dc", "UP": "#ffffff", "...
8bfd8deb454fd7c4f84ccd264024065d509fb853f22eaddfcea5d57d829520ae
Python
2,696
84
import torch import numpy as np from utils.complex_utils import complex_utils as Z def per_image_standardization(image): """ from: https://discuss.pytorch.org/t/per-image-normalization/22141/3 This function creates a custom per image standardization transform which is used for data augmentation...
9b7d15f75fe0c2baea825eb902182724b26a494800e3877538f118db27f2c5e4
Python
2,696
77
"""Tests for cog.input module (Input, FieldInfo).""" import pytest from cog import Input from cog.input import FieldInfo class TestInput: """Tests for Input() function.""" def test_input_returns_fieldinfo(self) -> None: result = Input(description="Test input") assert isinstance(result, Fiel...
ccbe583fb9e19b7dc7abcc89138f1b48548cad9a14fec6cc06712dca938e3392
Python
2,696
65
#----Figure_07_S16_preparation-------------------------------------------------- #------------------------------------------------------------------------------- # This is the code which has to be run in preparation for Figure 07 Panel E and # S18 for the connectivity analysis for Reinhard and Fukuda et al. 2024 #...
39a2881dbcc93dc2d1bcd0716380ceab7276bc5ad3529083ee4cfe7992f518f3
Python
2,697
68
import pandas as pd from scipy.io import loadmat path = '/m/cs/scratch/networks-pm/effects_externalfactors_on_functionalconnectivity/results' hypothesis = 'H7' measure = 'parti-coeff' def convert_array_to_dfs(array, mapping, variables): """ Convert a numpy array of shape (n, 16, m) to a list of m DataFrames o...
d03f6de141849634ffec750bd5a421baea828e4e13041a75d0b4ad4de0ad5ab6
Python
2,697
86
import contextlib import datetime import io import tempfile from typing import List, TypeVar import atheris T = TypeVar("T") class EnhancedFuzzedDataProvider(atheris.FuzzedDataProvider): def ConsumeRandomBytes(self) -> bytes: return self.ConsumeBytes(self.ConsumeIntInRange(0, self.remaining_bytes())) ...
43ea75a4c3f40cd5768e45b21bc519769b920ce0bdccf653873bb212c26909fe
Python
2,698
77
import inspect import pkgutil import importlib from typing import Set, List import merlin from merlin.plots._base import AbstractPlot from merlin.plots._base import PlotMetadata def get_available_plots() -> Set: """ Get all plots defined within any submodule of merlin.plots Returns: a set of references to t...
22c6abfc8e9a18c1a2c1fb3b9f594bc85a53d99610c4f297fda752f89eb3aa39
Python
2,699
59
#!/usr/bin/env python ## this script creates dataframes from the full distance matrices for control matrices (age, sex) ## and saves them to a new CSV file ## The dataframes contain the distances values for each pair of subjects. import pandas as pd from pathlib import Path # Load the all pairs list data_dir = Path('...
2a65db848cbc1a71d0173d5b8c12a66e739739877f8941f6ffed83d264859fa6
Python
2,699
65
"""Adapter for PyCox survival predictions.""" from __future__ import annotations from abc import ABC import numpy as np import pandas as pd from SurvivalEVAL.evaluations.custom_types import NumericArrayLike from .survival_evaluator import SurvivalEvaluator class PycoxEvaluator(SurvivalEvaluator, ABC): def __...
9a1bd045080a6074e8c2195d30079c73b308b3401fbf7c660e68283d5add9239
Python
2,699
67
from typing import Dict, Sequence, Union import torch from torch.nn.functional import interpolate from ..base_transform import EEGTransform class Resize(EEGTransform): r''' Use an interpolation algorithm to scale a grid-like EEG signal at the spatial dimension. .. code-block:: python from torc...
bbcb3a8ee945e491855db035c50c4606b049e6c8969526375a1a750b672e6d41
Python
2,699
103
""" Test suite for the learning_experiment.py file """ from learning_experiment import LearningExp def test_LearningExp(): e1 = LearningExp.load("data/LearningExp_190501_S5_001_log.txt") N = len(e1.data) all_exposure_data = e1.get_exposure_data() all_guessing_data = e1.get_guessing_data() all_...
bfe66027edc6304242c08e7eb93842c6d9d92a054b55cc353f949d79c06ff6b0
Python
2,699
61
"""The panel widget. Every callback below runs on the GUI thread (the context guarantees it).""" from collections import deque from PySide6.QtGui import QColor, QPainter, QPen from PySide6.QtWidgets import QLabel, QVBoxLayout, QWidget class Sparkline(QWidget): def __init__(self): super().__init__() ...
de847f7f7853d124b2f21decfe608ad50bb1e3e2ff473ea9d7c614443b9f3e1b
Python
2,699
98
import numpy as np def embed_gaussian(d, n=1): """ returns n normal vectors with variance = 1/n, inline with Plate's caluclations :param d: (int), dimensions of the embedding :param n: (int, default=1), number of embeddings to return :return: d-length np.array """ return np.random.normal...
1af9d5775f57df09c3685d8111803537259d19991956d75ad708445b07160b10
Python
2,700
97
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
303874dbabafea91159059a1c2570955b0b97aaef22d3327b38331cb4d67dceb
Python
2,700
110
from __future__ import annotations import pytest prefect = pytest.importorskip("prefect") from ase.build import bulk, molecule from quacc import flow from quacc.recipes.emt.core import relax_job, static_job from quacc.recipes.emt.slabs import bulk_to_slabs_flow def test_tutorial1a(tmp_path, monkeypatch): monke...
d521d96c2afb1c74ca140be58a0034c3a1efb1a83d016534f234d7470ab18edd
Python
2,700
87
import sys import logging import numpy as np from remora import log from remora.model_util import load_model from remora.data_chunks import RemoraRead from remora.inference import call_read_mods class CustomFormatter(logging.Formatter): err_fmt = "> error (remora): %(msg)s" warn_fmt = "> warning (remora): %(m...
44aad1ff4e67bc52c12812d9a8e9afedac1eceec5e8277a49f5b7044a291eb7e
Python
2,701
70
import os import subprocess import numpy as np import pandas as pd import glob import sys from multiprocessing import Pool import multiprocessing ########################### # This script will run SPrediXcan on # dyslexia and rhythm impairment CPM # sumstats. # 10.04.2023 (provided by Yasmina Mekki) ################...
4636ba865da51cab58c88de026f1ab81877535479cd888c273f4f02fc9008a66
Python
2,701
97
# script for testing python video reader to matlab video reader on windows. import cv2 import scipy.io as sio import numpy as np import movies import hdf5storage import os import glob import imageio import logging on_compressed = True dd_all = [] for machine in ['GLNXA64_h06u08.int.janelia.org_R2018a', ...
55ca1a5768eafd7aa878a5b51e22dea092e8d3e869b7c6430143758f3e13d962
Python
2,701
29
"""MEASURE_FIRST_CENSUS.py 2026-10-02. The census's measure-first list: every neuron whose single wrong sign costs at least one odour channel (full rate theory where checked, first order otherwise), ranked by expected harm = chance the model's sign is wrong x channels lost. Output: 06-OUTPUT/release/MEASURE_FIRST_SIG...
5f21057abb58e5fad40d9a92f92eca5278dd8c5e97a8aa32eedd3e22de7500cd
Python
2,701
94
from sys import argv from ase.io import read, write from ase.db import connect from ase.atoms import Atoms import numpy as np def parsedb(dbpath): db = connect(dbpath) # this function adds "has_forces" and "has_gradients" if this is not already stored in the db. # it adds "dummy"-forces or "dummy"-gradie...
5f77312cab09faabd08c966c719a5909c68547147df2a3c7fd83f4840339a2ca
Python
2,701
85
# -*- coding: utf-8 -*- # # central pytest configuration # # Builtin/3rd party package imports import sys import pytest from syncopy import __acme__ import syncopy.tests.test_packagesetup as setupTestModule import dask.distributed as dd import dask_jobqueue as dj from syncopy.tests.misc import is_slurm_node # If acme...
6d9c437ff40ca8a2501665b2fbf4290b0d90a6c044a42857740bb4f411098c28
Python
2,701
75
### Step 1: Define the Python Class import numpy as np import tensorflow as tf from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Conv3D, MaxPooling3D, Flatten, Dense, Dropout from tensorflow.keras.optimizers import Adam from tensorflow.keras.utils import to_categorical class VGGNet3DA...
927a1bb0f0427ab482b5a174b9b36ccdbe7e88487eebe1e2fd74647cb9a2d963
Python
2,701
89
# %% import os os.environ['CUDA_VISIBLE_DEVICES'] = "0" import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch_geometric.data import DataLoader import argparse from metrics import get_cindex, get_rm2 from dataset import * from model import MGraphDTA from utils import * from me...
cc4212e4fea1f2656062ba90868b199a77f812bd7eb79b6919073bf7fe55abe8
Python
2,701
66
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites from downward.experiment import FastDownwardExperiment from downward.reports.compare import CompareConfigsReport import common_setup REPO = common_setup.get_repo_base() REV_BASE = 'issue585-base' REV_V1 = 'issue585-v1' SUITE = ['gripper:prob0...
43a58385cf5a89f52fd25983a3fa966a9e08eacc1945d76ab47c886077b03bd1
Python
2,702
66
import datasets import lightning.pytorch as pl from hicdiffusion_model import HiCDiffusion from lightning.pytorch.callbacks import ModelSummary import os import shutil from lightning.pytorch.loggers import WandbLogger import time import argparse from lightning.pytorch.callbacks import ModelCheckpoint def main(val_chr,...
c7301a0147fd00b9e253fbef6186d2fa6b4a4cce346e590bee73d619575d9092
Python
2,702
102
from baseline import get_unet from glob import glob from PIL import Image from skimage.transform import resize import numpy as np from matplotlib import pyplot as plt from skimage.morphology import label from pycocotools import mask as maskUtils from tqdm import tqdm import os import cv2 from keras.layers import ReLU f...
e4de63451ab6d68050cab2d4db4ba655279450386cc6a36f349683e9f9136960
Python
2,702
72
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
6a1df2be8c6481b74c50d016c52dd2caa714b956a604e49eb96905d904401303
Python
2,703
117
from pertpy.data._datasets import ( adamson_2016_pilot, adamson_2016_upr_epistasis, adamson_2016_upr_perturb_seq, aissa_2021, bhattacherjee, burczynski_crohn, chang_2021, cinemaot_example, combosciplex, datlinger_2017, datlinger_2021, dialogue_example, distance_exampl...
653e622eb24914c2c4ab1f986d01897dd9aa6729cc952bd119cd8806648fbc12
Python
2,704
76
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
bc34fe61fb65722be7652b12aaadc54373c181477255ed3bb56e6451689f5983
Python
2,704
100
#!/usr/bin/env python3 ## this script visualizes the results of the anova movie comparison of the ISC values ## it reads in the results of the anova and visualizes the results on a glass brain ## it also writes the results to nifti files (if needed) ## import libraries import os import pandas as pd import matplotlib.p...
1f82e749ca932840662fe8541f9a068935da6ea2b367f0d811c6f4d16e8d27af
Python
2,706
50
"""FLY_TO_FLY.py 2026-09-30. Pre-registration: 04-NOTES/PREREG-2026-09-30k-FLY-TO-FLY.md Do FlyWire and BANC disagree, or do two runaways disagree? Projection-neuron rates to Seki et al.'s 17 odours, FlyWire (whole brain, HEAD_TO_HEAD rows) against BANC (antennal-lobe cut-out, BANC_TEST rows), under matched sign sets...
2db7ba8f3bc48a2667096ea4d0ebe3211eaf68a65fe178a38ac94f478526b0dd
Python
2,706
48
"""Leak Rate Dynamics: reservoir memory, steering geometry and influence on Qwen at several leak rates. Run from Experiments -> Run Python Script... Edit the settings below first. Nothing in the engine changes: the plugin sets the leak rate (as the RESERVOIR DYNAMICS control does), runs read-only steering probes and, ...
f2688d55a3b686baf412e9700855f7c131c0d162384bd12cb1cdabd89403c4d5
Python
2,707
68
import os import wget url_dict = { "train_pbmc": "https://www.dropbox.com/s/wk5zewf2g1oat69/train_pbmc.h5ad?dl=1", "valid_pbmc": "https://www.dropbox.com/s/nqi971n0tk4nbfj/valid_pbmc.h5ad?dl=1", "train_hpoly": "https://www.dropbox.com/s/7ngt0hv21hl2exn/train_hpoly.h5ad?dl=1", "valid_hpoly": "https://...
1a7b63ce65da98be6de4b99a2d63bb87be238bdaa6e0e91eb92e85a97174b66f
Python
2,708
95
""" Optuna example for fine-tuning a BERT-based text classification model on the IMDb dataset with hyperparameter optimization using Optuna. In this example, we fine-tune a lightweight pre-trained BERT model on a small subset of the IMDb dataset to classify movie reviews as positive or negative. We optimize the validat...
e536224103f006a09d4af8120baadc170b4434830256951671b2b5a1a730e1c5
Python
2,708
78
from sitetack.app.kmer import Kmer class TestKmer: def test_site_to_kmer_site_in_middle_generates_correctly(self): sequence = "ABCDEFGHIJK" site = 6 length = 5 expected = Kmer(site=site, subsequence="DEFGH") actual = Kmer.site_to_kmer(sequence, site, length) assert ...
24d4f70a83626daadf24851ceb69d01e930690c0422737cc4bfc7f18ab92e215
Python
2,709
95
""" Core recipes for EMT. NOTE: This set of minimal recipes is mainly for demonstration purposes. """ from __future__ import annotations from typing import TYPE_CHECKING from ase.calculators.emt import EMT from quacc import job from quacc.runners.ase import Runner from quacc.schemas.ase import Summarize if TYPE_C...
66d9233ef75e7e79c93599e903c2d7a168911231d637fa13772509ec7fa4b430
Python
2,709
86
from examples.pybullet.utils.pybullet_tools.pr2_primitives import iterate_approach_path from examples.pybullet.utils.pybullet_tools.utils import pairwise_collision, get_distance ####################################################### def get_cfree_approach_pose_test(problem, collisions=True): # TODO: apply this ...
8090bd75737e1c8403ea3bb9419254308588ea4ec0bd907e723508553ee33825
Python
2,709
81
import importlib import os from pathlib import Path import numpy as np from torch.utils.data import DataLoader class ChunkDataSet: def __init__(self, chunks, targets, lengths): self.chunks = np.expand_dims(chunks, axis=1) self.targets = targets self.lengths = lengths def __getitem__(...
4f7b68545c7108097c277771e4186c4727bfe24e906c10959f0a087da69be082
Python
2,710
68
import torch import numpy as np from torch.utils.data import Dataset class ConeGeometry(object): """ Cone beam CT geometry. Note that we convert to meter from millimeter. """ def __init__(self, data, index=0): # VARIABLE DESCRIPTION ...
b6d3a66b6661c9ba640ec50eb943d481e07c371228a3605582de43be6cb9f6c0
Python
2,710
86
"""Kolmogorov-Smirnov helpers for distributional calibration metrics.""" from __future__ import annotations import numpy as np from scipy.stats import kstwobign def discrepancy_to_uniform( x: np.ndarray, cdf: np.ndarray, x_support: tuple[float, float] | None = None, ) -> float: """ Compute the K...
c4feb58ddaac50c2a4bf951852a371dd7c30a10d99a6d82cfc13060c3a0187fc
Python
2,710
102
from baseline_aug import get_unet from glob import glob from PIL import Image from skimage.transform import resize import numpy as np from matplotlib import pyplot as plt from skimage.morphology import label from pycocotools import mask as maskUtils from tqdm import tqdm import os import cv2 from keras.layers import Re...
f65e96f268d5ac48c04c1a4b20ee21b33b112400eda4ab5c6f6cb2a6d18e0884
Python
2,710
82
import cocotb import pytest from cocotb.triggers import Timer from torch import asarray from elasticai.creator.arithmetic import FxpParams from elasticai.creator.nn.fixed_point import ReLU from elasticai.creator.testing import CocotbTestFixture, eai_testbench from elasticai.creator_plugins.act_func.utils import load_a...
6bce8cc2d93800f62c35bed431eba96bf1bc5a6358a557e7d091b28e598aa1a5
Python
2,711
108
#****************************************** # # SHARC Program Suite # # Copyright (c) 2023 University of Vienna # # This file is part of SHARC. # # SHARC is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software F...
ee7c66f267afab19b8c671b396d0ad00818ebe8394ec658dc51108325f306713
Python
2,711
58
import torch from .layer import Layer class CoherenceNet(torch.nn.Module): def __init__( self, config_lay1, config_lay2 ): """Initilize Energy predictor module. Args: """ super(CoherenceNet, self).__init__() self.config_lay1 = config_lay...
fb8ad91bf5dbc7cb418f18e68feba7af6e9908b11087be629d527da6991235ec
Python
2,711
66
supervised_learning = False options = dict(requires_training_frame=False, model_extensions=['h2o.model.extensions.Contributions', ]) def class_extensions(): @staticmethod def from_file(file=str, model_id=None): """ Creates new Generic model by loading existing embedded model into library, e.g....
6352ba156bd84c1d70b9ada99c051d3213ab801649a26dbf12ec479ce32697f2
Python
2,712
87
# -*- coding: utf-8 -*- # @title Compare emulation in software and hardware # @file validation.py # @author Romain Beaubois # @date 06 Oct 2023 # @copyright # SPDX-FileCopyrightText: © 2023 Romain Beaubois <refbeaubois@yahoo.com> # SPDX-License-Identifier: GPL-3.0-or-later # # @brief # ...
6ed9061d0365f9af220eb37e9b01cf8ec44be18089242c9d5ccbbfcb5d774db3
Python
2,712
110
"""Init data for quacc.""" from __future__ import annotations import logging import threading from importlib.metadata import version from typing import TYPE_CHECKING from ase.atoms import Atoms from pymatgen.io.ase import MSONAtoms from quacc.settings import QuaccSettings, change_settings from quacc.types import De...
e377522d19d60a846b9c0e40533b5cf3481f4b40c403650b2cf4f9e304451149
Python
2,712
100
#!/usr/bin/env python # -*- coding: utf-8 -*- """ """ import matplotlib.pyplot as plt import numpy as np NUM_PHASES = 1 in_name = 'x' hid_name = 'h1' out_name = 'o' hid_T_p = 'h1T+' out_T_p = 'oT+' hid_T_m = 'h1T-' out_T_m = 'oT-' phase_in = 1 phase_hid = 2 phase_out = 3 phase_err = 4 phase_W2pot = 5 phase_W2dep = ...
3cfaab03261d032b75983a36655cdadc9e7fedf9a15abb43ed3b219c2edbbb90
Python
2,713
74
# flake8: noqa # There's no way to ignore "F401 '...' imported but unused" warnings in this # module, but to preserve other warnings. So, don't check this module at all. # Copyright 2021 NVIDIA Corporation and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"...
5b24b3556b6d55ceb1f5c7550129cb981f3ac915e4f311a1af2dd45f23886eae
Python
2,714
71
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. def test_esm_if1(): import json import numpy as np from pathlib import Path from scipy.stats import special_ortho_group f...
5e8b220631f8cd772e0816bf1d4294e16f615616718d6d64a7882d2588c9ba49
Python
2,714
75
"""Some standard gradient-based stochastic optimizers. These are just standard routines that don't make any use of autograd, though you could take gradients of these functions too if you want to do meta-optimization. These routines can optimize functions whose inputs are structured objects, such as dicts of numpy arr...
a49409db9331c0c327d20777accb41cd326c9bfafd04da29e47b61d7f0ee39e0
Python
2,714
92
import numpy as np from hippo.environments.w_maze import WmazeTasks from hippo.agents.prefrontal_agent import LocationRewardMerger tasks = [ [0, 1, 2, 1], # LCRC [0, 1, 0, 2], # LCLR [2, 1, 2, 0], # RCRL [0, 1, 0, 1], [0, 2, 0, 1], [0, 2, 0, 2], [0, 2, 1, 2], [1, 0, 1, 0], [1, 0,...
a75601a26e46a80b0ac1e02a544142dfc676c50eb862be55f83b0e5052bad372
Python
2,714
99
# Node-group asset "Get Geometry Atoms" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump. from typing import TYPE_CHE...
df76d3612dbb27d0fbb8aa331d640716f36e04399ad87c12a3f66d1f7944c313
Python
2,714
90
from tqdm import tqdm from os.path import join as pjoin import pandas as pd import os from scipy.stats import zscore import argparse from nilearn.masking import unmask import logging from dimension_encoding.utils import load_clip66_preds, load_singletrial_data from dimension_encoding.glm import LinRegCVPermutation d...
30b870aa51903d46893349db50f507456261f2e8ff649c0153c65bdc365f5a38
Python
2,715
42
# -*- coding: utf-8 -*- import argparse from supar import VISemanticDependencyParser from supar.cmds.run import init def main(): parser = argparse.ArgumentParser(description='Create Semantic Dependency Parser using Variational Inference.') parser.set_defaults(Parser=VISemanticDependencyParser) subparser...
34e54a5a7f88b07355444b9a8b3c2c6e5d772264e93e39fe494ed1b0fedaf6e9
Python
2,715
100
# Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master...
51da23a00cbfa85ccb5f9a990ae589aef29e9988d25878b627ce6ace7af8ebd8
Python
2,715
75
""" Library to handle snapping coordinates to an mri surface (defaults to pial surface, but customizable) """ import os from config import RHINO_ROOT import numpy as np import nibabel as nib from scipy import spatial def get_raw_coordinates(filename): """ Gets coordinates from a "RAW_coords" file Meant to ...
df3b23709d2b02bc93afbe038e0437009ca99bc858f80d16f843cf67c979222e
Python
2,715
75
# ---------------------------------------------------------------------- # Copyright (C) 2016, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This program is free software: you can redistribute it and/or mo...
580f03399e02f987e2be4ca39d41321a81a47f9399580ea7c75c3709893b0328
Python
2,716
84
"""SVM decoding from microsaccade-rate features. The paper reports ~85% accuracy on a face-vs-non-face binary task using linear classifiers on the binned-rate feature vector. This module wraps that recipe in a thin scikit-learn pipeline so callers don't have to assemble it themselves. """ from __future__ import annot...
76d4dadc97b30120a7f5641360541d0ac6a7ff193cf8e77f1b30fbce1726ed77
Python
2,716
88
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: emma """ from numpy.random import seed seed(1) import tensorflow as tf tf.random.set_seed(1) import random random.seed(1) import numpy as np import pandas as pd import tensorflow as tf import SimpleITK as sitk from tensorflow.keras.utils import to_categorical...
66ee1581426fef1fbc083bbe46cda40c4cab6f104fb53ff45295dc1fd46d2d88
Python
2,717
74
# -*- coding: utf-8 -*- """ Created on Sat May 22 16:14:08 2021 @author: Maddox """ import numpy as np from expyfun.io import read_hdf5, write_hdf5, read_wav # opath = 'C:/Users/Maddox/Code/Experiments/pip_speech_shift/' opath = '/mnt/data/peaky_pitch/stimuli/slices/' click_root = 'clicks_{}.hdf5' speech_...
75fe61bf86fb7de541650ba3d535a1e51ec960f3b8cb1cad5a6c92f56b73156c
Python
2,717
71
# set QT_API environment variable import os os.environ["QT_API"] = "pyqt5" import qtpy # qt libraries from qtpy.QtCore import * from qtpy.QtWidgets import * from qtpy.QtGui import * import control.utils as utils from control._def import * import control.tracking as tracking from queue import Queue from threading im...
2648863831f571421905905206a473da29208c2b16ac33a2e792d201cb201bd4
Python
2,718
73
import numpy as np import pytest from scipy.interpolate import interp1d import SurvivalEVAL.evaluations.others.area_under_pr_curve as auprc_module def _scipy_cdf_row(cdf, times, targets, left_fill=None): return interp1d( times, cdf, kind="linear", fill_value=(cdf[0] if left_fill i...