sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
582292d89d36e8e12e00898352a1b62112cfb5033619e984762114d42e4693eb
Python
4,570
122
# Copyright 2018-2021 Xanadu Quantum Technologies Inc. # 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...
36fd2e4165a8878c90262042984724751818993e7585365a625faca0482797f3
Python
4,571
106
import os import sys from copy import deepcopy import torch.nn as nn import torch from evaluators.evaluator import Evaluator from datasets.scar import SCAR import datetime from tables.generate_token_counts import count_neural_tokens def neural_main(model_name, model_class, model_trainer, args): """ Moved the...
3e27f2fbd78b92bb1b00106a89463c6f4f22baad295e4fa20e4715cfd87650c6
Python
4,571
137
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jun 27 13:44:03 2023 @author: fm02 """ import numpy as np import pandas as pd import pickle import os import mne from mne.minimum_norm import read_inverse_operator import warnings warnings.filterwarnings('ignore') path = '/imaging/hauk/users/fm02/De...
3a41b1163124475f1333d15aef1086dc187f910271c4e70c2d9cc28ea877a114
Python
4,572
139
import pytest import torch from mrpro.operators import IdentityOp, MagnitudeOp, Operator, ZeroOp from mrpro.operators.LinearOperator import LinearOperatorSum from mrpro.utils import RandomGenerator from typing_extensions import assert_type from tests import ( dotproduct_adjointness_test, forward_mode_autodiff_...
69f223c69d42941c252d5f50f95b74ecb2b0b0c5240295310de0c2a867591e2b
Python
4,573
111
""" ========================================================= Compute SESAME inverse solution on high-density EEG data ========================================================= In the present example we shall show how to perform a source modeling analysis using SESAME as a standalone software. The data belongs to a r...
7232dc9f4033c457da53f8ccb7b7a61f36300d318f70b317cb6461d966566969
Python
4,574
87
from ..utils import PheWebError from ..file_utils import VariantFileReader, VariantFileWriter, get_filepath, get_pheno_filepath, with_chrom_idx, get_tmp_path, convert_VariantFile_to_IndexedVariantFile from .load_utils import parallelize_per_pheno, get_phenos_subset, get_phenolist import argparse, os from typing impor...
6c5e1364d9f04cdce0aee8624d94e02d3707883580545e92685c5e9ca9bfea3a
Python
4,575
173
# Copyright 2018-2021 Xanadu Quantum Technologies Inc. # 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...
0ac91689c8355475c12b234c1da66f4f01cebb14550d0446e9880843f94f1fd8
Python
4,578
133
import numpy as np import cv2 import torch import torchvision.transforms as T def normalise_adc(adc_image_in): """ Normalize an apparent diffusion coefficient (ADC) image. Parameters: - adc_image_in (numpy.ndarray): Input ADC image. Returns: - adc_image_out (numpy.ndarray): Normalized ADC ima...
30989c8bf6402dca859b0b7e40d1a902f4e1bd54538aaa2d603021fae68b6c07
Python
4,579
125
from __future__ import print_function import tensorflow as tf import numpy as np import copy npa = np.array class Synthesizer(object): def __init__(self, model, losses): self._graph = model.graph self._sess = model.sess self._image = model.image_ph self._losses = losses self._model = model ...
9ab13afa386ccfd4f0ff1a8acb3bbff8a43994d94400e2dd09d14c048616a18e
Python
4,579
145
import sys sys.path.append('.') from CommonSystem.Config import Config from EventController import EventController from tqdm import tqdm from psychopy import event, visual, core import os import time import math import numpy as np config = Config() config.addSTI = 'StimulationSystem/pics' config.addTG =...
a2d4ff710ade954a57f34e77244e8b8f35b3cb0a311d7b8d880e210efa59cf4b
Python
4,579
140
import torch import numpy as np class SequenceAccuracy(object): """Computes accuracy between two sequences. Inputs: pred (N, L, C) tgt (N, L) ignore_index (int): index of token to mask out """ def __init__(self, ignore_index=-100): self.ignore_index = ignore_index ...
8f31c9ce900331b2b6ca9aa8980566ee24cc1ec2b332d514e7472a301c8cb245
Python
4,581
121
#!/usr/bin/env python3 """ Description: Parallel SPIT parameter search using Python multiprocessing. Usage: ./run_SPIT_search_params_python.py -m <tx2gene_file> -j <num_jobs> -e <num_experiments> Author: Beril Erdogdu Date: September 2025 """ from multiprocessing import Pool, cpu_count from functools ...
711f6a84ee572cb1aabefe2bfd93f71e6fa1dce4638f74c24fa7a3116f5d2540
Python
4,584
138
import sys import math from scipy.stats import norm import numpy as np from .util import stderr def permutation_test(a, b, n_iter=10000, n_tails=2, mode='loss', agg='mean', nested=False, verbose=True): """ Perform a paired permutation test for significance. :param a: ``numpy`` array; first error/loss/pr...
51b8ebbbe14627032defa963b7b3dc807e8bd317b3df463004b32cada59e2118
Python
4,586
157
import numpy as np from numba import njit import math from kilosort.CCG import compute_CCG, CCG_metrics def count_elements(kk, iclust, my_clus, xtree): n1 = np.isin(iclust, my_clus[xtree[kk, 0]]).sum() n2 = np.isin(iclust, my_clus[xtree[kk, 1]]).sum() return n1, n2 def check_split(Xd, kk, xtree, iclust, m...
6469648b6668542850d5631b50c278dc9efc81d7f903a24e8079b2012167fddb
Python
4,586
115
import torch from torch.utils.data import Dataset import copy import random class PPODataset(Dataset): def __init__(self, batch_size, minibatch_size, is_discrete, is_rnn, device, seq_length, permute=False): if batch_size % minibatch_size != 0: raise ValueError("Batch size must be divisible by ...
f574b239640a982338db2e108dba723ee3ba172bd680912ad7b269dfb840d8b8
Python
4,586
171
import os from pathlib import Path import pandas as pd from nilearn.maskers import NiftiLabelsMasker, NiftiMapsMasker from sklearn.utils import Bunch ATLAS_METADATA = { "schaefer7networks": { "atlas": "Schaefer2018", "template": "MNI152NLin2009cAsym", "resolution": 2, "dimensio...
704d32df5a379fb040f533584058de0aee1541e26126ad8cef2e5d4b71c1fd17
Python
4,587
129
"""`RegressionExperiment` — the PyCaret 4.0 regression engine. Canonical import: from pycaret.tasks import RegressionExperiment # or (backward-compat): from pycaret.regression import RegressionExperiment Example ------- >>> from pycaret.datasets import get_data >>> from pycaret.tasks import RegressionEx...
deee4c05d46f068a3ac5c129c66e2721225339bd7b86cd62146e7b66dfe0855e
Python
4,587
116
from typing import Callable, Optional, Union import torch from torch import Tensor from torch_sparse import SparseTensor, matmul from torch_geometric.nn.conv import MessagePassing from torch_geometric.nn.dense.linear import Linear from torch_geometric.typing import Adj, OptPairTensor, OptTensor, Size from torch_geo...
2f60d62590272e5a02bc4901459d6542408160efd58046bbab4e8cbbc3e92e19
Python
4,590
128
##################################################################################################################### # Date created : 10/21/2022 # Date modified: 5/3/2023 # Purpose : This program reads and loads inputs data and passes them to the inference program ##############################################...
5ea4c50d8f57fe87baf162c8fa4eac1f7eda0bcadea7541d072f5b0585cef82d
Python
4,590
113
"""Tests for sliding windows.""" import pytest import torch from mrpro.utils import RandomGenerator from mrpro.utils.sliding_window import sliding_window def alternative_implementation(data, window_shape, axis, stride): """ Alternative implementation of sliding window for testing purposes. No error handl...
a5b9174caa8326e3f41bf11b423db2e2b1a9e726bd821905fde367e78a236857
Python
4,591
123
import datetime as dt import os from typing import List, Optional import ngs_tools as ngs from typing_extensions import Literal from . import config, constants, preprocessing from .logging import logger from .stats import Stats @logger.namespaced('consensus') def consensus( bam_path: str, gtf_path: str, ...
4780a53a5dd6afe00c54d859cac16aa2f85815071932504d076975afa46d2cf1
Python
4,602
133
import matplotlib # matplotlib.use('Agg') import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes from mpl_toolkits.axes_grid1.inset_locator import inset_axes import numpy as np import os import argparse import matplotlib as mpl label_size = 16 #mpl.rcParams['xtic...
8fc8af30584067220d1b1a23d9865ee82d29042150f6b2c7e987341f55d88b10
Python
4,602
126
import glob import os import parserix from cptools2 import utils def detect_plate_layout(plate_dir, ext=".tif", clean=True, truncate=True, sanitise=False): """ Detect whether a plate directory follows the old or new ImageXpress layout. Old layout (is_new_ix=False): plate_dir/*/*/*/*.tif (3 levels) ...
eb7fbf8c14578d34f594c0750501421459a77bd2b619edc3dc998710d71fc9f9
Python
4,605
151
import numpy as np from scipy.stats import norm def bw_nrd0(x: np.ndarray) -> float: x = np.asarray(x, dtype=float) x = x[np.isfinite(x)] n = x.size if n < 2: raise ValueError("Need at least 2 finite observations.") sd = np.std(x, ddof=1) q75, q25 = np.percentile(x, [75, 25], method="...
db60f31c3f360b176d722455bda14613a064a9ed352b87f172f474f39a22d758
Python
4,606
105
# # Python module to implement equivariant neural network # based on Clebsch-Gordan networks. This module uses linearity.py # and nonlinearity.py to implement the linear and nonlinear operations # of CG networks. Then it implements a dense layer at the end to # classify the scalar output of every layer in the CG netwo...
dbec3e3ca1bb7d600bb4d7b0cf4fa55841dd7790e0a4a3fd883d5c563c0b3fd3
Python
4,606
150
""" EA-compatible analogue to np.putmask """ from __future__ import annotations from typing import ( TYPE_CHECKING, Any, ) import numpy as np from pandas._libs import lib from pandas.core.dtypes.cast import infer_dtype_from from pandas.core.dtypes.common import is_list_like from pandas.core.arrays import ...
1714558e9c38a9ed8f87a9715a75fb4a9d310810a7615b7c6a104a3002c3e9ca
Python
4,609
117
# -*- coding: utf-8 -*- """Average Attention module.""" import torch import torch.nn as nn from onmt.modules.position_ffn import PositionwiseFeedForward from onmt.modules.position_ffn import ActivationFunction class AverageAttention(nn.Module): """ Average Attention module from "Accelerating Neural Tran...
7e0496fb7f69c7734d5646b919221b9d1caabb665c1c8b1306cf77aa9d4f6ec8
Python
4,610
117
import os import logging import argparse import numpy as np from .powderaverage.powderaverage import powder_average, save_data_as_npz from .models.nexi import Nexi from .models.parameters.acq_parameters import AcquisitionParameters from .models.parameters.save_parameters import save_estimations_as_nifti from .nls.nls i...
62451f3823ba9a3890b81015e0a39cdb8486a010e2ee9e5fdbf2eb1324eaea7d
Python
4,611
142
import numpy import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from sklearn.decomposition import PCA def updateColumnName(df, dictionary): allIndex = df.columns.values for i in range(len(allIndex)): if allIndex[i] in dictionary: allIndex[i] = dictionary[allIndex[i]] ...
7c741677308f9a95d0677a9544cf105ce22c5ad72406026455532e828cf93a7f
Python
4,613
128
# -*- coding: utf-8 -*- """ Created on Fri Oct 13 14:46:54 2023 @author: nrq2 """ ## ssh rachel@nostromo.ncl.ac.uk ## spyder-scenic-ad3 # cd /data/rachel/Linda_Lako/Retina/AD3/ATAC_analysis/SCENIC/ # conda activate scenicplus # python -m spyder_kernels.console # /home/rachel/.local/share/jupyter/runti...
ee364589faacd865e74573f4dd384c11108771bccf4649118665076c83c673d3
Python
4,616
144
""" 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. """ import argparse from pathlib import Path class Flags: def __init__(self): self.parser = argparse.ArgumentParser( de...
87e90b8edafced0e5f1effbbf42277a5471c46655fd8329f327d5fefc9f597df
Python
4,617
158
import pathlib from textwrap import dedent import tomllib import pytest import yaml from scripts.validate_min_versions_in_sync import ( get_operator_from, get_toml_map_from, get_versions_from_ci, get_yaml_map_from, pin_min_versions_to_yaml_file, ) DATA_PATH = pathlib.Path(__file__).parents[2] / "...
227a4cf8223f119d3543c340c86489254385b0ebd2fbe02ff104be67fc9d13b0
Python
4,619
160
import numpy as np import pytest import pandas as pd import pandas._testing as tm @pytest.fixture def ser(): return pd.Series([1, 2, 3], index=["x", "y", "z"]) @pytest.mark.parametrize( "mask", [ [False, True, True], np.array([False, True, True]), pd.array([False, True, True], d...
2d8b48a74b03ef7c5cf264c5b9b50b43d2dfe54f29daac3b4087913982545eb4
Python
4,619
121
"""Run under Windows CPython3.9 with the unchanged author pre.pyd. Usage: python generate_oracle.py SOURCE_DIR OUTPUT_DIR SOURCE_DIR contains pre.cp39-win_amd64.pyd, original model.bin, and extracted Conventional.txt (checksum checked). Only pickle.loads is substituted, providing an object with the same fitted estimat...
446af67ffd675fccb4fed238df991e961429b16d6a202d779803179c8090ad56
Python
4,619
169
# Copyright 2018-2026 Xanadu Quantum Technologies Inc. # 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 ...
d4a46c2a700edf36d4fe1f26da0a58d94525fc63cb6fa5e358ba958bf12fb2bf
Python
4,622
147
import csv import os import pytest from aigarmic.model import BinaryModel, BinaryNestedModel from aigarmic.plate import Plate from aigarmic._img_utils import get_image_paths from aigarmic.file_handlers import get_concentration_from_path from aigarmic.train import train_binary from aigarmic._nn_design import model_desi...
94daaee1c1a5ea2f9c84a5ed4c7f58071876603c9237297f964e60beb48dc24b
Python
4,623
115
import datetime class OperationState: def __init__(self): self.receiver_state = 'INIT' self.control_state = 'INIT' self.current_detect_state = 'INIT' class operationOperator: def __init__(self): self.messenager = None self.streaming = None ...
829be65eee8c4d248051a565acf2604a5405f9715017464bda82dfb423609043
Python
4,625
105
"""Tests for finite difference operator.""" from collections.abc import Sequence from typing import Literal import pytest import torch from einops import repeat from mrpro.operators import FiniteDifferenceOp from mrpro.utils import RandomGenerator from tests import ( dotproduct_adjointness_test, forward_mode...
5e509093bacb234dfe6919734044bc41a387b170508256707bc96d2517c6bafa
Python
4,627
166
""" collection of helper functions """ from __future__ import print_function, division, absolute_import import logging import os from glob import glob from collections import defaultdict import tables from .. import NcsFile, options logger = logging.getLogger(__name__) def check_sorted(channel_dirname): """ c...
b04c67b051d2283d0eba5a16c4bc9f93717b99f148b4fe959a0baa2a14611714
Python
4,627
119
"""Multi-discrete regression tests: masked path with heterogeneous head sizes (np.split chunked equally and mis-sliced e.g. [3,5,7] heads), batch-size-1 forward coverage, and the DiscretizeActions wrapper.""" import gymnasium as gym import numpy as np import pytest import torch from rl_games.algos_torch.model_builder...
ab655c472d9a1e576a232d7add9879204798fe1afbd588983e02437609751241
Python
4,629
130
import torch import numpy import bionetwork import plotting import pandas import argparse import seaborn as sns from scipy.stats import pearsonr import matplotlib.pyplot as plt from matplotlib.colors import LogNorm folder = 'figures/SI Figure 10/' #Get data number testCondtions = pandas.read_csv('synthNetTime/conditi...
b9fff2eea45fe506a00705518d9869085323655b3b53d736980ecf35b2fde3c7
Python
4,633
107
import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' import tensorflow as tf from tensorflow.keras import backend as K from tensorflow.keras.models import load_model from tf_explain.core.grad_cam import GradCAM from functions.OneDCNN_Utils import * from scipy.io import loadmat from sklearn.model_selection import Strati...
7c9a07cb7bbc6369c5e2deaa5095cc4b822658be0d95b5ecd2bda212727215de
Python
4,634
134
import os import pandas as pd from deepglyco.chem.common.elements import ElementCollection from deepglyco.chem.gpep.fragments import GlycanFragmentTypeCollection from deepglyco.chem.gpep.glycans import MonosaccharideCollection from deepglyco.chem.gpep.gpmass import GlycoPeptideMassCalculator from deepglyco.chem.pep.am...
2ff83e20fa6017fa94182778faec8b43c2f0931df363309f16bd5f69e555335c
Python
4,635
84
'''This module contains methods to compare the result of the SingleCellInputMapper to the neuronet population.''' import glob import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from ..IO.roberts_formats import read_InputMapper_summary from ..utils import select from ..analyze import excitatory, ...
45cf2be4d98726673783d4171ec92794a8d3c3dde157c82fc5a84200a25ea6a4
Python
4,635
116
import datetime import sys class OperationState: def __init__(self): self.receiver_state = 'INIT' self.control_state = 'INIT' self.current_detect_state = 'INIT' class operationOperator: def __init__(self): self.messenager = None self.streaming = ...
4688e872c3f50501fa7866e0bac6b0d28d6bdd64f9062e600198cfb4083353e2
Python
4,636
119
from datetime import timedelta import numpy as np import pytest from pandas.errors import OutOfBoundsTimedelta import pandas as pd import pandas._testing as tm from pandas.core.arrays import TimedeltaArray class TestTimedeltaArrayConstructor: def test_other_type_raises(self): msg = r"dtype bool cannot ...
e2051910334d95f4c97c8e2650f8e6ba4d3fc9073323aac2af53ba39a9469ab6
Python
4,636
143
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
01084385df95344ac1982ccc46c944ac7ea86fb4bdc116abd04e11c07a4ee292
Python
4,637
153
"""Unit test for parellel cooridnate-gathering routine""" import os import sys import numpy as np from pathlib import Path import h5py #import pyrosetta import logging import pytest import protein_holography from protein_holography.coordinates.get_structural_info import ( get_structural_info_from_dataset) from p...
6b9394c932f029986346ba473ea247d89b35600e530fb0807e19a64cf3eb7448
Python
4,638
155
# -*- coding: utf-8 -*- """ Created on Thu Mar 10 16:05:07 2022 This file contains convenience loading functions for different situations and analysis scenarios. However, this repository only contains the subset necessary for reproducing the manuscript results @author: Simon Kern """ import logging import numpy as n...
7614f80a67fbe2dbe7cc13a066dab1487bf6a9480a5c362a6a3700d3e49e8db1
Python
4,638
164
""" Run the base extension tests against an EA whose ``dtype.na_value`` is None. See GH#44602. """ from __future__ import annotations import decimal import functools import numpy as np import pytest from pandas.api.extensions import ( register_extension_dtype, take, ) from pandas.api.types import ( is_...
3494a69209cd37407e77954b30173fa04e041e6713d2de011423df53ecefe865
Python
4,642
166
"""Extract features for temporal action detection datasets""" import argparse import os import random import numpy as np import torch from timm.models import create_model from torchvision import transforms # NOTE: Do not comment `import models`, it is used to register models import models # noqa: F401 from dataset.l...
80c9f766bc4d22c130a88b88beaff228cb02e378c1b2f692b428ea28157608cc
Python
4,644
109
#!/usr/bin/env python3 """Derive a hybrid-type -> hydration (waters) lookup from somo.residue. Mattia's step 3: "We could potentially build a table of atom hybridizations from our somo.residue table linked to their hydration numbers. Based on this, for the new residue ... proposed atomic hydration are shown, to be int...
c1ed53089863e0e5d3d10e09a1df8227870861532fbe61d1c2210c656f40c2fc
Python
4,644
121
import numpy as np import matplotlib.pyplot as plt import sys import os from kcsd import sKCSD from kcsd import sKCSD_utils as utils import kcsd.validation.plotting_functions as pl import sKCSD_utils n_src = 512 R = 16e-6/2**.5 lambd = .1/((2*(2*np.pi)**3*R**2*n_src)) if __name__ == '__main__': fname_base = "Figure...
51ee9630a7dc8ccd49641a4baf87784b1183bb53577557d1d1e5b21fadeda0ff
Python
4,645
138
import numpy as np from scipy import stats from ._test import MantelResult try: import matplotlib.pyplot as plt from matplotlib.axes import Axes except ImportError: plt = None def plot( result, axis=None, alpha=0.05, hist_color="lightgray", gaussian_color="black", acceptance_color...
73254a3f0d6436361bf6b5e6d3f005e993a5fc0ab11012b197c6c13547a04066
Python
4,646
112
import os import numpy as np import torch import random from sklearn import metrics from torch.utils.data import DataLoader import torch import torch.nn as nn from sklearn.metrics import roc_auc_score, average_precision_score,accuracy_score from tqdm import tqdm from utils.graph_utils import collate_dgl, move_batch_to_...
2d60ea7187c4e4b99a562772c67ff26c06908715fe295a3f0a9e6050319a9a2e
Python
4,648
103
import numpy as np import pygalmesh from .curveExamples import Circle from .surfaceExamples import Sphere import loggingUtils from .meshes import Mesh, select_faces__ class TwoDiscs(Mesh): def __init__(self, largeRadius = 10., smallRadius = 4.5, targetSize=250): f = Circle(radius=largeRadius, targetSize=t...
5e6b8755134c124e489b3beb8ab2200037f54d4564c537a68b60b300d49d4fd0
Python
4,648
158
from __future__ import annotations import json import locale import os import platform import struct import sys from typing import TYPE_CHECKING from pandas.util._decorators import set_module if TYPE_CHECKING: from pandas._typing import JSONSerializable from pandas.compat._optional import ( VERSIONS, ge...
5fdd14209bd955dbd7ce975ba1774f073dc7c32038be732692e31db135c6519c
Python
4,649
176
""" Tests for the `deprecate_nonkeyword_arguments` decorator """ import inspect from pandas.errors import _CurrentDeprecationWarning from pandas.util._decorators import deprecate_nonkeyword_arguments import pandas._testing as tm WARNING_CATEGORY = _CurrentDeprecationWarning @deprecate_nonkeyword_arguments( WA...
bc0f64a62e1e2083e111c97e72e888dd79b2693344071bc9a75a2e64be97df5e
Python
4,650
145
""" Tests for plotting compatibility. """ from __future__ import annotations from typing import ( TYPE_CHECKING, Literal, ) if TYPE_CHECKING: from matplotlib import ( axes as maxes, axis as maxis, lines as mlines, ) from pandas.core.arrays import ExtensionArray import num...
46f1051437ce5789e66ab84710bf5ef182aea819724c3070006346dc73b38ad9
Python
4,655
158
import random import time from deepglyco.chem.common.elements import ElementCollection from deepglyco.chem.pep.aminoacids import AminoAcidCollection from deepglyco.chem.pep.mods import ModificationCollection, ModifiedSequenceParser from deepglyco.deeplib.pep.rt.data import PeptideRTDataConverter, PeptideRTDataset from...
98b0721e7cd82e448ffc91f9c793b7606e58bb74cb5371cfcb060e90b497ec45
Python
4,658
89
import pandas as pd import os import warnings from eLife_Grid_anchoring_2024 import analysis_settings from eLife_Grid_anchoring_2024.Helpers.array_manipulations import * warnings.filterwarnings("ignore") def add_shuffled_cutoffs(recordings_folder_to_process): recording_list = [f.path for f in os.scandir(recordin...
187fea317bce927c7b39fb91c2b1a1d0bef6cb20ce0f78d0bf162559d405274a
Python
4,660
153
import decimal import warnings import numpy as np import pytest from pandas.core.dtypes.cast import ( maybe_downcast_numeric, maybe_downcast_to_dtype, ) import pandas as pd import pandas._testing as tm @pytest.mark.parametrize( "arr,dtype,expected", [ ( # This is a judgement cal...
0994afb9b61b6d80ca4d08e874e0c44404c3e44ccb2fd8a5aa8450df9d53fe3a
Python
4,662
125
# -*- coding: utf-8 -*- """ Created on Thu Dec 16 17:09:27 2021 @author: Daniel Hulsey this script aligns a ccf to an individual session, and extracts dff data for each indicated region. Running it fully requires: 1. saved dff trace for the session being analyzed 2. saved points to align CCF to multim...
c8ab85558f5fc5bf26ba81d7815535b61723ff4e0e5f08dfbc2e3b59eeef7efc
Python
4,663
137
import numpy as np import pytest import pandas as pd import pandas._testing as tm def test_isin_nan(): idx = pd.MultiIndex.from_arrays([["foo", "bar"], [1.0, np.nan]]) tm.assert_numpy_array_equal(idx.isin([("bar", np.nan)]), np.array([False, True])) tm.assert_numpy_array_equal( idx.isin([("bar", ...
cf9425969f271c1a20acd63cb07dd5c3b6337d7a193886f5b01da1314566bcbc
Python
4,663
139
from typing import Optional import torch import torch.nn.functional as F from torch import nn, Tensor from .functional import label_smoothed_nll_loss class SoftBCEWithLogitsLoss(nn.Module): """ Drop-in replacement for nn.BCEWithLogitsLoss with few additions: - Support of ignore_index value - ...
7513f39fe0885f4ab9340637310f9c0c9d7c757d9ce48f30c78e3bb5d00251ef
Python
4,664
139
# -*- coding: utf-8 -*- """ Created on Thu Dec 17 13:14:28 2020 @author: derek.bickhart-adm """ import matplotlib from matplotlib import pyplot as plt matplotlib.use('Agg') from matplotlib.collections import BrokenBarHCollection from matplotlib import cm from itertools import cycle from collections import defaultdict...
35392806cadbf268771399eab9437a4aa33497b3968f0a2ffedee2ea413a02ea
Python
4,665
99
import os import numpy as np from draw import draw_angle_stimulus from result_plotter import ResultPlotter from utils import mkdir_experiment_setup, Observable, downsample_data from network import AngleSpatialConnectivity, RandomClusterConnectivity from model import IzhikevichKorndoerfer from image_preprocessor import...
5a97c45d2d415ecc461929349e6fcb7569b3b407e9ac00c2d51127f565a6ddba
Python
4,667
115
import torch.nn as nn import math import torch.utils.model_zoo as model_zoo import torch import torch.nn.functional as F class Bottle2neck(nn.Module): expansion = 4 def __init__(self, inplanes, planes, stride=1, downsample=None, baseWidth=26, scale = 4, stype='normal'): super(Bottle2neck, se...
ba63210194a093ed39f381875836d7f4b9c669a2ad4194c875a68ad38a973984
Python
4,668
143
# ------------------------------------------------------------------------------------------------------------------------------------- # Following code curated for GCPNet (https://github.com/BioinfoMachineLearning/GCPNet): # ----------------------------------------------------------------------------------------------...
fa0334bf51b26484228cbde465410edce5384a8b12ffab63fa7e7a7be4571800
Python
4,669
95
#!/opt/local/bin/python2.7 from os import path import argparse from Common.kernelFunctions import * from affineRegistration import * from Surfaces.surfaceMatching import * def main(): parser = argparse.ArgumentParser(description='runs surface matching registration and exports labels from subregions') parser.a...
0fd71ad866ed055722cc95630a3d5dea19ac234b675601a462ebd45180a89a9d
Python
4,670
147
## Works the best so far! Curve fits nicely and ymin/ymax don't have to be 0 and 1! import matplotlib.pyplot as plt import numpy as np import pandas as pd from scipy.optimize import curve_fit import sys import matplotlib.ticker as ticker import matplotlib.transforms as transforms from pathlib import Path from statisti...
2a0fe31879973babbe98a7e27c0f8645f75037d4526e16f37e8df0b8f93fcf7a
Python
4,671
115
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Dec 2 21:24:41 2021 Script to prune the original set of brain imaging files from PPMI to select those that will be uploaded to the cloud. Two steps are applied: 1. Get rid of entire sessions which had corrupted or missing files (DTI and resting...
3dc4882814c6daffeccf150f9c5f9fe59c68fbeed270af0f76643c9fa903de70
Python
4,673
107
#! /usr/bin/env python ############################################################################## ## DendroPy Phylogenetic Computing Library. ## ## Copyright 2010-2015 Jeet Sukumaran and Mark T. Holder. ## All rights reserved. ## ## See "LICENSE.rst" for terms and conditions of usage. ## ## If you use this wo...
e3a4a7ebfe9f3b03bfad635e8e63559e46193825ebbf0fad42ea12b0fc580cde
Python
4,674
121
import sys import argparse from Bio import SeqIO, BiopythonWarning, BiopythonParserWarning import sys import re import random import statistics import warnings def clean_name_func(name): """ converts all: " " (space), ";" (semicolon), ":" (colon), "," (comma), "()" (parentheses), "'" (quote) charact...
8782007a7a8d193e8408a559ab8850536660208b49db83704b94701678809b5c
Python
4,675
95
import argparse import pandas as pd import seaborn as sns import matplotlib.pyplot as plt def get_args(): """ Get arguments from command line with argparse. """ parser = argparse.ArgumentParser( prog='Plot-Main.py', description="""Make informative figures from pre- and post-filtered bin...
c3cf6d5007b46f391cae3f6cc4fedbbd26992eb2bdb79ac8bb203eafa808cce7
Python
4,675
150
""" Tests for the following offsets: - Easter """ from __future__ import annotations from datetime import datetime from dateutil.easter import ( EASTER_ORTHODOX, EASTER_WESTERN, ) import pytest from pandas.tests.tseries.offsets.common import assert_offset_equal from pandas.tseries.offsets import Easter c...
f2372287bd10cdc1954259fde7ff0b3971c17c2b9608090e8a4a149b767e2a82
Python
4,675
124
import torch from torchvision import datasets, transforms from tnn.layers import Permute, View, LinearLayer, tLinearLayer from tnn.networks import FullyConnected # from tnn.training.batch_train import train from autoencoder_batch_train import train from tnn.utils import seed_everything, number_network_weights, get_logg...
edb3285db1cb3c23e8dd3041f3fef593de081b9ca2964512d8354b95fe5090dc
Python
4,676
123
import os import numpy as np from sdna.net.functional import utils class BitEncodeStream(object): def __init__(self, inp_, outp_, blocksize, index_size): self.input = inp_ self.output = outp_ self.blocksize = blocksize self.index_size = index_size self.padding = self.get_p...
89d86a78c23ca9fa3cf06c7560262a16bfcb60e1e63ff5a9422ef30bdf765a93
Python
4,677
126
import sys import re import numpy as np import pandas as pd import librosa import argparse argparser = argparse.ArgumentParser(''' Utility for computing sound power metrics from the Natural Stories audio stimuli ''') argparser.add_argument('files', nargs='+', help='Paths to audio files for processing') argpars...
4ce100af265be057e59bbc250f0a97c0d618657d67167eb4d25875c59c11c775
Python
4,679
160
from abc import ABC, abstractmethod from typing import Optional, Type, Union import tqdm.notebook import tqdm.std from pycaret.internal.display.display_backend import ( DatabricksBackend, DisplayBackend, JupyterBackend, ) from pycaret.internal.display.display_component import DisplayComponent class Prog...
7f1e15bb1490f9f81664448044cac27fa2cb436cb310fa33cac45057f865d30c
Python
4,679
152
"""Superuser-only admin routes. Routes (mounted under ``/api/v1``): GET /admin/users list all users (superuser-only) PATCH /admin/users/{id} toggle is_superuser / is_active These are the cross-workspace controls — anything scoped to a single workspace lives under ``/workspaces/{id}/...`` (see memb...
01b51a643cb52a5f6b4d6fa332fc26025d2f5567a320390f296bd5ddb1bc0f26
Python
4,681
153
from typing import Iterable import numpy as np import pandas as pd from scipy.spatial.distance import squareform, pdist from sequence_models.constants import STOP, START, MASK, PAD from sequence_models.constants import PROTEIN_ALPHABET def warmup(n_warmup_steps): def get_lr(step): return min((step + 1) ...
5a884a19d3fa3ac7910b3a33af62428477c7d04e3f42ff8d68daeff2c0ab5482
Python
4,681
182
import matplotlib.pyplot as plt import matplotlib from matplotlib.colors import LinearSegmentedColormap import numpy as np import matplotlib.ticker as ticker import pandas as pd import seaborn as sns; sns.set() from statistics import mean, stdev import matplotlib.transforms as transforms import matplotlib.font_manager ...
7ac72c93e6f4b8d4812dec6f56922c690056f208f839c136197e9ef3f8d1be7d
Python
4,682
144
# Configuration file for the Sphinx documentation builder import os import sys sys.path.insert(0, os.path.abspath("..")) # Project information project = "PCNToolkit" copyright = "2025, Andre Marquand" author = "Andre Marquand" release = "1.0.0" # Extensions extensions = [ "autoapi.extension", "sphinx.ext.aut...
31a0f511a62de52aac90c8b4368efc240cfd608b8935ea67b9405743f095037d
Python
4,683
107
""" Display (and eventually generate) a set of correlated phenotypes as generated from an external pipeline This information will be shown on phenotype summary pages. This is an OPTIONAL feature- if information is not available, it will usually skip this step without failure. """ import logging import os from bolt...
a8262c2f032472d316f101cb3c0551c9ba699b9f03c71d003a7ba1366834717c
Python
4,683
101
"""Tests for DirectReconstruction.""" import pytest import torch from mrpro.algorithms.reconstruction import DirectReconstruction from mrpro.data import CsmData, DcfData, KData from mrpro.operators import DensityCompensationOp, FourierOp def test_direct_reconstruction_automatic(cartesian_kdata: KData) -> None: "...
352347975b9f2da9e8652e61997dee8067e57724d0f1b0aea2a178483a2fc4ba
Python
4,685
127
# -*- coding: utf-8 -*- # Copyright (C) 2019 Andrea Vázquez Varela # 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, either version 3 of the License, or # (at your option) any later version. #...
e355925a7ebe1579c0f6faeb8973784981fd80bbb03ca7a2c269c733c857e9aa
Python
4,685
153
import numpy as np from numpy import linalg as LA from typing import Dict, List, Tuple def trace(img_dict: Dict[str, np.ndarray]) -> Tuple[np.ndarray, np.ndarray]: """ Compute the trace of the diffusion tensor at b-value 50 and 1000. Parameters ---------- img_dict : dict A dictionary conta...
e5efa0882676aa6edf5f97029a16d15c2d2b914d2d554dd93815958ac868bac6
Python
4,686
104
import pandas as pd from rdkit.Chem import PandasTools import torch from pytorch_classes_and_functions import AmesDataset, DNN from captum.attr import LayerIntegratedGradients from local_evaluation_functions import attribution_auc, get_attribution_for_hidden_layer from helper_functions import string_to_int_list,d...
bf985e804a926826ad701a5bdb4066adcc91ebd7ac40883b5ddc6edcd2724251
Python
4,690
121
import logging import numpy as np from pathlib import Path from time import time from typing import Dict, Tuple import xml.etree.ElementTree as etree from fastmri_prostate.reconstruction.dwi.regridding import trapezoidal_regridding from fastmri_prostate.reconstruction.dwi.diffusion_metrics import compute_trace_adc_b15...
f6d4ffb8c84868389969758e2e1d0361406cf8d1b639683ffc51457f5da18adf
Python
4,692
112
"""Methods for encoding text into brain maps.""" import numpy as np from nilearn.masking import unmask from sklearn.feature_extraction.text import CountVectorizer from nimare import references from nimare.decode.utils import weight_priors from nimare.due import due @due.dcite(references.GCLDA_DECODING, description="...
a97a9bac57cdda965ba72a06fba2811b3772935b888a9714961e752ffc172281
Python
4,693
87
import pandas as pd import os import warnings import matplotlib.pylab as plt from eLife_Grid_anchoring_2024.Helpers.array_manipulations import * warnings.filterwarnings("ignore") def plot_field_shuffle_false_assay(recordings_folder_to_process): recording_list = [f.path for f in os.scandir(recordings_folder_to_pr...
d8a3249f5361acea089b83f68032a891dba88544ca5cd61cc8a4dc11b2dc495e
Python
4,693
120
""" Creates CA1 pyramidal cell model, sets parameters, runs simulation in NEURON and shows figures. Title: main_TBS_SLM.py Author: Matus Tomko Mail: matus.tomko __at__ savba.sk """ import libcell as lb from neuron import h, gui from CA1_plasticity.io.figures_shower import FiguresShower from CA1_plasticity.io.io_helper...
e2d1e13e722a3b68bf31cb3f0f868f5848e324165876a25308c683b9d9cd16fb
Python
4,694
208
import numpy as np import cv2 import os from os import listdir, makedirs from os.path import join from PIL import Image import shutil import sys import logging def crop_numpy(dim1, dim2, dim3, vol): return vol[ dim1 : vol.shape[0] - dim1, dim2 : vol.shape[1] - dim2, dim3 : vol.shape[2] - d...
2713a4a719804d39321ed827dbfd0d270d7b1f06797b3e2c1f7f1758c44b30b2
Python
4,696
113
# -*- coding: utf-8 -*- """ Created on Thu Jul 18 16:39:53 2019 @author: Wladek """ import scipy.stats as st import os import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from figure_properties import * def set_axis(ax, x, y, letter=None): ax.text(x, y, ...
07bf796ed7319dab986243e74c430576ee3e780ede1e8d5fa620aebc1b0a5e6f
Python
4,699
143
"""Authentication routes: login, refresh, logout, me.""" from __future__ import annotations from datetime import UTC, datetime from typing import Annotated from fastapi import APIRouter, Depends, HTTPException, status from sqlalchemy import select from sqlalchemy.orm import Session from pycaret_server.api.schemas i...
edba25a6b2488af10986fe7782e0ca248211c6fd2a21cdaa0065db36081c18c9
Python
4,699
129
import os os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3" import math import numpy as np import tensorflow as tf from tensorflow.keras import layers import logging tf.get_logger().setLevel(logging.ERROR) class Envelope(layers.Layer): """ Envelope function that ensures a smooth cutoff """ def __init__(self...
a3562272bfc3d44caa6f946e0fa8e302389821eabce5a25d2be85194052157d9
Python
4,700
133
# Copyright 2018-2021 Xanadu Quantum Technologies Inc. # 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...
1ba4d1941e891617685d8ae7b17e16450cec6a5b34d9d5b61438dd1c00f14c81
Python
4,702
137
import os from functools import cached_property, cache from typing import Tuple from pandas import DataFrame, read_parquet import numpy as np import torch import zarr from tifffile import imread, TiffFile from torch.utils.data import Dataset class CustomDataset(Dataset): def __init__(self, config: dict): ...
61da39409d8923556259ee8109baad157d45a2e1e0d2429aa99bf7b8375538c0
Python
4,702
192
from __future__ import annotations from typing import ( TYPE_CHECKING, Any, ClassVar, ) import numpy as np from pandas.util._decorators import set_module from pandas.core.dtypes.base import register_extension_dtype from pandas.core.dtypes.common import is_float_dtype from pandas.core.arrays.numeric imp...