sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
8929502e9ea8ad80051f60dee8d0580f0bbee00c5c057a369c02531dcc5edfad
Python
4,590
107
import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import Normalize from matplotlib import cm # Define x, y, and dz values x_values = np.arange(1, 17) # x ranges from 1 to 16 y_values = np.arange(1, 17) # y ranges from 1 to 7 # Flattened dz values (provided) dz = np.array([ 0....
fd9333ada40fad6dc08915c282e4602af643774dfdae6db8f43ff2f1520698cc
Python
4,591
150
''' CH3NH2 ''' import numpy as np import sys def intro(): print(""" SHORT List of potential energy surfaces for CH3NH2: P: potential energy, G: Gradient, D: Nonadiabatic coupling vector U: diabatic potential energy matrix UG: gradient of diabatic potential energy matrix This is listed at the...
9cd01aee038281ae5f0f03532b523de2f37aa5922ed91715b29f030f07d1fe3f
Python
4,593
126
import torch import numpy as np import os, sys sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from utils import get_data from utils import setup_logger import logging from TrainingLoop import TrainingLoop import matplotlib.pyplot as plt """ Final value-based model """ ## ---- Set seed ...
f644966269fa28cac144f8adf9554f51ad09446e93fe11b4e2fbf5f1d0fe34aa
Python
4,593
128
import unittest import logging import numpy as np import pandas as pd import scipy.sparse import anndata from batchglm.api.models.numpy.glm_nb import Simulator import diffxpy.api as de class TestDataTypesSingle(unittest.TestCase): def _test_wald(self, data, sample_description, gene_names=None): test = ...
02ac63f891fea7d4c76cbf73e5e14589b766a9a275f5637d54ed94689d73ca1e
Python
4,594
132
import torch import torch.nn as nn from torch import Tensor from monai import transforms as mo_trans from model.base_model import LocalAttention, MLP from model.transformer3D import ViT3D from utils.datasets import get_transform class BrainAgeEstimator(nn.Module): def __init__(self, args, device, chan...
119211c52424b9b76156a549d143f318fe1aef1eed07e65b081092821c6d7744
Python
4,594
134
from typing import Sequence, Union import torch import string import itertools from Bio import SeqIO from typing import List, Tuple from .data import Alphabet, get_rna_fm_token, BatchConverter, RawMSA rna_msaseq_toks = {'toks': ['A','U','G','C','-']} class RNAAlphabet(Alphabet): def get_batch_converter(self): ...
13ad09c2d620e11e5cc444928a06cd99e062462025254b074fe8e96beb98d9a9
Python
4,595
116
# A script to visualize the ERF. # Scaling Up Your Kernels to 31x31: Revisiting Large Kernel Design in CNNs (https://arxiv.org/abs/2203.06717) # Github source: https://github.com/DingXiaoH/RepLKNet-pytorch # Licensed under The MIT License [see LICENSE for details] # -----------------------------------------------------...
237688ba25034f26e682fba30032b16d223c98a7933fa43ad15e188282fa2894
Python
4,595
131
# transunet.py import torch import torch.nn as nn class ConvBlock(nn.Module): def __init__(self, in_channels, out_channels, stride=1): super().__init__() self.conv = nn.Sequential( nn.Conv3d(in_channels, out_channels, kernel_size=3, stride=stride, padding=1), nn.BatchNorm3d...
a096ca183c5d0e47a8cf1bc5e06bb73c58462dab5f14e656f283bd4a8c0fb5d7
Python
4,595
161
#!/usr/bin/env python """ HAL module for emulating a 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 class NoneStage(QtCore.QObject): """ Emulates a stage hardware object. ...
9c6314d8c17e0fd892935a8e4a816e7e5f4f3a6d98cf60b511cd12521eb403df
Python
4,596
131
from nipype.interfaces.base import ( File, TraitedSpec, BaseInterfaceInputSpec, BaseInterface, isdefined, ) from traits.api import Str, Either, Int import os class minIPInputSpec(BaseInterfaceInputSpec): in_file = File(exists=True, desc="Input 3D image file", mandatory=True) axis = Str("z"...
07a955776bc684dab2ec1ed5e68124a40d8aae0dcb40eb13bc9ca9afe58291cf
Python
4,597
178
""" This module defines the autoencoder (AE) models. References: Author: Julius Glaser <julius.glaser@fau.de> Soundarya Soundarresan <soundarya.soundarresan@fau.de> Zhengguo Tan <zhengguo.tan@gmail.com> """ import torch import torch.nn as nn from torch.nn import functional as F from typing import Lis...
9f2035e6bd5b8d5a0c83a2f8c7975a41851f0a74798439fb3f2609845139757c
Python
4,598
143
import random,sys import numpy as np from itertools import combinations, product def get_Einfo(): Einfo = {} Chrom = {} fin = open('human_permissive_enhancers.bed') for line in fin: line = line.strip().split('\t') Einfo[line[3]] = line[1] if line[0] not in Chrom: Chr...
ba77a1e0771d20665364ee4a4faa69ed06719bb3cc533640c4cc5ce7e15935f8
Python
4,599
79
#!/usr/bin/env python # -*- coding: utf-8 -*- # *************************************************************************** # # Copyright © 2022, UChicago Argonne, LLC # # All Rights Reserved # # Softwar...
556c93da516905996e0bc72b2ddd9a3714f86955e176990a23d5cb7b3a1cb000
Python
4,600
120
import logging import numpy as np import os import requests import torch from tqdm import tqdm from scilpy.ml.bundleparc.bundleparcnet import BundleParcNet # TODO in future: Get bundle list from model DEFAULT_BUNDLES = ['AF_left', 'AF_right', 'ATR_left', 'ATR_right', 'CA', 'CC_1', 'CC_2', 'CC_3', 'CC_4', 'CC_5', 'C...
3711f0ed693b12287ea7761a94d35c0ce8bbfb70f4b6b5240aee6937b58e8b37
Python
4,601
158
import nibabel as nib import numpy as np import pytest from numpy.typing import DTypeLike from pyment.preprocessing import conform, rescale TARGET_SHAPE = (224, 192, 224) def make_nifti( shape: tuple, zooms: tuple = (1.0, 1.0, 1.0), dtype: DTypeLike = np.float32, ) -> nib.Nifti1Image: data = np.ones...
10ac031faea1a636f7d398c941631d7d17220c229a269270be06e6a81f5d6eae
Python
4,603
80
# Kai Sandbrink # 2023-05-26 # This script extracts the survey responses for participants # %% LIBRARY IMPORT import numpy as np import pandas as pd import os, json import glob from utils import get_timestamp # %% PARAMETERS participant_ids = ['xyz'] data_folder = os.path.join('data', 'day3B', 'data') save_file =...
f8f1abfdd332ba5ba9b2cf3190f1f8fd86a192ef8b1e7cf2c586f14b3950d412
Python
4,603
152
# Copyright (C) 2021-2022 Intel Corporation # Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import argparse import importlib import importlib.util import logging import sys from http.client import HTTPConnection from pathlib import Path from typing import Any import attrs import cvat_sdk.auto_ann...
538eb0d58b3ff57954431c11f49105d55b34bb372dedb752a6285d2fa8be1431
Python
4,604
125
""" For code used in distributed training. Basically just found a stackoverflow implementation and got it to work. https://stackoverflow.com/questions/1365265/on-localhost-how-do-i-pick-a-free-port-number """ from typing import Tuple import torch import torch.distributed as dist import torch.multiprocessing as mp fro...
a3780ea0d442e37100ad49e9b09814dec36603fc8afadc032fe848f5ddbc4992
Python
4,604
123
# Copyright (c) 2022, Kwanhyung Lee, Hyewon Jeong, Seyun Kim 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 o...
c031cf153370a9dfe8864f0f6209f448ab39b6d139bd1595ac006da0d75a9a00
Python
4,606
132
''' CH4OF ''' import numpy as np import sys def intro(): print(""" SHORT List of potential energy surfaces for CH4OF: 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 a...
fcdd7735aee32cd7d24bef54508edf4c8ff5c7975c78ac10d8dfb9c246255d19
Python
4,606
110
from brainscore_vision.model_helpers.check_submission import check_models import functools import numpy as np from PIL import Image import torch import torchvision.transforms as transforms import torchvision.models from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vi...
ff2e47e5b4ba36f8a78482412913d4e7c623300657cb6c300df00d6556958cf7
Python
4,606
110
from brainscore_vision.model_helpers.check_submission import check_models import functools import numpy as np from PIL import Image import torch import torchvision.transforms as transforms import torchvision.models from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vi...
0d5afded0a419ffa1e635b5a9fb67581a2a4443ecac61a91f57e2cf8633b03d5
Python
4,607
154
import numpy as np import sys import pickle import os import yaml import argparse import ast from scipy.io import savemat from dannce.engine.io import load_sync, load_com from dannce.engine.processing import prepare_save_metadata from dannce import ( _param_defaults_shared, _param_defaults_dannce, _param_de...
00e897f3c8cc27b75e7de5392575f42de7f25a1486a5929283940b35e828c259
Python
4,608
100
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 (silhouette) has a very different stimulus sets then others, ...
542389913112939b8384b405e26db41b36f8a5e3be33c477b08726222a1ad09f
Python
4,608
111
from brainscore_vision.model_helpers.check_submission import check_models import functools import numpy as np from PIL import Image import torch import torchvision.transforms as transforms import torchvision.models from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vi...
c56ef122426116accac0e55e08961def207ff8ddeee6f2c74765c63cba6425c0
Python
4,608
110
import argparse import utils import keras from keras.models import load_model from os.path import join import numpy as np import gc ''' calculate standard deviation of ensemble predictions for train/test/val data for ResidualBind models ''' def parse_args(): parser = argparse.ArgumentParser() parser.add_argu...
cf510140f2a271a3079422c032c151f1285b8192db665db5e1a62135cdd322ac
Python
4,610
136
import multiprocessing import nibabel as nib import numpy as np from scipy.io import loadmat from scipy import sparse from itertools import compress import os import sys import time import argparse def argument_parse(): parser=argparse.ArgumentParser() parser.add_argument('--chunklist',action='store', dest='chunkli...
dd7ca32018300a5b7aeea8b87e320eee8f2a5febb14fe55be7c7a91d3a56e2ef
Python
4,610
116
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from http import HTTPStatus from unittest.mock import MagicMock, patch from django.conf import settings from django.test import TestCase from cvat.apps.engine.models import Project from cvat.apps.iam.models import User from cvat.apps.webhooks.excep...
1364d71ab8d9f4936423f3815e406ccff206c1e826a5df7b778866fdd112281f
Python
4,611
164
# -*- coding: utf-8 -*- """Header transformations.""" from pathlib import Path import nibabel as nb import numpy as np from numpy.linalg import inv __all__ = ["apply_affine_chunked", "read_vox2vox", "read_vox2ras_tkr", "vox2ras_tkr"] def apply_affine_chunked(aff, pts, chunk_size=10000): """Apply an affine matr...
56ede7830e66ce8a5006f574ced5c97196fae978e64a5269c933bd65dae884c4
Python
4,611
100
import numpy as np from rsatoolbox.util.searchlight import get_volume_searchlight from rsatoolbox.data.dataset import Dataset from nilearn.image import load_img from nilearn.masking import compute_brain_mask from rsatoolbox.rdm.calc import calc_rdm from rsatoolbox.rdm import RDMs import pickle from rich.progress import...
639053ddcc55739d8a14f80504c603b6b16cb7d92ddb2b66d7c373239f3901a1
Python
4,612
118
# Keywords obtained from https://github.com/tblite/tblite/blob/main/python/tblite/ase.py # TBLite calculator parameters for CompChemAgent from pydantic import BaseModel, Field from typing import List, Optional import logging try: from tblite.ase import TBLite except ImportError: logging.warning( "tblit...
278e01dc0a079b897bd21beba25ac8a6e3557db32ac9a0ee0ceedd59bbfc2de7
Python
4,613
96
import os import re import subprocess from nipype.interfaces.base import ( CommandLine, CommandLineInputSpec, BaseInterface, BaseTraitedSpec, BaseInterfaceInputSpec, TraitedSpec, File, traits ) from traits.api import Either, Float, Undefined class PSMDInputSpec(CommandLineInputSpec): # -p mode: from pre-p...
5afae758841fb808e3e9a6e310873ec292c57c22a3bb767f7c1ac8a89f4ac037
Python
4,614
167
#!/usr/bin/env python """ Tests of the parameters object functionality. """ import storm_control.test as test import storm_control.sc_library.parameters as params def test_parameters_1(): # Load parameters. p1 = params.parameters(test.xmlFilePathAndName("test_parameters.xml"), recurse = True) # Ch...
ce71f59b383177f1a007bb72aaaa03e272f1afbd2258d119a853777d5a0a8dd8
Python
4,614
129
"""Server-side policy for the experimental Deep Agent in the web UI. The CLI's Deep Agent runs in the operator's own terminal. In the web UI the person typing into the browser need not be the person who started the server (``--server.address 0.0.0.0``, Docker, Kubernetes), yet the Deep Agent can run shell commands as...
b9fda9fa6356ff09ed09edf82bf5ebdc9e3970987c216125fdc33083228647e8
Python
4,616
129
import logging from .constants import * _logger = logging.getLogger(__name__) def resolve_data_config( args=None, pretrained_cfg=None, model=None, use_test_size=False, verbose=False ): assert model or args or pretrained_cfg, "At least one of model, args, or pretrained_cfg...
21a5f14b97e5066e75b9524997db0707211559ce39f4c3551afef7795f27bef6
Python
4,617
158
"""Model factory to build different types of models.""" import torch import numpy as np from .mlp import SpikingMLP, SpikingEiMLP from .vgg import SpikingVGG, SpikingEiVGG from .resnet import SpikingResNet, SpikingEiResNet in_channels_dict = { 'MNIST': 1, 'CIFAR10': 3, 'CIFAR100': 3, 'CIFAR10DVS': 2,...
6e9baaa16359fae439fabc649e62792260f918febe266adb0474c759db45f014
Python
4,617
145
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from logging import Logger from pathlib import Path from urllib.parse import parse_qs, urlparse import django_rq from django.conf import settings from rq.job import Job, JobStatus from rq_scheduler import Scheduler from cvat.apps.engine.log import ...
4e8b75c3fc7d47a52bb1c02cea768bdece7ee74659901c75dac865ff944fb9b3
Python
4,622
101
# -*- coding: utf-8 -*- """ Apply deformation to surface mesh The purpose of the following script is to apply two deformations in succession (orig -> ana -> mpm) to a surface mesh using generated coordinate mappings. The script needs an installation of freesurfer. """ # python standard library inputs import os from ...
74678a82b9d781374760a1304529600033e0e70355f29d48f080d34d0f678213
Python
4,622
100
import numpy as np from result_caching import store from brainscore_core.supported_data_standards.brainio.assemblies import DataAssembly from brainscore_vision import load_metric, load_dataset from brainscore_vision.benchmark_helpers.properties_common import PropertiesBenchmark, _assert_grating_activations from brains...
c3d4697b59f7fb8bd343784747160461cdd3d22358d972ee39dc434a81ebf453
Python
4,622
137
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """isort:skip_file""" from .dictionary import Dictionary, TruncatedDictionary from .fairseq_dataset import FairseqDataset, FairseqIterableDat...
c27972c6739265f16f2ae262b01461259cbe8e60fc4067a8ecc4b98a31168559
Python
4,624
119
import mne import numpy as np import rsatoolbox import pandas as pd import copy import scipy.stats import matplotlib.pyplot as plt from joblib import Parallel, delayed import matplotlib font = {'family' : 'calibri', 'size' : 9} plt.rcParams['svg.fonttype'] = 'none' matplotlib.rc('font', **font) def pretty_plot(ax...
c99a2be4c0d6deed2b479c439e9d36d66bbdce22c2de4825964514bb1b0af698
Python
4,624
159
#Lucas Sancéré - import json import os import joblib import numpy as np import yaml from attrdictionary import AttrDict as attributedict from histo_miner.feature_selection import SelectedFeaturesMatrix script_dir = os.path.dirname(os.path.abspath(__file__)) ########################################################...
477c314b75556254f113163afb4fe5d4978b06bf0fb1b23ea512ed4c5c8709f1
Python
4,625
149
import os import random import numpy as np import pandas as pd import tensorflow as tf import matplotlib.pyplot as plt from sklearn.model_selection import KFold from sklearn.metrics import classification_report from sklearn.metrics import confusion_matrix from sklearn.metrics import ConfusionMatrixDisplay from prepro...
73de22482fc64ebf0183591e9f877dd95cd165c390a8919ab9468d6c59706329
Python
4,625
87
if __name__ == '__main__': from bread.data import Features, Segmentation import bread.algo.tracking as tracking from pathlib import Path from glob import glob from tqdm import tqdm import pickle, json import argparse import os, sys, datetime import torch from importlib import imp...
a060d7c2f36d31b3deeab1b63306861161efa46138b4510d346f9fba6e162e84
Python
4,625
125
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under th...
ee57c4a6d6c0686771b08878a9780298ed1653ff9a2022e6a8512e4262f6d074
Python
4,625
129
import torch import torch.nn as nn class UNet3D(nn.Module): def __init__(self, n_in, n_out): super(UNet3D, self).__init__() # Encoder self.ec0 = self.encoder_block( n_in, 32, kernel_size=3, stride=1, padding=1) self.ec1 = self.encoder_block( 32, 64, kernel_size=3,...
0ea7422ccba515494537ea5a80981961b80adb7d08591362fc9e48f57fb2b129
Python
4,626
142
#!/usr/bin/env python # # File dialog that allows for regex filtering. # from PyQt5 import QtCore, QtGui, QtWidgets import re import sys import storm_control.steve.qtdesigner.qt_regex_file_dialog_ui as qtRegexFileDialogUi def regexGetFileNames(caption = "Select File(s)", directory = None, extensions = None, regex =...
d30615ab8e1a7eeeba2ebef5af742a0a34dce7da9304780d1d71e3727d99ec6d
Python
4,626
113
import scanpy as sc import numpy as np import pandas as pd import sys import argparse import scipy import anndata as ad def ParseArgs(): parser = argparse.ArgumentParser( prog='AP_Profiling', description='Create AP Profiling for genes.', epilog='Best wishes' ...
f317bf62284a96b821ced1aacf58fa69f91c0487e6ad77bacc7dbf0de1f480ee
Python
4,627
92
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...
066f17bdfb881f24565f2a3f5cf9911c6aa7f1e133fb661fed96ef2b8c9eabdf
Python
4,628
92
from train_gtex import * """ Train with a subset of genes while using downsampled train donors """ def prepare_genes(config): """ Overwrite to get list of genes from SingleGeneDownsampledTrainDonors directory, which will be a smaller list of genes due to the number of extra models being trained """ ...
2808e41d0e2c9a35178f0b0ab1f04a0c22d48a82f8b68511048e1c9a5eea3fd2
Python
4,629
121
from nipype.interfaces.base import CommandLineInputSpec, File, TraitedSpec, traits_extension, traits, CommandLine import os.path class HDBetInputSpec(CommandLineInputSpec): in_file = File( desc='file to skull strip', mandatory=True, exists=True, argstr='--input=%s', hash_fi...
57d9534873120ce36231791f6c947ab80ecbd12029601f9d82a4fd8d3ef8c3af
Python
4,629
158
import torch from torch import nn from . import utils from . import model from . import data from . import argument import datetime import time import logging import os from pathlib import Path os.environ['CUDA_VISIBLE_DEVICES'] = '7' script_dir = Path(__file__).parent project_root = Path(__file__).resolve().parent.pa...
fac2e7cdc5d18b41e26304d2d86c01e97e6320c5867eca6f1d1980df163cb549
Python
4,629
134
"""``IsocortexEntireProjector``: one value per streamline, and their ordering.""" import numpy as np import pytest from ccf_streamlines.projection import IsocortexEntireProjector @pytest.fixture def projector(mini_ccf): return IsocortexEntireProjector( mini_ccf.surface_paths_file, resolution=mini_ccf.re...
35d5f6bef95b00068870750f76259e3f892f5f541fef399ee50e5baca83920ad
Python
4,630
137
import os import sys import pprint import torch import math import random from torchdrug import core from torchdrug.utils import comm from torch.utils import data as torch_data from torchdrug import data, core, utils sys.path.append(os.path.dirname(os.path.dirname(__file__))) from biopathnet import dataset, layer, ...
59cea948656f2bea53db9810393ba2a37ce76cf56831f040b0e432babbbf3a8d
Python
4,630
132
from collections.abc import Sequence from pathlib import Path from typing import TYPE_CHECKING import matplotlib.pyplot as plt import numpy as np import torch from aislib.misc_utils import ensure_path_exists from captum.attr._utils.visualization import Union, visualize_image_attr_multiple from torchvision.transforms i...
6d74c8102d9640171602d33b957af22abb2f6a5f85f7bcfc100d6a142271b392
Python
4,630
143
#!/usr/bin/env python """ RS232 interface to a Marzhauser stage. Hazen 04/17 """ import traceback import storm_control.sc_hardware.serial.RS232 as RS232 import storm_control.sc_library.hdebug as hdebug class MarzhauserRS232(RS232.RS232): """ Marzhauser RS232 interface class. """ def ...
9904a95cfbc28cce9b538ac2051519ffcc144df89bd1fdf594f6aabff312ffae
Python
4,632
103
# -*- coding: utf-8 -*- """ Created on Fri Jan 14 14:40:05 2022 @author: Yoshi """ import os import shutil # import matplotlib.pyplot as plt # from PIL import Image from average_radius_calculator import * # from scale_calculator import * # from cell_number_mapper import * # from cell_response_mapper import * def ...
f31f1a74714945c01700bc14a3336a7b07c22025d6dfbe7ec4008d0178d65fa3
Python
4,632
123
#!/usr/bin/env python """ Reads a list of intervals and a maf. Produces a new maf containing the blocks or parts of blocks in the original that overlapped the intervals. It is assumed that each file `maf_fname` has a corresponding `maf_fname`.index file. NOTE: If two intervals overlap the same block it will be writt...
f949e4ece3b3a993bddd3c2e65b9f3e499e9cb1cff54c8405ffc50f2af6f0548
Python
4,632
122
#! /usr/bin/env python3 import inspect import torch from utils import common_functions as c_f from utils.module_with_records_and_reducer import ModuleWithRecordsReducerAndDistance from losses.mixins import EmbeddingRegularizerMixin class BaseMetricLossFunction( EmbeddingRegularizerMixin, ModuleWithRecordsReduc...
766e1b47ae477ce7f6e893844f144f517be22497d0db9f208544fa91cf552482
Python
4,633
171
# the code is adapted based on a previous version of Dr. Sebastian Schmidt # adaptation was made to match brunel network simulation in NEST simulator # load packages needed for this project import arbor as A from arbor import units as U import numpy as np from numpy.random import RandomState from parameters import * ...
7769d22560b6c9b79ce43fe705dd3f2abf62fb68792f2fb230ccce39d3622202
Python
4,634
111
from __future__ import print_function import scipy.sparse as sp import numpy as np from scipy.sparse.linalg.eigen.arpack import eigsh, ArpackNoConvergence def encode_onehot(labels): classes = set(labels) classes_dict = {c: np.identity(len(classes))[i, :] for i, c in enumerate(classes)} labels_onehot = np.a...
876c7587bc590deea1640c6093fad1b30af8f0e91c9abc23aa6d7fb4ee5a2cdd
Python
4,634
113
"""Level-3 parity check: MATLAB vs Python network metrics on IDENTICAL graphs. Loads the adjacency matrices + MATLAB-computed metrics produced by parityRun/gen_step4_parity_reference.m (MATLAB's own BCT functions run on this parity run's adjacency), feeds the *same* adjMsub to the Python port's network_metrics functio...
14515fda9bd1e610775d9baba1f0d9010ba6f83072439e811cff9cdb066e92ac
Python
4,636
127
# -*- coding: utf-8 -*- """ Created on Thu Jun 6 20:13:38 2024 @author: fmizt """ import pandas as pd from sklearn.decomposition import PCA from matplotlib import pyplot as plt import numpy as np import seaborn as sns from scipy import signal from scipy.io import wavfile import glob import scipy.stats...
315c295178960d0ea7d43bfbe3b606720ae0d8ac2a2ceed97c1797dd28adff2a
Python
4,637
141
import h5py import os import matplotlib.pyplot as plt import numpy as np from matplotlib.patches import Rectangle 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: ', DAT...
37c80e423a1914a6a4fe4d7af7fbb2eb4752b67311c0f9b0e02a8a982c49c8a8
Python
4,637
126
''' C2N ''' import numpy as np import sys def intro(): print(""" SHORT List of potential energy surfaces for C2N: 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...
f1ce41c1bd823aef87c354caec4e3e594da8246f59d6f398079b69da66c383a6
Python
4,637
103
import torch import torch.nn as nn import torch.nn.functional as F import timm # Minimal decoder for Swin-based segmentation class SimpleSwinDecoder(nn.Module): def __init__(self, in_channels, out_channels): super(SimpleSwinDecoder, self).__init__() self.decode = nn.Sequential( nn.Conv2...
f1484344aca0fb54860d1bc959f0608adb75a8941b37e69aeacc5dbda533f29e
Python
4,639
126
import sys import argparse import numpy as np import pickle from matplotlib import pyplot as plt from scipy import sparse from scipy.io import loadmat def argument_parse_savematrixfig(argv): parser=argparse.ArgumentParser(description='Save a matrix image for an input chacoconn or average or multiple input chacoco...
3086f005f4bf58b94da5581a050046ebcdc93e08fcfe96c14885347a6e6163a2
Python
4,640
145
import enum import importlib import logging from dataclasses import dataclass from enum import auto from os import path from typing import List import onnx from onnx import AttributeProto logger = logging.getLogger(__name__) def parse_mapping_from_path(mapping_path): """ Parse the input accelerator residing...
d20deea523d908934a93803c0269e82a48aa74cb5dd76a1595128d32a3b1bd3b
Python
4,640
121
# -*- coding: utf-8 -*- # @Author : LG from ISAT.segment_any.segment_any import SegAny from matplotlib import pyplot as plt import numpy as np import cv2 import time import os def show_mask(mask, ax, random_color=False): if random_color: color = np.concatenate([np.random.random(3), np.array([0.6])], axi...
0b2f1d8f505d12d2e234027202ae71bc23e561cfaccd7fb9d7d53ef1f961a57b
Python
4,641
131
# Copyright 2025 BrainX Ecosystem Limited. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
502ccf0ae160686c94c19476bebce47d1b160f464bb02864429f233fa208d7f0
Python
4,641
140
import os import numpy as np import torch from tqdm import tqdm from torch_geometric.data import InMemoryDataset, extract_zip from mlcg.utils import download_url from mlcg.data import AtomicData class EFADataset(InMemoryDataset): """General base extractor for the EFA dataset described in https://doi.org/10.48550...
511bacd045c861bf18de7276b649b2c3d8d77315db279a5e967796ec0dc6c8a8
Python
4,641
92
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...
7a159629d2b645f6ec83235e7302c033eb4c330206b9ada00dfee3c71c8c1b1c
Python
4,641
134
# -*- coding: utf-8 -*- # # test_morphology.py import unittest import arbor as A import numpy as N import math """ tests for morphology-related classes """ def as_matrix(iso): trans = N.array(iso((0, 0, 0))) return N.c_[ N.array([iso(v) for v in [(1, 0, 0), (0, 1, 0), (0, 0, 1)]]).transpose() ...
a5d7106489136d1a83703c56ac2ba4147276a12974144de7753d82609021c883
Python
4,641
131
# LISI - The Local Inverse Simpson Index # Copyright (C) 2018 Ilya Korsunsky # 2019 Kamil Slowikowski <kslowikowski@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, e...
d5000d307bc0a19b99afe4e3286265af995fddb3db4330001f46aba6437e75b3
Python
4,641
110
from brainscore_vision.model_helpers.check_submission import check_models import functools import numpy as np from PIL import Image import torch import torchvision.transforms as transforms import torchvision.models from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vi...
42b5f5a673af7965701a0e6b3b269e005001186b8aac1e29be022f6e47b9923a
Python
4,642
118
import copy import pickle import numpy as np import pandas as pd import fire from joblib import Parallel, delayed import sys sys.path.insert(0,'..') import contrasts import nilearn import nilearn.image import nilearn.plotting import glob from nilearn.interfaces.bids import get_bids_files ref_img = nilearn.image.loa...
7b6a80d6bfce51648c15b22242e909c79bd84ffda40d7e44ef5577cd3ffa4bd3
Python
4,645
133
''' AlmHn ''' import numpy as np import sys def intro(): print(""" SHORT List of potential energy surfaces for AlmHn: 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 a...
8639eca6894e4bb5be76fc555da795bc705806b1881c00a3971a12d73cf7b113
Python
4,645
172
# -*- coding: utf-8 -*- """ Routines to generate various structure elements Structured elements defined by the ``setype`` key include: .. _StructureElementTypes: Structure Element Types ----------------------- =============== ===================================== Type Descrition =============== =======...
a65ca2066e2e5bdc14f9d522a33a37d858b4a2f4885a3526f2b47617a4bc72fe
Python
4,646
135
import matplotlib.pyplot as plt import numpy as np import nems from nems import Model from nems.layers import WeightChannels, FiniteImpulseResponse, RectifiedLinear, STRF from nems import visualization from nems.metrics import correlation from nems.models.LN import LN_plot_strf ## Synthesize some data # # Model has...
bd054a0231cb4f7315199029ed4ffd824ad32397a24cfc0d27f4af5115d7b363
Python
4,646
121
import mne import numpy as np import rsatoolbox import pandas as pd import copy import scipy.stats import matplotlib.pyplot as plt from joblib import Parallel, delayed import matplotlib font = {'family' : 'calibri', 'size' : 9} plt.rcParams['svg.fonttype'] = 'none' matplotlib.rc('font', **font) def pretty_plot(ax...
adb8be891922e8d520a9932df623ad9ef984d6abd5372d716a8b8d3a4c53a0a4
Python
4,647
110
import pingouin as pg import polars as pl import seaborn as sns from argclz import AbstractParser, argument from neuralib.plot import plot_figure from neuralib.util.verbose import print_load, printdf, publish_annotation from rscvp.statistic.core import print_var from rscvp.util.cli import CommonOptions __all__ = ['Se...
263a9f208453e889a19a2f43b5100f42312496022dffe9e91e33ff582fd47c47
Python
4,648
175
import torch import torch.nn as nn import torch.nn.functional as F from torch_geometric.utils import softmax from torch_geometric.nn import ( MessagePassing, GATv2Conv, GraphNorm ) class AttentiveLayer(MessagePassing): def __init__( self, input_dim, output_d...
ed6c72855eb466ddb7aa4bfa6de19bb5ce3a57b593e24784c7ca996ac18fc17c
Python
4,648
162
"""Plotting helpers for Waven RF correlation analysis.""" from __future__ import annotations from pathlib import Path from typing import Iterable, Optional, Sequence, Tuple import numpy as np def finite_abs_max(values: np.ndarray, fallback: float = 1.0) -> float: """Return a finite absolute max, with a nonzero ...
1031d46739f6a3386745ae0695907475ac2f86c4450da09b588698bd722c4a25
Python
4,649
158
#!/usr/bin/env python """ Provides the functionality of camera. Basically this is everything another module would need to know to display and/or save the output of the camera. Hazen 4/17 """ import copy from PyQt5 import QtCore import storm_control.hal4000.halLib.halFunctionality as halFunctionality class CameraF...
564674968e4458db73cb02e3749e0183e53e80e258ce3c9fe185238e8533bdee
Python
4,649
118
import numpy as np import pandas as pd import os import time import matplotlib.pyplot as plt import copy from .entropy import get_entropy, get_io_entropy from .vectorisation import get_all_vectorisation def get_oneway_ent(all_vector, id_lst, df, keyed, in_columns, out_columns): ''' Get the entropy of in/ou...
36be8a918235e54f7dd2fbbcb7d6c3fa0f508772d088c7670c5b0aabf57ac56a
Python
4,650
113
from brainscore_core.supported_data_standards.brainio.assemblies import NeuronRecordingAssembly import brainscore_vision from brainscore_vision import data_registry, stimulus_set_registry from brainscore_core.supported_data_standards.brainio.s3 import load_stimulus_set_from_s3, load_assembly_from_s3 BIBTEX = """@arti...
59e9cbdec8ab3353d4f272330357eae35b797af99601da1f438738aa966a0703
Python
4,650
111
# # TODO currently broken, make this work again # from brainles_preprocessing.core import ( # Modality, # preprocess_modality_centric_to_atlas_space, # ) # def preprocess_brats_style_t1_centric( # input_t1: str, # output_t1: str, # input_t1c: str, # output_t1c: str, # input_t2: str, # ...
bb145b47c6836f948e69a173c3fff431f50d1fd774b1022748ad1c88f364e5bb
Python
4,650
127
from typing import Any, Callable, Dict, List, Optional, Union import numpy as np import pyro # type: ignore import torch from numpy.typing import NDArray from pyro.infer import Predictive, Trace_ELBO # type: ignore from torch.cuda import empty_cache from tqdm import tqdm # type: ignore from scpca.train.handler imp...
6ec5b385287f4a95962198a8fb7b34b617e8063936f92aea13bd29d2d5fa1427
Python
4,653
111
# # TODO currently broken, make this work again # from brainles_preprocessing.core import ( # Modality, # preprocess_modality_centric_to_atlas_space, # ) # def preprocess_brats_style_t1c_centric( # input_t1c: str, # output_t1c: str, # input_t1: str, # output_t1: str, # input_t2: str, # ...
a5d6352ba62b2d9066c44c4d2b0b4a16446ae7663cf04a12f88dbe17d7236a59
Python
4,653
158
from __future__ import annotations import json from collections.abc import Callable from pathlib import Path from typing import Final import pytest from PySide6 import QtWidgets from pytestqt.qtbot import QtBot from labelme._app import MainWindow from ..conftest import close_or_pause from .conftest import MainWinFa...
5f5d973045e90df9d0d58bc8bfa7989dad5f2ad076ddb52a6da136d80797661d
Python
4,654
108
from brainscore_vision.model_helpers.check_submission import check_models import functools import numpy as np from PIL import Image import torch import torchvision.transforms as transforms import torchvision.models from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vi...
62f655b26239be6fca555024fcd9d873ce919b28d00795d2885988f6c6d40a56
Python
4,654
123
# Created by David Coggan on 2024 06 23 from brainscore_core.supported_data_standards.brainio.stimuli import StimulusSet from brainscore_core.supported_data_standards.brainio.packaging import package_stimulus_set import glob import os.path as op from brainscore_core.supported_data_standards.brainio.assemblies import D...
a5a8cd827d17e43980e5578a653859aa4db8a106281566625532e1e80eeb5f89
Python
4,654
136
#!/usr/bin/env python # coding: utf-8 ''' Dependencies: pip install SimpleITK nrrd requests matplotlib pandas cv2 chmod +x script.py In this code we leverage the rotated resampled and aligned annotation volumes. We have to guess the anontations in each voxel though as they were changed to an INT between 0 and 3000 f...
63d1a6307df645935539ee118a78d0d4f2ab43746e75ee6a17064c85134a3c93
Python
4,655
139
''' C2H6OH ''' import numpy as np import sys def intro(): print(""" SHORT List of potential energy surfaces for C2H6OH: 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...
738e61a1614cead33bac9aefa173a2aca6dcdc36ffaf573b7317ea2378a8a669
Python
4,655
105
from copy import deepcopy import numpy as np def merge(dict1, dict2): keys = np.unique(list(dict1.keys()) + list(dict2.keys())) keys = np.unique(keys) res = {} for k in keys: all_configs = [] if dict1.get(k) is not None: all_configs += list(dict1[k]) if dict2.get(k)...
99c443b2db833bfcc48f3e9b90056b686605284789ddf2e82a389670177aef2c
Python
4,655
113
import torch import torchvision import torchvision.transforms as T from torch.utils.data import DataLoader import click import h5py import EIANN.utils as utils @click.command() @click.option("--data-file-path", required=True, type=click.Path(exists=True, file_okay=True, dir_okay=False), ...
c99e33ae41ccdf9e29698a3bdbd8c0621efaa84f74ee720148cda122b46fe105
Python
4,658
124
"""Read structure diagrams and print their SMILES. Two ways to use the OCSR tools, both runnable from this directory: python run_ocsr.py # call the tool directly, no agent, no LLM python run_ocsr.py --agent # drive it through a ChemGraph agent The direct path needs no API key. It ca...
dd001a93c2e102c9d63cb2bae8e2ef01abfe72356ed8b8afcf6b52e76a334822
Python
4,658
124
import os from abc import ABC import vtk, qt, ctk, slicer from slicer.ScriptedLoadableModule import * from slicer.util import VTKObservationMixin # # NetstimPreferences # class NetstimPreferences(ScriptedLoadableModule): """Uses ScriptedLoadableModule base class, available at: https://github.com/Slicer/Slicer/blo...
4c6a7ff3b51f20ab5db2214f00dc0f73ba013454072c9c50002d528106504336
Python
4,660
146
import os import os.path as osp import time import numpy as np import torch import torch.nn.functional as F import pandas as pd import json import ijson import torch_geometric.transforms as T from torch_geometric.nn import ChebConv, GCNConv, Linear # noqa from tqdm import tqdm from sklearn.metrics import roc_auc_score...
3f19b42dbdb1db18a7ed83a08ab8380806bf37b4c6f7abe4fb2ca54549a49993
Python
4,661
136
#cd Desktop/GCN/pygcn/env2/ import os,csv,re import pandas as pd import numpy as np import scanpy as sc from scipy.sparse import issparse from anndata import AnnData import torch from sklearn.decomposition import PCA import math import matplotlib.colors as clr import matplotlib.pyplot as plt from . models import * cl...