sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
36945cd16e3564396bd37f48343d949516e4505adc3977267714de744ac775dc
Python
5,035
122
from treelib import Node, Tree import csv import logging class Hierarchy(Tree): def __init__(self): Tree.__init__(self) @staticmethod def pair2id(level, tag): return '%03d:%s' % (level, tag) @staticmethod def id2pair(identifier): return int(identifier[0:3]), ident...
d0b60397235e80b284209bfa567f444aec38d303e7ef07d12f86704e43abbf2a
Python
5,035
163
#!/usr/bin/env python """ A TCP communication class that acts as the client side for generic communications between programs in the storm-control project Jeffrey Moffitt 3/8/14 jeffmoffitt@gmail.com """ # # Import # import sys import time from PyQt5 import QtCore, QtGui, QtNetwork, QtWidgets from storm_control.sc_...
5cb10116ef0b83482b468140c725b7ee84ed4060929e3ab53dac9ac4933106bb
Python
5,036
173
import numpy as np import pytest import torch from eir.data_load.data_preparation_modules.prepare_array import ( ArrayNormalizationStats, prepare_array_data, ) @pytest.mark.parametrize( "array_data, expected_result", [ (np.array([1, 2, 3]), torch.tensor([[[1.0, 2.0, 3.0]]], dtype=torch.float3...
498c62b83526b8eda83e401c1b08556109a60bf5dd5f5ad46e76d9549838dcf4
Python
5,037
159
""" models/mlp_model.py 多标签手术指征 MLP(支持残差块 + 可选 Classifier-Chain Head) • 将所有 ReLU 的 inplace=False,避免 SHAP DeepExplainer 报错 • 主干网络:Linear → BatchNorm → ReLU → Dropout × L + ResidualFC × N • 输出头:普通线性或 Classifier-Chain Head (--use_cc) """ from __future__ import annotations from typing import Sequence, Tuple, List, ...
6297832fd1d0c5d24342b5c498233d2490a5b01cbcacc295c14db00a5aee7863
Python
5,037
142
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ This Python script is used to extract the timeseries from functional images preprocessed by fmriprep. This pipeline will generate timeseries files, framewise displacement record and the labels of the used Atlas. Schaefer 400 Atlas is used by default. Note!!!!!!!!!...
3eb8dfb457a368a2cdb55ae9b94af67d24e08c4cf9e4ba3222c22deaad75abad
Python
5,038
142
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ This Python script is used to extract the timeseries from functional images preprocessed by fmriprep. This pipeline will generate timeseries files, framewise displacement record and the labels of the used Atlas. Schaefer 400 Atlas is used by default. Note!!!!!!!!!...
ce22d7752be58fefdccd953d4f330822a588427fb5170fe99f852b1b9b113583
Python
5,041
151
from typing import List import torch import torch.nn.functional as F from torch import Tensor from torch.nn.modules.loss import _Loss import numpy as np from .functional import soft_dice_score __all__ = ["DiceLoss"] BINARY_MODE = "binary" MULTICLASS_MODE = "multiclass" MULTILABEL_MODE = "multilabel" def to_tensor...
6efa9376d2c33cdfe02ae882cb524eeb909936d1ac0a3a4bd6f370459dc482f1
Python
5,047
118
"""Per-subject shared-pool preparation for the LAION-fMRI benchmark. Replaces the earlier cross-subject `concat_shared.py` (which materialized a 5+ GB NaN-padded matrix in RAM and OOM'd). For the Allen2022-style shared-pool benchmark we don't need a single cross-subject assembly — `TrainTestNeuralBenchmark` with `alph...
769e299e4c8141ea336289f8ec1276e510f08bba684881622fc524a6c02ec8c0
Python
5,047
136
# Copyright 2024 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
ba45a9eab16b18c6e39fc32da02bbbbe485f5cce8023e900b2231c9ffb0a3740
Python
5,047
135
from typing import Dict, Tuple, Union, List import torch import torch.nn.functional as F from torch import Tensor @torch.jit.script def binary_erosion(image: Tensor) -> Tensor: kernel = _get_binary_kernel3d(3, image.device) padding = _compute_zero_padding((3, 3, 3)) b, c, h, w, d = image.shape # map...
05ffeb8354790bf5b280938abd7da81c42f249bfbb14dda6cf34d824a742875e
Python
5,048
159
""" models/classification_model.py 多标签手术指征 MLP(支持残差块 + 可选 Classifier-Chain Head) • 将所有 ReLU 的 inplace=False,避免 SHAP DeepExplainer 报错 • 主干网络:Linear → BatchNorm → ReLU → Dropout × L + ResidualFC × N • 输出头:普通线性或 Classifier-Chain Head (--use_cc) """ from __future__ import annotations from typing import Sequence, Tu...
565c085a9950f8e8f0e25072e2f491b2649b5b7d1ac77078698c1168b571fba6
Python
5,049
160
import argparse import os import os.path as osp import time import numpy as np import torch import torch.nn.functional as F from sklearn.metrics import f1_score import pandas import json import torch_geometric.transforms as T from torch_geometric.nn import ChebConv, GCNConv # noqa from tqdm import tqdm from sklearn.me...
5bfb160334af07f31d77765aaf8c2013a5a5b0982f4bcb30d948cb2444bc8a20
Python
5,049
175
""" This script plots the result of the cross-validation of the switch evidence direction. """ import sys import os sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import os import numpy as np import json import matplotlib as mpl import matplotlib.pyplot as plt import seaborn as sns ...
c67cda8e6a25e6acb95d6905f640a82b429ac984d967b8eeede05bf0739bd610
Python
5,049
140
"""Trainer for model on msi task. The scalar, image, and figures logged during training can be visualized in tensorboard by running the following command: $ python3 tensorboard --log_dir=logs/$run_number/tensorboard """ import logging import numpy as np import os from python_utils.logging import scalar_writer as scal...
ccdfcfc6aa817be937fcaf884f3ceaf7d06b230c026ba9006ef542ddf1e4d3da
Python
5,049
94
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'camera-detached.ui' # # Created by: PyQt5 UI code generator 5.10.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.s...
fe08e8f52173c37fad5c7be15c86e0a904c3247d4bb4ca1e68267fd316793ba3
Python
5,049
156
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Aug 22 22:36:52 2017 @author: ajaver """ import pandas as pd import numpy as np import numba import math import os extras_dir = os.path.join(os.path.dirname(__file__), 'extras') def load_OW_eigen_projections(): eigen_projection_file = os.path.join...
4ca54e4ba4ae02a88b049c576891763ebf67e3ec63f6b1fc4353fd284dde1dd1
Python
5,050
117
import numpy as np from scipy import stats from utils import Recorder_select, Q_nak from mitochondria_PDP1KD import Mito import matplotlib.pyplot as plt from figure_properties import * from default_ca_conc import ca_freq_concs dt = 0.1 seed = 11 np.random.seed(seed) def generate_spiketrain(rate, duration): # durat...
b88b430a6decc2537ee6cf45d16ceec5c86aabd58581ff6b9112013e99d0afde
Python
5,050
93
#!/usr/local/bin/python3 from pipeline import experiment, reso, meso, fuse, stack, pupil, treadmill, posture from stimulus import stimulus from stimline import tune import time import logging import datajoint as dj ## database logging code logging.basicConfig(level=logging.ERROR) logging.getLogger('datajoint.conne...
418ee1f438d083d53b2afd4fca60af7ad3bb79f02b4f635f30efd7f69fb9ab72
Python
5,051
127
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license """Utility functions for neural network modules.""" import copy import numpy as np import torch import torch.nn.functional as F from torch import nn __all__ = "inverse_sigmoid", "multi_scale_deformable_attn_pytorch" def _get_clones(module, n): ...
c61d3e9e37ae3d944e77a4dcc26902eb07bc908ca2904a4bb3a69f905aa8e371
Python
5,051
153
"""Attention-based multiple instance learning implementation. Modified from https://github.com/AMLab-Amsterdam/AttentionDeepMIL. References ---------- Ilse, M., Tomczak, J. M., & Welling, M. (2018). Attention-based Deep Multiple Instance Learning. arXiv preprint arXiv:1802.04712. """ from __future__ import annotatio...
8cf2ae4b68193b9a86de8f203e437f021691eb2336e432e3c7f6b8a04ee591ef
Python
5,052
141
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Compute the mean Apparent Fiber Density (AFD) and mean Radial fODF (radfODF) maps for every connections within a hdf5 (.h5) file. This is the "real" fixel-based fODF amplitude along every streamline of each connection, averaged at every voxel. Please use a hdf5 (.h5)...
e81ff2a6b258d15f52e0458c0cdfc2f4f531f88f0dc5762411053d8092051bcd
Python
5,052
142
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ This Python script is used to extract the timeseries from functional images preprocessed by fmriprep. This pipeline will generate timeseries files, framewise displacement record and the labels of the used Atlas. Schaefer 400 Atlas is used by default. Note!!!!!!!!!...
4d3ba6c5ee9bad80ffa516f28a096a1ff88a0dc36f127430f485482e6100817a
Python
5,053
161
"""Download and prepare all the Therapeutics Data Commons (TDC) ADMET datasets.""" from pathlib import Path import pandas as pd from tdc.single_pred import ADME, Tox from tdc.utils import retrieve_label_name_list from tqdm import tqdm from tdc_constants import ( ADMET_ALL_SMILES_COLUMN, ADMET_GROUP_SMILES_CO...
6b592ef375e162c8529bec5f5c79a3cdf5b4c5e92d8825918e873141f2f23743
Python
5,053
159
import argparse import os import os.path as osp import time import numpy as np import torch import torch.nn.functional as F import pandas as pd import json from torch_geometric.nn import ChebConv, GCNConv, Linear from tqdm import tqdm from sklearn.metrics import roc_auc_score, accuracy_score, recall_score, f1_score, pr...
ff2798543ea573fc2e4fc44027ddc7f31a77dfd24dacdf78f2c663a7e30c304e
Python
5,053
103
from snakemake.io import expand from snakemake.logging import logger import numpy as np from drop import utils from .Submodules import Submodule class AE(Submodule): def __init__(self, config, sampleAnnotation: "SampleAnnotation", processedDataDir, processedResultsDir, workDir): super().__init__(config, ...
38867fd2354dc97e42633331066cba36ee79cec67c34ca5375eaeb3b246beff0
Python
5,054
136
# Copyright 2024 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
8e3a517d2da7df362a393af5f933fc028cb041317b0181f2bebe745e40812c61
Python
5,054
162
"""Layer classes.""" import math import torch import torch.nn.functional as F from torch.nn import Parameter from torch_scatter import scatter_add, scatter_mean from torch_geometric.utils import remove_self_loops, add_self_loops def uniform(size, tensor): """ Uniform weight initialization. :param size: Si...
c21509729ff04629f63a2955a39762d37a16c8b71037bcbecb7bc5d8ec2fa147
Python
5,054
151
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jun 22 00:24:30 2024 @author: costantino_ai """ import os import logging from pathlib import Path import pandas as pd from brainscore_core.supported_data_standards.brainio.assemblies import BehavioralAssembly from brainscore_core.supported_data_standar...
242db39fcc75cd1f3d37275175546a4f4e5f28906ae16a8e50b1aa81d6e67898
Python
5,056
104
"""Optional LNCC backend backed by the standalone ``fused_lncc`` CUDA kernel. pip install fused_lncc --no-build-isolation # needs PyTorch + a CUDA toolchain; see its README reg = GreedyRegistration(..., loss_type='lite_lncc') # falls back to 'cc' if not installed """ import warnings from typing import List...
76282a87d1158a925fd9580e94748c695e370d560a8aec148bea62914ee5da41
Python
5,056
105
from PUMI.engine import FuncPipeline, NestedNode as Node from nipype.interfaces import fsl, afni from PUMI.pipelines.anat.segmentation import bet_fsl, bet_hd, bet_deepbet from PUMI.pipelines.func.compcor import compcor from PUMI.pipelines.func.concat import concat from PUMI.pipelines.func.data_censorer import datacens_...
74f518049af5a50083c9b85012639a44876aac6ae23329b17c47303eb7c2153d
Python
5,059
126
# Google utils: https://cloud.google.com/storage/docs/reference/libraries import os import platform import subprocess import time from pathlib import Path import requests import torch def gsutil_getsize(url=''): # gs://bucket/file size https://cloud.google.com/storage/docs/gsutil/commands/du s = subprocess....
9e942258ec074ea3967608c2f1c49fefa42d1eda68fb6ef2532f0baa889fe6b7
Python
5,059
154
# -*- coding: utf-8 -*- # python standard library inputs import os # external inputs import numpy as np import nibabel as nb def estimate_pv(input_target, input_border, path_output, name_output): """Estimate PV. This function estimates the partial volume contribution in each image voxel of a target im...
b8ee445490e068451635abd9da593972f613683e26667609c7781d4e353dad4d
Python
5,061
171
#!/usr/bin/env python # # make_image.py: # create the image for one frame in cytosim's result file # # copyright F. Nedelec, 2008-2010 # """ Calls executable to generate an image in each specified directory Syntax: make_image.py executable-with-arguments [options] [directories] The current directory is...
56ef0aa9bede809d2858fa3f5cb362aa68fee47196c15f723cce47e38c5b5111
Python
5,062
137
import glob import os import numpy as np from scipy import stats from .image_processor import * from matplotlib import pyplot as plt class Item: def __init__(self, image, center, angle, image_name): self.image_name = image_name self.image = image # Load image and convert to float32 ...
6d11551f8b790f7630bef50bd54b992c067659ff44177e5bc6041f2c755b0d99
Python
5,062
104
############################################################## ### Definitions of assembly neurons in different paradigms ### ### of overlap between cell assemblies ### ############################################################## ### Copyright 2020-2022 Jannik Luboeinski ### licensed under Apache...
55015da85cea5f68349361c265bc67564bdda0b621f533d497306efaf46697ca
Python
5,064
119
from scvi.dataset import CsvDataset import os from sys import argv from pathlib import Path from scvi.dataset import CsvDataset import numpy as np import pandas as pd from scvi.models import SCANVI from scvi.inference import SemiSupervisedTrainer import time as tm import rpy2.robjects as robjects def run_s...
f853390c874047f85f64e8270c384f5cd88c6cb475f98b32faef3edecc682bfb
Python
5,064
185
""" Wrappers for doing binary IO on file-like objects """ import struct import sys import numpy def bytesify(s): if isinstance(s, bytes): return s else: return s.encode() # Standard size: # short is 8 bits # int and long are 32 bits # long long is 64 bits class BadMagicNumber(IOError): ...
66290e4ad5cca9563f6221b24ce9c0981846e80c14038910217649431a6001f1
Python
5,065
129
"""``meanap-preflight`` — check a dataset before committing to a run. Answers, in seconds and without downloading anything: are the recordings my spreadsheet names actually there, how much will this transfer, and will it fit? """ from __future__ import annotations import argparse import csv import io import sys impo...
8d6505b3fec3b350c9fea5cfca21a6e1fb495d4b9689aa33a8e2f10070ffcb58
Python
5,065
136
# define multi-offset transformer reconstruction network import torch import numpy as np import torch.nn as nn from utils.utils import * from einops import rearrange import torch.nn.functional as F class Attention(nn.Module): def __init__(self, dim, dim_head=64, heads=8): super().__init__() ...
b064fc34fb92e6fa835c72bb6a1ec78fb4fc0f8ac47cf96ae90c5f7e4be8b4e8
Python
5,065
119
import numpy as np import pandas as pd import os import copy def build_network( rsnn, datapath, area_list=["wS1", "wS2", "wM1", "wM2", "ALM", "tjM1"], with_video=True, hidden_propability=0.0, ): """ Build the network based on the data collected from the dataset and based on the array r...
ff91cf5cfe31c0ad4de87e0b36097bb147db3b2eff52010689f25c4c1f975221
Python
5,065
155
import numpy as np import pandas as pd import os import torch import datetime from torch_geometric.data import Data, HeteroData import nltk import pickle import sys sys.path.append("..") from dataset import merge_and_split, get_data_dir, fast_merge, split_user_and_tweet def preprocess_dataset(dataset, server_id="20...
c3864d038fae72b003e07c092b6bebd4b49550924f2cd9fe35db2d432bdf397b
Python
5,066
104
############################################################## ### Definitions of assembly neurons in different paradigms ### ### of overlap between cell assemblies ### ############################################################## ### Copyright 2020-2022 Jannik Luboeinski ### licensed under Apache...
775e0828bdb13256ae4567f539e9b81a6418804d33d1d6dddc8172f25dd421f7
Python
5,069
132
from __future__ import annotations import copy from pathlib import Path from typing import Final from typing import cast from loguru import logger from .. import _yaml from .._ai_models import AI_TEXT_MODEL_OPTIONS from ._migration import migrate_config from ._shape_color import migrate_shape_color from ._shape_colo...
951aa435b3d03c44af2519531c0fab0870b7c6bdc7336e27a951cf2d1e814155
Python
5,069
126
#!/usr/bin/env python """ HAL module for Coherent laser control. Hazen 04/17 """ import storm_control.hal4000.halLib.halMessage as halMessage import storm_control.sc_hardware.baseClasses.amplitudeModule as amplitudeModule import storm_control.sc_hardware.baseClasses.hardwareModule as hardwareModule class CoherentL...
199ce4a444401ad4aadf78bdc3a6bb6adf922ba5c99735bb7398c9c635885628
Python
5,070
125
""" (C) Copyright 2021 IBM Corp. 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 in writing, software dis...
63259280b3f091916fb2595dce57a71b0a2a9e62f78cb96578316d584a799ec6
Python
5,070
137
''' Auxiliary functions for handling (pseudo-)trials. ''' import numpy as np from sklearn.covariance import LedoitWolf from typing import Any, Union, Callable def group_by(X: np.ndarray, Y: np.ndarray, conds: Union[np.ndarray, list[str]]) -> np.ndarray: ''' Group the EEG data by conditions. INPUTS: ...
9acdbc8d9494da176d4777b4b1d96ebd86742ca0314bbd36e99a40674e835ead
Python
5,070
161
import tests.util def _format_attributes(attrs): formatted_pairs = list() for k, v in attrs: formatted_pairs.append(' '.join([k, tests.util.double_quote(v)])) return '; '.join(formatted_pairs) def _group_transcripts_by_gene_id(transcripts): transcripts_by_gene_id = dict() for transcript...
ac8e71e7ec938c636d20478d4b11906b47c9f127fe84613c9ebf0593276159d0
Python
5,070
151
import os import numpy as np import sys import yaml import h5py import git import matplotlib.pyplot as plt filename,pathpath,dstpath,tintfile,exptype = sys.argv[1:] recid = os.path.basename(filename).split('.')[0] stylepath = 'config/presentation.mplstyle' plt.style.use(stylepath) sr_psth = 2000 k_std = (10/1000)...
1198a5aa334f5a19bf002c4e7b68e963b5bbc7d190558a514fe940d6e887d81b
Python
5,072
170
""" This submodule implements a scorer interface for the various causal metrics implemented. These scorers can then be incorporated into model selection objects to select the models (or hyperparameters) that optimizes these scores. For example, as a `scoring` parameter to a `causallib.model_selection.GridSearchCV objec...
23341752b1f228ae46785389651f47e91dd8d0cde4c87f6a39e5ed23286f6e4c
Python
5,072
158
"""This file currently uses opencv to select points for homography and/ or rectification. Ideally, I really want to move away from opencv, and we can do a lot of the selection just with matplotlib or similar instead. However, I would have to figure out how to draw those polygons with mpl. Some of this code was mofifie...
68c3e8f84d27b61011970a20c0fe569e8fbf60899de2c7fd476a4cddb038ae48
Python
5,072
133
"""Torch Module for E(n) Equivariant Graph Convolutional Layer""" # pylint: disable= no-member, arguments-differ, invalid-name import torch import torch.nn as nn import dgl from dgl import function as fn class EGNNNormConv(nn.Module): def __init__(self, in_size, hidden_size, out_size, edge_feat_size=0): s...
901f805e3ef0d8b2d90e37da69c30c670bf20ec23abe0b5e9a1a452f5043a87f
Python
5,072
146
import lmfit import numpy as np from impedancefitter import get_equivalent_circuit_model def calculate_impedance_spectrum_using_fft( dt: float, voltage: np.ndarray, current: np.ndarray, current_threshold=0.1 ): """Extract impedance spectrum from time domain data using the FFT. Parameters ---------- ...
58b7e30c1f05b520dcd0a656f482df7e54bccaac12bc0f0e6d60f814f6d78809
Python
5,073
157
from pyro import deterministic, param, plate, sample # type: ignore from pyro.distributions import ( # type: ignore HalfCauchy, Normal, TransformedDistribution, ) from pyro.distributions.constraints import positive # type: ignore from pyro.distributions.transforms import ExpTransform # type: ignore from...
e4da2c1fbfb7267ca2c730f062bc90fe6f3b88adb0d1dcdf73f356e8e15c8dd2
Python
5,074
172
import argparse import csv import datetime import json import os from typing import Any def find_validation_logs(root_dir: str) -> list[str]: results = [] for root, _, files in os.walk(root_dir): if "validation_average_history.log" in files: results.append(os.path.join(root, "validation_av...
b9674e1420be7ec6a25f8812c9653da06cc46603e3259cd593f3ebf556fd6bc5
Python
5,075
120
"""Plot consistency between participants in projection onto tuning shift PCs. Figure 4C. """ import matplotlib.pyplot as plt import numpy as np import os import pickle from matplotlib.patches import Patch from scipy.stats import sem, ttest_1samp from utils import ( draw_violinplot, get_pssd, get_voxel_to...
1467e4841bce4e536a2f0d6d63d093429b7d22b81629d00b5cc04e1abfd3b6f1
Python
5,076
102
#encoding=utf-8 import sys sys.path.append("../") import jieba.posseg as pseg import jieba jieba.enable_paddle() def cuttest(test_sent): result = pseg.cut(test_sent, use_paddle=True) for word, flag in result: print('%s %s' % (word, flag)) if __name__ == "__main__": cuttest("这是一个伸手不见五指的黑夜。我叫孙悟空,我爱...
2a66bda8b10ee94248c352eaab8d60a5ae267d860ff33f3f2bb8d038ca7f20cd
Python
5,076
75
"""LAION-fMRI benchmark registration. Benchmark registry: 20 headline variants matching the authors' re:vision framework. Headline ridge encoding variants — predict per-voxel responses from model features using kernel/dual ridge with per-fit CV alpha selection over a 21-value log-spaced sweep (1e-10 to 1e10). - Per...
2b40fa56857a3e6765249366bfd82ce17d691e0fe0f7231d12bd1cb4fc8cd2b6
Python
5,076
137
import xgboost as xgb import numpy as np import logging import os from argparse import ArgumentParser from sklearn.metrics import f1_score,precision_score,accuracy_score,recall_score,roc_auc_score from imblearn.combine import SMOTEENN from collections import Counter parser= ArgumentParser() parser.add_argument('--datas...
71ab0d880b42c964172abf6818545b8367849cd1af8a5dbc9f9b55ff0f7901ae
Python
5,077
116
import numpy as np from scipy import stats from utils import Recorder_select, Q_nak from mitochondria import Mito import matplotlib.pyplot as plt from figure_properties import * # Version will all the necessary parameters. dt = 0.1 seed = 11 np.random.seed(seed) def generate_spiketrain(rate, duration): # duration ...
eab87c8a830756d91d6e7316293165b73f5a4e8fcb8aab2a79fa40af5a2a56ec
Python
5,078
143
#!/usr/bin/env python from optparse import OptionParser from rpy import r import bx.align.maf import bx.bitset from bx.bitset_builders import binned_bitsets_from_file def main(): parser = OptionParser(usage="usage: %prog [options] maf_file snp_file neutral_file window_size step_size") parser.add_option("-o...
55f2ddae7974fe9fcf81aef5133b49ad04758368610146d7a3aebe8e809dfc1f
Python
5,079
111
import sys sys.path.append('./TEMcode/2024-10-22/run0/script') import pandas as pd import numpy as np import torch import glob import importlib.util # Own module imports. Note how model module is not imported, since we'll used the model from the training run import src.world as world import src.analyse as analyse impo...
73e48523e9c6bbce53b45a92d95ac89e8dbacedb6c4b022bec6c9a36748c82b3
Python
5,079
129
# -*- coding: utf-8 -*- # THIS FILE IS TEMPORARY. THIS FILE WILL BE DELETED AFTER THE PR IN DIPY from multiprocessing import Pool, cpu_count import warnings import numpy as np from scipy.ndimage import affine_transform def _affine_transform(kwargs): with warnings.catch_warnings(): warnings.filterwarning...
5c18fd71599ceef7a19c24e4d1ac8452ec2635d42df9d8e9da010a1edb21d373
Python
5,082
108
import numpy as np import pandas as pd from typing import Tuple, Union from . import ELA_Network_functions #----------------------------------------------------------------------------------- # ④calc TP for all combinations #----------------------------------------------------------------------------------- #-------...
db1bb05c3c7eea5f022119ca5ffc42783e778e8fbcef249f557159aeec35d6a1
Python
5,084
122
"""Electrode geometry for spike sorting: a ``probeinterface.Probe`` per MEA channel layout. Spike sorters need every channel's position in micrometres — to decide which channels a spike can appear on together, and to whiten over neighbours. The pipeline's own coordinates (:mod:`meanap.pipeline.channel_layout`) are a u...
00214ebea4b371c2278fc4d5414222bb92dfbd2119ffdfbc872428c52d6a7e2d
Python
5,085
124
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Script to compute the mean/median maximum fODF in the ventricles. The ventricules are estimated from an MD and FA threshold. This allows to clip the noise of fODF using an absolute thresold. -------------------------------------------------------------------------- R...
e114575cf46083d2906d65d4aa67cc85d1b33175d8a6d48561ef3c014d934e90
Python
5,085
183
# This file is part of connectome-manipulator. # # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2024 Blue Brain Project/EPFL """Main CLI entry point""" from pathlib import Path import logging import json import click from . import utils, log, profiler from .connectome_manipulation import connectome_manipulati...
9044b99b3e2bbc746f34de9f2843b26749a7e64723091a984607a657d347ba74
Python
5,086
143
"""This script trains a SR model for diffusion MRI (log-tensors) using also structural T1 and T2 as inputs. If you use this code, please the SynthSR paper in: https://github.com/BBillot/SynthSR/blob/master/bibtex.bib Copyright 2020 Benjamin Billot Licensed under the Apache License, Version 2.0 (the "License"); you ...
bc7901ce8c964b599bb5095617220854113ca1de34891bc39a4a1afd51d9dc2b
Python
5,086
117
import h5py import logging import numpy as np import os from PIL import Image from result_caching import store_dict from sklearn.decomposition import PCA from tqdm import tqdm from brainscore_vision.model_helpers.activations.core import flatten, change_dict from brainscore_vision.model_helpers.utils import fullname, s...
54a883ac5fcd899ccc727b80f60c9326ba7fed564c7b71632cbf7a780335090a
Python
5,087
136
""" Classes and functions for fitting ivim model """ import numpy as np from scipy.optimize import curve_fit from dipy.reconst.base import ReconstModel from dipy.reconst.multi_voxel import multi_voxel_fit from dipy.utils.optpkg import optional_package class IvimModelBiExp(ReconstModel): def __init__(se...
14ae550b5bc2ef4a00e46d2e061e9c1df45592ba473434a197b39defb656e76a
Python
5,089
102
#encoding=utf-8 import sys sys.path.append("../") import jieba def cuttest(test_sent): result = jieba.cut(test_sent) print(" / ".join(result)) if __name__ == "__main__": cuttest("这是一个伸手不见五指的黑夜。我叫孙悟空,我爱北京,我爱Python和C++。") cuttest("我不喜欢日本和服。") cuttest("雷猴回归人间。") cuttest("工信处女干事每月经过下属科室都要亲口交代24口...
62f98ebff3c4486ee2f1d12bca8d7dc9b83336b943e65f989440b180322d1291
Python
5,089
109
from nvidia.dali.pipeline import pipeline_def import nvidia.dali.types as types import nvidia.dali.fn as fn from nvidia.dali.plugin.pytorch import DALIClassificationIterator, LastBatchPolicy import os @pipeline_def def create_dali_pipeline(data_dir, crop, size, ...
9545b026d60fe1c910d4a25f5cbe8b26d5ca34ab58972e4e29c524e111e71693
Python
5,089
155
"""Completion-safe TIFF output helpers for stitched images.""" from __future__ import annotations import os from collections.abc import Iterator from contextlib import contextmanager from pathlib import Path from shutil import disk_usage from tempfile import NamedTemporaryFile, TemporaryDirectory from typing import A...
058ede200cf0f3a9a3c5bf112898bc5c8a5ef65c19e332d5e4dc1a6d7cfab4fe
Python
5,090
116
import numpy as np from scipy import stats from utils import Recorder_select, Q_nak from mitochondria_PDP1KD import Mito import matplotlib.pyplot as plt from figure_properties import * # Version will all the necessary parameters. dt = 0.1 seed = 11 np.random.seed(seed) def generate_spiketrain(rate, duration): # du...
68e9ee20226c18b02664478743a6368674a75c32a46fd9d090d6d5d32a9a6e84
Python
5,092
135
import time import argparse import torch import numpy as np import torch.nn.functional as F from torch.utils.data import DataLoader from torch.nn import ModuleList, Linear, BatchNorm1d, Identity from ogb.lsc import MAG240MDataset, MAG240MEvaluator from root import ROOT class MLP(torch.nn.Module): def __init__(s...
5c1ed83c9361bca649cbd8a07eec846536f76abed4f4ce1f2b466d415c6197bb
Python
5,093
131
import sys import os import numpy as np import pandas as pd import torch from model.QSAR import QSAR if __name__ == "__main__": # check GPU print('CUDA available:', torch.cuda.is_available()) # Should be True print('CUDA capability:', torch.cuda.get_arch_list()) print('GPU number:', torch.cuda.device...
7c973280e8a274c9624c2bc41fce690bbfa24367b145bda012928ec56fefe51b
Python
5,094
115
""" The following plugin functions by default expect the name and path of the preferences file to be the main lasagna preferences file. However, this can be over-ridden so that individual plugins can have their own preferences files and still use these functions. """ import os import yaml from lasagna.utils.path_uti...
12a5f0a297e5b54d161c38ac7ffe92425dc82858d10f0e2140228474ad494f68
Python
5,096
145
import re from pathlib import Path from typing import Optional import click import dolfin as df import numpy as np import pandas as pd import panta_rhei as pr import skimage import tqdm from panta_rhei import FenicsStorage, fenicsstorage2xdmf from simple_mri import load_mri from gmri2fem.utils import find_timestamps,...
1863e7e223b02957f21ae7ba0354e86f3cd6b5c8d2ee329fa318d9eb5b9feb1a
Python
5,097
104
# This is not applied in the NovaScope. import os import argparse import subprocess def create_layout(outprefix, lane, tile1, tile2, colshift, shifttype): layout = f"{outprefix}.{shifttype}shift.layout.tsv" if shifttype == "odd": with open(layout, 'w') as f: f.write(f"lane\ttile\trow\tcol\...
588741ffda1bdc8bd04949afc23761701f6cbe8ce989e7d186df4347c4da248f
Python
5,097
87
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file '/media/lg/disk2/PycharmProjects/ISAT_with_segment_anything/ISAT/ui/category_dock.ui' # # Created by: PyQt5 UI code generator 5.15.10 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this...
99f6a78c11fcba04ef284c0878f042231c75dcf8e47e678517b9930ec828d55d
Python
5,097
138
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved import json import os import torch from PIL import Image from sam3.model.box_ops import box_xyxy_to_xywh from sam3.train.masks_ops import rle_encode from .helpers.mask_overlap_removal import remove_overlapping_masks from .viz import visualize ...
a9a4c56ce8b4a9bc6f9d204f7c52251f045c8f8534ebf8affef1f886e8a5c30d
Python
5,097
118
"""Simulation failures must reach every caller without successful artifacts.""" import json from unittest.mock import Mock import numpy as np import pytest from ase.build import molecule from ase.calculators.calculator import Calculator from ase.calculators.emt import EMT from ase.io import write from chemgraph.sche...
ef2d586a7376ab2a97e802aff835184427769e50ebe793ffd06bb88c407b83ae
Python
5,097
148
import json import math import ijson from argparse import ArgumentParser import os import os.path as osp from datetime import datetime import numpy as np import pandas as pd from tqdm import tqdm parser = ArgumentParser() parser.add_argument('--dataset', type=str) args = parser.parse_args() dataset = args.dataset as...
0b5d86f36c506ce1a4685264f6acb3ced0d3f725cb6413e7b86fa0132b6e354f
Python
5,098
129
import numpy as np import sys import yaml import h5py import os from glob import glob import git varselection = ['M', 'B', 'LvR'] allvarnames = varselection + ['rate'] n_tints_min = 6 #minimum number of tints needed to calculate mean and std mininput_ifn = 4 #min_nspike_per_trial = mininput_ifn+2#n-spikes = n_interval...
e885873576717985a3e885698ff5ae224cf51e87e48c1c67d9e358f92bb26ba0
Python
5,098
146
"""Parity test: reading an Axion .raw directly vs. MATLAB's own AxisFile toolbox. Ground truth comes from Axion's bundled MATLAB reader driven exactly the way ``Functions/convertRawToMat/rawConvertFunc.m`` drives it:: AllData = AxisFile(raw).RawVoltageData.LoadData(well, [0 2]); dat = [AllData{wellRow,w...
2f1be0b15f9bf1f0679b75a064817ae36191965bac9dd675584661526dcec10f
Python
5,099
120
from qtpy.QtWidgets import QPushButton, QWidget, QVBoxLayout from napari import Viewer from napari.qt.threading import thread_worker from magicgui import magicgui from magicgui.widgets import FunctionGui import numpy as np import cv2 from aicsimageio.readers import CziReader from napari_dmc_brainmap.utils import get_a...
85587e9610fe9896e278f4ad727cdecbe4ca584d8785e6147753e76f75a1c364
Python
5,099
138
import ttach as tta import multiprocessing.pool as mpp import multiprocessing as mp import time from train_supervision import * import argparse from pathlib import Path import cv2 import numpy as np import torch from torch import nn from torch.utils.data import DataLoader from tqdm import tqdm def label2rgb(mask): ...
f6520fa12fb9f51bcb82d0acf8dc08eb41afa2b593de98bc1385d8a03e6f46a0
Python
5,099
129
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile import nibabel as nib import numpy as np import pytest from scilpy.io.dvc import pull_test_case_package from scilpy.gpuparallel.opencl_utils import have_opencl # If they already exist, this only takes 5 seconds (check md5sum) test_data_root = ...
0f53d04395f90347c8c3c6a5a128aa1f6a0cfa1b79b32223735997abab3ef835
Python
5,100
121
from .utils import * from .rclone import rclone_list_files def clean_local_files(subject = None, checksum = True, dry_run = False, keep_recent_weeks = 5, exceptions = ['Session Settings', 'Sessio...
5d713140b6be500f2636b236ce8dde8408798fd22bfe92ad108a65a9b5ad06d0
Python
5,100
133
# Generated by Django 4.2.16 on 2024-10-30 12:03 import django.contrib.auth.models import django.contrib.auth.validators import django.utils.timezone from django.conf import settings from django.db import migrations, models BUSINESS_GROUP_NAME = "business" USER_GROUP_NAME = "user" def delete_business_group(apps, sch...
3f0f0c2373c25e6bfe6284a38bf195ea558023cc94e46ca5f33a21dcb7c8334a
Python
5,102
106
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations import cv2 import numpy as np import torch from PIL import Image from ultralytics.data.augment import classify_transforms from ultralytics.engine.predictor import BasePredictor from ultralytics.engine.results impor...
15a9e9842e73e63ff8ce1f8fd17b76c169421cd6f6373aae031e671ffda3307c
Python
5,104
158
#!/usr/bin/env python3 # This script is included in documentation. Adapt line numbers if touched. import arbor as A from arbor import units as U import pandas # You may have to pip install these import seaborn # You may have to pip install these from math import sqrt def make_cable_cell(gid): # (1) Build a seg...
85821aac3ba3d80b97a5956a75e6da9a2bd2a3895fc77ba41039ea367b563598
Python
5,104
134
from inspect import CO_VARARGS import torch import torch.nn as nn from mmcv.cnn import ConvModule from torch.nn.functional import embedding from torch.nn.modules import conv from depth.models.builder import HEADS from .decode_head import DepthBaseDecodeHead import torch.nn.functional as F from depth.models.utils impor...
2cefd2bbe3e2b24a8744bcbabcfdac5507cd360389d0fc0f503cffe8d5ba63a3
Python
5,105
124
import argparse import utils import keras from keras.models import Model import tensorflow as tf from os.path import join import numpy as np import gc import yaml from model_zoo import MPRAnn_heteroscedastic ''' calculate standard deviation of ensemble predictions for train/test/val data for MPRAnn models trained wit...
1584851e12b778da421e1e7ab8f2d8369c9570ad9a9ec5b70eb8fbceb79af788
Python
5,106
173
""" Copyright 1999 Illinois 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 to use, copy, modify, merge, publis...
df18dd5980bf56076798ee4acf95663620e867bf7889a896814a1f3b8035a630
Python
5,108
115
""" Description: This script is run after `1_variant_effect_prediction.py`. It computes the variant effect sequence class scores based on Sei chromatin profile predictions, and by default, sorts the variants based on the maximum absolute scores across sequence classes, outputting the results as TSV ...
1f863ba34c435e87b8251d12ed07f03cbe2c7ca92a675deaf9ba6cd06b5404c2
Python
5,109
136
# python imports import os import glob import sys import random from argparse import ArgumentParser import matplotlib # third-party imports import tensorflow as tf import numpy as np from keras.backend.tensorflow_backend import set_session from keras.optimizers import Adam from keras.callbacks import ModelCheckpoint, ...
db96ee677c61569651f979be42543169d2c615c58629372a581a4df07da228f0
Python
5,109
141
''' NH3 ''' import numpy as np import sys def intro(): print(""" SHORT List of potential energy surfaces for NH3: P: potential energy, G: Gradient, D: Nonadiabatic coupling vector U: diabatic potential energy matrix UG: gradient of diabatic potential energy matrix This is listed at the end o...
c853e5f1866c8fd5c5dcbf2b6ec2123fd0554e76c4e872b057c0e77fdcd5625d
Python
5,111
144
import torch import numpy as np import pandas as pd from datetime import datetime as dt from dataset import fast_merge,df_to_mask from tqdm import tqdm dataset_names = [ 'botometer-feedback-2019', 'botwiki-2019', 'celebrity-2019', 'cresci-2015', 'cresci-2017', 'cresci-rtbust-2019', 'cresci-stock-2018', 'gilani-2017...
fb6f47e614c6f0060fb349396a296836ee97e2d50301f4783a2f2878d829068b
Python
5,111
178
# Kai Sandbrink # 2022-03-09 # Various utility functions import matplotlib.pyplot as plt import numpy as np import yaml, os from datetime import datetime # %% GENERAL FUNCTIONS def combine_tuples(tuples): ''' Arguments --------- tuples : list of tuples Returns ------- combined ...
07a39dde3365aeffa42dab9104357ddcfe91f2f1e8f51e7b7af160cf2324b79e
Python
5,112
126
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from ultralytics.utils import LOGGER, SETTINGS, TESTS_RUNNING, colorstr, torch_utils from ultralytics.utils.torch_utils import smart_inference_mode try: assert not TESTS_RUNNING # do not log pytest assert SETTINGS["tensorboard"] is True # v...