sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
0336a13fb48ace41287ef0a7ad4a981cdba9815820228b22b21535a2559c56e8
Python
4,445
78
import matplotlib.pyplot as plt from src.ionisation import * if __name__ == "__main__": """ Equation for systematic error removal E_actual (in eV) = 0.397 + 0.731 * E_vert (in eV) for wB97X-D4 Hydroxyorcein | Calculated energies | Energies after systematic error removal S1111 | ...
115e6bddeb379a821a4d88eeab13b5e458d717ef56d6b67d63e82a910f65d469
Python
4,445
105
# -*- coding: utf-8 -*- """ Created on Wed Jan 18 14:12:39 2023 @author: gligorov """ import xgboost as xgb import numpy as np from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score from Data_processing import keep_features, generate_all_permutations, flatten_3d_array...
6cd62cce160feb67d27837bcc3f223e328447fe76fe8d88d19c09d0b6d8e92e6
Python
4,445
137
""" Shared functions to load/generate data """ import itertools import math import random import string import numpy as np from impyute.dataset.corrupt import Corruptor from impyute.ops import error def randu(bound=(0, 10), shape=(5, 5), missingness="mcar", thr=0.2, dtype="int"): """ Return randomly generated data...
ecee7715d99ee0b5566260cda764ce27ae30f2da34923e6d877d00189629b911
Python
4,445
74
#!/usr/bin/env python ###--------------------------------------------LOAD LIBRARIES import scanpy as sc import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import numpy as np import copy import os, glob import random ###--------------------------------------------4 layers print('Reading anndata'...
b1bf528d41d682acd4205aa05c8663fdd2f24372c0bea0219b533dd893557a41
Python
4,446
80
import pytest import numpy as np from brainscore_vision import load_dataset, load_stimulus_set from brainscore_vision.benchmark_helpers.neural_common import filter_reliable_neuroids TOTAL_NEUROIDS = 2048 RELIABILITY_THRESHOLD = 0.3 EXPECTED_RELIAB_NEUROIDS = { 'monkeyF': {'V1': 332, 'V4': 117, 'IT': 157}, 'monk...
f72772ac9d6ca51164102a1a54991f534ae707e68a8d40429c947564cf77506c
Python
4,446
138
import jax import jax.numpy as jnp import matplotlib.pyplot as plt import glob import sys import os import re import json plt.rcParams["font.sans-serif"] = ["DejaVu Sans"] # Best available plt.rcParams["font.family"] = "sans-serif" plt.rcParams.update({ "font.size": 10, "axes.titlesize": 10, "axes.l...
9c088ab37c89183706d01c85c3df6cf457147a1efa857f8fa4e235c62dcfd1b2
Python
4,449
118
""" For code used in distributed training. """ from typing import Tuple import torch import torch.distributed as dist import os from torch import Tensor import torch.multiprocessing as mp def set_sharing_strategy(new_strategy=None): """ https://pytorch.org/docs/stable/multiprocessing.html https://discu...
02f2ca13fc653865247ccf08cbba00c734e9f161ea6b9205eebbb15ed86fa089
Python
4,450
100
# -*- coding: utf-8 -*- import argparse import sys import numpy as np import pandas as pd from loguru import logger import time from scipy.special import softmax sys.path.append('..') from nerpy.ner_model import NERModel from nerpy.dataset import load_data def main(): parser = argparse.ArgumentParser('NER task'...
0cb72624bbf1d18bd376c2ebe7baf2a17238455b62f38e24e81e488ed7da7ac2
Python
4,450
149
"""Contains utility functions for the SRC package.""" import os import logging from dataclasses import dataclass, field import pandas as pd import pysam @dataclass class PRSConfig: """Common configuration class for PRS scoring.""" bcf: str col: str = field(default="GT") build: str = "hg38" imput...
b53e02d3ccdc508014d4d3d2bd19923b5b9ff107fbdae3d136f00a0e178ea669
Python
4,450
127
"""Train surrogate model with Pytorch Lightning""" import os import hydra import lightning as pl import omegaconf from dotenv import load_dotenv from hydra.utils import instantiate from lightning.pytorch.callbacks import EarlyStopping, ModelCheckpoint, TQDMProgressBar from omegaconf import DictConfig, OmegaConf, open...
c4c3ab25342d18a7819278775e054bc243a29935d4ea6c3a8936ed3c8f0b95fe
Python
4,450
141
from lasagna.tree.node import Node _ROOT, _DEPTH, _WIDTH = list(range(3)) # Used by classes to navigate the tree class Tree(object): """ A simple tree class """ def __init__(self): self.__nodes = {} @property def nodes(self): return self.__nodes def add_node(self, id...
cd6d303b5a4bdef39d0c20fcd0d154c048bb308d6383f2812e17f2db4e2b65f3
Python
4,451
107
from zigzag.classes.stages import * import re def get_hardware_performance_zigzag( workload, accelerator, mapping, opt="latency", dump_filename_pattern="outputs/{datetime}.json", pickle_filename="outputs/list_of_cmes.pickle", ): # Initialize the logger import logging as _logging _...
de7e8a9a8fdc90aab8d15a359955f68c8c90030d16868f834bced2d3ba1336e6
Python
4,451
119
############################################################################# # Copyright (C) 2020-2026 MEmilio # # Authors: Maximilian Betz # # Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Li...
1a2628d875b8eb2dda6ecb98873423bcb6ec28e798c905950a58e40219274194
Python
4,452
121
import numpy as np from matplotlib import pyplot as plt from matplotlib.axes import Axes from neuralib.plot.colormap import insert_colorbar __all__ = [ 'plot_decoding_err_position', 'plot_confusion_scatter', 'plot_confusion_heatmap' ] def plot_decoding_err_position(mean_err: np.ndarray, ...
4c31d06e91b81a78e3ff69356d6f2c1a1ac1cea2c4841fed7510c8a6f840c03e
Python
4,452
128
"""Create rasters and firing rate plots.""" import os import sys import os sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import matplotlib as mpl import pandas as pd import json from ast import literal_eval from spikes.spike_utils import get_condition_spike_times from spikes.spike_u...
6057f527e7bac914b3c7ebfc65a3b1c405a4b7f91de3bf15cfc3103c313e9cdf
Python
4,454
109
"""Can the window actually be resized vertically? On a Mac the window could be made wider and narrower but its height would not budge. Nothing pinned it: the Results tab's network-viewer control column is five stacked group boxes, and an unscrolled panel hands its full height to the window as a *minimum*. That minimum...
6ca6cc663979cbf8666fffa27a4c6ceef1fe2e92d9affd0e9c5aabf779db068f
Python
4,454
108
import warnings 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_modified_topopro import IvimModelTopoPro class IAR_LU_modified_topopro(OsipiBase): """ Bi-exponential fitting algorithm by...
91cc73975f5e3e81ee4471765100b15104bf00a9051cfbf148354206378164f5
Python
4,454
112
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Script for fitting a Bingham distribution to each fODF lobe, as described in [1]. The Bingham fit is saved, with each Bingham distribution described by 7 coefficients (for example, for a maximum number of lobes of 5, the number of coefficients is 7 x 5 = 35 -- less th...
17bbc8d1cb5c20ad4c40ff71ebe512439b027483a8eb685faa6f921876c1c61c
Python
4,456
138
#!/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 import seaborn as sns import sys from pathlib import Path # (1) Read the morphology from an SWC file. if len(sys.argv) == 1: print("No SWC file passe...
2a6887f61a05bbb035cb99391d7d8a501d1b268398f16e6450140b86fcfe39bf
Python
4,458
143
import json import os import os.path as op def write_json(fname, data): """ Write data to JSON file. Parameters ---------- fname : str Full path to the file to write. data : dict A dict containing the data to write. Returns ------- None """ with open(fnam...
120c029c64cafe4a2882fa0dd2f765856ac7f2eed5769759d73950c4c9be18d6
Python
4,459
102
import json import numpy as np from PIL import Image def update_cellclass(classjson: str, maskmap: str, maskmapdownfactor: int) -> None: """ In the loaded json, replace all the cells predicted as tumor cells outside tumor region into epithelial cells (class 6) and rewritte previous json with new changes...
8fd20ea8f22cf416ac84652f2933aaa803181d7c962134c9c5dd52d7279beab2
Python
4,459
130
from pydantic import BaseModel, Field, model_validator from typing import Any, Optional, Dict import torch import logging try: from fairchem.core import FAIRChemCalculator, pretrained_mlip except ImportError: logging.warning("fairchem is not installed. .") FAIRChemCalculator = None pretrained_mlip = N...
ffc1fff29950f353f6e942ae834006bfcad6fb6f9b004a59bd528428000051cc
Python
4,459
122
import pandas as pd import numpy as np import numpy as np from numpy.linalg import norm import MDAnalysis as mda from MDAnalysis.analysis import distances import sys def point_in_triangle(x, y, a1, b1, a2, b2, a3, b3): def area(x1, y1, x2, y2, x3, y3): return abs(x1*(y2 - y3) + x2*(y3 - y1) + x3*(y1 - y...
98ae39a06b5e8421946fbf6b0e17a257e1e4e1d21933d13781fbe8307d31b792
Python
4,460
120
import numpy as np import scipy import matplotlib # matplotlib.use('Qt5Agg') import matplotlib.pyplot as plt import pathlib from postprocessing_modules.axonal_delay_kernel import AxonalDelayKernel from helper_functions.load_cell_distributions import compute_distribution from helper_functions.cell_type_lib import get_c...
05b363f6deaa0c532060e6f09ff6e8cf8f13a70068f7dafda39857c1eee8a3b3
Python
4,462
131
#!/usr/bin/env python3 """ Rule-Based Detector Evaluation Evaluates heuristic artifact detectors on binary test data. Authors: Evans Nyanney, Parthasarathy D Thirumala, Shyam Visweswaran, Zhaohui Geng Year: 2025 License: MIT """ import os import json import logging from typing import Tuple, Dict, Any import numpy a...
e463cc140c0341a849d59b5c61c290c83022f3018238f364e28651553a42b28a
Python
4,462
125
"""Make discrete distance bins for figure""" import nibabel as nb import numpy as np import subprocess root = '/Users/sebastiandresbach/data/s1Anfunco/Nifti/derivatives' digits = ['D2', 'D3', 'D4'] for digit in digits: distFile = f'{root}/sub-07/func/rois/sub-07_{digit}_maxpoint_BOLD_geodistance.nii.gz' nii ...
66e5ae8b6f1b95ba5f3a805406eb57fabba39fc75ea9b44bbb788a97c4a59477
Python
4,463
134
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) # %% for met in ['jets', 'ss']: ...
731b56a568313c4ed4ef262e9cd32dd4f2292682749e4be4541261ef6aac59bf
Python
4,463
146
""" this module provides a PyTorch implementation for the least square althorithm, such as the conjugate gradient method. Author: Zhengguo Tan <zhengguo.tan@gmail.com> References: * https://sigpy.readthedocs.io/en/latest/generated/sigpy.alg.ConjugateGradient.html * https://docs.scipy.org/doc/scipy/referen...
c65c57186012dcee1bfbbc8e7e4b123594a9bc42bfc42243f3b1b7be2b7c56f7
Python
4,463
136
from tqdm import tqdm import numpy as np import pandas as pd from nest.hotspot.hotspot import _compute_cutoff, compute_hotspots from nest.utility.utility import get_activity_dataframe from nest.cci.cci import compute_activity def interaction_hotspots( adata, verbose=False, interactions=None, save_act...
9cbeb256dc563fe860601acb44a8c4bdeae4ee99c4a324db5b388cdd7e275d87
Python
4,464
115
import os import shutil import csv import hashlib import logging from util.config_vars import config from util.io import make_dir_if_not_exists class IdentifyAndMoveDuplicates: """ The downloaded data may contain duplicates. Those duplicates are identified and moved into a dedicated duplicate folder t...
553e6bda69dee65f3b684b1db742f72ef1bdb4892751dd0f99bb804231526bc3
Python
4,465
98
#!/usr/bin/env python """ Material configurations for Rwp Uncertainty Quantification """ import os SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) CNN_DIR = os.path.dirname(SCRIPT_DIR) MATERIALS = { 'CeO2': { 'model_folder': 'model_CeO2_100epochs_digit_zero0p0075_lp0p005_May13_2025', 'mod...
b72d6e12ecb5618ddee208811b11b229d8a534aa66c8a5b6892a40e4cf42872a
Python
4,465
148
"""bpdb.py - Tools for working with protein structure files """ from collections import Counter from Bio.PDB import MMCIFParser, PDBParser, Selection, NeighborSearch def pdb_model(structure_file, water=False, ions=False): """Return a biopython [1] model entity from a structure file. Parameters --------...
d8e0136cf84296661f54bf1e12a844a270dbc4511e3f82eebff7878fc8262c86
Python
4,466
113
import pandas as pd import os import sys import numpy as np import subprocess def stiching_denoised_patches(input_path, output_fn = None): cts_files = sorted([x for x in os.listdir(input_path) if 'Counts.txt' in x]) denoised_fns = sorted([x for x in os.listdir(input_path) if 'denoised' in x]) assert(len(c...
4680b55826da1552f29a9c26c139d6e4a4aa18dcb7543b80124bc19652dc1595
Python
4,467
114
import torch from torch import Tensor from typing import List, Tuple, Optional, Union import torch.nn as nn from .layer_norm import LayerNorm from .drop_path import DropPath import warnings """ self.double_conv = nn.Sequential( nn.Conv2d(in_channels, mid_channels, kernel_size=3, padding=1, bias=Fals...
6e07c8a913241c9013bb5626d3d9f5f2403cefa6a43053fe6404dacead2e43dd
Python
4,467
122
# 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...
1d91e8a75777aeccb9cb30febaf4dff0578ce27fec873b393c879ef2df58a2f0
Python
4,468
58
from brainvoice.waveform_utils import write_waveform import pathlib import os import glob import shutil import pandas as pd from tqdm import tqdm import soundfile as sf if __name__ == "__main__": source_root_path = '05-09-23_decoding_single_trial_vs_sil' destination_root_path = '05-09-23_decoding_single_tria...
20a6f2c41bc33503fab1916a81eedf80cb3ab3b38d0f63905539883e62728310
Python
4,468
110
# # This script is an example of how to use the ModalityCentricPreprocessor class to preprocess a set of MR images. It is only here for quick development and testing purposes. It is not intended to be used in a production environment. from pathlib import Path from brainles_preprocessing.modality import CenterModalit...
7b021354acbfeeb479eb6d9456bdb1ddfaf6d44f65fa3115cefebf9cf7b7823d
Python
4,468
145
#!/usr/bin/env python # # compare.py # # copyright F. Nedelec, December 14th 2007, 14.03.2018; 4.8.2020 """ compare.py Compare files from two root directories Usage: compare.py root1 root2 [opendiff] """ from __future__ import print_function import sys, os, shutil, time, subprocess, tempfile exe = "diff" dif...
7db86cd04d0dd78f3f2e285dd9c9cfa882161629a9f2c8f08364e937091e98df
Python
4,468
98
from pathlib import Path import pytest from pytest import approx from brainscore_vision import benchmark_registry, load_benchmark from brainscore_vision.benchmark_helpers import PrecomputedFeatures from brainscore_vision.benchmark_helpers.test_helper import StandardizedTests, PrecomputedTests, NumberOfTrialsTests, \ ...
e7c4d40d677edc7c61ab4789efa0830bf372bf3619dd0968a3a23bc29263be86
Python
4,468
122
import warnings warnings.filterwarnings("ignore", message="It is not recommended to directly access") import torch import torch.nn as nn import torch.nn.functional as F from torch_geometric.nn.models import MLP from dataset import BatchMolGraph from module.ExplainableCrossAttentionEncoder import ExplainableCrossAttenti...
ed8c03c5e94aa60a108f00e5ed9073b7fe04e7c4d1f3baa1cec8f4cc37693a49
Python
4,472
121
import sys, os, copy import torch from monai.config import print_config from monai.transforms import ( AddChannel, Compose, LoadImage, EnsureChannelFirst, ScaleIntensity, ToTensor, HistogramNormalize, ResizeWithPadOrCrop ) from monai.data import NibabelWriter from utils.netdef import ShuffleUNet import numpy as...
03554df4f63b666a31bf83285c686989a87ad1ba98c066e62e83b0715f6b1e89
Python
4,473
114
import argparse import subprocess import shutil import os import time import multiprocessing from gen_rosetta_args import gen_rosetta_args def copyComplete(source, target): # copy content, stat-info (mode too), timestamps... shutil.copy2(source, target) # copy owner and group st = os.stat(source) ...
121cf7e57028c9487f150cb7d2f71b78afac83608931d0de54ce92756aa2a5b9
Python
4,473
97
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Sep 8 13:58:12 2023 @author: rl05 """ # import sys import os.path as op import numpy as np import pandas as pd # sys.path.append('/imaging/hauk/rl05/fake_diamond/scripts/preprocessing') import config def count_letters(text): return sum(c.isalph...
4aac5cedf88b9681042557e49fb40cfa16c56ff02285e1e37304ad3f59a9dcda
Python
4,474
107
""" AFMmeasurements_changingsettings_oneposition-manysettings.py This script iterates over a list of measurement settings at every position, so "go to position 1" --> "take a measurement with each of the settings in order_force-settings.txt" --> "go to position 2" --> "take a measurement with each of the settings in o...
b0800e50d8ae3b26d4db8eac3593c9350ed07bad1c67a10fefc51b4f51d4778e
Python
4,474
134
#!/usr/bin/env python """ Filming tests. """ import os import pytestqt import sys from PyQt5 import QtCore, QtGui, QtWidgets import storm_analysis.sa_library.datareader as datareader import storm_control.hal4000.hal4000 as hal4000 import storm_control.sc_library.hdebug as hdebug import storm_control.sc_library.param...
618a6152680dbdde75a72e4f5813a19d70d79a45399f82358ff43e71cae332b1
Python
4,475
82
from brainvoice.data.commonvoice_spectrogram_dataset import CommonVoiceSpectrogramDataset from brainvoice.data.stratified_batch_sampler import StratifiedBatchSampler import torch import pandas as pd import os class CommonVoiceSpectrogramStream(object): def __init__(self, bv_dataset_path, cv_dataset_path, catego...
81cf5fd2d649caff1a99fb95a53f53cbf865b714edb74e3947c1021b7ed77959
Python
4,476
156
import os import pytest import numpy as np import pandas as pd from collections import OrderedDict from impedancefitter import Fitter, get_equivalent_circuit_model R = 1000. C = 1e-6 model = "parallel(R, C)" Rc = 5.3e-6 dm = 7e-9 ecp = 60 kcp = 0.5 p = 0.2 km = 5e-11 em = 7.9 p = 0.1 kmed = 0.1 emed = 80 c0 = 1 k =...
869a7bd00d26030ce473ea1b1889869e1c464fbd632ad2842ac2a7a1db99f16b
Python
4,477
136
""" Collect statistical maps of all participants in a folder """ import glob import shutil ROOT = '/Users/sebastiandresbach/data/s1Anfunco/Nifti' subs = ['sub-05', 'sub-06', 'sub-07', 'sub-09', 'sub-10', 'sub-14', 'sub-15', 'sub-16', 'sub-17', 'sub-18'] contrasts = {1: 'D2vsAll', 2: 'D3vsAll', ...
2ad170a5000cc1e6a028e6c67773133e252c9f59986588cf22075d98c84a4649
Python
4,478
106
import os from importlib import import_module from pathlib import Path cell_graph_config = { "cell_f_list": [ 'area', 'r_equiv', 'r_maj', 'r_min', 'angel', 'ecc', 'maj_x', 'maj_y', 'min_x', 'min_y', 'x', 'y', ], ...
431380d203000590ec740815c77f08507f19596524e25db7e732b503ba4436fd
Python
4,478
154
"""Resolve endpoint configuration without constructing model clients.""" from __future__ import annotations from collections.abc import Mapping from typing import Any from chemgraph.models.endpoints import EndpointSpec, ModelRequest from chemgraph.models.endpoints import vllm as vllm_ep from chemgraph.models.endpoin...
289ed998f497c3efe97e412402cb059d7a5319f08ebb16733296403109ec0cbf
Python
4,479
115
import pandas as pd import matplotlib.pylab as plt import numpy as np def load_bhv(path='rtnet/behavioral data.csv', reject=True): bhv_path = 'rtnet/behavioral data.csv' bhv = pd.read_csv(bhv_path) if reject: # Participant rejection part_idxs = bhv.subject.unique() n_parts = len(pa...
4b4c6f1faebd64ee2f1d22f2113e64c5e27c2b7bba856fbb161a53e1df95e81a
Python
4,479
145
from __future__ import absolute_import from torch import nn from torch.nn import functional as F from torch.nn import init import torchvision import torch from .pooling import build_pooling_layer ''' this is the original code, I just didn't modify RWM ''' __all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 're...
0a6547b58a9c9061297a24b0c5034543ddde45db3e1ccbd18fd96f1804a33b3c
Python
4,480
117
#Lucas Sancéré - import os import yaml from attrdictionary import AttrDict as attributedict from tqdm import tqdm from histo_miner import hovernet_utils, segmenter_utils from histo_miner.utils import cellclass_process script_dir = os.path.dirname(os.path.abspath(__file__)) ########################################...
20c8fa2b6ea1450a12ca4f754c8344214b551e60d0efd72ff9d33520462b8bda
Python
4,480
118
import os import numpy as np import nibabel as nib import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import imageio # ========= User settings ========= flair_path = r"F:\BIDS\demo_BIDS\derivatives\xfm\sub-AFib0241\ses-baseline\sub-AFib0241_ses-baseline_acq-highres_space-T1w_desc-brain_FLAIR.nii...
5b370ad44c95673ba10907f66318dd21e152b95ccf715264b82297d63a6bc4f2
Python
4,480
113
import torch import torch.nn as nn import models.snn_type as snn_type from conf import global_settings as conf_set from models import snn_soma #import torch.cuda.nvtx as nvtx class basic_block(nn.Module): expansion = 1 def __init__(self, in_channels, out_channels, stride=1, has_bn=False): super(basic_...
770bf84512aeb9c779a6434069cfc13d9b44de33d801001495ae2a6d083202b2
Python
4,480
121
# 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...
8c1c8449a4498aee6a4f2ac445efad48730a67ac9447dd07d716da61ae14c760
Python
4,480
115
import argparse import joblib from collections import defaultdict import numpy as np import pandas as pd from sklearn.ensemble import RandomForestClassifier from xgboost_ensemble_classifier import XGBoostEnsembleClassifier from xgboost import XGBClassifier from sklearn.neural_network import MLPClassifier from sklearn...
5e2d12fb81d8c8e9759550e2a4dfc2c9817ddeebaff64634d075847629d1703f
Python
4,481
124
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT # NOTE: importing in the utils.py header leads to circular importing import textwrap from datetime import datetime from django.db.models import QuerySet from django.http import HttpResponseGone from django.http.response import HttpResponse from drf...
66d39beacb3ccc41293e36275397d964a449fee9ab9e4de58967476e9bc90c19
Python
4,481
146
from pathlib import Path from typing import TYPE_CHECKING import numpy as np from tests.setup_tests.setup_modelling_test_data.setup_targets_test_data import ( get_current_test_label_values, get_test_label_file_fieldnames, set_up_label_file_writing, set_up_label_line_dict, ) from tests.setup_tests.setu...
db9a3edf542005836ba7619cb104af4c6fabb58664367e879ae3bffa343494a7
Python
4,481
168
# NeuN,S100,Olig2,Iba1,RECA1,Cleaved Caspase-3,Tyrosine Hydroxylase,Blood Brain Barrier,GFP, # PDGFR beta,Parvalbumin,Choline Acetyltransferase,GFAP,Smooth Muscle Actin,Glutaminase,Doublecortin, # Sox2,PCNA,Vimentin,GAD67,Tbr1,Eomes,Calretinin,Nestin,Aquaporin-4,Calbindin, cell_type_panel = { 'NeuN': 'S1_R2C4.tif',...
aa835619acfa3af297b14d7955f310f4f82de9efbe02a9fe6c14e898d1620c53
Python
4,482
130
#!/usr/bin/env python import numpy as np import pandas as pd import click as ck from sklearn.metrics import classification_report from sklearn.metrics.pairwise import cosine_similarity import sys from collections import deque import time import logging from sklearn.metrics import roc_curve, auc, matthews_corrcoef from...
61f5970d46db090d209418323994fdd7ed5bf1e894a70844799e7f8c8541c8a1
Python
4,483
117
"""Causal, leakage-free preprocessing. Two normalisation stages, in this order: 1. **Per-session causal baseline** -- each session's features are expressed relative to the median/IQR of that session's own first `baseline_min` minutes. Absolute EDA level and eyelid geometry are strongly subject-specific, so w...
cac95e9f0c2dbb0a4ebfce1e566cef41f6c02ec4c03af2310291ecbf3b876ac3
Python
4,483
120
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from __future__ import annotations from django.conf import settings from django.contrib import admin from django.db import models from django.db.models import functions as db_functions from django.utils import timezone from rest_framework_api_key.mo...
4a3fd178459b390db6a4b38aea93fa44c4df1bc3f77dd5b92d0a7f3696e80bf2
Python
4,484
128
import os import sys import logging from datetime import datetime from errno import EEXIST LOGDIR = 'logs' PREDDIR = 'predictions' class FileExistsError(Exception): pass def main_name(): """Return the name of the main file without the extension.""" import __main__ as main return os.path.splitext(mai...
ad3d34b17d2e80f99081a080cbe924ef7198850f050cb99f76621299c8ed1958
Python
4,486
107
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT """Create a ground truth job in an existing task from an exact frame list you choose. Steps: 1. Retrieve the task and resolve the requested frames: indexes (--frame) or file names (--frame-name, matched against the task's frame list). 2. Re...
f3c90110a1967f42cc3505e3b83178c55cda680405080de19af367ed055a21eb
Python
4,486
105
# modules.py import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Function def initialize_weights(module): for m in module.modules(): if not hasattr(m, 'weight') or not m.weight.requires_grad: continue if isinstance(m, nn.Linear): nn....
55ce3fcc365fbb437a8c182b45bb41fbda158920527a12c9197ac643eb76ea3b
Python
4,489
229
# -*- coding: utf-8 -*- """ Created on Fri Mar 31 19:56:02 2023 @author: axthi """ import os my_path = os.path.dirname(os.path.realpath(__file__)) class project_template: def __init__(self): self.proj_nr = 0 self.exp_cond = '' # 'target' or 'control' self.roi = '' self....
6c054e17c4517ed6cb1e5a09a34d5837acd561a19f34bc75197d8de67edc69c6
Python
4,489
118
#! /usr/bin/env python3 # -*- coding: utf-8 -*- """ Compute a density map of seeds saved in .trk file. * They are saved as a data_per_streamline 'seeds' when using our tractography scripts with option --save_seeds. - scil_tracking_local - scil_tracking_local_dev - scil_tracking_pft If you use your own tractograms, yo...
dfc590d05846aef0a49e5b13cdad9d8f1662d191ff63bcd5020d6cc1e0c44d9f
Python
4,489
114
""" Loads data from imagej/fiji ROIs or ROIs sets (zip files) Requires ijroi from: https://github.com/tdsmith/ijroi/blob/master/ijroi/ijroi.py `pip install ijroi` to get it. """ import os try: import ijroi except ImportError: print('fiji_roi_reader_plugin requires the ijroi module from:\n' ' htt...
968c9814fd4c242eefaa486e7738a4669f970c68bd189a046277e279040ca4ee
Python
4,491
174
"""LangChain ``@tool`` wrappers over :mod:`chemgraph.tools.ase_core`. Every public function here is a thin decorator that delegates to the corresponding plain-Python implementation in ``ase_core.py``. """ from __future__ import annotations import os from typing import Any, Dict from langchain_core.tools import tool...
ab72e49c770b8fafa23738bb5bb64506bdfe2d3b88274c1319647dcbd492c79c
Python
4,491
119
from keras.models import Model import numpy as np import innvestigate.utils as iutils import os from keras.preprocessing.image import img_to_array, load_img import tensorflow as tf import PIL.Image import matplotlib.pyplot as plt import cv2 from interpreters import SGLRP, CLRP, LRP, GBP from utils import * def visua...
fdcbf8e175b2217dfd3b8907a02d7033133c5d21c567262cd0f2d9c2b1cd8f52
Python
4,491
161
import numpy as np import time import torch import torch.nn as nn import torch.nn.functional as F import torch.autograd as autograd from UBSIM.models import UNet def reshape_psf(num_frames, psf): """ Reshapes a PSF from size [N,N] to shape [1,num_frames-1,N,N] Parameters: num_frames: the nu...
2ca2cabe88f33685cdc83d6be9893458b332ea6b074f03bdd3489311a57f7a63
Python
4,492
97
""" Script to run busyring example """ import argparse import numpy as np import neuron from neuron import h import parameters from metering import RuntimeMetering from ring_network import RingNetwork # Parse commandline arguments parser = argparse.ArgumentParser() # Model and simulation parameters parser.add_argumen...
4697e5201816d08a7e50c58adb0fb020c17b62d9052d1eccd59bdc80c84c881a
Python
4,492
142
import sys import yaml import os import numpy as np import h5py import matplotlib.pyplot as plt import matplotlib as mpl pathpath,myrun = sys.argv[1:] #pathpath = 'PATHS/filepaths_carlen.yml' #myrun = 'runC00dMP_M' nclustvec = np.arange(2,21) with open(pathpath) as yfile: pathdict = yaml.safe_load(yfile) rundict_...
9c827e3f357c505b00f395bba66af3a81adec24ce4d0a7a087af78f001a9b788
Python
4,492
83
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file '/media/lg/disk2/PycharmProjects/ISAT_with_segment_anything/ISAT/ui/visual_prompt_dock.ui' # # Created by: PyQt5 UI code generator 5.15.10 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit...
6ac12dcf93fb4a015ecb3c01f243c17307587f4c770239f6b6ffc23a856220e8
Python
4,494
130
import tempfile from pathlib import Path from typing import Optional import click import numpy as np import pymeshfix import pyvista as pv import SVMTK as svmtk import tqdm from loguru import logger from brainmeshing.utils import ( fs_surf_to_stl, pyvista2svmtk, repair_triangulation, svmtk2pyvista, ) ...
1e786446bfeb9c6d3e55e6bf1e64a7c204d35ae541d649d1124712a39beee53a
Python
4,495
125
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Visualize seeds as 3D points, with heatmaps corresponding to seed density Example usages: >>> scil_viz_tractogram_seeds_3d seeds.nii.gz --tractogram tractogram.trk """ import argparse import logging import nibabel as nib import numpy as np from fury import window, ...
ddfe3567ea0e017545c79a57a1701d2f3d0f5325cb649fecc2bca76259b80f10
Python
4,495
131
"""Contains HLA interaction PRS functions""" import pandas as pd from ..core.score_bcf import score_bcf from .grouped_scoring import score_grouped def generate_dosage_table(dq, config, variant_log_path=None, prs_name=None): """Generate and rename the dosage table.""" # Select the correct position column base...
110941c88a6c5769a95c09423b5f3e5b9755d10ab09eb9fa5073657a9dc8671c
Python
4,496
113
#--------- # Figure 1-source code 1 # Related to Figure 1d # sub*_mri_record.txt files are also available from the Science Data Bank at https://doi.org/10.57760/sciencedb.18351 # csv_plot_pos.csv file is also accessible at https://github.com/ZHANGneuro/Greeble_PyGame_fMRI_task/blob/main/csv_plot_pos.csv # Bo Zhang # Fe...
6b5d2782c2e8b41a37bff8e866e752159e66c9f76abbcf9fab206f08ce74e5f5
Python
4,497
117
#!/usr/bin/env python """ HAL interface to Crystal Technologies AOTFs. Hazen 04/17 """ from PyQt5 import QtCore import storm_control.hal4000.halLib.halMessage as halMessage import storm_control.sc_hardware.baseClasses.amplitudeModule as amplitudeModule import storm_control.sc_hardware.crystalTechnologies.AOTF as AOT...
cf7b56addf3eb5a05a2a0fe6ea33953c265ec690db10bd8bf962f5aaaea94a42
Python
4,497
62
from .data_augmentation import augmentation from tensorflow.data import TFRecordDataset, AUTOTUNE, Dataset from tensorflow.io import FixedLenFeature, parse_single_example from .constants import IMAGE_SHAPE def datasets_from_tfrecords(records_ref, records_src, buf_size_ref, buf_sizes_src, batch_size=1, compression_type...
b6147461422f4fc1b1402b2e2aa0d09e2e989958a878889eb4597145f4fd7d8b
Python
4,498
133
#!/usr/bin/env python """ Interface to Logitech dual action joystick. Hazen 9/12 """ import pywinusb.hid as hid class DualAction(object): """ This class encapsulates the interface to a Logitech dual action joystick. It remains in the project for reference purposes but it would not work ...
3bb8174954bca5cb560ad6646043b44c3b17436e5830349207919fe8e0ef38e9
Python
4,499
131
import pandas as pd import numpy as np import re import os def celegans_data(): ce_meta = prep_ce_meta() # lin_data = prep_lin_data() edge_df = prep_edge_df() cook_meta = prep_cook_meta() ce_meta = ce_meta.reset_index().join(cook_meta.add_prefix('Cook '), on='Neuron').set_index('Neuron') ce_met...
ca882f858619a6a1033d563f1090b6f47425f4d7494a90043e576a782f7f3593
Python
4,499
148
# -*- coding: utf-8 -*- # @Author : LG # from https://blog.51cto.com/u_15872074/5841477 from PyQt5.QtCore import QRectF, Qt, QTimer, pyqtSignal from PyQt5.QtGui import QColor, QFont, QPainter, QPainterPath, QPen from PyQt5.QtWidgets import QWidget class SwitchBtn(QWidget): # 信号 checkedChanged = pyqtSignal(b...
a0f4b50240263e6e40abcb12188f9ef8e91e5ce9d4e57e7c43ce9e6a61e2e200
Python
4,500
141
import typing from typing import List, Optional, Tuple, Union import torch from torch import Tensor import torch_geometric.typing from torch_geometric import EdgeIndex from torch_geometric.edge_index import SortOrder from torch_geometric.typing import OptTensor from torch_geometric.utils import index_sort, lexsort fr...
a634e20d238617e78adaaf4859daa55189febcc16db2a5f4c529e2d645e94d73
Python
4,500
104
import glob import os import numpy as np import pytorch_lightning as pl from monai.apps import download_url, extractall from monai.transforms import AddChannel, Compose, EnsureType, LoadImage, RandFlip, ScaleIntensity from sklearn import preprocessing from torch.utils.data import DataLoader, Dataset from {{cookiecutte...
ba905e19e23ea68d38ec2ecc2a349f37da4ae958e6dfb8662ae346490298ccf4
Python
4,500
114
from nipype.interfaces.base import BaseInterface, BaseInterfaceInputSpec, TraitedSpec, File, traits import os import csv import numpy as np import nibabel as nib from nibabel.processing import resample_from_to from cvdproc.config.paths import get_package_path L_SCR = get_package_path("pipelines", "external", "alps",...
4a2f78122ee7514392d11441eb884c4d6c1544ce15b408bd17df6d451b066274
Python
4,501
142
import os from pathlib import Path import click import numpy as np import pandas as pd import simple_mri as sm from gmri2fem import segment_tools as segtools from gmri2fem.masking import create_csf_mask from gmri2fem.segmentation_refinement import ( extrapolate_segmentation_to_mask, resample_segmentation, ) ...
227fd01d32b2fdc81f62523caac38e479d8c31b73034d11852fcbb1e01a733bb
Python
4,502
119
import os import time as tm import pandas as pd import warnings warnings.filterwarnings("ignore") import tensorflow as tf tf.logging.set_verbosity(0) import Cell_BLAST as cb import numpy as np from numpy import genfromtxt as gft import rpy2.robjects as robjects def run_Cell_BLAST(DataPath, LabelsPath...
715bbc5b112f99dfee9c1e9f09321ff865dcc6228dc34aa3605b7dc22853689f
Python
4,502
137
import unittest from toolkit.models import GINModel import torch as th class TestDeepGOModel(unittest.TestCase): @classmethod def setUpClass(self): self.batch_size = 4 self.input_length = 32 self.nb_gos = 32 self.nb_zero_gos = 32 self.nb_rels = 5 self.hidden_dim...
333e81a1d72ff6062968c1d4ba6def6b2ba40ebbf7c802d9dfb8d78d05283f24
Python
4,503
165
from dataclasses import dataclass from typing import TYPE_CHECKING, Any, ClassVar, Literal, Protocol, Union from eir.models.input.array.models_cnn import CNNModel, CNNModelConfig from eir.models.input.array.models_identity import IdentityModel, IdentityModelConfig from eir.models.input.array.models_linear import Linea...
b4ac3a2e36a111d79dd653eda8a04b1e848076d4179fb4788a56a6348a6e3328
Python
4,506
121
""" model of deep speckle. including the follow parts: 1. feature extractor 2. flow estimator 3. intensity estimator 4. regularizer for subpixel 5. refiner for flow and intensity """ from sys import argv import torch from module import FeatureExtractor, costvol_layer, Warping_layer, FlowEstima...
60d3661c443f0489a4793f0fba749c5976b5d46bd645db732800e44079ed9fdd
Python
4,507
142
from pathlib import Path from types import SimpleNamespace import numpy as np import pytest import tifffile from napari_dmc_brainmap.stitching import tiff_output @pytest.fixture def scratch_root(monkeypatch, tmp_path): root = tmp_path / "app-cache" / "stitching" / "scratch" monkeypatch.setattr(tiff_output, ...
bd6837646185af91fa449c2638440fbe2c2a62ebf172254f139f054bfb71fa4d
Python
4,509
142
import logging from pathlib import Path import pytest from brainways.utils.cell_detection_importer.qupath_cell_detection_importer import ( QupathCellDetectionsImporter, ) @pytest.fixture def importer(): return QupathCellDetectionsImporter( threshold_1=0, threshold_2=0, threshold_3=0,...
1d0b9c44aaf540b42413f0b2abddddd445a0502941cf1c9efa2ed57f2e551616
Python
4,510
126
# -*- coding: utf-8 -*- from dipy.io.utils import is_header_compatible import logging import nibabel as nib import numpy as np import os from scilpy.utils import is_float def load_img(arg): """ Function to create the variable for scil_volume_math main function. It can be a float or an image and if image...
aafcd188d7f91c6b30b14e643049fc1abeb5483bf558f2eea588f2ce85818126
Python
4,510
96
import numpy as np from brainscore_core.supported_data_standards.brainio.assemblies import BehavioralAssembly from brainscore_core.supported_data_standards.brainio.packaging import package_data_assembly import pandas as pd ''' ** NOTE: This benchmark (edge) has a very different stimulus sets/assemblies then others in...
ba18bb363bc165b08a6466e879f6bbda77d9782a241293be8921e6afae6aa2d3
Python
4,511
106
# -*- coding: utf-8 -*- """ Created on Wed Dec 4 14:19:39 2019 @author: Yoshi """ import numpy as np def cell_excitatory_flagger(cell_number,correlation_coefficients,areas_under_curves,data,key,frequencies,intensities,threshold): # Default flags best_frequency,characteristic_frequency = "N/A","N/A" ...
0efd2c581f6502408b7cf177bb1007ea69281e8be8d462c548838c77f86c2af3
Python
4,512
82
#! /usr/bin/env python """Run pycurv on a vtp surface file Usage: curvarture.py <vtp_file>""" __author__ = "Benjamin Barad" __email__ = "benjamin.barad@gmail.com" __license__ = "GPLv3" import os import time import sys import click from .curvature_calculation import new_workflow, extract_curvatures_after_new_workflo...
88f423134d2d019e02d91e4054a552ac91d656f4d2b7734a1939de410d36c0db
Python
4,514
89
import csv import os from os.path import join as ospj from numpy import savetxt import pandas as pd import re import sys import json import shutil """ This script collates the pyAFQ tract profiles output across subjects in preparation for visualization and fitting GAMs. Each pyAFQ tract profiles csv should be a 1D arr...
c3adb3cb4f401de9e05b5487ca38f8733bfef9f857c508cdc42422b642e5e52a
Python
4,514
95
from typing import Callable import torch.nn as nn import torch.nn.functional as F import numpy as np from dgl.nn.pytorch import SumPooling, WeightAndSum, AvgPooling, MaxPooling from layers.pooling import AttentionPooling, AttentiveFPPooling, WeightAndMean, WeightAndMeanV2, \ WeightedSumInte...