sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
0bf723688a0cdaa89434938fff0dfcc6bd132233047e7d43dcb01fac37ac8a15
Python
4,119
146
import pytest import torch from torch.testing import assert_close from ..data_processors import ( DefaultDataProcessor, IncrementalDataProcessor, MGPatchingDataProcessor, ) from ..normalizers import UnitGaussianNormalizer from neuralop.tests.test_utils import DummyModel def test_DefaultDataProcessor_pi...
49b14733dd25ef93ac7dd3b7cd998b955060b1f6762c0bc72f35af9d2bf8bc24
Python
4,120
120
import numpy as np from graspologic.utils import largest_connected_component import pandas as pd def get_paired_inds(meta, check_in=True, pair_key="pair", pair_id_key="pair_id"): pair_meta = meta.copy() pair_meta["_inds"] = range(len(pair_meta)) # remove any center neurons pair_meta = pair_meta[pair_...
cc3f52d373031333f676880676e0fa2652d3ad69a44ec27069e08d4959af1e6a
Python
4,120
107
"""Tiny stdlib HTTP helpers (JSON + multipart) so worker adapters stay dependency-free.""" from __future__ import annotations import json import mimetypes import os import secrets import tempfile import urllib.error import urllib.request from pathlib import Path from typing import Any, Iterable class HttpError(Runt...
dd477b1511d26065d0bcd18036a1abc4fb78087f60a044822e3f82d3a5fd7479
Python
4,121
126
import argparse import logging import spacy import json import multiprocessing import numpy as np import time from tqdm import tqdm import matplotlib.pyplot as plt from os.path import join nlp = spacy.load('en_core_sci_sm', disable=['ner', "tagger"]) def get_ngrams(orig_text): doc = nlp(orig_text) if args.lem...
0901f53169e42700b7608c0de85c13ffe9fb69bd940e41d245374bdcc9dbac3e
Python
4,122
104
# -*- coding: utf-8 -*- # Generator classes to dynamically load the data. # COPYRIGHT: TU Delft, Netherlands. 2021. import glob import h5py import random import numpy as np from tensorflow.keras.utils import Sequence class DataGenerator(Sequence): """ Generates data for Keras. Assumes that the data is stor...
965e869e91eadfeb79ca67c6085d79882b8b2fb7d6ce546543ea1e77ffc8a443
Python
4,122
116
from src.utils.tokenizer import smi_tokenizer, remove_floats from sklearn.model_selection import train_test_split from chembl_structure_pipeline import standardizer from rdkit.Chem import MolStandardize from rdkit import Chem import modin.pandas as pd import os os.environ["MODIN_CPUS"] = "16" os.environ["MODI...
86a71891ee80ce916071c712ca499fa2cab409aeb60283ff1c8bb3cc761beb86
Python
4,123
109
# Copyright (c) 2015-present, Facebook, Inc. # All rights reserved. import os import json from torchvision import datasets, transforms from torchvision.datasets.folder import ImageFolder, default_loader from timm.data.constants import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD from timm.data import create_transform ...
d57f35ecb6d4ac99ca28597792cd18ec38582f838c82bfaea272180ede761247
Python
4,124
130
import torch from torch import Tensor from torch.nn import PairwiseDistance as pdist def make_node_ref(nodes: torch.Tensor): ''' Makes a node reference to unite node indicies across explanations. Returns a dictionary keyed on node indices in tensor provided. Args: nodes (torch.tensor): Te...
565909f043309d07271529f1b71e4fb0aa776e6b0e1332ab3d77e07f842e0a46
Python
4,125
163
# -*- coding: utf-8 -*- """ Created on Tue Jul 20 18:47:06 2021 @author: N.V """ import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation from matplotlib.animation import FuncAnimation import os # note that this must be executed before 'import numba' os.environ['NUMBA_DISABLE_INTEL_...
46750d639558d95e34584caf8800a80ec4b6b7b5a9eed21a7d3e3ae8af593f91
Python
4,126
154
"""Elekta Task Dataset: AE-HMM Pipeline. In this script we train an Amplitude Envelope Hidden Markov Model (AE-HMM) on source reconstructed task MEG data. The examples/toolbox_paper/elekta_task/get_data.py script can be used to download the training data. Functions listed in the config are defined in osl_dynamics.co...
6d7f107458ea1c53b1fb1f1e9f056bdd133b8d1489840bd83a5bad0586d510f8
Python
4,126
129
# # Expansion Hunter Denovo # Copyright (c) 2017 Illumina, Inc. # # Author: Egor Dolzhenko <edolzhenko@illumina.com>, # Sai Chen <schen6@illumina.com> # Concept: Michael Eberle <meberle@illumina.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General...
db371129b61e4320de1f53253514619e329e20193577fe4d1f9b976ea255c21d
Python
4,127
119
import sys import os import hashlib import struct import subprocess import collections import argparse import re dm_single_close_quote = u'\u2019' # unicode dm_double_close_quote = u'\u201d' END_TOKENS = ['.', '!', '?', '...', "'", "`", '"', dm_single_close_quote, dm_double_close_quote, ")"] # acceptable ways to end ...
e289ee59218c041f50fa15eeb24caa438f7e7219ac2cfa141b50c4f563c0eac1
Python
4,128
146
""" Set of standardized tests for RACCOON F. Comitani @2020-2022 """ import sys import json import argparse import numpy as np import pandas as pd from sklearn.datasets import make_blobs from clustering import * from classification import * from update import * def _create_dataset(): """ Creates a dummy dat...
e45514a742e3752c392d851c51bf41b41473fc8d7d2871431ca12877f3f9cb86
Python
4,128
116
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from scipy import stats import matplotlib.ticker as mtick def plot_data_vs_fit(xdata, ydata, fit, xlabel, ylabel, title, **kwargs): # plot data and fit f = plt.figure(figsize = (7,5)) plt.scatter(xdata, ydata, la...
d0c6b2bb494b336b3b670b93118df997bc8bf40ca4499a7b1fa156900e8ff789
Python
4,133
90
# Copyright 2021 Huawei Technologies Co., Ltd # # 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 agreed to...
5949cd19fc537ced8db357dc612a18e103206d73c920b65da4867ab284b6ab9e
Python
4,134
146
import argparse import glob import os import re import numpy as np import multiprocessing as mp import traceback """This script is used to condense Bcl-2 family energy tables for a protein-peptide complex into one just for the 20-amino-acid length peptide. This is done by adding all pair energies between the peptide a...
d1b1bafabfb7fcefb89e7996b811e0a987e179c5d93a3326f00b13cb7ed16854
Python
4,134
127
from tctx.analysis import simbatch as sb from tqdm.auto import tqdm as pbar from tctx.analysis import amat as am import numpy as np import pandas as pd from matplotlib import pyplot as plt def extract_batch( batch_original, sim_gids, min_participation=None, rank_method='first', ei_type='all',...
5915b4515356ff5a5c2a7d91a5ed1a35ab8713e363f9bea16f1f81d3781ca455
Python
4,135
145
# Get statistics for a given file (pickle) of SG instance import os, argparse import torch import numpy as np from graphxai.datasets import load_ShapeGGen import matplotlib.pyplot as plt from sklearn.linear_model import LogisticRegression from sklearn.model_selection import GridSearchCV from graphxai.gnn_models.node_...
cf90da4af559771e28bfcbfde724a472ccfdef4b32eb99cf1e8f82b6007dac31
Python
4,135
128
from mpi4py import MPI import glob import simulator as sm import os import numpy as np import sys # Note rank 0 is not used for simulations. It causes problems with the subprocess module. comm = MPI.COMM_WORLD rank = comm.Get_rank() nproc = comm.Get_size() # print('nproc = ', nproc) sim_name = '/global/home/users/ya...
fa30ca6095461c09b2ec684119c031229461f749da541cb8a2288dbfda8aecc6
Python
4,135
125
import numpy as np import os from ..preprocess import permute as perm from ..utils import path as pth class Brain: """A class containing data that represents a single brain. Attributes: connectome (array): Array of the connectome. reducedConnectome (array): Connectome with extreme components...
2e5218eba330eceb788ad2a3d59d07e2b4ee8268708c0c5bab763ae18a70e5f9
Python
4,136
113
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. # Set up custom environment before nearly anything else is imported # NOTE: this should be the first import (no not reorder) from maskrcnn_benchmark.utils.env import setup_environment # noqa F401 isort:skip import argparse import os import torch...
6de23cbfe984d97e2f829ccc7489ea2239421a59d80e36f3f1d0e7a7b0e8e030
Python
4,138
177
# Libraries import pandas as pd import numpy as np import pickle # Path path = './combined_tidy_v0.0.10.csv' # Read data ad model data = pd.read_csv(path, parse_dates=['date']) # Describe. data.describe().T.to_csv('data.describe.raw.csv') # --------------------------------------------------- # Data pre-processing a...
1f172cb88850390875dbacac98bb6358ea3609d3b77dd9386c73b7d0aee90267
Python
4,139
125
from __future__ import print_function import numpy as np import argparse import torch import pdb import os from slideflow.clam.utils import * from slideflow.clam.utils.eval_utils import initiate_model as initiate_model from slideflow.clam.models.model_clam import CLAM_MB, CLAM_SB import csv def path_to_name(path): ...
36fbee780f5733ebbb034c11480043f016a438020cddae66a9a22e354682e433
Python
4,140
114
import os from os.path import join import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestRegressor from sklearn.model_selection import ShuffleSplit, GridSearchCV from sklearn.metrics import (mean_absolute_error, mean_squared_error, ...
44aa9eaf44f8047bd53c178be37bdc1b23ee854b69452f8fa9f3a9290e839ab8
Python
4,140
121
# This script is part of navis (http://www.github.com/schlegelp/navis). # Copyright (C) 2018 Philipp Schlegel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
47f05a692d38749a80874e2972bfe0fdec1802644259969a333a6ebe523af2f2
Python
4,140
128
import argparse import os from glob import glob import medmnist import numpy as np import tensorflow as tf from medmnist import INFO, Evaluator from medmnist.info import DEFAULT_ROOT from PIL import Image from tqdm import tqdm def main(data_flag, input_root, output_root, model_dir, run): if not os.path.isdir(ou...
8558c00a37a5aa8947646b6e3173c7a330857d49e48c860f7fae7776a9fc1151
Python
4,140
117
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # import os import argparse import numpy as np import torch from torch.autograd import Variable from torchvision.utils import mak...
526f1e2f9f852849a58ef1c09def61d2afcd8a2d6786b253c539a5ddc1f29cd7
Python
4,143
109
# Copyright 2020-2022 Huawei Technologies Co., Ltd # # 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 agre...
dad85efd89703cade8ba667dd2daa575a577131cfe375dd0f39a8715bcf9bc1b
Python
4,144
124
#%% import os import sys try: os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/') sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/maggot_models/') sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/') except: pass import pandas as pd import numpy ...
885409da298688aa8795f5d29b1b698d57130a9e270a0d67344d3f3e9fceba8f
Python
4,146
123
from __future__ import print_function, absolute_import import os import torch import torch.utils.data as data from torchvision import transforms import torchvision.transforms.functional as TF from dataloader.data_utils import * def generate_pair_images(root, gap): images = [] root = os.path.expanduser(root) ...
b5acd9a1baba2384f1199773e2b895f67300617145e7ea8df03720b7575e0a8a
Python
4,151
99
# Copyright 2022 Huawei Technologies Co., Ltd # # 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 agreed to...
d42d25e462d0a31349d9b4f5b2caa20972ff76ba8c5280de2fa0204ac1b78b74
Python
4,152
139
import csv import os import sys def feature_to_index(cases, column_nb, offset=0): feature_set = set() for case in cases: if len(case) > column_nb: feature_set.add(case[column_nb]) l = list(feature_set) index = {} i = 0 for f in l: if f != '': index[f] = i...
5da46dbaaaf7a6c2428cab1bbb1e01a92630b92367dfbc7ca1493f1a0d832736
Python
4,153
88
import torch import torch.nn as nn import torch.nn.functional as F class Siamese(nn.Module): def __init__(self): super(Siamese, self).__init__() # Using Sequential to create a small model. When `model` is run, # input will first be passed to `Conv2d(1,20,5)`. The output of # `Conv...
f1090d0c4b1b3811cda99a5a50df27f0bb3a9147bf42c649e4d6e3468477ee2d
Python
4,155
179
# -*- coding: utf-8 -*- """ Created on Mon Feb 14 16:15:07 2022 @author: N.V """ import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation from matplotlib.animation import FuncAnimation import os # note that this must be executed before 'import numba' os.environ['NUMBA_DISABLE_INTEL_...
a2b45062bc67714c0c27ebcb2bf0a53fa2a5d1b4e2c71f1b78285fc75ac11155
Python
4,156
138
import csv import os import sys def feature_to_index(cases, column_nb, offset=0): feature_set = set() for case in cases: if len(case) > column_nb: feature_set.add(case[column_nb]) l = list(feature_set) index = {} i = 0 for f in l: if f != '': index[f] = i...
93932ab27dfb52e6b57a563db37c8f04a3522f873a0bb8db292a797b02fbde22
Python
4,157
90
# Copyright 2022 Huawei Technologies Co., Ltd # # 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 agreed to...
c99b7b564aa402c64bc93fba6ba4929d4c8ec48ad00e98e8a213bb79b29d3047
Python
4,158
143
# Copyright 2021 Huawei Technologies Co., Ltd # # 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 agreed to...
e55fb316d1b29abf0eb1da3811c3128e9f0ec5085fca5d7ca26b74313abf7aba
Python
4,158
109
# Copyright 2021 Huawei Technologies Co., Ltd # # 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 agreed to...
004e94b4dfba590ae8694c38379f861fec36e1c8ed969e1fc32ba6c6c7acce27
Python
4,159
159
''' Figure 7 Statistics of ciliated fits ''' import pandas as pd from pylab import * from matplotlib import gridspec import seaborn from file_management import * from os.path import join width, height = 3, 5 table = pd.read_csv(join(config['root'], 'Ciliated with PIV', 'tables', 'selection_ciliated.csv')) box_width ...
6339adbe2aa91c4c9a6f2e8bacb85aa87a137b3288bb9a2453dc83d7db5e711d
Python
4,159
138
import csv import os import sys def feature_to_index(cases, column_nb, offset=0): feature_set = set() for case in cases: if len(case) > column_nb: feature_set.add(case[column_nb]) l = list(feature_set) index = {} i = 0 for f in l: if f != '': index[f] = i...
9bc9c717b21a3e4a868843ea953888776a43c899189982f1f41f5487442ba463
Python
4,159
128
#!/usr/bin/python #################################################################################################### # Copyright (c) 2020, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> ...
44af93c426ac4ac8a96d0934ff86a7bf4cd9ce32491e8ece27557af2d7fd345f
Python
4,160
105
import os import pandas as pd import torch import torch.nn as nn import argparse from sklearn.model_selection import KFold from dataset import ViscosityDataset from model import ViscosityNet from trainer import Trainer, TrainerConfig from utils import seed_everything, prepare_training_input from base import VISCOSITY...
f705e231811f5e5a23bfa55840c6b1e57513840ca1704d28d6114c523d486345
Python
4,160
102
"""Regression coverage for singleton-strand accounting (issues #805 and #757).""" from collections import Counter import pytest from MACS3.Signal.FixWidthTrack import FWTrack @pytest.mark.parametrize("maxnum", [-1, 1, 2]) @pytest.mark.parametrize("reads", [ [], [(b"chr1", 100, 0)], [(b"chr1", 100, 1)],...
f753f3f06f34e50d3fcfb5decb2b0d88ce2b166e044a05eaf2d909b46dda4d08
Python
4,160
117
# Copyright 2021 Huawei Technologies Co., Ltd # # 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 agreed to...
77cef518cb05c1836fc688fae378b25da00aa6df65f18047a8a65e02d03d05be
Python
4,162
85
import os, sys # currentdir = os.path.dirname(os.path.realpath(__file__)) # parentdir = os.path.dirname(currentdir) # sys.path.append(parentdir) # PYTHON > 3.3 does not allow relative referencing # # PYCHARM_EXEC = os.getenv('PYCHARM_EXEC') == 'True' import tensorflow as tf import voxelmorph as vxm from voxelmorph.tf...
f3ab91194a7e923aab1edff7288d20f0ad9f596c69e3f54dd1f280f44aad3a4e
Python
4,163
106
# Copyright 2022 Huawei Technologies Co., Ltd # # 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 agreed to...
309d6fefab78b319bd9326b5f4d7bdd675e2b29baed97ed7f743cd9d8708915d
Python
4,165
113
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from basic_blocks import ( DownSampling, EncoderBlock, DecoderBlock, Deconvolution, AttentionBlock, OutputTransition, ) from spp_block import Pyramid_Pooling_3D # NOTE: rsppUnet -> Residual Spatial Pyramid Poo...
5b2195241958bbfe29fd9a8082ca0c691148bb114f7a2c8437fd748a087e3223
Python
4,165
123
# Copyright 2021 Huawei Technologies Co., Ltd # # 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 agreed to...
e11f5d0eb1d45dc7961e1054f82fe06ef43690fffb16a07277c176a3608b8b81
Python
4,165
108
# basic imports import os import numpy as np import pickle import matplotlib.pyplot as plt def recover_states(replay: list) -> np.ndarray: ''' This function extracts the states of replayed experiences. Parameters ---------- replay : A sequence of replayed experience...
3369375d8bfb12bd00745620d5a35687fdf3c6e82d8943e4342c566eb6654c60
Python
4,166
153
import os import gzip from skimage.transform import resize from skimage.util import montage import nibabel as nib import pydicom as pdm import nilearn as nl import nilearn.plotting as nlplt # import h5py import numpy as np import pandas as pd import torch from torch.utils.data import DataLoader, Dataset import alb...
3abbe23247c68fe5f2f35516e2da4db7caf8f95d13be66b2c0086b7ba750df9a
Python
4,166
160
#%% import os import pickle import time from pathlib import Path import matplotlib.pyplot as plt import networkx as nx import numpy as np import pandas as pd import seaborn as sns from anytree import LevelOrderGroupIter from scipy.sparse import dia_matrix, diags, load_npz, save_npz from sklearn.decomposition import Tr...
708c7020c9c63553c6b4a5fe6bee13b41b392ed119acc69dda6c537374bf56df
Python
4,168
135
import os import torch import torch.utils.data from PIL import Image import sys if sys.version_info[0] == 2: import xml.etree.cElementTree as ET else: import xml.etree.ElementTree as ET from maskrcnn_benchmark.structures.bounding_box import BoxList class PascalVOCDataset(torch.utils.data.Dataset): CL...
a565f009a32940aac6a6de31d50b6218038afe57147dc59fa83a680366abfc01
Python
4,169
106
from __future__ import print_function, division import numpy as np from ase.db import connect from tinnet.regression.regression import Regression lr = 0.006326505613656666 lamb = 0.1 atom_fea_len = 139 n_conv = 3 h_fea_len = 253 n_h = 1 Esp = -3.343 db = connect('train.db') images = np.array([r.toatoms() ...
1168c7799bb1be13460528553989b9bb4134f27e570a5b799177db6c7d56d69a
Python
4,171
118
import torch.nn as nn import torch from math import log2 from kornia.filters import filter2D class Blur(nn.Module): def __init__(self): super().__init__() f = torch.Tensor([1, 2, 1]) self.register_buffer('f', f) def forward(self, x): f = self.f f = f[None, None, :] * f...
fb96b07c87461bb6098cb696d6c07485cbe4ab11ec0c357739bb2863538cc81e
Python
4,175
138
import csv import os import sys def feature_to_index(cases, column_nb, offset=0): feature_set = set() for case in cases: if len(case) > column_nb: feature_set.add(case[column_nb]) l = list(feature_set) index = {} i = 0 for f in l: if f != '': index[f] = i...
67224d0ff88868cc479ad81b1568ba6f1f6db5d6eae53ca0fcaa4aa6abda1aec
Python
4,176
123
from __future__ import absolute_import # -------------------------------------------------------- # Fast/er R-CNN # Licensed under The MIT License [see LICENSE for details] # Written by Bharath Hariharan # -------------------------------------------------------- import xml.etree.ElementTree as ET import os import nump...
80aa6624d9f7d2ff68dc73d1370774c173f697cb49b11419910ffa9d0a164208
Python
4,182
124
import sys import torch import torch.nn.functional as F import matplotlib.pyplot as plt from torch_geometric.nn import GCNConv, GINConv from graphxai.datasets.ba_houses import BAHouses as BAH #from graphxai.gnn_models.node_classification import train, test class GCN_1layer(torch.nn.Module): def __init__(self, hid...
11908a8a191656210f7ec3ffb4fbed05f0fda5974cdd9905374525f16582904b
Python
4,183
73
# Copyright 2022 Huawei Technologies Co., Ltd # # 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 agreed to...
1473b6e731e778d626a826e10e4d4cb2cd5960c9952ce639082722e630856f5a
Python
4,184
116
#!/usr/bin/env python3 """ File: replication_plot.py Created: 2020/06/10 Last Changed: Author: M.Vochteloo Copyright (C) 2020 M.Vochteloo This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foun...
5f4403c48525565aeaa49815fcd230205c1906ffb830c9e3a3aef24620bb78a7
Python
4,184
160
import numpy as np from numpy.random import default_rng from ..utils import get_random_seed def _input_checks(adjacency, random_seed, effect_size, max_tries): adjacency = adjacency.copy() if isinstance(random_seed, np.integer) or random_seed is None: rng = np.random.default_rng(random_seed) else:...
7868015d230b255eeef98437276fe37203cb16070f44e0c22e45ac18e657687e
Python
4,184
92
__author__ = 'jieqing jiao' __contact__ = 'jieqing.jiao@gmail.com' import numpy as np from niftypad.tac import TAC from niftypad.kt import dt2tdur from niftypad.image_process.regions import extract_regional_values import matplotlib.pyplot as plt import nibabel as nib import os def image_to_parametric(pet_image, dt, ...
a69a0543439f57c52c9971e1d425860767b83a97b8b77c3333b783b461e1354b
Python
4,184
122
import random import numpy as np import torch from PIL import Image, ImageFilter from numpy.random import choice as npc from torch.utils.data import Dataset class RoofTrain(Dataset): def __init__(self, dataset, transform=None): super(RoofTrain, self).__init__() np.random.seed(0) self.data...
ea8952b63f7afadd131396491c6005efe0a83192716bc76977d8bc6adfe647da
Python
4,184
99
# Copyright 2023 Huawei Technologies Co., Ltd # # 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 agreed to...
1604d71f672538a7648663454e7227fd972808362ed87175fcea4cb11e155363
Python
4,186
109
"""Shared helpers for the CARLA -> Autoware map tools. Coordinate convention (load-bearing, read this before touching any math): * CARLA / Unreal is LEFT-handed: x forward/east, y RIGHT (south), z up. * OpenDRIVE and the Autoware lanelet2/pcd map pair are RIGHT-handed. CARLA negates y when it imports an OpenDRIVE f...
3e1747ab7beeec4f2e17af51884e2141e6ad0d6c7241ea7324c5588a56995eb8
Python
4,186
122
#!/usr/bin/env python3 """ @ Lina Teichmann INPUTS: call from command line with following inputs: -bids_dir OUTPUTS: Plots the ERFs of the repeat trials. NOTES: If it doesn't exist, the script makes a figures folder in the BIDS derivatives folder """ import numpy as np import m...
4f637c6664bb582dec32f78da1b45733bf0c062d627f5290c620aa5518fe4c4c
Python
4,187
121
# coding=utf-8 # Copyright 2020 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
8f01d34b6861a08c359ef75acf4a6e50f4a86787d624d9297c45d1ff7bdba642
Python
4,187
120
import os import shutil # from libtiff import TIFF from scipy import misc import random import cv2 import numpy as np # def tif2png(_src_path, _dst_path): # """ # Usage: # formatting `tif/tiff` files to `jpg/png` files # :param _src_path: # :param _dst_path: # :return: # """ # tif ...
eb0cfb4c79f01c20231c6224a43121e3d1861ae79666cb529793eace1d1c532b
Python
4,188
98
import os.path import argparse parser = argparse.ArgumentParser(description='Make Molgenis Compute samplesheet for NABEC.') parser.add_argument('samplesheet', help='NABEC samplesheet') parser.add_argument('cram_dir', help='path to cram file dir for input') parser.add_argument('fastq_dir', help='path to fastq file dir ...
6a409e19533c7aac9f3f82e8acfb1a5497e1c4465b6bbb7f1a6a5a637bfea729
Python
4,189
122
''' Author: Naiyuan liu Github: https://github.com/NNNNAI Date: 2021-11-23 17:03:58 LastEditors: Naiyuan liu LastEditTime: 2021-11-24 19:19:52 Description: ''' import os import cv2 import glob import torch import shutil import numpy as np from tqdm import tqdm from util.reverse2original import reverse2wholeimage impo...
08a12f11089296e0963672b0165b077f7a051613503f69491eb3a33e3db97dee
Python
4,190
109
# This scripts gives an example of hyperparameters search with Sherpa # input file: smap_smos_overlap_3dm_seas_c_no_std.pkl # output file: trials' summary import sklearn as skl from sklearn import preprocessing import pandas as pd import numpy as np import tensorflow as tf from tensorflow import keras from tensorflo...
e4b19692c7e2a4e519a3055900a5506e1940bb2ba50e6f9c04085ea77c2400cf
Python
4,190
121
import torch import numpy as np from medpy import metric import torch.nn.functional as F class AverageMeter(object): """Computes and stores the average and current value.""" def __init__(self, name, fmt=":f"): self.name = name self.fmt = fmt self.reset() self.val = 0 s...
0862f2be30ca999fcd18a9ebb546f49e99056d9cc73cfc655c78a5418cbdce70
Python
4,192
116
""" fragmenters Created by: Martin Sicho On: 06.05.22, 12:19 """ import re from itertools import combinations import numpy as np from rdkit import Chem from rdkit.Chem import Recap, BRICS from drugex.logs import logger from drugex.molecules.converters.interfaces import ConversionException from drugex.molecules.conve...
e14dd86126e7407ad8818df771d388ed662d6b7ea90d76b90b453aa55ee7d268
Python
4,192
130
from __future__ import division from collections import OrderedDict import torch from mmcv.runner import Runner, DistSamplerSeedHook from mmcv.parallel import MMDataParallel, MMDistributedDataParallel from mmdet.core import (DistOptimizerHook, DistEvalmAPHook, CocoDistEvalRecallHook, CocoDist...
3d237c016a87cbfcacce27c2094bf062d2a54d86dce52d3c81b972f49023b42d
Python
4,194
187
# -*- coding: utf-8 -*- """ Created on Tue Jul 20 21:08:56 2021 @author: N.V """ # -*- coding: utf-8 -*- """ Created on Tue Jul 20 18:47:06 2021 @author: N.V """ import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation from matplotlib.animation import FuncAnimation import os # not...
6b7b51c4c9da1e0a8da5732cb6a2ba226b99e564833470c76f058f26497fbef1
Python
4,194
145
#!/usr/bin/env python # Classes for managing IsoSeq clusters, including annotation matches. import os import sys import re # for regular expressions import cPickle as pickle from tt_log import logger VERSION = '20150814.01' logger.debug('version %s loaded' % VERSION) regexFP = re.compile('f(\...
b5cac31b0387cc85d4688bebd789d4e58ed45e7b7035ed82a4c3028525fc085d
Python
4,194
104
# requires: mayavi # dataset: mne_sample ''' Example performes a permutation cluster test on source space data and creates an HTML file describing he output. ''' import eelbrain as e # settings n_samples = 1000 # create an HTML report in which to document results report = e.Report("MNE Sample Dataset", author="Prof...
cb5ba8ab35889adcfa7fc9ecd640df8482f0b689f50c0c3f66c0524fac43712c
Python
4,194
109
# Copyright 2020 Google Research. 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 applicable law...
999c29de3ee4f19393cbd4a8517683e952caee61aabaddabd2e926cd332b9489
Python
4,199
89
import torch import torch.nn as nn import torch.nn.functional as F class ConvBlock(nn.Module): def __init__(self, in_features, out_features, num, dropout_block, pool=True): super(ConvBlock, self).__init__() layers = [] layers.append(nn.Conv3d(in_channels=in_features, out_channels=out_featur...
12f6070f03f9361d0a4ae168475fc9f98778e314266c894a9049a23bf0a8bbcf
Python
4,204
142
# Usage createChartJS.py "fileOut...dat" # Will replace the .dat file with a # sub-sampled .JS file in a format usable by the Chart.js library cleanUp = False#True import csv, re, sys, os from decimal import Decimal path = sys.argv[1] DirName = os.path.dirname(os.path.abspath(path)) FileName = os.path.basename(path)...
f389a6425ac2fc5b2af3ce5b2e140a3e82ffdd3537127649be217fc83a9b4f5b
Python
4,204
117
# -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: import tensorflow as tf from keras.models import Model from keras.layers import Input, Conv2D, MaxPooling2D, UpSampling2D, Cropping2D, ZeroPadding2D, BatchNormalization, Activation ...
56a5c8067ac4d7adcea61253889f5bbda478f239166a95170ef17002b1f4415a
Python
4,209
154
import logging # import first to make sure logging works from pathlib import Path import os # basedir = Path("MCMC_inference_connected") basedir=Path(".") results_dir=basedir /"NEWResults_inference_57" results_dir.mkdir(parents=True, exist_ok=True) logs=results_dir/ "logs" logs.mkdir(parents=True, exist_ok=True)...
a58c96b7e9e6b84da61dff83abef4aabb5598e4a763f98849481d82a9715243b
Python
4,210
117
from Lif_Parameters import * from Lif_Equations import eqs_LIF seed(val) ##################################### # Initialize the neuronal populations ##################################### # ------- Layer 0 ------- l0 = NeuronGroup(n_cells, eqs_LIF, method='exponential_euler', threshold='vm>v_th', reset='vm=v_r', refract...
8edb1462589f878d16dddea5be183d5f5a357f0c38bb40e74e813f1ba978484e
Python
4,214
154
import logging # import first to make sure logging works from pathlib import Path import os # basedir = Path("MCMC_inference_connected") basedir=Path(".") results_dir=basedir /"NEWResults_inference_58" results_dir.mkdir(parents=True, exist_ok=True) logs=results_dir/ "logs" logs.mkdir(parents=True, exist_ok=True)...
b33abd99f704d6819585e73fcc7d0d6221917eceafee57785e8fdbda9d94d82e
Python
4,215
138
import os.path as op import random import numpy as np import numpy.testing as npt import pytest import nibabel as nib import tempfile from AFQ.models.csd import fit_csd from AFQ.models.dti import fit_dti from AFQ.tractography.tractography import track from AFQ.utils.testing import make_tracking_data seeds = np.arra...
d7174ec69396519479320a57ff0e985d0d6e269bd21db80b5cc9e58fa569d2db
Python
4,217
128
import os import pickle import random import cv2 import numpy as np import torch from torchvision.transforms import functional as F def get_instance(module, name, config, *args): return getattr(module, config[name]['type'])(*args, **config[name]['args']) def seed_torch(seed=42): random.seed(seed) os.env...
fbfe2c302065f8dc33e79677aa7d735b585303bc5d9856aa0397c26030f98383
Python
4,218
91
# Copyright 2021 Huawei Technologies Co., Ltd # # 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 agreed to...
149bdaea7ae623923a42830c111cc385e7b41f81a25d0846294f36dbbc051166
Python
4,219
130
import numpy as np import torch import torch.nn as nn class Anchors(nn.Module): def __init__(self, pyramid_levels=None, strides=None, sizes=None, ratios=None, scales=None): super(Anchors, self).__init__() if pyramid_levels is None: self.pyramid_levels = [3, 4, 5, 6, 7] if stri...
74843e9395b3ce4d4eb8432298c3ff0efbf08235ec97e94b53a9446970089e03
Python
4,223
143
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import unittest import glob import os import copy import torch from maskrcnn_benchmark.modeling.detector import build_detection_model from maskrcnn_benchmark.structures.image_list import to_image_list import utils CONFIG_FILES = [ # bbox ...
bd770e3ba3ebf5907331ef77f3dd8e2d7cddf63db0f5bbd42b7eeda493b6e31a
Python
4,223
94
# -*- coding: utf-8 -*- import numpy as np from . import mi from . import utils from ._base import _EmbeddingCausality, _DirectCausality class CrossMappingEntropy(_EmbeddingCausality): def fit(self, data, mi_kwargs=None): assert data.shape[1] > 1, 'data must have more than 1 column (variable).' s...
f07f0e4d648b5dfac212c0f71329c307813c45564dc8228c28583e5dc1524129
Python
4,228
89
import os import matplotlib import matplotlib.pyplot as plt import numpy as np import seaborn as sns def main(): theme = 'dark' matplotlib.rcParams['axes.edgecolor'] = '#ff0000' sns.axes_style("darkgrid") N = 2999 n_clusters = 14 fixation_end = 1100 s_dm = np.load('s_dm.npy') s_go = ...
8a4a274d340125f4ecc7148c59007703165cf3435b9c6d425f49a19ea3fa9f2c
Python
4,230
94
# Copyright 2020 Huawei Technologies Co., Ltd # # 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 agreed to...
93151087b88a6915cc4f77840e3f98bf55a097f67934d58bf949d018242c71a0
Python
4,230
119
# Copyright 2021 Huawei Technologies Co., Ltd # # 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 agreed to...
d62bd5134bb5fea0a478ff3728c34686f4f257543bb5d4c37d75d827a28945d2
Python
4,231
102
#################################################################################################### # Copyright (c) 2019 - 2023, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # This program is free ...
78771944ca09aeebada0732acfd7e382138857ae840092064f86ea6e3281a358
Python
4,232
112
import numpy as np from ..simulation.traj_tools import * from torch_geometric.data import Data import torch import numpy as np from .data_tools import * EMPTY_FIELD_VALUE = np.nan class SkeletonTrajData(Data): def __init__( self, raw_positions, time, graph_info={}, traj_i...
8a3cb95a46e673cc6fa449818ff3e63fb79f865569772f663ef4f990b388b587
Python
4,233
108
# Copyright 2022 Huawei Technologies Co., Ltd # # 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 agreed to...
f39702373f5950b61178d6b38d9d6bbf8d7b0f7451e3c8197f649bf22a1d6bb4
Python
4,233
104
# Copyright 2021 Huawei Technologies Co., Ltd # # 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 agreed to...
0cc48381ee8c12f44cbbb17cd851ccfc38539cbc9434b87942298fff01053656
Python
4,234
141
import torch.nn as nn import math def conv3x3(in_planes, out_planes, stride=1): """ 3x3 convolution with padding """ return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) class BasicBlock(nn.Module): expansion = 1 def __init__(...
4a9178006a10294ab24be4e6e5e5826ab8a2a19046a59c6e94e78bc9f8f269cb
Python
4,235
146
if __name__ == '__main__': # ------------------ # Libraries # ------------------ # Generic libraries import pandas as pd import numpy as np import matplotlib.pyplot as plt # Basic functions in sklearn from sklearn import datasets from sklearn import metrics from sklear...
9043e7b7b8b585f635df5a88ff2ee0aa88b4cf889183b95d647f11053b81fd9e
Python
4,235
139
__author__ = "Jianfeng Sun" __version__ = "v1.0" __copyright__ = "Copyright 2023" __license__ = "GPL v3.0" __email__ = "jianfeng.sunmt@gmail.com" __maintainer__ = "Jianfeng Sun" import pandas as pd from tmkit.util.Reader import Reader as greader from tmkit.util.Writer import Writer as gwriter class Reader: def ...
ecdaa1b9e58a66148db7a9856913cf84b60d6ef33e51b4d25e2082afb47c158c
Python
4,235
131
#%% import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from pymaid_creds import url, name, password, token import pymaid import connectome_tools.cluster_analysis as clust import connectome_tools.celltype as ct import connectome_tools.process_matrix as pm rm = pymaid.CatmaidIn...