sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
a250edc7ff6215ba32b146df0c24219deb80a14bf55a9336f3104dc91b2c0873
Python
12,375
374
""" Numeric arrays stored as individually compressed blocks on disk, allowing pseudo-random acccess. `BinnedArray` is used to build such an array in memory and save it to disk. `BinnedArrayWriter` can instead be used when creating the array sequentially (does not require keeping all data in memory). `FileBinnedArray` ...
f357847fd5c9c14c19d50eab68953da7839d56a4ea1055af7d785cdb0a0be229
Python
12,375
282
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations import argparse import cv2 import numpy as np import onnxruntime as ort import torch from ultralytics.utils import ASSETS, ROOT, YAML from ultralytics.utils.checks import check_requirements class YOLOv8: """...
611f73e9bde015ee876d446b468ddb679d806082dc5632872e11920f9e2b6af9
Python
12,377
292
# Kai Sandbrink # 2023-07-30 # This script compares data from Day 1 and Day 2 to see if any learning took place. # %% LIBRARY IMPORT import numpy as np import os import pandas as pd from scipy.stats import ttest_rel, ttest_ind from human_utils_project import sort_train_test, get_clean_data from human_utils_behavior...
d0cfd0e7edd15eecb67f732b803715b5a65d8edf81b6df9ea4342fc376fcb7f1
Python
12,378
332
# Neural network import os import time import tqdm import torch import torchvision import pandas as pd import polars as pl import numpy as np from PIL import Image from sklearn import metrics, model_selection from config import Config torch.manual_seed(Config.random_state) torch.cuda.manual_seed(Config.random_st...
1384636cef57d3b0f2a40a7abd3f09cd0761c965d5cf5fb11dfd8c8190ef3fdf
Python
12,382
348
"""Tests for mcmlnet.utils.network_init module.""" import copy import pytest import torch import torch.nn as nn from mcmlnet.utils.network_init import ( init_weights, matmul_precision, set_activation, ) class TestMatmulPrecision: """Test cases for matmul_precision function.""" @pytest.mark.par...
94337c6f830ee2955a089b96c80316e3a3537f9dd8203493afd9af623697fcfd
Python
12,387
283
# Copyright 2024 Image Analysis Lab, German Center for Neurodegenerative Diseases (DZNE), Bonn # # 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...
bfbf24c2b3c5a8f922180493db190a5208f501480b11c351850f434f6ce9167a
Python
12,387
278
# # Reference : https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3864968/ # # Written by SK Park , NIRAL, UNC # 2021-04-18 import dtiplayground.dmri.preprocessing as prep import yaml,traceback import numpy as np import time from pathlib import Path import os import markdown from dipy.align.imaffine import (transform_ce...
0fff9536aa39b0e1933313f48547ed0c989eb0b090eb035ac28dcd49cf8061c9
Python
12,388
357
# The ImpedanceFitter is a package to fit impedance spectra to # equivalent-circuit models using open-source software. # # Copyright (C) 2018, 2019 Leonard Thiele, leonard.thiele[AT]uni-rostock.de # Copyright (C) 2018, 2019, 2020 Julius Zimmermann, # julius.zimmermann[AT]un...
b914e364f084a22b34c5073bf5ff719d84a8ce9aade4643f926fd27cc1c74658
Python
12,388
234
import argparse import os import pathlib import time import datetime import h5py import numpy as np from enum import Enum from neuron_interface.neurosim.simulation.dendritic_delay_simulation import DendriticDelaySimulation from postprocessing_modules.axonal_delay_kernel import get_axonal_delay_kernel from helper_funct...
1cc86d9ae913429dd9d6538ac5dd4834d4204c8e3c5e2d24b4b0858748d3858c
Python
12,391
367
# -*- coding: utf-8 -*- """ Created on Thu Nov 30 11:38:01 2023 @author: N. Delinte """ import json import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from scipy.stats import linregress, ttest_ind from statannotations.Annotator import Annotator from unravel.viz import plot_me...
6b4fcf969745b90a50b0d01bceae99aead4015f8a6e9b96a23d142849ada32d6
Python
12,395
246
import numpy as np import tensorflow as tf tf.compat.v1.disable_eager_execution() tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR) import argparse, os, time, logging from tqdm import tqdm import pandas as pd import multiprocessing from functools import partial import pickle from model import UNet, ModelCo...
e61176c544dae139e82819838a8f93944431595fbfa867b65df5fbbdf6a8c021
Python
12,397
303
from datetime import date import matplotlib.pyplot as plt import networkx as nx import numpy as np import os import pandas as pd import difflib from path_plots import dmdb_plots as dp import re import shutil from yaml import safe_load from utils.build_indications import get_id_num, read_deprecated_ids def generate_md...
18d2e2c65a114dbae75adebee952a96ea7119f594fb4d30d519e13680265e4c1
Python
12,398
275
import argparse import torch import torch.utils.data from motion.dataset import MotionDataset from model.eghn import EGHN import os from torch import nn, optim import json import random import numpy as np from utils import EarlyStopping parser = argparse.ArgumentParser(description='VAE MNIST Example') parser.add_arg...
d0b0144d19772d7a77790657783668a981deb5ed68996ea9fa13988c2e89ea4a
Python
12,398
361
"""Cycle Duration Analysis. Load tinda output and calculate cycle duration based on best sequence (group level) fitting a second HMM on the fixed state sequence Authors: Mats van Es Carina Forster Last update: 23-06-2026 Important: run in environment with osl_dynamics 2.0.2 """ import os imp...
c7f5239b4ea8ca3f6fafdab02c680c48881ad128a134562bd4193601fa693c57
Python
12,399
286
import os import numpy as np import pandas as pd import torch import torch.optim as optim import torch.nn.functional as F from sklearn.decomposition import PCA from sklearn.metrics.cluster import adjusted_rand_score from sklearn.multiclass import OneVsRestClassifier from sklearn.svm import SVC from sklearn import svm f...
3b7f0a6ab647cd909083faf60db47480081cc235298d6ad188ba586d82a30629
Python
12,400
416
import math import torch from torch import nn from torch.nn import init as init from eir.models.layers.norm_layers import LayerScale def append_dims(tensor: torch.Tensor, target_shape_no_batch: list[int]) -> torch.Tensor: # exclude batch dimension current_dims = len(tensor.shape) - 1 target_dims = len(t...
1e44d4712cc1fa96dd5fd88c97e456a8bfca194d1112aaaf76cb8a7e5e2ec0e3
Python
12,402
358
#!/usr/bin/env python """ Classes for reading HAL movies and XML. Some of this is a copy of storm_analysis.sa_library.datareader, except that support for the spe and fits formats has been removed. Hazen 10/18 """ import hashlib import numpy import os import re import tifffile import storm_control.sc_library.param...
bcbe3e4a488b6176db3f1c9ad46fe168698ca83e4d6901e87fed070d67b517fd
Python
12,405
406
# -*- coding: utf-8 -*- import logging import numpy as np from scipy.spatial.distance import cdist, pdist, squareform def swap_sampling_eddy(bvecs, shell_idx): """ Optimize the bvecs of fixed multi-shell gradient sampling for eddy currents correction (fsl EDDY). Bruteforce approach to maximally spr...
cde06a63d66eaaa786e17ba35f221d5e7f02e4d3a85bc29e8c678edc71eb5586
Python
12,405
356
import json import numpy as np import torch from tqdm import tqdm from infopath.utils.functions import trial_match_template, return_trial_type import pandas as pd def light_generator(time, window="baseline", freq=100): time = torch.tensor(time) t = torch.arange(time.shape[0]) * 2 / 1000 light = torch.sin(...
246fc3ea081548a23573aaa06abc62274fe84ca3b50542fdac0ae9b6881b4fad
Python
12,406
347
import numpy as np import matplotlib.pyplot as plt from statsmodels.nonparametric.smoothers_lowess import lowess import numpy as np from scipy.interpolate import interp1d from sklearn.preprocessing import MinMaxScaler import matplotlib.pyplot as plt import math import pandas as pd import os from scipy.interpo...
a543e9084d95e58d56813263484a01c9708253da998811069ccea9acd14d58b5
Python
12,413
305
#!/usr/bin/env python3 # Author: Francois Aguet import numpy as np import pandas as pd from collections import defaultdict from bx.intervals.intersection import IntervalTree import argparse import os import gzip class Exon: def __init__(self, exon_id, number, transcript, start_pos, end_pos): self.id = exo...
6390ad61a4244ee96f9a015a12678e33ee6cac3914d706a33087aafb98114177
Python
12,421
267
import os import math import numpy as np from scipy import ndimage import tensorflow as tf import utils as utils import models from dcrf_gradient import dense_crf_inference from scipy.ndimage import gaussian_filter from utils import downsample_upsample_scipy import nibabel as nib def predict(subject_list, ...
dd304990f8d4fc3064348724d948dffc28fef81c9310dcfe67d7454dba499ca4
Python
12,428
308
from data_utils import locate_dataset, write_to_json from tqdm import tqdm from typing import Dict, List, Optional import os import random class Sampler: """ A class to sample a subset of registration problems from the registration graph and store them in a JSON file. The problems can be either cur...
5bd6904ed2cae8957f88272d0ecac74e6fcf1f922c8edecb79275ebfe21637c5
Python
12,430
303
# PyTorch utils import datetime import logging import math import os import platform import subprocess import time from contextlib import contextmanager from copy import deepcopy from pathlib import Path import torch import torch.backends.cudnn as cudnn import torch.nn as nn import torch.nn.functional as F import tor...
d4b29c6b3192618cb9566fc6f4ce8fea5e341bd6fd99e1cce6393a7f25b8b426
Python
12,434
389
import torch import torch.nn as nn from collections.abc import Sequence import numpy as np class ConvLayer(nn.Module): def __init__(self, in_channels: int, out_channels: int, dimensions: int = 2, strides: int = 1, kernel_size: Seq...
33590cb8011645db35a868a4e9dc171284daf68f0eca7b4ddbae37466cd4aa23
Python
12,443
129
"""Descriptive follow-up exports from frozen results and versioned annotations.""" import csv,hashlib,json,math,re,statistics from pathlib import Path ROOT=Path(__file__).resolve().parents[2];OUT=ROOT/'tables/dna_maintenance';OUT.mkdir(parents=True,exist_ok=True) def read(p): with (ROOT/p).open() as f:return list(csv....
ab98bb014cc1b4c81b473da81f2347ff7bbf2af8c1cc33fc5731eb5da9ad6ddb
Python
12,452
252
from typing import Callable, Dict, List, Optional, Tuple, Union from torch_geometric.data import Data, FeatureStore, GraphStore, HeteroData from torch_geometric.loader.node_loader import NodeLoader from torch_geometric.sampler import NeighborSampler from torch_geometric.sampler.base import SubgraphType from torch_geom...
4d11b068a627f672e7ddfa74ad24b3786b3db878f6ad9cdfa2632c7837eaf0ef
Python
12,454
338
from math import sqrt from typing import Optional, Tuple, Union import torch from torch import Tensor from torch.nn.parameter import Parameter from torch_geometric.explain import ExplainerConfig, Explanation, ModelConfig from torch_geometric.explain.algorithm import ExplainerAlgorithm from torch_geometric.explain.alg...
992957b54a07c5d8f4e3632058d5a96c814855c97e8b51d77751efa8069376ec
Python
12,463
296
""" Reference: - Zhang, Hang, Chongruo Wu, Zhongyue Zhang, Yi Zhu, Zhi Zhang, Haibin Lin, Yue Sun et al. "Resnest: Split-attention networks." arXiv preprint arXiv:2004.08955 (2020) """ import math import torch import torch.nn as nn from . import splat __all__ = ['ResNet', 'Bottleneck'] class DropBlock2D(object): ...
a27253a2106a59c8c38df21e2a39f69f951e9bab2a89271760d06503ef5d356a
Python
12,470
355
"""Base logger and its helper handlers.""" import numbers import warnings from abc import ABCMeta, abstractmethod from collections import OrderedDict from collections.abc import Callable, Sequence from typing import Any import torch import torch.nn as nn from torch.optim import Optimizer from eir.train_utils.ignite_...
aaff685e875d5ca578bb12638e3f5242fcb8c22d38510f7080b3656818353be3
Python
12,472
308
import os import re import shutil import subprocess from typing import Optional, Tuple class TOPED: def __init__(self, distribution: str, user: str, linux_workdir: str): """ Specify WSL distribution, user, and working directory for FSL. Parameters: distribution : str ...
2b3d0498ff9275d466247d1a2d953825f1eab6322a6c4436859264d450338db4
Python
12,473
338
""" This file contains several helper functions to calculate sleep statistics from a one-dimensional sleep staging vector (hypnogram). """ import warnings import numpy as np import pandas as pd __all__ = ["transition_matrix", "sleep_statistics"] #####################################################################...
d311981bc6c006429e709273484431c65da85c863cb2c346b0fc463a15f1f426
Python
12,475
335
# -*- coding: utf-8 -*- from dipy.reconst.shm import sh_to_sf, sh_to_sf_matrix from fury import actor import numpy as np from scilpy.reconst.bingham import bingham_to_sf from scilpy.viz.backends.fury import (create_contours_actor, create_odf_actors, ...
253a5d6b651631d467a18b2ecc446fb2e0218dbc118165e87fdb69e775e548f8
Python
12,481
349
from __future__ import annotations import functools from collections import namedtuple from collections.abc import Iterable from typing import cast import django_rq from django.conf import settings from django.http import HttpResponseBadRequest, HttpResponseNotFound from django.utils.decorators import method_decorato...
3801fc7ec597a37414993afc0b4721474604344a86f004b30e643e5ea97895d3
Python
12,482
277
#! /usr/bin/env python3 # -*- coding: utf-8 -*- """ This script computes two myelin indices maps from the Magnetization Transfer (MT) images. Magnetization Transfer is a contrast mechanism in tissue resulting from the proton exchange between non-aqueous protons (from macromolecules and their closely associated water mo...
d79a9868a70238d7efff9c1355e4497e911419625384922251cddbe43b31aa1f
Python
12,483
298
# -*- coding: utf-8 -*- """ EPI <-> ORIG registration The purpose of the following script is to compute the deformation field for the registration between antomy in conformed freesurfer space and native EPI space. Inputs are a mean epi in native space, a T1 map of an mp2rage acquisition, a freesurfer orig file generat...
d3bd3caffd86541a85704f7f905bd61055e494cdfcde478e9abdcd8e26c8c382
Python
12,484
419
import numpy as np from scipy.stats import zmap, zscore from sklearn.utils.extmath import randomized_svd from sklearn.utils.validation import check_random_state, check_X_y from pyls import utils def svd(crosscov, n_components=None, seed=None): """ Calculates the SVD of `crosscov` and returns singular vectors...
e79264d4704e67db95fadcdbe6315c167df31cccb15d7b5c0667e5160acc7f3e
Python
12,484
286
""" builds the tensorflow execution graph for the model by parsing network_specs """ import os, warnings warnings.simplefilter(action='ignore', category=DeprecationWarning) from os.path import isfile import argparse import yaml import numpy as np import tensorflow as tf os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' import ...
5169a933f8d6a3473e20a5db1a82d67811a8e56cbb4140bd812f548c1fa67f64
Python
12,491
275
"""A module that contains unit tests for the :py:mod:`corelay.io.spectral` module.""" import os import typing import numpy import pytest from matplotlib import pyplot from corelay.pipeline.spectral import SpectralEmbedding, SpectralClustering from corelay.processor.affinity import SparseKNN from corelay.processor.cl...
b56a4559232918bfb2c9ded677bf1481a021f81df7c747952d0065e0e8eff4e3
Python
12,498
252
"""Tridesclous2 rebuilt from its components, with the stages MEA-NAP wants to vary exposed. Stock TDC2 (:mod:`spikeinterface.sorters.internal.tridesclous2`) is a fixed chain: 5 σ threshold detection → subsample → per-channel ISO-SPLIT clustering → templates → the *peeler* (template matching over the whole recording) →...
593c9fc7ea9df6ea89fa1d546004ea2ad478bf62e1033a4001ad2c93e9411479
Python
12,499
326
import torch import numpy as np import scipy.stats as stats from .utils import sample_dist from typing import Literal image_size = 224 visual_degrees = 7 kernel_size = {'p': 21, 'm': 65} # 95% of Gaussian coverage # Receptive fields of P and M ganglion cells across the primate retina (Kroner and Kaplan, 1994) # htt...
1b13c7c5a4211c87af403bd0e7a933ce25245500688388e5bf8499bdfa7a0e3b
Python
12,500
402
import copy from dataclasses import dataclass, replace import torch import torch.nn.functional as F import torch_geometric as pyg import torch_geometric.graphgym.models.act import torch_geometric.graphgym.register as register from torch_geometric.graphgym.contrib.layer.generalconv import ( GeneralConvLayer, G...
29901659e1ae014d6e6dd8c20b1d63df285ec6839daa97b240857c16fde4f031
Python
12,502
280
############################################################################# # Copyright (C) 2020-2026 MEmilio # # Authors: Patrick Lenz # # 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 Licen...
54cc129e20f56fed2ad19abbd7546f2b5d888a6d6ef0570bb764abd2224ce087
Python
12,502
422
# -*- coding: utf-8 -*- """Surface utilities.""" import datetime import os import shutil import sys import numpy as np from .. import execute_command from ..io.filename import get_filename __all__ = [ "mris_thickness", "mris_curvature", "inflate_surf_mesh", "upsample_surf_mesh", "mris_expand", ...
02e71025e03cd17a941ffbcc502d24965c7366760eda9e8efa088fd17c93fbc4
Python
12,504
333
""" Multiprocessing executor for parallel image processing. Provides headless worker functions that process images without Qt dependencies. """ import os import traceback def init_worker(): """ Initialize worker process. Called once per child process at startup. Sets environment variables to prevent ...
c9a87338f0e75f38df2719d45a1369b1b22cf71ed195a6be2fec44547ace63d5
Python
12,504
372
#!/usr/bin/env python """ Fitting for offset using correlation with a 2D Gaussian. Hazen 04/18 """ import ctypes import numpy from numpy.ctypeslib import ndpointer import scipy import scipy.optimize import storm_analysis.simulator.draw_gaussians_c as dg import storm_control.c_libraries.loadclib as loadclib # Load ...
d15550c40f4d3dbaad41052d23682563ad6f6e8a822296198636a8156a6ce00f
Python
12,513
235
import mat73 import argparse import numpy as np import cebra from choice_mode_functions.combine_all_trials_all_brain_regions import dataset_all_sessions, choice_sampled_population from choice_mode_functions.split_dataset import split_train_test_data, k_fold_split_data from choice_mode_functions.model import cebra_model...
517ad6f40fc3962813dc9aa68623d45c4d4ff3c1f304d8e529f2842a71bcb9c4
Python
12,515
234
import os import torch import torch.nn as nn import torch.backends.cudnn as cudnn import torch.utils.data as Data import random import numpy as np import pandas as pd import anndata as ad import scanpy as sc from collections import defaultdict import warnings warnings.filterwarnings('ignore') from model.utils import *...
7dea3ad6586dc51b224b43692c4f64c853c0c040df59eaad8c34bc756e402179
Python
12,516
263
import multiprocessing import os from copy import deepcopy from multiprocessing import Pool from typing import Tuple, List, Union, Optional import numpy as np from batchgenerators.utilities.file_and_folder_operations import subfiles, join, save_json, load_json, \ isfile from nnunetv2.configuration import default_n...
bc8da7805b5702670e7a5d0879af878f2f6f1b6f643eea3dc68fb8194041b80b
Python
12,516
336
""" 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...
306516c520ac2a1ef349445a0d1c157cee6b89adb4d700c5f72573a2a301bad2
Python
12,517
263
import nighres import os import nibabel import numpy import glob import scipy.ndimage import ants indir = '/home/pilou/Projects/Cerebellum/Cerebellar-segmentation-ABC/ahead/coreg/' outdir = '/home/pilou/Projects/Cerebellum/Cerebellar-segmentation-ABC/ahead/tissues/' #bfimg = indir+'Ahead_brain_122017_blockface-image_...
d636bd2e1335cbb3fb5022768491e79493736c42976f0c65dfb033b960fffdd1
Python
12,518
306
# import general libraries import copy import numpy as np import pandas as pd from sklearn.linear_model import RidgeClassifierCV from sklearn.model_selection import train_test_split from sklearn.pipeline import Pipeline from sklearn.preprocessing import StandardScaler from tqdm import tqdm # import brain-score specif...
2ae9784abde6cf8a5c67f4335015b87150a4bc7bf8d7720fca2972cb61fe0bf3
Python
12,519
328
import torch import torchvision from torch import nn import torch.nn.functional as F # Based on the implementation in # https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1): return nn.Conv2d(in_planes, out_planes, ...
090dec61ad939710c83c0df7ba84a048614bb0dd1266128618f7ad4585f49e58
Python
12,523
273
import os.path as osp import numpy as np import copy import torch import torch.nn as nn import torch.nn.functional as F from torch_geometric.nn import Linear, HGTConv import heapq import random from scipy.spatial.distance import pdist from sklearn.metrics import roc_auc_score from torch_geometric.data import HeteroData...
69a1a07488be1e63cf76633b62eab28c86377e6b76b882969af4346cbfbbb286
Python
12,526
299
try: import torch import torch.nn as nn import torch.nn.functional as F except ModuleNotFoundError: print('pytorch is not installed. Using without it.') import sys import numpy as np from pathlib import Path from scipy.interpolate import interp1d from scipy.io import loadmat import platform import warni...
0e2f3a3745b77b0bf9b1ac68dea848328c5cbddcaba67c7ce54072d385a4aedb
Python
12,528
358
#!/usr/bin/env python """ Handles objectives manipulation. X/Y offsets are in units of microns. Hazen 10/18 """ from PyQt5 import QtCore, QtGui, QtWidgets import storm_control.steve.comm as comm import storm_control.steve.coord as coord import storm_control.steve.imageItem as imageItem import storm_control.steve.ste...
8bd5875f291afd91e58e5c9cf62d9e6144fb7cda2908320104796b9f16543140
Python
12,528
188
# update 2024-09-11: Add options to support FFPE alignment import os, sys, gzip, argparse, subprocess, random, glob from utils import read_maybe_gzip, check_iupac, revcomp star_default_options= "--limitOutSJcollapsed 5000000 --soloCellFilter None --soloBarcodeReadLength 0 --outFilterScoreMinOverLread 0 --outSAMtype B...
6e993b1fb3ffdd103fb213fc63a8244031e6384625bda7fd739768055d314d74
Python
12,529
363
import numpy as np import pytest from nelpy import formatters class TestBaseFormatter: """Test the BaseFormatter class.""" def test_base_formatter_initialization(self): """Test BaseFormatter initialization raises NotImplementedError""" with pytest.raises(NotImplementedError): for...
89cdcdbf8af72984ddde57bb038af0a3fe8f2053002ce4e5a5a3b925fc9f9b32
Python
12,532
248
import numpy as np from matplotlib import pyplot pyplot.ion() MV_PER_V=1000 SEC_PER_MIN=60 MS_PER_S=1e3 NA_PER_AMP=1e9 artifact_height=30 #mV - delta V between two sample points def line(x,A,B): return B*x+A def rows_columns(n): factors=list([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0) in...
0dfee8e856800288039c748629f63aa494d6e8231ae8ff656fd47303801a0576
Python
12,533
261
# =============================================================================== # Authors: Jenny Wang, Julia Camps and Lucas Berg # Version: 24/06/24 # =============================================================================== # This is a stand alone script that plots ECGs from body surface potentials # simulate...
a29f5536939edfaaa4d8f95609acb6f0fad85331d8ff8669327239706daec52f
Python
12,534
260
import json import pathlib import random from pathlib import Path from typing import List, Dict, Union from natsort import natsorted import pandas as pd import matplotlib.colors as mcolors import matplotlib.cm as cm import matplotlib.pyplot as plt from napari.utils.notifications import show_info class ColorManager: ...
5c3895197540a702b835f44cf9958cb3a13a75c2214e3ca219cccb8d21b0652a
Python
12,539
251
from operator import itemgetter from nilearn.decoding import SearchLight import os import nibabel as nib from glmsingle import GLM_single import glob from sklearn.pipeline import make_pipeline from nilearn.maskers import NiftiMasker from ants import apply_transforms, image_read, from_nibabel import pandas as pd from ni...
ff3ece00236a3d3463f9158d070f19ea2957cd5a8fe4ca6fac4942d94fa6d70d
Python
12,539
243
import numpy as np import os import sys import pandas as pd import json from scipy import stats import tqdm import itertools import matplotlib.pylab as plt sys.path.append(os.getcwd()) import functions.process as proc import functions.algebra as al from functions.io import makedir sys.path.append(os.path.expanduser(...
b5f74e68ece208e56be5baced0808e2cca4adbf22b795c16540a9d4fafcb1255
Python
12,540
269
import SimpleITK from pathlib import Path from queue import Queue from tqdm import tqdm import logging import numpy as np import torchvision.transforms as transforms from utils.detection_helper import create_anchors, process_output, rescale_boxes from utils.nms_WSI import nms, nms_patch import os import pickle import ...
0bec498ceb0ced6e9474b717673ea40ed0bd6868d6d5db8fff4957834ebe5546
Python
12,542
380
# -*- coding: utf-8 -*- """Check preprocessing quality.""" import os import shutil as sh import matplotlib.pyplot as plt import nibabel as nb import numpy as np from scipy.stats import pearsonr, shapiro from .. import execute_command from ..io.filename import get_filename from ..segmentation.mask import clean_ana, m...
dc62ee79974c5b7327bcc3f5f582b1d18f2e7082c8d6b3bfccf1425dd143726d
Python
12,545
379
import numpy as np import csv from debugtest import debugtest from BH76 import BH76 from W417 import W417 """ This module provides auxiliary functions for handling testset data, assembling features for machine learning, and exporting neural network weights in a TurboMole-friendly format. Functions --------- - _unstac...
0be0dcdad0bbab346a79fc0749fcb45dc454535370d8a45497f6f7d8c9ba4031
Python
12,550
302
# -*- coding: utf-8 -*- # @Author : LG from json import dump import cv2 import numpy as np import tqdm from pycocotools import coco as mscoco from pycocotools import mask as mscoco_mask from ISAT.formats.isat import ISAT __all__ = ["COCO"] class COCO(ISAT): r""" COCO format Attributes: keep_...
0e601db0d6cb28cec3f428f5a5f51d835d6cf3084ebf570ca3bbeb7e9e83e4e0
Python
12,551
409
""" Dataset Classes for H-FNO Multi-Physics Sensor Response Prediction This module provides dataset classes for loading and preprocessing sensor simulation data. Supported sensor types: - Thermal (RTD sensors) - Acoustic (microphone arrays) - Flow (orifice plate sensors) Data format: HDF5 files with inpu...
146dce824f17006eb41e0450b0bd7216784ef7941f95d92f6d515f54f448b0b6
Python
12,552
432
import os import matplotlib.pyplot as plt from matplotlib import colors import scanpy as sc import seaborn as sns import numpy as np import pandas as pd import colorcet as cc # Global variables store dataset-specific information from nest.hotspot.geometry import similarity_map library_id = None img = None scale = No...
805599f86078a9c16eb2f11221c984b22721b3e02de02481ba86c72c0003452a
Python
12,555
374
# -*- coding: utf-8 -*- import os import re import sys REFERENCE_VALUES = { 'npr': 5, # Npr value (line 8 and 48) 'ncy': 10, # Number of cycles 'rpa': -1, # Rpa value (line 14) 'ratio': '0.00000', 'bkpos': '25.000', 'wdt': '15.0000', 'cthm': '0.9100', ...
340f2c12d2309f235d5ebd3e08a2bdd81594bc9872db71bdd89a2b05750f2bf8
Python
12,557
474
import logging from math import radians import numpy as np from dipy.tracking.streamline import set_number_of_points import AFQ.viz.utils as vut from AFQ._fixes import make_mp4 try: from fury import actor, window from fury.colormap import line_colors except (ImportError, ModuleNotFoundError) as e: raise ...
0b01389dc0d6f12e4c5eb6bc370177a24810c2d44b539191ff6701b6cdfcc1f9
Python
12,558
366
import numpy as np import matplotlib import matplotlib.pyplot as plt import Utility import scipy import os from shutil import rmtree import random import scipy.ndimage as ndimage # space size, we used 45 in paper, and here increase the space size for visualization purpose n = 80 grid_orientation = 45 # goal location...
b04a6c9bf1a9db67c3e5f0bf0840b94556d6c83cf6ecbfbb892c5598c64f2171
Python
12,559
321
"""Prepare the NSD-core betas in fsaverage space. The betas are then divided into train and test split for encoding models training, ID testing, and OOD testing splits. Parameters ---------- subject : int Number of the used NSD subject. data_ood_selection : str If 'fmri', the ID/OD splits are defined based on fMRI r...
4965f847459e637314ea150520df200636ec1e55da34820184897508dcd38b6a
Python
12,560
326
import numpy as np import scipy.stats from sklearn.cross_decomposition import PLSRegression from sklearn.linear_model import LinearRegression, Ridge, RidgeCV from sklearn.preprocessing import scale from brainscore_core.supported_data_standards.brainio.assemblies import walk_coords, DataAssembly from brainscore_core.me...
a23ede43337bdcf9d2478609f043d3822cbbde7b4b2a951e658067d5dfc32713
Python
12,563
258
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations from pathlib import Path from typing import Any import numpy as np import torch from ultralytics.models.yolo.detect import DetectionValidator from ultralytics.utils import ops from ultralytics.utils.metrics import...
8f8c6075204e00bc0597c73586b270e6e9b36c694863377b187e628225a9ace2
Python
12,564
407
# Source: https://github.com/neuraloperator/neuraloperator/blob/main/neuralop/losses/data_losses.py import torch import math from deepcardio.losses.finite_diff import central_diff_1d, central_diff_2d, central_diff_3d from torch_scatter import scatter_mean class LpLoss(object): """ LpLoss provides the L-p norm...
354a59678a9cfe82d99b6309b96fc5b044cb0c455d09db5f990f25289de2ab04
Python
12,572
322
# Imports import sys import os import pandas as pd import numpy as np import random from scipy.integrate import odeint, solve_ivp from lmfit import minimize, Parameter, Parameters, report_fit from model_functions_loco_Rew6 import * import matplotlib.pyplot as plt from pathlib import Path ########## DATA LOAD ########...
5bf30417a30d8e28d60ca2a3294c84c08e31b0a19cce5fe5a9d82d7f4636fa1f
Python
12,578
353
import json from copy import copy from dataclasses import asdict from pathlib import Path from typing import TYPE_CHECKING, Any import numpy as np from aislib.misc_utils import ensure_path_exists from eir.experiment_io.input_object_io_modules.array_input_io import ( load_array_input_object, ) from eir.experiment_...
c2718ad9c4d81d1cceabe075b53458c9ffffa077b15800240d1d6b1037051482
Python
12,579
290
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Script to compute the Diffusion Kurtosis Imaging (DKI) and Mean Signal DKI (MSDKI) metrics. DKI is a multi-shell diffusion model [1]. The input DWI needs to be multi-shell, i.e. multi-bvalued. Since the diffusion kurtosis model involves the estimation of a large numbe...
09bf60af5b09def81d6723530f4d518c223fd8dcb4810185994dbb0f5accd54b
Python
12,581
307
''' FibrosisNet Kaggle Submission This python script will create the submission file that we submitted to the Kaggle competition. Running this script with `CT_WEIGHT=1.0` (best performance) achieves -6.8188 private score. Running it with `CT_WEIGHT=0.96` achieves -6.8195 private score. Note that the Darwin team hav...
56256bade1ecccbcc21d376b283a60d0d7fd5f63315edecee398af4c70adb97f
Python
12,583
356
# The ImpedanceFitter is a package to fit impedance spectra to # equivalent-circuit models using open-source software. # # Copyright (C) 2018, 2019 Leonard Thiele, leonard.thiele[AT]uni-rostock.de # Copyright (C) 2018, 2019 Julius Zimmermann, # julius.zimmermann[AT]uni-rost...
0309b0f637a1c32be65bd4d94ba7669089a437c8c1e52af031d16ea88d8e839d
Python
12,586
357
import math from collections import abc from collections.abc import Callable from dataclasses import dataclass from typing import Any, Literal from torch import nn from transformers import AutoConfig, AutoModel, PreTrainedModel from eir.models.input.sequence.sequence_models import SequenceModelClassGetterFunction fro...
f99cae5fe06491b0510e1c082dffe702df2d35465fda76214dd423250160d25e
Python
12,586
375
import json import shutil import tarfile from collections import defaultdict import numpy as np import seisbench import seisbench.util from .base import WaveformBenchmarkDataset # Conversion from earth radius DEG2KM = 2 * np.pi * 6371 / 360 class NEIC(WaveformBenchmarkDataset): """ NEIC dataset from Yeck ...
bea41e05a03a54639636014b416ac76439135c3dff8d629193092e0c9b94e800
Python
12,587
281
# 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 ...
67985c181f524000a781fbcdbd3a141b26e39964509bc222f491a10ff44f4c6f
Python
12,590
342
def plot_selected_cell_type_flow( pcloud_list, model, device, finaltruth, selected_cell_type, arrow_sample_size_per_type=55, xlim=(-0.2, 1.5), ylim=(-0.5, 2), height_scale=1.0,save_path=None ): """绘制特定细胞类型的流动""" # 创建画布 fig = plt.figure(figsize=(19.5,9.5)) # 单个子图的宽度 # 创建子图2:显示特定细胞类型的流动...
34fc028473c0e8f9bf7cd8caa166b5fb633a5343fe26539c35ed683e524f2736
Python
12,591
327
""" MSI Peak Processing Pipeline ───────────────────────────── Processes raw h5ad mass spectrometry imaging data through: 1. Global spectrum construction 2. Baseline correction (ALS) + Savitzky-Golay smoothing 3. Peak detection with minimum distance filtering 4. Per-pixel intensity summation around selected pea...
e592e11c52d6c26cbbffa2c29ddec411fd51b0b8fec43ece54852a9d0dab6a9d
Python
12,591
271
import torch from torch import nn from torch_geometric.nn import global_mean_pool def unsorted_segment_sum(data, segment_ids, num_segments): result_shape = (num_segments, data.size(1)) result = data.new_full(result_shape, 0) # Init empty result tensor. segment_ids = segment_ids.unsqueeze(-1).expand(-1, da...
2228c3e0a8b07631584933c85cb82fc698e8ce8a09f7a09d1f42a2c3c9bec5aa
Python
12,594
410
# TODO: add docstring import matplotlib as mpl from matplotlib import pyplot as plt from matplotlib.offsetbox import AnchoredOffsetbox class AnchoredScaleBar(AnchoredOffsetbox): def __init__( self, transform, *, sizex=0, sizey=0, labelx=None, labely=None, ...
04c160ea3bab63d52e7da8b90468e63dd7d4de5e427c463d86a9df6bca48af57
Python
12,596
369
""" AMASS dataset loader: SMPL .npz → normalized COCO-17 clips. Directory layout expected: amass/ ├── CMU/ │ ├── 01/ │ │ ├── 01_01_poses.npz │ │ └── ... ├── MPI_HDM05/ ├── SFU/ └── ... (other AMASS sub-datasets) Each .npz file contains: poses : (T, 156) SMPL-H pose p...
2a3e0c5e308b674a972ad9ffdfd44fb4cf666227d3d1b6ffa4f6fa0989818b0e
Python
12,598
348
"""Provide different loss or metrics classes for images.""" import tensorflow as tf from deepreg.constant import EPS from deepreg.loss.kernel import gaussian_kernel1d_size as gaussian_kernel1d from deepreg.loss.kernel import rectangular_kernel1d, triangular_kernel1d from deepreg.loss.util import NegativeLossMixin, sep...
a8d042f76acec855262dd4269f23707faa19c3c6ad5e9ce511f139884293b952
Python
12,598
393
"""Provider registry and readiness checks for the ChemGraph UI. One place that knows, for every way ChemGraph can reach an LLM, how to tell whether it is usable right now and which models it serves. Used by the Configuration page (provider cards) and the first-run setup on the main page. Streamlit-free and network-f...
6cf90a2c5dd6c1ad3c9e02f7126ecb21489cacd71ddd3a686f963b424fac1f9d
Python
12,600
348
#!/usr/bin/env python """ Classes that handles reading STORM movie files. This is used by the Steve program and it assumes the existance of an XML file that describes everything that one needs to know about a movie. Hazen 07/15 """ # # FIXME: Why not just use the version if the storm-analysis project? # # Or m...
2fb7212540cd8f4baeb499711b888bc39ffcea34f89ffd49f41e6af22fadb5ff
Python
12,602
283
"""Resuming a run from a previous analysis (``Params.prior_analysis``). MATLAB's ``MEApipeline.m`` lets you skip already-completed work: set ``Params.priorAnalysis = 1``, point ``Params.priorAnalysisPath`` at an earlier ``OutputData…`` folder and ``Params.startAnalysisStep`` at the step to resume from. Results still g...
42392c0d43e9f38687b6e083ef93f8bb3bee5139f533846629a20431ccb23d31
Python
12,604
333
#!/usr/bin/env python # -*- coding : utf-8 -*- """Tools for exporting DSIStudio-compatible outputs. Adapted from mattcieslak/dmri_convert/mrtrix_to_dsistudio.py to suit PyDesigner's needs. References ---------- 1. https://github.com/mattcieslak/dmri_convert/blob/master/mrtrix_to_dsistudio.py """ import os impor...
4cf22ad22c27c839f087eae60b647d684ab03c4b22ea7a97901e074cd1715dd8
Python
12,606
365
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from __future__ import annotations import base64 import json import logging import os from contextlib import AbstractContextManager from http import HTTPStatus from pathlib import Path from typing import TYPE_CHECKING, Any import urllib3 from cvat...
7b9d9ac650735161077f453efe5be2f4080f634e522695b79c1bd0fc58dbf323
Python
12,606
224
import json from chemgraph.schemas.agent_response import ResponseFormatter _response_schema_json = json.dumps(ResponseFormatter.model_json_schema(), indent=2) planner_prompt = """ You are an expert in computational chemistry and the **Planner** responsible for coordinating a parallel execution workflow. Your role i...
f16a9570598f6dac607ffadabcd7ac4e751f887d8128d3dccea4bb10ba8b35ca
Python
12,607
333
# -*- coding: utf-8 -*- import logging import os import tempfile import numpy as np from dipy.io.stateful_tractogram import StatefulTractogram from dipy.io.streamline import load_tractogram from scilpy import SCILPY_HOME from scilpy.io.fetcher import fetch_data, get_testing_files_dict from scilpy.tractograms.streaml...
ba38d83a25367980227c8c308fb49462d3458e2dae58949d1ae099c8d56192b9
Python
12,608
310
from pathlib import Path from typing import Callable import numpy as np import pandas as pd import json from meanap.params import Params, active_spike_method from meanap.pipeline.cancellation import CancelCheck, check_cancel from meanap.pipeline.progress import RunProgress from meanap.pipeline.resume import build_inp...
41fc3b7b343b5d571cdfd4e40ed303bf15eb586e71f4318e81de8a70bd0631c7
Python
12,609
347
""" Entrypoing """ import pathlib #If proto/thalamus.proto exists (implies we are in repo checkout) then regenerate protobuf interfaces if they are out of date from ..build import generate THALAMUS_PROTO_PATH = pathlib.Path.cwd() / 'proto' / 'thalamus.proto' THALAMUS_PROTO_GEN_PATH = pathlib.Path.cwd() / 'thalamus' /...
51eebf440ae9b8bf2040fdbcc3ae626f683f73e5eeda2ee87df355e12bfb1899
Python
12,609
315
#!/usr/bin/env python # Copyright (c) 2015 Tobias Neumann, Philipp Rescheneder. # # This file is part of Slamdunk. # # Slamdunk is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the #...