sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
62e50be5972bc5d8ead7fe1cde0a38639cdee5d4d6c12e0fce0103e330e2b09f
Python
7,014
206
import sys import os import schnarc import logging import shutil import argparse import numpy as np import datetime import copy import time (tc, tt) = (time.process_time(), time.time()) #import schnet import schnetpack as spk import torch import torch.nn as nn from ase.units import Hartree, Bohr, Debye, invcm from torc...
c8863a4de7b0a171bf1ebfe6d69a2d3d3ebd1790730f99c376a189d245e1ac7c
Python
7,016
133
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2024 Clinic for Diagnositic and Interventional Radiology, University Hospital Bonn, 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 ...
0b6e5c4c8f52a4797cb4844a329506e3fa41a4a911a2fce56318d8602b86e3d9
Python
7,019
198
"""Inference modules and script. Copyright (c) 2024 University of Michigan. All rights reserved. Licensed under the MIT License. See LICENSE for license information. """ import os import logging from shutil import copy2 from functools import partial from typing import List, Union, Dict, Any import yaml import numpy ...
cfba05d55024228c11b7a8b1ce138dd1b0828bc7aae2a0572a018c5f4bfcb118
Python
7,022
195
"""Parameter space overview figures ----------------------------------- Combines individual figures to parameter space overview figures using latex. """ import os import matplotlib.pyplot as plt import subprocess import pickle import numpy as np import glob import matplotlib matplotlib.use('Agg') def parameterspace...
0e63de89dc981ce9af888b2ea07360106c45547f25da34a7c58798e7d243fcef
Python
7,024
170
# Copyright (c) 2020, Ko Sugawara # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and t...
7e07c8015295a3187dcd4626443e298b2fc22af1148aa00d5d21acf288054091
Python
7,027
184
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Written by Tong He and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md """ import os import argparse import subprocess import numpy as np from nilearn import datasets from nilearn import input_data from nilearn.connectome import Con...
88d252b527cf2a6ac68cd7a21bb1ee4a6f4dc2f9b0c54c601f2caba8461d532d
Python
7,027
206
"""Execution context tracking for the autodiscover directory feature. This module maintains a thread-/task-local stack of ContextNodes that records the nesting of flows, subflows and jobs as they execute. When NESTED_RESULTS is enabled, the context stack is translated into a filesystem path (e.g. ``my_flow-<id>/my_su...
9a6ac4a7e61eb9ff2d5acf4e188305bc5fc7f8b1f20ca63861cc1da125f5b3ed
Python
7,027
180
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
5fdbfb96445a65e2844de643284b9397d9a785b5b7c20aa922023cec13ba1112
Python
7,029
159
import os import time import logging import math import argparse import numpy as np import torch import random import torch.nn as nn import torch.backends.cudnn as cudnn import torch.distributed as dist import torch.multiprocessing as mp import torch.utils.data as data import warnings from utils.util import setup_logge...
90a685d2edc659ee34c07585bc97ab32d3f89cd259f954ebcc6ee1f5967f5f96
Python
7,029
244
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ AutoArbor_M3: The method 3 of AutoArbor Algorithm Created on Feb 13 10:22:52 2020 Last revision: March 24, 2020 @author: Hanchuan Peng """ print(__doc__) import time import os import csv import pandas import numpy as np from numpy import linalg as LA import math imp...
099405645278bda509d0d25cf02094aff6edc9c05eec4f75236083fb07140a8a
Python
7,030
167
from typing import List, Tuple, Union import matplotlib.pyplot as plt import mne import numpy as np import torch from .utils import _plot_to_image _DEFAULT_MONTAGE = mne.channels.make_standard_montage('standard_1020') def plot_raw_topomap(tensor: torch.Tensor, channel_list: List[str], ...
9661404d945592d99bf1a4c7d193d5b2e5bdd22406d2205a333cf82764083960
Python
7,030
226
import torch.nn as nn import math import torch.utils.model_zoo as model_zoo # from lib.normalize import Normalize __all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101', 'resnet152'] model_urls = { 'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth', 'resnet34': '...
d64551dc8eddd30cf3b214d2ac58551ae1db05f1df73cd49c00208969b0d0c6e
Python
7,031
173
"""Container for multiple HED schemas used together in multi-library validation.""" from __future__ import annotations import json from hed.errors import ErrorHandler, ValidationErrors from hed.errors.exceptions import HedExceptions, HedFileError from hed.schema.hed_schema import HedSchema from hed.schema.hed_schema...
90bb907147af5bb6cec37650620ee309a0ea8b9f15ee1f802ba6037e44b64107
Python
7,033
222
"""Materials Project-compatible recipes using the original MP settings.""" from __future__ import annotations from importlib.util import find_spec from typing import TYPE_CHECKING from monty.dev import requires from pymatgen.io.vasp.sets import MPRelaxSet from quacc import flow, job from quacc.calculators.vasp.para...
6cc32f02bff2f65fc98c3fbd623a9d24788784029e04ba0a9c801e818b462e9e
Python
7,037
189
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
892de2bcdf2479eebb57ffa12b19e6c11701beb28c12f0def092e3ba301eb277
Python
7,038
202
import numpy as np import pickle as pkl import matplotlib.pyplot as plt from matplotlib import rc #rc('font',**{'family':'serif','serif':['Computer Modern Roman']}) ## for Palatino and other serif fonts use: #rc('font',**{'family':'serif','serif':['Palatino']}) font = {'family' : 'normal','weight' : 'bold'} rc('text'...
b2f968815149b0b0f6a82307089f300adb834b55264d8776dd6e56f6df52bafe
Python
7,039
253
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import math from functools import partial __all__ = [ 'ResNet', 'resnet10', 'resnet18', 'resnet34', 'resnet50', 'resnet101', 'resnet152', 'resnet200' ] def conv3x3x3(in_planes, out_planes, stride=1): # ...
4150a6c7bb08c01ded0cfc5be096066d526d9a9318f8f4c2a4c660bb15ec20be
Python
7,040
207
from __future__ import annotations from copy import deepcopy from pathlib import Path import numpy as np import pytest from ase.build import bulk, fcc100, molecule from ase.io import read from pymatgen.core import Structure from quacc.atoms.slabs import ( flip_atoms, get_surface_energy, make_adsorbate_st...
533ac10ef9d897aa476941a47545a3ace41e20f695eb18a8555ed8867f1290d0
Python
7,040
162
from functools import partial from collections import OrderedDict import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import requests import io import tensorflow_hub as hub def get_weights(bit_variant): response = requests.get(f'https://stor...
72ee73fa33d5af009788720c8d78c53277a4af4cd1f915d9899e6234336224f9
Python
7,042
177
#!/usr/bin/env python from __future__ import print_function import argparse from collections import namedtuple from itertools import permutations, combinations import numpy as np from examples.continuous_tamp.primitives import draw_state, SUCTION_HEIGHT, GROUND_NAME from examples.continuous_tamp.run import initiali...
7ff37280bc48a25eb5ca927df253d80333c23647c043565a28ac6332d64694b9
Python
7,042
182
import numpy as np from PIL import Image from PIL import ImageEnhance from PIL import ImageFilter import matplotlib.pyplot as plt from scipy import ndimage import argparse import time import os import warnings import ntpath from src import utils from src.settings import Settings warnings.filterwarnings("ignore") """...
3438129e4ad02c84a93d840d6f193573bd65a3706775e9dc257ffb199c557b9f
Python
7,045
217
#!/usr/bin/env python3 ######################################## ### Load packages ######################################## print("----- Loading packages -----") # General import numpy as np import pandas as pd import os import csv # Computing import scipy.io from scipy import stats from heapq import nlargest # gi...
4964c6537a52510b3e0ac70a93cbcb0a4991a060b0cedbb07e9ea0e3503ff185
Python
7,045
210
from __future__ import annotations from copy import deepcopy from pathlib import Path import numpy as np import pytest from ase.build import bulk, fcc100, molecule from ase.io import read from quacc.atoms.slabs import ( flip_atoms, get_surface_energy, make_adsorbate_structures, make_slabs_from_bulk, ...
797161ca2620251a29c3a374567afd33ac246261c72130fd0349e56cfb424c2a
Python
7,045
251
import numpy as np import matplotlib.pylab as plt import cv2 from skimage import measure import datetime import json import os import re import fnmatch from PIL import Image from pycocotools import mask import glob from tqdm import tqdm_notebook from multiprocessing import Pool from multiprocessing import cpu_count imp...
81064f2d156bfd2624c73239694bee37a89f2a276d2ed53753023a78adaff5b8
Python
7,045
181
import sys import os import numpy as np import traceback # dir_name, filename = os.path.split(os.path.abspath(__file__)) # sys.path.append(dir_name) # sys.path.append(os.getcwd()) import pandas as pd from joblib import Parallel, delayed from src.utils import logger, parse_config, contain_substr from scipy.spatial.tran...
327252e16e69bb6c07dc3a6889260a52854e02824d9f139385cacb5c0e0b9406
Python
7,046
169
import os import itertools import torch import json import pandas as pd import argparse import multiprocessing from multiprocessing import set_start_method from torch_geometric import seed_everything from model.ada_med_graph import AdaGNN, ppmi_data_prepare label_tar=['Label_NHY', 'Label_NP3_Tremor'] parser = argpars...
e069a387c31ba58cbe53440d8aed3402e371cf6f9449bef62a6ea4ae396c2c69
Python
7,049
180
""" Display's a histogram to analyze the statistical distribution of a column data in a STAR file, or a combination of them. Input: - STAR file(s)/column(s) - Operator (optional) Output: - A figures with the histogram is displayed """ __author__ = 'Antonio Martinez-Sanchez' ###### G...
f5f5314a9b19102c56e77eaa8e641d2d0e09eb3d3c516a772843a52ed72caaef
Python
7,049
193
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Written by Tong He and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md """ import os import time import random import argparse import numpy as np from keras import backend as K from keras.optimizers import SGD from config import co...
72518b7e40a7ccc738e4058dd40aa340804394acbb64bb21b91abb6658cf0dfa
Python
7,050
189
import math import torch import numpy as np 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() def reset(self): self.val = 0 self.avg = 0 self....
d4d6d72861f6c7a15a0a386ce45b85ed8669e91f784d55bd9d8d57b55bb46987
Python
7,051
213
from __future__ import print_function import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data from torch.autograd import Variable import numpy as np import torch.nn.functional as F class STN3d(nn.Module): def __init__(self): super(STN3d, self).__init__() self.conv1 = to...
01bc2f253bfff1098d518fe0fc8e6b98814e77ed6f7820db63e2bf80485210ac
Python
7,052
191
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
72427df5bc19466bb611eb7f120c91ecc1ee49a7f29d8221026f980e4ca97122
Python
7,052
183
""" Overlap-weighted doubly robust propensity-score analysis. Propensity score PS = P(Exposure | Age, Age², Sex, Age × Sex) is estimated via logistic regression. Two doubly robust approaches are implemented: Approach A — PS as an additional covariate in OLS: Score ~ Exposure + PS + Age + Age² + Sex + Age × ...
a5ee1fd055d791c95b2cc8e2b6c397ded94be7f83bdc96c11bf05f54b994c118
Python
7,053
200
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
45b70778f969145b36ec8d01b5eef0a7c4f81437e8ade16d2d5a801be0ee3b25
Python
7,056
243
# -*- coding: utf-8 -*- # # Routines for designing and applying # FIR windowed sinc filters # # Builtin/3rd party package imports import numpy as np import scipy.signal.windows as sci_win from scipy.signal import convolve def apply_fir(data, fkernel, method="fft"): """ Convolution of the input `data` with a...
52fb00cdb5904ee74a2875631b9f5a562b50cec2d5f4321a4d36e1da54aac29b
Python
7,056
138
import numpy as np import torch def vectors_shuffled_batch_collate_fn(shuffled_batch, num_contexts_range, num_targets_range): ''' This function works together with the method get_ct_indices_for_one_function and the functions get_non_overlapping_ct_indices or get_...
cc1712cb2fbe04bb6e0bb5aa25b5dcfd02cd54ed0d7bdadf325efd006e1ccb12
Python
7,057
167
""" ================= Run the full PREP ================= In this example we show how to run the full PREP pipeline on a noisy EEG recording using :class:`~pyprep.PrepPipeline`, inspect which channels it flags as bad, and visualize the effect of cleaning. .. currentmodule:: pyprep """ # noqa: D205 D400 # Authors: ...
db646c5b4e3e5581edd42dedb7db389ed64c340e69d9d43bfacf4a0a7cf0c2d0
Python
7,057
199
from __future__ import annotations import re import numpy as np import pytest from scipy.optimize import NonlinearConstraint from bayes_opt import BayesianOptimization, ConstraintModel @pytest.fixture def target_function(): return lambda x, y: np.cos(2 * x) * np.cos(y) + np.sin(x) @pytest.fixture def constra...
18737d983bbac26d313d11c819637ecff77d0db523640cf74d040f324a0f87c0
Python
7,060
186
"""Classes for managing counts of tags for one type tag such as Condition-variable or Task.""" class HedTypeCount: """Manager of the counts of tags for one type tag such as Condition-variable or Task. Parameters: type_value (str): The value of the variable to be counted. type_tag (str): Th...
acc4fbf2a746d988ba28cc4b1911452b805d1118e08b30982c5589097866898e
Python
7,062
219
"""Implementation of CLI modify command.""" import math from itertools import chain import numpy as np from treem.io import SWC from treem.morph import Morph from treem.utils.geom import rotation def _scale_radii(morph, nodes, scale_radius): """Scales radii.""" scale = np.abs(scale_radius) for node in ...
7edb2e5e4561640c1c4f8ca048dbbc9d693512582acbc27a7ada5e1b2d8aadd1
Python
7,064
153
from PoseBase import PoseBase import PoseTools import os import tarfile import tensorflow vv = [int(v) for v in tensorflow.__version__.split('.')] if (vv[0]==1 and vv[1]>12) or vv[0]==2: tf = tensorflow.compat.v1 else: tf = tensorflow # from batch_norm import batch_norm_mine_old as batch_norm if vv[0]==1: f...
5663f73f11bb115f762365eda05d3259ccbd8ce6d83816d48f6fb8ce7cf20b52
Python
7,065
205
""" Optuna example that optimizes multi-layer perceptrons using PyTorch distributed. In this example, we optimize the validation accuracy of fashion product recognition using PyTorch distributed data parallel and FashionMNIST. We optimize the neural network architecture as well as the optimizer configuration. As it is...
5d5c6f89d82d3d4d44b48035500a54a93ef746b3e25cb0a57e5f1d0ca6fa72c3
Python
7,065
187
import pickle import os from typing import Union import torch import lmdb class EEGSignalIO: r''' A general-purpose, lightweight and efficient EEG signal IO APIs for converting various real-world EEG signal datasets into samples and storing them in the database. Here, we draw on the implementation ideas of i...
4ed217251255e8c82fe0962f66c293cb077695c1b372a404674cd1df8ecc5d1a
Python
7,066
158
import builtins import uuid from pathlib import Path from unittest.mock import MagicMock import pytest import NDATools from NDATools.upload.batch_file_uploader import files_not_found_msg from NDATools.upload.cli import ValidatedFile from NDATools.upload.validation.api import ValidationManifest, ValidationV2Credential...
f8b8077e07b29d652abed5720634015a3554b4e06c51e3209b332af31d6d3573
Python
7,066
217
# Defines different color classes used to generate artificial training stimuli. import torch from torch import Tensor class Color: "Base class" def __init__(self): self.color = self.colorval() def colorval(self) -> Tensor: raise NotImplementedError def fill_tensor(self, height, wi...
5ab4a193a9c7840d1dba729b26bb973f558ef68b90b01264e5bdc10c0bc92cd7
Python
7,068
229
import torch from torch import nn import random from . import utils class Permute(nn.Module): def __init__(self, *order): super().__init__() self.order = order def forward(self, x): return x.permute(self.order) class Onehot(nn.Module): def __init__(self, n): super...
85b7128b4b5d65e2c14a729949221b3b8aea6d5261f028452fe7f1fe84a35c62
Python
7,068
128
import matplotlib matplotlib.use('TkAgg') # Set the backend for matplotlib import matplotlib.pyplot as plt import os import scipy import scipy.io import numpy as np from Functions.f_AnalysisGraphs import * # Import custom analysis graph functions from Functions.f_AnalysisFunctions import * # Import custom ...
0b17e0236a27321a545f7821c5e4177ec937e36998f5c54a3fd506a170ef9aaf
Python
7,069
198
''' Modified by Mayank Kabra From LEAP https://github.com/talmo/leap by Talmo Pereira ''' import h5py import numpy as np import os from time import time import keras import keras.models from keras.layers import Lambda import tensorflow as tf import re from clize import run from leap.utils import find_weights, find_be...
2907af69b533cdec9d7e1440b103231a2b5d52c9e2cd29831da2833dd7d7b161
Python
7,069
147
examples = dict( disable_training_metrics=""" >>> from h2o.estimators import H2OSupportVectorMachineEstimator >>> splice = h2o.import_file("http://h2o-public-test-data.s3.amazonaws.com/smalldata/splice/splice.svm") >>> svm = H2OSupportVectorMachineEstimator(gamma=0.01, ... ran...
61e8acc7d377f609a2435e5c2a3037cd1289bf41e3bcc357ab962188fd32ef6c
Python
7,069
232
import numpy as np import logging import platform from scipy.stats import iqr def psth( trl_dat, trl_start, onset, trl_end, chan_unit_combs=None, tbins=None, output="rate", samplerate=1000, ): """ Peristimulus time histogram The single trial input `trl_dat` needs 3 column...
219ddf3ba450cc6ac3b377b42403d17abe246b4ea28632293699f3764a3dd658
Python
7,071
114
"""WHY_THE_LINE.py 2026-10-03. Pre-registration: 04-NOTES/PREREG-2026-10-03b-WHY-THE-LINE.md Is the inequality's line excitation meeting inhibition at the lobe's own rates? s_own = the excitatory share of local-neuron synapses onto uniglomerular PNs, each weighted by its neuron's mean rate at that very sign set; predic...
4eb4d8402521c33704bd51d79dff1e44263452902d7e05e90d8791c9aae9a974
Python
7,071
198
from __future__ import annotations from enum import Enum from loguru import logger from ord_schema.message_helpers import json_format from ord_schema.proto import reaction_pb2 from pydantic import BaseModel """ used in exporting reaction data from pb """ class ReactionDataWarningType(str, Enum): COMPOUND_NAME_...
fad0ad6f68995e7328db7527d1a287668062839650cad18f74a71c35d3240570
Python
7,071
261
''' Serial communication protocol to control optotune liquid lens - by Deepak Krishnamurthy - updated by Hongquan Li July 2021 ''' import serial import platform import sys import time import numpy as np import warnings import serial.tools.list_ports from control._def import * class optotune_lens: # A class for s...
009f82ae8af1422fb322f16b176f8e89b61ead26368ad0f379a074244ff3a554
Python
7,073
186
""" Deterministic classification of particles in a STAR file (Heuristic approximation for large dataset) Input: - The STAR file with the particles to classify - Classification parameters Output: - A set of STAR files with the new classes """ __author__ = 'Antonio Martinez-Sanchez' ######...
55ba4693124c7dadef068b5be1fdeb006c60e04e225107e7058f50bc1ad29569
Python
7,073
252
#!/usr/bin/env python """Python script to run cell model""" """ /* Copyright (c) 2015-2022 EPFL-BBP, All rights reserved. THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PA...
5cbc0fa1fd63524aaede017f6df6ef8df9294aea34cbae08df9660af5c56b758
Python
7,073
252
#!/usr/bin/env python """Python script to run cell model""" """ /* Copyright (c) 2015-2022 EPFL-BBP, All rights reserved. THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PA...
79b017dc382a4546c624885f0be8e8a3953760ae987757fc16c49caa8139feed
Python
7,073
252
#!/usr/bin/env python """Python script to run cell model""" """ /* Copyright (c) 2015-2022 EPFL-BBP, All rights reserved. THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PA...
8b6d7ac82f910e90fd6e2584322c5a8c1d5cd79de4113729a744e7a394b629de
Python
7,073
252
#!/usr/bin/env python """Python script to run cell model""" """ /* Copyright (c) 2015-2022 EPFL-BBP, All rights reserved. THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PA...
91d387da10845ab76e551d86f958b3470a84a6d4483a36da5f1fcbbdbc05e92c
Python
7,073
252
#!/usr/bin/env python """Python script to run cell model""" """ /* Copyright (c) 2015-2022 EPFL-BBP, All rights reserved. THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PA...
a6d37a99d29bc14990ff6658d321e9f5f5c9bf16d31d1e1e2086456f625456ea
Python
7,077
212
from utils import load_dataset, load_snp, null_dist_score1, FilterLCC, load_score import pickle from collections import defaultdict import multiprocessing from sklearn.cluster import KMeans from sklearn.decomposition import TruncatedSVD from scipy.stats import norm import numpy as np def sig_score(gene): gene_...
d027687817d1fdbb6ffe5d252305ff8090d19fff1409aef649108d81fe0b1859
Python
7,077
214
from utils import load_dataset, load_snp, null_dist_score1, FilterLCC, load_score import pickle from collections import defaultdict import multiprocessing from sklearn.cluster import KMeans from sklearn.decomposition import TruncatedSVD from scipy.stats import norm import numpy as np def sig_score(gene): gene_c...
5e6089ca9d9361c5a9ca99a244affd66dd95508264bb326d4554c4df57bfef4f
Python
7,078
266
"""Classes for several probability distributions (Gamma, Lognormal, Wald, Weibull).""" import numpy as np from scipy.special import gamma as gamma_func from scipy.stats import gamma, invgauss, lognorm, weibull_min class Gamma(): """ Define a gamma distribution. This class represents a gamma distribution...
7b6df373ad041b3dc38756d938f4f80d853d3c256b6e435850d88a1bc5cfba83
Python
7,078
244
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
9e2b494058d9cc526cc453c4f86fb0c1f7d3730c5a130341a4be01decd3b98e8
Python
7,080
202
import torch from torch import nn class BernoulliVAE(nn.Module): """ Vanilla VAE with Bernoulli latent distribution. Args: input_size (int): size of model input latent_dim (list[int]): dimensions of 2D latent space n (int): number of times to sample from latent distribution for a ...
cebff23eb7443052b68b1b47f4e073d4e0883662a19def19cc15bdae28784f30
Python
7,080
127
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Created on Fri Apr 8 11:29:57 2022 # @author: caroline """ Compute logistic regressions of the weights of priors and sensory likelihood for each subject. # Fit weights of priors and likelihood in T1 ## With bayesian combination (= bayesian decision and generative...
5be8e8c4f0dcc01ec9b234c5980186d82332a84a6e0b46e8e0ed80d79922359d
Python
7,083
158
from __future__ import division, print_function, absolute_import import importlib.machinery import tensorflow.keras.callbacks as tfcallbacks import chrombpnet.training.utils.argmanager as argmanager import chrombpnet.training.utils.losses as losses import chrombpnet.training.utils.callbacks as callbacks import chrombp...
df552c09b49e8e3d202f70e2d1d7545096b346b4403e1876512645aa66f16264
Python
7,083
209
"""Convolutional neural net on MNIST, modeled on 'LeNet-5', http://yann.lecun.com/exdb/publis/pdf/lecun-98.pdf""" import data_mnist import autograd.numpy as np import autograd.numpy.random as npr import autograd.scipy.signal from autograd import grad convolve = autograd.scipy.signal.convolve class WeightsParser: ...
9919341a5c1e42333fe9232c4d5469a543e4c86f8f44aeaa5d0fd538d6329aa9
Python
7,084
182
# ---------------------------------------------------------------------- # Copyright (C) 2016, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This program is free software: you can redistribute it and/or mo...
0ee3c7f81cdbab4fae00a139ec1cc2f81ef814a1997e94192666176e30aa6143
Python
7,087
212
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from ..initializer import create_initializer class BasicBlock(nn.Module): expansion = 1 def __init__(self, in_channels, out_channels, stride): super().__init__() self.bn1 = nn.BatchNorm2d(in_channels) ...
e56c3b56ef64abfd0b7bad2a3a1d1b831da1762c0bceaccc7f425b06212a9673
Python
7,088
239
#!/usr/bin/env python # -*- coding: utf-8 -*- """ :AUTHOR: Jens Petersen :ORGANIZATION: Heidelberg University Hospital; German Cancer Research Center :CONTACT: jens.petersen@dkfz.de :SINCE: Wed May 17 14:29:20 2017 :VERSION: 0.1 DESCRIPTION ----------- Preprocess all experiments under a given XNAT endpoint REQUIRES...
c96f2eda522237dded7beb4009b732b36e9463ff92ef070dfb905e0c3445440c
Python
7,089
150
from typing import Any, Tuple import numpy as np import pandas as pd from torch.utils.data import Dataset from .base_dataset import BaseDataset class ConcatDataset(Dataset): """ A dataset class that vertically concatenates two datasets. This class is particularly useful for combining multiple datasets to cr...
cd01e9fa21ad3370cfa3e29ae25abd8082ccf296454b9946ec744f64ff011bd4
Python
7,093
227
# -*- coding: utf-8 -*- # # Main package initializer # # Builtin/3rd party package imports import os import sys import subprocess import getpass import socket import numpy as np from hashlib import blake2b, sha1 from importlib.metadata import version, PackageNotFoundError import dask.distributed as dd # Get package v...
04d7e4934e875bc5b6370d6157d26f0ec6981f09ceccde2165f49eb3168de71b
Python
7,094
188
from scipy.spatial import distance import scanpy as sc from sklearn.decomposition import PCA from sklearn.manifold import TSNE import umap.umap_ as umap import numpy as np import warnings warnings.filterwarnings('ignore') def preprocess(adata, filter_min_counts=True, size_factors=True, normalize_input=False...
73a26fd9f5b8c56e421db0ee47fec3e0f5a2187bbf3651b45772086805ff43b0
Python
7,095
189
"""Counting, integration, and prediction helpers for nonparametric estimators.""" from typing import Literal import numpy as np from numpy.typing import ArrayLike from SurvivalEVAL.evaluations.util import get_prob_at_zero def _predict_step( t: ArrayLike, event_times: np.ndarray | None, values: np.ndarr...
76b302f9f3284f5cfe9ae403d5011e307d71cac087cbec5e57231f79c2d868ed
Python
7,095
158
import torch import torch.nn as nn from torch.utils.data import DataLoader import numpy as np from tqdm import tqdm from model import * from data.dataset import CategoricalStructureAdjointDataset import argparse from utils import * import os import datetime ABS_PATH = os.path.abspath(__file__) ABS_PATH = "/".join(ABS_...
05d1c294062d767186ff74f9fcb704a89d2a7c58af72ef13763b6c03671f8710
Python
7,096
253
#!/usr/bin/env python """Python script to run cell model""" """ /* Copyright (c) 2015 EPFL-BBP, All rights reserved. THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICU...
8bd6039112ca6b4696f6c2f91ecd35284a60c462a4a82c99d0998899e0544e1f
Python
7,096
253
#!/usr/bin/env python """Python script to run cell model""" """ /* Copyright (c) 2015 EPFL-BBP, All rights reserved. THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICU...
9c18d07fc3d17bc4d43b64787e3d40341d01bb1acb26963de61e65a7894e4e3a
Python
7,096
253
#!/usr/bin/env python """Python script to run cell model""" """ /* Copyright (c) 2015 EPFL-BBP, All rights reserved. THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICU...
afffb84e82085035277b78981ae4ad96e5b3310f053a310679958dcc5e697191
Python
7,096
185
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
b32c7b4ad8962a52e258a9299782bb63994188f1ceb729fb48818eb2063e3bc7
Python
7,096
253
#!/usr/bin/env python """Python script to run cell model""" """ /* Copyright (c) 2015 EPFL-BBP, All rights reserved. THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICU...
48bda9e28cf2fe51cc70c77ae9deecdb7265e254e898e97f356b55fa75745d07
Python
7,097
225
# helper functions for processing inputs to disperseNN2 import numpy as np import sys from geopy import distance import random import utm import tskit from disperseNN2.read_input import parse_provenance # project sample locations def project_locs(locs, fp=None): # projection (plus some code for calculating error...
9139fa399da8096833ae1c52f52c4264a51437a22edb51e69deb2c6ee3cba516
Python
7,097
147
from typing import List import torch import torch.nn as nn from .mmd_like import _MMDLikeTrainer def _gaussian_kernel(x_source, x_target, mul_kernel=2.0, num_kernels=5, sigma=None): n_samples = int(x_source.shape[0]) + int(x_target....
3a3a9a1655114312f8967b64434c6ff9e7feac117e6e816c5c56301e7a1279ac
Python
7,098
143
""" DeepLabCut2.0 Toolbox (deeplabcut.org) copyright A. & M. Mathis Labs https://github.com/AlexEMG/DeepLabCut Please see AUTHORS for contributors. https://github.com/AlexEMG/DeepLabCut/blob/master/AUTHORS Licensed under GNU Lesser General Public License v3.0 """ import deeplabcut import os import subprocess import y...
7557a8be036938d7ca3b18b7dae9e5d9a8c95de3c00b1fe9659dee45cd59e21e
Python
7,098
215
from distutils import log import distutils.command.sdist as orig import os import sys import io import contextlib from itertools import chain from .._importlib import metadata from .build import _ORIGINAL_SUBCOMMANDS _default_revctrl = list def walk_revctrl(dirname=''): """Find all files under revision control"...
ffff55416c012930cc7ff6a131f477a2ac418bd7db77ebeeb96f0001f2ead100
Python
7,098
235
import numpy as np import h5py import os import nibabel as nib import json import random import cv2 import copy class Params: def __init__(self, json_path): self.update(json_path) def save(self, json_path): """" Save dict to json file Parameters ---------- jso...
40f958ed06a3d8699913c7c177bff43a83328cfcd6c3ffde0713bf0c05364975
Python
7,100
208
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
0e1a3e7e46c2a1b83c87ee946cacfb3b6684a3db2410b834f218398d83f46485
Python
7,103
181
""" Created on 25/07/2019 :author: Mahyar Osanlouy, Gonzalo D. Maso Talou :summary: """ import numpy as np from PIL import Image from src.utils.get_image_size import get_image_size from src.utils.sitk_utils import is_sitk_image, get_sitk_image_to_data class ImageSizeException(Exception): pass ...
7986726799c8d6164c111010a502b0c314205704a459e97a54d6807b16753674
Python
7,104
196
import random import urllib.parse from nglui import statebuilder import json from codex.data.brain_regions import REGIONS, COLORS from codex.data.versions import ( DEFAULT_DATA_SNAPSHOT_VERSION, DATA_SNAPSHOT_VERSION_DESCRIPTIONS, ) from codex import logger NGL_FLAT_BASE_URL = "https://ngl.cave-explorer.org"...
81bf5d80224de02de3bc340855e3afd61d685ba9f41d3224846168eeb104baaa
Python
7,105
198
"""Graph encoders.""" import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import manifolds from layers.att_layers import GraphAttentionLayer import layers.hyp_layers as hyp_layers from layers.layers import GraphConvolution, Linear, get_dim_act import utils.math_utils as pmath class...
fd4d4d53f0be483805ce46c0c40b0f0e03131de4d66596870909d937f8e1d14f
Python
7,105
190
# SPDX-FileCopyrightText: 2015 Eric Larson # # SPDX-License-Identifier: Apache-2.0 import base64 import io import json import zlib from pip._vendor import msgpack from pip._vendor.requests.structures import CaseInsensitiveDict from .compat import HTTPResponse, pickle, text_type def _b64_decode_bytes(b): return...
9a57c47d374df74697870149b6d89f069029f2c4d4870050f0896c43238b5c72
Python
7,108
168
#!/usr/bin/env python """ toposampling - Topology-assisted sampling and analysis of activity data Copyright (C) 2020 Blue Brain Project / EPFL & University of Aberdeen This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Fr...
9cee12c1ceab6d34c88dd93ad3496bc602f1c8fd6fd3e5945f33c79f88007e7f
Python
7,109
202
import tensorflow as tf import PoseMDN from stephenHeadConfig import conf as conf import PoseTools import edward as ed import math import numpy as np import matplotlib.pyplot as plt import mymap import PoseTrain import os import pickle from tensorflow.contrib import slim from edward.models import Categorical, Mixture, ...
b32e3e022801540ccf3fd236b520138982fab8974cac7c7efc58ad7362ffebaa
Python
7,109
194
# set QT_API environment variable import os os.environ["QT_API"] = "pyqt5" import qtpy # qt libraries from qtpy.QtCore import * from qtpy.QtWidgets import * from qtpy.QtGui import * import pyqtgraph as pg from datetime import datetime from control._def import * class SpectrometerControlWidget(QFrame): signal_ne...
0180a768762556cc44d9897757e55476923154bc38052f373c5740eaf17912df
Python
7,110
210
#!/usr/bin/env python # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ This module provides a human agent to control the ego vehicle via keyboard """ import time from threading import Thread import cv2 import numpy as np try: import pygame ...
30afee7899abb636d1c50596e06d483d7683231b66c7771bb71b06bdae4a2a67
Python
7,112
182
""" Tests module contact. Need to add more tests. # Author: Vladan Lucic # $Id$ """ from __future__ import unicode_literals from __future__ import absolute_import __version__ = "$Revision$" from copy import copy, deepcopy import importlib import unittest import numpy import numpy.testing as np_test import scipy ...
c5eed43fcd3f0cd1e8d65819a0b1be8cfeba688900709f85e2b0f5893f750ad9
Python
7,113
123
import numpy as np from scipy.signal import welch from scipy.integrate import simps from Functions.f_SignalProcFuncLibs import * def f_bandPower(v_data, sf, v_freqBand): """ Compute the power of a given frequency band in a signal. Args: v_data (array-like): The input signal data. ...
836d3a05c4571809af4955f225644b0bc3421ef601d046c1bc24e6749d077d58
Python
7,114
209
#!/usr/bin/env python #================================================================ # Copyright (C) 2023 Yufeng Liu (Braintell, Southeast University). All rights reserved. # # Filename : utils.py # Author : Yufeng Liu # Date : 2023-03-02 # Description : # #=========================...
f2b8ba541b0c70b930c2c4e987248041fd3371a173f0584b165f5f50f0c8f132
Python
7,123
170
# MIT License # # Copyright (c) 2024 Yu Bao, Harbin Institute of Technology # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # ...
700f21ec265ac60d3b13985a08c429205ce6e95ef1a07eda1fe67343645fc960
Python
7,125
173
from __future__ import print_function from dvn.utils import get_itk_array, get_itk_image, make_itk_image, write_itk_image, get_patch_data, get_volume_from_patches import numpy as np from dvn import Network as NET import argparse import os def norm_data(data): data = data - np.min(data) data = data * 1.0 / np.m...
9eed915aae97a6abceb78980d5a3a439e27b60a272a14441110832c2aa8c018a
Python
7,125
162
# coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. # # 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...
bb7bcc43ab4537509a2b59432bf03ff3ab356528ad2c7cca12c574c775bafa9c
Python
7,126
135
#!/usr/bin/env python from __future__ import division, print_function import argparse import sys import torch from topaz.denoise import Denoise3D, denoise_tomogram_stream from topaz.denoising.datasets import make_tomogram_datasets name = 'denoise3d' help = 'denoise 3D volumes with various denoising algorithms' def ...