sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
0f2aa681beea539a204306fc880885af7b7a7926836ed5cd66b1ce9ee04e167e
Python
1,909
44
#!/usr/bin/env python3 import argparse import subprocess import os import tempfile parser = argparse.ArgumentParser(description='Run METASOFT.') parser.add_argument('metasoft_jar', help='metasoft.jar') parser.add_argument('metasoft_input', help='') parser.add_argument('prefix', help='Prefix for output file: <prefix>.m...
3c23115ec3e09c4fbd363594c2aca7bbb22b58228c157273fb1333f1e3aa8f3e
Python
1,909
53
import scipy as s import scipy.special as special import scipy.stats as stats from .basic_distributions import Distribution from mofapy2.core.utils import * class Binomial(Distribution): """ Class to define Binomial distributions Equations: p(x|N,theta) = binom(N,x) * theta**(x) * (1-theta)**(N-x) ...
58133fee531bd4ac660be545eee5120f12f42b185e87329e8854a51026b00446
Python
1,909
61
#!/usr/bin/python # ## @file # # Coherent CUBE 405 laser control. # # Hazen 7/10 (com port modified Josh 6/26/13) # import cube ## Cube405 # # Controls a Coherent Cube 405 laser. This is sub-class of cube.Cube. # class Cube405(cube.Cube): ## __init__ # # Initiate RS-232 communication, ...
c56374cbee8e5ac22d4dd4685ecc86ce4a4919d0c7ccb4abbb4246de55aca6f4
Python
1,909
45
def rpn_model(file): from sklearn.feature_selection import SelectKBest from sklearn.linear_model import ElasticNet from sklearn.pipeline import Pipeline from sklearn.preprocessing import RobustScaler from sklearn.feature_selection import f_regression import numpy as np import json with...
40b4b68125193ad453f36cc700e90f2d62a4c1f7557935a9ad5a1e62d09f50de
Python
1,910
54
import os import numpy as np import pandas as pd from impedancefitter.RC import RC_model from impedancefitter.readin import (readin_Data_from_collection, readin_Data_from_TXT_file, readin_Data_from_csv_E4980AL) f = np.logspace(1, 8, num=20) omega ...
e68ae1a0f28bf587e85b94450c6915ab819c066c6926b631a49fc862fbd91c8f
Python
1,910
51
from collections.abc import Callable from functools import partial from pathlib import Path from eir.experiment_io.input_object_io import load_serialized_input_object from eir.setup.input_setup_modules.setup_array import set_up_array_input_object from eir.setup.input_setup_modules.setup_bytes import ComputedBytesInput...
603515081868e34dd7c5eb3369dc32e03b00b160985f1bc4f862207696a56ff6
Python
1,911
46
# cifar10 dataloader from torch.utils.data import DataLoader from torchvision import datasets, transforms def Cifar_Data_Load(args, is_training=True): args=args['dataloader'] if is_training: transform_train = transforms.Compose([ transforms.RandomCrop(32, padding=4), transforms....
7c825bfbe07772e4b1170744f85bd24631ae1944568fe43ff48fec6b9767343b
Python
1,911
49
import h5py from glob import glob import os import numpy as np from scipy.stats import scoreatpercentile as sap import matplotlib.pyplot as plt srcdir = 'ZENODOPATH/quiet_active_detection/quiet_active_stats' figdir = 'FIGDIR/quiet_active_stats' if not os.path.isdir(figdir): os.makedirs(figdir) myfiles = glob(os.path...
ceaa9764eca4840f51c9be5051d28114e851e1d0bda50ac2e33e1273833c8471
Python
1,911
40
"""Explicit byte-verified restoration of tracked inputs into a fresh checkout.""" import argparse,json from datetime import datetime,timezone from pathlib import Path from urllib.request import Request,urlopen from src.acquisition.download import ROOT,MANIFEST,sha256 def restore_record(record,root=ROOT): target=r...
0285f480e97bcc98fbbe835b3378ec585eba14ce0f16c575881460ee97b2edaa
Python
1,913
74
#! /usr/bin/env python # Copyright 2014 Numenta Inc. # # Copyright may exist in Contributors' modifications # and/or contributions to the work. # # Use of this source code is governed by the MIT # license that can be found in the LICENSE file or at # https://opensource.org/licenses/MIT. import os import argparse impor...
2e87d0ee3c2457ab3c5f6c1e77a40f580eb70eeab3886434a0aeebe6283694bc
Python
1,913
60
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT """Restore a project from a backup zip as a new project. Pair with project_backup.py to migrate or clone a project. Steps: 1. Restore --backup as a brand-new project. 2. Optionally delete the restored copy (--cleanup) — useful when testing a ...
5811225a22bdd74c46e7f07605458bd601345287364464d7ad4ec9a6d169475e
Python
1,913
63
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ """ def compute_downsample_size(down_size, resolution_wh): """ Compute the downsample size based on the given input size and original resolution. This function determines the downsample size based on different formats of `down_size`: 1. If `down_siz...
595bce43be9051338bd55f8dd1fe9d6f25e634ed726afe79baa12e3b093011e3
Python
1,913
66
from enum import Enum class Parameter(Enum): EMBEDDINGS = "embeddings" HIDDEN_SIZE = "hidden_size" USE_CRF = "use_crf" USE_RNN = "use_rnn" RNN_LAYERS = "rnn_layers" DROPOUT = "dropout" WORD_DROPOUT = "word_dropout" LOCKED_DROPOUT = "locked_dropout" LEARNING_RATE = "learning_rate" ...
1d2f112ce93c37b45538c71d3c321fa62786a3195ed6ae834cf76c6476a3b8c8
Python
1,914
60
#!/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...
449a753bb9fc2fbb2d3d8d9c3ed014db669b3206515f54aa2974732a0240a067
Python
1,914
49
# SPDX-FileCopyrightText: Copyright © Timo Koch # SPDX-License-Identifier: GPL-3.0-or-later import matplotlib.pyplot as plt import matplotlib as mpl from overlay import overlay_images, niifile_to_ndarray from map_to_mri import TIME_STAMPS, VTK_FIELDS, PREFIX import numpy as np mpl.rcParams['savefig.pad_inches'] = 0 ...
1a798a8655827b5168fc23abc7df18ec78dc73334a4607ce645deaf57b08ded6
Python
1,915
68
import ntac import os from os.path import join from ntac import Ntac, FAFBData # first download the flywire data we'll need for this example. This will be cached in ~/.ntac/flywire_data ntac.download_flywire_data(verbose=True) # SeededNtac is happy to accept an aribtrary CSR adjacency matrix and a list of labels #...
4bcd52ca417b959eca431e4ab84d16eb794b8ef0a200cf59c041f32c5b6f65e0
Python
1,915
45
# import libraries ## general libraries import pandas as pd ## brain-score libraries import brainscore ## domain-transfer specific libraries from helpers_background_id import loading_brain_model_activation ##### NOTES ON THIS SCRIPT ##### # This script is used to create a stimulus set with the background-id inclu...
6a19e260e9ed678c3890495034ab8d861d845404b52aa63207c3ff686a082309
Python
1,915
41
# The ImpedanceFitter is a package to fit impedance spectra to equivalent-circuit models using open-source software. # # Copyright (C) 2018, 2019 Leonard Thiele, leonard.thiele[AT]uni-rostock.de # Copyright (C) 2018, 2019, 2020 Julius Zimmermann, julius.zimmermann[AT]uni-rostock.de # # This program is free ...
d0bd107d3e772acf10043f609d0bd63df24ab663fc16c30ff09998857f5c8f7a
Python
1,915
61
"""Cross-day cell tracking for CAT-NAP. Follows the same cells through a culture's DIVs by matching suite2p ROIs with ROICaT, and says how much each match can be trusted. Design and the evidence behind every constant here: ``python/CATNAP_CELLTRACKING_PLAN.md``. The short version of what that document establishes, b...
e83f3db1a07a4c7f822b68df9ff245496a85a969842e5cf63e5e4a5fb0f7efcb
Python
1,915
70
import argparse from training import text_pretrain, train_hdc_mlp from inference import lhdm_infer def main(): parser = argparse.ArgumentParser( description="LHDM: text pretraining, visual training, and inference." ) parser.add_argument( "--stage", type=str, required=True, ...
92b1df576dbfc8a62f12aa4d8c3ceffdbc2da7bef04ba5b274d64e546151ef9e
Python
1,917
48
#@SNTService snt snt.requireVersion("5.0.5") # SNT version required to run this script """ Exemplifies how to plot a two-dimensional bivariate histogram in SNT. Documentation Resources: https:#imagej.net/plugins/snt/scripting Latest SNT API: https://javadoc.scijava.org/SNT/ """ from sc.fiji.snt import Tree from s...
eaa3afa3f44f5d79e6f79c931e16a39187cf227fc5ccf09ba455d6bdf892c8c0
Python
1,917
44
import numpy as np from brainscore_vision import load_metric, load_ceiling, load_dataset from brainscore_vision.benchmark_helpers.neural_common import NeuralBenchmark, average_repetition from brainscore_vision.data.sanghavi2020 import BIBTEX_SANGHAVIMURTY from brainscore_vision.utils import LazyLoad VISUAL_DEGREES = ...
0138a504a9d7f73e88816057cd80c4050d47ff5382f0b1bd81d321da369a53e0
Python
1,918
68
# -*- coding: utf-8 -*- """Various matlab functions for high-resolution fMRI data.""" import os from .. import execute_command class MatlabCommand: """Class for running Matlab commands. Parameters ---------- fname : str Name of the Matlab script to run. *args Variable length arg...
e9d7eaaac73855155233eb79b77287405766cb46d94477a3eb9bdbbae704e7d7
Python
1,918
51
# -*- coding: utf-8 -*- # @Author : LG from PyQt5 import QtWidgets from ISAT.ui.text_prompt_dock import Ui_Form class TextPromptDockWidget(QtWidgets.QWidget, Ui_Form): def __init__(self, mainwindow): super(TextPromptDockWidget, self).__init__() self.setupUi(self) self.mainwindow = mainw...
5a8354ce1e37d5407331153d3b76b3a36885f41c91f96abf1b58d143818f7d50
Python
1,919
52
from brainscore_vision.model_helpers.check_submission import check_models import functools import os import torchvision.models from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images from pathlib import Path fr...
79f2dddf96d90abe7cacebc9abe5644b522438d060f89f41d2f7ac9f87a20fe1
Python
1,919
64
import numpy as np from nibabel import load as load_mri from multiprocessing import Pool from subprocess import run inp_paths = None # to define out_paths = None # to define N_PROCS = None # to define def indicesCrop(mri_path): mri = load_mri(mri_path).get_fdata() d1_1=0 while d1_1<mri.shape[0] and np....
0e49f8b02dbb23545e62319e7237c1db165eb9a9d2f6385abcf34abd6b7c65c2
Python
1,920
66
"""Train Chemprop models on all the Therapeutics Data Commons (TDC) ADMET datasets""" import subprocess from pathlib import Path from typing import Literal from tqdm import tqdm from tdc_constants import ( DATASET_TO_TYPE, DATASET_TYPE_TO_METRICS_COMMAND_LINE, ADMET_ALL_SMILES_COLUMN, ) def train_tdc_a...
d1fc5b8e841feb5730c538359812f564f1fb087861fb16a46b50a20a18bba740
Python
1,921
55
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import glob import os import tempfile from dipy.io.stateful_tractogram import Space, Origin import h5py from scilpy import SCILPY_HOME from scilpy.io.hdf5 import reconstruct_sft_from_hdf5 from scilpy.io.fetcher import fetch_data, get_testing_files_dict # If they already...
e59ca74b635199c7b774a7e596bde20c95232a5dbc1d8a4ae92a8ac5aa8ec552
Python
1,921
59
import pandas as pd import numpy as np from sklearn.model_selection import KFold from sklearn.preprocessing import StandardScaler import matplotlib.pyplot as plt from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense from tensorflow.keras.optimizers import Adam file_path = r"C:\featur...
613f3aa3e95280ec9a9e5e41a2970c980632e4bfc8e70e02ad54f693795e94e3
Python
1,922
73
# Copyright (C) 2021-2022 Intel Corporation # Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import argparse import json import os.path from typing import Any from attr.converters import to_bool from cvat_sdk.core.proxies.tasks import ResourceType def parse_resource_type(s: str) -> ResourceType:...
ee2618026c135d0498acbd002147fba331dbef9f0f80d8845b435e5d9267e440
Python
1,922
74
"""Public lowercase API for the Waven package. The implementation currently lives in :mod:`Waven` for historical reasons. This package provides the import style users expect after installation: import waven from waven import PipelineConfig """ from __future__ import annotations import importlib try: fro...
2d6e65e72780af42c0a6f260b580179854e4d06a1fcdc64338dca1b71092d971
Python
1,923
56
import tensorflow as tf import csv import numpy as np import SimpleITK as sitk import matplotlib.pyplot as plt from numpy import argmax import pandas as pd import tensorflow.keras.backend as K from tensorflow.keras import initializers from tensorflow.keras.callbacks import Callback from tensorflow.keras.layers import ...
2113e0881f526736b587b65b3c4d471c817f9718aa9e1ecf04c34660d6a59a33
Python
1,924
82
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Create "files.csv" files in the directories downloaded from BioImage Archive """ import os import glob import pandas as pd import mbflim.utils as ut config = ut.load_config() source_dpath = config['paths']['source_dpath'] lists_dpath = os.path.join(source_dpath, ...
6fa71ded304fbd2e84ad2418e756d65982c92e5edf6de2e8da2059bf27f991e9
Python
1,924
54
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile import numpy as np from dipy.io.surface import load_surface from dipy.io.utils import Space 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 (ch...
c6e7b17d840e04acfa3acda9ba5f354f8887066c963a5613cb145e23b612a73a
Python
1,924
56
"""Evaluate predictions from TDC ADMET Benchmark Group models.""" from pathlib import Path import numpy as np import pandas as pd from tdc.benchmark_group import admet_group from tdc_constants import ADMET_GROUP_SEEDS, ADMET_GROUP_TARGET_COLUMN def tdc_admet_group_evaluate(data_dir: Path, preds_dir: Path) -> None:...
2a2e1cdd93b196378c1973dd0109d7ea5bc32c9abdad84dc58f831cd650b5aae
Python
1,925
28
from testsetclass import TestsetClass class RG18(TestsetClass): def __init__(self): self.weak = 1.0 self.molecules = ['ne4', 'hfNe', 'c2h2', 'c2h2Ne', 'hfKr', 'ar3', 'hfAr', 'bzNe', 'c2h6Ar', 'ar', 'kr', 'kr2', 'ne2', 'ar4', 'c2h2Ar', 'bzAr', 'bz', 'c2h6Ne', 'ne3', 'ar2', 'kr3', 'hf', 'ne', 'ne6',...
d14a4c5433a1103c20f45065e4f0526235019a9b558d42bec27b6770aaa66333
Python
1,925
38
from .cornets import CORnetCommitment, _build_time_mappings, CORNET_S_TIMEMAPPING import logging from .cornet_helpers import vonecornet _logger = logging.getLogger(__name__) class VOneCORnetCommitment(CORnetCommitment): def start_recording(self, recording_target, time_bins): self.recording_target = record...
a49bc770fb7d324363a9bad81e535dc96e4758284edff8c009191c878b8b4f83
Python
1,926
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_SANGHAVIJOZWIK from brainscore_vision.utils import LazyLoad VISUAL_DEGREES =...
cb2bebd064841579301050b33eea363511cd705be059253867ac575cb2a59b66
Python
1,927
70
"""parse_case Returns: [int]: which data case we are in. """ import os __all__ = ["parse_case"] def parse_case(sourcespace, targetspace, tdir): """parse_case Args: sourcespace (string): space in which the source data lies. targetspace (string): space to interpolate the source data to. ...
f8f81f272f8d8b60f0d270085a9496c82e5e221428e96e79240fb46404b1531d
Python
1,927
70
# Import Packages, Libraries and Files from psychopy import visual, core, event, __version__, gui, monitors,constants import os import glob def start_movie(win,moviename): videos=glob.glob(f"{os.path.dirname(os.path.abspath(__file__))}/videos/**/*.mp4",recursive=True) if len(videos)<1: print('ER...
1faceb9719b433f8b6ef92a199b1b67569a9d2f75d72a2bb20e6e8c25b33c269
Python
1,928
49
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_images, load_preprocess_images from brainscore_vision.model_helpers.check_submission import check_models import ssl from transformers import MobileViTForImageClassification...
ec4865e9ab8ce2fbdc7eeec20cdd721a10deed9c56eeb2c3fa9d52053d6cb47f
Python
1,928
86
#!/usr/bin/env python import sys import gzip import argparse import logging from Bio import SeqIO logger = logging.getLogger("cut_indrop_spacer") logging.basicConfig( level=logging.DEBUG, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", handlers=[ logging.FileHandler("cut.log"), ...
10c5fa13547f8171685f006a32ab7abc0f77d262b4ba7a85bb9ebe05051ff5a6
Python
1,929
55
from typing import List, Union from torch_geometric.data import Data, HeteroData from torch_geometric.data.datapipes import functional_transform from torch_geometric.transforms import BaseTransform from torch_geometric.utils import coalesce @functional_transform('remove_duplicated_edges') class RemoveDuplicatedEdges...
d1cd17162b9bd725c0b4458a50dff7498ff2a6fec66c1f3643bd53c5cd4104a0
Python
1,929
57
from pathlib import Path import click import nibabel as nibabel import numpy as np import pyvista as pv import simple_mri as sm def mri_data_to_ndarray( grid: pv.StructuredGrid, data_name: str, shape: tuple[int, ...], mask: bool = True ) -> np.ndarray: data_array = grid.point_data[data_name] if mask: ...
f37b21e1bdcfd94caea64eee7e9775f47702d038b1f86a88c561b82cdcde1372
Python
1,929
58
from matplotlib import gridspec import matplotlib import numpy as np import matplotlib.pyplot as plt from pathlib import Path cur_fold = 6 cur_path = Path.cwd() / "data" / "txt_barchart_"f"{cur_fold}_fold_effect_erc_handdraw_g12_2025.txt" with open(cur_path) as f: lines = [line for line in f] num_each_row = len(...
2ba5485227e4460f177e7d566be97842dbec9777d9f4b714afb48732d248b1a2
Python
1,930
52
from brainscore_vision.model_helpers.check_submission import check_models import functools import os import torchvision.models from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images from pathlib import Path fr...
cb1897bc025c2b3399c4e9383541b2060d905b0d539a6dbf3041aa148f7595c1
Python
1,930
64
#%% import numpy as np from scipy import stats # turn off warning messages import warnings warnings.simplefilter(action='ignore', category=FutureWarning) from sklearn.discriminant_analysis import LinearDiscriminantAnalysis #%% def omega2(data, trialInfo, iv): ssTotal = ((data - data.mean(axis=0))**...
2cdd9d041245ed3f61f6b88f35c370c1f5e1c2bcdfc2ab3f61636e67993e5049
Python
1,932
63
import pytest import torch from eir.models.model_setup import get_model from eir.models.model_setup_modules.meta_setup import al_meta_model from eir.setup import config, input_setup from eir.setup.output_setup import set_up_outputs_for_training from eir.train_utils.optim import maybe_wrap_model_with_swa from eir.utils...
c1f0b83a725ffbefc3ce065e39a7de21cdcab7f6a84134919af864d18f8b602b
Python
1,932
78
import numpy class Highlighter(object): def __init__(self): self.color_map = [ "#ff0000", "#ff4000", "#ff8000", "#ffbf00", "#ffff00", "#bfff00", "#80ff00", "#40ff00", "#00ff00", "#00ff40...
5a4c35a5c26380ad13a8e6d36fd6c567150063626b5da0d05084dd6d7e7a634a
Python
1,934
59
from ogb.utils.features import (allowable_features, atom_to_feature_vector, bond_to_feature_vector, atom_feature_vector_to_dict, bond_feature_vector_to_dict) from rdkit import Chem import numpy as np def smiles2graph(smiles_string): """ Converts SMILES string to graph Data object :input: SMILES string (s...
5daa9a4fd539db7e1417d2436dc858fc1c740a6153ce2a10b5777f6ca046b31c
Python
1,934
61
from matplotlib import gridspec import matplotlib import numpy as np import matplotlib.pyplot as plt from pathlib import Path cur_fold = 3 cur_path = Path.cwd() / "data" / "txt_barchart_"f"{cur_fold}_fold_effect_erc_handdraw_g12_2025.txt" with open(cur_path) as f: lines = [line for line in f] num_each_row = le...
b983c821323d7420a543ebb57730db4ac5aa2a880fd03c72c3e6eed0b99b9868
Python
1,934
59
import pandas as pd import time import json import content_feature as cf import csv def get_content_vector(tweets_text): content_vector = { "characters":cf.count_characters(tweets_text), "hashtags":cf.count_hashtags(tweets_text), "words":cf.count_words(tweets_text), "hashtags_to_wor...
de4b31b599c4db31779c5e8897948c398d1e11658b07d3d45eb3304ba9469534
Python
1,934
49
# -*- coding: utf-8 -*- # @Author : LG from functools import partial from PyQt5 import QtWidgets from ISAT.ui.visual_prompt_dock import Ui_Form class VisualPromptDockWidget(QtWidgets.QWidget, Ui_Form): def __init__(self, mainwindow): super(VisualPromptDockWidget, self).__init__() self.setupUi(s...
e89ec14733bb9311318d8e6e26d193faed56821810606d0ef951ea3718c4c40e
Python
1,934
59
import pandas as pd import time import json import content_feature as cf import csv def get_content_vector(tweets_text): content_vector = { "characters":cf.count_characters(tweets_text), "hashtags":cf.count_hashtags(tweets_text), "words":cf.count_words(tweets_text), "hashtags_to_wor...
98d1f4b3af846f7ddee9b15f203fafac6a316772b1eea1ca9e81ccfecd87f3cb
Python
1,935
63
from __future__ import annotations from pathlib import Path import pytest from PySide6.QtCore import Qt from PySide6.QtWidgets import QApplication from pytestqt.qtbot import QtBot from ..conftest import close_or_pause from .conftest import MainWinFactory from .conftest import show_window_and_wait_for_imagedata @py...
9f5f66a81c79fb8db6c29cbea82ffca30af8f58ed01e123c96c3af82ad1e9cfb
Python
1,937
60
"""R² (coefficient of determination) metric for Keras models.""" import tensorflow as tf class R2(tf.keras.metrics.Metric): """Streaming R² metric for regression models. Accumulates residual and total sum of squares across batches and computes R² in ``result()``. """ def __init__(self, name: st...
13da9324f65587034aa45bf2a564521854eaef4142da234a5f5fd8497a14a831
Python
1,938
51
import numpy as np from PIL import Image import tensorflow.compat.v1 as tf tf.disable_v2_behavior() class ModelLoader: def __init__(self, model_path): self.session = None detection_graph = tf.Graph() with detection_graph.as_default(): od_graph_def = tf.GraphDef() ...
e5ef1baa932d63426b24c5ccfad9575f328e503aec2235462aa5cffb49c87e42
Python
1,938
23
from testsetclass import TestsetClass class DC13(TestsetClass): def __init__(self): self.weak = 1.0 self.molecules = ['ISO_E36', 'ch2n2', 'c2h2', 'c20bowl', 'ISO_C8H8_1', 'c2h4', 'CL2', 's2', 'C6Cl6', 'c20cage', 'carbooxo2', 'o3', 'o3_c2h4_add', '13dip', 'be4', 'ISO_E35', 'heptatriyne', 'ISO_P36',...
fd0e0ce54611b276f71be10b189377e3a3b8f3fc49cd83616e5fa632e0e1f425
Python
1,938
60
import os import pandas as pd import numpy as np from nilearn.connectome import ConnectivityMeasure from sklearn.preprocessing import StandardScaler def scrub(ts, fd, scrub_threshold, frames_before=0, frames_after=0): frames_out = np.argwhere(fd > scrub_threshold).flatten().tolist() extra_indices = [] for...
0741fd8cae2f6c9cc9eb763da56ff62650a570ffb6eabfbd4a0f384b64c6785d
Python
1,939
78
from .aepicker import BasicPhaseAE from .base import GroupingHelper, SeisBenchModel, WaveformModel, WaveformPipeline from .cred import CRED from .das_base import ( DASAnnotateCallback, DASModel, DASPickingCallback, FKFilter, InMemoryCollectionCallback, MultiCallback, PatchCoordinate, Pat...
3b941c81ec351563be64b728a1b4b37177d96008303c2185c9eb9ff89911efad
Python
1,939
75
""" Sklearn-compatible model factories for score prediction. Supported models: logreg, xgboost, random_forest, vit The ViT model requires the [vit] extra: pip install kinescope[vit] """ from sklearn.linear_model import LogisticRegression from sklearn.ensemble import RandomForestClassifier from xgboost import XGBClas...
5454b60ad09064c363c8974f3049bcb2d620ff55570bb5b0dc889e30cec82991
Python
1,939
56
import numpy as np from scipy.stats import mannwhitneyu from tqdm import tqdm import pandas as pd def load_matrix(file_path): return np.loadtxt(file_path, delimiter="\t", dtype=float) def mann_whitney_u_per_gene(matrix, group_a_idx, group_b_idx): p_values = [] u_stats = [] for gene_row in matrix: ...
a913e9eafb8f48ecd374501133d2f75d5d80051d73d4a59357f0af1c9f1c9ae4
Python
1,940
55
import numpy as np from tqdm import tqdm from argclz import AbstractParser, argument from neuralib.io import csv_header from rscvp.util.cli.cli_output import DataOutput from rscvp.util.cli.cli_stimpy import StimpyOptions from rscvp.util.cli.cli_suite2p import Suite2pOptions from rscvp.util.util_trials import TrialSign...
1e1d68b9ac6d810279fa2c0b322c655addeda5d6626289dfcb3093053061ed37
Python
1,941
73
# -*- coding: utf-8 -*- # python standard library inputs import os # external inputs import numpy as np import nibabel as nb from nibabel.freesurfer.io import read_geometry, write_morph_data from gbb.normal import get_normal # local inputs from ..io.affine import read_vox2ras_tkr from ..io.get_filename import get_fi...
49b0636ecab52248439a288d9361cc8ca1df1f8a562383bccbcaa0ab773bd3e6
Python
1,941
64
"""Example script for applying hierarchical clustering to match state time courses from different runs. The method is described here: https://www.biorxiv.org/content/10.1101/2023.01.18.524539v2 """ import pickle import matplotlib.pyplot as plt from scipy.cluster import hierarchy from osl_dynamics.inference import mo...
727c3281ee5d91fb219e6382c52b36c364c6fa4ba4d7dbbf190d5c97f2d768cb
Python
1,941
68
import matplotlib.pyplot as plt import pandas as pd cases = 'Reymond_99_heart_ref3_02' # plot for the arterial system models = 'arterial' elements = ['A5','A1','A8','A52','A49'] title = ['Carotid','Aorta','Radial','Femoral','Anetrior Tibial'] start = [0,1,1,1,1,0] lit_folder = 'literature_results/charlton_data/' li...
8ce3e9a3067b785a113a4d6b12ef3cc21ffa491fb037cd0326afd7991bc5439a
Python
1,941
76
"""Pydantic configurations for SFCN model variants.""" from abc import ABC from typing import Annotated, Any, ClassVar, Literal, cast from pydantic import BaseModel, Field from ..models.sfcn import SFCN, BinarySFCN, CategoricalSFCN, RegressionSFCN class BaseSFCNConfiguration(BaseModel, ABC): """Shared configur...
9c46ff55b4a38ca08c0c0dffaffba65bb07664651fd05141e7d868ba0aa87da8
Python
1,941
70
import h5py import os import matplotlib.pyplot as plt import numpy as np DIR = os.path.dirname(os.path.realpath(__file__)) HOME_DIR = DIR.rsplit('/', 1)[0] HOME_DIR = HOME_DIR.rsplit('/', 1)[0] print('> HOME: ', HOME_DIR) DATA_DIR = HOME_DIR + '/data/' print('> DATA: ', DATA_DIR) # %% f = h5py.File('/home/atuin/b1...
e2ed35f5e65c389b4e0d9d45b20e4639a1d1645deeca5b450648d3af8920836b
Python
1,941
53
import cv2 import numpy as np import os from tqdm import tqdm input_root = 'E:\peiguoquan_data\Tea_Origin\Tea_Origin' # 注意路径斜杠方向 output_root = 'E:/peiguoquan_data/Tea_origin_keying' os.makedirs(output_root, exist_ok=True) # 茶叶颜色极限范围 (基于提供的RGB数据) lower = np.array([20, 30, 0]) # 更低更宽,避开背景颜色 upper = np.array([170, 1...
434a4f338a6fa03fd0a5178b9111951d5f552b2b7e8813503941c39ae4d73160
Python
1,942
72
# -*- coding: utf-8 -*- # python standard library inputs import os # external inputs import numpy as np import nibabel as nb # local inputs from ..io.get_filename import get_filename def crop_coordinate_mapping(file_in, pad=0, overwrite_file=True, path_output=""): """Crop coordinate...
84e3e6f620a59b17cf740c13302bd2887a3ac32a5c78cbb95e3bd8879d924103
Python
1,942
70
import h5py import os import matplotlib.pyplot as plt import numpy as np DIR = os.path.dirname(os.path.realpath(__file__)) HOME_DIR = DIR.rsplit('/', 1)[0] HOME_DIR = HOME_DIR.rsplit('/', 1)[0] print('> HOME: ', HOME_DIR) DATA_DIR = HOME_DIR + '/data/' print('> DATA: ', DATA_DIR) # %% f = h5py.File('/home/atuin/b1...
2792b6d6f8585f406afd9690ad6f0b9aedba1e36a86836e38a0088b0a97ae5ca
Python
1,943
61
from pydantic import BaseModel, Field from typing import Union from chemgraph.models.atomsdata import AtomsData class VibrationalFrequency(BaseModel): """ Schema for storing vibrational frequency results from a simulation. Attributes ---------- frequency_cm1 : list[str] List of vibrationa...
5bf922700f26888df966f0b3fb5759424b28250135ae3ebd182daf6edabf556b
Python
1,943
50
import tensorflow as tf from typing import Any, Dict, List, Tuple from loss_function import loss_function class LossAndGradientCache: """ A class to cache and compute loss and gradients using TensorFlow. """ def __init__(self, num_params: int, data_all: Dict[str, Any], fixed_params: ...
a5be86c7211a4052c7d84bd7db8d5239735a68c24c4be442ddc379d990ba7d02
Python
1,943
68
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from enum import Enum from typing import Any import attrs from cvat.apps.engine.models import Job, Location, Project, Storage, Task class StorageType(str, Enum): TARGET = "target_storage" SOURCE = "source_storage" def __str__(self): ...
473fd3ffc5ddab1a6e048e6c9890f71f0ea0e81ba0b4aca64c675050060ebd71
Python
1,944
60
import torch import torch.nn.modules.batchnorm import skoots.lib.utils from torch import Tensor from typing import Dict, Optional, Union, List import matplotlib.pyplot as plt from torchvision.utils import flow_to_image, draw_keypoints, make_grid from torch.utils.tensorboard import SummaryWriter from yacs.config import ...
bde07f8071ba25285cf80df9267a0dffde8c57d34a63e857cafa88644b4c0a2d
Python
1,945
59
# Copyright 2024 DeepMind Technologies Limited # # 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 applicable law or agree...
35197d177b90efad87fd37c9f78cf15022cc0ed01af763187d95907fdd0fb301
Python
1,946
59
import os,csv,re import pandas as pd import numpy as np import scanpy as sc import math import numba @numba.njit("f4(f4[:], f4[:])") def euclid_dist(t1,t2): sum=0 for i in range(t1.shape[0]): sum+=(t1[i]-t2[i])**2 return np.sqrt(sum) @numba.njit("f4[:,:](f4[:,:])", parallel=True, nogil=True) def pairwise_distanc...
662a7bae6fef19a0d51212eb4c0ce919f4e12acfe9ad3d29401f8d0d44b86ab2
Python
1,946
77
import os import h5py import numpy as np DIR = os.path.dirname(os.path.realpath(__file__)) DATA_DIR = DIR.rsplit('/', 1)[0] DATA_DIR = DATA_DIR.rsplit('/', 1)[0] + '/data' # %% b-values and vectors with h5py.File(DATA_DIR + '/0.7mm_21-dir_R1x3_dvs.h5', 'r') as f: bvals = f['bvals'][:] bvecs = f['bvecs'][:] ...
be8565f5015a88b08c7b04654d44abe8176f3fda67bb150917d8a4cb471478f0
Python
1,946
83
#!/usr/bin/env python """ Extract ranges of scores from a sorted file in which each line contains a position followed by a score. TODO: The finder class might actually be useful, it strides through a file and builds an index based on the first line. Maybe move it into the library and get rid of this very ...
fedf6830e87ed42f877858a43a1995ed50416bad5ad67d6b9f24c7a5db4b5d27
Python
1,946
63
import torch import torch.nn as nn class Discriminator(nn.Module): def __init__( self, feature_maps: int, image_channels: int, depth: int = 5, activation: str = "Sigmoid", dropout: float = 0.0, ): super().__init__() asse...
8ccd8adfb40292be6de6780eea2cf23744e36c3b3085645169b179020d868f3a
Python
1,947
70
import random from utils import decode_one_hot, one_hot from rules import ( ATOMIC_NUMBER, ATOMIC_SUBSTITUTIONS, CHARGE_SUBSTITUTIONS, HYBRIDIZATION_SUBSTITUTIONS ) def atomic_rules(atom_one_hot): atom_num = decode_one_hot( atom_one_hot, ATOMIC_NUMBER() ...
c6b3e8e2d17d32acaf5f08cd4319cb3e4ea7ecfae15c6243dad8905bb74c0459
Python
1,947
77
"""Predict a continuous value using neuroimaging features. Note, this script doesn't require osl-dynamics, it uses scikit-learn to train a machine learning model. This script should achieve an R2 value of ~0.55. """ import numpy as np from sklearn.pipeline import Pipeline from sklearn.preprocessing import StandardSc...
d3586fa67837535f1a6e9c102aff95e8e05b53bb497488d47405311432eb7afd
Python
1,947
78
import argparse import h5py import numpy as np # %% parser = argparse.ArgumentParser(description='create dvs h5 file for 3-scan trace.') parser.add_argument('--bvals', nargs='+', type=int, default=[50, 100, 200, 300, 400, 500]) parser.add_argument('--bavgs', nargs='+', type=int, ...
e135d58a559c26ee55e1e7504af17da4c1680e26d3f0a01495dc9c4fbaa01d20
Python
1,947
52
"""Setup file for dannce.""" from setuptools import setup, find_packages setup( name="dannce", version="1.2.0", packages=find_packages(), install_requires=[ "six", "pyyaml", "imageio==2.8.0", "imageio-ffmpeg", "numpy<1.19.0", "scikit-image", "matp...
3b1b12564361bab43be2ad9fa8ad90c0b7132b13e0f7650035cd4f8e9809fc17
Python
1,948
47
# Parts taken and modified after https://github.com/MIC-DKFZ/nnUNet/ import psutil import torch from nnunetv2.inference.predict_from_raw_data import nnUNetPredictor def get_torch_device(device='gpu'): assert device in ['cpu', 'cpu-max', 'gpu', 'mps'], f'-device must be either cpu, cpu-max, g...
3cd38515fec6f21b7e1703f2bb96313a4b74fbd423416aae509450acb125b4e5
Python
1,948
57
#!/usr/bin/env python """ This is part of the work-around for the lack of a 64 bit version of the AotfLibrary.dll file. Hazen 12/13 """ import socket import sys import AOTF my_aotf = AOTF.AOTF() my_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) my_socket.connect(("127.0.0.1", 9001)) e...
8a1f0ed31eb1a978b62b4dbb7052d853290d2aa50c9ce1eaf40a9cd1891a206f
Python
1,948
68
import click from matplotlib import pyplot as plt import numpy as np import pandas as pd from cycler import cycler purple = [.5, 0, .5, 0.9] purple_light = [.5,0,.5, 0.3] green = [0, 1, 0, 0.9] green_light = [0,1,0,.3] blue = [1,.3,0, .9] blue_light = [1,.3,0,.3] colors = [purple,green, blue] colors_light = [purple_l...
118167be7be858d422e3e90b7985575764d6e148801149b20f3188cae2f93d92
Python
1,949
64
import tkinter as tk from tkinter import filedialog import pandas as pd import matplotlib.pyplot as plt import librosa import librosa.display import numpy as np def open_files(): # show dialog to select CSV file csv_path = filedialog.askopenfilename( title="Select CSV(acceleration) file", filet...
55346071b9d96e3a8e0a0c1f78b23fec962e1885154b7a53776e5286cf31c5fd
Python
1,949
62
# Generated by Django 4.2.26 on 2026-05-06 19:53 import django.db.models.deletion from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("engine", "0103_alter_default_chunk_type"), ] operations = [ migrations.AlterField( model_name=...
01457c6acdc54e1a6b471e9c1da96dda6f5a3e84241a2881094c7d253313b1e5
Python
1,950
57
import torch import torch.nn as nn import torchvision use_cuda = torch.cuda.is_available() device = torch.device("cuda" if use_cuda else "cpu") from collections import namedtuple from torch.utils.data import Dataset, DataLoader #import spacetorch.analyses.rsa as rsa import argparse from urllib.request import url...
2174762c14de16d7a398242f637a56bcf313661951ffa6f05668c5ae85404b48
Python
1,950
67
""" A dense decoder """ from functools import partial from torch import nn from .utils import (get_norm_layer3d, get_activ_layer) class Conv3dBlock(nn.Conv3d): """ 3d convolution block with optional normalization and activation for the dense decoder below. """ def __init__(s...
53a4257d496f80205e22a91b0753e2ec61ca873ee95fdbacc5f7e2d5f758701b
Python
1,950
81
# -*- coding: utf-8 -*- """ Interface to write csv files of cell coordinates / intensities The module utilizes the csv file writer/reader from numpy. Example: >>> import os, numpy >>> import ClearMap.IO.CSV as csv >>> import ClearMap.Settings as settings >>> filename = os.path.join(settings.ClearMapPa...
9b7dc707a4e825008e01f17b9f439f69beeda73c2583a781e443886ffeaffd07
Python
1,950
63
""" MultiStep LR Scheduler Basic multi step LR schedule with warmup, noise. """ import torch import bisect from timm.scheduler.scheduler import Scheduler from typing import List class MultiStepLRScheduler(Scheduler): """ """ def __init__( self, optimizer: torch.optim.Optimizer, ...
550f6be01e8faae2c0205c874ca25c639de3ddd34a6a14a3bf78858fad0fa45e
Python
1,951
86
import sys import os import glob import gzip from optparse import OptionParser USAGE = """ count-kmer-maps.py --kdir <dir of kmer fasta files> counts kmer mapping positions """ ############################################################################### parser = OptionParser(USAGE) parser.add_option('--kdir'...
a942bea99ebd2b6ad3ad01a3c2812cd622ddbb3d5a5052039ddb52cf2c8bf7c5
Python
1,951
55
# Copyright (c) 2026 Rohit Jena. All rights reserved. # # This file is part of FireANTs, distributed under the terms of # the FireANTs License version 1.0. A copy of the license can be found # in the LICENSE file at the root of this repository. # # IMPORTANT: This code is part of FireANTs and its use, reproduction, or...
24568fedaeaa967e35c3a4ebcb3d1c2b28ece6cb1b65713f00bda35090beacba
Python
1,952
45
# ============================================================================================================================== # Author: Lucas Berg # ============================================================================================================================== import os import sys import numpy as np i...
3cbf5fcbecf14721a0f2793e1e946c13556531b821c28348b8e5269e5998ef17
Python
1,952
61
""" Tests for `bx.seq.seq`. """ import unittest import bx.seq from bx.seq import ( fasta_tests, nib_tests, qdna_tests, ) test_fa = "test_data/seq_tests/test.fa" test2_fa = "test_data/seq_tests/test2.fa" test_nib = "test_data/seq_tests/test.nib" test_qdna = "test_data/seq_tests/test.qdna" valid_fasta = f...
7b023f51d98b70f784728697d0f48ea3165d5830970544fdc68c2728d1707b96
Python
1,953
66
import typing from collections import OrderedDict from collections.abc import Hashable, Sequence from dataclasses import dataclass from typing import Literal from eir.setup import schemas from eir.setup.input_setup_modules.common import get_default_sequence_specials @dataclass class ComputedBytesInputInfo: input...
8644e5e7e95519f803fb49c1dba5b7ce92e067d4647fb725d3a56541ddb7ee94
Python
1,953
70
import glob import os import pandas as pd from psychopy import event from psychopy.constants import FINISHED def learn_anc(win, vidstim): vidstim.play() while vidstim.status != FINISHED: vidstim.draw() win.flip() keys = event.getKeys() if "escape" in keys: # rese...
f69c54bb049bd64b94db245830725fff039318328f0f6a0df9bf9442071be37d
Python
1,953
46
import torch from distances import DotProductSimilarity from utils import common_functions as c_f from utils import loss_and_miner_utils as lmu from losses.base_metric_loss_function import BaseMetricLossFunction from losses.mixins import WeightRegularizerMixin class NormalizedSoftmaxLoss(WeightRegularizerMixin, Base...