sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
e4f9be1386548d5156f7f56048c9b37698419aa0dfc396c01a7c50beaa48708b
Python
5,704
173
# Kai Sandbrink # 2022-10-01 # This script runs the decoding analyses for the Explore-Exploit Setting # %% LIBRARY IMPORTS import torch import os, copy import numpy as np from sklearn.linear_model import Ridge from sklearn.model_selection import train_test_split from sklearn.metrics import r2_score, mean_squared_err...
a493d226229049749f407878e688c4ffc7a84c70fc4956297462a9859cd55e9e
Python
5,705
173
""" Train and compare DLIM (Deep Latent Interaction Model) models on different datasets and environments. This script: 1. Loads data for a given dataset/environment combination. This script allows for data from Kemble et al. and Kinsler et al. 2. Trains multiple instances of DLIM with and without spectral regularizat...
86c8e04e3d8bd51758948173322bc37c75056d124a6cace837074faa7ac5ba0e
Python
5,706
145
import sys import importlib import pandas as pd import train_it_mdp as sv importlib.reload(sv) import torch import torch.nn as nn import torch.optim as optim from tqdm import tqdm import matplotlib.pylab as plt import n_choice_markov as mdp importlib.reload(mdp) import numpy as np from torch.utils.data import DataLoade...
b95a42472b4b5092c39121b5905df3060ca3e95719c99f82c25401da31c96016
Python
5,706
205
from typing import List import cv2 import numpy as np import torch import torch.nn.functional as F from scipy.spatial.distance import cdist from cv2.ximgproc import guidedFilter from PIL import Image # fushion stragety def low_pass(img, k=(30, 30)): 'img: np.ndarray, float32, 0-1' assert img.dtype == np.floa...
e07164295e19e77de1ffa104366bc876bdd07a97c22574890eed7564a5169f8f
Python
5,707
149
import numpy as np import pandas as pd from sklearn import metrics import scanpy as sc import ot from sklearn.decomposition import PCA import scipy.sparse as sp from sklearn.model_selection import train_test_split import torch from torch_geometric.data import Data import sklearn.neighbors def index_to_mask(index, size...
80a0624eb29f6a10569d8b26e5bfaa5b7c64df734b0871601ef7fc3847e7a1ba
Python
5,708
168
import os import pandas as pd import numpy as np import pickle import pkg_resources from ast import literal_eval class Architecture: def __init__(self, architecture, baseline_accuracy, ptq_accuracy, qat_accuracy, noisy_accuracy, analog_accuracy, baseline_drift_60, ...
096f67a2adc00f8da046cc98c0f79ad45bba434c26407eb5003d4eb7cf1e5333
Python
5,709
152
""" 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...
d2dff2b97624e69e3f1e68d09f4456435d0e22d2de362662aa4b46ea4d972d8e
Python
5,709
197
import math def add_vec(u, v): return (u[0] + v[0], u[1] + v[1]) def norm_vec(v): return math.sqrt(v[0] * v[0] + v[1] * v[1]) def sub_vec(u, v): return (u[0] - v[0], u[1] - v[1]) def rot90_vec(v): return (v[1], -v[0]) def scal_vec(alpha, v): return (alpha * v[0], alpha * v[1]) def unit_v...
74baa26e1076a1712e8628823c391af318d2ea579ed2a38b0d589416090feecd
Python
5,712
176
#!/usr/bin/env python """ A TCP communication class that acts as the server side for generic communications between programs in the storm-control project Jeff Moffitt 3/8/14 jeffmoffitt@gmail.com Hazen 05/14 """ import sys from PyQt5 import QtCore, QtGui, QtWidgets, QtNetwork from storm_control.sc_library.tcpMessag...
a04378300082131ef815c49b7e12685614c13ce97fa3eaef471e28901ea04fe7
Python
5,712
157
import unittest import numpy as np import torch import torch.nn as nn import torch.testing as ptt from torch.utils.data import DataLoader from deepdwi import fourier, util from deepdwi.dims import * from deepdwi.recons import zsssl if __name__ == "__main__": unittest.main() devices = [torch.device('cpu')] i...
be568a093bf9e8556b8039ee376a27b6e89a6b3d06c1c7b90ca050fa9ac8de7b
Python
5,712
142
import platform import sys from glob import glob from setuptools import ( Extension, setup, ) def main(): metadata = {"scripts": glob("scripts/*.py")} if len(sys.argv) >= 2 and ( "--help" in sys.argv[1:] or sys.argv[1] in ("--help-commands", "egg_info", "--version", "clean", "sdist") ): ...
6d13b84e889ce60345c866cb16b65a1d051976c0afb959c61b7aae0f223f2aeb
Python
5,713
175
#!/usr/bin/env python """ Analyze frames using QRunnables and QThreadPool. Hazen 05/17 """ import time from PyQt5 import QtCore import storm_control.hal4000.halLib.halModule as halModule import storm_control.hal4000.spotCounter.lmmObjectFinder as lmmObjectFinder class AnalysisWorker(QtCore.QRunnable)...
e3069d7f6f963056f01739b464052674706b1cbf70e1c49348c3a45ce9ff83ab
Python
5,714
152
""" 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...
8d22e5524caa2a241d1419f09e2104efa38f514d481e6446b944948e9f33bf99
Python
5,716
163
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter from torch.nn.modules.module import Module from .GAT import GATConv from.preprocess import fix_seed class Discriminator(nn.Module): def __init__(self, n_h): super(Discriminator, self).__init__() ...
7148c30970b0722aaa33ddbb419e1d53836e3091a66147f62636b64da1f6d924
Python
5,717
134
# import brain-score specific libraries from brainscore_core.supported_data_standards.brainio.assemblies import NeuronRecordingAssembly from brainscore_vision import load_dataset, load_ceiling, load_metric from brainscore_vision.benchmark_helpers.neural_common import NeuralBenchmark, average_repetition from brainscore_...
1ca5f7dff0b9b3eecc098d2cc6864ef4f06e727916d161e219481c05ae6beb98
Python
5,718
269
# 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]uni-rostock.de # # This program is free ...
4e1da59f4cb25e042fd0ee1d30f1ded0af4ee529a27e8ef94b3f79593205e68e
Python
5,718
128
#!/usr/bin/env python """ 单折训练脚本(随机 8:2 划分),支持 FocalLoss / BCE 与 CC-Head """ import argparse import random from pathlib import Path from typing import List import numpy as np import torch from torch.utils.data import DataLoader, WeightedRandomSampler import config from dataset import StrabismusDataset from models.ml...
58adf6107ffbe8cf073d03da21c804e38fde8593695542ef7ae5e7c32d86f333
Python
5,719
175
'''EfficientNet in PyTorch. Paper: "EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks". Reference: https://github.com/keras-team/keras-applications/blob/master/keras_applications/efficientnet.py ''' import torch import torch.nn as nn import torch.nn.functional as F def swish(x): return x ...
61cda632c12be96f1cbb351a7f7f113fd38acc265bb4c28b4b68238fbe17be67
Python
5,719
155
import torch import numpy as np import ogb from ogb.linkproppred import LinkPropPredDataset import matplotlib.pyplot as plt from scipy import stats def plot_nodes(nodes, data, str="train"): # generate unique node lists u, indices = np.unique(nodes, return_index=True) x = [] y = [] z = [] for...
9e2f3d29c19d906ac2904a68c22468fa16471eadf37d2231453732231e87734a
Python
5,720
121
import argparse import utils import keras from keras.models import load_model from os.path import join import numpy as np import gc ''' Get the average of the predictions from all ResidualBind models in an ensemble if --eval flag set, evaluates ensemble avg prediction performance on test set if --distill flag set, ave...
48bf9b1d9b640217cbf6bb0cd4cb20a76842b5ee4845097f80b1c167eac69baa
Python
5,721
199
import os import numpy as np import pandas as pd import datetime as dt import sklearn.metrics as mt from pathlib import Path from tqdm import tqdm from sklearn.linear_model import LogisticRegression from sklearn.svm import SVC from sklearn.pipeline import Pipeline from sklearn.preprocessing import StandardScaler datas...
edd18cab09a55ba2a28c11951f4652ed9e547aa1785d4c8ddbbce6f8decfc532
Python
5,722
166
import numpy as np import scipy import ot from .glmpca import glmpca import anndata as ad import scanpy as sc from scipy.spatial import distance def filter_for_common_genes(slices): """ param: slices - list of slices (AnnData objects) """ assert len(slices) > 0, "Cannot have empty list." co...
1e78ff95a0a8d95acb80daac25168c10502ab7c296a1b5fe19f197c0d5103695
Python
5,725
190
# Copyright (C) 2022 Intel Corporation # Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from enum import StrEnum from django.conf import settings from cvat.apps.iam.permissions import OpenPolicyAgentPermission from .models import Membership class OrganizationPermission(OpenPolicyAgentPermissio...
f6bb83726a7c75597b488d5f9fff7ef6a7fc4135644d60f2e27900149959e59b
Python
5,725
146
import pandas as pd import numpy as np from causallib.positivity import BasePositivity from sklearn.linear_model import LogisticRegression OPTIMAL_THRESHOLD_ACCURACY = 5e-6 def _check_is_valid_threshold_value(threshold_value): if not isinstance(threshold_value, (float, type(None))): raise ValueError("inv...
1c2cb02a1d854bc578c8dd0497594b774b6ef5e9dc0d07378328b03735d82cc9
Python
5,727
172
# This file is part of Mooney computational modeling project. # # Mooney computational modeling project is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) an...
452c0bb786c8bff47e02f6cc0b7758d9d2548b30c97c34662480c2df48128972
Python
5,727
206
"""Functions for running full pipelines via the config API. See the documentation for :mod:`osl_dynamics.config_api` for example usage. """ import argparse import logging import pprint from pathlib import Path from typing import Callable, Dict, List, Optional, Union import numpy as np import yaml from osl_dynamics....
cdbe3e71d4adde9f527080d927ebbc221115363d21066bde3f8ea700f75b9104
Python
5,727
180
from ..qt import * import typing import asyncio import collections from .. import thalamus_pb2 from ..task_controller.util import create_task_with_exc_handling class ChannelsList(typing.NamedTuple): node: str channels: typing.List[str] sample_intervals: typing.List[int] class ChannelsDataModel(QAbstractItemMod...
8ab65244ad44604d0341d600c3f3b645e95d829e8c28d2261e3aaac2b8e47fff
Python
5,729
186
#!/usr/bin/env python3 # This script is included in documentation. Adapt line numbers if touched. import arbor as A from arbor import units as U import pandas as pd # You may have to pip install these import seaborn as sns # You may have to pip install these from math import sqrt # Construct a cell with the followi...
9628961746d006a4989cc4677c22432e75ceb62c2e46dfbe9ee91dc106246ba9
Python
5,729
134
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Oct 3 11:00:46 2025 @author: rl05 Plot Supplementary Figure - Bayes Factor time series """ import sys import os import os.path as op import pandas as pd import pickle import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from mat...
4b2f34320c76aa03dc7c1fc09a1de0ef1d15a3f26468aba15728b93b7275ddd3
Python
5,730
167
import numpy as np import sys, os, string, inspect, types, glob, fnmatch, re, copy, shutil import signal, time, errno, socket, platform, tempfile, traceback, stat import distutils.spawn, operator, tarfile from optparse import OptionParser import math import json import random #-----------------------------------------...
dd47d7aad4684870819449f50ac4460d9092ffe7793d60ece8ef59a628cf7876
Python
5,730
121
import pytest from qtpy import PYQT6, PYSIDE6 from tests.utils import pytest_importorskip @pytest.mark.skipif(PYQT6, reason="Not complete in PyQt6") @pytest.mark.skipif(PYSIDE6, reason="Not complete in PySide6") def test_qt3drender(): """Test the qtpy.Qt3DRender namespace""" Qt3DRender = pytest_importorskip(...
17abb584bc3489cdab3425f7e471d729499edb810fb764bf1d23447e787c7d0d
Python
5,732
165
''' CH4_H2O_H2O ''' import numpy as np import sys def intro(): print(""" SHORT List of potential energy surfaces for CH4_H2O_H2O: 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 potent...
69decdcb1635c5f449ea110d9dee8ed79420dd2dd076ea24415e3d4b4d098109
Python
5,732
137
import numpy as np from dipy.core.gradients import gradient_table from src.wrappers.OsipiBase import OsipiBase from src.original.fitting.IAR_LundUniversity.ivim_fit_method_biexp import IvimModelBiExp class IAR_LU_biexp(OsipiBase): """ Bi-exponential fitting algorithm by Ivan A. Rashid, Lund University """...
209352275451fd7475e5d50f2a3df7d197d9be4a7c81080db9eee526f03debd7
Python
5,734
200
""" Functions for plotting results from a mean-centered PLS """ import numpy as np import pandas as pd import seaborn as sns def _set_group_lvls(n_conds, n_grps, grp_lvls=None): """ Derives a pandas data series of group labels Parameters ---------- n_conds : int Number of conditions in t...
48f067d3368e5c02f18ef8281c7d8282d505480175478878da4b554a2f27d2be
Python
5,734
157
import sys import yaml import os import numpy as np import pandas as pd import matplotlib as mpl from matplotlib import pyplot as plt pathpath,myrun = sys.argv[1:] #pathpath = 'PATHS/filepaths_carlen.yml' #myrun = 'runC00dMP3_brain' with open(pathpath) as yfile: pathdict = yaml.safe_load(yfile) rundict_path = pat...
ac1b4ebf9fbee8e0ecbc58c818695a9d4707775f65da9326c1de09e784cf2588
Python
5,735
139
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import os.path as osp from tempfile import TemporaryDirectory from datumaro.components.dataset import Dataset from datumaro.components.errors import DatasetError, DatasetImportError, DatasetNotFoundError from django.test import SimpleTestCase from ...
200b144dca39fc2f82a30964ceb5b9caf1321478134a718cf0dc606fa95e79e5
Python
5,737
152
# %% # importz import os import av import cv2 as cv import numpy as np from numpy.core.fromnumeric import reshape from PIL import Image, ImageOps from tqdm import tqdm # %% # Functions for numpy videos # resize needs to be a tuple of width, height def read_and_resize_video_frames(path, resize = None): frames = [...
4ceaeb964dca920ab47e107e0a5fa6744a21b9b9932fa5c11cac566a21937a60
Python
5,738
130
""" HiP-CT Registration Helper Functions """ import os import numpy as np import skimage.io as skio import json import glob import tqdm import natsort import SimpleITK as sitk def convert_16_to_8(im_itk_arr): """ This function converts 16-bits itk stack to 8-bits itk stack Args: im_itk_arr: 16-bits...
7e81d2d921ba9f7fa0b794beadbf797c49ba9786ff9ec2ba30aef3c4c0bf1dcb
Python
5,738
119
import numpy as np from result_caching import store from brainscore_core.supported_data_standards.brainio.assemblies import DataAssembly from brainscore_vision import load_dataset, load_metric from brainscore_vision.benchmark_helpers.properties_common import PropertiesBenchmark, _assert_grating_activations, \ calc...
df623c717482d7a43adadb5bbe386ced3f937476175df39adb8eba45796a3f17
Python
5,738
123
# wfield - tools to analyse widefield data - decomposition # Copyright (C) 2020 Joao Couto - jpcouto@gmail.com # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Licens...
17e93ae85ed5570d76f5811ab0982d7fdb503569cbf47251ce232692d8788cbd
Python
5,739
172
import os import numpy as np import pickle import pkg_resources from ast import literal_eval class Architecture: def __init__(self, architecture, baseline_accuracy, ptq_accuracy, qat_accuracy, noisy_accuracy, analog_accuracy, noisy_drift_60,noisy_drift_3600,noi...
cf445650530fe9b59211487fc831e3ee409143bf6cb13f7dacd84a15f0728da6
Python
5,740
161
""" Kinematic dynamics: velocity, acceleration, angular displacement. Ported from utils/kinematics.py (Chambers et al. 2020 pipeline). """ import numpy as np import pandas as pd def get_delta(df: pd.DataFrame, inp: str, outp: str) -> pd.DataFrame: """Frame-to-frame difference of column `inp` → stored in `outp`....
f3966978c330c89187ad43d9d876e31281a0ba03ee3ba590ba02b776e3fac7b2
Python
5,741
194
""" Stochastic Gates Layers and Models Adapted from: https://github.com/runopti/stg Original authors: Yutaro Yamada https://github.com/runopti License: MIT Modification: - introduced warm_start as mu-gates initialization """ import math import numpy as np import torch import torch.nn as nn from stg_PopPK.utils impo...
24bb4c3d9f669e55b2575a5685eea6d62ad00586e0d88d8d0feb8af7168976dc
Python
5,742
89
import seaborn as sns from Utilities_and_Loading import * def define_global_variables(script_vers): my_general_parameters = {} # Paths my_general_parameters['data_path'] = '../../Data/' vars_path = '../../Results/variables' figures_path = '../../Results/figures' my_general_parameters['vars_path...
e478e7c18100409a98ccbad24412c41e678993cc89b077e18e686499b9a91db7
Python
5,747
168
import h5py import logging import numpy as np import pandas as pd from scipy.linalg import cho_solve, cho_factor import heig.input.dataset as ds def check_input(args): # required arguments if args.bases is None: raise ValueError("--bases is required") if args.ldrs is None: raise ValueError...
4da4b62dc2bd1c522d28ee064408a4f6fac7cdc1200619c94da680075d353cc2
Python
5,748
154
""" Classes and functions for fitting ivim model """ import numpy as np from scipy.optimize import lsq_linear from dipy.reconst.base import ReconstModel from dipy.reconst.multi_voxel import multi_voxel_fit from dipy.utils.optpkg import optional_package from scipy.signal import unit_impulse class IvimModelL...
6c22122ee73eb84f3d25ebae2987dd4caa6adcce1faa74de29d5a1f1f70c4858
Python
5,749
146
"""Test the functions in the yasa/hypno.py file.""" import unittest import matplotlib.pyplot as plt import numpy as np import pandas as pd import pytest from pandas.testing import assert_frame_equal import yasa from yasa.hypno import Hypnogram, simulate_hypnogram from yasa.hypno import _hypno_find_periods as hfp hy...
3eb8fd8b80613901c183efec07c78965f7002944818893560c9ac86a390e3dbe
Python
5,751
148
import datajoint as dj from pipeline import experiment from commons import lab from datajoint.jobs import key_hash import os import numpy as np from .utils import h5, signal from .exceptions import PipelineException from . import notify schema = dj.schema('pipeline_temperature') @schema class Temperature(dj.Import...
51a3d0c58d7e25835dafe4312cf465fb18f9517233a22fb2bfe38bab2d0a2957
Python
5,751
132
import torch import numpy import pandas as pd import torch_geometric.transforms as T from torch_geometric.data import Data, InMemoryDataset import os ## Define "Dataset" class based on ordinary Python list. class SpatialOmicsImageDataset(InMemoryDataset): """ Spatial omics dataset loader for HRCHY-Cy...
b6ab540c247e2a19cb659a2c642e616a9746324f2a0032bad2dd73c0d8734f01
Python
5,751
139
""" HMM: Summary Statistics ======================= A useful way of characterising the data is to use statistics that summarise the state time course, these are referred to as 'summary statistics'. The state time course captures the dynamics in the training data, therefore, summary statistics characterise the dynamics...
2cf2fa8563a511c53e395889302fb8da625e5237b64d090d0ba965b09238616b
Python
5,752
156
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2023/6/3 15:23 # @Author : SONG-LE # @知乎 : https://www.zhihu.com/people/xiao-xue-sheng-ye-xiang-xie-shu ''' 封装画图的算法 ''' import matplotlib.pyplot as plt import numpy as np import os import scienceplots # 判断图片目录是否存在 #fdir = r'E:\Projects\WMH_segmentation\derivative...
46e75495575faeb60d0642c057c896a023a916b088ec1d3761e99a6fd4f26827
Python
5,752
154
import torch from torch import Tensor import torch.nn.functional as F from typing import Dict, Tuple, Union, Sequence, List from typing import Tuple @torch.jit.script def _compute_zero_padding(kernel_size: List[int]) -> Tuple[int, int, int]: r"""Utility function that computes zero padding tuple. Adapted from K...
0380ec8c56820d575cebb6e8a0410b0152d89ff8cd4ba804b20a9d15e9efbe30
Python
5,753
166
''' AOSLO systen ------------------- For creating an AOSLO object matched to a user's system. ''' import numpy import yaml from scipy.interpolate import interp1d class AOSLO: ''' An AOSLO class. Instances of this class are AOSLO objects with parameters specified in the system parameter yaml file ...
28a8e220431e1f06699429531b2ea2395b575e478ad1aef3dc6892aae9206205
Python
5,753
142
import scanpy as sc import pandas as pd import numpy as np import scipy import os from anndata import AnnData,read_csv,read_text,read_mtx from scipy.sparse import issparse import random import torch from Spa3D import Spa3D def preprocessing_filter_by_gene_number(adata,min_counts=None,max_counts=None,min_cells=10,max_c...
b744ece2dcd41342d0c81afbd62da20634032def4d5a499545fec2e313a59497
Python
5,753
189
import logging import threading from abc import ABC, abstractmethod from typing import Any, Callable, Dict, List, Optional from torch.distributed import rpc from torch_geometric.distributed.dist_context import DistContext, DistRole try: from torch._C._distributed_rpc import _is_current_rpc_agent_set except Excep...
242ae55fa5199a7114315881f36a0ffe635c9ed0da0c13d40c9b654685b30489
Python
5,754
135
import os import pandas as pd import numpy as np import scipy.sparse as sp import torch import random from six.moves import cPickle as pickle from torch_geometric.data import Data from torch_geometric.utils import to_undirected, remove_self_loops from sklearn.model_selection import StratifiedShuffleSplit import imblear...
a8845d346e7a891f855ea4e49508342ac44898b48a469c43391bb12c7dea34d5
Python
5,756
102
montreal_idx = { 1: ((0, 2, 3, 7, 8, 13, 17, 1, 4, 5, 6, 9, 10, 11, 12, 14, 15, 16, 18), (19, 21, 22, 26, 27, 32, 36, 20, 23, 24, 25, 28, 29, 30, 31, 33, 34, 35, 37)), 4: ((0, 2, 3, 7, 8), (13, 17), (1, 4, 5, 6, 9, 10, 11, 12), (14, 15, 16, 18), #left (19, 21, 22, 26, 27), (32, 36), (20, 23, 24,...
f7ff78006ba9780fc36172e3edf1e1802e86eadd56ea0cf831a30e398c515d6b
Python
5,757
100
planner_prompt = """ You are an expert in computational chemistry and the manager responsible for decomposing user queries into subtasks. Your task: - Read the user's input and break it into a list of subtasks. - Each subtask must correspond to calculating a property **of a single molecule only** (e.g., energy, enthal...
622245a80a87cbc7b4a33e6381ef6c4e83a97c8ed5cb974dc528b2be66665a6a
Python
5,759
141
import numpy as np import pyvista as pv from pathlib import Path COARSE = '/mnt/home/naghavis/Documents/Research/DeepCardioSim/deepcardio/LVmean/LV_mean.vtk' RR1_FILE = '/mnt/home/naghavis/Documents/Research/DeepCardioSim/deepcardio/LVmean/LV_mean_RR1.vtk' RR2_FILE = '/mnt/home/naghavis/Documents/Research/DeepCardioSi...
5f2fe537fcc8d1a7d7c63e7ae760727bd41f842206673f3dd1dc76b692d4c846
Python
5,761
126
import nighres import os import nibabel import numpy import glob inpath = '/home/pilou/Datasets/Sereno_cb2020/cerebmap20/mri/' outdir = '/home/pilou/Projects/Cerebellum/Cerebellar-segmentation-ABC/sereno/coreg/' T1_img = inpath+'orig.mgz' T2_img = inpath+'T2.mgz' PD_img = inpath+'PD.mgz' mni09c = '/home/pilou/Data...
0db56dffe29c88deac92396966aaf17bce4b73125094556575af91b370e263a0
Python
5,762
209
import numpy as np import numpy.typing as npt import ase from modules.tools.system_cutoff import ( find_closest_atoms_to_mol, find_closest_pair_of_atoms ) """ Parameters for all descriptors: ------------------------------- descriptor: descriptor binary data site_size: site size parameter mol_path: path to molecule...
852a7f93f3a0711047f7be6cad2742dad8fb0471ac3ea61d9a562b1fd6f4868c
Python
5,762
179
""" Distributed training/validation utils Hacked together by / Copyright 2020 Ross Wightman """ import logging import os from typing import Optional import torch from torch import distributed as dist from .model import unwrap_model _logger = logging.getLogger(__name__) def reduce_tensor(tensor, n): rt = tenso...
2190abedadb075a73968f026070abe261b47185138428d17e3ed2fc09f2b3089
Python
5,764
266
#! /usr/bin/env python # aponteeduardo@gmail.com # copyright (C) 2017 '''' Contains functions related to the parameters. ''' from . import containers from . import reparametrize as reparam from . import likelihoods class Parameters(containers.AlgebraicObject): ''' Abstract class. ''' @classmethod ...
bf989b884c4234e57d1f0795266fa805455ea4574ad94c27c3173ff4d5b3d58e
Python
5,765
126
from causallib.estimation.base_weight import WeightEstimator from .univariate_curve_fitter import UnivariateCurveFitter from sklearn.base import BaseEstimator as SKLearnBaseEstimator from typing import Any import pandas as pd from copy import deepcopy from .survival_utils import canonize_dtypes_and_names from .base_sur...
3f36aaa52fec77af4e02e3bc0c184da3b578e570111f7304e46dc89849aa77d4
Python
5,767
158
#!/usr/bin/env python """ HAL module for controlling a Marzhauser stage. Hazen 04/17 """ from PyQt5 import QtCore import storm_control.hal4000.halLib.halMessage as halMessage import storm_control.sc_hardware.baseClasses.stageModule as stageModule import storm_control.sc_hardware.marzhauser.marzhauser as marzhauser ...
f798cd1a3e70802afa6183bae9815b0ed268d2b8c6683448758e763efa93872b
Python
5,768
171
from pathlib import Path from typing import Optional import click import numpy as np import pyvista as pv import scipy import skimage from loguru import logger from simple_mri import SimpleMRI, load_mri from brainmeshing.utils import binary_image_surface_extraction from gmri2fem.utils import largest_island, segmentat...
0b557d3bb5788126538d7866da57e9521c511b583ad1f99e0560d2be31a36ee3
Python
5,770
117
from collections.abc import Sequence import colorama as clr def log_and_raise_missing_or_multiple_config_matching_general( train_name: str, train_type: str, matches: Sequence[dict], predict_names_and_types: Sequence[tuple[str, str]], name: str, ) -> None: assert name in ("input", "output") ...
f0d9b93a06eeb810297bcb6aaba73c9f0da5fcbdf141b5d7997cf204dccdefce
Python
5,770
158
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Prepare a typical command for topup and create the necessary files. The reversed b0 must be in a different file. """ import argparse import logging import os import subprocess import nibabel as nib import numpy as np from scilpy.io.utils import (add_overwrite_arg, ...
fad281866eefd32f78a7ec93d1852a20f43bad80b53b7aa9c723c93fd96451d1
Python
5,770
151
#! /usr/bin/env python """Label connected components of membrane graphs for per-region statistics. Each connected component of a triangle graph is given a unique integer id in a `component_number` vertex property. This parallels the `patch_number` property written by generate_patches.py, so the same downstream per-re...
de123f9fd89b54c04d7ceab4ba8fa2582fe1bfa84bde4df5e81cdf385f8111ef
Python
5,771
161
"""Layer thickness measurement, against streamlines whose layers we chose. The layer memberships are assigned voxel by voxel here, so the returned start, end and thickness are all derivable by hand: a straight path of unit-spaced voxels at 10 micron resolution puts layer *i* between 10*i and 10*(i+1). """ import nump...
c5d9efd23a4d3a47a8c4ac04d673b6547f385d52b8e77a1dd755a65f6d245046
Python
5,772
197
import asyncio from typing import Literal, Type import numpy as np import obspy import pytest from matplotlib import pyplot as plt from seisbench import models from seisbench.ext.utils import get_edge_indices from seisbench.models.base import _trim_nan, _trim_zeros from seisbench.models.utils import PredictionSegment...
0349dfbfc6aa58f82cbceca782ec46dbb4f1d1c06ceec4ddf49ad95f6b80af4c
Python
5,774
173
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ plot_bland_altman_corrected.py 生成“回归式偏倚校正”后的 Bland–Altman 图,完整消除恒定偏倚和比例偏倚, 并将 95% 限度(Limits of Agreement)收窄至 ±1.96 SD。 用法: cd StrabismusRegression/tools python plot_bland_altman_corrected.py 输出: results/figs/bland_altman_proportional.png """ import ...
3c081b1b73cae03e0b317e98bd2daf99e772786712a59f1e5d47e12295919ba1
Python
5,774
112
""" This scripts generates 3 examples where we try to regress LR T2 scans into HR T1 scans. We assume here that HR label maps are available with corresponding T1 scans. Thus this script produces pairs of real HR T1 scans along with aligned HR synthetic scans, simulating LR T2 scans. If you use this code, please the S...
51a60655980665a8a0e942d341d6c40b146577e561e2a49da750c8f09859258f
Python
5,774
164
""" Compare rigid registration: legacy (so(3)) vs quaternion implementation. For rotation angles in [5, 10, 15, 30, 45] degrees, we sample a random 3D axis, rotate the fixed image and segmentation by that rotation, then run both RigidRegistration (quaternion) and legacy RigidRegistration (so(3)), and assert mean Dice ...
a6b20f15c9adb9d3cf7c6998f3af194f8be3396c126442c09be1ebf936996098
Python
5,774
192
#!/usr/bin/env python3 from collections import defaultdict from dataclasses import dataclass from typing import Optional import json import arbor as A from arbor import units as U import seaborn as sns import pandas as pd import matplotlib.pyplot as plt from pathlib import Path here = Path(__file__).parent # (3) A ...
d159795796bfbead67475b17590c306235b5c5a37f0386493fbee931fc91e77e
Python
5,774
184
import pandas as pd import numpy as np import argparse import matplotlib.pyplot as plt parser = argparse.ArgumentParser(description='Preprocess edge list') parser.add_argument('-e','--edge_list', help='Edge List to be processed.', required=True) parser.add_argument('-n','--node_list', help='Node List to be processed.'...
f8c3b4f0ec3c0fbec4e0fdadad5309f5fb5f8a6e6bc27fb7b131038bcaf8722a
Python
5,775
164
import argparse import h5py import os import matplotlib.pyplot as plt import numpy as np DIR = os.path.dirname(os.path.realpath(__file__)) HOME_DIR = DIR.rsplit('/', 1)[0] HOME_DIR = HOME_DIR.rsplit('/', 1)[0] print('> HOME: ', HOME_DIR) DATA_DIR = HOME_DIR + '/data/' print('> DATA: ', DATA_DIR) # %% parser = argp...
660c899b72270bbfd21c738d719ba0a91b301302e4bb72808b6d4fe321a76c78
Python
5,776
142
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Plot all mean/std per point for a subject or population json file from tractometry-flow. WARNING: For population, the displayed STDs is only showing the variation of the means. It does not account intra-subject STDs. """ import argparse import itertools import json im...
e6b211da925f8e6548a04bb435a1a6723b3158fbafde7a7536af10110ef64782
Python
5,777
198
import torch import torch.nn as nn class Squeeze_Excitation(nn.Module): def __init__(self, channel, r=8): super().__init__() self.pool = nn.AdaptiveAvgPool2d(1) self.net = nn.Sequential( nn.Linear(channel, channel // r, bias=False), nn.ReLU(inplace=True), ...
2a1030854941b82d912fd4c1949a55aac94825acb448264d5e766d0afdcb1b16
Python
5,778
136
import warnings import torch from torch import optim from featurevis.exceptions import FeatureVisException def gradient_ascent(f, x, transform=None, regularization=None, gradient_f=None, post_update=None, optim_name='SGD', step_size=0.1, optim_kwargs={}, num_iterations=1000, ...
a22fbbc5537cc9323aa5aaad54d3c1f4a7dfcb1fba2e98f51ec2debaa9265c69
Python
5,779
130
"""A module that contains unit tests for the :py:mod:`corelay.processor.embedding` module.""" import typing from importlib import import_module import numpy import pytest from sklearn.datasets import load_digits from sklearn.metrics.pairwise import euclidean_distances from sklearn.utils import Bunch from corelay.pro...
6a71cfa0bee7ad24c30197d1d6db908730a90ae39c6b03be6b34ab466c6d0774
Python
5,780
157
# -*- coding: utf-8 -*- # genbed: A Python toolbox for generative embedding based classification # Copyright 2019 Sam Harrison # Translational Neuromodeling Unit, University of Zurich & ETH Zurich # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public L...
7fd8a9e122992b2983eb70f0ca922d0c1ea69a501691188874a54a04ce9e0f72
Python
5,780
163
# vessap open graph benchmark dataset import os import os.path as osp import sys import sys sys.path.insert(0, '../') sys.path.insert(0, '../../') sys.path.insert(0, '../../ogb') import torch import numpy as np import pandas as pd import scipy import argparse import networkx as nx import torch_geometric.transforms as...
11e6106af46977a8dc61b0ffc41600f3e6a92df8824a076a0dc148ea6320a232
Python
5,781
160
# This file is adapted from: # https://github.com/txie-93/cgcnn.git import torch import torch.nn as nn import torch.nn.functional as F from torch_geometric.nn import MessagePassing class ConvLayer(nn.Module): """ Convolutional operation on graphs """ def __init__(self, atom_fea_len, nbr_fea_len)...
cb3c1f6860e1fbbf730ddbafe4a3418a3d328dbd415f6768402febe8895b11bf
Python
5,781
148
from PySide6.QtWidgets import ( QWidget, QPushButton, QGridLayout, QLineEdit, QCheckBox, ) class NavigationControls(QWidget): """ Reusable navigation/control widget used across multiple GUIs. Provides: - processFolderButton: main action (e.g., Play / Process Current Folder) - ...
1485be3c3ae583a9dfc6b5a00a61e75529d734a8ccbc3a74528afffcd266127a
Python
5,782
188
import logging import matplotlib.pyplot as plt import xml.etree.ElementTree as ET import mne import numpy as np from iso_analysis.utils import bootstrap_ci def plot_iso_single_subject_save(iso_df, subject_id, save_path): """ Generate a single combined ISO plot for all channels and save the plot image. Pa...
7fc30e389b08767c790951abe1a115873c6a4e20f350b60c31d5879678f39353
Python
5,783
149
""" A simple plugin just to change the order of the slices """ from PyQt5 import QtWidgets from lasagna.plugins.lasagna_plugin import LasagnaPlugin from lasagna.plugins.registration_plugins import reorder_stack_UI from lasagna.plugins.registration_plugins import selectstack_UI class plugin(LasagnaPlugin, QtWidgets.Q...
b7b4951d992bfef5c71a68a2298738a86cc75e9a8f3c5ce6106cd9ceda0b3251
Python
5,784
148
############################################################################# # Copyright (C) 2020-2026 MEmilio # # Authors: Henrik Zunker # # 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 Lice...
40eb4d907d1fd9ef29d7358b473fa07a1e8f9142949b3429f95f5ffc235e44b4
Python
5,786
149
# -*- coding: utf-8 -*- # python standard library inputs import os import sys from collections import Counter # external inputs import numpy as np import nibabel as nb from nibabel.freesurfer.io import read_geometry from skimage import measure from nighres.surface import probability_to_levelset from nighres.laminar i...
ccfe99da518c5a8df5fe0077287f3c4acdf2157d63c355db7f01e11cf1579d18
Python
5,786
197
import logging import os.path as op from enum import IntEnum from time import time import numpy as np from scipy.ndimage import ( binary_dilation, distance_transform_edt, gaussian_filter, ) from skimage.segmentation import find_boundaries from AFQ.data.fetch import afq_home, fetch_babyseg_models from AFQ....
aabae215c5474913be5887ce64c1d832f5f60b0e3c49c89a058fd3dfc91e03b3
Python
5,787
133
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations from pathlib import Path from typing import Any import torch from torch import nn from ultralytics.utils import IS_JETSON, LOGGER, is_jetson from ultralytics.utils.torch_utils import TORCH_1_10, TORCH_2_1, unwrap_...
0d9e7b43155688f8613a319a378ef71db85f5f6c7dd2fda6868cd6cb1e06e8cf
Python
5,789
188
import time import json import math import enum import struct import typing import threading import queue as thread_queue import random import logging import datetime import asyncio import functools import subprocess from ..resources import native_exe from ..config import * import pathlib import grpc from .. import u...
9603ab2fa3e0878065696d15f304bdcb8d24ce34b15a10cf7105e6984992f189
Python
5,789
142
from typing import NamedTuple, NewType __all__ = ['CodeAlias', 'HEADER', 'CodeInfo', # 'CELLULAR_IO', 'WFIELD_IO', 'BEH_IO', # 'get_headers_from_code'] CodeAlias = str HEADER = NewType('HEADER', str) def h(*header: str) -> list[HEADER]: return [H...
1c8cdcfcf01b10f28a20da3b4bc626cb81a9754ef16264b4c0110e981f153aea
Python
5,791
163
""" 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...
0ce0bde417b1f39a96380fb7ee402f6dd0945ed3ebd3baceeb8b54763af37132
Python
5,792
178
import numpy as np from sklearn.preprocessing import LabelEncoder from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score, f1_score from xgboost import XGBClassifier import pickle from pstimutils import PertStimDataSimple from perturbation1 import * def downsample_to_...
ab824bffd0f3d9adfe299edb7d4577f77780787593c577fdb8ad7c575fe9d280
Python
5,794
167
import seaborn as sns import matplotlib.pyplot as plt import numpy as np import pandas as pd import os import argparse parser = argparse.ArgumentParser( 'Visualize the distribution of learned edges between residues.') parser.add_argument('--num-residues', type=int, default=146, help='Number of ...
b91ab6d670a0a2cb42da313a48a7e9db1218e3f06dad7386e581db59410fbf5d
Python
5,794
134
import warnings import torch from torch import Tensor import torch_geometric.typing from torch_geometric import EdgeIndex from torch_geometric.typing import Adj, SparseTensor, torch_sparse from torch_geometric.utils import is_torch_sparse_tensor, scatter def spmm( src: Adj, other: Tensor, reduce: str = ...
61f4d29a18a0f0bb6056dfa5da4e40b7994cf5051bda99d2ec8653279b2ba6f0
Python
5,795
117
# Copyright 2025 BrainX Ecosystem Limited. 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 required by appli...
07006e37b546a143f73255bcae3b12f6a0762a805f2d90770c60f889ff3e0e7f
Python
5,797
179
# Implementation following https://www.pyimagesearch.com/2021/11/08/u-net-training-image-segmentation-models-in-pytorch/ import torch import torch.nn as nn from torchvision.transforms import functional as T from torch.nn import functional as F from pli_cyto.models.components.distributed import RunningNorm2D class B...
2de9ca4b1289d058a43cc1dc9f36abfec2857c8b5be4fe190346990352818009
Python
5,797
147
import numpy as np import pandas as pd from scipy.stats import norm from sklearn.metrics import roc_auc_score, make_scorer from sklearn.naive_bayes import GaussianNB from sklearn.model_selection import cross_val_score, cross_val_predict, LeaveOneOut from pipelines import preproc_pipeline # from .util import short_feat ...