sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
3ad0e39b11fcce88b63b878f1a01e652c4a703c5a1bd6f097d38233c1b82b428
Python
1,368
54
import argparse from datetime import datetime from deepreg.train import train name = "paired_mrus_brain" # parser is used to simplify testing # please run the script with --full flag to ensure non-testing mode # for instance: # python script.py --full parser = argparse.ArgumentParser() parser.add_argument( "--te...
a28cdf98091a881f1a77d21ac07c12d362f97be5738d65eb788bead2afcaeffa
Python
1,368
45
from dataclasses import dataclass from typing import TYPE_CHECKING import torch from torch import nn if TYPE_CHECKING: from eir.setup.output_setup_modules.tabular_output_setup import ( al_num_outputs_per_target, ) @dataclass class LinearOutputModuleConfig: pass class LinearOutputModule(nn.Modu...
24b4c1b10b4df3a10928fbd8e54806da5b6c521a26cfafbebd792baff6cb386d
Python
1,369
51
"""This script provides an example of using custom backbone for training.""" import tensorflow as tf from deepreg.registry import REGISTRY from deepreg.train import train @REGISTRY.register_loss(name="root_mean_square") class RootMeanSquaredDifference(tf.keras.losses.Loss): """ Square root of the mean of squ...
2b3d01f2574ee04bad6388d3a126efb8e399eaabcdf8309d05178b5ee43bb638
Python
1,369
50
# -*- coding: utf-8 -*- """ Created on Fri Nov 24 23:06:03 2023 @author: Artur Klepaczko """ from pathlib import Path import random from tqdm import tqdm npy_root = Path(R'D:\TexturesKidneys\NPY_v2') exp_root = Path(R'D:\TexturesKidneys\OnePatientOut') patients = [] for category_dir in npy_root.iterdir(): for ...
8a87b1e5f6f17275dd570be4b4bfc0816d3d5dfc794aac7d8192a3b88463edd1
Python
1,369
43
import os import logging import torch import numpy as np import torchio as tio def load_ivim_subject(study_subject_path): """ loads torchio subject with IVIM data (signals and bvalues) Args: study_subject_path: path in which subject data is located Returns: """ subject_dict = {} ...
f292a22742f1ff4fb9118ddb908aa89897d7378225332212222b926c0e7c5e0d
Python
1,369
36
from pathlib import Path import pytest from pytest import approx from brainscore_core.supported_data_standards.brainio.assemblies import BehavioralAssembly from brainscore_vision import load_metric from brainscore_vision.benchmarks.rajalingham2018.benchmarks.benchmark import load_assembly @pytest.mark.private_acces...
01377c95337cc50ecb94c2991c0badd81e210f170829ebfaecbcb263ae514bb6
Python
1,370
54
#!/bin/env python import numpy as np import sys xmin = float(sys.argv[1]) xmax = float(sys.argv[2]) ymin = float(sys.argv[3]) ymax = float(sys.argv[4]) zmin = float(sys.argv[5]) zmax = float(sys.argv[6]) nx = int(sys.argv[7]) ny = int(sys.argv[8]) nz = int(sys.argv[9]) area_tot = (xmax-xmin)*(ymax-ymin)*(zma...
56c0df93b9b828eb34a207148e925b9b2201da41fa329634e2ceb2e4f804dc28
Python
1,370
45
import os import numpy as np import scipy.sparse as sp import torch from six.moves import cPickle as pickle from torch_geometric.data import Data from torch_geometric.utils import to_undirected, remove_self_loops from preprocessing import load_data import pandas as pd from collections import Counter df = pd.read_csv...
1df0b6ae61c0e8330998f55d8a0f4bd1fd47e807d3400d8ec3de1c2ee301e0ab
Python
1,371
49
# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides Qt3DLogic classes a...
312becc18db80b48bfa3d6dc2ef2937178b09a1ac6463b2c60484c5119b5eb3a
Python
1,371
60
#!/usr/bin/env python3 import argparse import numpy as np from ase.io import read, write from KerNNCalculator.KerNNCalculator import * import argparse from os.path import splitext from ase.vibrations import Vibrations ''' Usage: python ase_vibrations.py -i structure.xyz ''' #parse command line arguments parser = ar...
426ee7bd9bd49f3b56cab0fc4741b7512002f198dd899215d8d35b9887c3d762
Python
1,371
49
# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides Qt3DInput classes a...
ca39b951944992d100212d06b6e08750c5b17677c57fecb2b8b736774e77a5e5
Python
1,371
49
from numpy import arange def get_grid(): zmin = 0.4 zmax = 4.4 dz = 2 assert zmax <= 6 assert zmin >= 0.3 assert zmax >= zmin + dz ymin = -7 ymax = -4 dy = 0.5 assert ymax >= ymin + dy assert ymax <= -4 as...
0b1bdd3f76a18a6aa3db42738eafa212d8c1b0cab6fa5621cfae82caf4878c53
Python
1,372
74
# -*- coding: utf-8 -*- """TODO""" import os import sys from mpi4py import MPI from core.logger import Logger from core.system import System logger = None kernel = None mpicomm = None def init(directory='.', simulation_name='default', logfile_prefix='default', quiet=False): """TODO""" # Initialize MPI and...
339ff0b2e36b4b6c3a60045fb1cf7fcedc2fde2492a87e537a351f0f46575a87
Python
1,372
55
import argparse from datetime import datetime from deepreg.train import train name = "paired_mrus_prostate" # parser is used to simplify testing # please run the script with --full flag to ensure non-testing mode # for instance: # python script.py --full parser = argparse.ArgumentParser() parser.add_argument( "...
3d722e843563ad621a9f90a2807db2b80226310c0f536242dce9d24a2ae5ac31
Python
1,372
45
""" Separate overlapping surfaces """ import SVMTK as svm from pathlib import Path # TODO : improve if __name__ == "__main__": print("Start ",__file__) outdir = Path("results") outdir.mkdir(exist_ok=True) sphere1 = svm.Surface() sphere2 = svm.Surface() # Create two spheres # First...
83be8a92556134506f13dec63067c82ba239d2029d5f3885e82c90bc2efc65e9
Python
1,372
40
from setuptools import setup, find_packages with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() # with open("requirements.txt", "r", encoding="utf-8") as fh: # requirements = [line.strip() for line in fh if line.strip() and not line.startswith("#")] setup( name="harvest", ...
26d8ed27de54ce6f9897245d34bd30d36f75c71359a4eba78972d4e4fea6d3e1
Python
1,373
39
# -*- coding: utf-8 -*- import os import nibabel as nib import numpy as np from scilpy import SCILPY_HOME from scilpy.io.fetcher import fetch_data, get_testing_files_dict from scilpy.reconst.utils import is_data_peaks def test_is_data_peaks_with_real_data(): fetch_data(get_testing_files_dict(), keys=['processing....
3672922946fd967ec7c60808fe8f6a0c91ce593adcf3ac494c69990a5908f4ad
Python
1,373
43
import functools import socket from datetime import datetime from pathlib import Path from neuralib.tools.slack_bot import send_slack_message from neuralib.typing import PathLike __all__ = ['slack_bot'] def slack_bot(*, env_file: PathLike | None = None, timestamp: bool = True): """sending error message to slack...
98955939bd76e8808a3a2fa73b39266b591f14ac7295943a0239d14cb12379c8
Python
1,373
40
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("quality_control", "0012_qualityrequirement_and_more"), ] operations = [ migrations.AlterField( model_name="q...
00b7464d47e4ae8ddc2957b52deb050a35da75603c59b6a025ff4e41ca3f94dd
Python
1,374
62
"""Train an HMM. """ from sys import argv if len(argv) != 3: print( "Please pass the number of states and run id, e.g. python 2_train_hmm.py 8 1" ) exit() n_states = int(argv[1]) run = int(argv[2]) output_dir = f"results/models/{n_states:02d}_states/run{run:02d}" print("Importing packages") im...
88d2d70431b89255d9f185c654c70373a02e9e44a8c3e8b3e7e3fca94672f2ee
Python
1,374
48
"""Run molecular docking through the ChemGraph agent. Docks a small-molecule candidate into a receptor with AutoDock Vina using the ``molecular_docking`` workflow, which binds the docking tools and prompt for you. The candidate can be a SMILES, a molecule name, or a PubChem CID; the receptor here is the prepared vanco...
2a357918c34b6c4fe17c255dbcf20b98c01118ea97c8f57eb9e7d74e47d17524
Python
1,375
54
import sys import numpy as np import hipsternet.neuralnet as nn import hipsternet.solver as solver time_step = 10 n_iter = 1000000000 alpha = 1e-3 print_after = 1000 H = 64 if __name__ == '__main__': with open('data/text_data/japan.txt', 'r') as f: txt = f.read() X = [] y = [] ...
a67e632fd190bc05d634a6e0ebba3428fbb2e9411ee1552d4cd81b2f218e38fd
Python
1,375
41
""" (C) IBM Corp, 2019, All rights reserved Created on Aug 25, 2019 @author: EHUD KARAVANI """ import unittest import pandas as pd import numpy as np from causallib.estimation import MarginalOutcomeEstimator class TestMarginalOutcomeEstimator(unittest.TestCase): @classmethod def setUpClass(cls): cls...
b1d5208bc8dadb9ef0f16745e79a829d34df4a380c2675b2cf6095fa2ed676af
Python
1,375
41
#!/usr/bin/env python """ HAL module for emulating a (IR) laser for the focus lock. Hazen 04/17 """ import storm_control.hal4000.halLib.halMessage as halMessage import storm_control.sc_hardware.baseClasses.amplitudeModule as amplitudeModule class NoneIRLaserFunctionality(amplitudeModule.AmplitudeFunctionality): ...
31684f11cb1a2f176902898a05144a0f21851e53c48699bc6d64918209e87561
Python
1,376
51
#!/usr/bin/python3 # EPSILON = 100 EPSILON_ABC = 0.025 * 0.01 # 21: LSPV. 23: LIPV. 25: RSPV. 27: RIPV # inferior PV parameters R1_23_27 = 0.06 # x_rad of inf PV XSHIFT_23 = 0.07 + R1_23_27 # x_cen of LIPV XSHIFT_27 = 1 - XSHIFT_23 # x_cen of RIPV R2_23_27 = 2 * R1_23_27 # y_rad of inf PV YSHIFT_23_27 = 0.63 #...
85fd74fafdebebf3d6ff8386d48343d9ff708b39233985a6f1e280a40ab59476
Python
1,376
41
import torch import numpy as np from utilities.ivim.forward_model import ivim_parameters_to_signal def simulate_ivim_signal(D, Dp, f, S0, bvalues, SNR_array, rg): """ simulate ivim signal Args: D: diffusion coefficient Dp: pseudo diffusion coefficient f: perfusion fraction ...
8cb4acb98f029caebf9b9a3fdb6bdc90d5b18fb6d29d47f8694232e16df2849a
Python
1,376
44
from __future__ import annotations import random from dataclasses import replace import numpy as np from napari.qt.threading import FunctionWorker from pytestqt.qtbot import QtBot from brainways.pipeline.brainways_params import BrainwaysParams, TPSTransformParams def randomly_modified_params(params: BrainwaysParam...
ae55c061ec40536e9cd797545abe44364655f9d966ba99fc864931b41fde539e
Python
1,376
53
import argparse from datetime import datetime from deepreg.train import train name = "unpaired_ct_lung" # parser is used to simplify testing # please run the script with --full flag to ensure non-testing mode # for instance: # python script.py --full parser = argparse.ArgumentParser() parser.add_argument( "--tes...
f1cc27703fd86bda18c70f351a2301c2642ca7de6d5ccda1c9d038f129c65c7b
Python
1,376
53
import argparse from datetime import datetime from deepreg.train import train name = "grouped_mr_heart" # parser is used to simplify testing # please run the script with --full flag to ensure non-testing mode # for instance: # python script.py --full parser = argparse.ArgumentParser() parser.add_argument( "--tes...
6afac09a8ff36ce7c5a7b5cf80c454ed335714503e939e632427960bd2c81346
Python
1,377
40
import os.path as op import dipy.core.gradients as dpg import dipy.data as dpd import nibabel as nib import nibabel.tmpdirs as nbtmp import numpy.testing as npt import pytest from AFQ.models import dki from AFQ.utils.testing import make_dki_data def test_fit_dki_inputs(): data_files = ["String in a list"] b...
c2e7187808189d53885aa9512f71a5dec6093aa42bb0f09b0468c68bc08d19f4
Python
1,377
52
""" This module implements the proximal operator. """ import torch import torch.nn as nn from typing import Tuple from deepdwi import util from deepdwi.dims import * class VAE(nn.Module): def __init__(self, model: nn.Module): super(VAE, self).__init__() self.model = model ...
43b4fff075a6e39581a611a594d46f4411e80fb1c8c9684027b9007e3a5da991
Python
1,378
44
import unittest from unittest import mock from ogo.cli import GenerateFEM class TestGenerateFEM(unittest.TestCase): def setUp(self) -> None: pass def tearDown(self) -> None: pass @mock.patch("ogo.cli.GenerateFEM.spine_compression_main") def test_dispatch_to_vertebra(self, mock_spine)...
4d23056f243026fcafde5c506648aa018cfae44c01d7d47db6cb2713b737f271
Python
1,378
39
from typing import Optional from torch import nn, Tensor import torch.nn.functional as F import torch __all__ = ["FocalCosineLoss"] class FocalCosineLoss(nn.Module): """ Implementation Focal cosine loss from the "Data-Efficient Deep Learning Method for Image Classification Using Data Augmentation, Focal ...
5ec4bb65c2cfe337fa933d30e636d94ddbefbe8e93b2c8b30960dee5719e3ea1
Python
1,378
40
from qtpy.QtCore import Signal from qtpy.QtWidgets import QGraphicsView class QGraphicsViewMT(QGraphicsView): #: Emitted when the mouse moves over the view. mouseMoved = Signal() #: Emitted when the mouse enters the view. mouseEntered = Signal() #: Emitted when the mouse leaves the view. mouseL...
6707116f0b49854947c4138c0ad0d3e27c9b5d2af21be27c331f8191399bca3b
Python
1,378
45
import csv import numpy as np import matplotlib.pyplot as plt import yaml import sys import os import h5py pathpath = 'PATHS/filepaths_carlen.yml' with open(pathpath, 'r') as myfile: pathdict = yaml.safe_load(myfile) sys.path.append(pathdict['code']['workspace']) from pfcmap.python.utils import tessellation_tools a...
92f4b2661fc05390f6b1d1f5fdd151fc997faf94b7304d8ba3ee1243929d1a57
Python
1,378
34
from utils import setup_features from param_parser import parameter_parser from utils import tab_printer, read_graph import numpy as np import pandas as pd from sgcn import SignedGCNTrainer from param_parser import parameter_parser from utils import tab_printer, read_graph, score_printer, save_logs, read_st_graph, trai...
ace20c7a47fbc044074bdb4ae935c9a15ce4eec9e90c4ecb88741cc14322771c
Python
1,378
45
# -*- coding: utf-8 -*- """Check correct synchronization with trigger signal.""" import matplotlib.pyplot as plt import numpy as np import scipy.io as sio __all__ = ["check_trigger"] def check_trigger(input_biopac): """This function loads the digital input from a saved biopac mat-file and checks the number ...
b192d27d2aa3e748854490ce4a89bc22402a930397f565207c2edb55f1e48257
Python
1,378
30
#--------------------------------------------# # 该部分代码用于看网络结构 #--------------------------------------------# import torch from thop import clever_format, profile from torchsummary import summary from nets.deeplabv3_plus import DeepLab if __name__ == "__main__": input_shape = [512, 512] num_classes =...
fddbbe551069d1ae887b9171d1f3b595e990fb21fa89ff414c239c7b3dc29619
Python
1,378
54
import argparse from datetime import datetime from deepreg.train import train name = "unpaired_mr_brain" # parser is used to simplify testing # please run the script with --full flag to ensure non-testing mode # for instance: # python script.py --full parser = argparse.ArgumentParser() parser.add_argument( "--t...
6423e8f2a293aa1beca5c9dd3b62ec3330d050a274a6821f901d65c2aeadde71
Python
1,379
38
from nipype.interfaces.fsl import Reorient2Std from PUMI.engine import BidsPipeline, NestedNode as Node from PUMI.pipelines.anat.anat_proc import anat_proc from PUMI.pipelines.func.compcor import anat_noise_roi, compcor from PUMI.pipelines.anat.func_to_anat import func2anat import os from PUMI.pipelines.func.temporal...
8a0bfe452767e67027c0579fd19a3497b3201b512cbfab893b3539897e5b5d7a
Python
1,379
60
import numpy as np from impedancefitter.cpe import cpe_ct_model, cpe_ct_w_model, cpe_model omega = 2.0 * np.pi * np.logspace(1, 8, num=20) k = 1e-7 alpha = 0.9 Rct = 100 Aw = 10 def test_cpe_ct_w_type(): """Test CPE return type.""" Z = cpe_ct_w_model(omega, k, alpha, Rct, Aw) assert isinstance(Z, np.nd...
014dc0c367c159571693016609d49b64dc40af50c654a97846e9ad32d616050f
Python
1,380
43
''' dynamic import model ''' import importlib def import_model(model_path): # 获取模块路径和类名 module_path, class_name = model_path.rsplit('.', maxsplit=1) # 1 利用字符串导入模块 module = importlib.import_module(module_path) # 2 利用反射获取类名 cls = getattr(module, class_name) # 3 生成类的对象 # obj = cls() ...
139842a4433f212c946722d53f94ff009156a139d6293d347b9737cac72433cc
Python
1,380
49
from ..qt import * from .. import thalamus_pb2 from ..task_controller.util import create_task_with_exc_handling class SpikeGlxWidget(QWidget): def __init__(self, config, stub): super().__init__() layout = QVBoxLayout() layout.setAlignment(Qt.AlignmentFlag.AlignTop) self.setLayout(layout) edits ...
456f205538b5d92399c92154edac30ea92931fd4d93ab53c5f31a033691b9d98
Python
1,380
49
# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides Qt3DExtras classes ...
eb9c150f3ff518813b8c576e1bccdbc197cc08d96f080c3281987ec0d910156f
Python
1,380
47
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import inspect from abc import ABC, abstractmethod from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.utils.module_loading import import_string class IEmailValidator(ABC): @abstractmethod d...
33bfa81ec68a74217cd11d52638b3b6b1e62a5d3f1178f81075e5e2e9a42d993
Python
1,381
48
# -*- coding: utf-8 -*- # python standard library inputs import os # external inputs import nibabel as nb def include_pial_correction(path, sub): """Include pial correction. This function takes manual corrections from the file pial_edit.mgz which shall be located in the freesurfer mri folder and inclu...
de3860158aa04650faa08c4914089df8f4573643b2e354b37fe14ca65011f352
Python
1,382
34
"""M/EEG processing pipeline. This subpackage provides a complete pipeline for processing M/EEG data from raw sensor recordings to parcellated source-space time courses. Modules ------- - :py:mod:`~osl_dynamics.meeg.maxfilter` — Wrapper for Elekta Maxfilter (SSS/tSSS). - :py:mod:`~osl_dynamics.meeg.amm` — Adaptive ...
09a902f6ac765631094c9c59c792e21a89f284acb57a942d9a03646a7779f27f
Python
1,384
36
# Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/...
46554b2cb810f52cf9ccf67d89d2a08e00a94fe81d4be7652a2f31f8e2ceac3e
Python
1,384
26
import mne from rsatoolbox.data import TemporalDataset from rsatoolbox.rdm import calc_rdm_movie, combine from joblib import Parallel, delayed from scipy.signal import savgol_filter subs = [f"sub-{(i+1):02}" for i in range(20)] ordered = ["square", "rectangle", "isoTrapezoid", "parallelogram", "losange", "kite", "righ...
1edf861f03193406f8960f4610201d3f8df0d6c3cf46336619f97bd2b2532340
Python
1,385
55
import argparse from datetime import datetime from deepreg.train import train name = "unpaired_us_prostate_cv" # parser is used to simplify testing # please run the script with --full flag to ensure non-testing mode # for instance: # python script.py --full parser = argparse.ArgumentParser() parser.add_argument( ...
4172cff32ef71e82e069fe3a8e1dab7133a9a948c208a16a6cebba4a83a5fe3e
Python
1,385
42
#!/usr/bin/env python """ HAL module for emulating an illumination filter wheel. Hazen 04/17 """ import storm_control.hal4000.halLib.halMessage as halMessage import storm_control.sc_hardware.baseClasses.amplitudeModule as amplitudeModule class NoneFilterWheelFunctionality(amplitudeModule.AmplitudeFunctionality): ...
6326594bf4bc9048055eeadc9dcf2059d95251371ce6d8c5945cbae80bb2ddbc
Python
1,385
45
import numpy as np import torch import torchio from torchio.transforms import Transform class SortSignalOnXval(Transform): def __init__(self, **kwargs): super().__init__(**kwargs) def apply_transform(self, subject): """ Sorts signals and xvals on ascending xvals Args: ...
c095274c30d8a7b960eccb03f2ad202dd4ef7f762dd553bceb1e2c8864768aa8
Python
1,385
26
import os from nipype.interfaces.base import (CommandLineInputSpec, CommandLine, traits, TraitedSpec, BaseInterface, BaseInterfaceInputSpec, File) from traits.api import Directory, Str, List, Bool, Enum, Int, Float, TraitError, Either class SimpleN4BiasFieldCorrectionInputSpec(CommandLineInputSpec): input_image = ...
edc88858aef2ef93b9098c76403bb331fe2e4dfdfca978f6fe10062d7e192b48
Python
1,385
42
import os import random import torch import numpy as np import pandas as pd from utils import process_data, dataloader_generation_pred, model_performance_test, metrics, parse_arguments, load_model, process_and_predict, save_results from model import Cross_Attention_DDG, apply_masked_pooling, SinusoidalPositionalEncodi...
73859a4ca3fb97b52273c3c98e7e5aaa82a082c72a24d6aec1080e6174cd4825
Python
1,386
36
import pandas as pd import argparse from tqdm import tqdm parser = argparse.ArgumentParser(description='Preprocess edge list') parser.add_argument('--atlas_groups', help='Atlas Groups - List to be processed.', required=True) parser.add_argument('--atlas_nodes', help='Atlas Node List to be processed.', required=True) a...
bbd50b656c351d439107e829effd7183bd8fbfb69b5784984727ec8b81837aef
Python
1,386
51
# -*- coding: utf-8 -*- # external inputs import numpy as np import scipy.io as sio import matplotlib.pyplot as plt def check_trigger(input_biopac): """Check trigger. This function loads the digital input from a saved biopac mat-file and checks the number of sent triggers and the time difference be...
f01e71f6600cd8f369725490b4651807963fe4f8b9df652ac8b8f9287f485d10
Python
1,386
62
import os from pathlib import Path import requests script_dir = os.path.dirname(os.path.abspath(__file__)) def download_from_zenodo(url: str, output_path: str): response = requests.get(url) response.raise_for_status() with open(output_path, 'wb') as f: f.write(response.content) print(f"Do...
fade159e3fb3a0ed32ee7d62b5300b76965a09c00f6ba57578e17bb55bce7fff
Python
1,386
38
""" @author: Erik Kubaczka """ import torch from torch.utils.data import DataLoader import my_setup from data_processing.masked_sequence_model_token_based_triplet_dataset import Sequences, SequenceToSequenceDataset def split_data(dataset, split=None): if split is None: split = [0.7, 0.15, 0.15] tr...
fc1364300acab3f52203510e20672838d4d5ef35deccb2bef054f3bf4210294e
Python
1,386
41
import os import glob import numpy as np import pandas as pd import scanpy as sc import seaborn as sns import matplotlib.pyplot as plt from submodule_activity import plot_module_heatmap adata = sc.read_h5ad('../adata_U54_BA9_splotch_lambdas.h5ad') adata.obs['array'] = [x.split('/')[-2] for x in adata.obs.index] # d...
2919e022b00fa19a7f1a464151edd2194393535ecc776678bf09196d9e961e68
Python
1,387
40
# %% # imports # you must activate the conda env /home/data/eccolab/CondaEnvs/pymeshlab to run this script import os import pymeshlab from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter base_mesh_dir = '/archival/projects/SPLaT/data/mesh' # %% # Argle parser parser = ArgumentParser( prog='combine_do...
2ab76cbaf646003ebd8ca31dbcf4c3dfa884464ad7a0606d738b5ac55a4b705a
Python
1,387
62
#!/usr/bin/env python3 import arbor as A from arbor import units as U from util import plot_spikes # global parameters # cell count N = 10 # total runtime [ms] T = 1000 # one interval [ms] t_interval = 10 # numerical time step [ms] dt = 0.1 class unconnected(A.recipe): def __init__(self, N) -> None: sup...
5db7313802b8fde85446f86982b6c0e889bdf4c7d91dc001cfc75a4e69c96031
Python
1,387
40
import numpy as np from skimage.transform import ProjectiveTransform from typing import Union, List def fitGeoTrans(src: Union[List[int], np.ndarray], dst: Union[List[int], np.ndarray], mode="projective",**kwargs) -> np.ndarray: """ This function is the same as matlab fitgeot...
ce500475f6338cf7b079492c7541980e49d2eeb6e961698fca8fdeae49441e79
Python
1,387
45
import os from PUMI.pipelines.anat.segmentation import defacing from nipype import IdentityInterface from PUMI.engine import BidsPipeline from PUMI.engine import NestedNode as Node ROOT_DIR = os.path.dirname(os.getcwd()) input_dir = os.path.join(ROOT_DIR, 'data_in/pumi-unittest') # path where the bids data is locate...
e73bcee3d25baa3a2e9210ea1cab3918057b481c02e76319f11fc763340b2e8a
Python
1,387
54
import base64 from copy import deepcopy from io import BytesIO import requests from PIL import Image def encode_image_to_base64(file_path: str) -> str: with Image.open(file_path) as image: buffered = BytesIO() image.save(buffered, format="JPEG") return base64.b64encode(buffered.getvalue()...
1cc0df39b0b9fd211e8115984d85ff634c9f9b1f4274924f6dbf1e50a0c564e0
Python
1,389
41
import torch import random import h5py import numpy as np def set_seed(seed, device_id='cuda:0'): # Set seed for Python's built-in random library random.seed(seed) # Set seed for numpy np.random.seed(seed) # Set seed for PyTorch CPU torch.manual_seed(seed) if torch.cuda.is_available(): ...
25259b1b68ac6c6add9ccd6a5d57c2790d83cab6f763ef8d53ca858273d9dcf8
Python
1,389
39
from brainscore_vision.model_helpers.check_submission import check_models import functools import torchvision.models from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images from .load_model import * # This is...
3b0d81f902a0511cbb92d54d0a6499e3df9b8d2ee3c596d7abe6e01e16785823
Python
1,389
39
from brainscore_vision.model_helpers.check_submission import check_models import functools import torchvision.models from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images from .load_model import * # This is...
446ed1374aa1989437e820edbbb8a56f4c7c8e0aeb6b7f95a85b725e95b75cd9
Python
1,389
61
# -*- coding: utf-8 -*- """ Interface to write binary files for point like data The interface is based on the numpy library. Example: >>> import os, numpy >>> import ClearMap.Settings as settings >>> import ClearMap.IO.NPY as npy >>> filename = os.path.join(settings.ClearMapPath, 'Test/Data/NPY/points...
da6a8dd2762a553e4100aee6c41393f4db2108747c8c2a85d562dd52a4e6b628
Python
1,390
36
# Copyright 2024 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
09947537e2fb3ef2c377ee5c24196d797c31c327707ff7ace9380ed6d2a62f8d
Python
1,391
52
# -*- coding: utf-8 -*- """ Gradient nonlinearity correction This scripts calls the HCP toolbox to correct for gradient nonlinearities in the input volume. Further explanations can be found in a separate readme. The script needs an installation of fsl. Dependencies: - gradunwarp: https://github.com/Washington-Univers...
12bf1c4b214ca82e5e0f24c8d679ad768b7b70f48730b6b60bb984ade54a4876
Python
1,391
39
from brainscore_vision.model_helpers.check_submission import check_models import functools import torchvision.models from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images from .load_model import * # This is...
b315382bbb86a911bc669c12519b453d5e2ead816cfc23d1fd281d048aa03da1
Python
1,391
51
from importlib import metadata BASE = """ Acknowledgements ================ This project would not have been possible without the people developing, maintaining and releasing open source projects online. Therefore, I would like to thank the people that developed the packages this project directly depends on, those th...
be747946bafd82ba6618c651a6defa5ca25c5551b84b11ef50c5abe2aa3b32d2
Python
1,391
38
# SPDX-FileCopyrightText: Copyright © Timo Koch # SPDX-License-Identifier: GPL-3.0-or-later import matplotlib.pyplot as plt import numpy as np import glob import click @click.command() @click.option('--folder', default="../build-cmake/app", help='Folder containing the data') @click.option('-n', "--number-of-plots", d...
dc073a4ec9d02fcfa8dcbe9ad544e850a6a90b0be11998318813686791444d55
Python
1,391
54
import numpy as np import pytest from napari_dmc_brainmap.results.results_helpers.results_quantifier import ( ResultsQuantifier, ) def test_majority_hemisphere_uses_left_positive_atlas_direction(): assert ResultsQuantifier._majority_hemisphere( np.array([571, 600, 500]), 570, ) == 'left' ...
6d4a8b57c60ecd7cf095f402921491a37766711eda66411bbad9d13e598f7be3
Python
1,392
59
""" Motion correction workflows to consider ----------- - single contrast and double contrast data (vaso), interleaved? - afni, fsl and spm, (ants mc??) - check fmriprep for ref volume generation - for double contrast first mc each contrast tham register both contrasts and combine transformations? """ from nipype.pi...
7cdf77d66495b677ede43bbccfbc8b9bb9ebedaeb6d3a04d59f5288da36119f0
Python
1,392
52
import arbor as A import matplotlib.pyplot as plt from matplotlib import cm, colors from pathlib import Path import numpy as np ex = 1 ey = 0 ez = 0 def plot_morphology(mrf, *, fg=None): tree = mrf.segment_tree cs = cm.viridis fg = plt.figure(figsize=(10, 10)) ax = fg.add_subplot(projection="3d") ...
8ca7c4adedcf8233aa9b5b10762f0c5588f83715144f9d1e0ccec701b9e72455
Python
1,392
45
from qtpy import QtGui, QtWidgets from qtpy.QtCore import Qt, QRect class ModeToggle(QtWidgets.QPushButton): def __init__(self): super().__init__() self.setCheckable(True) self.setMinimumWidth(44) self.setMinimumHeight(132) def paintEvent(self, event): if self.isChecke...
396711368b84cdac83aa47844910c71428244c4af9393a711c04106d43dd9373
Python
1,393
48
#encoding=utf-8 from __future__ import print_function, unicode_literals import sys sys.path.append("../") import jieba jieba.load_userdict("userdict.txt") import jieba.posseg as pseg jieba.add_word('石墨烯') jieba.add_word('凱特琳') jieba.del_word('自定义词') test_sent = ( "李小福是创新办主任也是云计算方面的专家; 什么是八一双鹿\n" "例如我输入一个带“韩玉赏鉴”的标题,在自...
3dcb5418e627762634d74eb05b40d78d7f9e67dc04fff523ee9f5ffdeed8b80c
Python
1,393
35
""" TMS Explorer was developed to assist with the data preprocessing of transcranial magnetic stimulation (TMS) as part of the study "Transcranial direct current stimulation (tDCS) and mindfulness meditation in fibromyalgia" in the "Non- invasive brain stimulation lab" (NBS) at the university medicine Göttingen ...
a99e0d957aed21a38449641e4acf1bd779197c5c2f4da4c7cf8222bf72bdb382
Python
1,393
15
"""Record literal URLs in built assets alongside the browser's request audit.""" import hashlib,json,re from pathlib import Path ROOT=Path(__file__).resolve().parents[2];dist=ROOT/'explorer/dist' assets=[] for p in sorted(dist.rglob('*')): if p.is_file() and p.suffix in {'.js','.css','.html'}: s=p.read_text();assert...
e07fdee7c2c83fc8afa13ab1cd18b39ec34d5daca639c7361b9fb4d24a01bb04
Python
1,393
39
import numpy as np from rscvp.util.cli.cli_celltype import CellTypeSelectionOptions from argclz import AbstractParser, as_argument from neuralib.plot import plot_figure __all__ = ['OverviewSessionStat'] class OverviewSessionStat(AbstractParser, CellTypeSelectionOptions): DESCRIPTION = 'Compare fraction of varia...
080524b1fde9ce01377553822a02f4c030e63760f7fd2d4f4680aaae957791e8
Python
1,394
42
"""Example code for plotting power maps calculated using the state/mode spectra estimated from the source reconstructed data and inferred state/mode time course. The spectra can be calculate with a multitaper (in the case of a state time course) or regression (in the case of a mode time course). See examples/spectra/...
1d454baa19f3e2e7c532e8aa9f071107ea09e98f8be6a76e794e1493384a5ea5
Python
1,394
45
from PyQt5 import QtGui, QtWidgets from PyQt5.QtCore import Qt, QRect class ModeToggle(QtWidgets.QPushButton): def __init__(self): super().__init__() self.setCheckable(True) self.setMinimumWidth(44) self.setMinimumHeight(132) def paintEvent(self, event): if self.isChec...
a2fff718eb85c82baf1318102719d54c8c69cafe6821d18e587e478aae282321
Python
1,394
49
#!/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 time import numpy as np import BoxCountingMethod_Solid import Draw import data_excel import nibabel as nib import os # import r_tif # Set the directory...
4ad995b46c91fe66f9bccb9cdde4687f19796aaacbb0d2db75b5c4e1e8ff9cfd
Python
1,395
54
import argparse from datetime import datetime from deepreg.train import train name = "grouped_mask_prostate_longitudinal" # parser is used to simplify testing # please run the script with --full flag to ensure non-testing mode # for instance: # python script.py --full parser = argparse.ArgumentParser() parser.add_ar...
75803f1d9a3a4fc2f8628daad6d906b0b13c9b403a9baf607c71c8f1b1373d4b
Python
1,395
53
from __future__ import absolute_import import warnings from .market1501 import Market1501 from .msmt17 import MSMT17 from .personx import PersonX from .veri import VeRi from .dukemtmcreid import DukeMTMCreID from .brain import Brain #RWM from .brain_segs import Brain_Segs #RWM __factory = { 'market1501': Marke...
6e125a8cc180fb757e26463170404e499265ae7c24ebb9c81689347a26df12fb
Python
1,396
52
import sys import os import glob from optparse import OptionParser USAGE = """ write-mrsfast-ksearch-cmds.py --kdir <dir of kmer fasta files> --fa <fasta> --out <out file for cmds> writes out cmds for mrsfast """ ############################################################################### parser = OptionParse...
ea47fcfad205bf5168c2ce7e646f3d63d44b46b6e8523637176e50ddf18aba1d
Python
1,396
31
from brainscore_vision.model_helpers.check_submission import check_models import functools import timm import torch from huggingface_hub import hf_hub_download from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_i...
90123392610cdf0d561f9d00fc412bf5d570baf338ed1b07ea9a5c8884fc430e
Python
1,397
29
""" 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...
f71a50f11955b47a04c08c949164291c9bc7e76f28e6e7c4672eaf7aef71c3b8
Python
1,397
59
#!/usr/bin/env python """ Run HAL for testing Steve. Hazen 11/18 """ import os import subprocess import sys import threading import time import traceback from PyQt5 import QtWidgets import storm_control.hal4000.hal4000 as hal4000 import storm_control.sc_library.hdebug as hdebug import storm_control.sc_library.param...
44c35869af8b3a66032aa3d72189792a8fce9aba83e3ebc656ddcc61d6e4a562
Python
1,398
41
from copy import deepcopy from unittest.mock import MagicMock import numpy as np from eir.data_load.data_preparation_modules import prepare_sequence from eir.setup.schemas import SequenceInputDataConfig def test_prepare_sequence_data(): test_input = np.array(list(range(100))) test_input_copy = deepcopy(test...
89104cd65f45c4f10c17498476becd28a0bd4b39ee2f713cd98e69292aa1b194
Python
1,398
56
import numpy as np import matplotlib.pyplot as plt from parameters import * def plot_raster_and_PSTH(times, sources, bin=30): plt.figure(figsize=(60, 80)) plt.subplot(311) plt.plot(times, sources, "|", color="k") plt.ylim([100, 200]) plt.xlim(0, tfinal) plt.ylabel("neuron ID") plt.subplo...
876901c2f19b229e6d45722c58859dc39d6d94f9e67d3805ed4e022f1c7bfc10
Python
1,399
47
# Generated by Django 3.2.16 on 2022-11-30 08:44 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("engine", "0060_alter_label_parent"), ] operations = [ migrations.AlterField( model_name="labeledshape", name="type"...
2b3b748f97ee7ff2a3640f3ef95d90cd337d759bdd5c14da3e8d93410c95a55e
Python
1,400
60
import os import uuid from unittest import TestCase from unittest.mock import ANY import kb_python.stats as stats from tests.mixins import TestMixin class TestStats(TestMixin, TestCase): def test_start(self): s = stats.Stats() s.start() self.assertIsNotNone(s.start_time) self.as...
bc08053bea2c17541c787e898f2aed74482d05f5e73b1068eb6a75b83ad937bc
Python
1,400
51
from ..qt import * import bisect from ..config import ObservableCollection import typing import functools class IntanWidget(QWidget): def __init__(self, node, stub): super().__init__() if 'Channels' not in node: node['Channels'] = [] channels = node['Channels'] layout = QVBoxLayout() qlis...
f159608baead5610724e21f76cc8a628bef66277726691f822e7a80b7e664226
Python
1,400
49
# -*- coding: utf-8 -*- """ Created on Fri Mar 31 11:12:54 2023 @author: axthi """ import sys # -------------------------------------------------- # NOTE: Update this path to fit to your installation path_to_utils = 'C:/Users/axthi/simnibsN/memoslap_utils/' sys.path.append(path_to_utils) import simnibs_memoslap_util...
ff117e9451aae161d457cb4f5a558b3908a01e610d95c5ea216727538cc8290f
Python
1,400
37
# -*- coding: utf-8 -*- # # test_event_generators.py import unittest import arbor as arb from arbor import units as U """ all tests for event generators (regular, explicit, poisson) """ class TestEventGenerator(unittest.TestCase): def test_event_generator_regular_schedule(self): cm = arb.cell_local_lab...
b869a94dd1638206dfacb9574709e15c5dca706edb5bd8bda6a6d8eaa5b55136
Python
1,402
51
from __future__ import annotations from pathlib import Path from typing import Final import pytest from PySide6.QtWidgets import QMessageBox from pytestqt.qtbot import QtBot from ..conftest import close_or_pause from .conftest import MainWinFactory from .conftest import show_window_and_wait_for_imagedata @pytest.m...
d2b3081cba1b9b3f1c078430d7f04b127550398b8f72831178e045c818962387
Python
1,402
52
# Copyright (c) DP Technology. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import lmdb import os import pickle import torch import numpy as np import collections from functools import lru_cache from . import data_utils import logging logge...
461244a181abe1398d85cb4763372007b4ecdfa7cd9b6eec62879190d4950e9d
Python
1,403
37
# encoding=utf-8 from __future__ import unicode_literals from whoosh.analysis import RegexAnalyzer, LowercaseFilter, StopFilter, StemFilter from whoosh.analysis import Tokenizer, Token from whoosh.lang.porter import stem import jieba import re STOP_WORDS = frozenset(('a', 'an', 'and', 'are', 'as', 'at', 'be', 'by', '...