sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
e284a6a273401c36bc231978f07eac6093ae19283089f28ac421ca84a25ee7b1
Python
3,090
116
import tensorflow as tf import os import nibabel as nib import numpy as np import random import re from skimage.transform import resize from pathlib import Path from const import * def int64_feature(value): return tf.train.Feature(int64_list=tf.train.Int64List(value=[value])) def int64_list_feature(value): ...
f8fcb134952d26c94dfcb6042a9857b9e81010c0b4bc6a2756b4ba3277a610a5
Python
3,092
58
############################################################################### # This script execute an automated search of all possible combinations of two # # sets of terms. The search is done in scopus. The script retrieves all scopus# # results and store them in json files. The search can be updated by changing # ...
fde19bab4102159fe3c782377afc59a8615aa10bbd520a0b4b8c77d1194d8496
Python
3,094
101
""" Tests that work on both the Python and C engines but do not have a specific classification into the other test modules. """ from io import StringIO import pytest import pandas as pd import pandas._testing as tm @pytest.mark.parametrize( "data,thousands,decimal", [ ( """A|B|C 1|2,334...
170c73a4cbed88e2161b63cd9e40b29d4c04c2dc9134772f2f240c7e0eef7cb6
Python
3,095
105
""" Implementation of DataFrame.filter and Series.filter with a boolean mask. """ from __future__ import annotations from typing import ( TYPE_CHECKING, Any, Literal, ) import numpy as np from pandas._libs import lib from pandas.core.dtypes.common import is_bool_dtype from pandas.core.dtypes.generic im...
d20e9ded96cdcb3d84172c18ef7099b8dcc4bb0ef15a28cff688398845382cf4
Python
3,095
106
""" paq2py Read PAQ file (from PackIO) into python Lloyd Russell 2015 """ import numpy as np def paq_read(file_path=None, plot=False): """ Read PAQ file (from PackIO) into python Lloyd Russell 2015 Parameters ========== file_path : str, optional full path to file to read in. if none i...
398980b5b97a91812ef3d9c8a27cec7c43cfa84c08562767bb10d182e97d2f9a
Python
3,096
90
# coding: utf-8 """Implementation of the 'qc' command. """ import logging from atropos.commands.base import ( BaseCommandRunner, Pipeline, SingleEndPipelineMixin, PairedEndPipelineMixin) from atropos.commands.stats import ( SingleEndReadStatistics, PairedEndReadStatistics) from atropos.util import run_interrupt...
8b66574e2df69953e1ec9ed9f7d71472c861e0901c98cd3557cea519d9cbf8f0
Python
3,096
52
#! /usr/bin/env python import argparse import os import pandas as pd parser = argparse.ArgumentParser(description='Output a BED file of the final ORF ratings generated by rate_regression_output.py') parser.add_argument('--inbed', default='transcripts.bed', help='Transcriptome BED-file (Default: transcripts.bed)') par...
117e329e74ce45f3b2fc5add011a7e8b087f123f63d985225901039fa2e88abd
Python
3,097
79
# Copyright 2025 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 agre...
4be5aa7d60d5a13c5f30d1adb29028f96458370a953f2c92e8dbacd4d84c3c44
Python
3,097
96
import pytest from pandas.errors import Pandas4Warning import pandas as pd import pandas._testing as tm @pytest.mark.parametrize( "meth, kwargs", [ ("truncate", {}), ("tz_convert", {"tz": "UTC"}), ("tz_localize", {"tz": "UTC"}), ("infer_objects", {}), ("astype", {"dty...
01d6496880dc14f0b5722e00a97d942dc9e828376a855a1a0e46819114c5108e
Python
3,098
100
import numpy as np import pytest from pandas._libs.parsers import ( _maybe_upcast, na_values, ) import pandas as pd import pandas._testing as tm from pandas.core.arrays import ( ArrowStringArray, BooleanArray, FloatingArray, IntegerArray, ) def test_maybe_upcast(any_real_numpy_dtype): # ...
19fd5d1d8570ecda263ced4e7cd0a5361b16053f87cb89b10d5863d728d13ad2
Python
3,098
53
import torch from torchvision import datasets, transforms import argparse def setup_cifar10(n_train=40000, n_val=10000, n_test=10000, batch_size=32, data_dir='data'): transform = transforms.Compose( [transforms.ToTensor(), transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))]) train_datase...
a1c6b0dbff955a5bfbc8b9f327ea2e5ca260efa487fa75ade67514a69cb4abdb
Python
3,098
91
from datetime import date import numpy as np import pytest from pandas.errors import Pandas4Warning import pandas as pd import pandas._testing as tm class TestAstype: def test_astype(self): ci = pd.CategoricalIndex(list("aabbca"), categories=list("cab"), ordered=False) result = ci.astype(objec...
5dc48d1871b1fdf5c2a846f7333d432a0b62b176478d89d07da818d60a94e551
Python
3,099
89
# 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...
cebc145e51a623de5de72d2309198ea8e9efff9c6f3f09c9490fb8aa8cd72d66
Python
3,099
113
# -*- coding: utf-8 -*- """ Created on Mon Nov 9 17:31:36 2020 Port of MATLAB function sequenceness_crosscorr.m @author: Simon Kern """ import numpy as np from numba import njit def _corrcoef(*args, **kwargs): try: # try jax implementation, magnitudes faster import jax jax.config.update("jax_...
91dc06d9c131ec83ab91be1584c1cfc60863bee57568359cdffca0aa4ef13223
Python
3,100
114
import numpy as np def cartesian_to_spherical(r: np.ndarray) -> np.ndarray: """ Convert Cartesian coordinates to spherical coorindates. Parameters ---------- r : numpy.ndarray Array of Cartesian coordinates x, y, z. Returns ------- np.ndarray Array of spherical coordin...
005c8087d1a905c5312bce19c16b2fe31f523991e8be838f7a8edffebdf0abe1
Python
3,102
101
#MIT License # #Copyright (c) 2019 Iñigo Prada Luengo # #Permission is hereby granted, free of charge, to any person obtaining a copy #of this software and associated documentation files (the "Software"), to deal #in the Software without restriction, including without limitation the rights #to use, copy, modify, merge,...
536c6ac8d609372aeb05637b201d0f0bb16869710e1adc0ad59b6e0b41a0565b
Python
3,102
90
__all__ = ["PeptideMS2Predictor"] import itertools import os from logging import Logger from typing import Any, Iterable, List, Mapping, Optional, Union import pandas as pd import torch from ....speclib.pep.spec import PeptideMS2Spectrum from ....util.progress import ProgressFactoryProto from ...common.prediction im...
5579f73f495ad9a58eb94e092915f56531a810cde7390e3e59c08bb5c8585550
Python
3,102
128
# %% from pathlib import Path import pandas as pd from julearn.model_selection import RepeatedContinuousStratifiedKFold from julearn.pipeline import PipelineCreator from julearn.utils import configure_logging from sklearn.gaussian_process.kernels import RBF # Needs to install skrvm # pip install https://github.com/Ja...
9c6f1c48813a5bdc8b9cb8fe862e2bd18de09b78db38cac0b01a51f064a3467f
Python
3,103
96
import numpy as np import pandas as pd import pandas._testing as tm class TestValueCounts: # GH#7735 def test_value_counts_unique_datetimeindex(self, tz_naive_fixture): tz = tz_naive_fixture orig = pd.date_range("2011-01-01 09:00", freq="h", periods=10, tz=tz) self._check_value_count...
374be61817b6728a79e662e0c13b2cfd5cc81a40d8256ab3da0cc6cdd52634e6
Python
3,105
70
"""Inati method for coil sensitivity map calculation.""" import torch from einops import einsum from mrpro.data.SpatialDimension import SpatialDimension from mrpro.utils.sliding_window import sliding_window def inati( coil_img: torch.Tensor, smoothing_width: SpatialDimension[int] | int, ) -> torch.Tensor: ...
82a9223f79e80bb6128b237f21a0cdd2ce1fdf8a23c2cbd963434a97e6f7bffc
Python
3,105
80
import tensorflow as tf def network1(config, n_celltypes, n_features, training=False): """ Creates network from config file (config), number of celltypes (n_celltypes) """ model = tf.keras.Sequential() for l in range(config["n_hidden_layers"]): # model.add(tf.keras.layers.Dense(config["hid...
b3fd00a5958a4160ebed7088dddeed7c54313ce5c931ba2ff17d5df56f2fa55f
Python
3,105
75
import pathlib import importlib.resources import numpy as np from PyQt6 import QtCore, QtWidgets class KeyValueTableWidget(QtWidgets.QTableWidget): def __init__(self, *args, **kwargs): """A table widgets with two columns for key-value visualization""" super(KeyValueTableWidget, self).__init__(*ar...
d853f53e91287cb3c0d54ea3d96c8720ff4671070c282083bc4a2ae894fe153e
Python
3,106
115
import numpy as np class NeuroScanMessage(): def __init__(self) -> None: # 初始化,定义各种请求类型 self.initial() def initial(self): # infoType self.InfoType = dict( InfoType_Version = 1, InfoType_BasicInfo = 2, InfoType_ChannelInfo = 4...
a004918405fdd200f4aba0cde05486a9dbe7ef88d178190aabd8e53bdb04584d
Python
3,116
65
from botocore.client import Config import ibm_boto3 import os import sys from pathlib import Path # from shutil import copyfile # from tqdm import tqdm # import tensorflow as tf sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__fi...
37207a9a3f582759e92f1c5a5b02aec7367a557d09756e99059b1848aae623e9
Python
3,118
96
"""Radial phase encoding (RPE) trajectory class with sunflower pattern.""" import numpy as np import torch from mrpro.data.KTrajectory import KTrajectory from mrpro.data.traj_calculators.KTrajectoryCalculator import KTrajectoryCalculator from mrpro.utils.reshape import unsqueeze_tensors_left GOLDEN_RATIO = 0.5 * (5*...
bc970637174ab25f62688be16201c4ff11b469301733daffb24d55e99b4bb5c2
Python
3,119
78
"""Regression tests for the 2.0 release-blocker batch (silent-wrong-behavior class): seed 0, legacy seq_len, SAC multi_gpu guard, adaptive-LR resume.""" import copy import numpy as np import pytest import torch from rl_games.torch_runner import Runner from tests.test_critical_fixes import (_load_params, CARTPOLE_YAM...
78b1915926d9bd8a36fdf9ac2a8112b79e232c400e0f294fac38aa140decfa8a
Python
3,120
111
# py3 import sys import os import pysam import pybedtools from pybedtools import BedTool #print len(sys.argv) if len(sys.argv) != 5: sys.exit('Usage: python sc_atac_readcounter.py [Input Bam file] [Input Index table (NA if no table)] [peak BED] [Output file]') inputbam = sys.argv[1] indextable = sys.argv[2] type1bed...
f3dac8b2b5fe70a70853084656aa3ecd24770cab76d65f3801f0ea2c2509e729
Python
3,120
132
""" This script demonstrates * the rationale of locally low rank regularization for DWIs. Author: Zhengguo Tan <zhengguo.tan@gmail.com> """ import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Circle, Rectangle import sigpy as sp from sigpy import linop, util import h5py import os DIR...
370007db7651e32e810ffe76ee4cd2b64952d581ffa0d829f92097903666cb1a
Python
3,121
91
"""support pyarrow compatibility across versions""" from __future__ import annotations import sys from typing import Any from pandas.util.version import Version PYARROW_MIN_VERSION = "16.0.0" try: import pyarrow as pa _palv = Version(Version(pa.__version__).base_version) pa_version_under17p0 = _palv < ...
961409734f0d827cf4efcacf000120809d63e8e63d5c3372ffa45cf61fc3a42b
Python
3,122
74
from training import * from training.label_processor import process_labels from utilities.utilities import * if __name__ == "__main__": data_create = sys.argv[1] add_suffix = sys.argv[2] normal = sys.argv[3] == "True" nb_examples = None if len(sys.argv) > 4: nb_examples = int(sys.argv[4])...
d53903c593e780e3e1d9387bcd9bb262bed664d095e55b4bd2b9b7e9a55411b7
Python
3,122
90
import json import os import struct import sys import traceback import urllib.request from dclab.external.packaging import parse as parse_version from PyQt6 import QtCore class UpdateWorker(QtCore.QObject): finished = QtCore.pyqtSignal() data_ready = QtCore.pyqtSignal(dict) @QtCore.pyqtSlot(str, str) ...
d5e9c3b45177794cc79e032fc0ddf285d55fca69228a3684e1bd45c03aa6ad06
Python
3,123
107
import os import random import numpy as np import pandas as pd import tensorflow as tf from sklearn.metrics import mean_squared_error as mse def rmse_fn(x, y): return mse(x, y, squared=False) def pcor(x, y): return np.corrcoef(x, y)[0][1] def ccc_fn(y_true, y_pred): cor = np.corrcoef(y_true, y_pred)[0...
b118da0b8c0f65eb482ddc1577c8a48428dbf2734da21efbf4c821d610c8460b
Python
3,124
43
import numpy as np np.random.seed(26) import os, torch basedir = os.path.abspath(os.path.dirname(__file__)) os.chdir(basedir) file_path = os.path.abspath(os.path.join(basedir, 'literature_data')) data_path = os.path.abspath(os.path.join(basedir, 'data')) # 1. drug_disease drug_disease_co = torch.Tensor(np.loadtxt(os...
6c823ef9f7098830f805309b679324c0c5ff4de326be7320fa75b352e9575287
Python
3,125
98
""" 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 logging import os from ocpmodels.common.registry import registry from ocpmodels.trainers.forces_trainer import ForcesTrainer class ...
465688bbfcf2af433d875c42fb1113069120c258c669b026ae0762ef0feea8f0
Python
3,126
116
""" Tests that work on both the Python and C engines but do not have a specific classification into the other test modules. """ import csv from io import StringIO import pytest import pandas as pd import pandas._testing as tm from pandas.io.parsers import TextParser xfail_pyarrow = pytest.mark.usefixtures("pyarrow...
8f402cfa54d2035a6654b433ab24cba481109dbd9a1a2893795581afe28826b4
Python
3,129
72
"""Tests the conjugate gradient operator.""" import torch from mrpro.operators import ConjugateGradientOp, EinsumOp, LinearOperatorMatrix from mrpro.utils import RandomGenerator def random_linearop(size: tuple[int, int], rng: RandomGenerator): """Create a random LinearOperator.""" return EinsumOp(rng.complex...
914c6fb78fa5d5aa9d9dcfdceb03c220cfa95c928d3f0e64d1f7fdc3377efc6b
Python
3,129
86
from datetime import ( datetime, timedelta, ) import pytest from pandas._libs.tslibs.timezones import dateutil_gettz as gettz import pandas.util._test_decorators as td import pandas as pd import pandas._testing as tm class TestTimestampToPyDatetime: def test_to_pydatetime_fold(self): # GH#45087...
75f804c87065b7d3964b9c09a791e8b57610036f9657b6b5f641c852c795ac18
Python
3,131
52
from botocore.client import Config import ibm_boto3 # import types import os import sys import pdb import pandas as pd import numpy as np import pickle sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))) from ...
fbcd3bef950d0d7bc6aa65f96b03b76b3e67e9378d68fee20b810b8f87beca18
Python
3,131
95
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 config = Config() config.addSTI = 'StimulationSystem/pics' config.addTG = 'StimulationSystem/target/green_...
f50196dc63c6c78cd6cd37e1d84adaef1a30090ec910ffa8b08d99eb9aa7348c
Python
3,132
94
import operator import numpy as np import pytest import pandas as pd import pandas._testing as tm class TestMatMul: def test_matmul(self): # matmul test is for GH#10259 a = pd.DataFrame( np.random.default_rng(2).standard_normal((3, 4)), index=["a", "b", "c"], ...
85d746a3f5192c4e5dd0c12b2aee2c59e815ff9a93025aa0a8a4402933b787bf
Python
3,133
100
from tests import TestCaseNeSVoR from nesvor.svr.registration import VolumeToVolumeRegistration from nesvor.image import Volume from nesvor.transform import RigidTransform from tests.phantom3d import phantom3d from nesvor.utils import ncc_loss import torch class TestVVR(TestCaseNeSVoR): @staticmethod def get_...
890b2d1d010b45c3043a21e0ed2bf646a397ebc37101cfe07dcab4df79784d55
Python
3,133
91
import os import numpy as np np.seterr(all="raise") from deepglyco.speclib.common.combine import NonRedundantSpectraConsensus from deepglyco.speclib.gpep.filter import GlycoPeptideSpectrumFilter from deepglyco.speclib.gpep.hdf import GlycoPeptideSpectralLibraryHdf from deepglyco.speclib.gpep.inmemory import GlycoPe...
0d88d89a1571303626a7147d6409b6bc6ff42404834c76bae11bdbc3de2c3cd7
Python
3,139
89
"""Module for build dynamic fields.""" from collections import Counter, defaultdict import torch from onmt.utils.logging import logger from onmt.utils.misc import check_path from onmt.inputters.inputter import get_fields, _load_vocab, \ _build_fields_vocab def _get_dynamic_fields(opts): # NOTE: not support tg...
277b2f4fb0768cfb058ce63e96e069a25af1604a0786a0195fa902de47af671f
Python
3,139
99
# Copyright 2020 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
b3ffbbfdb10ddcea93c2f41e592579e8b344b5b4449fbed04932f7ec6598e96f
Python
3,139
88
__all__ = ["GlycoPeptideBranchMS2TreeLSTM"] import dgl import torch from torch import nn from dgl.ops import copy_u_sum # type: ignore from ..ms2.model import GPeptideMS2Output, GlycanMS2FragmentNN, GlycanMS2Output, GlycoPeptideMS2RatioOutput from ....util.collections.dict import chain_item_typed from ..common.data i...
39116bed2c264eb55772d448ac3f7cf6b17e339718ec72dade9cd3845f43f5b3
Python
3,140
89
__all__ = ["GlycoPeptideRTPredictor"] import os from logging import Logger from typing import Any, List, Mapping, Optional, Union import numpy as np import pandas as pd import torch from ....util.progress import ProgressFactoryProto from ...common.prediction import PredictorBase from ..common.data import GlycoPeptid...
f7756230f8747e69bbfbe3d71d6ceef59fbfa5a276a60e318320295a8a80fb31
Python
3,140
112
import numpy as np import pytest import pandas as pd import pandas._testing as tm @pytest.fixture def m(): return 5 @pytest.fixture def n(): return 100 @pytest.fixture def cols(): return ["jim", "joe", "jolie", "joline", "jolia"] @pytest.fixture def vals(n): vals = [ np.random.default_r...
686ff009d0498e9109b1d62fea3c735f89d04e6683d80a04553e9705a626dc93
Python
3,141
126
"""Path-related utilities for PCNtoolkit.""" import os def get_default_home_dir() -> str: """Get the default home directory for PCNtoolkit. Returns ------- str The default home directory path """ if home_dir := os.environ.get("PCN_HOME_DIR"): return home_dir # Try user's...
66104638bd9b8964d7d450fc71594f8eaf1a2f89a17a938edfbd69e37e6981ce
Python
3,143
93
''' Utils for use in seaborn_plot.py. These are mostly taken from ss_helpers.py, but used separately to avoid the necessity of activating conda. Authors: Sara Mathieson, Rebecca Riley ''' def parse_mini_lst(mini_lst): return [float(x.replace("[",'').replace("]",'').replace(",",'')) for x in mini_lst] de...
7d63ce0dd512e6f401af05456c44f8a1c755f2b87e32686f4875f398cecfa31f
Python
3,146
88
import argparse import torch.cuda from tqdm import tqdm import numpy as np import pandas as pd from sequence_models.utils import parse_fasta from sequence_models.pretrained import load_model_and_alphabet parser = argparse.ArgumentParser() parser.add_argument('model') parser.add_argument('in_fpath') parser.add_argume...
ac544d75f61468cbed548a9e101dc7ea82345871266c199f67998d0acdb1f712
Python
3,147
137
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 17 16:08:44 2020 @author: reisertm """ import sys sys.path.append("/home/reisertm") sys.path.append("/home/reisertm/nora/src/python") import numpy as np import tensorflow as tf import math from tensorflow.keras import Model from tensorflow.keras ...
558bef23104f3a0a67cea47fab78ac49fb3ee848aca3a8fde4818e21e7c6b7e2
Python
3,148
94
###################### ### Import Library ### ###################### # My library from molgraph.dataset import * from molgraph.graphmodel import * from molgraph.training import * from molgraph.testing import * from molgraph.visualize import * from molgraph.experiment import * # General library import os import argpars...
78e0550c6ea388eafbd901e767079fe3df3d1558d3822fdbedfe4d1349586eaf
Python
3,148
97
__all__ = ["GlycoPeptideRTTrainer"] import os from logging import Logger from typing import List, Mapping, Optional, Union import torch from ...util.weightloss import AutomaticWeightedLoss from ....util.progress import ProgressFactoryProto from ...common.training import TrainerBase from ...pep.rt.loss import RTMAEL...
2e2b50fddca541e61adcb9fcb52c90e7343aace1d3a4d09377c4105ef84d8946
Python
3,150
107
#!/usr/bin/env python ''' Testcases for the neural network training ''' import windseer.utils as utils import windseer import os import torch import unittest class TestDictutils(unittest.TestCase): def test_dict_update(self): dict_in = { 'a': 1, 'b': { 'changed':...
738214069c2fde518164a43b11d621c730bfc133a0401ed04fdf10cdf7c1df8e
Python
3,152
116
from __future__ import annotations import contextlib import inspect import os import re from typing import ( TYPE_CHECKING, Any, ) import warnings if TYPE_CHECKING: from collections.abc import Generator from types import FrameType @contextlib.contextmanager def rewrite_exception(old_name: str, new_n...
a4eeda637a00618b6a301c2a577dd8f21031c6f5d05932c17d8e7c64df52b405
Python
3,152
92
''' create_ppp_sync_submitter.py Create a shell script to submit AWS S3 sync jobs to the cluster for PPP imagery. ''' import argparse import re import os import colorlog import inquirer from aws_s3_lib import list_prefixes # Configuration MANIFOLDS = ['dev', 'prod', 'devpre', 'prodpre'] BASE = "/nrs/neuronbri...
5ae0663b0cddaeb54e416766d513d533a58e54737cc92ce7f226756239102b3c
Python
3,153
98
from dataclasses import dataclass import logging import time import numpy as np import torch from modules import ( dimensions, model, pretransformations, posttransformations, transformation_utils, ) @dataclass class EdsrDimensions(dimensions.Dimensions): """ Edsr dimen...
5f0803998800a96be348d7658dac2cadb57cc20c15f98432b8c86af7aacc4f2c
Python
3,153
87
import numpy as np import logging from copy import deepcopy # Class running stochastic gradient descent # opt is an optimizable class that must provide the following functions: # addProd(g0, step, g1): returns g0 + step * g1 for directions g0, g1 # getGradientSGD(coeff) returns coeff * gradient; the result can be ...
b6a1c9558183d2b76de53aa2a232bdad8dd177186f087d0dcba8ae3e46204169
Python
3,157
92
''' create_ppp_sync_submitter.py Create a shell script to submit AWS S3 sync jobs to the cluster for PPP imagery. ''' import argparse import re import os import colorlog import inquirer import aws_s3_common.aws_s3_common as AW # Configuration MANIFOLDS = ['dev', 'prod', 'devpre', 'prodpre'] BASE = "/nrs/neuro...
32c34c78586c3ffa7ef392c334a49a9248e194f27e61b87491cb0ddfaf2343a5
Python
3,160
94
# 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...
44c412338b7c0ccff2cebcc8e0e53f59cdbd32714218000a05e41eb1e9957887
Python
3,161
78
############################################################### ################################################################ import numpy as np import matplotlib.pylab as plt import matplotlib.gridspec as gridspec import matplotlib matplotlib.rcParams.update({'text.usetex': False, 'font.family': 'stixgeneral', 'mat...
3a1b32bcdfeaa04e291aaa92741fa777dddc441f3c74b3cb68ead4472b0d7d04
Python
3,162
75
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import os import cv2 from PIL import Image class PAPQMNIST_SIL(): def __init__(self, list_IDs, labels, transform, path, batch_size, dim, n_channels, n_classes, negative_class_name, positive_class_name, shuffle):...
09879ab97fd4fbf64e96e05d008c7e3f2349b1503d5874c3dd416bdd1d343ac7
Python
3,163
94
###################### ### Import Library ### ###################### # My library from molgraph.dataset import * from molgraph.simplemodel import * from molgraph.training_simple import * from molgraph.testing_simple import * from molgraph.visualize import * from molgraph.experiment import * # General library import os...
51c795362545d95c2390c38c58054c5283364692b24b61b2ab22ef6a6c5d240a
Python
3,165
71
""" Methods to gather results from different subjects """ import os from scanometrics.utils import logging def quantifybrainstem(subjects_dir, subj_id, output_filename='brainstem_volume.txt'): """ Collects relevant brainstem information from morphometry output :param subjects_dir: absolute or relative p...
54725563de9c9dbd20a1017b1af102343f0bcd3afd24f1c44773c31f15dc371a
Python
3,165
101
# Copyright 2018-2023 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...
54960e17380bba959b8643133d278c95ea53a37cd38b4bc9a86f81ea060913cb
Python
3,165
83
#%% # -*- coding: utf-8 -*- import numpy as np import sys,os sys.path.append('./') from utils.model import * from utils.cal_param import * from utils.move_detector import main from utils.unet import * from env_config import * #=========================set values below========================== # Load models input_sh...
509bf8b0772565313972eaeaf819dedaba20d52b781779cf3aaa056860a2ff17
Python
3,168
105
import functools import itertools import logging from multiprocessing import Pool, TimeoutError import os import signal import sys import time from typing import Callable, List import warnings sys.path.append('/gscratch/stf/mpun/software/PyRosetta4.Release.python38.linux.release-299') import h5py import numpy as np im...
99f3a66fb8d9d81701a2fbc28c33e4e20041387cdb43cc72b8d8944de86c3291
Python
3,168
76
import argparse, os, yaml def strtobool(value): # local replacement for distutils.util.strtobool (distutils was removed in Python 3.12) value = str(value).strip().lower() if value in ('y', 'yes', 't', 'true', 'on', '1'): return 1 if value in ('n', 'no', 'f', 'false', 'off', '0'): retur...
6975e3d7cf95adb4b7f3ee02146789defa3d31a53987f97c824eb195693d1af0
Python
3,169
92
from ecgdigitize import visualization from typing import Optional, Union from dataclasses import dataclass from enum import Enum import numpy as np from ecgdigitize.image import ColorImage from . import common from .grid import detection as grid_detection from .grid import extraction as grid_extraction from .signal i...
4727ce3569885a3e22330c4907292b77c4b078b3425fa19bdff7dae1bc13d921
Python
3,170
80
import numpy as np, matplotlib.pyplot as plt, sys import pumpprobe as pp ds_list = "/projects/LEIFER/francesco/funatlas_list.txt" funa = pp.Funatlas.from_datasets( ds_list, merge_bilateral=True,merge_dorsoventral=True,merge_AWC=True, ds_exclude_tags="mut...
1178b2dd9013771401e5a89e389eae00aa24ed7788bcfb081b3407590e14f021
Python
3,172
94
__all__ = ["BatchProto", "MS2DataConverterProto", "MS2Dataset"] import os from logging import Logger from typing import Any, Generic, List, Mapping, Optional, Protocol, TypeVar import torch from torch.utils.data import Dataset from ...speclib.common.speclib import MS2SpectrumType, SpectralLibraryBase from ...util.pr...
000872265cd2ef3dea7a941e1bc09d865abe8a4e404eb369d38b7a3633b6d4f4
Python
3,176
71
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jan 23 08:26:03 2022 @author: danielkerschensteiner """ import numpy as np import pandas as pd import tkinter as tk import tkinter.filedialog import glob import os def collect_columns(path_name, ind_col, target_col): files = glob.glob(path_n...
17534bdbad88bf95dd6d474869f6be0369ceb6665456dd42566044eb8c88549c
Python
3,176
71
"""(Iterative) Walsh method for coil sensitivity map calculation.""" import torch from mrpro.data.SpatialDimension import SpatialDimension from mrpro.utils.filters import uniform_filter def walsh(coil_images: torch.Tensor, smoothing_width: SpatialDimension[int] | int) -> torch.Tensor: """Calculate a coil sensit...
b44bb0eb10c49af3c055a9ac532691917a318c0f339cb79c55481109e4340646
Python
3,176
110
import pytest import pandas as pd import pandas._testing as tm from pandas.core.reshape.merge import ( MergeError, merge, ) @pytest.mark.parametrize( ("input_col", "output_cols"), [("b", ["a", "b"]), ("a", ["a_x", "a_y"])] ) def test_merge_cross(input_col, output_cols): # GH#5401 left = pd.DataFr...
bc17a5fbff57372e75f98b04ec9823eba12099af55f0e5463a83143f422f308b
Python
3,176
96
# # File to test the hnn.py class. # # This file establishes the clebsch gordan coefficients, sets up an hnn with given parameters, # loads holograms from .npy files, and then tests the network via a function call. # import os import numpy as np import tensorflow as tf import protein_holography.network.hnn as hnn i...
659d04ae6879cc6144f406de5cb7f18220cac2f8f137ee5f8a8a0211fffd1588
Python
3,178
122
import pandas as pd import numpy as np from scipy import stats, linalg from statsmodels.stats import multitest def calculate_median_absolute(x): """Calculate Absolute median value""" return x.abs().median() def significant_level(x, alpha=0.05, correction=None): """ Apply FDR correction to a pandas....
9eb9b88389352fa87632620b6e9972e542c635694cd52b58c972ee0a489c178d
Python
3,178
89
""" Base class to track job results Authors: Thomas A. Hopf """ from abc import ABC, abstractmethod DEFAULT_RESULT_COLLECTION = "evcouplings_jobs" DEFAULT_FILE_COLLECTION = "evcouplings_files" class ResultTracker(ABC): """ Track job status and results in a database """ def __init__(self, connecti...
6e75b2f0d4da61cd1d2ea47595098aa6dd6ed6ebf5c5807a1d0dc6432518bdcd
Python
3,180
110
import matplotlib.pyplot as plt import numpy as np import pandas as pd import sys import matplotlib.ticker as ticker import matplotlib.transforms as transforms from pathlib import Path import math from statistics import mean, stdev from plotting_functions import * #create figure and set font fig, ax = plt.subplots()...
de3ef6947e72062d70ce2a3a55937de850fdb460ff6162b0528e9396c63a6120
Python
3,180
98
# Copyright 2018-2020 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...
a967ebf112de9ad4d63d2a4cf530340ca4d3f8bb2ddfd95c606894cc7a3d2df2
Python
3,181
83
from torchmetrics.functional import accuracy, precision, recall, auroc, f1, specificity from torchmetrics import ConfusionMatrix import torch import pandas as pd def calculate_metrics(pred_labels, target_labels, loss=torch.tensor([0])): """ This function should be replaceable with MetricCollection from torch ...
6384cebbfb4a0a1723b2a733a1797c23b46c499ca70b5625205c2c480e12333c
Python
3,182
80
from StimulationProcess.BasicStimulationProcess import BasicStimulationProcess from psychopy import core, visual, event import time class FinishProcess(BasicStimulationProcess): def __init__(self) -> None: super().__init__() def change(self): if self.controller.endBlock: ...
43611d7d64ec97f7d771d31f494de53b17f1fb143bb607cc3b335247ac4e8afd
Python
3,183
116
""" 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 logging from abc import ABC, abstractmethod import torch import wandb from torch.utils.tensorboard import SummaryWriter from ocpmodel...
58a2e41769b71567f0b479d5e47332e6a42e3f3c7e3af1e21e480e8ca245ffc8
Python
3,184
81
#!/usr/bin/env python __author__="etseng@pacb.com" import os, re, sys from Bio import SeqIO from csv import DictReader, DictWriter from collections import Counter FIELDNAMES = ['pbid', 'pbgene', 'length', 'refisoform', 'refgene', 'fl_count'] pbid_rex = re.compile('PB.(\d+).\d+') def demux_for_subsamping(class_filena...
f4f6c39a1cdb32452a4f4d47c42f50e2fd3ffd97732a396d7643984fcf741452
Python
3,186
65
import os.path import argparse import logging from base import loggingUtils import base.surfaces as surfaces from base.kernelFunctions import Kernel from base import surfaceMatching from base import secondOrderMatching as match #import secondOrderMatching as match def compute(tmpl, targetDir, outputDir, display=True, ...
307fbb18e75093388ab588043212245ae9470f18854bcbe6370cf61b2b374bc4
Python
3,187
78
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import os import cv2 from PIL import Image class OC_SIL(): def __init__(self, list_IDs, labels, transform, path, batch_size, dim, n_channels, n_classes, negative_class_name, positive_class_name, shuffle): ...
6efa10ded111ca0add65a6829d39c7e81b5d20318d44c1abf86b073c95b86a29
Python
3,187
131
"""All acquisition enums.""" from enum import Enum, Flag, IntFlag, auto class AcqFlags(Flag): """Acquisition flags. NOTE: values in enum ISMRMRD_AcquisitionFlags start at 1 and not 0, but 1 << (val-1) is used in 'ismrmrd_is_flag_set' function to calc bitmask value [ISMb]_. References ----------...
80808661ef29fc05ce6e4fe4a13cf25ec9fe8c17d9c6fedf3e164c67d2cb7b7f
Python
3,188
108
import numpy as np from scipy.signal import hilbert from scipy.stats import zscore import fbpca from scipy.signal import medfilt2d maskfile = "demodata/mask.npy" ncomp = 20 def cpca(input_data, n_comps, n_iter=20, l = 10): l += n_comps n_samples = input_data.shape[0] (U, s, Va) = fbpca.pca(input_data, k =...
019c306bb90356ce4faf8856b378ca603e3a12f4c268d37120e6dcf19122178f
Python
3,189
78
#! /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...
e41143d1eab97da8a99a47820b0e0849f1150c31d5971b9d954f5b1f67666422
Python
3,189
86
import os import json import csv import pandas as pd import numpy as np import random from .readPDB import getDataset, fastaname def save_dataset_to_csv(csv_path, data, models_per_pair=5, use_ranking=False, data_dir=''): contents = [] for index, row in data.iterrows(): label = 1 if row['type'] == 'p...
b0607cadea732bbf396b1bac54ad4052c237b899e8510cbe6cc25c020a592c04
Python
3,190
74
## deprecated 12.02.2021 rieke / arco # import pandas as pd # import dask # import dask.dataframe as dd # # from compatibility import multiprocessing_scheduler # def burst_detection_helper(proximal_voltage_series, st, burst_cutoff): # sim_trial_index = proximal_voltage_series.name # spike_times = st.loc[s...
b0ca76e11f7a71a81a9fffbe09973f621ed72d03e10c195c3e028198bd5bbd7f
Python
3,191
100
import re, sys, os sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', 'resource-gcg', 'scripts')) from tree import Tree def A(q): return q.split('/')[0] def W(q): return q.split('/')[1] def depth(S): return ( -1 if '-/-'==S[0] else 0 if '-/-'==S[1] else 1 if '...
2c3c25e2275634e561bac5a85e09c090d1f7db12cabb923ce9c55d9842b64c8f
Python
3,192
86
import numpy as np def initialize_population(population_size, dimension): return np.random.rand(population_size, dimension) def calculate_fitness(positions): return np.sum(positions, axis=1) def update_producers(positions, fitness_values, iteration, max_iterations, alert_value, safe_threshold): ...
9e62aa54c3b880a95e492924bafd4130795c599de528fd657832460a925c5ce5
Python
3,194
74
import itertools import numpy as np from elephant.spike_train_dissimilarity import van_rossum_distance, victor_purpura_distance from elephant.spike_train_synchrony import spike_contrast from neo.core import SpikeTrain class Measure: def __init__(self, firings, metric='rsync'): ''' Function for calc...
97d2693e530326a32ed4570fb027ff4e0baf5d15c7f0f75ecfcd1728a1699c60
Python
3,195
94
from Analyze_Retinotopy import PrfMapping from Analyze_PRF import AnalyzePrf from Analyze_EccSF import AnalyzeEccSf from Analyze_RadialBias import RbRatioAnalyses if __name__ == '__main__': # Create an instance of PrfMapping class prf = PrfMapping(fov=20) # Obtain model response profiles for sp...
20b86b789aad9aab3b77c3feebccc91d065ca703110d919f7c87db21e328bf95
Python
3,197
82
import torch import torch.nn as nn import torch.nn.functional as F class SSIM(nn.Module): """Layer to compute the SSIM loss between a pair of images """ def __init__(self): super(SSIM, self).__init__() self.mu_x_pool = nn.AvgPool2d(3, 1) self.mu_y_pool = nn.AvgPool2d(3, 1) ...
978cf821b0abeda63bc52bb8dc5743657787f136aeaf3234445e8c338236e635
Python
3,197
79
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jul 29 17:48:31 2022 @author: mpeshwa """ #Importing required libraries from Bio import SeqIO from tqdm import tqdm import random from itertools import chain import math import pandas as pd import numpy as np import sys import argparse import random d...
0e549bc1ca411bc96670c6272e5e6c33e2687cf1aab1ae6200a396c1cd445a95
Python
3,198
97
import os import pickle import shutil import hashlib import base64 import json import numpy as np import pandas as pd from .log import auto_log from .configs import CACHE_DIR class CacheLoadError(Exception): pass class RobustJSONEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj,...
68791807dfc2147cb10094612fe928264b41a777c940b822e89a291743d11b1b
Python
3,199
87
"""Class for Zero Pad Operator.""" from collections.abc import Sequence import torch from mrpro.operators.LinearOperator import LinearOperator from mrpro.utils.pad_or_crop import pad_or_crop class ZeroPadOp(LinearOperator): """Zero Pad operator class.""" def __init__(self, dim: Sequence[int], original_sha...
1d370b8e83d8650c9e5680bb5935e967b0ffab6a2187c5241f62e80a8a0f310a
Python
3,200
80
from rl_games.common.ivecenv import IVecEnv # wrap your vector env so it resets for you under the hood from gymnasium import spaces def remove_batch_dim(space: spaces.Space) -> spaces.Space: """Recursively remove the first (batch) dimension from a Gym space.""" if isinstance(space, spaces.Box): # ass...
81a30491f96289a6318992fb45a48e22a3d73428e9580e4f95c9fd60d67b7f14
Python
3,200
103
""" .. _decoding_md: ==================================================== Decoding Multidimensional Gradient ==================================================== Gradec provides . """ # Download HCP S1200 principal gradient from gradec.fetcher import _fetch_gradients gradients = _fetch_gradients(cortical=True) #...