sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
dcff8ea5df5e417873f647325683f9d4215109b28d1ea3ca7eca7f49df2d0ed8
Python
6,738
184
"""Which version of which pipeline produced a result. Three pipelines ship from this repository and move at different speeds, so one number cannot describe them: MEA-NAP's electrophysiology path is mature and versioned back to 2023, CAT-NAP is a recent port, and MEA-Stim is mid-port. A result is only reproducible if i...
52b51a7690b918fb868c40515635ea25c7bc93a5dcfdb2cee4310dd6db4b9270
Python
6,739
160
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This script is used to alter a bundle while keeping it similar enough to the original version (keeping the dice coefficient above a given threshold). The script will subsample, trim, cut, replace or transform the streamlines until the minimum dice is reached. Various o...
896de5e614076f873e0554abfe9be6abd3af5f867580dce667e5c4d5c725453d
Python
6,739
171
# 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, ...
1a069712299a9a41266f1c489eec52096bab8565f691592363feffcca5b9871d
Python
6,742
178
from __future__ import print_function from keras import activations, initializers, constraints from keras import regularizers from keras.engine import Layer import keras.backend as K import keras class GraphLayer(keras.layers.Layer): def __init__(self, step_num=1, activation=...
6de084668ec7b2e5310fadaa7e00bf618aef5e6b571781783d2b9c0399059f67
Python
6,742
166
"""Custom state initializers with permanent properties between trials""" import numpy as np import collections from moog import sprite from . import poll_generator from moog.state_initialization import distributions as distribs class ParentStateInitializer(): def __init__(self, agent_0_factors, agent_1_factors, ...
70e3a80f7f3b7da9c924cb0f19cc8b09236cb7c9ad727281c57648e2400e5414
Python
6,742
158
import numpy as np import pandas as pd #----------------------------------------------------------------------------------- #----------------------------- # func: input:state -> output:List of adjacent states (AS) of the given state def return_AS_binary(state_str :str) -> list: #------------------------- # che...
030b4ed00a2e63be8fa943a4aaa1c023825450c1630b6fc08b33be4a41e8bf4d
Python
6,743
169
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT """Create a task whose jobs are defined by you, file by file, instead of by a frame count: one job per camera, per scene, per delivery batch. Two ways to group: --job FILE [FILE ...] one job per occurrence, in the given file order --files-per-...
9d5108698dfef74c584cb54c77769a136f127ae73a2e955cbce086b108f85844
Python
6,744
212
import os import tempfile import unittest import h5py import pandas as pd import numpy as np from pandas.testing import assert_series_equal from numpy.testing import assert_array_equal, assert_array_almost_equal from heig.herigc import CommonSNPs, OneSample class toy_GWAS: def __init__(self, snpinfo): s...
09a9e729e72d05f1f5187820855e04aee4a73f3022248341e9d49d2133a7435f
Python
6,745
170
"""Keeping an output folder honest about which recordings it analysed. The spreadsheet decides what a run covers, and it changes: a sixth recording arrives, or one turns out to be bad and is taken out. Continuing a run (``Params.continue_interrupted``) handles both for the *numbers* — a new recording is computed, a re...
c8813e450aaab3f9266dfdcea5ddde1bc14df8435a17e25bcc20884522956cee
Python
6,746
207
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import torch import biotite.structure import numpy as np import pandas as pd from biotite.structure.io import pdbx, pdb from biotite...
d300a1a4934e0e75716dddc18841874562f599a5f28f6f5ef266df3168bdb3c5
Python
6,747
104
import numpy as np import sys, os from scipy.stats import pearsonr, false_discovery_control import matplotlib.pyplot as plt import os import pandas as pd import sys from ism_performer import * import argparse from select_drivers_performer import * def get_enformer_eval(tissue,donor_fold,desired_seq_len,n_center_bins):...
c5b3c15bc071f83f2f8ec06ffd91f33a234209d04e828d28c4a045b3cf9a90e9
Python
6,748
157
import numpy as np import torch import random import pickle as pkl from functools import reduce class SimulationDataset(): """ NBodyDataset """ def __init__(self, partition='train', max_samples=1e8, data_dir='', n_complex=5, average_complex_size=3, system_types=5): self.parti...
77357dd51c7602365913b8e24b1a62d9ba150fc6391b0781987c55b148e37a59
Python
6,749
164
"""Structural/sanity tests for NMF dimensionality metrics (``nmf.py``). Run from the repo root:: uv run python python/test_pipeline_nmf.py ``cal_nmf`` is not just stochastic but *algorithm*-different from MATLAB's ``calNMF.m`` (sklearn's coordinate-descent NMF solver standing in for MATLAB's built-in ``nnmf``, w...
a491b0e99154010195942d02b72ff62909648c52d861d3e84bf04b543379d1a9
Python
6,749
190
from sklearn.metrics import ( roc_auc_score, root_mean_squared_error, accuracy_score, f1_score, recall_score, precision_score, mean_absolute_error, average_precision_score ) from scipy.stats import pearsonr, spearmanr import oddt.metrics as vsmetrics from sklearn.manifold import T...
e257b15ae463bb453682ffd252355ee7211713b2cf85cec9f8e9f1f8fd31daea
Python
6,750
160
import os, sys from pathlib import Path from tqdm import tqdm MODULE_DIR = str( Path( Path(__file__).parent.resolve() ) ) sys.path.append(MODULE_DIR) from pathlib import Path from argparse import ArgumentParser import torch from torch.utils.data import Dataset, DataLoader import esm from biopdb_utilities import read_...
dc6ca33d267a0580d32dace338754f3f81217d4440c012b0cdfbe834e176761a
Python
6,752
149
# -*- coding: utf-8 -*- """ Created on Sun Dec 15 21:14:11 2019 @author: Yoshi """ import numpy as np from PIL import Image,ImageDraw,ImageFont from cell_drawer import * from arrow_coordinate_calculator import * def cell_response_mapper(path,canvas,width,height,map_type,cell_locations,scale,radius,color_key,freq...
39f491ed20b262b711795ba7a5558fe9f96e2c7f5b79f764be549fd11c9e3665
Python
6,754
170
import torch from torch import nn from models.gcl import GCL, E_GCL, E_GCL_vel, GCL_rf_vel from models.layer import GMNLayer class GNN(nn.Module): def __init__(self, input_dim, hidden_nf, device='cpu', act_fn=nn.SiLU(), n_layers=4, attention=0, recurrent=False): super(GNN, self).__init__() self.hi...
6ea151400417c6789def88e6b0c33c48c113f9739675f697ed3e7fea9f4643c7
Python
6,754
160
#!/usr/bin/env python """ The z stage UI. Hazen Babcock 05/18 """ import os from PyQt5 import QtCore, QtGui, QtWidgets import storm_control.sc_library.parameters as params import storm_control.hal4000.halLib.halDialog as halDialog import storm_control.hal4000.halLib.halMessage as halMessage import storm_control.hal...
724950e0e37a90e84524738820a044193dc261a96bfbe48ea75f0e5a2ffeb426
Python
6,754
160
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Semantic segmentation on video frames """ import os import cv2 import numpy as np from tqdm import tqdm import torch from transformers import OneFormerProcessor, OneFormerForUniversalSegmentation from ..utils.io_helpers import check_outputfile, array2str_encoder, ...
0cb57806bb860e97f1f1f610dd200c80e83f2db4a33c81463be29677090dadc3
Python
6,756
196
"""Adaptive (locally-variable-bandwidth) kernel density estimate. Port of ``ssvkernel.m`` (Shimazaki & Shinomoto 2010, "Kernel Bandwidth Optimization in Spike Rate Estimation"). Used by the **population-level PSTH plots** only — the CSV metrics use gaussian smoothing (see ``psth.py``), so this is not on the headline p...
8856ad246043b00a5222b015911b9a11ce4b74f735aa9d991faa4cecefe5abd2
Python
6,757
203
import numpy as np import torch import pickle as pkl import os class MotionDataset(): """ Motion Dataset """ def __init__(self, partition, max_samples, delta_frame, data_dir): with open(os.path.join(data_dir, 'motion.pkl'), 'rb') as f: edges, X = pkl.load(f) V = [] ...
9ae3652e0c0c2ba920993068fe963cfc6179d5b18051fee957ef054141e0f462
Python
6,757
207
from pathlib import Path import numpy as np import nibabel as nib from dipy.io import read_bvals_bvecs from dipy.core.gradients import gradient_table from dipy.reconst.dti import TensorModel from dipy.reconst.fwdti import FreeWaterTensorModel from beltrami import BeltramiModel from matplotlib import pyplot as plt pri...
3e78a4c1596a033e51e1a5a7deabdf9f4a876135f78ed4371922083f72b0b0b2
Python
6,758
149
#%% configuration from config.config import settings import os import pandas as pd import pickle import xgboost as xgb from sklearn.ensemble import RandomForestClassifier from config.reproducibility import enforce_reproducibility from data import preprocessing from evaluation.performance import ( evaluate_model, ...
64411e1da3a2c3f1fcbb16a7c0155ce1ab45f150be19232d275aca2b5de74665
Python
6,758
147
from brainscore_vision.model_helpers.check_submission import check_models import functools from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images import torch import torch.nn as nn import torch.nn.functional a...
554917c55f0780feb6c5f258ec0ab788dbd884ccb29ec61e4b52ef49a86b3565
Python
6,759
173
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from __future__ import annotations import argparse import getpass from pathlib import Path from urllib.parse import urlsplit from cvat_sdk.core.auth import DEFAULT_SERVER, AuthStore, ProfileEntry from cvat_sdk.core.client import AccessTokenCredenti...
b87888842c567c9a53fa048ce33908b7cf960bb8a3fac68dc322ab6100813a42
Python
6,759
209
# -*- coding: utf-8 -*- """ Created on Wed Mar 25 19:31:32 2020 Functions for loading mpep data stored in .mat (matlab) files @author: Samuel Failor """ import scipy.io as sio import numpy as np from . import timelinepy as tl from . import cortex_lab_utils as clu import matplotlib.pyplot as plt # def protocol_path...
d0606dd235286703c2028ec4cd0b2dbb5449db1552fb383cf088735e337e6758
Python
6,759
193
"""Single-loop ownership for asynchronous local LangGraph checkpointers.""" from __future__ import annotations import asyncio import logging import os import threading import time from collections.abc import Callable from concurrent.futures import TimeoutError as FutureTimeoutError from pathlib import Path from typin...
3c14910a27ad0309ccae1af0a4dd0d46ee783289159c68b3ca8793ffd7f4569d
Python
6,760
188
""" 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...
c52745fd89a63c7360cd2400efb89387c6909a3d86f81af46fba8cad4cb5c09f
Python
6,761
134
import numpy as np from typing import Union, Tuple, Callable, Hashable, List, Dict from pathlib import Path from brainscore_vision.model_helpers.activations.temporal.inputs import Video, Stimulus from brainscore_vision.model_helpers.activations.temporal.utils import assembly_align_to_fps, stack_with_nan_padding from b...
9de78c8a2e347870940d4795fc1278ad2e68fe0a5c29d913189a050ad02cc7c4
Python
6,762
159
import torch import numpy as np import time from torch.cuda.amp import autocast from torch.optim.lr_scheduler import ReduceLROnPlateau from skimage.metrics import peak_signal_noise_ratio, structural_similarity import torch.nn.functional as F import torch.cuda.amp from torch.cuda.amp import autocast from tomocupy_stream...
7233a41640550ff20ddbdb6d0d44719cb26884f12d55abe4321157fc67c95f60
Python
6,763
166
from typing import Callable, List, Optional import torch from torch_geometric.data import HeteroData, InMemoryDataset class HM(InMemoryDataset): r"""The heterogeneous H&M dataset from the `Kaggle H&M Personalized Fashion Recommendations <https://www.kaggle.com/competitions/h-and-m-personalized-fashion-r...
f0d4794ebbefaa49247e1e3941e69b555752669ca77c88a398e6b71c596d8460
Python
6,764
175
from __future__ import print_function import argparse import os import os.path import shutil import sys def parse_args(): parser = argparse.ArgumentParser( description='Modify the files from an rMATS output directory to prepare' ' a new --od directory for running --task stat') parser.add_argu...
fa2102852286ca30d28de41e1e3be884bf174cc4ce843fb6d8906afd7375dbb3
Python
6,764
180
import torch from infopath.model_loader import load_model_and_optimizer from infopath.config import load_training_opt, save_opt import os import pandas as pd import shutil import numpy as np import matplotlib.pyplot as plt def generate_and_save_data( save_path="datasets/ModelData", log_path="log_dir/a2c6ad170...
ad7d3fed271c5125fec77020e6ecc3a880f1963e78a1dc067e3937508412d796
Python
6,765
131
import argparse import json import pkg_resources from .dataset_downloading import download from .dataset_downloading import continue_from from .dataset_downloading import continue_from_fastq from .export_data import export from .prerun_configs import set_environment from .dataset_downloading import download_qiita from ...
2ba63b04afb0d449431e45bdbd96a0395f8df488b5b900318e141bf80c27ca07
Python
6,766
168
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT """Bulk-create tasks inside a project, each task's data read from a registered cloud storage. Two ways to spell a task's data, repeatable and mixable: --task KEY[,KEY,...] explicit object keys, in order: * a single ...
47c2bc5c9d797235059f733c1b3053d4426bc82fc54c1c0dd32073fab02568cd
Python
6,767
210
import os import glob import itertools import matplotlib.pyplot as plt from scipy.stats import norm import numpy as np import pandas as pd import nibabel as nib from scipy.stats import norm from nilearn import image, plotting, glm, masking,datasets from nilearn.maskers import NiftiMasker from ants import apply_transfor...
e975b1db3f86a2b633cc97221ac1e26cebec3c0a7b407d5140d1d28a46a744e8
Python
6,770
150
import glob2 import os import pandas as pd import nibabel as nib import numpy as np from nilearn import image, plotting, masking, surface from matplotlib import colors def get_voxel_model_assignments(df, roi, threshold, linear_experiment_name, vae_experiment_name): max_lin_subset, max_vae_subset, lin_vae_subset =...
f3ba66c8e84b5de52b5c72067aef5f62527058c45a3bc27e99b6bcdc095c0203
Python
6,770
250
# -*- coding: utf-8 -*- """Make layer This script computes equidistant layers between a white and a pial surface. The following steps are done: (1) match vertex numbers of both surfaces (2) extract main component to remove unconnected parts (3) inflate white surface for visualization (4) compute meshli...
06a562dd9d8c316a38bc15b7ed3ac286e12029f83cca67c3f588bbd0e5ec5bd9
Python
6,772
199
# -*- coding: utf-8 -*- # python standard library inputs import os import sys import datetime import shutil as sh # external inputs import numpy as np import nibabel as nb from sh import gunzip # local inputs from ..io.get_filename import get_filename from ..io.surf import write_mgh from ..cmap.generate_coordinate_m...
ee933eefad3c6a6a58e0393beb805854340470933c20af494d3eef89f43a071d
Python
6,772
204
import h5py from glob import glob import sys import yaml import os import numpy as np import matplotlib.pyplot as plt import pandas as pd pathpath,myrun,roi_tag = sys.argv[1:] ''' pathpath = 'PATHS/filepaths_carlen.yml' myrun = 'runC00dMP3_brain' #pathpath = 'PATHS/filepaths_IBL.yml'# #myrun = 'runIBLPasdMP3_brain_p...
db7736918ae3c964b7b3f41f13008195ddbaa6825ece1a00090a19235fd6e07e
Python
6,773
158
# Copyright (c) 2022, Kwanhyung Lee, AITRICS. All rights reserved. # # Licensed under the MIT License; # you may not use this file except in compliance with the License. # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT ...
f2768b1fae3e5b66a0ddf48942768f6d59cc87b35a8c10609c2d179bdf565d84
Python
6,774
239
from __future__ import annotations import pytest from PySide6.QtCore import QPoint from PySide6.QtCore import Qt from pytestqt.qtbot import QtBot from labelme._app import MainWindow from ..conftest import close_or_pause @pytest.mark.gui def test_toggle_all_shapes( *, qtbot: QtBot, annotated_win: MainWi...
e1688126c055450294442190f8dd702f6b15d3eba8baab9ba28d1f61266922fb
Python
6,775
218
from typing import List from typing import Tuple import torch from torch import Tensor """ 2D and 3D implementations of vector to embedding. vector is predicted by a network and is an array of values ranging from -1 to 1. These values can be scaled by "scale" and are used to project pixels from their location, to a...
b3d7ddc69878955735ac0191d84bdf4977c7174174a29a59273dbaddb0ea2e57
Python
6,776
197
import math from collections.abc import Sequence from dataclasses import dataclass, field from typing import TYPE_CHECKING import torch from torch import nn from eir.models.fusion.fusion_default import al_features, default_fuse_features from eir.models.layers.mlp_layers import MLPResidualBlock from eir.models.models_...
9ce32a6575e7c89d2bb740f8bf5ebe9bf11fb0b9f479976c8d9442d9318f7ee1
Python
6,779
176
import h5py import os import matplotlib.pyplot as plt import numpy as np import sigpy as sp from skimage.metrics import structural_similarity as ssim from skimage.metrics import normalized_root_mse as nrmse from skimage.metrics import peak_signal_noise_ratio as psnr DIR = os.path.dirname(os.path.realpath(__file__)) ...
aa199801ff7a1af7d2a6daeaf5617e3a97a2202da27e7040e074990d65c2e898
Python
6,779
191
import sys import time import getopt import numpy as np import scipy.ndimage as nd from skimage import io as skio from skimage import exposure from slice_dataframe import slice_dataframe ############################################################################### # basic chip settings ##############################...
b550aa4fc8fedc6be13086c6c7d174d7f9b9ee691c7af35106822bab3bf07ad0
Python
6,779
205
# -*- coding: utf-8 -*- # python standard library inputs import os import datetime # external inputs import numpy as np import nibabel as nb import shutil as sh import matplotlib.pyplot as plt # local inputs from ..segmentation.orthographic_projection import orthographic_projection def get_retinotopy_images(input_...
1f6dbd4bd48c73bbd4570ced196458b56a315111d76ea00dc7b235a4a6fe5274
Python
6,781
121
import numpy as np import torch from threadpoolctl import threadpool_limits from nnunetv2.training.dataloading.base_data_loader import nnUNetDataLoaderBase from nnunetv2.training.dataloading.nnunet_dataset import nnUNetDataset class nnUNetDataLoader2D(nnUNetDataLoaderBase): def generate_train_batch(self): ...
135be40b19c27ccf26891c607507b26c1f97252f5589686f4df36436d6500940
Python
6,783
172
import os from torch.utils.data import Dataset import numpy as np from data import conform from monai.data import CacheDataset from monai import transforms import nibabel as nib def get_test_sample(): root_idr = '/groups/ag-reuter/projects/fastsurfer-tumor/fastsurfer-tumor-pipeline/tumor_validation_data/cleane...
5f48bb00220dbc99a05d7a03070b83d3a796049805195f798a1be3f29f22915b
Python
6,783
148
from brainscore_vision.model_helpers.check_submission import check_models import functools from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images import torch import torch.nn as nn import torch.nn.functional a...
ac5aad5a29393eb11de9b8af5b798af2466fc216c22780714868d95799ebe494
Python
6,783
208
""" Venous mask A binary mask of venous voxels is created from a set of time series. First, a baseline correction of each time series is applied if not done before (i.e., if no file with prefix b is found). Venous voxels are classified in the following way: Mean epi and mean tSNR acrss all time series are thresholded ...
95dd88a77558dde2fe603510e168e19d75e621182d2935819f96ab6b3c0e0351
Python
6,784
160
"""Intuitive plots for ep10 linear probe results.""" import json import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as mpatches from pathlib import Path RESULTS = Path("results/probe_full_ep10/loso_metrics.json") OUT = Path("results/probe_full_ep10") m = json.load(open(RESULTS)) kin = m["kin...
5dd2f782a370398aa77fb924b49c18ed04b76501356cb10aba1e0033b5bb41b9
Python
6,785
217
from typing import Annotated from typing_extensions import TypedDict from langgraph.graph import StateGraph, START, END from langgraph.graph.message import add_messages from langchain_core.messages import ToolMessage import json from langchain_openai import ChatOpenAI from langgraph.checkpoint.memory import MemorySave...
1ee911daa29b5cf730720f23ac987d02cac4fa834cbdf5191c9ae5bbe3e2d85c
Python
6,786
197
import cv2 from pydicom import dcmread import tensorflow.compat.v1 as tf import pandas as pd import numpy as np import random import math from functools import partial import sys import os ###################################################################################### ################ Functions f...
3c9a89c06521d851741ee0109633bd325ec12fd74604d8caaefede50ca6d5260
Python
6,786
231
import math import torch from torch import nn from torch.nn import Parameter, functional as F from torchvision.ops import StochasticDepth from eir.models.layers.norm_layers import LayerScale from eir.utils.logging import get_logger logger = get_logger(name=__name__) class LCL(nn.Module): __constants__ = ["bias...
cce883fda944eb76499a70325b0000b2edd316478a7b4fd21c9e42f3bdf30d94
Python
6,787
204
# Generated by Django 4.2.21 on 2025-09-08 16:13 import django.db.models.deletion from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("organizations", "0002_invitation_sent_date"), migrations.swappable_dependency(sett...
dc583e6444c23d6733affca4c75b8d7b82797e76196ba3f1cafe44b6ede675a7
Python
6,787
178
# src/train/train_classification.py """ 单折训练脚本 — ClassificationModel(新增 L2 正则 & OneCycleLR + ReduceLROnPlateau 调度) ---------------------------------------------------------- 功能: 1. 加载单折训练/验证索引。 2. 构建 Dataset 和 DataLoader。 3. 实例化 ClassificationModel + 损失 + 优化器 + 双调度器 + EarlyStopping。 4. 训练并在验证集上评估,记录主要指标到日志。 5. OneCycl...
d7cbad7784c879a75bce767ecfd12b1f10b037cea9739045fdfc020319885063
Python
6,788
205
# -*- coding: utf-8 -*- # # dist_train.py # # Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache...
66df581197617d0abc1110ccce8cb7692e66d48bf99e32c8194e60b63b7a8c91
Python
6,789
169
import torch import torch.nn as nn from torch.nn.parameter import Parameter import pdb class BiaffineAttention(nn.Module): """ Adopted from NeuroNLP2: https://github.com/XuezheMax/NeuroNLP2/blob/master/neuronlp2/nn/modules/attention.py Bi-Affine attention layer. """ def __init__(self, inp...
dcafd28c7fef095a298bc5d9cf8d7a11011ba4b00ef59d9cd7414da9d363b542
Python
6,791
181
# Copyright (c) Meta Platforms, Inc. and affiliates. # 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 torch from torch import nn from torch.nn import functional as F from typing import List, Tuple, Type from .common...
099eb734855f98febb04fb305fed5a91acab101d40599907072e2709fd49afaf
Python
6,795
166
# allowable multiple choice node and edge features allowable_features = { 'possible_atomic_num_list' : list(range(1, 119)) + ['misc'], 'possible_chirality_list' : [ 'CHI_UNSPECIFIED', 'CHI_TETRAHEDRAL_CW', 'CHI_TETRAHEDRAL_CCW', 'CHI_OTHER' ], 'possible_degree_list' : [0...
f714831f63acb7ad4fa9846d19029ad76196e58c970869d8ef9739fe1d2f32ae
Python
6,795
206
""" Scheduler Factory Hacked together by / Copyright 2021 Ross Wightman """ from typing import List, Optional, Union from torch.optim import Optimizer from .cosine_lr import CosineLRScheduler from .multistep_lr import MultiStepLRScheduler from .plateau_lr import PlateauLRScheduler from .poly_lr import PolyLRScheduler...
42a5f7010eea93b06468d2697ec6a8b6905b62b39ed54f6472359d86af69b8d1
Python
6,797
168
#!/usr/bin/env python import argparse import logging import os import requests import sys import pandas as pd import json # Logs stuf logging.basicConfig(level=logging.ERROR) logger = logging.getLogger(__name__) # String API url string_api_url = "https://string-db.org/api" """ def getStringIDsFromProtIDs(proteins,...
4fb833794ba3d351c3e9439e10ab08613d34855ab8ca81ebff082d47b150e420
Python
6,800
172
from __future__ import print_function import os import re import gzip import itertools import argparse import time import logging __author__ = 'Martin Aryee' logger = logging.getLogger('root') #args = {'out_dir':'/PHShome/ma695/tmp', 'min_reads':10} #base = '/data/joung/sequencing_bcl/131007_M01326_0075_000000000-A6...
f7903fbc07905e4fc17bef3f7153c801484429abe6f7b1732c2265a178c16d56
Python
6,800
166
import numpy as np from scipy.spatial.transform import Rotation as R from ..neurosim.cells.neuron_cell import NeuronCell from neuron import h class TestNeuronCell: def test_load(self, neuron_cell: NeuronCell): assert len(neuron_cell.all) == 73 assert len(list(h.allsec())) == len(neuron_cell.all)...
afebdbae05a548170741ef0af4109513db7438046fff46286ee410a1a4464b2e
Python
6,803
193
import numpy as np def categorize_trials(behavioral_df, factor, agent_idx=0): """ Categorize trials based on the specified factor. Parameters: behavioral_df (pd.DataFrame): Behavioral data for categorizing trials. factor (str): The factor by which to categorize trials ('reward', 'nback', 'switch'...
da43b317bc5e0fb0109b5382d66cb3e21b90811dd8316ea32223c7a70402a0e3
Python
6,804
204
import h5py import sys import numpy as np import yaml import os from scipy.stats import kurtosis from sklearn.decomposition import FastICA from scipy.signal import medfilt import matplotlib.pyplot as plt pathpath,recfilename = sys.argv[1:] with open(pathpath, 'r') as myfile: pathdict = yaml.safe_load(myfile) sys.pa...
ea6cbc1555c12f3f67b3aa5176a9721ee3f8979641ea4223621d8a45f1b31ab8
Python
6,804
198
from torchvision import transforms import random import os import numpy as np import torch import Utils.config_stomach as CONFIG import itertools from matplotlib import pyplot as plt import scipy from sklearn.metrics import roc_curve, roc_auc_score import math def seed_torch(seed=0): random.seed(seed) os.envi...
9f37cc4f0fe6a72f6f97ba18d64f9d96d692c434e5da9696ffc86984610dd47f
Python
6,805
134
import numpy as np def print_steady_state_format (sv): for i in range(len(sv)): #print("sv[%d] = %e;" % (i,sv[i])) #print("extra_data[%d+offset] = %e;" % (i,sv[i])) print("*((real * )((char *) sv + pitch * %d) + threadID) = %e;" % (i,sv[i])) def get_correct_indexes (sv): nlin = np.shap...
1a156b59fdf307b6ccf8d02e9d96329af2a29dab0d9132b58748c5b6f9ac1cf7
Python
6,806
211
# Copyright 2017 Calico 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, sof...
d89efa62044ab21ec863ab21aa95fbabfeaec81bec26aede3d6e721a74a31d6c
Python
6,806
148
import h5py import os import numpy as np import pandas as pd from sklearn.preprocessing import LabelEncoder import sys sys.path.append('/project/roysam/rwmills/repos/cluster-contrast-reid/clustercontrast/') print(os.getcwd() ) from QC_functions import * #-----------------------------------------------------------...
32e0e934278345a37b3a49ecbe8790812ffcbddd2712a2106312558608098c32
Python
6,807
189
import brainpy as bp import brainpy.math as bm import matplotlib.pyplot as plt import numpy as np from scipy import stats import levy import math bm.set_platform('cpu') class CANN2D(bp.dyn.NeuGroup): def __init__(self, length, tau=1, tau_v=144, m_0=1., k=8.1, a=0.2, A=10., J0=4., sigma_u=0., sigma_m=0., ...
27f0a951650a7d3b1c4bda1768d80dab0b3a1fbd7edb3fe8cb29159a7b6c82c8
Python
6,811
201
import asyncio import pandas as pd from nicegui import ui from nicegui.testing.user_simulation import user_simulation from metaprivBIDS.corelogic import revert_column from metaprivBIDS.browser_app import ( WorkspaceState, _disclosure_score_outlier_figure, _eligible_quasi_identifiers, _rig_outlier_figu...
8e9c5ba1fbe115cf6df7f780cd0039223df6a56a9d78c5f6b84a3914d68f93fb
Python
6,811
164
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This script will output informations about lesion load in bundle(s). The input lesion file is a labeled volume (.nii.gz) where each lesion is represented by a unique label. To label a lesion file use scil_labels_from_mask. Then, the second input can either be streamlin...
e14e2edb8623280a78d027ceec2510200822ce123769ed7e91bdfcb7bb786811
Python
6,811
201
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from __future__ import annotations import glob import os import shutil from abc import ABCMeta, abstractmethod from collections.abc import Iterator from datetime import timedelta from pathlib import Path from typing import ClassVar from django.conf...
5cad23b026c10c928ea46a5898577960ee7af7674ea6efd46b60c518ed0f6fdc
Python
6,812
208
import os from types import SimpleNamespace os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") import pytest from PySide6.QtCore import Qt from PySide6.QtGui import QColor from PySide6.QtWidgets import QApplication from musclex.ui.widgets.image_alignment_table import ( ColKey, ImageAlignmentTable, axi...
347be1b17c8206d259f1d6926638739882a96e043b502e817e296415ad735de9
Python
6,814
178
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from __future__ import annotations from collections.abc import Hashable, Sequence from functools import cached_property from typing import Any import datumaro as dm from django.db import transaction from cvat.apps.dataset_manager import data_model...
82ef11340d77b1dcc14578ffe3d6f6216bd86d390a1e7e531b0ee2cc3cce95f4
Python
6,818
182
""" Class for estimating the respiratory waveform from the phase channel of an EPI timeseries - Developed specifically for the Dense Amygdala project, but more widely useful for complex-valued fMRI - Required temporally unwrapped complex phase difference BOLD timeseries with critical or better temporal sampling of resp...
e73cc845c8730ee78675197cdb99643d0fc0069f4db21c3f785e611069dc79d2
Python
6,818
165
""" Module to define multi-view nodes. A multi-view node is simply a node that is defined for several views. For example, the weights W or the data Y, but not the latent variables Z. Types of multi-view nodes: - Multiview_Variational_Node: variational nodes present in all views - Multiview_Constant_Node: multiview nod...
50a39b9504164a8dbdecb715c01ee54dca4a592e772bda09686a6825606a1ec3
Python
6,820
239
# # Copyright © 2009- The Spyder Development Team # Licensed under the terms of the MIT License """ Compatibility functions """ import enum import sys from . import ( PYQT5, PYQT6, PYSIDE2, PYSIDE6, QtBindingsNotFoundError, ) from .QtWidgets import QFileDialog TEXT_TYPES = (str,) def is_text_s...
f4c427785914ab645da1e3d190a6c4fd9330e129c8914b3455ab50db8153ea2c
Python
6,820
241
#!/usr/bin/env python3 import arbor as A from arbor import units as U import argparse import numpy as np import pandas as pd import seaborn as sns # You may have to pip install these. class Cable(A.recipe): def __init__( self, probes, Vm, length, radius, cm, ...
2b584ac057167b49eb6337f4ed1be4ace4ff876dd7ea9da0e6c9dbd253418f23
Python
6,823
165
from typing import Type import numpy as np from neuron_interface.neurosim.cells import NeuronCell from neuron import h def collect_lines(neuron_cell: Type[NeuronCell], coordinates): assert neuron_cell.loaded, "Cell must be loaded" lines_collected = [] idx = 0 for nrn_section in neuron_cell.all: ...
98f9cd6cdb6889e4cb3f4fe32f37064e3fb16890942cd64d745f53152040eb9c
Python
6,823
176
""" Quadrilinear and Hexalinear function for sequence labeling Author: Xinyu Wang """ import torch import torch.autograd as autograd import torch.nn as nn import torch.optim as optim import torch.sparse as sparse import math import flair.nn import pdb class QuadriLinearScore(nn.Module): """ Outer product vers...
6e67b7abc6140ba8ecb700c1a6c79a492396f775e24892a7967a245c8c61facd
Python
6,825
145
"""对scdata和stdata数据进行过滤""" import os import numpy as np import pandas as pd import scanpy as sc from matplotlib import pyplot as plt import spotd.simulation_st as simulation_st import anndata from scipy.sparse import issparse,csr_matrix from sklearn.preprocessing import normalize from rpy2.robjects.pack...
2a3d6a5518e6fc8bf61f1de1bcd2d176be9a816a26d1c5699ee0dfe8ad2e387e
Python
6,826
182
import json import typing import asyncio import logging import traceback import threading import grpc from . import thalamus_pb2 from . import thalamus_pb2_grpc from . import grpc_tls from .iterable_queue import IterableQueue from .config import ObservableCollection, ObservableDict, ObservableList import jsonpath_ng ...
03c91e649087a2118d17e90d20b5cf6ae62a5f8694e470d977917d03866c081e
Python
6,829
156
import sys from pathlib import Path p_dir = str(Path(__file__).absolute().parents[1]) if p_dir not in sys.path: sys.path.insert(0, p_dir) import random import time import os import torch from torch.nn import functional as F import numpy as np import pandas as pd import nibabel as nib from tqdm import tqdm from scipy ...
c89f437a364ede70c831f3d6e39260591421a35bcfc51dab605a820885662bc3
Python
6,829
180
# vessap open graph benchmark dataset import os import os.path as osp import sys from numpy.random import seed from pathlib import Path sys.path.append(str(Path(os.path.abspath(__file__)).parents[2])) import torch import numpy as np import pandas as pd import scipy import argparse import networkx as nx import torch_...
111d314394ca63dee4b538370c6b33edcc2faccc9dc889061b5788009f0ead88
Python
6,830
211
#!/usr/bin/env python3 # This script is included in documentation. Adapt line numbers if touched. # # Authors: Sebastian Schmitt # Fabian Bösch # # Single-cell simulation: Calcium-based synapse which models synaptic efficacy as proposed by # Graupner and Brunel, PNAS 109 (10): 3991-3996 (2012); https://doi.org...
4918b10216e8adcb74e557184c60971a627da5ab233b1cab5195ff8568434716
Python
6,831
209
import os import h5py from pathlib import Path import yaml import pickle import concurrent.futures from tqdm import tqdm import json import pandas as pd import numpy as np from typing import Dict, List, Tuple, Optional import torch from bce.utils.constants import * # load combined epitopes csv def load_epitopes_c...
adb9a482b84d065f5c29f1452a052b2de6bfc6b6ddfbb963c7d6a77bb5ce994c
Python
6,831
222
import sys import math import numpy as np from scipy.optimize import leastsq def groGxyz(line): _x=float(rl[20:28])*10 _y=float(rl[28:36])*10 _z=float(rl[36:44])*10 _xyz=[_x,_y,_z] return _xyz def pdbGxyz(line): _x=float(rl[30:38]) _y=float(rl[38:46]) _z=float(rl[46:54]) _xyz=[_x,_y...
17473748d1c88d96fddefeac790eb48493bc09316f1d8966bd0a3cfbee911812
Python
6,832
174
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack.package import * class Arbor(CMakePackage, CudaPackage): """Arbor is a high-performance library for compu...
7424bedd474088742c668d756b1fbbc20f44a00d9a5c81c77c53cc5e0a12d917
Python
6,833
175
import shutil from pathlib import Path import h5py import pandas as pd from tqdm import tqdm import seisbench from .base import WaveformBenchmarkDataset, WaveformDataWriter try: from huggingface_hub import hf_hub_download except ModuleNotFoundError: hf_hub_download = None class CEED(WaveformBenchmarkDatas...
737a4fe59f5b5f92d7ae9947925728f59b3b7d56114e0e6180b6b817a9bd8fa9
Python
6,834
192
from depth.models import depther import torch import torch.nn as nn import torch.nn.functional as F from depth.core import add_prefix from depth.ops import resize from depth.models import builder from depth.models.builder import DEPTHER from .base import BaseDepther # for model size import numpy as np @DEPTHER.regis...
01a9e387ce22082d8bd7eff6d28d7d084990b4d798bf0e252f723f11936c5f08
Python
6,836
171
# 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, ...
78a1454b76b3a12b7e43c264b0085a11b5e616ae92e4fb38d5a1b40f9926531a
Python
6,842
153
"""The noise statistics detection shares between its methods. Every method run on one channel needs the same two numbers — the robust sigma and the median of the filtered trace — and each is a full partition of a multi-million-sample array. They are now measured once per channel and handed to each method, which is mos...
a7a6a69114883e22bfcf9f65286224c455c7abf65ac34de5c4097e687b2bd5b3
Python
6,847
207
""" Functions to read and write points files TODO: The read functions have different outputs. We should decide on one """ import os import yaml import xml.etree.ElementTree as ET def read_pts_file(file_name): """ Read an elastix pts file :param str file_name: :return list pts_coord: list of list with pt...
c0871d482be76583acfa9a950f020711750c0222fc09e05ed2224e0f03468c3b
Python
6,847
213
import numpy as np from sklearn.preprocessing import MinMaxScaler, StandardScaler #from numba import jit def flip_genos(genodata): ''' Flip genotype labels between representation of REF allele count and ALT allele count. :param genodata: genotypes represented as 0,1,2, missing values encoded as 9 :type genodata...
f666e4cad0b9663af49155339a4c04fc12386a5aaf8003fc1f1f0f327fb18d21
Python
6,848
149
##### PAPALE2025 LOCAL STIMULI PACKAGING ##### # In order to run the Papale2025 benchmark locally, you need to obtain the stimuli yourself due to licensing rules. # Only the neural data can be downloaded from the public S3 bucket. # This file packages the stimuli into Brain-Score format and saves them at the BrainIO ca...
0d62ee160cc1f863d6cf4e99259eb75004628e8eebecdad36a822a1225cfeb5c
Python
6,849
165
""" Methods for outlier removal. Reproduced with permission from Oscar Jalngefjord: https://github.com/oscarjalnefjord/ivim/tree/outlier by Elina Petersson """ import numpy as np import nibabel as nib import numpy.typing as npt import matplotlib.pyplot as plt from scipy.optimize import minimize from scipy.stats import...
8ad9f191c49a751e6c90c54b98abf20bf62d0239b8321e4636af4c91b5e21918
Python
6,849
217
"""File-system helpers for the ChemGraph Streamlit UI. Functions for finding XYZ files and extracting directory paths from agent messages. Helpers that searched the current working directory or the global ``CHEMGRAPH_LOG_DIR`` were removed on purpose: they picked up stale artifacts from earlier sessions. Per-exchang...