sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
3ae4d4027c70b7781eed00bf91edf7e28875f305d74a155f561f52feba46037a
Python
7,316
157
import numpy as np import pandas as pd from anndata import AnnData import pkgutil import io from typing import Optional, Union, List, Iterable def ligand_receptor_database( database: str = "CellChat", species: str = "mouse", signaling_types: Union[str,Iterable[str]] = ["Secreted Signaling", "Cell-Cell Cont...
4a5eb2d47f10e2762c29eed6212c190a54709edc3ce01c1f136bce6d901473a6
Python
7,316
181
# -*- coding: utf-8 -*- # 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 Any, Di...
155b1a69ba51cd6ae3b987e6b50d64688d17ca32ccf3015d5d279df3b01742c2
Python
7,317
150
import matplotlib.pyplot as plt import numpy as np import json def display_average_scores_among_search(json_file, saving_title='average_scores_among_search.png'): search_idx = [] after_mean_dice = [] after_mean_instance_dice = [] before_mean_dice = -1 before_mean_instance_dice = -1 with open(js...
9e62cd782005a13f28389ca992d4e53ab6fcf24269d65aac31f8b7721f8f6dcb
Python
7,317
234
# score_bcf.py import os import logging import numpy as np import pandas as pd import pysam from collections import deque from joblib import Parallel, delayed from .utilities import ( configure_logging, check_bed_type, get_samples, determine_bcf_type, normalize_bed_contigs, ) from .bcf_parallel impo...
e4c954fcbf22c63817fd54914d6089a40b5e9dfc7eb44bbc3159b09d3923dbe0
Python
7,318
166
import warnings warnings.filterwarnings("ignore", message="It is not recommended to directly access") import math import torch import torch.nn as nn import torch.nn.functional as F def index_select_ND(source: torch.Tensor, index: torch.Tensor) -> torch.Tensor: """ Selects the message features from source corre...
a1953fe3c50265b75bd3787d6c984bbbd7fb95626353e146c26f2ded2895bfe4
Python
7,319
182
"""A short timing run, so a batch can be split by how fast each machine is. Two computers rarely run at the same speed, and the split has to reflect that or the faster one sits idle at the end. Core counts are a poor guide — a laptop's eight cores and a workstation's eight cores are not the same eight cores — so this ...
56e0e78d82f257fb892d713d8fc3e8faf900ab447b20b0fdc53103180fdd19a7
Python
7,320
153
#!/usr/bin/env python3 """Generate a synthetic fixture with UL-DD's file layout. THIS IS A TEST FIXTURE, NOT DATA. Anything computed from it is a check that the code runs, never a scientific result. It exists so the pipeline can be exercised end to end -- including the degraded-signal paths -- before the real restrict...
452483b27ff2e3da69cf22ea06228069a110d6d56b9bdd947e2e0158abb8246d
Python
7,321
259
import os import pickle from dataclasses import dataclass import numpy as np import pandas as pd def save_fit( G1_file, fit_, fit_str, lags, meta, min_g1, min_lag_points, out_hdf5_path, times, tofs, ): import h5py with h5py.File(out_hdf5_path, "w") as h5: fits...
cedfbd84f39048060b3f4d75c53573c55a3c4bd52a5b2dad4085a8acd82f16b0
Python
7,322
172
import shutil import subprocess import nibabel as nib import numpy as np import pytest import importlib_resources from comet import cifti, utils # Parameter space ATLASES = ["schaefer", "yan", "glasser", "gordon"] RESOLUTIONS = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000] NETWORKS = [7, 17] SUBCORTICALS = [None...
0b13c6124089921d5d2b8ed7f2282da65d9ca46e69be5734bbc9a0bfb75334bc
Python
7,325
164
from brainscore_core.supported_data_standards.brainio.packaging import package_data_assembly from pathlib import Path from shutil import copy from brainscore_core.supported_data_standards.brainio.stimuli import StimulusSet from brainscore_core.supported_data_standards.brainio.packaging import package_stimulus_set from ...
00735891cfa24cd2ccfa913b50e2e2b108d4ec2c1ca0566e47ff320d4baaa414
Python
7,326
159
''' NO2 ''' import numpy as np import sys def intro(): print(""" SHORT List of potential energy surfaces for NO2: P: potential energy, G: Gradient, D: Nonadiabatic coupling vector This is listed at the end of description to show the availability. For example: P/G means both potential energy and g...
3a8599adddf74c7869dc6217d925e6ecac6b7a8fd8f444712ef9dd7e390f9f72
Python
7,330
194
import random from collections.abc import Sequence from dataclasses import dataclass from pathlib import Path from typing import TYPE_CHECKING import pandas as pd from tests.setup_tests.setup_modelling_test_data.setup_targets_test_data import ( get_current_test_label_values, get_test_label_file_fieldnames, ...
dce9b838bf1bac9d0069356a469fd78ce3715d7d944a934a7c26b5b1f98af38e
Python
7,330
202
from deepcardio.neuralop_core.transforms import DataProcessor from torch_geometric.data import Data import torch from torch_cluster import radius from torch_scatter import scatter import os from deepcardio.neuralop_core.transforms import UnitGaussianNormalizer DataScaler = UnitGaussianNormalizer GINO_NEIGHBOR_RADIUS ...
671a8f76902da7b8c6f4bb2c4fcef6ce6b9dd96cab0f2f8a1b8e2c95a0177098
Python
7,331
191
import matplotlib.pyplot as plt import numpy as np from scipy.ndimage import gaussian_filter, gaussian_filter1d from scipy.stats import poisson def plot_poisson_distribution(n: int = 50, lam_range: tuple[int, int] = (5, 50), n_lines: int = 4): x = np.ara...
af3a73db00cbadd33bf0fcf84615044d604b19e064d3f004fe1189f99ebc211e
Python
7,331
200
import math import os import torch import torch.nn as nn import torch.utils.model_zoo as model_zoo bn_mom = 0.0003 class SeparableConv2d(nn.Module): def __init__(self,in_channels,out_channels,kernel_size=1,stride=1,padding=0,dilation=1,bias=False,activate_first=True,inplace=True): super(SeparableConv2d,se...
e63b22747480cb186a52f4ea158822dd5bcc46042f36cf9c9d5011f330d5bedf
Python
7,332
167
import pandas as pd import os import numpy as np import matplotlib.pylab as plt import sys def plot_seq(fg, df, agent=0, n_steps=1, block=0): fg.clf() seqdf = df.query('agent == {} & n_steps == {} & block == {}'.format(agent, n_steps, block)) cmap_tab = plt.get_cmap('tab10') ax = fg.add_subplot(1, 1, 1...
8f0a9bbb9b54c28e919413a7b53db12aa8b01f0cd07e15b35d00806df1f3c806
Python
7,334
206
import numpy as np from scale.utils import ( select_best_lambdas, spatial_sample_split, preprocess, check_for_raw_counts, ) from scale.training import train from scale.clustering import calc_clusterings from scale.search import calc_stability, calc_entropy from scale.config import Config import scanpy ...
4065502040694b47eb24787e57b6cfaf6c1db7d1eeccadcc48f315d7d4ca4dfa
Python
7,335
191
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Evaluate pair-wise similarity measures of masks and atlas. All volumes must be co-registered in the same space. Support multiple input volume. The following command will compare all combinations of the input volumes (1-2, 1-3, 2-3): scil_volume_pairwise_comparison m...
f585bc351f0da9084b1aa765862e82c056aa3e8b4626538e54a578a3cce8bb58
Python
7,335
211
from __future__ import annotations from typing import TYPE_CHECKING import napari import napari.layers import numpy as np from napari.qt.threading import FunctionWorker from PyQt5.QtWidgets import QApplication from brainways.pipeline.brainways_params import BrainwaysParams from brainways.ui.controllers.base import C...
d79618f18abba187df71bc93d1642384b47db6c2895e0b1c976a8219cf762370
Python
7,337
232
from torchvision import transforms import torch.utils.data as data import numpy as np import random import torch, torchvision from torchvision import datasets, transforms from torch import nn, optim from torch.nn import functional as F from PIL import Image, ImageFilter import os import scipy.io as sio class EyeData(da...
08ac50f921c4753c8b70a96d85f98fdbbe44cd7260bbfb526fd4bed27da62117
Python
7,340
255
"""Support backcompatibility for configs at v0.1.1.""" from copy import deepcopy from typing import Dict from deepreg.constant import KNOWN_DATA_SPLITS def parse_v011(old_config: Dict) -> Dict: """ Transform configuration from V0.1.1 format to the latest format. V0.1.1 to latest. :param old_config...
7e661122c3da069c3806e62b7492c8f6a779cf2579e69fa6dfeb9c083ba3276d
Python
7,341
176
# 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 Any, Dict, List, Tuple, Union ...
cae86ad40a3c78e09bc328804f5e4eb5269fdba9105c708e34a9423492105bfe
Python
7,341
204
import os import glob import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import scipy.stats as sist import ast from statsmodels.stats.multitest import fdrcorrection def fix_string_format(string): # Split the string by spaces values = string.split() # Join the valu...
6cb67111772999dea1dffebd8d577fb176d7350b9c7537f431cb6e3cec1e64fb
Python
7,342
187
# -*- coding: utf-8 -*- import os import re import sys def find_reference_pcr_file(pcr_file_path): current_dir = os.path.dirname(pcr_file_path) for i in range(5): # Try up to 5 levels up ref_path = os.path.join(current_dir, 'dat_vestacif_files', 'reference_pcr_format', 'tbbaco.pcr') if ...
7b35a7f9211fc31d5ee1f42d037ca920c887d89a39597682faf453d63384f7c5
Python
7,342
229
#!/usr/bin/env python import argparse import collections import datetime import json import math import sys import uuid from pathlib import Path from typing import Any from typing import Final import imgviz import numpy as np try: import pycocotools.mask # type: ignore except ImportError: print("Please inst...
663cb0fc50b4f0d8b803054cb6115f902795c836698a8f65c82f8a635061ed58
Python
7,344
190
###################################################################### # Copyright (C) 2020-2026 MEmilio # # Authors: # # Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de> # # 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...
2457c5a3d1b257c3683c83cd6d409a18bd20d4e794f19d4e6952c40e35fcbb72
Python
7,345
222
import sys import yaml import os import numpy as np import h5py import matplotlib.pyplot as plt import matplotlib as mpl pathpath,myrun,ncluststr,cmethod = sys.argv[1:] #pathpath = 'PATHS/filepaths_carlen.yml' #myrun = 'runCrespZP_brain' #ncluststr = '8' #cmethod = 'ward' ncl = int(ncluststr) with open(pathpath) as ...
a1f2550564834de7eaa7bb6dc4bcdd06503be35ab2243628256a51412d2ea581
Python
7,345
201
from zigzag.classes.hardware.architecture.memory_instance import MemoryInstance from zigzag.classes.hardware.architecture.operational_array import OperationalArray from zigzag.classes.hardware.architecture.memory_hierarchy import MemoryHierarchy import networkx as nx class Core: """ The Core class houses the ...
a452efb07f4e4bcbbcf514fa24f181f279ada3d9cb952ca1d5fba191e3713e05
Python
7,345
203
import argparse import torch import torch.nn.functional as F from torch.utils.data import DataLoader from ogb.linkproppred import PygLinkPropPredDataset, Evaluator from logger import Logger class LinkPredictor(torch.nn.Module): def __init__(self, in_channels, hidden_channels, out_channels, num_layers, ...
a33f9ce3486f7738a2e3f7211103c7cd0a3f7458c7afd1cbb898432eca912155
Python
7,346
208
import inspect import logging import warnings from typing import Any, Dict, Optional, Union import torch from torch import Tensor from torch_geometric.explain import Explanation, HeteroExplanation from torch_geometric.explain.algorithm import ExplainerAlgorithm from torch_geometric.explain.algorithm.captum import ( ...
0d1347bfe166bbd298778bf59e9c8288dc11cf4968d2c061883d8612abaeb6da
Python
7,347
231
import re from pathlib import Path from typing import Optional import click import numpy as np import pandas as pd import simple_mri as sm import tqdm import gmri2fem.segment_tools as segtools from gmri2fem.segment_tools import find_label_description, read_lut from gmri2fem.segmentation_groups import default_segmenta...
ee95e45b9d6c14ad952cfbcc14bea5665f7547872b0773ac6ab9adaa8a96d922
Python
7,347
142
#! /usr/bin/env python """Step three of the pipeline Take a series of triange graphs in gt format from pycurv and measure distances within and between surfaces as well as orientations relative to the growth plane and to each other. Two usage options: 1. Measure distances and orientations on a single **tomogram** wort...
f2df3915715ed199bf1ab36af2d02095e776e76983d3cf8b2219c98ddefe2423
Python
7,347
175
from torch_geometric.data import InMemoryDataset import pandas as pd import shutil, os import os.path as osp import torch import numpy as np from ogb.utils.url import decide_download, download_url, extract_zip from ogb.io.read_graph_pyg import read_graph_pyg, read_heterograph_pyg from ogb.utils.torch_util import replac...
59ba2022958b9f847ce5a3f2d6e11bf54076809709853efc61ccb12abdb8de6a
Python
7,348
200
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from __future__ import annotations import numpy as np from PIL import Image from rest_framework import status from rest_framework.exceptions import ValidationError class ROIHelper: """ Utilities for running automatic annotations functions ...
947570831ab8732ba6d6901a92b7a7e5baf880de38066a2cc7419ce336cd4f39
Python
7,349
199
"""Pooling every machine's part into one output folder. Each machine's part is an ordinary output folder for its share of the batch. Bringing them together is a file-level union of the things that belong to *one recording* — its spike times, adjacency, checks, and figures — plus a key-level union of step 4's ``netmet_...
bc59758e9cd928c2f0fe7fb54ee2500e5b8cf94a07184009d25c0154f0ecb892
Python
7,350
228
from typing import cast, Sequence import numpy as np import scipy from matplotlib import pyplot as plt from matplotlib.axes import Axes from scipy.stats import sem from neuralib.plot.colormap import insert_colorbar from neuralib.typing import AxesArray from rscvp.util.typing import SIGNAL_TYPE __all__ = [ 'plot_...
3835dd687c3cd06ae94d060910138b503defcd6181dde1b1326318a746cc2baf
Python
7,352
210
import os.path as op import dipy.data.fetcher as fetcher import nibabel as nib import numpy as np import numpy.testing as npt from dipy.io.stateful_tractogram import Space, StatefulTractogram import AFQ.data.fetch as afd import AFQ.recognition.cleaning as abc import AFQ.recognition.curvature as abv import AFQ.recogni...
5221a8688fde717c7d158a56204e9ee40e1fa4cf0b270273c93fc61188dc48ad
Python
7,353
187
import os import os.path as osp import pandas from tqdm import tqdm import ijson import json from datetime import datetime import numpy as np from gensim.models import word2vec from nltk import tokenize dataset = 'Twibot-22' if not osp.exists('tmp/{}'.format(dataset)): os.makedirs('tmp/{}'.format(dataset)) proper...
69c877d1f888be1f14314cfdb73fb220499cbb128650b866f6d093da40683328
Python
7,354
230
""" Train and evaluate multiple DLIM (Deep Latent Interaction Model) instances in parallel with and without spectral regularization. This script: 1. Loads real datasets (e.g., 'harry', 'elife') for a given environment. 2. Trains multiple DLIM models using multiprocessing. 3. Compares training performance (MSE loss) a...
807c74ae3eb78412257b0046688b9f31e610d2d0d423f1cc06a543d3f5d3781e
Python
7,358
241
import os from tqdm import tqdm import glob import numpy as np from scipy.interpolate import interp1d from scipy.stats import pearsonr from scipy.ndimage import gaussian_filter1d from fiberpipeline.utils import get_basename from nicety.conf import get_conf from joblib import Parallel, delayed import optuna import wa...
e75fa47acc46c9655dfecd1d34c17e7c126146a440701c6c16d52d3047d444ce
Python
7,360
157
"""Default calculator behavior on core-only and Polar-enabled installations.""" import json from pathlib import Path import subprocess import sys from types import ModuleType from unittest.mock import Mock import pytest import toml from chemgraph.schemas.calculators import mace_calc from chemgraph.utils import calcu...
49f2bf8230076a341c706eb852211a9520a56ad32c11f1abcbbf8822d9dbb652
Python
7,362
227
"""Single-channel Dynamic Network Modes (SC-DyNeMo).""" from dataclasses import dataclass from typing import Dict import numpy as np import tensorflow as tf from osl_dynamics.models.dynemo import Config as DynemoConfig from osl_dynamics.models.dynemo import Model as DynemoModel from osl_dynamics.inference.layers imp...
00ae2f26e799afd1fc8a03c4e9a8452884ff90f2d7876e5d6502420ba058606f
Python
7,363
233
import pandas as pd import scanpy as sc import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import seaborn as sns def tracks_plot( adata, marker_genes, width=12, track_height=0.25, fontsize=None, use_raw=False, exp_transform=False, labels=None, ...
04d7d1214b100f2cea1af2520d59d54e4c2f2e79a2605e36387c80cde67b6f41
Python
7,364
203
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Aug 24 08:49:51 2023 @author: rl05 Suppress artifact - filter, ICA, identify bads, epoch, epoch rejection """ import os.path as op import pickle import json from mne import pick_types, find_events, Epochs from mne.preprocessing import ICA, create_eog...
8fcf8296eb1e870df1b2a7b763e06ff71c3b57d0a2c4eb1be78f3cf3c6594610
Python
7,366
229
import functools import typing import bisect import pdb import logging from ..qt import * from ..config import * LOGGER = logging.getLogger(__name__) class Delegate(QItemDelegate): def createEditor(self, parent: QWidget, option: QStyleOptionViewItem, index: QModelIndex) -> QWidget: if index.column() == 4: ...
2058639983763b61a9d0b00ccb6d235aff827d58f3bd2baf42e4fb7aea6c9926
Python
7,367
227
"""Shared, internal types for the endpoint × protocol model-loading pipeline. The pipeline is:: caller -> load_chat_model -> endpoint spec -> protocol builder -> client An *endpoint* declares only what makes it different from other endpoints that speak the same protocol: its base URL, credential policy, model-na...
ea7db9acd456b1444eb893dcdecac6dbb4df5dc462ac03738fddf26b124ecf81
Python
7,369
195
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import json import re from os.path import join as pjoin from io import StringIO import numpy as np import pandas as pd import os import sys from glob import glob from natsort import natsorted LABDATA_FILE= pjoin(os.path.expanduser('~'),'labdatatools','preferences.json') ...
f6553af83cc781d24338d21779eda930b697fba9132dff439771d463742ca0be
Python
7,369
167
############################################################################# # Copyright (C) 2020-2026 MEmilio # # Authors: Martin J. Kuehn, Maximilian Betz # # Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compl...
1d4767adbb557fe1c0bacec8130855d5fe4d0153f6ac7f890c4d6d251407441e
Python
7,373
176
from PUMI.engine import QcPipeline, GroupPipeline from PUMI.engine import NestedNode as Node import nipype.interfaces.fsl as fsl from nipype.interfaces.utility import Function from PUMI.utils import get_reference import nipype.interfaces.ants as ants @QcPipeline(inputspec_fields=['mask', 'template'], outp...
a2677524185923841ac8022a848e503795258789449278b8ea5141217d5655a4
Python
7,376
206
""" Classifier head and layer factory Hacked together by / Copyright 2020 Ross Wightman """ from collections import OrderedDict from functools import partial from typing import Optional, Union, Callable import torch import torch.nn as nn from torch.nn import functional as F from .adaptive_avgmax_pool import SelectAd...
55d7141a5aa6d2ab22645e0f008b0cd2b11180874491dff98e5ec25d2f67c072
Python
7,377
203
""" This script plots the results of the single-session predciton of switches from neural data. """ import sys import os sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import matplotlib.pyplot as plt from scipy import stats import json import numpy as np from pathlib import Path fro...
f29033adadcd7c633d040ba56b255435338953192a7f37bae7266b4ff5d4911d
Python
7,377
136
"""This scripts generates 3 examples where we now use multi-modal data to regress HR synthetic scans. Specifically we regress HR synthetic T1 scans from LR T1 and T2 scans. Thus this script produces synthetic HR T1 scans as regression target, and aligned HR synthetic scans (input channels) simulating T1 and T2 scans ac...
54d58b103ba51480fc98bb3180df2ad53f8edccda2d27d128b9212c0465eccc5
Python
7,379
228
import os import os.path as osp import re import warnings from typing import Callable, Dict, Optional, Tuple, Union import torch from torch_geometric.data import InMemoryDataset, download_url, extract_gz from torch_geometric.utils import from_smiles as _from_smiles class MoleculeNet(InMemoryDataset): r"""The `M...
d6330bd15399f5ec062c179275ac33f2256d2628dec3dc547bf0ee691a934f4e
Python
7,379
73
import argparse def ArgParserPatch(commandline,do_exit,flag=0): parser = argparse.ArgumentParser() exp=['experiment','--exper'] parser.add_argument(exp[flag], type=str, help = 'give name of h5 file, for example: ') parser.add_argument('-headstages', type=str, nargs="+", help='which headstage to analyze...
0c38df582d121f90fdd73adc49e11448a10bb2c30e54eb6d649ceffad05471f9
Python
7,382
213
""" Apply Machine Learning Classifiers to OpenPBTA data Modified from PDX PPTC Machine Learning Analysis https://github.com/marislab/pdx-classification Rokita et al. Cell Reports. 2019. https://doi.org/10.1016/j.celrep.2019.09.071 Gregory Way, 2018 Modified by Krutika Gaonkar for OpenPBTA, 2019 In the following not...
0626238808833b97bd3467a2873fe61efa5eeb9163d3c2ccdf7974d14e5bdac4
Python
7,383
221
#!/usr/bin/python3 # import os import sys import argparse import numpy as np from uac import utils # Create the parser my_parser = argparse.ArgumentParser(description="Calculation of old atrial coordinates") # Add the arguments my_parser.add_argument("target_path", metavar="path", type=str, help="Path for the new ta...
303cc4535134e9280eee7420d214ee912610107b5ec1594cf6e4946f30b9726f
Python
7,383
197
#!/usr/bin/env python3 """ Centroid geometry similarity via pairwise Euclidean distances (label-matched): Given two centroid CSVs (from plot_scatter_centroids), this script: 1) Loads centroids and matches rows by (layer, network) 2) Computes within-dataset pairwise Euclidean distances between all centroids: DA(i...
1770fdb8a3f65e751d6c21b703f41a9045fe1745633d004af2f2ef4e2943f889
Python
7,384
170
#!/usr/bin/env python3 import sys import getopt import time ############################################################################ # Main gateway: ############################################################################# # usage def main_usage(): print(""" Usage : GEM_toolkit.py action [options] Actio...
33f41a0b22c9d0e44da51c77ed254ac58078bcb7f480f0fb86647d6a5b53e93f
Python
7,385
179
""" 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 IvimModelSegmented3Step(ReconstModel): def ...
db8ff8b542d0e0cfa3813b0922d827d413a7e0f1fe56913dc3e4d30722d703f8
Python
7,385
213
""" A set of helper functions for TIMBRE. @author: Gautam Agarwal """ import numpy as np from random import sample from keras import models from scipy import signal def test_train(lapID, which_phase, n_folds=5, which_fold=0): """ Returns test and train samples Parameters: - lapID: contains info ...
e21afecc778c86266a18a9e4e56eec8515a1f99a7f5689c3940227ed6d9fb9b1
Python
7,385
237
from typing import Any import torch import torch.nn as nn import torch.nn.functional as F import seisbench.util as sbu from .base import WaveformModel class CRED(WaveformModel): """ Note: There are subtle differences between the model presented in the paper (as in Figure 1) and the code on Github. ...
589d95a64a784bb4ef338796723569f2de545687a3f0af29db56c543be493a06
Python
7,386
152
import torch import os import glob2 from tqdm import tqdm import pathlib def check_early_stopping(val_loss, previous_val_loss, early_stopping_counts, early_stopping_threshold, epoch, model, optimizer, scheduler, path): exit_training = False if val_loss.item() > previous_val_loss: early_...
d0bcbf481214b1dca6d936181753bfa94ce1364b83c729041fcf7481a6caed3a
Python
7,388
139
""" 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 may not use this file except in compliance with the License. You may obtain a copy of the License at http:...
e974f0f621c6d74ceed5f82e0f7087ec2cc0a021314b07181b267684f30a247e
Python
7,389
192
# This file is part of connectome-manipulator. # # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2024 Blue Brain Project/EPFL """Auxiliary classes to process many nodes split into chunks""" from dataclasses import dataclass from functools import reduce from operator import and_ from typing import Union import ...
6d3b9eec2749716e76beffa57b03dc43744e83fd3b4bd918ee0e576ae6d633f5
Python
7,391
206
import argparse import torch import torch.nn.functional as F from torch.utils.data import DataLoader from ogb.linkproppred import PygLinkPropPredDataset, Evaluator from logger import Logger class LinkPredictor(torch.nn.Module): def __init__(self, in_channels, hidden_channels, out_channels, num_layers, ...
e43ee15aea25163e73c9dd8a2f4e0302644ecfe010335be0748010a3f97922f6
Python
7,391
148
import pandas as pd import xarray as xr from brainscore_core.supported_data_standards.brainio.stimuli import StimulusSet from brainscore_vision import load_dataset, load_metric from brainscore_vision.benchmark_helpers.neural_common import ( TrainTestNeuralBenchmark, RSABenchmark, average_repetition, filter_rel...
fbcbee7a2d82c5bc2e50981c91e95e1bb0fd8c17706949010cb8d62614f580eb
Python
7,391
140
from brainvoice.data.brainvoice_dataset import BrainVoiceDataset from brainvoice.data.datasplit import DataSplit from brainvoice.data.standard_scaler import StandardScaler from brainvoice.data.minmax_scaler import MinMaxScaler import os import torch class BrainVoiceStream(object): """ Subset part ...
bf8b85c94bde5af115b409b2c82adfffdef1cc943a270114a2895fc061bfc8ff
Python
7,394
327
# 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...
3aec00a8b4a733177b0c0a07baaa285f7ec5dc5febe4bfa8e6eb8ca7f32e706c
Python
7,397
187
"""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, ...
f8a10d3751cd3ec020959c757774cded09645195a0a2c602505e60086cb8d369
Python
7,397
160
from pathlib import Path from typing import List, Tuple import numpy as np from PIL import Image from brainscore_core.supported_data_standards.brainio.assemblies import NeuroidAssembly, PropertyAssembly from brainscore_vision import load_benchmark from brainscore_vision.model_interface import BrainModel from brainsco...
3a171840849779128422e6fa716f739bbc3279e10d7c37b00079b2c465243610
Python
7,399
243
from pathlib import Path from types import SimpleNamespace import numpy as np from napari_dmc_brainmap.registration.sharpy_track.sharpy_track.model.AtlasModel import ( AtlasModel, ) from napari_dmc_brainmap.results.probe_vis.probe_vis.view.ProbeVisualizer import ( ProbeVisualizer, ) from napari_dmc_brainmap.s...
4983acc421c4c65bc768b5546025b7a17168c194a913db28edff80b541bedcab
Python
7,400
236
import re from pathlib import Path from typing import Literal, Optional import numpy as np import pandas as pd import scipy as sp import skimage import tqdm def apply_affine(T: np.ndarray, X: np.ndarray) -> np.ndarray: """Apply homogeneous-coordinate affine matrix T to each row of of matrix X of shape (N, 3)...
5c704486fe5b597367d364b540627e665c199931a727c2f05b44ea8d2b33a9c5
Python
7,405
197
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Script to compute signal to noise ratio (SNR) in a region of interest (ROI) of a DWI volume. It will compute the SNR for all DWI volumes of the input image seperately. The output will contain the SNR which is the ratio of mean(signal) / std(noise). The mean of the sig...
03e96dbc2d8aacda5395bc7352616c07fdb85aa45da364eb6e325efcb569a16e
Python
7,407
204
""" Cross-Modal Fusion Module for AVPENet. Transformer-based bidirectional cross-modal attention fusion. Given audio embedding ea ∈ R^512 and visual embedding ev ∈ R^512: 1. Project into shared space with learnable positional encodings 2. Audio-to-visual attention: queries from audio, keys/values from visual 3....
476a8f3ec1578f6cba9dcce056357d723ba6e830921501c5fe002001f8de1e8d
Python
7,407
219
"""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.function as fn from dgl.nn.functional import edge_softmax class EGNNv2Conv(nn.Module): def __init__(self, in_size, hidden_size, out_size, edg...
7f75df646cdeb11de1b952cde06197f8a582128992d05e535a6044e470eb4d44
Python
7,409
202
# Created by David Coggan on 2024 06 25 import numpy as np from brainscore_core.supported_data_standards.brainio.assemblies import DataAssembly, NeuroidAssembly from brainscore_vision import load_dataset from brainscore_vision.benchmarks import BenchmarkBase from brainscore_vision.benchmark_helpers.screen import place...
afbf0de027df0165fd331036c3b7b15cd5155ff907d93f4b908ef5fb49c5b7fc
Python
7,409
244
# The ImpedanceFitter is a package to fit impedance spectra to # equivalent-circuit models using open-source software. # # Copyright (C) 2023 Julius Zimmermann, # julius.zimmermann[AT]uni-rostock.de # # This program is free software: you can redistribute it and/or modify # ...
faaa5aa3442ac40d3f5c9d2299b1af1e5ec80f783feac83dba36f1958cde1665
Python
7,410
200
# Copyright (c) OpenMMLab. All rights reserved. import os import os.path as osp import platform import shutil import sys import warnings from setuptools import find_packages, setup def readme(): with open('README.md', encoding='utf-8') as f: content = f.read() return content version_file = 'mmseg/ve...
014a563cf3b660b73cfdcb6ec487fd6c5fc5354fe7b08fa59be1967216eaf082
Python
7,411
211
import numpy as np from math import log from collections import defaultdict from logging import info from data import Token, inverse_target_map from util import as_scalar def transition_probabilities(sequences, smoothing=None, binarize=True, log_prob=True, verbose=False): """Estimate...
cd17eedf191ac33c0164aba0909a27721bf632ecd4607957a523b7db8b218e59
Python
7,411
201
""" Deprecated HierarchicalEventClassifier LOO version @ 2022 Knowblesse Using the preprocessed Neural Ensemble dataset with behavior labels, build and test the SVM. Along with the accuracy, feature importance is calculated. Two classification is done. 1) Is it HE or HW? 2) Is it data from Avoidance trial or E...
eda89c4ed4aee3d2d8eef3af44c6c30f9559a86e5b0f7230cb061f2674d27bab
Python
7,412
171
from typing import Dict from math import prod from zigzag.classes.workload.layer_node import LayerNode from zigzag.utils import pickle_deepcopy class TemporalMapping: """ Class that collect all the info related to temporal mapping. """ def __init__(self, temporal_mapping_dict: Dict, layer_node: Layer...
5b1182161bd18eda3ce1a2a0befc2e978d8fbe3c713b25a29277f3585d470ac2
Python
7,416
159
# Copyright (c) 2026 Rohit Jena. All rights reserved. # # This file is part of FireANTs, distributed under the terms of # the FireANTs License version 1.0. A copy of the license can be found # in the LICENSE file at the root of this repository. # # IMPORTANT: This code is part of FireANTs and its use, reproduction, or...
9dfbeb148182879707e4d50b4a08ab42809c87179044093fcaae237a2dfc2538
Python
7,416
232
# coding=utf-8 # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
fdd1e7a3e15ea49629b1f87d0e7490127b79eb477d83c3f900ef5c2b81be281f
Python
7,416
227
""" Support for reading and writing the `AXT`_ format used for pairwise alignments. .. _AXT: http://genome.ucsc.edu/goldenPath/help/axt.html """ from bx import interval_index_file from bx.align import ( Alignment, Component, src_split, ) # Tools for dealing with pairwise alignments in AXT format class ...
1377684ddf54b29335fcbb8180c83fe9d9ea789fc5a4a7643b02df7d31f50f9a
Python
7,418
177
###################################################################################################### ### Script to compute the firing rate over time via fixed time windows from spike raster data; ### ### computes the firing rates for all subpopulations in an "equal overlap" paradigm ### ###########...
34ba7ba655d2cd4d4b9d31f0e4914f2a4c4212db06759f1c8ad830ce1565a03f
Python
7,419
170
import os import torch import gc import numpy as np import matplotlib.pyplot as plt from Bio.Phylo.TreeConstruction import DistanceMatrix, DistanceTreeConstructor from Bio import Phylo from scipy.ndimage import zoom, gaussian_filter from scipy.stats import spearmanr, pearsonr, mannwhitneyu, false_discovery_control from...
1e9961587008feb5d9695d328fafcbc76c19bccd4454de88349fd541997e4b97
Python
7,420
152
"""Exports a YOLOv5 *.pt model to ONNX and TorchScript formats Usage: $ export PYTHONPATH="$PWD" && python models/export.py --weights yolov5s.pt --img 640 --batch 1 """ import argparse import sys import time from pathlib import Path sys.path.append(Path(__file__).parent.parent.absolute().__str__()) # to run '$ ...
29be60ad41d8aabe90c6e78eddcf8ae4f4f3c69462d418775134cf0b2d9b53b4
Python
7,421
167
# Copyright (c) 2026 Rohit Jena. All rights reserved. # # This file is part of FireANTs, distributed under the terms of # the FireANTs License version 1.0. A copy of the license can be found # in the LICENSE file at the root of this repository. """Tests for the optional lite_lncc LNCC backend (loss_type='lite_lncc'). ...
523f46cfacb4d910fe398919bc214645a7eb2bfc8b492eca8fd25d6719d2d843
Python
7,421
225
# Copyright (c) 2023 Khaleelulla Khan Nazeer, Anand Subramoney, Mark Schöne, David Kappel # # 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 #...
30d4d62849e911318d180c9cac4784f7807de10ba7d6d2acdf7d8120f180dfe4
Python
7,422
177
###################################################################################################### ### Script to compute the firing rate over time via fixed time windows from spike raster data; ### ### computes the firing rates for all subpopulations in an "equal overlap" paradigm ### ###########...
1f12a9fa1dfa463aba96a0fc51f810bf7b84439f09588a1ada04597f25ddd76f
Python
7,423
242
from ..qt import * from .. import thalamus_pb2_grpc from ..observable_item_models import FlatObservableCollectionModel, TreeObservableCollectionModel, TreeObservableCollectionDelegate, get_selected_rows from ..config import ObservableDict from ..task_controller.util import create_task_with_exc_handling import datetime ...
c525df7e9db390d9016e56ad51c2cbec389666f4fb81b9b1597da03e488f6cf1
Python
7,429
282
"""Train DyNeMo on Nottingham movie data. """ print("Setting up") import pickle import numpy as np import os.path as op from os import makedirs from osl_dynamics import analysis, data, inference from osl_dynamics.models.dynemo import Config, Model from osl_dynamics.utils import plotting #%% Settings # GPU settings ...
823abbe5c3f5a66bc81ee35ed2d582b92a21abf0ef8a0ceb0d043ea1b38ad08f
Python
7,435
241
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved import atexit import functools import logging import sys import uuid from typing import Any, Dict, Optional, Union from hydra.utils import instantiate from iopath.common.file_io import g_pathmgr from numpy import ndarray from sam3.train.utils....
43158e6e0383f16c177f33ffd6769c470111842cb9e213e2b4b7077232aeafed
Python
7,436
183
# this python file is used to import, not for running directly import os import time import cv2 import numpy as np import torch from .models.experimental import attempt_load from .utils.datasets import LoadImages, LoadStreams from .utils.general import (check_img_size, check_requirements, n...
06c2c318e765605d3d7612e414537982ebf86eb378ede9e6d4820384b77c90be
Python
7,439
211
import numpy as np import tensorflow as tf from tensorflow import keras as K from tensorflow.keras import Model from tensorflow.keras.layers import Dense from tensorflow.keras import initializers from tensorflow.keras.regularizers import l2 import custom_transform from my_loss import MyLoss from DFTlayer import DFTLay...
0b36d14c3d193ac397080b96f4069329a1ce37301fc361a4ec7dbc1fdc7260e7
Python
7,439
199
from .SampleAnnotation import SampleAnnotation from .Genome import Genome from .SampleParams import SampleParams from .submodules import * from .ExportCounts import ExportCounts from drop import utils from pathlib import Path import wbuild from snakemake.logging import logger class DropConfig: CONFIG_KEYS = [ ...
2da46f2c7a33e68f18f0aa81b1111bd329002d8435c9b265a41a249f806f6a23
Python
7,439
256
"""shufflenet in pytorch [1] Xiangyu Zhang, Xinyu Zhou, Mengxiao Lin, Jian Sun. ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices https://arxiv.org/abs/1707.01083v2 """ from functools import partial import torch import torch.nn as nn class BasicConv2d(nn.Module): de...
4804b961acc9839adaf47cad1db2c5154316f2dda4e36346d56eb32669845081
Python
7,440
153
from torch.optim.lr_scheduler import MultiplicativeLR, SequentialLR as _SequentialLR, \ ReduceLROnPlateau as _ReduceLROnPlateau from torch.optim import Optimizer from typing import Union, Callable, List import warnings from bisect import bisect_right from ..util.util import has_argument __all__ = ['WarmUp', 'Sequ...
40e87b022cb74fd500ba9e9de5c5c0681647a3a313400248d075af86a2a74f5e
Python
7,445
236
#!/usr/bin/python import sys import argparse import numpy as np import nibabel as nb import logging try: from due import due, BibTeX except ImportError: # Adapted from # https://github.com/duecredit/duecredit/blob/2221bfd/duecredit/stub.py class InactiveDueCreditCollector(object): """Just a stub...
820da7e5869a86abf23ed3777b7024915cd1b0c9f1be5506a10fd37ff94ee224
Python
7,445
257
import atexit import inspect import json import subprocess import textwrap import threading import time from collections.abc import Callable, Sequence from dataclasses import dataclass from functools import partial from pathlib import Path from typing import Any import requests from docs.doc_modules.experiments impor...