sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
8ef9b8239cee8d13d876e39b99dd560c6c5805cbcec5f11a30e35bbdd3422e23
Python
3,290
126
# Calculate energies import glob import numpy as np import numpy.typing as npt from modules.tools.strings import get_clus_and_mol from modules.tools.error import display_traceback def get_total_energy_from_relaxation(file: str) -> float: """Return the total energy from a relaxation.info file Params --...
5245250bafafe32d31f16f56a2e8e2ff4eedab76ee90c382072c9a52be3c9786
Python
3,291
73
import torch def crop_tensor(input_tensor, center, crop_size, pad_mode='constant', pad_kwargs=None): """ Crops and pads an input tensor based on the specified center and crop size. Padding can be customized. Parameters: - input_tensor (torch.Tensor): The input tensor with shape (c, x, y) or (c, x, y,...
3e40f7c8cbce6f1cea2f20dce9a81e931367793d6ddf7ab820585902f4df28b8
Python
3,294
109
# -*- coding: utf-8 -*- # # 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 # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import inspect...
bf85a92c33cd3e7c44115a3196f8255f98dbc544de6c2582ca51f14e7cd89781
Python
3,294
104
# Train the Machine Learning model # Imports import json import numpy as np from sklearn.preprocessing import StandardScaler import modules.train_steps.predictors.linear_regression as lr import modules.train_steps.predictors.kernel_ridge_regression as krr import modules.train_steps.predictors.mlp_regression as mlp ...
e0e1928a4ebb88e4c4266f50a746a1c063d0379c5ae1f17ba0d80afbb0a20180
Python
3,294
94
from pathlib import Path from brainscore_core.supported_data_standards.brainio.stimuli import StimulusSet from brainscore_core.supported_data_standards.brainio.packaging import package_stimulus_set import pandas as pd import re stimuli = [] image_paths = {} stimuli_directory = 'images' ''' Dataset Information: - Fr...
225854c67fcd81d1d8f3ed0674f8f2bd5a8c705b3454883875777f0074ad4b50
Python
3,296
86
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import json import os import tempfile import numpy as np from dipy.io.gradients import read_bvals_bvecs from scilpy import SCILPY_HOME from scilpy.io.fetcher import fetch_data, get_testing_files_dict # If they already exist, this only takes 5 seconds (check md5sum) fet...
e8e1b57f25ccdc5d3342dad0004c4fe2bdb927ac4184a01573e56711e6290615
Python
3,296
96
# Run QCALC for each folder with an aims.out file # Imports from glob import glob import subprocess from modules.tools.strings import compress_name from modules.tools.error import display_traceback def generate_relaxation_info(folder: str): """Create a dummy relaxation.info (with only the energy) Params: ...
a23fc29be81ae914cc3b39b4756224062717f41f26112aef8c6ba560c0bccfeb
Python
3,297
85
# This file was automatically generated by SWIG (https://www.swig.org). # Version 4.3.1 # # Do not make changes to this file unless you know what you are doing - modify # the SWIG interface file instead. from sys import version_info as _swig_python_version_info # Import the low-level C/C++ module if __package__ or "."...
3a7ef16868cc7ff21246f0e6a41a49d24ad8a1fd1aefc5c4cd292afcdccb72a5
Python
3,298
88
from dataclasses import dataclass from typing import Optional import torch from torch import Tensor import torch_geometric.typing @dataclass(init=False) class SelectOutput: r"""The output of the :class:`Select` method, which holds an assignment from selected nodes to their respective cluster(s). Args: ...
cd5ba150e87fa7c6fd9239c4c5dab5526f97d2c39e905202708b8cec2bc44357
Python
3,298
129
"""Example script for demonstrating DyNeMo's ability to infer a soft mixture of modes. """ print("Setting up") import os import numpy as np from tqdm.auto import trange from osl_dynamics import data, simulation from osl_dynamics.inference import metrics, modes, tf_ops from osl_dynamics.models.dynemo import Config, ...
f781210e563a8689d56a01ffd9f95b2a6089e942ed0e5c33fe18da1c2679b2bd
Python
3,298
84
from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import accuracy_score, confusion_matrix, precision_score, recall_score, f1_score import numpy as np import matplotlib.pyplot as plt import seaborn as sns import time import torch class RandomForestClassification: def __init__(self, train_data...
03a8942810f334e81daae8356e4a5fc5367c99a0774265d99fd809ce02e7d116
Python
3,299
61
import numpy as np auddur = 0.2 valvedur = 0.5 stimplotfns = { 'AudStim_10kHz': lambda timestamps,ax: [ax.axvspan(timestamp, timestamp + 0.2, **{'color': 'k', 'alpha': 1, 'lw': 0}) \ for timestamp in timestamps],\ 'valve_opening': lambda timestamps,ax: [ax.axvspan...
0b7d557536f7f6572c5cf109a8d29bfdfd29e40ff38f0cb90e08322a54ba076e
Python
3,300
79
# -*- coding: utf-8 -*- import os import tempfile import nibabel as nib import numpy as np from dipy.io import read_bvals_bvecs from scilpy import SCILPY_HOME from scilpy.io.fetcher import fetch_data, get_testing_files_dict from scilpy.reconst.frf import compute_ssst_frf, compute_msmt_frf, replace_frf # If they alre...
801708365df57bb4a86a56cf103d8887361fcd153451cd32bb0cbd44e2b1bd6f
Python
3,302
64
import os import argparse import h5py import numpy as np import torch from chinn.models import PartialDeepSeaModel from chinn import train def get_args(): parser = argparse.ArgumentParser('Perform test') parser.add_argument('model', help='The model') parser.add_argument('data_file', help='The data file') ...
c7916537c17f6f90c70ddf17e83082eeb909a7fb2d50cd76cb02e3e62349e2a3
Python
3,302
68
#!/usr/bin/env python3 # Author: Francois Aguet import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import pandas as pd import numpy as np import argparse import os def lamp_from_readcount_list(readcount_files, coverage_cutoff=8, other_ratio_cutoff=0.05): """ Determine ratio of foreign all...
0b3e4eac0bb9a8a03c108e66871575161cdc44011b408407ac944a2d4e6a3274
Python
3,303
102
from typing import Tuple import tensorflow as tf class CheckpointManagerCallback(tf.keras.callbacks.Callback): def __init__( self, model, directory, period: int = 1, save_on_train_end: bool = True ): """ Callback wrapping `tf.train.CheckpointManager`. :param model: model ...
4bb69df0ec9a34d6b8818515dfa647506af3869bb354285b0e43e869ce3643f1
Python
3,303
127
import functools import os import re from typing import Callable import scipy.io from .config import get_bustools_binary_path, is_dry, is_validate from .logging import logger from .utils import run_executable BUSTOOLS_INSPECT_PARSER = re.compile(r'^.*?(?P<count>[0-9]+)') class ValidateError(Exception): pass ...
35743fae046b9f22e6f02c7bfb4c76ca4a598cddc3a0bfbf18ed264bf0eeb1e0
Python
3,306
68
#!/usr/bin/env python3 import argparse, sys, os, re class SmartFormatter(argparse.HelpFormatter): def _split_lines(self, text, width): if text.startswith('R|'): return text[2:].splitlines() # this is the RawTextHelpFormatter._split_lines return argparse.HelpFormatter._split_li...
add8cd0cd3119018e2400197ecadf63165a8b7b892cf0ed9288331cf60f0389a
Python
3,306
72
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile from scilpy import SCILPY_HOME from scilpy.io.fetcher import fetch_data, get_testing_files_dict # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys=['anatomical_filtering.zip']) tmp_dir = ...
3ad8f4a43975234b950d275d99e268613ec926bf7498ee2d0b44d487f512b2e8
Python
3,307
116
import itertools from eir.models.input.array.models_cnn import ( ConvParamSuggestion, conv_output_formula, solve_for_padding, ) def calc_conv_params_for_dimension( input_size: int, target_size: int, min_threshold: float, max_kernel_size: int = 7, max_stride: int = 4, max_dilation:...
3d12755ff1aa8a539dc34a1b10df059974508ce871951301219d966e8ecb2170
Python
3,307
66
import keras.backend as K from keras.models import Model, Sequential from keras.layers import Input,InputLayer,Multiply,ZeroPadding2D from keras.layers import Conv2D, MaxPooling2D,Conv1D,MaxPooling1D from keras.layers import Dense,Activation,Dropout,Flatten,Concatenate from keras.layers import BatchNormalization ...
558ca0b2ccab5c35b9b8189fd7b6ce9229506dc7755a1db7ade2f760a42ad8e1
Python
3,307
107
""" Run XANES workflows via the ChemGraph agent using MCP stdio transport. The MCP server is launched locally as a subprocess -- no separate server process, SSH tunnel, or port forwarding needed. The LLM agent receives the XANES MCP tools and uses them to fulfill the natural language prompt. Prerequisites: - OPENA...
98ca872fc7b49eb2fb11934b230d44a337e91feaf83896385e1d02e5181f5f20
Python
3,307
83
#To run from within python: 1. ARGS="14-Mar-2015_SLH002" 2. execfile('AnalyzeIV.py') # start and end of current duration, and time to wait until steady state, should be specified here #need to fix spike height, currently it is the overshoot from loader import Measurement import numpy as np import pickle import sy...
85a92d8f1ccf9ed52fe12b64c04ef244308d3bc05aae518e4d0fe89a457a419e
Python
3,308
98
import torch.nn as nn import torch from chimaera.lib.models import DNAEncoder from chimaera.lib.trainer import ChimaeraModule import numpy as np class OneToTwo(nn.Module): def __init__(self): super(OneToTwo, self).__init__() def forward(self, oned): twod1 = torch.tile(oned, [1, 1, 1...
f43ae280c67a4e3076ee3518fa2625afd3821eafcc55c92a65f08b30192644ea
Python
3,308
93
"""Where CAT-NAP's *derived* per-recording files live. suite2p's own outputs (``F.npy``, ``ops.npy``, …) are inputs: read-only, and often not ours to modify. But denoising produces six more ``.npy`` files that have always been written *into the same folder*, and :func:`load_suite2p` reads them back from there. That is...
8dce2f28a9ed55be5066e00f83b61bf8fed0b556ab327ea4c17786c694a963f7
Python
3,310
119
# Copyright 2024 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
f85ebb369ef766d06978fa9deaa436a07e6037d8cb5be9877855f764388ad9f0
Python
3,310
88
from typing import Optional, Tuple, Union import torch from torch import Tensor from torch_geometric.utils import scatter def to_nested_tensor( x: Tensor, batch: Optional[Tensor] = None, ptr: Optional[Tensor] = None, batch_size: Optional[int] = None, ) -> Tensor: r"""Given a contiguous batch of ...
0986666362b4dc0ff504ddd0d908202b810e5bc44e44743ecfb14878affd6658
Python
3,311
105
from yacs.config import CfgNode as CN # ----------------------------------------------------------------------------- # Training config definition # ----------------------------------------------------------------------------- _C = CN() # ----------------------------------------------------------------------------- #...
0db835d61f4fae4c4c19bbad84b352aa7870ee42853f594617e1dafc6ecc9216
Python
3,311
76
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations from pathlib import Path import torch from ultralytics.utils import LOGGER from ultralytics.utils.checks import check_requirements from .base import BaseBackend class QNNBackend(BaseBackend): """Qualcomm QN...
6785e3ef3e7819b8ad8ee08364a7abd943783e9842521d9e3d96d8a9da605349
Python
3,311
84
################################################################################# ### Script to analyze the weight structure in a network (weight distributions ### ### and mean weight within and between subpopulations) ### ##########################################################################...
8693194dd9f131f5f57abd01accd71e564ba5ca9833fb9cc0bddc75101c137e5
Python
3,311
82
from src.wrappers.OsipiBase import OsipiBase from src.original.fitting.OGC_AmsterdamUMC.LSQ_fitting import fit_segmented, fit_segmented_array import warnings import numpy as np class OGC_AmsterdamUMC_biexp_segmented(OsipiBase): """ Segmented bi-exponential fitting algorithm by Oliver Gurney-Champion, Amsterdam...
1f0407fb67f37129f69087e7a83a9a47a810f23734b76cf82548debfdcc6640f
Python
3,312
94
import scipy.io as spio import os import numpy as np import seaborn as sns import matplotlib.pyplot as plt def loadmat(filename): data = spio.loadmat(filename, struct_as_record=False, squeeze_me=True) return _check_keys(data) def _check_keys(dict): for key in dict: if isinstance(dict[key], spio.m...
003d6b4176b74ccd56d11180c3640cf1f884af35387bb55c7a485b7af19dc6b4
Python
3,313
88
from deepcardio.neuralop_core.transforms import DataProcessor from torch_geometric.data import Data class CustomDataProcessorGraph(DataProcessor): def __init__( self, in_normalizer=None, edge_attr_normalizer=None, pos_normalizer=None, out_normalizer=None ): super...
4cc29647bacbf5ce4a5f080bb3892097779840bac3b339b1966b5bd3aa9a3d0b
Python
3,313
100
import numpy as np import matplotlib.pyplot as plt #define constants evtokcal = 23.060541945 def plot_corr(e_true, e_pred, F, forces, model_path): # definitions for the axes left, width = 0.15, 0.65 bottom, height = 0.1, 0.65 spacing = 0.03 rect_scatter = [left, bottom, width, height] rect_...
87dcdda9a180487b19c617aef2cbc0be22dc663580c57380f58642369db0d052
Python
3,313
66
import torch import torchvision import torchvision.transforms as transforms datapath = 'D:\Projects\Context Dependent Learning\datafile' def get_indices(dataset, class_name): indices = [] for i in range(len(dataset.targets)): if dataset.targets[i] in class_name: indices.append(i) ...
b2dc4a8e02f7886826bae74938d49b19b2cecea14fa8c34b3b137573011b303b
Python
3,313
81
#!/usr/local/bin/python3 import logging from pipeline.meso import * from tqdm import tqdm # PATCH DELETION OF meso.SummaryImages.Correlation and meso.SummaryImages.L6Norm BY MARIO GALDAMEZ ON 2021-12-17 logging.basicConfig(level=logging.ERROR) logging.getLogger('datajoint.connection').setLevel(logging.DEBUG) if ha...
f174ee56878998a3be27ffa123a07b2848a2b8fc275237411f8866fe129ee97f
Python
3,314
98
import numpy as np import polars as pl from argclz import AbstractParser, try_int_type, as_argument from neuralib.plot import plot_figure from rscvp.statistic._var import VIS_DIR_HEADERS from rscvp.statistic.csv_agg.core import ParquetSheetSync, NeuronDataAggregator from rscvp.util.cli.cli_io import get_headers_from_c...
45cfaf857b498538bc13c799fa859e9f05193ec919d729c6bfeaa945bc61f16d
Python
3,315
69
#!/usr/bin/env python3 """Stage 1 (DD-Database) -- extract features and cache windowed arrays.""" from __future__ import annotations import argparse, json, logging, sys, time from pathlib import Path import numpy as np sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src")) from rgnft.data_dd import DDD...
55f9239956bf1e3cc54467c7c0c3e24e1830f6905c3c2c45275dc7d2f851b813
Python
3,315
84
################################################################################# ### Script to analyze the weight structure in a network (weight distributions ### ### and mean weight within and between subpopulations) ### ##########################################################################...
7b96dec1c6307889dfbbeee652b420d9805ca620df6e05524a5b0f6d831176f6
Python
3,315
97
''' Script to obtain layer-specific activations from Wav2Vec2.0-large-xlsr-53-german for all audio files in a given directory. NOTE: Running this model is quite memory intensive if you want to run it over the full narrative data. At the very least, you should have 20GB+ of memory available (preferably 40GB). NOTE: He...
d2588d505bf9af6204899983a572abfbf0b17fb2302e2f346e038bc903e46d55
Python
3,316
107
from __future__ import division from time import sleep from time import time import numpy as np import scipy as s import pandas as pd import numpy.ma as ma import os import sys import h5py from mofapy2.core.nodes import * def mask_data(data, mask_fraction): """ Method to mask data values, mainly used to evaluate ...
086b344f312a078cf552e8e3fc7c0f8cb0853395cd757852e4dda00211482237
Python
3,318
60
from typing import Optional from pytorch_lightning import LightningDataModule from torch.utils.data import DataLoader from project.datasets.DB5.db5_dgl_dataset import DB5DGLDataset from project.utils.deepinteract_utils import dgl_picp_collate class DB5DGLDataModule(LightningDataModule): """Unbound protein compl...
6a0a466d41779392fcd80649ff72ed6c0c53ded2233250154749ff9877850c62
Python
3,319
65
import os import sys import json from mako.template import Template sys.path.append(os.path.abspath(os.path.dirname(os.path.realpath(__file__)))) from macularCellGenerator import load_json def load_jsons(json_dir): json_data = [] for json_path in os.listdir(json_dir): if json_path.startswith('macular...
96eafa9199243d57692f16a9cddf6db27ba4183d1c6d65fbbd3437b8731b589d
Python
3,319
84
"""Register each run to one reference run.""" import os import subprocess import numpy as np import nibabel as nb # ============================================================================= REF_NAMES = [ "/home/faruk/DATA-PT35_SLABS/derived/sub-10_WB_crop/01_mag/03_avg/sub-10_ses-01_run-01_dir-def_part-mag_M...
795505f32267577339fff9a0aa6e721d51f6ce2221762e9aa8af3797a2964efd
Python
3,320
87
import numpy as np # func for the whole image pred in 3D denoising class PatchPred_3D_denoiser: def __init__(self, eval_model): self.eval_model = eval_model def multi_input(self, w_img, o_img): w_0, o_0 = w_img, o_img w_2, o_2 = w_0[:, ::2, ::2, :], o_0[:, ::2, ::2, :] ...
a7bc6685ee896af4eb8874644a10e40f1a47b240d44948ab7beed890b406969b
Python
3,320
84
from __future__ import absolute_import from __future__ import division from __future__ import print_function import glob import re import os.path as osp from ..utils.data import BaseImageDataset class VeRi(BaseImageDataset): """ VeRi Reference: Liu, X., Liu, W., Ma, H., Fu, H.: Large-scale vehicle r...
3883dadd9dcea8b9529966a4b0081911c31dcbed04de1ef974d477449c7b5d8c
Python
3,322
89
import sys import os sys.path.insert(0, '../') sys.path.insert(0, '../../') sys.path.insert(0, '../../../') sys.path.insert(0, '../../../../ogb') os.environ["OMP_NUM_THREADS"] = "2" # export OMP_NUM_THREADS=1 os.environ["OPENBLAS_NUM_THREADS"] = "2" # export OPENBLAS_NUM_THREADS=1 os.environ["MKL_NUM_THREADS"] = "2" #...
cf498e36658feff80c9cf263532244c3f567d15a17d7ba9de7180d8753536546
Python
3,322
88
from unittest.mock import Mock, patch import pytest from brainways.project.info_classes import MaskFileFormat, SliceSelection from brainways.ui.controllers.cell_detector_controller import CellDetectorController from brainways.ui.widgets.cell_detector_widget import CellDetectorWidget @pytest.fixture def cell_detecto...
e8f6074c890772a26fde85dc66b961aeb8cd3ec52378cd9eebfb37f9de7b0663
Python
3,322
91
import itertools import torch import torch.nn.functional as F def resample(x, res_scale, axis, output_shape=None): """ A module for generic n-dimentional interpolation (Fourier resampling). Parameters ---------- x : torch.Tensor input activation of size (batch_size, channels, d1, ...,...
086bc802d2a2d019b3945de237ef16a8f511776b7f94ffbb1f6f051b7c4c11ad
Python
3,323
109
# Copyright 2014-2015 Numenta Inc. # # Copyright may exist in Contributors' modifications # and/or contributions to the work. # # Use of this source code is governed by the MIT # license that can be found in the LICENSE file or at # https://opensource.org/licenses/MIT. import multiprocessing import os import pandas tr...
2ca0eeff79f33331cd9473465d727527b7d2d653c0c8cc9c882eadd818139a9f
Python
3,324
82
import torch from torch_geometric.nn import TransformerConv def masked_edge_index(edge_index, edge_mask): return edge_index[:, edge_mask] class SemanticAttention(torch.nn.Module): def __init__(self, in_channel, num_head, hidden_size=128): super(SemanticAttention, self).__init__() self...
45b0d160fc636123ee930de5ab130e090410472b225b8851341fed1b6305d008
Python
3,325
96
from typing import Callable, Optional import torch from torch_geometric.data import Data, InMemoryDataset, download_url class QM7b(InMemoryDataset): r"""The QM7b dataset from the `"MoleculeNet: A Benchmark for Molecular Machine Learning" <https://arxiv.org/abs/1703.00564>`_ paper, consisting of 7,211 mo...
0dd2daa1c33fd3efc38282837dfb7e30dd50465ce92b44154df93ba41ef06de0
Python
3,326
103
import pdb import grpc import typing import bisect import logging import asyncio import functools import traceback from .config import ObservableCollection, ObservableDict, ObservableList from .qt import * from .task_controller.util import create_task_with_exc_handling from . import thalamus_pb2 from . import thalamu...
d76575d1e2cf9209e185d9db351dd2157d89ff78279354488848594afc2f3f80
Python
3,326
86
# NOTE: 256GB CPU memory required to run this script. import os.path as osp import time import argparse import torch import numpy as np from torch_sparse import SparseTensor from torch_geometric.nn import CorrectAndSmooth from torch_geometric.nn.conv.gcn_conv import gcn_norm from ogb.lsc import MAG240MDataset, MAG240...
28ce4761a780c64e33ac58e6e01175c8eed34599e5fe43c8bc273112295411ea
Python
3,327
84
""" Convert unit feature prediciton results from mat to pkl This file is a part of GenericDecoding_demo. """ import sys import os import glob import pickle from itertools import product from time import time import numpy as np import h5py #--------------------------------------------------------------------------...
39d7bacc6fd44357500857cf05222efe274501844a93f4e059518694ea8aad8d
Python
3,327
88
from numpy import ( allclose, isnan, ) from bx.motif import pwm def test_create(): m = pwm.FrequencyMatrix.from_rows(["A", "C", "G", "T"], get_ctcf_rows()) # Alphabet sort assert m.sorted_alphabet == ["A", "C", "G", "T"] # Character to index mapping assert m.char_to_index[ord("A")] == 0 ...
806ac04cf18f57101f3ef65234e81e59cfa97a1b12a7541e79ef5df552314a11
Python
3,327
90
# This file was automatically generated by SWIG (http://www.swig.org). # Version 4.0.2 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. from sys import version_info as _swig_python_version_info if _swig_python_version_info < (2, 7, 0): raise Runtime...
a7d9436aa4c748ffb8cb69c51fbf8150549123991a01e151e7ed5ead08de215c
Python
3,327
101
from collections.abc import Sequence import numpy as np import torch from hypothesis import given, settings from hypothesis.strategies import floats, integers, lists from eir.data_load.data_utils import Batch from eir.interpretation import interpret_tabular as it from eir.interpretation.interpretation import SampleAt...
dfb89c08ec98e3a32c5eb70aed0d3946000eefef01f1538e2dd30df9a759b980
Python
3,327
101
# -*- coding: utf-8 -*- import numpy as np def random_uniform_on_sphere(nb_vectors): """ Creates a set of K pseudo-random unit vectors, following a uniform distribution on the sphere. Reference: Emmanuel Caruyer's code (https://github.com/ecaruyer). This is not intended to create a perfect resul...
7e21a6ad9cc0596e234a67c7e9a77df2a0176ba5dbecd7ff405e07dc481f8696
Python
3,334
83
import numpy as np from monai import transforms class ZScoreNormalisation(object): ''' Calculate the z-score normalisation of the input image in a batch, i.e. (x-mean)/std. ''' def __init__(self): self.eps = 1e-8 def __call__(self, sample): mean = sample.mean() std = sample....
7c05e26856d0ce00cbec6bd67d95b1fd7636abbcfd90f2af4464169fce8409de
Python
3,335
91
from Bio import ExPASy from Bio import SeqIO from collections import Counter import numpy as np import matplotlib.pyplot as plt import csv from matplotlib.backends.backend_pdf import PdfPages AA_LETTERS = sorted("ACEDGFIHKMLNQPSRTWVY") # list all proteins in ecoli by uniprot_ID - aprse from .txt file UPID_list = [] ...
ebf871821fd7331b86262963218fb60849eba8dc6c2253ae02eaceb30e66058d
Python
3,335
78
from brainscore_vision import data_registry, stimulus_set_registry, load_stimulus_set from brainscore_core.supported_data_standards.brainio.s3 import load_stimulus_set_from_s3, load_assembly_from_s3 from brainscore_core.supported_data_standards.brainio.assemblies import NeuroidAssembly BIBTEX = """@article{cowley2026c...
ae9cd62fc5fbc4a7397d366d250206a74e2cf44dd7ac9e53570f5d320f01c258
Python
3,336
96
""" Tests for `bx.wiggle`. """ import unittest from io import StringIO from bx import wiggle # A modified version of UCSC's example wiggle, taken from http://genome.ucsc.edu/goldenPath/help/wiggleExample.txt test_wig = """browser position chr19:59302001-59311000 browser hide all browser pack refGene encodeRegions br...
63dfe2aca500dde8d84403a49691c59b5f5627f5b67f299282e03548963dbb62
Python
3,337
85
import tensorflow as tf import csv import numpy as np import SimpleITK as sitk import matplotlib.pyplot as plt from numpy import argmax import pandas as pd import tensorflow.keras.backend as K from tensorflow.keras import initializers from tensorflow.keras.callbacks import Callback from tensorflow.keras.lay...
bc32a2b8f478ba81b2ba301281fd2a282641cfe5c3ab2dd30eb5ba32db594ecc
Python
3,337
155
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Split results according to segmentations """ import os import numpy as np import mbflim.utils as ut import mbflim.visualization as vis import mbflim.image.image_set_processing as setpro import mbflim.parameters as par import tools.flim.flim_set_processing as fl_set...
96e37c28c8a4de1796fd9ea9e7f8fbb7d21340a1e0f6619bbdf75b5816442b76
Python
3,339
112
#!/usr/bin/python # ## @file # # Communicates with a Thorlabs PM-100 power # meter attached to COM1. # # Hazen 2/09 # import lib.RS232 as RS232 ## powerMeter # # Encapsulates RS-232 based communication with a Thorlabs power meter. # class powerMeter(RS232.RS232): ## __init__ # # @par...
280059ed6b8c7a62a9465097d3e8ce822cacbb87346557f31ceea0371bc33c82
Python
3,340
104
""" Defines the RewardSchedule widget """ import typing import logging import functools from ..qt import * import matplotlib from matplotlib import pyplot from ..config import ObservableCollection COLORS = [ QColor(int(c[0]*255), int(c[1]*255), int(c[2]*255)) for c in pyplot.get_cmap('tab10').colors ] LOGGER = ...
085c7bb997e14209246c294fc72f2f9d8ba66ce99853f42fe253b290b1fca203
Python
3,341
83
import numpy as np from monai import transforms class ZScoreNormalisation(object): ''' Calculate the z-score normalisation of the input image in a batch, i.e. (x-mean)/std. ''' def __init__(self): self.eps = 1e-8 def __call__(self, sample): mean = sample.mean() std = sample....
34539f4288fccab4e588578ff5e4663aa90e849f2f75df6aa70219d65b715e9b
Python
3,341
92
# -*- coding: utf-8 -*- # @Author : LG import os from PIL import Image, ImageOps from PyQt5 import QtCore, QtWidgets from ISAT.ui.process_exif_dialog import Ui_Dialog class ProcessExifDialog(QtWidgets.QDialog, Ui_Dialog): def __init__(self, parent, mainwindow): super().__init__(parent=parent) ...
cc1324291142d919a95e69defd2d12b4b83183cda340dfe70280bc8c7d4037ec
Python
3,341
90
############################################################################# # 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...
3713867545bcd7853db781d6c7d3adfbfd04b78955a784443a984e17eb392893
Python
3,342
73
import functools from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images from brainscore_vision.model_helpers.check_submission import check_models from brainscore_core.supported_data_standards.brainio.s3 import load_weight_file from brainscore_vision.models.mobilenet_v2_0_5_192.model impo...
b6b25c8c77daa7ad54ae193499c942c3aa157ddaf5a5ac37b83f859701784892
Python
3,343
90
# Main keywords and parameters obtained from https://wiki.fysik.dtu.dk/ase/_modules/ase/calculators/nwchem.html # Parameters for NWChem calculator in CompChemAgent from typing import Optional, Union, Dict from pydantic import BaseModel, Field from ase.calculators.nwchem import NWChem class NWChemCalc(BaseModel): ...
b129310bb20d220748cf4b939d48b5348f9e29761a805a89c5c4348ac75ff587
Python
3,345
70
import torch from torch._dynamo import OptimizedModule from torch.nn.parallel import DistributedDataParallel as DDP import torch.distributed as dist def load_pretrained_weights(network, fname, verbose=False): """ Transfers all weights between matching keys in state_dicts. matching is done by name and we only ...
c26e23e4b44cdcf266e0771ac60d62fa524f8613c2bedebce47fbd8692e0623c
Python
3,346
78
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...
d5a7285d2926223fecfa0eb8a2f5a93d0b0737a9ad94134049f91190d9397ee6
Python
3,346
74
import os import scanpy as sc import scanpy.external as sce import anndata as ad import pandas as pd from scipy.io import mmread import warnings warnings.simplefilter(action='ignore', category=FutureWarning) os.chdir("/data/wuqinhua/phase/age/") data = sc.read_h5ad("./all_pbmcs/all_pbmcs_rna.h5ad") meta = pd.read_csv...
3e5d86916b1f221f75814dbb489c22f975f2083f4c0b2a882c5754d48bfe05d2
Python
3,348
92
import os from argparse import ArgumentParser import numpy as np import torch from Functions import generate_grid_unit, save_img, save_flow, transform_unit_flow_to_flow, load_4D, imgnorm from miccai2020_model_stage import Miccai2020_LDR_laplacian_unit_add_lvl1, Miccai2020_LDR_laplacian_unit_add_lvl2, \ Miccai2020...
5a6d3d45bd9d174e516e72d65037dfd24696577f8d8f04484f63d2c68f44f4ac
Python
3,348
88
#!/usr/bin/env python import click as ck import numpy as np import pandas as pd import time import math import gzip from deepgo.utils import Ontology, NAMESPACES from deepgo.models import DeepGOModel from deepgo.data import load_normal_forms from deepgo.extract_esm import extract_esm from pathlib import Path import to...
62fa239e2394372bde1b79035ef05d6164b4892870b5c4ed20852140075f66b0
Python
3,348
100
# Copyright (c) OpenMMLab. All rights reserved. import matplotlib.pyplot as plt import mmcv import torch from mmcv.parallel import collate, scatter from mmcv.runner import load_checkpoint from depth.datasets.pipelines import Compose from depth.models import build_depther def init_depther(config, checkpoint=None, dev...
e812ac554be84caa120527941776a26a857d0ec08c9879a7cc0324e26b98481f
Python
3,348
83
#!/usr/bin/env python3 """Stage 1 -- extract features and cache windowed arrays. Run once per (observation window, horizon) pair. Output is a compressed .npz plus a JSON manifest recording every parameter that shaped it. """ from __future__ import annotations import argparse import json import logging import sys impo...
088694a0b5a78cd241db9cef04089636c6dd183504cb04e1fb27f6c563b8f5e7
Python
3,349
64
# # fiberprofile/analysis/parametrize.py # # Parametrize fiber tracts by arc length (replaces dtitractstat -f): the plane of origin and the arc length of every # fiber point are computed like EXTRACT_Profile, and each fiber is resampled on the arc length grid (multiples of the # step size from the plane): every...
091fd02f5bba72e28a2c48cfb99418eab8363b77e7fd8d38591d25ab0d1e5439
Python
3,349
108
import numpy as np import torch def predict_tier1( model, data_loader, device, return_embeddings=False): model.eval() all_predictions = [] all_labels = [] embeddings = [] with torch.no_grad(): for batch in data_loader: batch = batch.to(dev...
34fc0b19ad490ca6c15de97a7b77150faa4c9394ae122abb1dfba09ceea42ef9
Python
3,349
115
# -*- coding: utf-8 -*- # @Author : NaiChuan # @Time : 2025/7/15 11:57 # @File : ResMLP.py # @Software: PyCharm import torch import numpy as np from torch import nn from einops.layers.torch import Rearrange class Aff(nn.Module): def __init__(self, dim): super().__init__() self.alpha = nn.P...
c942a7faee38098732c5d5a78994e2f542faf93d776a5eb4c90f5f6bb664fd01
Python
3,349
107
import os import sys import subprocess from setuptools import setup, find_packages, Extension from setuptools.command.build_ext import build_ext from os import path this_directory = path.abspath(path.dirname(__file__)) with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f: long_description = f....
ea6596cb5b637aea2b8bcb46f2447d772461e755524519041c49e48a3d7d981e
Python
3,349
94
import torch from torch import Tensor import torch.nn as nn from typing import Union, List from bism.utils.cropping import crop_to_identical_size class tversky(nn.Module): def __init__(self, alpha, beta, eps): """ Returns tversky index of two torch.Tensors :param smooth: float ...
75a5c6a6ecc376687df6bca00680a7b7669868193b2df2429ff7cb1f0a3f360c
Python
3,350
66
from mmsdk.mmdatasdk import log from mmsdk.mmdatasdk.configurations.metadataconfigs import * from tqdm import tqdm #this function checks the heirarchy format of a given computatioanl sequence data. This will crash the program if data is in wrong format. If in correct format the return value is simply True def validat...
2dd86c2f40f2023d0aaa36deeac62de8492c6c00d6ebf265c2b7b5b50e3847f8
Python
3,352
92
# Copyright 2024 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
5a1d5fdcd4350b9ed848919794512a856fb90daacfbf1bdfe1bd2a958e875666
Python
3,352
118
import numpy as np import pandas as pd from torchvision.transforms import ToTensor from . import names def mse(image1, image2, mask=None): from skimage.metrics import mean_squared_error if mask is not None: mse = mean_squared_error(image1[mask], image2[mask]) else: mse = mean_squared_er...
65edaa81034e4fba7c3dc1fde935437e7bc7df8b9c560e22fdd9b5509276cebb
Python
3,352
107
# import our previous code from wilson_cowan import step, Params from ring import recipe from mpi import world, group, inter import arbor as A from arbor import units as U import numpy as np assert world.size == 2, "Need exactly two ranks" dt_arb = 0.005 # ms dt_nmm = 0.01 # ms dt_com = 0.5 # ms T = 100 # ms ...
bfe0fd43ca616b5ad54492e5adb32243643abb85dd0204904819ebb5acbec80e
Python
3,352
102
#-*- coding : utf-8-*- import os import csv import pandas as pd import time import content_features as cf from tqdm import tqdm def caculate_feature(all_text, all_text_like, all_text_retweet): vec = { "id":'u', "characters":cf.count_characters(all_text), "hashtags":cf.count_hashtags(a...
e832bd3f38e5e4e493ae0c0c93501ef7338acd4e4525ca374fb3f37fd2fc9742
Python
3,352
114
# coding=utf-8 """ Tests for deepreg/model/backbone/global_net.py """ from typing import Tuple import pytest import tensorflow as tf from deepreg.model.backbone.global_net import AffineHead, GlobalNet def test_affine_head(): """ Test AffineHead. """ batch = 3 input_shape = (4, 5, 6) config ...
11a83631f95ac1962a2ce575f55415f018a4429df1f968667167c9ce21496262
Python
3,355
100
import nilearn import nilearn.regions import nilearn.reporting import itertools import plotly from scipy import ndimage import fire import sys sys.path.insert(0,'..') import pickle from nilearn import plotting from nilearn import surface from nilearn.glm.thresholding import threshold_stats_img import numpy as np ...
698da65dcb93914fb7f31f01463a9a2805d68d81390b9cab4660f8c5e662d8f0
Python
3,355
98
# -*- coding: utf-8 -*- """ Simulation study for EMPRISE fMRI data Joram Soch, MPI Leipzig <soch@cbs.mpg.de> 2023-07-03, 14:51: first version 2023-08-10, 14:45: generated new signals """ ### Step 1: specify settings ################################################## # import modules import EMPRISE import NumpRF imp...
649ea9957311774c5e63afc76961fafe4ba2df44cfadeeb5f21bd0769c25b596
Python
3,356
113
"""CTF Rest Dataset: TDE-DyNeMo for Dynamic Network Analysis. In this script we train a Time-Delay Embedded (TDE)-DyNeMo model on source reconstructed resting-state MEG data. The examples/toolbox_paper/ctf_rest/get_data.py script can be used to download the training data. Functions listed in the config are defined i...
83a8585f2d69407924bab562d8f50efc61ea8e55e070fa27b8a76fa5e202a49d
Python
3,356
94
#CMU Multimodal SDK, CMU Multimodal Model SDK #Multi-attention Recurrent Network for Human Communication Comprehension, Amir Zadeh, Paul Pu Liang, Soujanya Poria, Erik Cambria, Prateek Vij, Louis-Philippe Morency - https://arxiv.org/pdf/1802.00923.pdf #in_modalities: is a list of inputs from each modality - the first...
33eba9c80c800fc2312705bd4021d4a31f52501c0ab393beae9fba5a02896b7b
Python
3,357
120
from pathlib import Path import numpy as np import torch from eir.setup.input_setup_modules.setup_array import ArrayNormalizationStats def array_load_wrapper( data_pointer: Path | int, ) -> np.ndarray: assert isinstance(data_pointer, str | Path), data_pointer array_data = np.load(str(data_pointer)) ...
e602c1e0f4d98fbac9a5f26bc13746fe26fd4de64bca20832a6a0fdb2e0bc2e6
Python
3,357
85
# This file was automatically generated by SWIG (https://www.swig.org). # Version 4.3.1 # # Do not make changes to this file unless you know what you are doing - modify # the SWIG interface file instead. from sys import version_info as _swig_python_version_info # Import the low-level C/C++ module if __package__ or "."...
e201d4d9240f5ebab0787e2c16a5f91ec6250936c9689b749cda11e3c60b3c10
Python
3,358
91
"""Viewer servers owned by the GUI, one per bundle the user opens. The viewer is a local web server (:mod:`meanap.viewer.server`) that renders a bundle's figures on demand. Launching it from the GUI means the GUI owns its lifetime: the server must outlive the click that started it, must not be started twice for the sa...
581e4403145c2dc0457dc3b43f3d39231075d4a9e5d723e2693d740c9108448e
Python
3,359
105
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from .models import Event, EventGroup, WebhookTypeChoice from .utils import REQUEST_COMPLETION_RESOURCES def event_key(action: str, resource: str) -> str: return f"{action}:{resource}" class Events: _RESOURCES: dict[tuple[str, EventGroup...
6b72de435bd3fd75c141904576628f1fdafe4260489bd360cecfadf4e9402c81
Python
3,359
96
from __future__ import absolute_import from torchvision.transforms import * from PIL import Image import random import math import numpy as np class RectScale(object): def __init__(self, height, width, interpolation=Image.BILINEAR): self.height = height self.width = width self.interpolatio...
24d33f450d545ffb0c6764f6e77d301d014dd53c64e35bcff490f9366be34585
Python
3,360
73
import functools from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images from brainscore_vision.model_helpers.check_submission import check_models from brainscore_core.supported_data_standards.brainio.s3 import load_weight_file from brainscore_vision.models.mobilenet_v2_0_5_192.model impo...