sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
91e3bd50d831bcec061abe0d863505f347496e7cd122b0ec8b30850cf6bfb25d
Python
8,504
243
import os import numpy as np import librosa from glob import glob import torchaudio import math import torchaudio.functional as F #import disvoice SAMPLE_RATE= 16000 from scipy import stats from disvoice.prosody import Prosody import parselmouth F0_FORMANT_COUNT = 4 # F1~F4 def get_formants(filena...
9c3c723c4b49b02430fb7d6849eea30fcc1c89264c99a4de12704af1d8f953a2
Python
8,507
258
# Generate explainability plots for each models import os import multiprocessing import tqdm import torch import torchvision import pandas as pd import polars as pl import numpy as np import matplotlib.pyplot as plt import seaborn as sns from PIL import Image from scipy.spatial import distance from sklearn import m...
4e995dc749f7d7481475d4d4faef8bab0c1e74a67f769a2db92ec5c2f0d00e7d
Python
8,509
168
#!/usr/bin/env /mnt/nasapps/development/python/3.7.1/bin/python import argparse, csv, re def cellLimits(s): try: #print(s) #print(re.split(seps, s)) situp = [] return(tuple(s.split(','))) # situp.append(si.split(',')) return situp except: raise argpar...
b44003eda0a66a5daea0860155ea04f4303cf2a3ce7650aefd9f353de91f4918
Python
8,510
213
import torch from torch_geometric.nn import GCNConv from sklearn.neighbors import kneighbors_graph import numpy as np # define the celcomen class class celcomen(torch.nn.Module): """ A k-hop Graph Neural Network model for disentangling inter- and intra-cellular gene regulation, and then leveraging to predict s...
e62a43030038e90bdbdc16c25373a62246458efb6e99e620ee92ace7e21d77de
Python
8,512
158
from typing import Set import itertools from zigzag.classes.hardware.architecture.core import Core from zigzag.classes.hardware.architecture.dimension import Dimension from zigzag.classes.hardware.architecture.memory_hierarchy import MemoryHierarchy from zigzag.classes.hardware.architecture.operational_array import Op...
f1d9c7e45fb6c054130a959efd97292b299b5bc9ab2edb2509363c83c827b6d4
Python
8,514
261
from inspect import isfunction import math import torch import torch.nn.functional as F from torch import nn, einsum from einops import rearrange, repeat from models.unet.util import checkpoint def exists(val): return val is not None def uniq(arr): return{el: True for el in arr}.keys() def default(val, d...
99605bb15ae8cda7118f657813ae0d658c4b5e3c5ba48d563fc60c8752827a48
Python
8,523
199
from typing import Union from pathlib import Path import tarfile import pooch import os import numpy as np import torch from safetensors.torch import load_file from .model_snapshot_handling import get_latest_snapshot from .args_from_yaml import load_args_from_yaml from .model import TransformerModel, get_embedding_lay...
c5286b90cd48211ec3d4017b334bd563c546e28c62a84c7c913807d121d89bcc
Python
8,523
236
import os import numpy as np import pandas as pd import torch os.environ['CUDA_VISIBLE_DEVICE'] = '5' import math from tqdm import tqdm from torch import nn from sklearn.metrics import accuracy_score, roc_auc_score, f1_score, precision_score, recall_score from torch.utils.data import Dataset, DataLoader from pathlib im...
9d047dda1674ea4b0fd2ae01f30e8f809b93ee639dca1f575eaa14b2070001ba
Python
8,525
185
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license """Shared ReID encoder used by BoT-SORT, Deep OC-SORT, and TrackTrack. * `.pt` YOLO checkpoints — loaded via `YOLO()`; embeddings are pulled from the second-to-last layer through the predictor's `embed=[...]` argument (works with classification and Re...
ad1946c2c2ba411ae7f307321e40193c31ff00f17e714011fb4500a1a9af702f
Python
8,527
213
import torch import torch.nn as nn import nibabel as nib import numpy as np from torch.optim import Adam import os class SIREN(nn.Module): def __init__(self, input_dim=3, hidden_dim=256, output_dim=3, num_layers=3): super().__init__() self.net = [] self.net.append(nn.Linear(inp...
a605775331e8fd132ea61806fbcc44945dea27601bdd49ea273c7bd5d30c4441
Python
8,531
265
# -*- coding: utf-8 -*- # # Connectome-Manipulator documentation build configuration file, created by # sphinx-quickstart on Fri Jul 12 09:43:51 2024. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerate...
5188887455deea2f5404c93bf0d15547becb5e76a49b235f821675b72f48aa60
Python
8,533
280
import json import os import os.path as osp import ijson import pandas from tqdm import tqdm import numpy as np from sklearn.cluster import KMeans from queue import Queue import random random.seed(20220401) def get_tag_features(): key_to_index = json.load(open('data/key_to_index.json')) vec = np.load('data/ve...
921e97069f80bf9ce9782c006d90c3e8d6c8ddb99ef2de3e49dd1825bbaa1534
Python
8,533
214
import numpy as np import pandas as pd import os import matplotlib.pyplot as plt from IPython.display import Image import imageio from .ism import SeqMatrix, MutGenerator from .motifs import Motif, align_to_pfm, pfm_to_logo from . import plot_utils class Evolution(): def __init__(self, ...
1bc7491e4760b0cb91e97e04bf4b7dd7b232aea6ca61ea1fac1a30c51b22a843
Python
8,535
219
import numpy as np from sklearn.metrics import ( mean_squared_error, mean_absolute_error, r2_score, average_precision_score, roc_auc_score, f1_score, precision_score, recall_score, matthews_corrcoef, accuracy_score, confusion_matrix, roc_curve, precision_recall_curve, auc ) def calculate_graph_metri...
beb7d81e34987da7b1d6e2ed5fb964d5f2b7b5ad4a22239d567ad61977d76ebc
Python
8,535
202
#!/usr/bin/env python3 """ Script to compute various metrics derivated from asymmetric ODF. These metrics include the asymmetric peak directions image, a number of fiber directions (nufid) map [1], the asymmetry index (ASI) map [2] and an odd-power map [3]. The asymmetric peak directions image contains peaks per hemi...
0a1dbb2f2869f3428dcdf5b15228f5b4a19cb53d248e7b68c66485cd59fa29f3
Python
8,537
254
"""Defines the routes of the ADMET-AI Flask app.""" from uuid import uuid4 from tempfile import NamedTemporaryFile from flask import ( after_this_request, jsonify, render_template, request, Response, send_file, session, ) from rdkit import Chem from admet_ai import __version__ from admet_...
616aee2c98174b6b7d189c71959f39ad34baceed8de484138be7d0823441c612
Python
8,538
261
#!/usr/bin/python # ## @file # # Capture pictures from a (generic) USB camera. This is not used as we typically # use the Thorlabs cameras instead. # # This requires the PIL and numpy libraries as well as VideoCapture. # # Hazen 03/12 # import cv2.cv as cv import numpy from PIL import Image #import pyga...
92807055e90b4dd7356d52d1228b76317d12a527adf7f0a22c18cbfc5b58214e
Python
8,539
204
#! /usr/bin/env python """Maintainer tool: build the small distributable example dataset. Crops a full tomogram + segmentation pair down to a small sub-volume that still contains a useful stretch of two membranes (default IMM+OMM), downcasts to keep the download small (tomogram -> float16, segmentation -> int8), write...
ea10db0f8ab8a044d23e1bfb43861612853d1a011a7a3e5aa2256c27a20d3110
Python
8,541
198
import csv import json import nibabel as nib from nilearn.plotting import show from nilearn import surface, datasets, plotting import numpy as np import os from os.path import join as ospj import pandas as pd import sys """ This script applies nilearn.vol_to_surf to GMprobseg and WMprobseg. This is done for 1 subject ...
93d3ed1d136c5286c2bf80143b0a68bfed39b3c4fa3b1136de6b2c404decc19f
Python
8,542
224
from argparse import ArgumentParser import os import os.path as osp import pandas from tqdm import tqdm import ijson import json from datetime import datetime import numpy as np from gensim.models import word2vec from nltk import tokenize parser = ArgumentParser() parser.add_argument('--dataset', type=str, default='Tw...
0b7dcb494c628fa3651d4ff6c89399c2630f1532cb88600f7b374abc7c5d1324
Python
8,546
229
# -*- coding: utf-8 -*- """ Contrast-enhanced mean epi This scripts preprocesses the phase data from an epi time series to get the phase variance over time and an mean epi magnitude image with enhanced GM/WM contrast. The following steps are executed: 1. motion correction to magnitude time series 2. unwrap pha...
8b3a797faf5db2199703295daba632db286d8487b103de9f09e194fa15cc89ea
Python
8,547
251
"""Use Virchow to extract latent features from whole slide images.""" from __future__ import annotations import argparse from pathlib import Path from typing import Callable, List, Optional, Sequence, Tuple, Union import h5py import numpy as np import openslide import torch from PIL import Image from torch.utils.data...
364aeda1d8753e6641d2f970f3430c36fedc3fc4e5d1ef72ed9481164f20c0b6
Python
8,548
227
# -*- coding: utf-8 -*- """ EPI <-> EPI The purpose of the following script is to compute the deformation field for the registration between different epi time series. The script consists of the following steps: 1. set output folder structure 2. n4 correction epi 3. clean ana (remove ceiling and normalise)...
8943cbb2314b125e318921574de4a23211aa2bce22f4ff348daebb83554b909e
Python
8,548
272
# TODO: should this go in nems.layers directory instead? # or maybe nems.tools? import logging import inspect import re log = logging.getLogger(__name__) class KeywordMissingError(Exception): """Raised when a keyword lookup fails.""" def __init__(self, value): default_message = f'"{value}" not...
e884d3f3ca4a9ab436a1efd44d03434529e5c125292b851048b4a4fc043fc25b
Python
8,549
167
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon May 20 15:21:26 2024 @author: rl05 Save cross condition decoding scores into a csv. For later mixedlm analysis in R for interaction between time window and denotation. """ import sys import os import os.path as op import numpy as np import pandas as ...
053fa0d27371743ed81cde1a523c99935a233148f98ea73f1c7d052f3aa36848
Python
8,553
201
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Cut streamlines using a binary mask or two labels. --mask: Binary mask. Streamlines outside of the mask will be cut. Three options are available: Default: Will cut the streamlines according to the mask. New streamlines may be generated if the mask is disjoint....
44ca03947cb01af812161c4dd9b6b5f518d0cf45caefdce4e430c6ce344c85d0
Python
8,555
240
import os import numpy as np import torch from torch_geometric.data import InMemoryDataset, extract_gz, extract_tar from mlcg.utils import download_url from mlcg.data import AtomicData class MaterialsCloudDataset(InMemoryDataset): """General base extractor for the MaterialsCloud dataset described in https://doi....
be94247b44c13c1b410f7d6528ce84351fcc4b75d1371836ecc07d959fe6a616
Python
8,555
234
""" 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...
d7f2b3aebaf9406f230cdbec105ba89fefa6a02968b9622f12d5b2394fe1dd39
Python
8,557
90
from testsetclass import TestsetClass class AMINO20x4(TestsetClass): def __init__(self): self.weak = 1.0 self.molecules = ['THR_xag', 'GLY_xad', 'TYR_xab', 'GLY_xac', 'MET_xbf', 'GLN_xap', 'THR_xah', 'MET_xbo', 'MET_xag', 'PRO_xaf', 'GLN_xal', 'GLY_xab', 'GLY_xae', 'ILE_xae', 'ILE_xak', 'ASP_xau',...
9677a6d248280ec4e8a49f75ffee29294c5750a38475b91214f80af6d82440dc
Python
8,560
226
# @String(visibility="MESSAGE",value="<html><div WIDTH=600>This script tags particles according to skeleton features: It detects maxima on a masked image and clusters detected maxima using features of the mask-derived skeleton. A maxima is considered to be associated to a skeleton feature (junction, tip, etc.) if the d...
ec83081abb43ae9bb9a461c1d03b82c04d0b838b4fef715d8fb4653fe53897fd
Python
8,562
209
import math import torch import torch.nn as nn import torch.nn.functional as F import torchvision.models as models from torchvision.models import ResNet18_Weights, ResNet34_Weights, ResNet50_Weights, ResNet101_Weights, ResNet152_Weights class ResNet2D(nn.Module): def __init__(self, model_type="resnet18", num_class...
6b1bd1a6304e32e7caa64d55b3b161c85a26307066df1987ac819b44c2cef5d4
Python
8,563
227
import os import yaml import h5py import sys import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from scipy.stats import kendalltau,pearsonr pathpath,tempstr = sys.argv[1:] my_runsets = tempstr.split('___') print('Comparing %s'%str(my_runsets)) ''' pathpath = 'PATHS/filepaths_carlen.yml'...
f0b23dac3bfb40a4b8a7dc3f2f8577b176c3f9090affd7a93ac90064ddcb57b9
Python
8,564
195
''' CH5 ''' import numpy as np import sys def intro(): print(""" SHORT List of potential energy surfaces for CH5: P: potential energy, G: Gradient, D: Nonadiabatic coupling vector This is listed at the end of description to show the availability. For example: P/G means both potential energy and g...
914f30853aed1f0b8c979b9ff617738bd958f399bd8133e6baca4617fe4257e6
Python
8,565
201
#!/usr/bin/env python3 """ Binary Model Data Preparation for EEG Artifact Detection Prepares binary classification datasets for three specialized artifact detection models using preprocessed EEG data. Each model distinguishes a specific artifact type from clean EEG signals. Key Features: - Three binary models: Eye Mo...
e4fe6dbe0fd2e7f617b23f520dc7967225a053ec2fbf51710637a4985d10c7e8
Python
8,565
184
''' Preprocessing of brain IVIM data Requirements: - ivim - fsl - freesurfer - itk - itk-elastix ''' #%% import numpy as np import nibabel as nib import subprocess, os from nipype.interfaces import fsl import itk from ivim.io.base import read_bval, write_bval from ivim.preproc.base import extract, combine, average fr...
ce3bfc0524894a1b4b5df35c92660abe1045b6c19b7102190a602634171e5208
Python
8,566
219
"""What happens when a suite2p .npy is empty, truncated, or half-written. An interrupted run, a full disk, or a copy that stopped part-way all leave the same thing behind: a file at its final name that no longer holds what its name promises. The failure that motivated this was a batch over a Dropbox share dying on one...
24e063fccb8ea0822a2bda909bffc5473c0c8021d0810ea0ddcf2e7c91f1c94f
Python
8,567
216
# -*- coding: utf-8 -*- """ Created on Fri Apr 7 22:58:25 2023 @author: axthi """ import re import os import logging import pickle import shutil from .preparation import create_cereb_surface, get_central_gm_with_mask, get_center_pos, _relabel_internal_air from .simulation import run_FEMs, analyse_simus, _create_res...
2304cbee41bb2f7b8d28dfbfbf177800d0c257a47ee971d89a4c6334baf0b89a
Python
8,568
251
""" Utilities for working with the local dataset cache. """ import os import logging import shutil import tempfile import json from urllib.parse import urlparse from pathlib import Path from typing import Optional, Tuple, Union, IO, Callable, Dict from hashlib import sha256 from functools import wraps import boto3 fr...
a839a28c9d73d48218ddea7e65d61054cf257de3b430a023b4c250f31f7b2895
Python
8,568
216
"""Test pipeline Step 1 — spike detection parity with MATLAB. Run from the repo root:: uv run python python/test_pipeline_step1.py Downloads example data if not already present (same files the MATLAB test pipeline uses), runs Python spike detection with the same parameters as the ``OutputData03Mar2026`` MATLAB r...
ac93a07203489e29128282ec052fe61c27abe297ce157c764e222c4f80df4713
Python
8,568
295
""" Stochastic Gates utils Copied from: https://github.com/runopti/stg Original authors: Yutaro Yamada https://github.com/runopti License: MIT """ import torch import torch.nn as nn import numpy as np import six import torch.optim as optim import collections import copy from torch.utils.data import Dataset from coll...
2ff0ec0a22bb2aa9df2228636932e7a94b1976486c2262694b1026fcdf29fccd
Python
8,569
203
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Compute BundleSeg & supports multi-atlas & multi-parameters. This is similar to what our previous RecobundlesX (RBx) script could do, but BundleSeg is better and more efficient. For a single bundle segmentation, see the lighter version: >>> scil_tractogram_segment_wit...
fe19a5bb340a57f49d01352609202b065b6587b5d1d50703a13a478a685080ba
Python
8,569
209
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Visualize bundles. Example usages: # Visualize streamlines as tubes, each bundle with a different color >>> scil_viz_bundle path_to_bundles/ --shape tube --random_coloring 1337 # Visualize a tractogram with each streamlines drawn as lines, colored with # their local...
e555bb5064b49d011d3ad4e5375294625042b0196e12b1304a208a5bb869f2d6
Python
8,572
258
from copy import copy from typing import Any, Literal from eir.models.input.array.models_locally_connected import LCLModelConfig from eir.models.output.array.array_output_modules import ( ArrayOutputModuleConfig, LCLOutputModelConfig, ) from eir.models.output.array.output_array_models_cnn import CNNUpscaleMode...
dab8c1a9d6d259cfc264ffab9aa6774ece73cbd50d9205d876eeb809a1069ecc
Python
8,582
235
import os from sacred.utils import apply_backspaces_and_linefeeds from sacred.observers import FileStorageObserver from sacred import Experiment import sys sys.path.append("..") from utils import set_global_seed from torch_geometric.data.batch import Batch from itertools import chain from utils.eval import evaluate_on_...
0c0c2cbd18907dcbf46fa7de28486e7276bccb4073fa1c73ad473d1c51021580
Python
8,583
216
# %% ### import modules from pathlib import Path import seaborn as sns import pandas as pd import bap1b.figures as figures # %% set path data_dir = Path(__file__).resolve().parents[1] / "data" results_dir = Path(__file__).resolve().parents[1] / "results" # %% Load data for adjustment in ["adjusted", "unadjusted"]: ...
a14ae603a11ad784914ce5bd965603132cf8d743470a9f38c3c7b4d506416942
Python
8,583
276
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from __future__ import annotations import base64 import json import os import shutil from functools import cached_property from pathlib import Path from types import NoneType from typing import Any, ClassVar from uuid import UUID, uuid4 import attr...
8c1f1483277a9e48bd4341709ad7b3db79b36dea8dafdcf88f888f455f9b7a63
Python
8,585
178
# Copyright (c) 2022, Kwanhyung Lee. All rights reserved. # # Licensed under the MIT License; # you may not use this file except in compliance with the License. # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTI...
0d6ece9cc7f1273217c2e5b3f25c82c073ea09d216f78d966b569f6d3270a05e
Python
8,586
231
from ..qt import * import asyncio import typing import numpy import grpc import numpy.linalg from ..config import ObservableDict from ..thalamus_pb2 import AnalogRequest, AnalogResponse, NodeRequest, NodeSelector from ..thalamus_pb2_grpc import ThalamusStub from ..task_controller.util import create_task_with_exc_handli...
df9253697ce7d0ce4d30ca00370c35fbef86e7af026e8279d49e2131ceb52555
Python
8,587
201
import sys sys.path.append('../..') from PAINTeR import connectivity # in-house lib used for the RPN-signature from PAINTeR import plot # in-house lib used for the RPN-signature from PAINTeR import model # in-house lib used for the RPN-signature import numpy as np # hi old friend import pandas as pd from sklearn.prepr...
23eb524717d189f219b5b378b75e8b43b296906a2dd360ec10d4160855ce6fb2
Python
8,589
265
#!/usr/bin/env python3 """ screening_scatter_simple.py Simplified standalone version for generating iGABASnFR screening scatter plots. No external dependencies beyond standard scientific Python packages. Usage: python screening_scatter_simple.py python screening_scatter_simple.py --data "good-40AP-all-omit_mi...
067d0543c123b9d0a4ca9fe4ddb5b943e3ea1ef080a73b7d33ac6e60780e8b19
Python
8,590
258
#!/usr/bin/env python """ Image file writers for various formats. Hazen 03/17 """ import copy import datetime import struct import tifffile import time from PyQt5 import QtCore import storm_control.sc_library.halExceptions as halExceptions import storm_control.sc_library.parameters as params cl...
77b1e48d13a1a43f0a1cf9ad1cd178c6f179b24d50834740701147d0af6d486d
Python
8,590
265
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import csv import json import os import random import sys from itertools import product NAME = "webhooks" def read_rules(name): rules = [] with open(os.path.join(sys.argv[1], f"{name}.csv")) as f: reader = csv.DictReader(f) ...
f82ab86c23eeff16948f05cc0738ab2e0763fd9ebca65828bfa17465f15fbd69
Python
8,592
173
import numpy as np from brainscore_core import Score from brainscore_vision import load_metric, load_dataset from brainscore_vision.benchmark_helpers.neural_common import NeuralBenchmark, RSABenchmark from brainscore_vision.metrics.regression_correlation.metric import ( CrossRegressedCorrelation, dual_ridge_cv_reg...
2fc0414b3033bc3b20d7b676d8e44527bc3765f5a3d4a9c4bdbfe01a0228323f
Python
8,593
214
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import numpy as np import torch from torch import nn from typing import Any, Optional, Tuple, Type from .common import L...
2131176889482f4c769085d8f81ef5bcd97ded45fb97393f35eccd90761b7c31
Python
8,594
277
import os import shutil import tempfile from typing import Dict, Optional from urllib.parse import urljoin, urlparse import requests from typing_extensions import Literal from .config import ( BUSTOOLS_RELEASES_URL, BUSTOOLS_TARBALL_URL, COMPILED_DIR, KALLISTO_RELEASES_URL, KALLISTO_TARBALL_URL, ...
6146336cf3abac1c1c29a420eb05dd6854bc50a96300fb220218ed37266da25e
Python
8,594
258
from copy import copy from typing import Any, Literal from eir.models.input.array.models_locally_connected import LCLModelConfig from eir.models.output.array.array_output_modules import ( ArrayOutputModuleConfig, LCLOutputModelConfig, ) from eir.models.output.array.output_array_models_cnn import CNNUpscaleMode...
f20c92759a8da1cd791564909dd2d827a079d400eb56c70d9fe7bdea878058f0
Python
8,594
244
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import torch from torch import Tensor, nn import math from typing import Tuple, Type from .common import MLPBlock clas...
29fde86ac1e5979db0ba7ee69edf858f9bd612aa306a168aa8157ce0736fd205
Python
8,595
215
#!/usr/bin/env python """ HAL module for controlling a Tiger controller. Hazen 05/18 """ import math from PyQt5 import QtCore import storm_control.sc_library.halExceptions as halExceptions import storm_control.hal4000.halLib.halMessage as halMessage import storm_control.sc_hardware.baseClasses.amplitudeModule as am...
38e96a16a5a0dda3cdaf7c3919932b44dc1d1cd00e855ffb741048b8daafa947
Python
8,596
255
import numpy as np import numpy.random as npr import matplotlib.pyplot as plt import pickle as pkl import os from scipy.io import loadmat, savemat from math import ceil def create_hyperparameters(data_path, save_path, *args): """ Create/Modify hyperparameters settings for RNN. Args: data_path: Directo...
467e1ae263f7d76fb70b91085b7776b7125a0628678955bf4100bf204504a62c
Python
8,596
177
# Copyright (c) 2022, Kwanhyung Lee, AITRICS. All rights reserved. # # Licensed under the MIT License; # you may not use this file except in compliance with the License. # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT ...
c3cb5fe38d7bc27dc9d73df004cda019558e9320d0bd789b5092942a48cc7537
Python
8,596
250
# Adapted from https://github.com/amarquand/nispat/blob/master/nispat/bayesreg.py from __future__ import print_function from __future__ import division import numpy as np from scipy import optimize, linalg from scipy.linalg import LinAlgError class BLR: """Bayesian linear regression Estimation and pred...
88473911a6ee98fda0093b1d2f036073de1d5a883c0e247ed16be5728c97f254
Python
8,599
276
import json import shutil from copy import deepcopy from dataclasses import asdict, replace from pathlib import Path from typing import List, Tuple from unittest.mock import Mock import numpy as np import pytest import torch from aicsimageio.types import PhysicalPixelSizes from brainglobe_atlasapi import BrainGlobeAtl...
930982543cd87c1c576b34dd998551ded2bb1e70992920c7b2c328d977bbc249
Python
8,599
218
from sklearn.cluster import KMeans from sklearn.mixture import GaussianMixture from scipy.linalg import eigh, cholesky from scipy.stats import norm import numpy as np import scipy.cluster.hierarchy as hac from sklearn.metrics import davies_bouldin_score,silhouette_score from pfcmap.python.utils import cluster_validatio...
5b48bde2cfd6252d7396184a51b339545da88874a7ecef8910d86fd88df1c1c9
Python
8,600
209
# define multi-offset transformer reconstruction network import torch import numpy as np import torch.nn as nn from torch import Tensor from utils.utils import * import torchkbnufft as tkbn from einops import rearrange import torch.nn.functional as F class Attention(nn.Module): def __init__(self, dim, d...
399d3b131449cbb9725083199595e4c6beb13f36d0a95b3bce20a030aef34e1f
Python
8,603
69
from testsetclass import TestsetClass class HAL59(TestsetClass): def __init__(self): self.weak = 1.0 self.molecules = ['30_CF3I-benB', '26_benI-mSHAB', 'MeI_NCH', '20_benBr-acetoneB', 'NH3_F3CI', 'PCH', '21_benI-acetoneB', 'FI_PCH', 'BrBr_OCH2', 'NCH_NIS', 'MeI_FCCH', 'NCH_FCl', 'F3CI', 'PCH_FBr',...
473e7bed90666ae51b1accbf15b7562d2119eb2cde7c88f16fd7521a1cc01dc2
Python
8,605
224
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations import contextlib import glob import os import shutil import tempfile from contextlib import contextmanager from datetime import datetime from pathlib import Path class WorkingDirectory(contextlib.ContextDecorator...
c23f3e676439a7ad3bae972a6bacbd1c5e1d05bb241df7dd4dff80d3cbd16ff2
Python
8,608
240
"""Predictor classes. Predictors generate sets of predictions for a single fold with no cross-validation or train-test logic. """ import abc from copy import deepcopy from typing import Union import pandas as pd from ..estimation.base_estimator import IndividualOutcomeEstimator from ..estimation.base_weight import ...
1424dc30da60cb1d08a0b5a5ff76a3d6c7a7f82cfd66e4bf6424687d028ab789
Python
8,613
259
# %% import os import glob import random from os import listdir, makedirs from os.path import join, isdir, basename, dirname, isfile from tqdm import tqdm import numpy as np import torch from torch._dynamo import OptimizedModule from torch import multiprocessing as mp import cv2 import torch.nn.functional as F from mat...
b5142e0532536417af8c81824d5710fe17aacf4a06280d1d460586414e390b7a
Python
8,616
218
#!/usr/bin/env python3 """ Supplementary Information Figures 4 and 5: Single compartment orientation dependence from SpinWalk simulations at 3 T and 9.4 T. Combined figure (2x3 layout): All simulations across compartments - Top row: ΔR1 relative changes (%) for extra-axonal, intra-axonal, and myelin compartments - Bot...
6e6945ddd26ce55988e046624173355d5bbd3acf91ec02f3960a5e04cb5951c2
Python
8,617
268
from __future__ import annotations import base64 import re from pathlib import Path from urllib.parse import urljoin import requests import streamlit as st from bs4 import BeautifulSoup from htbuilder import HtmlElement, div, ul, li, br, hr, a, p, img, styles from htbuilder.funcs import rgba, rgb from htbuilder.units...
23e8a26137b44f37e9a319313822c5b38d9c55796e756202eb46d64f1979d2b0
Python
8,618
227
# %BANNER_BEGIN% # --------------------------------------------------------------------- # %COPYRIGHT_BEGIN% # # Magic Leap, Inc. ("COMPANY") CONFIDENTIAL # # Unpublished Copyright (c) 2020 # Magic Leap, Inc., All Rights Reserved. # # NOTICE: All information contained herein is, and remains the property # of COMPAN...
3f09a07814fd266925b5146e922eb50e8e01d0f7a23ba847f6183a69e582ed6b
Python
8,618
213
#! /usr/bin/env python """Shared helpers for loading the pipeline config.yml.""" __author__ = "Benjamin Barad" __email__ = "benjamin.barad@gmail.com" __license__ = "GPLv3" import copy import click import yaml # Directory settings that the pipeline joins with filenames by plain string # concatenation (e.g. work_dir ...
97d8f852b09a8c21ac8d32ea68e90dd52c40d9449d0188f21e381313bd6cac6d
Python
8,618
264
from __future__ import annotations from dataclasses import replace from typing import TYPE_CHECKING, Callable, Optional import numpy as np from PyQt5.QtWidgets import QApplication from brainways.pipeline.brainways_params import BrainwaysParams from brainways.pipeline.brainways_pipeline import PipelineStep from brain...
83f4e95d17a17bbbfae1facecbbcf6c00d0917208f7b87b530f8b0e199b3a2e8
Python
8,621
188
import os import subprocess import shutil import nibabel as nib import time import numpy as np import pandas as pd from nipype import Node, Workflow from nipype.interfaces.base import BaseInterface, BaseInterfaceInputSpec, TraitedSpec, File, Directory, traits, CommandLineInputSpec, File, TraitedSpec, CommandLine, Direc...
df2701b99bbb5626cf2e74349ce15a19a7fc8b6cef59ae15f461686a581f55d1
Python
8,621
206
#!/usr/bin/env python """ build_pca_basis.py ================== Build a PCAwarp head-shape basis from your own set of segmented head meshes. This is the step that comes AFTER the MRIsegmentation pipeline (https://github.com/harmening/MRIsegmentation). That pipeline segments each subject into corrected four-tissue bou...
c5eaa573d63ff7a33da5b53bcf9523e1988e8b99f5eb712f7082f6e3a37b1b90
Python
8,622
199
import os from copy import deepcopy import numpy as np import argparse import innvestigate.utils as iutils from keras.models import Model from keras.preprocessing import image from keras.utils import to_categorical import keras import tensorflow as tf from numpy import average, dot, linalg from utils import * from lrp ...
a6e83e4bc8c6427bb94d1ed30a799def49741e698b792690395b46b74ebbac6c
Python
8,628
248
"""PR 2 regression tests for the single-loader migration (issue #201). These lock in the behaviors PR 2 promised beyond the endpoint-level route matrix (which already covers per-endpoint ``prepare`` parity): - The ordered endpoint registry resolves each family to the right endpoint, with prefix routes winning over ...
daf7a3b5ded9f09f16391572edcb1ad9f4325ef4e3dab48934e6228fa168a4ea
Python
8,629
240
import json import mmcv import numpy as np import os.path as osp from PIL import Image from ..builder import PIPELINES @PIPELINES.register_module() class LoadKITTICamIntrinsic(object): """Load KITTI intrinsic """ def __call__(self, results): """Call function to load multiple types annotations. ...
973ba0d0b9ac68f0b47b10c83fb68f9f6b032aad942d73d1648e71123e730de0
Python
8,631
199
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jun 21 23:15:17 2024 @author: costantino_ai """ from brainscore_core import Score from brainscore_vision.benchmarks import BenchmarkBase from brainscore_vision.benchmark_helpers.screen import place_on_screen from brainscore_vision.model_interface import...
d917d21af67e2b1f1f27094d0ad95fdcdce42e21199a6113ba3de8073b7f2bc5
Python
8,631
289
import sys import typing import asyncio import traceback import threading import subprocess import multiprocessing import multiprocessing.connection from thalamus.qt import * from .thread import ThalamusThread from .config import ObservableDict from . import thalamus_pb2 from . import thalamus_pb2_grpc import datacl...
3da00748685bd1f7a45ba9490349ea6ac73e1e37df6ed745e186f3305a5d3a60
Python
8,632
246
""" This script makes behavior plots for the paper, for the single player human task. """ import sys import os sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import matplotlib as mpl import matplotlib.pyplot as plt import seaborn as sns import pandas as pd from pathlib import Path fr...
62e07a46e5908e4d454c16bc962775f1c84d0c2613f01d3b52c1206e15a85d18
Python
8,633
259
#!/usr/bin/env python """ Image file writers for various formats. Hazen 03/17 """ import copy import datetime import struct import tifffile import time from PyQt5 import QtCore import storm_control.sc_library.halExceptions as halExceptions import storm_control.sc_library.parameters as params cl...
31b656082ecea47d3cd30347d70559ee853ce21fe54300eb052d4d5a40da4556
Python
8,636
238
"""``BoundaryFinder`` against the mini-CCF's 2-D atlas. The atlas holds two rectangles, each inset from every edge, so every contour is a closed loop whose corners are computable by hand: a region occupying rows r0..r1 and columns c0..c1 has its boundary at r0-0.5 .. r1+0.5 by c0-0.5 .. c1+0.5. ``tests/test_projectio...
e6e7ef4654f7112cf2b1d0ea52a72b01bac1754f45461e038c008670220d6ce3
Python
8,637
303
# The ImpedanceFitter is a package to fit impedance spectra to # # equivalent-circuit models using open-source software. # # Copyright (C) 2021, 2023 Henning Bathel, henning.bathel2[AT]uni-rostock.de # Copyright (C) 2021, 2023 Julius Zimmermann, # julius.zimmermann[AT]uni-r...
2b21366bf526059098bd5eaef991f8c99a3806d3f2b9974fe562445b538b7ef8
Python
8,638
237
""" Implementation of the simple task """ import typing import logging import datetime from ..qt import * from . import task_context from .widgets import Form, ListAsTabsWidget from .util import wait_for, wait_for_hold, TaskResult, TaskContextProtocol, CanvasPainterProtocol from .. import task_controller_pb2 from ..c...
fa3a504a59212d979ede62a54bdc1e9d1bde44c682e8fc2f697912f03604e18e
Python
8,638
252
"""Use Virchow2 to extract latent features from whole slide images.""" from __future__ import annotations import argparse from pathlib import Path from typing import Callable, List, Optional, Sequence, Tuple, Union import h5py import numpy as np import openslide import torch from PIL import Image from torch.utils.dat...
1f63a16bd917a5643afe5814ef2ab0c8c39fa0de5a39e7f839e3a20f3f15d2ef
Python
8,639
216
import copy import torch import torch.nn as nn import torch.optim as optim import torchvision from torchvision import datasets, transforms, models from torch.utils.data import DataLoader, random_split import timm from transformers import ViTForImageClassification, ViTFeatureExtractor import matplotlib.pyplot as plt imp...
903ebdcf916e28a0d2b505baa397397c922cda5007452676e40d9c312d511256
Python
8,639
227
import pandas as pd import torch import numpy as np import pandas as pd from glob import glob from tqdm import tqdm import os import random from torch_geometric.utils import to_undirected, remove_isolated_nodes, remove_self_loops, train_test_split_edges, negative_sampling import math # our modified example def custom_...
a84b4b78890550b3b298843805c23093b17c7e3abd87b9cb27b46d605fd2f338
Python
8,640
229
import os import glob import sys import random import time import torch import numpy as np import scipy.ndimage from argparse import ArgumentParser # project imports import datagenerators import networks import losses def Dice(vol1, vol2, labels=None, nargout=1): if labels is None: labels = np.uniqu...
e826810ab9a8ac52b76f45d591831ed6742f49a5d9695c6a1cfdd5ee4d11c7f1
Python
8,641
252
from datetime import datetime from typing import Callable, Literal, TypeVar, Generic, ParamSpec, Any import numpy as np from scipy.stats import sem from argclz import AbstractParser, as_argument, try_float_type, argument from argclz.dispatch import Dispatch, dispatch from neuralib.plot import plot_figure, plot_peri_o...
1e95cd8fa5d4d5c794ea1ddcbeff3988ba84cc53eca02ae65b4900f12c767c2d
Python
8,643
243
# -*- coding: utf-8 -*- """ Created on Thu Apr 20 19:12:38 2023 @author: rl05 """ import numpy as np import csv import random from psychopy import visual, core, data, event from scansync.meg import MEGTriggerBox MEG = MEGTriggerBox() MEG.set_trigger_state(0) # reset trigger state number_of_blocks = 5 show_photodio...
aea7718e28f86291a14b7908a601fb00ed26bf91ce27719030d46b16a95e065a
Python
8,647
143
""" This scripts generates 3 examples of trainig data for joint SR/synthesis between low resolution (LR) and high resolution (HR) T1 scans. We use here real HR T1 scans. The synthetic scans are generated by sampling a Gaussian Mixture Model conditioned on label maps, which must correspond to the real HR scans used as t...
e72d3343198602a5d65c30254f089816ecdac592e68b4825c1fa06fab3b2296c
Python
8,648
228
#!/usr/bin/env python """ HAL module for controlling a Marzhauser stage. Hazen 04/17 """ from PyQt5 import QtCore import storm_control.hal4000.halLib.halMessage as halMessage import storm_control.sc_hardware.baseClasses.stageModule as stageModule import storm_control.sc_hardware.marzhauser.marzhauser as marzhauser ...
2e7d7eab2d5d759ad3aed4fb05a747f0dbff42d4d7a88ce114887a00c3f662db
Python
8,652
282
from collections.abc import Sequence from enum import Enum from pathlib import Path from typing import Annotated, Optional, Union, get_args from unittest.mock import Mock import pytest from magicgui import magicgui, register_type, type_map, type_registered, types, widgets from magicgui.type_map import TypeMap def t...
a31830805b1872c669feeac4db2cda6dc38a291a95f26efb80ffafe30a2228b0
Python
8,655
251
import json import random from collections.abc import Callable, Sequence from dataclasses import dataclass, field from pathlib import Path from typing import Any, Literal import numpy as np import pandas as pd import pytest from _pytest.fixtures import SubRequest from tests.setup_tests.setup_modelling_test_data.setup...
760abb07951365088dfd8676848cc20dd1229c8fedcedf03e9251d28acc7fd82
Python
8,658
238
import os from dataclasses import dataclass from typing import Optional import numpy as np import scipy from matplotlib import pyplot as plt from numpy.typing import NDArray from mc_analysis.simulator.g1_simulator_utils import get_cw_jac_list, get_td_jac from mc_analysis.utils.absolute_paths import DATA_PATH from mc_...
4160d2eb9be64414ea449ea6495f20d5764fa1d10220e6828542fc9f870ebe09
Python
8,659
266
""" Batch fitting script for simulated or experimental g1 time series. This script fits all `.pkl` recordings in a folder (or a single file) using a specified fitting method: - Time domain (td) - Continuous wave (cw) - Speckle contrast optical spectroscopy (scos) Usage: python mc_analysis.examples/run_fitting.py...
a471ebbe5ce8159e8d248e62fa94ec249f352612460fba5a17522d8e65452307
Python
8,660
265
# ============================================================================================================================== # Script used to plot the state-vector traces from a simulation that uses the 'save_as_text_or_binary' [save_result]. # 1) Run the simulation and store the 'V_it_<id>.txt' files in the outpu...
96c73c51040348067b78f345099e57e7f995194175b89fb3036f784a9a2b2d93
Python
8,661
317
""" Main script for generating laminar inferred cortical surfaces using equidistance, equivolume, and curvature-based linear models Reference: Lee H, ..., Huang S, Communications Biology, 2026 Requirements: - Python 3.11 - FreeSurfer installed and configured - cortech Python package available (https://github.com/simn...
aaf6d91384e79365fda3f9ad801c5fcbe60be70f939f41466b9e7ab7b0fd9165
Python
8,662
217
import pfp_api_client from pfp_api_client.pfp.calculators.ase_calculator import ASECalculator from pfp_api_client.pfp.estimator import Estimator, EstimatorCalcMode, EstimatorMethodType from ase import Atoms from ase.io import Trajectory, write from ase.build import bulk, surface, molecule, add_adsorbate, fcc111 from a...