sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
def83a781048ff3a0c948bf0dbf3f4151f18f2bffc88139a78aec6e7cd97e477
Python
3,525
107
import numpy as np import SimpleITK as sitk def dice_coefficient(output, target, threshold=0.5, smooth=1e-5): """ Calculates the Dice coefficient between two binary masks. Args: output (numpy.ndarray): Predicted binary mask target (numpy.ndarray): Ground truth/Label binary mask threshold (floa...
79c92375288cee91519cc3dad315918ecbf8129a94a169efb11d68b597d754dc
Python
3,528
104
import argparse import logging import os import sys from datetime import datetime from gln.common.cmd_args import cmd_args as gln_args from models.gln_model.gln_trainer import GLNTrainer try: from models.transformer_model.transformer_trainer import TransformerTrainer from onmt.bin.train import _get_parser excep...
a706bc9f651dfc7319da9ab4b07b57139eff2695fbc882a12b3ffb96a46ca17f
Python
3,528
120
from __future__ import print_function """ Manage the vector strength summary files as .p files Creates a dict with rows (cells) and columns (experimental manipulations) Adds data to file, or prints results from the file Usage: import vspfile routines: vspfile.init_vsp() vspfile.add_data() vspfile.print_vsp() This m...
239c7babfba2ec4478fd0ebd4d35a871280f6eb8df3a94ca8ca0df2f2f0830d2
Python
3,529
103
# Copyright 2019-2026 The AmpliGraph Authors. All Rights Reserved. # # This file is Licensed under the Apache License, Version 2.0. # A copy of the Licence is available in LICENCE, or at: # # http://www.apache.org/licenses/LICENSE-2.0 # import tensorflow as tf import numpy as np from ampligraph.datasets import loa...
b8f103a0c181bd9a6a8c1d7daefc9d17c83d848f914e12695774d2c7d59ddfbf
Python
3,531
106
# Copyright 2019 DeepMind Technologies Ltd. All rights reserved. # # 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 appl...
53d8ad2409bcfb746ca89858980e104c3f25c6b7ef0e5b179f993315bbd089f8
Python
3,535
98
# Copyright 2019 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 agr...
04f227af394375110ff0a0e1b8a79137372f50299e74dedf8f833e111fcf204a
Python
3,537
70
import json import numpy as np import pandas as pd import pytest import torch from isoprism import IsoPrism from isoprism.benchmark import METHODS, build_queue, main, verify_prepared from isoprism.report import export_tables from short2long.competitive_model import CompetitiveAllocationNet from short2long.published_be...
a6b5da5956b32e99cb9741669f46e5204203996ec0dd572fd36e61a74ed45aea
Python
3,537
55
import unittest import os from marker_tools import get_nsforest_confidences from dendrogram_tools import dend_json_2_nodes_n_edges from nomenclature_tools import nomenclature_2_nodes_n_edges current_dir = os.path.dirname(os.path.realpath(__file__)) PATH_MOUSE_NOMENCLATURE = os.path.join(current_dir, "../dendrograms/no...
63d84622555dd570ac33087f951ab975b815463cf25593b6cc30762c42160fde
Python
3,538
93
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Thu Oct 11 17:46:18 2018 @author: tpisano """ import numpy as np, sys, os from skimage.external import tifffile from skimage import filters from skimage.morphology import binary_dilation, ball from tools.registration.register import similarity_transform, t...
65699aa07aad9b72716917facbe47cdfe5aee7c763ca7545b2a5bb7f62e86fc0
Python
3,539
114
# Copyright 2019 DeepMind Technologies Ltd. All rights reserved. # # 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 appl...
9a14f39be373c2e6d178a3b64d406470c145cfffa0e60e66042e78293b2d76d6
Python
3,544
99
# coding=utf-8 # Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved. # # 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 # # ...
c7c9d7b534e03f1e4384e52eb3ce8219aea2056c92e900fac746e6e2d511cd2b
Python
3,544
91
# data preparation for zebra fish. data reading, scaling, croping, adjusting data format and split into train/val/test # data loading # all the 69 stacks of data import os import numpy as np from scipy import ndimage import random import argparse from skimage.transform import resize import matplotlib.pyplot as plt ...
1e1834aa57c2acd4e3b44260c967107af1293d1ba8a38859f1d6e9b16df26d6c
Python
3,546
113
""" Test shuffled autorrelation. (for pytest) Shuffled autocorrelatioon routine testing We confirm that the status of the results for all 6 patterns is the same as defined in the audit. The test data are computed in the sac.py module This module is part of *vcnmodel*. Support:: NIH grants: DC R01 DC015901 (...
c9325531dbfea480a6fe05182d0d3d94329291905f8148a133a2cdbf4edeff29
Python
3,546
100
# Copyright 2018-2025 # Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH # 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/LICE...
4f100233a931d175093cf671629dbbe6937bf34fc258e2d04a87650064ff461e
Python
3,547
115
""" Test using sound stimulation to generate SGC spike trains. This script uses an_model.get_spiketrain(), which internally calls MATLAB to generate spike trains and caches the output. A higher-level approach is to use DummySGC, which will automatically feed the spike train into a synapse for input to downstream neu...
a1b6006d5bc270b9f2a951448d8ca8b6ffcef3622b7556b338303dacf8cea3dc
Python
3,548
98
#------------------------------------------------------------------------------- # Test handling for compressed debug sections # # Pierre-Marie de Rodat (pmderodat@kawie.fr) # This code is in the public domain #------------------------------------------------------------------------------- import os import unittest fr...
a3bf36fb3dae06c7f5a0f3d8ad8b2fc16c16c05f82378dd1896036db8f23e39e
Python
3,549
62
from __future__ import print_function import numpy as np from itertools import groupby from functools import reduce from operator import add from scipy import signal from featureExtractor import FeatureExtractor from globalTimeManagement import getTimeDiffInSeconds class FeatureExtractorRawDataWithSTFTWithTime(Feature...
ad55365b85ccf1ba043f1467364b6818483f3f613b530a1bc882b52ec6c2778c
Python
3,549
115
import sys import re import matplotlib matplotlib.use("Agg") from matplotlib import pyplot as plt import seaborn as sns sns.set_style("white") import pandas as pd from matplotlib.ticker import FormatStrFormatter colors = sns.color_palette("RdYlBu", 13) colors = sns.cubehelix_palette(7, start=2, rot=0, dark=0.05, li...
cec53d9e56106d9a9b1f0106a1a3eef6af0b82368a220549c6ab534b6d386fea
Python
3,552
96
# Copyright 2019 DeepMind Technologies Ltd. All rights reserved. # # 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 appl...
7993202ef0778d38337ac5deee5d25296ab30d212afe7c2ff04984413f552c2e
Python
3,553
113
"""Solar dataset for time series forecasting.""" import pandas as pd from sktime.datasets._single_problem_loaders import load_solar from sktime.datasets.forecasting._base import _ForecastingDatasetFromLoader __all__ = ["Solar"] class Solar(_ForecastingDatasetFromLoader): """Load the GB National Solar Estimates...
c51343cfed7af32f2f83ec6bcca7b6028259a9332947931ec151f6c7df1da968
Python
3,553
109
# Copyright 2026 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 agr...
60a50f1759beca88ba178bfce15d86313374a27eac513fffa51f44b7e03de808
Python
3,557
126
from lgn.models.autotest.lgn_tests import lgn_tests from lgn.models.autotest.utils import plot_all_dev from utils.argparse_utils import ( get_device, get_dtype, parse_model_settings, parse_data_settings, ) from utils.initialize import initialize_autoencoder, initialize_test_data from utils.utils import...
ca691c28084aeed76a5e40dc0b789b71a18d15804cf3566b0e86cf359d58499b
Python
3,559
107
import os import numpy as np # Read in all files and split them according to the specification. with open("dataset/abstracts.csv") as f: abstracts = f.read().strip("\n").split("\n") with open("dataset/content.csv") as f: content = f.read().strip("\n").split("\n") with open("dataset/features.csv") as f: f...
4e02d5643d77b88d0141a6d10fcba7a4cf682242a581b3566e3978fd782102dc
Python
3,560
82
# Copyright 2007 Zachary Pincus # This file is part of CellTool. # # CellTool is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. import re import freeimage from celltool.contour import contour_class...
584370fab610e51bbafe925ab690fd6911591469f2f289b58a2066270cb822e7
Python
3,560
84
#------------------------------------------------------------------------------- # elftools tests # # Yann Rouillard (yann@pleiades.fr.eu.org) # This code is in the public domain #------------------------------------------------------------------------------- import copy import os import unittest from typing import Cla...
adf781edc19639199e6db0e61447eb0bff40bb79614a0456aeef325125b2fd25
Python
3,561
111
# Copyright 2019 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 agr...
876e0573952d6a8b8971bde1d05694fec9a48028ab72e6f023bf2ce9f7c9b166
Python
3,565
103
# Copyright 2026 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 agr...
7328d6c3e86ed25dd4330a1ff169e12623b2f575d233f11b7240737cc67fcf4f
Python
3,566
101
# Copyright 2019 DeepMind Technologies Ltd. All rights reserved. # # 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 appl...
9b3609d95268a1a58429bc7e61894779c4f2890a92c35baa71e70e0a9d2ee7af
Python
3,570
88
# Copyright 2019 The TensorFlow Authors. All Rights Reserved. # # 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 applica...
dbba0745da0694e87c9417c5adde9df66e1def9bab6f10b6bbbe55b8a90f9500
Python
3,570
98
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class DepthToSpace(Base): @staticmethod def export_default_mode_exam...
034475cd47164cf8328303e4e4641138cc67ed8fcec1000119f74d005da08a8f
Python
3,573
100
"""Tests for HMM annotation estimator.""" __author__ = ["miraep8"] import numpy as np import pytest from numpy import array_equal, asarray from scipy.stats import norm from sktime.detection.hmm import HMM from sktime.tests.test_switch import run_test_for_class @pytest.mark.skipif( not run_test_for_class(HMM), ...
e558c343a2cc280d7037987a37bc9139c8105473d5fe18fbba1b52ed00e63f72
Python
3,577
107
""" Make a master file list for a group of runs This list is created after the runs are done, and in a subdirectory. """ from pathlib import Path import pickle import toml import datetime from dataclasses import dataclass, field from typing import Union, Dict, List import dataclasses # @dataclass # class Rundata: # ...
f00ee7b014ab913d484d1d7fe1accb7a2b542a34028bf71553887819ac2e55b0
Python
3,578
100
# Copyright (c) Open-MMLab. All rights reserved. import os import os.path as osp import tempfile from unittest.mock import MagicMock import matplotlib.pyplot as plt import mmcv import numpy as np import pytest from mmcls.core import visualization as vis def test_color(): assert vis.color_val_matplotlib(mmcv.Col...
140acbc785c5998dab2aabe5bf8ddcf919d042c4bd1ba1b076d7edc0e0012ede
Python
3,581
100
"""Testing panel converters - internal functions and more extensive fixtures.""" import numpy as np import pandas as pd import pytest from sktime.datatypes import check_is_mtype from sktime.datatypes._series_as_panel import ( convert_Panel_to_Series, convert_Series_to_Panel, convert_to_scitype, ) from skt...
7962fb61ee851e94882f4b2002b60f941e143b105dcff1cae4826d10fa686649
Python
3,581
103
# coding=utf-8 # Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved. # # 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 # # ...
85e5c17a7e52ab775511c1d26f85b8aecee7f67397cb736aa7e78ed15ce3cf80
Python
3,583
113
# Copyright 2018-2025 # Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH # 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/LICE...
e64e492cc1b984ff44b84e6c4fa3574454b49ff4c25a5f33b0bb27fedc0a93f0
Python
3,583
80
# SAFE TEAM # # # distributed under license: CC BY-NC-SA 4.0 (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.txt) # # import argparse from dataset_creation import DatabaseFactory, DataSplitter def debug_msg(): msg = " DATABASE UTILITY" msg += "-------------------------------------------------\n" ...
fc546b3815d07a5a7b5d93382fd5d1a312932a50561b6ea7359243a2107f5869
Python
3,584
118
from __future__ import division import re import numpy as np import pandas as pd class Node(object): """ Class for extracting the structure of vrml files """ def __init__(self, dict): """ Initialize an instance of the "Node" class from a file name. Parameters ...
567d366aefcb2b29cee5221fa8bca3ab3c427fb243f569b88bbc8415c4d7d165
Python
3,585
108
# Copyright 2018-2025 # Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH # 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/LICE...
3835aefc124250b35710a754d32084935aa7c6aa57140619ae9f13e1d66dd896
Python
3,587
93
# Copyright (c) OpenMMLab. All rights reserved. from functools import partial import pytest import torch from mmcls.core import average_performance, mAP from mmcls.models.losses.accuracy import Accuracy, accuracy_numpy def test_mAP(): target = torch.Tensor([[1, 1, 0, -1], [1, 1, 0, -1], [0, -1, 1, -1], ...
0931b3ad1ca07035981174d60d6d97d598e745515a5a560bd604fd5750e88688
Python
3,589
120
# Copyright 2026 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 agr...
418d98b41024c39597c19d532e20f1c7640996aa28b20ff96502a4a8ad71084c
Python
3,589
98
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.ops.aionnxml._common_classifier import ( compute_probit, compute_softmax_zero, expit, ) from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunA...
ff33a7d8efb74d7a9d6b2f7f59c183394bf639bf0be66937b6e2f7287da2f2a6
Python
3,590
125
"""Tests for bycycle.utils.dataframe.""" import pytest from copy import deepcopy import numpy as np import pandas as pd from bycycle.utils.dataframes import * ################################################################################################### ########################################################...
ac5067ece95d99bb377b6bf7ea74772be7ddd6c19608bc1eec17fd89eeae0115
Python
3,591
113
#!/usr/bin/env python3 # CBDA validation and training set creation. # This script defines the set of ordinal line numbers to use for the validation # set of a CBDA project. # # Inputs: # File name of original data file. # The following assumptions are made about the contents of the file: # It ...
feee50e93820f12f949175d3b878a63ce54bdf9e9a9744fe94cac5ad70f5f619
Python
3,591
103
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np class TreeEnsembleAttributes: def __init__(self): self._names = [] def add(self, name, value): if not name.endswith("_as_tensor"): self._names.ap...
f429d14b314527c175bf3ef04f0836773df6d4da4359d003f24ac77e31c9afd7
Python
3,592
74
# Setup import warnings warnings.filterwarnings("ignore") import numpy as np import pandas as pd import pickle as pkl import matplotlib.pyplot as plt import matplotlib as mpl from sccoda.util import comp_ana as mod from sccoda.util import cell_composition_data as dat from sccoda.util import data_visualization as viz ...
4eeb742367958f4c0d6fd53621b0398926ecc04eb944e2d36ed306d7aa482bc7
Python
3,593
125
import pandas as pd import os import Levenshtein BASE_PATH = 'data/tl_train/U6T7/' PRE_TRAIN_PATH = 'data/pre_train/DeepHF_old/' def get_folders(path): folders = [] names = [] for folder in os.listdir(path): if os.path.isdir(os.path.join(path, folder)): folders.append(folder) ...
f3cb1493aa1402db0df9275971d51e3af5d76cf075140bd7cbbf203afb4c89d6
Python
3,596
106
import os import h5py import numpy as np from sklearn.metrics import roc_curve, auc, precision_recall_curve, accuracy_score, roc_auc_score def make_directory(path, foldername, verbose=1): """make a directory""" if not os.path.isdir(path): os.mkdir(path) print("making directory: " +...
85e502d84643f6fd56304cad3b8bffac46143c35b410cfd0c61716edf85b93ce
Python
3,597
111
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file) # Ported from skchange (BSD-3-Clause), original authors: johannvk """Multivariate Gaussian change score.""" __author__ = ["johannvk"] import numpy as np from sktime.detection.base._base_interval_scorer import BaseIntervalScorer from sktime.detec...
d4861e90de343d52e2cefe501122e1d37f7e2452a4252abde319c38d2ff48207
Python
3,597
84
import numpy as np import joblib import torch from torch_geometric.data import Data class FileLoader(torch.utils.data.Dataset): """Data loader for graph data. The loader will use features defined in features.yml.""" def __init__(self, file_list, feat_names, feat_stats, norm, data_clean): self.file_l...
d512cdbcdd978339b431294d97faf319ce023eef724189d24a00e216119bb174
Python
3,604
107
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the 'License'). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the 'license' file acc...
b222eab8447085645821d45e6522332757b344d94fc9ec29203207affd593cd2
Python
3,606
111
''' @author: Nicholas Browning ''' from __future__ import print_function from builtins import str import os import sys import argparse import openbabel from src import outprocesses as op import subprocess def sander_minimize(mol, out_mol, num_procs): delete_files = ["mol.pdb", "mol.prmtop", "mol.inpcrd", "mol.rs...
08263ef4954b7e54eea1117663fe1c1e5a0fde8218a672fecdca1466532befe6
Python
3,608
116
# Copyright 2019 DeepMind Technologies Ltd. All rights reserved. # # 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 appl...
7e84ef732a78d01c7444e9bb218f667e34424dce2d0b0b050f455802aea788e5
Python
3,612
81
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! import grpc from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 import real_time_payoff_tracker_pb2 as real__time__payoff__tracker__pb2 class RealTimePayoffTrackerStub(object): # missing associated documentation comment i...
459db2a0094d6485a076edc5853cc70343d95da1da4e880840261c97154e9226
Python
3,613
109
"""Tests for bcblib.imaging.info.""" import numpy as np import nibabel as nib import pytest from bcblib.imaging.info import ( header_summary, header_dump, header_field, format_summary, format_summary_short, format_dump, ) def _make_nii(shape=(4, 5, 6)): data = np.zeros(shape, dtype=np.float32) retur...
837c9bee88aa8001c2fab005ee5140e206efdf5faf117ec57d8aa5ae94eb85bf
Python
3,613
103
import argparse import math import os import matplotlib.pyplot as plt import numpy as np import torch import wandb from torch.utils.data import DataLoader from tqdm import tqdm import src.model.metrics as module_metric from src.trainer.trainer import Trainer from src.utils.config import process_config from src.utils....
c005d2fdd13e4d9ed9f04cd10e26f82d20df593ab11844f023d90b9b219228d0
Python
3,613
175
from __future__ import division import numpy as np def cart_to_spherical(x, y, z): """ Convert coordinates from Cartesian to spherical. Parameters ---------- x : float x coordinate. y : float y coordinate. z : float z coordiante. Returns ------- r...
30170c8c14fbf2f9b4ff9aa9ad6ced5284f36d1e5b7cdffc9f04ced56abaa158
Python
3,615
108
"""Testing mtype/scitypes lookup.""" __author__ = ["fkiraly"] from skbase.utils.dependencies import _check_soft_dependencies from sktime.datatypes._registry import ( generate_mtype_register, generate_mtype_soft_deps, mtype_to_scitype, scitype_to_mtype, ) def pytest_generate_tests(metafunc): reg...
4716d6d63b9c5b4869f48bc489c9c4ba744a96f4b79edf9ed0be4473c30d2741
Python
3,615
95
import matplotlib.pyplot as plt import numpy as np from Historia.cellcontr import solver as solcontr from Historia.ep import solver as solep from Historia.shared.plot_utils import get_col def fun(axes, rat, color): # --------------------------------------------------------------- # Electrophysiology hz =...
a43839f4e93020b75f4290da86c7b68c0705b02c26ebe1653107d7e3ad8369e7
Python
3,615
104
import numpy as np from keras.models import * from keras.optimizers import * from sklearn.metrics import mean_squared_error, r2_score import scipy as sp from scripts import models_util from scripts import data_handler as dh from keras.callbacks import Callback def scheduler(epoch, lr): learning_rate = 0....
23e11eee7db6a886ca981b98c1ecf8bd38746611c5dc80723b4b290dbd6daef5
Python
3,616
86
# Copyright 2022 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 agr...
8f6e3a7ee164da0eb865758576e4eb40f40a761bb90f76508cf86610afc78d08
Python
3,618
116
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Creates example patient plot in Figure 4 from Wang et al. (2023) Temporal stability of intracranial EEG abnormality maps for localizing epileptogenic tissue. Calculates time-varying D_RS from abnormalities before plotting. Choose example patient at beginning of scr...
fe22fcbe901ed5c767da2d7938282652426c4ea8a4876251ad00dada08adddee
Python
3,618
92
''' Pure-python implementation of UCSC "liftover" genome coordinate conversion. Liftover coordinate conversion correctness test. Copyright 2013, Konstantin Tretyakov. http://kt.era.ee/ Licensed under MIT license. ''' import os.path import gzip import sys from pyliftover.liftover import LiftOver THIS_DIR = os.path.d...
7feedbbd4375aeab5ebf2bca48fe2c3b2b17f9831af616d22e29b9ebf0d7a7f0
Python
3,620
88
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import pytest from onnx import TensorProto, checker, helper, numpy_helper, version_converter from onnx.reference import ReferenceEvaluator from onnx.reference.op_run import OpRun c...
10429ca473ab152f5cd3a521f289506055b7e6c526b94866b0044c30ad072cb2
Python
3,621
112
from __future__ import print_function import numpy as np from scipy.ndimage.filters import gaussian_filter class Perturb(object): """ Callable class for in-place image perturbation. """ def __init__(self): raise NotImplementedError def __call__(self, img): raise NotImplementedErro...
7e62c831885c0e9f4070e244da94b63089fc46e786dadae78fa6152a7afbef65
Python
3,621
112
# Copyright 2026 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 agr...
0d7fcc3488ee5e31023d554bbd6e2d01b654d0101d13077cd6fed9aa8e2dc07d
Python
3,622
115
#!/usr/bin/env python import click from functools import partial from multiprocessing import Pool import os import pandas as pd import re import subprocess as sp import sys sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), os.pardir, ...
9384cbd582e8ad8b7db4d9bc6ae0ed54d69950e6d9bbe6c3ef304c2dd6fcc20d
Python
3,623
96
# Copyright 2019 DeepMind Technologies Ltd. All rights reserved. # # 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 appl...
95982f3c217c703c3ce1e093ddbb75b9c1aabe39f91c462a4fdb17d4288cffee
Python
3,623
114
import logging from pathlib import PosixPath from typing import Optional, Tuple import ants from omegaconf import DictConfig from rich.logging import RichHandler from roiloc._cache import handle_cache from roiloc.locator import RoiLocator from hsf.roiloc_wrapper import save_hippocampi FORMAT = "%(message)s" logging....
5c9ca3effe0a0feeb6d9f936c3a77aa53c34957c24e347d0791363ca9ecb6a15
Python
3,624
132
import click from itertools import product from pathlib import Path from typing import Iterable import warnings import pandas as pd classifiers = ( 'xgboost_cce', 'logistic_regression_cce', 'logistic_regression_ovr', ) segmentations = ( 'freesurfer', 'sri', ) def load_results(filename: Path) -> ...
77ca316029b1c409933f5ac3d110d32b4947f216a2b0a8f8ad5afe6065df831f
Python
3,625
117
# -*- coding: utf-8 -*- # # Copyright © 2013 Charles E. Vejnar # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at https://www.mozilla.org/MPL/2.0/. # import logging import os import subprocess fro...
70f926be29e2cf5eb63d2649405b281e71f2f3f65435a1a58ed5a4bb1e32689f
Python
3,626
95
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx import TensorProto, helper, numpy_helper, shape_inference class TestTrainingTool: def test_training_info_proto(self) -> None: # Inference graph. ...
697ff3dc9107e0dadebda40110257bc83b6821876e1e99d478a1f7630a365527
Python
3,627
104
#!/usr/bin/env python3 #!/usr/bin/env pypy3 """Set qnames based on the curies defined for a given ontology. Usage: qnamefix [options] qnamefix [options] (-x <prefix>)... qnamefix [options] <file>... qnamefix [options] (-x <prefix>)... <file>... Options: -h --help print this -k --keep ...
c051843b9abbb2660c132267726b83864da049269b2accebd440361bca8f5ee9
Python
3,627
110
import gzip import shutil # for removing and creating folders import urllib import warnings from pathlib import Path import requests import yaml from Bio import SeqIO from Bio.Seq import Seq from tqdm.autonotebook import tqdm from yarl import URL from .paths import DATASET_DIR_PATH, DATASET_URL_PATH def _guess_loc...
fc956f53c540112e28a76552ea44b4bc874a5ccdd43b78c4d0ac28386369e470
Python
3,627
106
# Copyright 2026 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 agr...
c5451c4cf78d0905c9e3121e405cd0dc20b11e2a2c65b234c5dda0d34fd42896
Python
3,628
77
# 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 # # http://w...
e74adfe05d9b2b243a383016bdd64765e70c8a0e3be7c589c01bbad85ce0fd87
Python
3,628
136
"""Example generation for testing. Exports examples of in-memory data containers, useful for testing as fixtures. Examples come in clusters, tagged by scitype: str, index: int, and metadata: dict. All examples with the same index are considered "content-wise the same", i.e., representing the same abstract data objec...
f1dc31ad82328ed89753265c25dc329b7a9ae7dfbf03246b652aa6f8bfd76d02
Python
3,628
99
import os import numpy as np import pickle import keras from scripts_tool import models_util from scripts_tool import training_util gl_init_lr = 0.0008 def create_data(config, DataHandler): # Create main dir data_dir = f'tool data/datasets/{config.new_data_path}/6_fold/' if not os.path.exists(data_dir): ...
0fb9d24a1b8fca0d580a4345b706b99475cdb1f16d0064203b7560cf332317a4
Python
3,631
95
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class LpNormalization(Base): @staticmethod def export_l2normalizatio...
afe5706b626bd43f371a73b3728193f7ea5b92850e85c017bbb6019ef790f9a8
Python
3,633
117
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file) # Ported from skchange (BSD-3-Clause), original authors: Tveten, johannvk """Base cost function for interval-based scoring.""" __author__ = ["Tveten", "johannvk"] from sktime.detection.base._base_interval_scorer import BaseIntervalScorer class...
32d66f7a77154847d54161b29755bf35de759ef62bbf13da4c7e9a11a8384dbb
Python
3,635
97
from copy import deepcopy import sys, os import torch import numpy as np from vp_suite.models import PhyDNet as OurModel from vp_suite.utils.models import state_dicts_equal REFERENCE_GIT_URL = OurModel.CODE_REFERENCE REPO_DIR = "PhyDNet" # noinspection PyUnresolvedReferences def test_impl(): from models.model...
6c3ccc140196bc664b1b294470ee0c58f68ce7d2c7a7459941419a1e5a8a1b72
Python
3,637
99
""" Model component of the MVC pattern for pciSeq diagnostics. """ import redis import pandas as pd import numpy as np import logging from typing import Optional, Dict, Any from pciSeq.src.diagnostics.constants import DiagnosticKeys model_logger = logging.getLogger(__name__) class DiagnosticModel: def __init__(...
090550bd1b371ebf9b3d9e5aeae2a59a1f390532d394baec7828bff4dfe27a4e
Python
3,638
60
import argparse from trainer import Trainer from utils import init_logger, load_tokenizer from data_loader import load_and_cache_examples def main(args): init_logger() tokenizer = load_tokenizer(args) train_dataset = load_and_cache_examples(args, tokenizer, mode="train") test_dataset = load_and_cache...
e047488c1597dceea8fadb81cff4c301d9de7a7a52a960df90e99233d9a29309
Python
3,639
80
from types import SimpleNamespace import numpy as np from scipy import sparse import torch from short2long.unified_data import select_catalogue from short2long.unified_benchmark import PlainMLP, classical_fit, classical_predict from short2long.unified_metrics import moran, spatial_metrics from short2long.coverage_retr...
4c89dbe2d89c7779c7994cf00b44f48e99449f13dc55246b08a003b2a4ca53a4
Python
3,641
92
import unittest from onmt.inputters.image_dataset import ImageDataReader import os import shutil import cv2 import numpy as np import torch class TestImageDataReader(unittest.TestCase): # this test touches the file system, so it could be considered an # integration test _THIS_DIR = os.path.dirname(os.pa...
ed425b38182b5611765519b16eb2b3485c187e9f40a88a8581684b549f8a9aab
Python
3,642
113
# SPDX-License-Identifier: LGPL-3.0-or-later """The model that takes the coordinates, cell and atom types as input and predicts some property. The models are automatically generated from atomic models by the `deepmd.dpmodel.make_model` method. The `make_model` method does the reduction, auto-differentiation and commun...
05061e49c71041f12440475e02e96f3a3bf7619451ac5b4a17d1a04e2eca0761
Python
3,643
98
import numpy as np np.random.seed(1234567) import random random.seed(1234567) from collections import Counter import re, os, csv, math, operator import pandas as pd #Contains 86 elements (Without Noble elements as it does not forms compounds in normal condition) elements = ['H','Li','Be', 'B', 'C', 'N', 'O', 'F', 'Na...
2449a6fde71acb1067bc67190fbad8d148e39165ab13c260db2615472985705c
Python
3,644
100
import torch import torch.nn as nn class RevIN(nn.Module): def __init__(self, dim=-1, std_min=1e-5, max_val=100, use_sinh=False): super().__init__() self.dim = dim self.std_min = std_min self.max_val = max_val self.use_sinh = use_sinh def fit_transform(self, x, mask=No...
51137902d4df89351a90821eefc78b0d1fb4dc484cbfb9f248e4d6b491efdce9
Python
3,646
120
# roifile/setup.py """Roifile package setuptools script.""" import re import sys from setuptools import setup def search(pattern: str, string: str, flags: int = 0) -> str: """Return first match of pattern in string.""" match = re.search(pattern, string, flags) if match is None: msg = f'{pattern...
daf58f06a87d5dd4dcd35fc1cfd44f5c16bac466a1dcd0348d8bfeb6f816194b
Python
3,647
108
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file) """Implements compositor for ignoring exogenous data.""" __author__ = ["fkiraly"] from sktime.forecasting.base._delegate import _DelegatedForecaster class IgnoreX(_DelegatedForecaster): """Compositor for ignoring exogenous variables. C...
8ff02002d260e05b92f07b7513436e467c0f72462646506a557cc609198caf03
Python
3,648
116
import logging import random from collections import defaultdict import torch from torch.utils.data.sampler import Sampler log = logging.getLogger("flair") class FlairSampler(Sampler): def set_dataset(self, data_source): """Initialize the data source for the FlairSampler. Args: data...
e296c5b30a74ed7f404c2f074d98d8f89109cfb61c421c7e77ab783db8108b7b
Python
3,649
97
# In Nomine Functions Team # distributed under license: GPL 3 License http://www.gnu.org/licenses/ import argparse import numpy as np """ Precision = #correctly_predicted_tokens / #predicted_tokens Recall = #correctly_predicted_tokens / #original_tokens """ def calculate_precision_recall(original_names, predicted...
9c4025d6e12b2f5bfd06a7446dd682fbbf4ce5a5dc1a3d3c240450bba0d33124
Python
3,651
118
import io import lmfit import numpy as np import pandas as pd import seaborn as sns from lmfit import Model from matplotlib import pyplot as mpl from pylibrary.plotting import plothelpers as PH from pylibrary.plotting import styler as ST # all runs 20 dB SPL 8/28, 8/29 2020 pbm 100ms pip # Plot the FSL and SSl for ea...
4be791945aa8c559f3188cfb42caad5a01a0bf5fc50ea63c1cf3c86119d2141b
Python
3,652
98
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file) """Unit tests for (dunder) composition functionality attached to the base class.""" __author__ = ["fkiraly"] __all__ = [] import pytest from sklearn.preprocessing import StandardScaler from sktime.clustering.compose import ClustererPipeline from...
03bf7372a7cbb87641c7ed83daf7ccdeb4402ac2b05ac5fb21d9a5384161c4e2
Python
3,653
84
import numpy as np import pickle from parameterSetup import ParameterSetup from fileManagement import getFileIDs from evaluationCriteria import y2sensitivity, y2confusionMat, printConfusionMat from sequentialPrediction import classifySequentially from featureExtractor import featureExtraction from classifierTrainer imp...
a0022ae2abcb1ce14b347333a0a11a942d11b208cef365f7daa009ac3c8e34c7
Python
3,655
122
# Copyright 2019-2020 The ASReview Authors. All Rights Reserved. # # 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 appl...
036f97b2c301139953786e0a4e4635aa5cb0823bedbc62045db14e03ba8135f5
Python
3,656
101
import argparse import logging import os import sys from datetime import datetime from gln.common.cmd_args import cmd_args as gln_args from models.gln_model.gln_tester import GLNTester try: from models.transformer_model.transformer_tester import TransformerTester from onmt.bin.translate import _get_parser excep...
69f71e389eb5ce061a515ad42d4656d07de71fb61f844fda7ee43b77afd6fee6
Python
3,659
121
# SPDX-License-Identifier: LGPL-3.0-or-later """Model wrapper for Uni-Mol v1 self-supervised pretraining.""" from typing import ( Any, ) import array_api_compat from deepmd.dpmodel.array_api import ( Array, ) from deepmd.dpmodel.atomic_model import ( DPUniMolAtomicModel, ) from deepmd.dpmodel.common impo...
69892b8e00463748ecd6a07027ec3916a1b26276425718eb70ca91932608d7f0
Python
3,661
108
# Copyright 2022 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 agr...
8d3e46a0c24c4310b5f69a143fee6bec6543d117251fe2c3af8882122a6c3d87
Python
3,661
102
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Apr 14 14:45:34 2022 @author: nagehan """ import matplotlib.pyplot as plt import numpy as np # Sulcal depth with respect to shape # Surface area small - senegal galago, night monkey, white faced saki s1 = [[1.23,2.32,2.73], [0.93,1.74,1.98],...