sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
b88dc09efe966d303c6689381469ff7e3a11e63bce3cebaa63855d9ca7c4694e
Python
1,868
59
import torch.nn as nn from torch import Tensor from torch.nn import init from custom_layers.custom_dropout import Dropout from custom_layers.custom_module import BatchEvalModule class Dense(BatchEvalModule): # A dense layer following the idea of Tensorflow def __init__(self, in_features, out_features, activa...
62b88504a3a1db4f9fb5b5cf2cd988b9a1bfb2f9478422fb894eeab4d598c122
Python
1,869
73
# Figure 2 import numpy as np from scipy.constants import epsilon_0 as e0 import impedancefitter as ifit from impedancefitter.single_shell_wall import eps_cell_single_shell_wall from impedancefitter.suspensionmodels import bhcubic_eps_model, eps_sus_MW em = 5.0 dw = 250e-9 Rc = 2.75e-6 - dw dm = 7e-9 km = 0.0 kcp = ...
cb0a1ad008f67585d04394476f9dc070dbf897cf64022fba4afaa6fd2ebf8579
Python
1,869
50
from brainscore_vision.model_helpers.check_submission import check_models import functools import os from urllib.request import urlretrieve import torchvision.models from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_prepro...
571e73b8fdcc5e9608ae7e5f408aac8e15979e4d222ba2c6ecc0a2d877c882bd
Python
1,870
51
import torch def sinkhorn(feature1, feature2, pcloud1, pcloud2, epsilon, gamma, max_iter, sim_k=50, dist_k=10): feature1 = feature1 / torch.sqrt(torch.sum(feature1 ** 2, -1, keepdim=True) + 1e-8) feature2 = feature2 / torch.sqrt(torch.sum(feature2 ** 2, -1, keepdim=True) + 1e-8) S = torch.bmm(featur...
b0721065839963a9be7a90cd2a6840770e7786f9ae6552b075a886e7b2c1ab22
Python
1,870
71
import sys import genutils3 import os from optparse import OptionParser USAGE = """ extract-50mers.py --fai <.fai file> --fa <fasta file> --outdir <out dir for kmer files> prints out 50mers with step of 5. """ ############################################################################### parser = OptionParser(U...
fa7effe96063f17af0d91f9acfe4f8e19581369ce051d8e0246e4416a323888d
Python
1,870
45
import numpy as np from brainscore_core import Metric, Score class Dimensionality(Metric): def __init__(self, factor): self.factor = factor #factor to return def __call__(self, assembly1, assembly2) -> Score: #each assembly should have 3 dimensions: (factor, sample_num, neuron_i) dims...
ac316a19690b9800ce1c628f5ad3f3cadd4b8e52272410d9bc1b866564d27218
Python
1,871
50
from brainscore_vision.model_helpers.check_submission import check_models import functools import os from urllib.request import urlretrieve import torchvision.models from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_prepro...
f9529243b9099509407b47d13592368265b834c51b3283b45033485dc0bd1107
Python
1,871
89
""" Utility functions for working with `Bitset`s and treating lists of (start,end) as `Bitset`s. """ from bx.bitset import ( BinnedBitSet, MAX, ) def bitset_intersect(ex1, ex2): bits1 = list2bits(ex1) bits2 = list2bits(ex2) bits1.iand(bits2) return bits2list(bits1) def bitset_subtract(ex1, ...
08fcdfe9a7135a93e3a867e6fbc6c55fab66cdac1be4d30706a11010d87686ee
Python
1,872
53
import os import json #TODO change results dir def setup_paths_and_config(config_path, result_dir_name = 'results', root_dir=None, transfer=False): if root_dir is None: root_dir = os.path.dirname(os.getcwd()) data_dir = os.path.join(root_dir, 'data') result_dir = os.path.join(root_dir, result_di...
99add8b28486ec1650775864b0f593cd016e10f51221770286fbfe6a6c4f169f
Python
1,872
50
from brainscore_vision.model_helpers.check_submission import check_models import functools import os from urllib.request import urlretrieve import torchvision.models from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_prepro...
df0c41a95600a1c0d8b18802056628bf122d834e2bb5fcf76e998038badac4dd
Python
1,872
79
""" nelpy core objects ``nelpy`` is a neuroelectrophysiology object model and data analysis package. """ # __all__ = ['IntervalArray', # 'EpochArray', # 'RegularlySampledAnalogSignalArray', # 'SpikeTrainArray', # 'BinnedSpikeTrainArray', # 'EventArray'] # ...
b9339cb20cc828c86fb184bdfb7c16053a3e00d7a46f2f58bd4e651759caf292
Python
1,874
53
from typing import List class OperationalUnit: def __init__( self, input_precision: List[int], output_precision: int, unit_cost: float, unit_area: float, ): """ General class for a unit that performs a certain operation. For example: a multiplier unit. ...
e3cecc1b0017241126fabd24a627e15173df26dad427bc20832472747a32ca29
Python
1,874
22
from testsetclass import TestsetClass class CARBHB12(TestsetClass): def __init__(self): self.weak = 1.0 self.molecules = ['2O_A', '4N_A', '4CL', '4CL_A', '1N_A', '1CL_A', '3O_A', '3CL_A', '2CL_A', '4O_B', '2N_B', '3CL', '1O_B', '1O', '2N', '2O', '3N_B', '1N', '3O', '2O_B', '4N_B', '4CL_B', '3N', '...
8fa93bd8c096701efc800f7191ed6338a0c9371c820b0c19af1ae48be9c87fbb
Python
1,875
58
# 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...
98b573d35df0b781b5079a6aa99b9312ffe22cfc38912672e582412961676b63
Python
1,875
69
import SimpleITK as sitk import os import sys dir_script = os.path.dirname(os.path.abspath(__file__)) loc_atlas_gm = os.path.join(dir_script, "grey.nii.gz") loc_atlas_wm = os.path.join(dir_script, "white.nii.gz") loc_atlas_csf = os.path.join(dir_script, "csf.nii.gz") loc_exclude = os.path.join(dir_script, ...
bebfd6c6140bf4c36fec2367df0bf23f527e7ba5cb2f76a43445f9ef45d85a41
Python
1,875
46
#!/usr/bin/python """ Gamepad310 HAL module. Hazen 04/18 """ import storm_control.sc_hardware.baseClasses.joystickModule as joystickModule import storm_control.sc_hardware.logitech.gamepad310 as gamepad310 class Gamepad310Module(joystickModule.JoystickModule): def __init__(self, **kwds): su...
2d90563b8a5f1ddf73432342b5f646642da4f78ed30cb9c5375f383e2f9672d7
Python
1,876
59
import utils import argparse from os.path import join import keras from keras.models import load_model import numpy as np import gc ''' get average of ensemble predictions for X_train to generate new y_train new y_train will be used to train an ensemble distilled model ''' def parse_args(): parser = argparse.Argu...
55a8ec50193aa4e1c37a593c4d2c474ea43cb73e55252bbb86d256b75a266cde
Python
1,876
50
import torch import torch.nn as nn import numpy as np class InputSpikes(nn.Module): def __init__(self, opt, prec_type=torch.float32): super(InputSpikes, self).__init__() self.prec_type = prec_type self.opt = opt if opt.n_rnn_in == 200: p_stim = 0.5 elif opt.n_rn...
5e90fa63cd36d5a9ed24cfa8715ef6194428997e418341df28aa0f6b31b9d47d
Python
1,876
51
# Copyright (c) OpenMMLab. All rights reserved. import warnings import torch.nn as nn import torch.nn.functional as F def resize(input, size=None, scale_factor=None, mode='nearest', align_corners=None, warning=False): if warning: if size is not None ...
9edc6b0beab2c3e6852802f1e7bcaceb49e12d9736da80fd24bafc46c33eba59
Python
1,876
45
from brainscore_vision import stimulus_set_registry from brainscore_core.supported_data_standards.brainio.s3 import load_stimulus_set_from_s3 BIBTEX = """@article{hendrycks2019benchmarking, title={Benchmarking neural network robustness to common corruptions and perturbations}, author={Hendrycks, Dan and Dietterich...
aaeb0b59f06b7a92b314891e1b1212d12e4a9ea46065d7b6095ea6705e677f87
Python
1,876
57
import numpy as np from impyute.ops import matrix from impyute.ops import wrapper from impyute.ops import error @wrapper.wrappers @wrapper.checks def locf(data, axis=0): """ Last Observation Carried Forward For each set of missing indices, use the value of one row before(same column). In the case that the...
26d930f04d826f2a53695096d4f5eeacd82ea8e005df580bb8a34cdfbc29f257
Python
1,877
71
"""Configurations to train a MultiRNN model on MSI task. See ../models/multi_rnn.py for model details. """ from models import multi_rnn import msi_task import torch import trainer def model_config(): config = { "constructor": multi_rnn.MultiRNN, "kwargs": { "input_feature_len": 3, ...
2ee5d827d93e32e790f2a303ef371c308c6f65e7d33ab1def10de89dc34a1259
Python
1,877
60
import pandas as pd import re human_data = pd.read_csv('human_data_normal/human_data.csv') images_shown = pd.read_csv('human_data_normal/images_shown.csv') human_data["image_shown"] = "FILL" columns = {"Participants 1-7": [1,2,3,4,5,6,7],"Participants 8-13": [8,9,10,11,12,13], "Participants 14-19": [14,15,...
3267c7c38c193f260d84615942eb684b2f7b104be33f9ee571ea0383463eab47
Python
1,878
63
''' 1. Load brain phantom 2. Add Rician noise 3. Denoise using denoise algorithm 4. Check that sum of squared residuals decreased after denoising ''' import os import numpy as np from phantoms.brain.sim_brain_phantom import simulate_brain_phantom import nibabel as nib import matplotlib.pyplot as plt from src.original....
3cf679dc394416471596710dfa464a82b8bf414dfaaad900ce3f7338a7554909
Python
1,878
51
from chemgraph.schemas.multi_agent_response import PlannerResponse def test_planner_response_accepts_full_payload(): payload = { "thought_process": "Decomposing into per-molecule calculations.", "next_step": "executor_subgraph", "tasks": [ {"task_index": 1, "prompt": "Calculate...
e6b905767023f0fa68fac31d770ca1e3ceab7424376db94b3a26f48a7061029e
Python
1,878
50
from brainscore_vision.model_helpers.check_submission import check_models import functools import os from urllib.request import urlretrieve import torchvision.models from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_prepro...
fd09c43400cf902c8ff2c77538c4ab5a171bc3ada5fb328baa58d3ece4224714
Python
1,878
44
from tests.common import * def test_dryrun(demo_dir): r = run("snakemake -n -c1", dir_path=demo_dir) message = "This was a dry-run (flag -n). The order of jobs does not reflect the order of execution." assert message in r.stdout def test_pipeline_no_run(demo_dir): LOGGER.info("run entire pipeline wit...
012abbbc654b49d0a06ad5eafd7762b73897f53d6ba820b48710395fc22bec47
Python
1,879
42
import numpy as np import pytest from brainscore_core.supported_data_standards.brainio.stimuli import StimulusSet from brainscore_vision import load_stimulus_set, load_dataset from brainscore_vision.model_interface import BehavioralAssembly @pytest.mark.memory_intense @pytest.mark.private_access class TestHebart2023...
8031a592e3d8ff2e008e8c3d02652bba795315e4e3b8fc047552aa274ae79244
Python
1,879
60
import unittest import warnings from unittest.mock import patch from neuralib.imglib.io import tif_to_gif, gif_show from rscvp.retinotopic.cache_retinotopic import RetinotopicCacheBuilder from rscvp.retinotopic.main_retinotopic_map import RetinotopicMapOptions from .util import check_attr class TestRetinotopicModule...
80e520a90fd8fb6e6d58925dc7808a0930179d35860131908e4035aaaa15f869
Python
1,879
50
# %% ### import modules from pathlib import Path import seaborn as sns import pandas as pd from matplotlib import pyplot as plt import bap1b.figures as figures # %% read results table results_dir = Path(__file__).resolve().parents[1] / "results" df = pd.read_excel(results_dir / "cs_a_results.xlsx") # %% round all ...
82b8d42930389fcd2a39e639354ce50312bceeae162595cd2e7056d805a4f024
Python
1,879
47
#create_toy_computational_sequence.py #this example shows how to create two toy computational sequences and put them together in a dataset import mmsdk from mmsdk import mmdatasdk import numpy def random_init(compseq,feat_dim): for vid_key in vid_keys: num_entries=numpy.random.randint(low=5,high=100,size=1) com...
0332f6233fa48ebda38b7b930e1b910166e17dc3af6898f2da5ddced9ecc9764
Python
1,880
50
from brainscore_vision.model_helpers.check_submission import check_models import functools import os from urllib.request import urlretrieve import torchvision.models from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_prepro...
08ef5b276d5fa90bbc146689075b529d29302c81dc5e21f5e9d8be76f8c91449
Python
1,880
56
#!/usr/bin/env python3 import argparse import numpy as np from ase import Atoms from ase.io import read, write from ase.optimize import * from KerNNCalculator.KerNNCalculator import * ''' Script to calculate the potential energy of a structure. Usage: python predic_mol.py -i structure.xyz ''' #parse command line argu...
16d186094fa71449f826556e7dc7b91b4d60b1f5e534e500cb1401e6c7a03c7a
Python
1,880
84
""" File I/O utilities for DHG-LGB framework. Provides standardized loading and saving functions for various file formats. """ import os import pickle import numpy as np import yaml from typing import Any, Dict def load_config(config_path: str) -> Dict[str, Any]: """ Load YAML configuration file. Param...
f7f37b8ed8b2e3d8973e0af893ff264acef7d589261cd4fcca7d895d205c0971
Python
1,880
63
from nipype import IdentityInterface, Function import definitions from PUMI.engine import NestedWorkflow as Workflow from PUMI.engine import NestedNode as Node from nipype.interfaces import BIDSDataGrabber from nipype.utils.filemanip import list_to_filename import os from PUMI.pipelines.func.deconfound import despikin...
fdfcefa398d4f5cb52bb798a6265bf7f9ffa48c753aa14c1e4b756c92f293ee6
Python
1,880
60
#!/usr/bin/env python import json import sys import os import pandas as pd # Read config file def read_config_file(config_path): with open(config_path, "r") as f: config = json.load(f) return config # Concate the different dat files ## all these files should be formated the same way. Column header are s...
6b203a1268fcbed8eaa8d46e55978b9c374c40744962d7b8447a17612b5c3f37
Python
1,881
54
"""Regression test for grouped node-cartography composition plots. Run with:: uv run python -X utf8 python/test_node_cartography_proportions.py """ from __future__ import annotations import tempfile from pathlib import Path import numpy as np import pandas as pd from meanap.pipeline.plotting_step4 import ( ...
962757598504d0936466dbb1d8249d959b79d41e12c9d64495b8a2c61e0ec8ef
Python
1,881
44
import numpy as np from brainscore_vision import load_ceiling, load_metric, load_dataset from brainscore_vision.benchmark_helpers.neural_common import NeuralBenchmark, average_repetition from brainscore_vision.data.sanghavi2020 import BIBTEX_SANGHAVI from brainscore_vision.utils import LazyLoad VISUAL_DEGREES = 8 NUM...
14bf895fea444e76142849835a95c739534298f0fcd4723033f0310db7ac47a4
Python
1,882
63
# -*- coding: utf-8 -*- # python standard library inputs import os # external inputs import numpy as np import nibabel as nb def clean_ana(file_in, min_value, new_range, overwrite=True): """Clean ana. This function removes ceiling values from a computed T1 map of an mp2rage acquisition. Low intensity ...
59fe8d242dedfad3a066d6fa054e46d73b1ada58db618ac8c279f002924459ae
Python
1,882
55
from ..qt import * from ..pipeline.data_widget import NodesModel, ChannelComboBox class TouchDialog(QWidget): def __init__(self, config, stub): super().__init__() self.setWindowTitle('Touch Input Config') nodes_model = NodesModel(config['nodes']) if 'touch_config' not in config: config['touch_...
68846e1f2ab1a34fdacd70b16d69f09c2439118f75deafa02364d6b19b1cd21c
Python
1,882
53
import argparse from pathlib import Path import pandas as pd import SimpleITK as sitk # parse the arguments parser = argparse.ArgumentParser( prog='Inference Script for the FeTA Challenge Submission', description='Runs inference on an input image and\ s...
b4c478715a86c4a73ec492370700d9fc21d167266b8c0328fb2cfc9a8cb280df
Python
1,882
61
import torch.utils.data as data_utils import torch from PIL import Image import numpy as np import random import glob import os from Utils import utils Map = { 'tumor': 1, 'normal': 0 } utils.seed_torch(seed=0) class Dataset_test(data_utils.Dataset): def __init__(self, path, transforms=None, padding=0, b...
0dc4d4d132af8c0f031009caeecba965de73cb31bec016bae54807446fe45773
Python
1,883
64
import torch import numpy as np import scipy.sparse as sp from sklearn.neighbors import kneighbors_graph from sklearn.neighbors import KDTree from scipy.sparse.csgraph import dijkstra from typing import Union def construct_knn_graph( points, k: int = 10, ) -> sp.csr_matrix: n, d = points.shape if k >=...
22b2ad9a1ef5fe92ba16c6b1cbc04e56118129469b54dfd6950f39c3ccfaafc2
Python
1,883
43
from argclz import AbstractParser, argument, as_argument from neuralib.atlas.ccf.matrix import load_transform_matrix, SLICE_DIMENSION_10um, slice_transform_helper from neuralib.plot import plot_figure from neuralib.util.verbose import publish_annotation from rscvp.util.cli import HistOptions, CCFOptions __all__ = ['Sl...
97c9d94a729f5d29b714f7adef324f4243e5979d42f406455e59ece66cc7ccb0
Python
1,883
63
#!/usr/bin/env python import argparse import sys parser = argparse.ArgumentParser(description="") parser.add_argument("bam", nargs="?", help="input bam file", type=argparse.FileType('r')) parser.add_argument("ref", nargs="?", help="input bam file", type=argparse.FileType('r')) parser.add_argument("outfile",nargs="?"...
f7830bb7de5e0c2b32e9f39f71e636749ebe11367dd0d80431eca0f93b8a1a39
Python
1,883
75
# -*- coding: utf-8 -*- """ Provides tools for timing """ #:copyright: Copyright 2015 by Christoph Kirst, The Rockefeller University, New York City #:license: GNU, see LICENSE.txt for details. import time class Timer(object): """Class to stop time and print results in formatted way Attributes: ...
d852cdf993ca90b10e8a7b0bc6f56c46f7dc607a9e92136a6a57368f363185de
Python
1,884
74
import unittest import numpy as np import torch import torch.testing as ptt from deepdwi import util from deepdwi.dims import * if __name__ == "__main__": unittest.main() devices = [torch.device('cpu')] if torch.cuda.is_available(): devices.append(torch.device('cuda')) class TestUtil(unittest.TestCase):...
814e8ae0a6041aee30beae0b22440ec1b39ef6ad2a5e23ba4ad5982c39fc7f1d
Python
1,885
84
import argparse import sys from collections.abc import Callable, Generator from contextlib import contextmanager from eir import __version__ from eir.predict import main as main_predict from eir.train import main as main_train @contextmanager def patch_sys_args(patched_args: list[str]) -> Generator[None]: old_ar...
91045a174d59dfa79f4d408e0cd20eac3a71d152e5b68694bc32a3f95ba370bf
Python
1,886
55
import torch from torch import Tensor @torch.jit.script def baked_embed_to_prob( embedding: Tensor, baked_skeletons: Tensor, sigma: Tensor, eps: float = 1e-16 ) -> Tensor: r""" N Dimensional embedding to probability with a baked skeleton array Calculates a probability :math:`\phi` based on a euclidea...
0f50cb325eefd32903cbd408f4632700b28b449f6d9f32fb5ef7a0e4de54acef
Python
1,887
67
from qtpy.QtWidgets import ( QVBoxLayout, QHBoxLayout, QLabel, QLineEdit, QWidget, QGroupBox, ) import napari from typing import TYPE_CHECKING if TYPE_CHECKING: import napari class OutputDataLayout: def __init__(self, viewer: "napari.viewer.Viewer"): self.viewer = viewer ...
5b248210c7e6fe9144facee57572cf3714a81e0b00823903de8b45daf1e8e5b1
Python
1,887
68
""" Surface edits """ import SVMTK as svm from pathlib import Path if __name__ == "__main__": print("Start ",__file__) outdir = Path("results") outdir.mkdir(exist_ok=True) sphere1 = svm.Surface() sphere2 = svm.Surface() sphere5 = svm.Surface() # Create two spheres # First sphere ce...
9b080aba9cec24bed8fc62f390f55a6dcb70f7826b04b56a7058825ee729e8db
Python
1,887
52
# Copyright (C) 2019-2022 Intel Corporation # Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import shutil from datumaro.components.dataset import Dataset from cvat.apps.dataset_manager.bindings import ( GetCVATDataExtractor, detect_dataset, import_dm_annotations, ) from cvat.apps.dat...
aee597504132fb381fbf6a6a13d6eb70acf745b2627008f0fe9215b90e9f8792
Python
1,887
55
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # Adapted from https://github.com/facebookresearch/segment-anything from setuptools import find_packages, setup from setup...
0ceb0732ab011c0cf179298a5d6eba2210dfdd747a39a80fe8cafdd0b480b2ac
Python
1,888
60
from collections import OrderedDict from typing import Dict, NamedTuple import numpy as np from numpy.typing import NDArray from patsy.design_info import DesignMatrix # type: ignore class StateMapping(NamedTuple): mapping: Dict[str, int] reverse: Dict[int, str] encoding: NDArray[np.float32] idx: NDA...
792560a53355239742a161dc37315e21013ab5a16567b0efb41b9f7076675107
Python
1,888
50
import pyvisa as visa import pyvisascope import multitimer import time import yaml import logging visa.log_to_screen('INFO') logger = logging.getLogger('pyvisa') log2file = logging.FileHandler('experiment.log') logger.addHandler(log2file) def main(): # enter here the ID of your device. On windows, VISA you c...
bba39c43c4a799fd88b966648ae3a27d4f6eccc9d086dbf737b750b9d5542474
Python
1,888
62
import random from analognasbench.data import AnalogNASBench, DriftMeasurement def random_search_analog_nasbench( num_samples=100, objective_metric='analog_drift_86400', seed=42 ): """ Perform a random search over the AnalogNASBench to find the architecture with the best (maximum) 'analog_drift...
bfc9a7ca7aef2c6ccfcd78062007bbb9af5147b0667faf80d688288311e25251
Python
1,888
53
""" Task-difference control analysis. This script tests whether a task-difference IBS change variable explains the same cooperation-gain outcomes. It is intended as a control analysis to show that the main brain-behavior association is specific to cooperation-related IBS. """ from pathlib import Path import pandas as...
81d478b729310c7da92c5c1f58585e68d4172021c033c874dc5a18540f584e31
Python
1,889
52
import os import pytest import numpy as np import SimpleITK as sitk import torch from pathlib import Path @pytest.fixture def test_data_dir(): """Return the directory with test data.""" return Path(__file__) / "test_data" def dice_loss(pred: torch.Tensor, target: torch.Tensor, smooth: float = 1e-5, reduce: bo...
91c7ac4eeea396098279e3e93b10d03a7561c41fc6b99f62bbd76cef62843917
Python
1,889
68
import os import os.path as osp import ssl import sys import urllib from typing import Optional import fsspec from torch_geometric.io import fs def download_url( url: str, folder: str, log: bool = True, filename: Optional[str] = None, ): r"""Downloads the content of an URL to a specific folder. ...
b1fd7356cf063a4f9b929ddae70ae8b2749e57e46edf6904f415e36ab3d5a7e2
Python
1,889
70
import os import glob from ._prediction_widget import PredictionWidget from ._training_widget import TrainingWidget from ._log_widget import LogWidget from ._data_transform_widget import DataTransformWidget from qtpy.QtWidgets import ( QVBoxLayout, QHBoxLayout, QTextEdit, QLabel, QPushButton, QComboBox, ...
27228afd2138e2cd42774d8b65f2da639821c0aa892d1e372e6652c755fc4ffe
Python
1,890
57
# Load a triangle graph, and calculate the distance to the edge of the graph for every triangle. # Use the pycurv triangle graph tools to identify the edge, the calculate minimum geodesic distance # from each triangle to the edge. from pycurv import TriangleGraph, io from graph_tool import load_graph from scipy.spat...
8598c944253a33fbb1b71eb1b5a3fe77c29cf931bb332d731367036eb4492e0c
Python
1,890
77
#!/usr/bin/env python2.7 import sys import numpy import math from lowess import lowess import struct GC_normalize = sys.argv[1] normalize = open(GC_normalize,'r') x = [] y = [] stdev = [] i = 0 ave = 0 count = 0 maxCov = 0 for line in normalize: arr = line.split() x.append(float(arr[0])) y.append(float(arr[1])) ...
3e630995bd99d43c17250266409f2b636815c4156d6b068192fdfc8fc2cd0fc4
Python
1,891
51
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import json import os import tempfile from scilpy import SCILPY_HOME from scilpy.io.fetcher import fetch_data, get_testing_files_dict # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys='surface_vtk_fib.zip') tmp_d...
e498900bbddac08602208d6b433f1639ffa3b592b874d0c50e25bb842139f6cf
Python
1,891
71
import os import sys import json """ Dumps ARA JSON as a flattened file that we can feed into our tree reader """ def is_valid_json_file_path(fname): if not os.path.exists(fname): print("Can not find file " + fname) return False if not fname.lower().endswith('json'): print("Data shou...
2585797635f8f45d50c16d15aaca7e9a11a736d9120da41abe7c81bf0e24e8dc
Python
1,892
39
#!/usr/bin/env python3 import pandas as pd import argparse import os parser = argparse.ArgumentParser(description='Aggregate RNA-SeQC metrics from multiple samples') parser.add_argument('input_files_tsv', help='TSV file with paths to metrics files') parser.add_argument('prefix', help='Prefix for output file name') par...
5bb341bca7ca5520ed75ba56d36ee6afb06be68906360a85e73a17e231e93bd8
Python
1,892
70
from collections import defaultdict import torch import torch_geometric.typing from ._compile import compile, is_compiling from ._onnx import is_in_onnx_export from .index import Index from .edge_index import EdgeIndex from .seed import seed_everything from .home import get_home_dir, set_home_dir from .device import ...
6dcf8ea0fde61413f52f8a03e5bd6f3fd1524f490b91744c77614c9d68137c1b
Python
1,892
61
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations import json from pathlib import Path from ultralytics.utils import LOGGER def onnx2mnn( onnx_file: str, output_file: Path | str, quantize: int | str | None = None, metadata: dict | None = None, ...
6eefc1299be2ec0968f55589079ee4542a4ca69ca192e45e9b1f0f98dbb4eff4
Python
1,892
65
import glob import os.path import numpy as np import skimage.io as io import torch import zarr from torch import Tensor def convert(base_dir): if os.path.isdir(base_dir) and not base_dir.endswith(".zarr"): files = glob.glob(os.path.join(base_dir, "*.trch")) else: files = [base_dir] print(...
0b7d0707ae5eb3bf0fdfaab3f3defd7d49d0d08241a8e5f4adb3a03c15272ab4
Python
1,893
59
# 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 import os from datetime import datetime # -- Project information ---------------------------------------------------...
1ce8846b8c6fc499e1e97f53d076e18185bc2c2f075b9074510b651ae57a2cff
Python
1,893
81
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import io import warnings import tqdm from cvat_sdk.core.helpers import DeferredTqdmProgressReporter, TqdmProgressReporter from cvat_sdk.core.progress import NullProgressReporter, ProgressReporter def _exercise_reporter(r: ProgressReporter) -> Non...
94039e9cbadae2c64a8e34822089d4bc73de286af036911ed9c02658796b5d78
Python
1,893
46
import numpy as np import math import soundfile as sf import librosa def raised_cosine(x, mu, s): return 1 / 2 / s * (1 + np.cos((x - mu) / s * math.pi)) * s def apply_raised_cosine_window(audio, sr, ramps_padding_window_duration): window_len = int(sr * 0.001 * ramps_padding_window_duration) left_raised_...
a380e4d106326e554dd6dade5b2d575f1ce1a0ce78d91378732c343f13b1bed4
Python
1,893
55
#!/usr/bin/env python """ Emulated Z stage functionality Hazen 04/17 """ from PyQt5 import QtCore import storm_control.hal4000.halLib.halMessage as halMessage import storm_control.sc_hardware.baseClasses.hardwareModule as hardwareModule import storm_control.sc_hardware.baseClasses.lockModule as lockModule class N...
349e63245801a336f57f98bb1bb5ec216cd77b98a6cb0faffb66bdb1659ffbc4
Python
1,894
65
""" Curve fitting examples for the Look Locker sequence with a given SNR """ import matplotlib.pyplot as plt import numpy as np import click from look_locker import curve_fit_wrapper def f(t, x1, x2, x3): return np.abs(x1 * (1.0 - (1.0 + x2**2) * np.exp(-(x3**2) * t))) @click.command() @click.option("--values...
61e9d7abf97f067c9323bbe2070fd53234dc33f469a1b3ae58bfc8ef7882676e
Python
1,894
70
#!/usr/bin/env python3 # tifffile/lsm2bin.py # Copyright (c) Christoph Gohlke # SPDX-License-Identifier: BSD-3-Clause """Convert [MP]TZCYX LSM file to series of BIN files.""" from __future__ import annotations import argparse import sys try: from .tifffile import lsm2bin except ImportError: try: fr...
5e40a8439d4afd4e4e8c8ce568bce4201c5f891d55cfaf527d4449bccdd6ba1a
Python
1,895
42
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'filter-wheel.ui' # # Created by: PyQt5 UI code generator 5.7 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.setObje...
1db785d8824b6ab2acfe9bfab1418eaf6263575f1df68942f9a5109f154e93ae
Python
1,896
71
#!/usr/bin/env python3 import sys from optparse import OptionParser USAGE = """ python combine-trf.py --segments < segments file> --trfdir <dir where trf out .dat files are> --out <out file name> combine the split trf files into a single file """ ################################################################...
6e92b0fde295a0f588aa2da42d188784f700be88cf50c9005849aea8742c3656
Python
1,897
57
#!/usr/bin/env python # coding: utf-8 # In[3]: import scvelo as scv import numpy as np import torch import matplotlib.pyplot as plt import pyrovelocity as pv from pyrovelocity.tasks.data import download_dataset from pyrovelocity.tasks.preprocess import preprocess_dataset from pyrovelocity.tasks.train import train_d...
6c8544b2e1bc59b39ca92d24a78d77bca573c471b80358d2a32240b4212b08c3
Python
1,898
48
import sys from pathlib import Path p_dir = str(Path(__file__).absolute().parents[2]) if p_dir not in sys.path: sys.path.insert(0, p_dir) import os from os.path import join import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import numpy as np class cbr_tiny_hydra(nn.Module...
d43d207fb9ee8e3b9093ff2029d2d67df87e6b3dbc9af3bb956a037a38a4c179
Python
1,898
57
################## PURPOSE ################# # This script is to remove duplicated coordinates reulted from Bedtools merging # and removes NULLs if they are not stand-alone values in a cell ################# ASSUMPTION ############### ############################################ # Imports in the pep8 order https://...
614b5e9c95849f3cc1c68251f3b52cd32ad377ba3ffa3ef2049e66df5dcb0f9f
Python
1,899
30
"""Snapshot telomere pathway hierarchy for annotation, never replace frozen memberships.""" import datetime,hashlib,json,re,subprocess from pathlib import Path ROOT=Path(__file__).resolve().parents[2] OUT=ROOT/'data/raw/context/reactome_dna';OUT.mkdir(parents=True,exist_ok=True) manifest=ROOT/'metadata/reactome_dna_ann...
d496a1a2dbf5d6bb668da0b608c48ec86b2da4e8abd5c0887568c081f581ed0a
Python
1,899
73
""" Classes for implementing `Pipeline`s composed of `Filter`s (intended to be subclassed). """ import abc class Filter(abc.ABC): def run(self, reader, writer): for block in reader: block = self(block) if block: writer(block) def step(self, reader, writer): ...
81d9b9b97b9b6f5d4fcb88ea260201c39ec6d4d7852f5ad34a825193f2c06b52
Python
1,900
57
################## PURPOSE ################# # This script is to remove duplicated coordinates reulted from Bedtools merging # and removes NULLs if they are not stand-alone values in a cell ################# ASSUMPTION ############### ############################################ # Imports in the pep8 order https://...
93fbb4404e64dbfa7a587b7025830c81ccc2a0b8efa821f6477dadf8a456fd21
Python
1,900
37
import os from .utilities import run_cmd command_based_on_os = {'Ubuntu': ['wget --output-document sratoolkit.tar.gz https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/current/sratoolkit.current-ubuntu64.tar.gz'], 'CentOS': ['wget --output-document sratoolkit.tar.gz https://ftp-trace.ncbi.nlm.nih.gov/s...
b811a181c0b166699678f5526e7ef305c819e7839501cfee05aa6b0a93f597a9
Python
1,900
46
import subprocess import os import pandas as pd import argparse import glob def main(): parser = argparse.ArgumentParser() parser.add_argument("--log_dir", required=True, help="Directory containing *.log.txt files for all subjects.") parser.add_argument("-o", required=True, help="Output file.") args =...
d8d8bfd0ce4e2cf76e69b618ce23cf800cfb5e2bd181ceddb7f6517e803b4fd3
Python
1,900
60
from .generic import GenericH5 from glob import glob from os.path import join, isdir from os import makedirs from torchvision import datasets __all__ = ['download_synth', 'SynthTrain', 'SynthVal', 'SynthTest'] def download_synth(directory, url='https://celldetection.org/data/synth.zip'): """Download Synth. ...
7e7a6716f2df184228ea9f9844c146b4573a67630dd5388e7fe5eda5fbf4efc3
Python
1,902
54
"""Example code for plotting connectivity maps based on a correlation matrix. In this example we use the inferred state/mode covariance matrices to calculate the state/mode correlation matrix. In this script we use an HMM fit, but this can be easily substituted for a DyNeMo fit. """ import os import numpy as np fro...
b2ed7533057461d881f531127c48ed6b107822da099d5f6cda9f743255e587bc
Python
1,902
51
from nab.detectors.base import AnomalyDetector from nab.detectors.skyline.algorithms import (median_absolute_deviation, first_hour_average, stddev_from_average, stddev_from_moving_a...
997b7f9995c7704b66d2598b91c59e0703cae59a66331e95e856bbb3749f342f
Python
1,903
69
#!/usr/bin/env python import re DL = 0 def getblocks(rank, time): with open('{:06d}/comm.log'.format(rank)) as origin_file: list = [] for line in origin_file: found = re.findall(r'^\s*{} BLKL.*'.format(time), line) if not found: continue; list.append(found[0]) return list[DL].s...
d293e66f7e03cbecdfffb9464127284799e585e71f5b3033c6235fcd53ebd338
Python
1,903
46
# Copyright (C) 2020-2022 Intel Corporation # Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import os.path as osp import zipfile from glob import glob from datumaro.components.dataset import Dataset from datumaro.plugins.transforms import Rename from cvat.apps.dataset_manager.bindings import Get...
27af46bdb370259ea468b42311e93528c6c25e4c473a36bab166afb07181dfc4
Python
1,904
68
# -*- coding: utf-8 -*- # python standard library inputs import os import datetime from shutil import copyfile # external inputs import numpy as np from sh import gunzip # local inputs from ..io.get_filename import get_filename def resample_volume(file_in, file_out, dxyz=[0.4, 0.4, 0.4], rmode="Cu"): """Resamp...
927682eb75a0af0638cad1d9edc87a885e1d959d698288ac4fe3927dd41dddc6
Python
1,904
59
"""AIMNET2 foundation models parameters for ChemGraph """ from pathlib import Path from typing import Optional, Union from pydantic import BaseModel, Field class AIMNET2Calc(BaseModel): """AIMNET2 calculator configuration. This class defines the configuration parameters for AIMNET2 machine learning models ...
b9e7604a72c0563ec139e0d2f4a383caecff595a1f3b8a9cbc8dc31b1a55c1e3
Python
1,904
64
import django.utils.timezone from django.db import migrations, models import cvat.apps.engine.models def add_created_date_to_existing_jobs(apps, schema_editor): Job = apps.get_model("engine", "Job") jobs = Job.objects.prefetch_related("segment__task").all() for job in jobs: task = job.segment.ta...
4df62d6560302c8b1662dd60f0e8bfb373fe7e6fb499c53730983efc0b4bb774
Python
1,905
51
# ============================================================================== # Binaries and/or source for the following packages or projects are presented under one or more of the following open # source licenses: # setup.py The OpenLane Dataset Authors Apache License, Version 2.0 # # See: # https://g...
52dbb85bf7617daa28f3a2c4045714d39e91e02393bd640c881d4fbc982e2788
Python
1,905
57
#!/usr/bin/env python # coding: utf-8 # In[3]: import scvelo as scv import numpy as np import torch import matplotlib.pyplot as plt import pyrovelocity as pv from pyrovelocity.tasks.data import download_dataset from pyrovelocity.tasks.preprocess import preprocess_dataset from pyrovelocity.tasks.train import train_d...
ab006a46e4f0d53c3af575f2a428c655da96c7cbc67b1e72d735e3ab71b9dd8b
Python
1,906
69
# pylint: disable=line-too-long import argparse from datetime import datetime from deepreg.predict import predict name = "unpaired_ct_abdomen" ckpt_index_dict = {"comb": 5000, "unsup": 5000, "weakly": 5000} parser = argparse.ArgumentParser() parser.add_argument( "--method", help="Training method, comb or uns...
be1c3db42029b1db470936a5270172d97786a92ce7fe92ca9d0f12b4df02e319
Python
1,906
54
import os import pandas as pd import yaml from pathlib import Path from drop.config.SampleAnnotation import SampleAnnotation def fixSampleAnnotation(input_file, output_file): """ :param input_file: sample annotation file with relative paths :param output_file: location for sample annotation file with abso...
78aa4cf5a3ee66778b8fbef09820ee1a84bff3ace08081fa303f55b261bc3274
Python
1,907
30
import os from nipype.interfaces.base import (CommandLineInputSpec, CommandLine, traits, TraitedSpec, BaseInterface, BaseInterfaceInputSpec, File) from traits.api import Directory, Str, List, Bool, Enum, Int, Float, TraitError, Either class SegCSVDPVSInputSpec(CommandLineInputSpec): t1w = Str(mandatory=True, argst...
a8086b54d0e1ea2f711e8556c39e83e9e1ee5a337bd19a606636c4f8bdf4f103
Python
1,907
22
from brainscore_vision import model_registry from .helpers.helpers import CORnetCommitment, _build_time_mappings from .model import get_model, TIME_MAPPINGS, get_layers ### ReAlnet01_cornet with different fields of view than 8 visual degrees (default) ### # exploring 4, 12, 16 visual degrees # code is adapted from the...
ac241f43d3f76a0224cb7573727f83c62e55c413b39b18ee3842e171fb5f382e
Python
1,907
74
"""ChemGraph package metadata.""" from importlib.metadata import PackageNotFoundError, version from pathlib import Path from typing import Any _DISTRIBUTION_NAMES = ("chemgraphagent", "chemgraph") def _load_toml(path: Path) -> dict[str, Any]: """Load TOML data from a file path. Parameters ---------- ...
645dbe44ada3a3a9987105149bd45cba88b52f052148e0450c8be4629507c63c
Python
1,908
60
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT """Authenticate without putting a token in your code: use a saved profile. Create a profile once on the command line, then any script can use it: cvat-cli --server-host 'https://app.cvat.ai' profile create --name app --set-default Steps: 1. If...