sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
5a5602f79010cdd38a465d85425ae7166f28634252fc684e7fd2ec6a136a916b
Python
2,135
57
# 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...
8d0be5931f02fe561020a36c31712b319b277b10b8bf1400d572fb86808e0f09
Python
2,135
48
import torch import math ### this was used to generate the ensemble for the two-state model during training. def generate_two_state_ensemble(positions, dG, num_bins, min_bin, max_bin,): # positions: shape [B, N_res, 3] # dG: shape [B, 1] # return: shape [B, N_res, N_res, num_bins] lower_breaks = torch....
f05a192a023c82e667a480baea6295253945b92b3f0e4fbcd22aab2434a6e223
Python
2,136
67
import tensorflow as tf import numpy as np from tensorflow.keras.models import load_model from sklearn.metrics import r2_score # GPU configuration gpus = tf.config.experimental.list_physical_devices('GPU') if gpus: try: for gpu in gpus: tf.config.experimental.set_memory_growth(gpu, Tr...
347cd5f630c06f4510dafe8ab16ee89158345e55d9c22e59e807aa182e4765d1
Python
2,138
51
import os import logging from glob import glob from PIL import ImageFile ImageFile.LOAD_TRUNCATED_IMAGES = True def read_images_paths(dataset_folder, get_abs_path=False): """Find images within 'dataset_folder' and return their relative paths as a list. If there is a file 'dataset_folder'_images_paths.txt, r...
1334e1f0fee8b80306358ae6aa3157b925766e1ff26ab74e1e2def8a4b0483a6
Python
2,139
56
import glob import os import numpy as np import pandas as pd list_all_neukin_df = [] skipdates = ["220818", "220819"] input_folder = "/sc-projects/sc-proj-cc15-ag-wenger-retune/data_kinematic_states_neural/" VICON_FS = 200 window = 300 overlap = 250 days = [i for i in next(os.walk(input_folder))[1] if i not in skip...
20f0029c13610f5b902148b674ac088d6fe240c7cf4d0f29a41e79759f1a7e5f
Python
2,140
69
import sys import time import getopt import json from scipy.sparse import csr_matrix import anndata import pandas as pd import numpy as np from anndata import AnnData # usage def affine_h5ad_usage(): print(""" Usage : affine_h5ad.py -i <input.h5ad> -o <output.h5ad> -x [column of ...
2389c488b2c974a770678d65834458fe81411f672fa70fa422cad740a4c4dff7
Python
2,140
60
#!/usr/bin/env python """ HAL module for controlling a LUDL stage. Hazen 05/17 """ import math 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.ludl.ludl as ludl class LudlS...
bab06d10849b6208760d65fcd4158ce3c4a15ee411bdcd9e0686384ca9e6cfaa
Python
2,140
55
# -*- coding: utf-8 -*- import numpy as np import nibabel as nib from dipy.io.stateful_tractogram import StatefulTractogram, Origin, Space from scilpy.tractanalysis.voxel_boundary_intersection import \ subdivide_streamlines_at_voxel_faces def test_subdivide(): # Creating a few very short streamlines (2 point...
d98d0077f46fc4541649a494eebde469f6fd97ae34b43fb1a3f92bf9283fc901
Python
2,140
51
import numpy as np def get_im2col_indices(x_shape, field_height, field_width, padding=1, stride=1): # First figure out what the size of the output should be N, C, H, W = x_shape assert (H + 2 * padding - field_height) % stride == 0 assert (W + 2 * padding - field_height) % stride == 0 out_height =...
dc70ed3a0153c83a0e5b86e455577835944661834ac78f37c25f2256acca7e12
Python
2,140
51
from dtiplayground.dmri.common.tools.base import ExternalToolWrapper from dtiplayground.dmri.common import measure_time import dtiplayground.dmri.common from pathlib import Path import subprocess as sp import os class NIRALUtilities(ExternalToolWrapper): def __init__(self,binary_path= None, **kwargs): ## binary...
15161f632e7790dc17ea6f8a99864e4b77587e01488f8e598b777f03178fe7dc
Python
2,142
60
############################################################################# # Copyright (C) 2020-2026 MEmilio # # Authors: Daniel Abele # # 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...
797eb7eab7fb9fc55ebed80a619a070ce881103ac1428c75abc126ac9f0b3a98
Python
2,142
69
"""MEA-Stim: electrical stimulation detection & analysis (MATLAB port). See ``python/MEASTIM_PORT_PLAN.md`` for the port plan and parity strategy. """ from .detection import ( StimChannelInfo, detect_stim_times, get_stim_patterns, check_stim_pattern, ) from .cleaning import clean_spikes_from_stim from...
8d4dabadc0675b64f6d80380eb0b6dc3680e6d03a1601308ff2449022a10e863
Python
2,142
58
import torch from UBSIM.blind_SIM_functions import calc_residual def cost_function_norm(M, predicted, psf, num_frames): """ The cost function for blind-SIM with normalization by average intensity added Parameters: M: the set of raw input sub-frames predicted: t...
e6fb5086d9fd42e00caa90bb81578b5f36cfe3f3ef40bc715fb90a70fc56941c
Python
2,142
48
# # a nipype interface to pad dwi import os import nibabel as nib from nipype.interfaces.base import ( TraitedSpec, CommandLineInputSpec, CommandLine, File, traits, Str ) class PadDWIInputSpec(CommandLineInputSpec): in_dwi = File(exists=True, mandatory=True, desc='Input DWI file', argstr='%s', position=0)...
5abb84ccae46d3217a939543934994f316d63778778e29aa4b1449828aea2563
Python
2,143
47
from brainscore_core.supported_data_standards.brainio.assemblies import BehavioralAssembly from brainscore_vision import data_registry, stimulus_set_registry, load_stimulus_set from brainscore_core.supported_data_standards.brainio.s3 import load_assembly_from_s3, load_stimulus_set_from_s3 data_registry['Lonnqvist202...
c96ce8e2271dd3a972835634ccc8a087840d621886311c7267987e9ce0a1b220
Python
2,143
68
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Script to remove specific labels from an atlas volume. >>> scil_labels_remove DKT_labels.nii out_labels.nii.gz -i 5001 5002 ---------------------------------------------------------------------------- Reference: [1] Al-Sharif N.B., St-Onge E., Vogel J.W., Theaud ...
df468829c115270c866a394c820002f727933ba18fcb239a511237f5cf6383c7
Python
2,143
71
import unittest import numpy as np import torch import torch.testing as ptt from deepdwi import fourier if __name__ == "__main__": unittest.main() class TestFourier(unittest.TestCase): def test_fft(self): input = torch.tensor([0, 1, 0], dtype=torch.cfloat) ptt.assert_close( fou...
43c07499c21511b4f195c7e8e21e157e8dcc793d7068d696ba220dd6c82ae302
Python
2,144
59
import os from copy import deepcopy from typing import Optional from deepreg.constant import KNOWN_DATA_SPLITS from deepreg.dataset.loader.interface import DataLoader from deepreg.registry import FILE_LOADER_CLASS, REGISTRY def get_data_loader(data_config: dict, split: str) -> Optional[DataLoader]: """ Retur...
83a24e4a9cdee3e7f1a1f61bb8d1df7ff75c272fa4a47349d532cabd786b54e5
Python
2,144
60
import pandas as pd import seaborn as sns from matplotlib.axes import Axes from rscvp.util.cli.cli_celltype import CellTypeSelectionOptions from rscvp.util.cli.cli_output import DataOutput from argclz import AbstractParser, argument from neuralib.plot import plot_figure __all__ = ['ParaCorrMatOptions'] class ParaCo...
ae8d8a1c2ca4da3d9f99c7f1d6a1863dd03e9fd435789dbb85469f89bf6b2933
Python
2,144
71
#!/usr/bin/env python # author: Jannes Spangenberg # e-mail: jannes.spangenberg@uni-jena.de # github: https://github.com/JannesSP # website: https://jannessp.github.io """ Using 9mer Gaussian models might lead to overfitting. Using this script, we reduce the 9mer models to 5mer models by only using the middle 5 bases....
b520aa613185c3b140d62ab456d70197b390574760606601cac3f60048e7fcd9
Python
2,144
51
import numpy as np from brainscore_core.supported_data_standards.brainio.assemblies import BehavioralAssembly from brainscore_vision import load_dataset, load_metric from brainscore_vision.benchmark_helpers.screen import place_on_screen from brainscore_vision.benchmarks import BenchmarkBase from brainscore_vision.metr...
fd45d1d317ae39bc102e3936ac5a13625c0b7769c27803646cf7d6b4018f8b1c
Python
2,144
59
import numpy as np from argclz import AbstractParser from neuralib.plot.plot import scatter_histplot from rscvp.model.bayes_decoding.main_cache_bayes import ApplyBayesDecodeCache from rscvp.model.bayes_decoding.util import calc_wrap_distance from rscvp.util.cli import CameraOptions from rscvp.util.util_lick import cal...
976831f9bd5038562c9ad9125c640be7cd4054ef82d3c2cfdb905f8261a4e954
Python
2,145
49
import pytest import os import re def test_DropConfigKeys(dropConfig): for key in dropConfig.CONFIG_KEYS: assert dropConfig.get(key) == dropConfig.config_dict[key] def test_DropConfigPaths(demo_dir, dropConfig): assert dropConfig.getRoot() == f"{demo_dir}/Output" assert dropConfig.getProcessedDat...
071ffc89e6a70f635d37ac6b89df0fd27c5d7b9eb1e3b3cc1e28eca00ac24de5
Python
2,146
66
# -*- coding: utf-8 -*- import matplotlib.pyplot as plt import numpy as np import sys import os # In[] # Generate_initial_population def write_txt_sx_width_initial_points_540(L0, Lb, b_min, b_max): R_bonding = Lb element_size_ds = L0/500 bonding_ds = Lb/20 sx_width_initial_poi...
de0d3f8ab6b5f16661098db48f84189f61e71d0441758a33720aa5e75c11745f
Python
2,146
52
from brainscore_core.supported_data_standards.brainio.assemblies import NeuronRecordingAssembly from brainscore_vision import data_registry, stimulus_set_registry, load_stimulus_set from brainscore_core.supported_data_standards.brainio.s3 import load_assembly_from_s3, load_stimulus_set_from_s3 BIBTEX = """@article{bas...
797ed515f431f3077c865d684a1d704740b2aef32e3063d0185596f35ed25554
Python
2,148
56
# by Shaoxuan Yuan at 2024/04/22 import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import DataLoader, TensorDataset import numpy as np from unet import U_Net # 从您的 UNet 文件导入模型类 # from old_unet_model import UNet # 从您的 UNet 文件导入模型类 # 加载数据集 train_images = np.load('D:/桌面/proje...
98e4142afb1f624c6aed466daffe352ebe6770271ae65e81963ecb61960d8562
Python
2,148
79
import csv import pandas as pd import torch from tqdm import tqdm label_list = pd.read_csv("/data2/whr/czl/TwiBot22-baselines/datasets/Twibot-20/label.csv") label = [] for i in label_list["label"]: if i == "bot": label.append(1) if i == "human": label.append(0) label_tensor = torch.tensor(lab...
ee29a5ea159e7c06e73d06c1b67845529854d1cb3ed2885844a6d027d0859699
Python
2,148
55
"""Config API for specifying and running pipelines. The config API allows you to define a full analysis pipeline (data loading, preparation, and model training) as a YAML config and run it in a single call. For example, to train a TDE-HMM:: config = ''' load_data: inputs: training_data ...
b971f5d2252fbb9e13a7e4d3185dd074e09467b9ab4c02b52a6f3c3389a5d399
Python
2,149
69
import datajoint as dj from .experiment import BrainArea, Layer from .preprocess import ExtractRaw, Prepare, Slice, MaskCoordinates import numpy as np schema = dj.schema('pipeline_map', locals()) schema.spawn_missing_classes() @schema class LayerMembership(dj.Computed): definition = """ -> ExtractRaw.GalvoRO...
13224ef9930156a11607005fd5be8f567b8171ddac9e949282d7ea994b0ba179
Python
2,150
78
#!/usr/bin/env python3 """ sa.py Parse and possibly sanity-check a .sa file output by bowtie2-build in --sa mode. These files have a very simple format: first is a uint32_t containing the length of the suffix array, the rest is an array of that many uint32_ts containing the suffix array. """ import sys import struc...
8d702c6213af4c4d38314df726da0dcc160e66e97b1a6918845899d8f1a8dbf2
Python
2,150
64
import torch from torch import Tensor import torch.nn as nn from typing import List, Union, Tuple class SpatialEmbedding(nn.Module): def __init__(self, backbone: nn.Module): """ A model architecture for skoots-based spatial embeddings. :param backbone: :type backbone: """ ...
2a196341bae514aeb1e7af9c58cf9824e670eec17e2e04b44046baa7836f1431
Python
2,151
58
# Copyright (c) OpenMMLab. All rights reserved. import mmcv import torch.nn as nn from mmcv.cnn import ConvModule from .make_divisible import make_divisible class SELayer(nn.Module): """Squeeze-and-Excitation Module. Args: channels (int): The input (and output) channels of the SE layer. rati...
9bdb76e9908b5f4734759a64854b93d6d63dce11c626c3f756ef5b30e3d8279f
Python
2,151
94
class Animal: """ Animal metadata container for experimental subjects. Parameters ---------- animal_id : str or int Unique identifier for the animal. name : str, optional Name of the animal. dob : str or datetime, optional Date of birth. sex : str, optional ...
9e9ee0858302f1973cb4eb7e841957fd7f9d99264c6e2dbf5f2be8989bd3330d
Python
2,151
71
from typing import Tuple import torch from batchgeneratorsv2.transforms.base.basic_transform import BasicTransform class MirrorTransform(BasicTransform): def __init__(self, allowed_axes: Tuple[int, ...]): super().__init__() self.allowed_axes = allowed_axes def get_parameters(self, **data_di...
b04d36e77d34367adb39c19d24abd6472c87404a1d647fb65aa943eb46388a76
Python
2,151
67
#!/usr/bin/env python # This file is part of connectome-manipulator. # # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2024 Blue Brain Project/EPFL import importlib.util from setuptools import setup, find_packages # read the contents of the README file with open("README.rst", encoding="utf-8") as f: README...
ccfa2dcda6c211b03c838f552d01f216f67a8972c986f138848252056317ff33
Python
2,151
48
import strawC, numpy as np, random, argparse, gzip, pandas as pd def readStrawCResult(result, bin_offset=0): i, j, v = [], [], [] for r in result: i.append(r.binX) j.append(r.binY) v.append(r.counts) return np.array(i, dtype=int), np.array(j, dtype=int), np.array(v, dtype=float) ...
a8d4e9a4de96a5e1a01f7de171311caa6261dad4912976081f8aa7eb343b6e4d
Python
2,152
68
"""Tests for locomotion.tasks.two_tap.""" import cluster.multi_gpu as multi_gpu import functools from absl.testing import absltest import numpy as np import os DEMO_PATH = "../demo/markerless_mouse1" CONFIG_PATH = "../tests/configs/dannce_mouse_config.yaml" DANNCE_PATH = "../tests/configs/label3d_dannce.mat" class...
e7edf0498c60b6ba0b56338ab135e61343151dd0d40f5e907dd6196bd0062d34
Python
2,152
63
# -*- coding: utf-8 -*- """ Created on Sun Mar 27 14:08:48 2022 @author: Artur Klepaczko """ import csv from itertools import product from pathlib import Path from typing import Final import numpy as np from glcm_extractor import get_glcm_feature_vector from shape_extractor import get_shape_feature_vector ROOT: F...
f493f7f5046cffb5b015fe1852a83a931663813e6ac99637d7dacc93d7834697
Python
2,152
85
import numpy as np import torch import pickle import os, sys import glob import pandas as pd input_folder = sys.argv[1] subset = sys.argv[2] split = torch.load("./split_dict.pt") valid_index = split[subset] def flatten(d, index): res = [] for x in d: res.extend(x[index]) return np.array(res) ...
d31a83f012339ed52f0d05397f387338cacf5be3cf114beb1c21cb08f846c5b8
Python
2,153
61
from __future__ import annotations from pathlib import Path import numpy as np import pytest from pytestqt.qtbot import QtBot from ..conftest import close_or_pause from .conftest import MainWinFactory from .conftest import draw_and_commit_polygon from .conftest import select_shape from .conftest import show_window_a...
79b96a83365dc54fe8fdb41d1336344fb5512119eb7ef44ad02b8d99155dfbee
Python
2,154
58
import functools from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.check_submission import check_models from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images import torch from .evnet.evnet import EVNet def get_model(name...
19ddb434489b6533d870eaa1480ee4b211efb016ae51fbc6f4a1be54ae1b29f2
Python
2,155
74
# -*- coding: utf-8 -*- """ Show low resolution of colour system With this script, the low resolution of colour perception can be shown. An rgb image is read and converted to greyscale. Then, a grid is defined on the image and only the grid points are coloured by a smoothed version of the initial colour image. """ #...
adaeb82ce361922cafba83259b1be4f8a96aac799fae227c118f2d916cdae872
Python
2,155
60
# 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/master...
47979406358347d8b6ace735f09d82c05437dcdd1b9f258732c28bb3c20c0a18
Python
2,156
39
from string import ascii_lowercase as alphabet import numpy as np from pytest import approx from brainscore_core.supported_data_standards.brainio.assemblies import NeuroidAssembly, DataAssembly from brainscore_vision import load_ceiling from .ceiling import PearsonCorrelation class TestInternalConsistency: def ...
ebd631ede08a1f9925132e09d165f852be6b679182c7303c4af41ff2f192401c
Python
2,157
67
""" Example of how to use the prediction pipeline inside osl-dynamics to perform a grid search and nested cross-validation. This script is based on simulated data. """ import numpy as np from osl_dynamics.analysis import prediction from osl_dynamics.utils.misc import set_random_seed set_random_seed(42) # Create a ...
a31102a703ef1e0e446f040be8384862db10f2302e74e0723c74bbc32d69359b
Python
2,158
62
import nilearn import nilearn.plotting import scipy import nilearn.image import numpy as np import pickle import fire import matplotlib.colors as colors import matplotlib.pyplot as plt from matplotlib.colors import LinearSegmentedColormap from matplotlib.colors import ListedColormap, BoundaryNorm task = "category" ba...
fd572ec9081b73d4479f3af176122d50be65a268369f3c9ea8e06d6bebafc191
Python
2,158
74
""" .. _surface_picking_example: Picking a Point on the Surface of a Mesh ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This example demonstrates how to pick meshes using :func:`surface_mesh_picking() <pyvista.Plotter.enable_surface_picking>`. This allows you to pick points on the surface of a mesh. """ ############ IMPO...
1891f0b0a91ac442076b7b628ddb6ecaff024c4097dd5d8f873ae8ec8d16edd1
Python
2,159
68
from xml.dom.minidom import parse import xml.dom.minidom import numpy as np import sys import getopt import json #Usage def get_xml_matrix_usage(): print(""" Usage : SEAM.py get_xml_matrix -i <file.xml> -o <output> """,flush=True) def get_trackEM_forward(param :str) -> np.matrix: ...
44a12d89629f0bd394e5c9fce58b54459e5597cef4c3cd69c7b5742f85a8e2eb
Python
2,160
57
"""Test the functions in the yasa/heart.py file.""" import unittest import numpy as np from yasa.fetchers import fetch_sample from yasa.heart import hrv_stage # Load data ecg_filepath = fetch_sample("ECG_8hrs_200Hz.npz") ecg_file = np.load(ecg_filepath) data = ecg_file["data"] sf = int(ecg_file["sf"]) hypno = ecg_f...
6fc490053428384f807d1e36ff5312d9a69558aaecb7a3a52e6882e184813d43
Python
2,160
71
import pytest import os import numpy as np import pandas as pd from collections import OrderedDict from impedancefitter import get_equivalent_circuit_model, PostProcess, Fitter from openturns import Distribution, TestResult @pytest.fixture def postprocessRC(): f = np.logspace(1, 8) omega = 2. * np.pi * f ...
ab715e1fe85fb191c39fb39343971a1cd184eedc86b975fb0d001a762ef8f44f
Python
2,160
71
# The ImpedanceFitter is a package to fit impedance spectra to # equivalent-circuit models using open-source software. # # Copyright (C) 2021, 2022 Julius Zimmermann, # julius.zimmermann[AT]uni-rostock.de # # This program is free software: you can redistribute it and/or mod...
af9d5d0a2d1b50cb03bae0663420002316fc95ea2dfd9c2d80d30bca9179506f
Python
2,160
76
""" Wrappers for VTK lookup tables. """ # Author: Oualid Benkarim <oualid.benkarim@mcgill.ca> # License: BSD 3 clause from vtk.util.vtkConstants import VTK_STRING, VTK_UNSIGNED_CHAR from .base import BSVTKObjectWrapper from ..decorators import unwrap_input class BSScalarsToColors(BSVTKObjectWrapper): """Wrapp...
e42488547c8b2762e624ddec33190c6455e79d78fdaea34da4ef3645d20ad111
Python
2,160
65
"""Deprecated compatibility shim for OpenAI / Argo model loading. The construction logic now lives in ``chemgraph.models.endpoints.openai_direct`` and ``chemgraph.models.endpoints.argo`` behind shared protocol builders. Prefer ``chemgraph.models.loader.load_chat_model``, which routes Argo Claude models through the Ant...
153d30e7537178065ac8b3ff19bb947448c3d3f0e66a48780a7b1049413e43db
Python
2,161
57
import torch from torch_geometric.data import Data from torch_geometric.data.datapipes import functional_transform from torch_geometric.transforms import BaseTransform from torch_geometric.utils import to_scipy_sparse_matrix @functional_transform('largest_connected_components') class LargestConnectedComponents(BaseT...
439ea8ea607ed87c238044996ae57c404254f49b072b6bd513b8edff386fc014
Python
2,161
60
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile from scilpy import SCILPY_HOME from scilpy.io.fetcher import fetch_data, get_testing_files_dict # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys=['tractometry.zip']) tmp_dir = tempfile....
bef3c0c2f83cb5fa61d68ccbdde1b0dfe025ed15155edfb1a587c4243973883f
Python
2,161
89
#!/usr/bin/env python3 import argparse import numpy as np from ase import io from ase.io.trajectory import Trajectory from ase.io import read, write from HessKerNNCalculator.KerNNCalculator import * from os.path import splitext import ase.units as units ''' Usage: python3 NN_NM.py -i structure.xyz ''' #parse comman...
3d427d116d1048ec82a5b01263e561e420d7b3a30d73d3c34f62e74633fcae1b
Python
2,162
70
"""Mask files. - MNI152_T1_1mm_brain.nii.gz - MNI152_T1_2mm_brain.nii.gz - MNI152_T1_8mm_brain.nii.gz - ft_8mm_brain_mask.nii.gz Mask files can be resampled in FSL, e.g. to resample the 1x1x1 mm grid MNI mask file to a 5x5x5 mm grid: .. code:: flirt -in $FSLDIR/data/standard/MNI152_T1_1mm_brain.nii.gz -ref $FSL...
1192315334a7aef58f3a1ba668a4a661f0b6f93428dd28e3879922e61b6fed58
Python
2,163
89
import arbor as A from arbor import units as U import matplotlib.pyplot as plt from pathlib import Path import numpy as np here = Path(__file__).parent ctr = "(location 0 0.5)" mrf = A.load_swc_neuron(here / "Acker2008.swc") dec = ( A.decor() .set_property(Vm=-55 * U.mV) .paint('"soma"', A.density("hh"...
5dba8adc62b7352464a843ae3962b6ad19c1c50c2e66190d5ce143777fd3082d
Python
2,163
63
import torch from utils import common_functions as c_f from reducers.base_reducer import BaseReducer from reducers.mean_reducer import MeanReducer def aggregation_func(x, num_per_row): zero_denom = num_per_row == 0 x = torch.sum(x, dim=1) / num_per_row x[zero_denom] = 0 return x class PerAnchorRedu...
c6019046943c1ac2f65846e636320ebc43a4f7ff8a9efeafc7651bfe30ed3e98
Python
2,163
96
""" utilites to read the linemod dataset to numpy types @author Pavel Rojtberg <https://github.com/paroj> """ import numpy as np def _parse_ply_header(f): assert f.readline().strip() == "ply" vtx_count = 0 idx_count = 0 for l in f: if l.strip() == "end_header": break elif...
c07f5c274b106c581d7393c33fecdd1ca78a2eb8209f1811d03da9d8ca8ed53c
Python
2,164
45
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'selectstack.ui' # # Created by: PyQt5 UI code generator 5.7.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_selectStack(object): def setupUi(self, selectStack): sel...
52a0e60f0bece2c7d364ccd24f0a873384562b07accceeb69ed48c6c4c120c89
Python
2,165
66
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile import numpy as np import nibabel as nib from scilpy.io.streamlines import save_tractogram from dipy.io.stateful_tractogram import StatefulTractogram, Space, Origin tmp_dir = tempfile.TemporaryDirectory() def init_data(): streamlines = [[...
c57ec0483a034e6fd3c9c6f1e858f2395da8d4354885b33da6ee44666d128a40
Python
2,165
43
from tests.common import * class Test_RVC_Pipeline: # change the third instance of "run: true" to "run: false" to turn off the RVC module # run the RVC module using this config_RVC_norun (which should do nothing) def test_pipeline_no_run(self,demo_dir): LOGGER.info("run RNA variant calling pipeline with ...
90ff47346c0ae0ec1a873584c793abb9ec620196e0c11e86dff3bdc7e83b54aa
Python
2,166
56
import matplotlib import numpy as np from matplotlib.colors import LinearSegmentedColormap font = {'family': 'serif', # 'serif': ['Computer Modern'], 'serif': ['Helvetica', 'DejaVu Sans'], # 'weight': 'bold', 'size': 8} savefig = {'bbox': 'tight', 'pad_inches': 0.01, ...
f7670b245760fb618549f98c742bfe6ae03f27e77d7bfe82901aee990554a4cc
Python
2,167
70
# -*- coding: utf-8 -*- # python standard library inputs import os import datetime # external inputs from nipype.interfaces.freesurfer import VolumeMask def get_ribbon_fsurf(path, sub): """Get ribbon fsurf. This function calculates the grey matter ribbon mask using a wrapped freesurfer function. Old f...
3f9bd70aebbfd294daddadab37aae01f4833299d1f765366b47fccd28e4a0d5e
Python
2,168
62
"""Run the ALCF IRI Facility API workflow through the ChemGraph agent. Uses the ``single_agent_iri`` workflow, which can be bound to either of two shipped tool sets (both cover ALCF's IRI REST API at https://api.alcf.anl.gov): * ALCF_IRI_FLAT_TOOLS -- 43 direct tool wrappers (default; ...
4884b77015f8b405a583cbffdcf5277847523df5cfac8340de20a8d5cc07ac36
Python
2,168
71
import seaborn as sns import matplotlib.pyplot as plt import pandas as pd import glob import os wk_dir = snakemake.params.wk_dir opdf = snakemake.output.opdf opng = snakemake.output.opng dfs = [] for statf in glob.glob(os.path.join(wk_dir, '*/logs/stats_summary.txt')): dfs.append(pd.read_table(statf)) a = pd.conc...
b20142784a989e587f3fac4173d6f6834a87ed5d9c1998d0d5c9f215684e6bbd
Python
2,168
67
from tomocupy_stream import GPURecRAM from tomocupy_stream import find_center import h5py import numpy as np import tifffile # init data, dark, flat, theta with h5py.File('data/test_data.h5', 'r') as fid: data = fid['/exchange/data'][:, :, :] dark = fid['/exchange/data_dark'][:] flat = fid['/exchange/data...
c9ba3e600c502edbd6b1349631da6ec59baec85d76483b97ad19f3d7e0069e47
Python
2,168
52
import imageio from tqdm import tqdm import warnings from .util import generate_frames, filter_frames_index_function, apply_filters, discretize from math import ceil def zebra_noise(output_file, xsize, ysize, tdur, levels=10, xyscale=.2, tscale=50, fps=30, xscale=1.0, yscale=1.0, seed=0, filters=[("comb", 0.08)]): ...
3f1b6a7d046546014f41f75bbc7765c2d909297aa8feff4e747445bded1cad76
Python
2,169
24
from brainscore_vision import benchmark_registry from .benchmark import Allen2022fmriSurface, Allen2022fmriSurfaceRSA # Default: 8 subjects, 515 images benchmark_registry['Allen2022_fmri_surface.V1-ridge'] = lambda: Allen2022fmriSurface('V1', 'ridge') benchmark_registry['Allen2022_fmri_surface.V2-ridge'] = lambda: All...
0be15b505d1f98e2b00a22db6d2f29074566e956e699a2dfdc1c3c09daa30064
Python
2,170
79
import unittest import warnings from unittest.mock import patch from rscvp.model.glm.main_eval import BehavioralGLMOptions from .util import check_attr class TestGLMModule(unittest.TestCase): """Test in ``model.glm`` module and relevant statistic locally""" @classmethod def setUpClass(cls): warn...
2acd0dadf733301fbfc46ccc65d3adab1af40fde985a5c67311f96166acba4ac
Python
2,170
47
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 # binarize an image under a threshold class FSLMathsUnderThrInputSpec(CommandLineInp...
dde6e983d05b195eefb1d832669c58cad709941c1b778eb8f852a52da5b580be
Python
2,170
68
import nibabel as nb import numpy as np import subprocess import os import glob subs = ['sub-05'] digits = ['D2', 'D3', 'D4'] for sub in subs: volumes = sorted(glob.glob(f'/home/sebastian/Desktop/patchFlatten/{sub}_done/upsampled/registeredFunc/regTmp/vol_*_reg.nii.gz')) nrVols = len(volumes) layerFil...
0d334ad389e9951a2985f31d49d3fbda688db53e4b3a0cacc1fe120512982234
Python
2,172
68
import click from matplotlib import pyplot as plt import numpy as np import pandas as pd from cycler import cycler purple = [.5, 0, .5, 0.9] purple_light = [.5,0,.5, 0.3] green = [0, 1, 0, 0.9] green_light = [0,1,0,.3] blue = [1,.3,0, .9] blue_light = [1,.3,0,.3] colors = [purple,green, blue] colors_light = [purple_l...
a3d18e072b6445b6845fa157eccfc8b1da1ce62335a39141522a945807e981fe
Python
2,172
71
# 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...
6d19ffdf1b5edc435893952c5deec1ff4f8a3457e86262d9102bdf7c9a93df47
Python
2,174
64
# -*- coding: utf-8 -*- """ Method to extend interpolation objects to constantly / linearly extrapolate. """ #:copyright: Copyright 2015 by Christoph Kirst, The Rockefeller University, New York City #:license: GNU, see LICENSE.txt for details. import scipy.interpolate from numpy import array def extrap1d(x, y, int...
850d9fdb11c84a7264d73246b959bcb6de6ae5b27b567800cca7c014d0c956db
Python
2,174
60
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
b71f055e2b04627c6d552c3c2b46d505936da0bf80b1f2e51ba3639d7ab0a7d0
Python
2,175
45
import os,sys import torch import argparse from chinn.models import PartialDeepSeaModel, NNClassifier from chinn import train def get_args(): parser = argparse.ArgumentParser(description="Train distance matched models") parser.add_argument('data_name', help='The name of the data') parser.add_argument('mod...
18b4afe964263e0e6fa2a3a85d0ade0385d435b863b465d44850c6e6fc1133bc
Python
2,176
67
import ants import antspynet import sys import os.path from os import path import tensorflow as tf t1_file = sys.argv[1] output_prefix = sys.argv[2] threads = int(sys.argv[3]) tf.keras.backend.clear_session() config = tf.compat.v1.ConfigProto(intra_op_parallelism_threads=threads, i...
b8b97a572a0ae966d1bdc36b860f9791ee039065fafca4503beb697ae1481884
Python
2,176
56
import serial from psychopy import core def identify_targets(): # make list with one dict per port. Dict contains port and boolean that controls if it will be used sers = [{'ser': serial.Serial( f"/dev/ttyUSB{ser_num}", timeout=0), 'use': False} for ser_num in [0, 1]] for target in ['Buttons', 'Se...
cdacc18966b23c72eacb33fba690ab847b6aaa1cd0284f1c4ddd9d6f12e6ad54
Python
2,176
67
"""Example for running TINDA on MEG data from the Nottingham MEGUK dataset. """ import os import pickle import numpy as np import matplotlib.pyplot as plt from scipy.stats import ttest_rel from osl_dynamics.inference import modes from osl_dynamics.analysis.tinda import tinda, plot_cycle, optimise_sequence def get_d...
f378cf0b464f2ac5e1daf3609ba25fd51c7e34f294846281707ffe006c3e9ef1
Python
2,176
84
import pandas as pd import numpy as np ########## # analysis def load_exps(l_pqt): '''Load simulation results from disk Parameters ---------- l_pkl : list List of parquet files with simulation results Returns ------- exps : df data for all experiments 'path_res' ''' ...
4fe462bdf4e91076bb4a46683f271dfe7855a35f628c80d69ddd39a3ebf61626
Python
2,177
75
import functools import hashlib import importlib import io import tarfile from pathlib import Path from django.conf import settings from django.contrib.sessions.backends.base import SessionBase _OPA_RULES_PATHS = { Path(__file__).parent / "rules", } @functools.lru_cache(maxsize=None) def get_opa_bundle() -> tup...
97d83b34ff6e03d1978aec441bce3463d16b90f1c1d00200e497ecb6b0a84b81
Python
2,178
60
from nipype import IdentityInterface, Function from PUMI.engine import NestedWorkflow as Workflow from PUMI.engine import NestedNode as Node from nipype.interfaces import BIDSDataGrabber, fsl from nipype.utils.filemanip import list_to_filename from PUMI.pipelines.anat.segmentation import bet_fsl, bet_hd import os # ex...
df57374c143ca41b115d737e71f753fab93980c774a8a32d93bc0275dd8b5d72
Python
2,178
76
import pandas as pd import scipy.stats as stats import pyfocus __all__ = ["GWAS", "GWASSeries"] class GWASSeries(pd.Series): @property def _constructor(self): return pyfocus.GWASSeries @property def _constructor_expanddim(self): return pyfocus.GWAS class GWAS(pd.DataFrame): ""...
e2f7ad800dab230cc58eeea76062ab2f4ea17cc89d125985d651b38035ce43a2
Python
2,180
66
import sys,os from setuptools import setup, find_packages from os.path import join as pjoin, dirname, exists from glob import glob from dtiplayground.config import INFO as info using_setuptools = 'setuptools' in sys.modules extra_setuptools_args = {} if using_setuptools: # Set setuptools extra arguments extra...
db611a4bc8c2aa84e1c5f58302a1598c436921c384d11613b369d5015492fce3
Python
2,182
101
import numpy as np from scipy.constants import epsilon_0 as e0 from impedancefitter.cole_cole import cole_cole_R_model from impedancefitter.RC import RC_model, drc_model, rc_model, rc_tau_model omega = 2.0 * np.pi * np.logspace(1, 8, num=20) # parameters are chosen that multiple models yield same result # for RCfull...
e55db7365223cf6c41c67ff410929119436369c9255d8a662e70003af1a27387
Python
2,182
55
from eir.models.model_setup_modules.output_model_setup_modules import al_output_modules from eir.models.output.tabular.linear import ( LinearOutputModule, LinearOutputModuleConfig, ) from eir.models.output.tabular.mlp_residual import ( ResidualMLPOutputModule, ResidualMLPOutputModuleConfig, ) from eir.m...
a9b5667ac0330eeaccbee694eb722f2af435afd3db644ad5e4a79f37c129d621
Python
2,185
60
import argparse import torch from torch_geometric.nn import Node2Vec from torch_geometric.utils import to_undirected from ogb.nodeproppred import PygNodePropPredDataset def save_embedding(model): torch.save(model.embedding.weight.data.cpu(), 'embedding.pt') def main(): parser = argparse.ArgumentParser(des...
f4ed7c43b25ea935971eaa8f4841a637d78be287129bb6885ecb25689b38fdf9
Python
2,185
64
#!/usr/bin/env python3 import configparser import re import sys from pathlib import Path REPO_ROOT = Path(__file__).resolve().parents[1] RE_PLACEHOLDER_PR_URL = re.compile(r"//github\.com/[\w.-]+/[\w.-]+/pull/X") def main(): scriv_config = configparser.ConfigParser() scriv_config.read(REPO_ROOT / "changelo...
1041c0c1a51dd4a2406c74d53d88c12338914573010e4ee54cd786e8428b708d
Python
2,186
67
# Generated by Django 3.2.14 on 2022-07-18 06:37 import os import shutil from django.conf import settings from django.db import migrations from cvat.apps.engine.log import get_logger MIGRATION_NAME = os.path.splitext(os.path.basename(__file__))[0] MIGRATION_LOG = os.path.join(settings.MIGRATIONS_LOGS_ROOT, f"{MIGRA...
1082625354bf298035fbdeb3738ae783aa10ae4acff5bdb5afbc634323ff1e07
Python
2,186
48
#!/usr/bin/python ######################################### # Author: Yunjiang Qiu <serein927@gmail.com> # File: restriction_cut.py # Create Date: 2015-02-27 16:46:15 ######################################### import sys import argparse from Bio import SeqIO from Bio.SeqUtils import GC import re def find_site(fasta,s...
7b8fc4efbf42f8d47ab0144df57b9c0d14c7be3ca3a7aac58dd697e1338e73bd
Python
2,186
68
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from io import BytesIO import boto3 from botocore.exceptions import ClientError from shared.utils.config import MOTO_ENDPOINT_URL, MOTO_KEY, MOTO_SECRET_KEY class S3Client: def __init__( self, endpoint_url: str, *, access_key: str, se...
aefec70e0e34eef39835cd05dc5f643731d4285261253a91508ce041468942af
Python
2,186
58
import functools from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.check_submission import check_models from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images import torch from .evnet.evnet import EVNet def get_model(name...
ce40626ddccebdad3f589e57eea8d67976c4ee2501b749021c1554216e493a1e
Python
2,186
45
import os import sys import json from mako.template import Template sys.path.append(os.path.abspath(os.path.dirname(os.path.realpath(__file__)))) from macularCellFactoryGenerator import load_jsons as load_cell_jsons from macularSynapseFactoryGenerator import load_jsons as load_synapse_jsons def generate_header(json_...
3ba1b748786ea26f370d7957b68b11c3847cd40754963eb670cf9a11557a3c08
Python
2,187
61
import json from tqdm import tqdm from MyBotometer import Botometer, NoTimelineError from tweepy.error import TweepError import tweepy from argparse import ArgumentParser import os if __name__ == '__main__': parser = ArgumentParser() parser.add_argument('--dataset_name', type=str) parser.add_argument('--p...
9b2e9c851900d713e2ed94332b2f25d55331ab93521f400b7d2f406ca7bbc50f
Python
2,187
52
from PySide6.QtWidgets import QApplication, QMainWindow, QFileDialog, QFormLayout, QPushButton, QVBoxLayout, QDialog, QLabel, QComboBox, QDialogButtonBox microscopy_options = ['Brightfield/Phase Contrast', 'Nucleus', 'Budneck', 'Others'] class FileTypeDialog(QDialog): def __init__(self, parent=None): super...
d1ff0af10cd7388feb78b711027eef9b84b4872d33f434ced285dde5b1ac2619
Python
2,188
61
from collections.abc import Sequence from dataclasses import dataclass, field from typing import Literal al_cat_loss_names = Literal["CrossEntropyLoss", "BCEWithLogitsLoss"] al_con_loss_names = Literal[ "MSELoss", "L1Loss", "SmoothL1Loss", "PoissonNLLLoss", "HuberLoss", ] @dataclass class Tabular...
17666158601ba957ec6bd1b7f05e6fcabf934de6a09fc40f0d90cecef4622d88
Python
2,189
56
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile from scilpy import SCILPY_HOME from scilpy.io.fetcher import fetch_data, get_testing_files_dict # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys=['commit_amico.zip']) # ToDo: For more ...
9ebda4b914cd3ff54e5267ff240e6f245d33ed54fdf3ad28e27dc4d0bbb2582e
Python
2,189
64
from sklearn.metrics import accuracy_score, f1_score, precision_score, recall_score, matthews_corrcoef, \ roc_auc_score, precision_recall_curve, auc import torch import torch.nn.functional as func def null_metrics(): return { 'acc': 0.0, 'f1-score': 0.0, 'precision': 0.0, ...