sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
d32d4dfb97a0272d9e04ab3c7038011c40b8aed8148f898464f5e0beef1ca318
Python
991
31
import sys import re import pdb def is_failtree(linetree): #perl -pe 's/.*\([^a-z]+ .*//' if re.search(r'.*\([^a-z]+ .*', linetree) is not None: return True else: return False def gen_failtree(words): #use failnode labels? assert len(words) > 0 #if ("" not in words): # ...
37e48c028698caf1bf80a4a845a6cb19249a0fb4fdb98439107e2095dca680a0
Python
993
33
import sys def main(): print("word totsurp") all_word, all_llmsurp, all_bori, all_bprob, all_iprob = [], [], [], [], [] lines = sys.stdin.readlines() for line in lines[1:]: #print(line) word, llmsurp, bori, bprob, iprob = line.rstrip().split(" ") all_word.append(word) ...
ce4c0a97132ae7df75e7da2a94b8f96855084c5d4c739b6cbf8d92c380b016de
Python
993
31
from distutils.core import setup setup( name = 'NeatMS', packages = ['NeatMS'], version = 'v0.6', license='MIT', description = 'NeatMS is an open source python package for untargeted LCMS deep learning peak curation', author = 'Yoann Gloaguen', author_email = 'yoann.gloaguen@mdc-berlin.de', url = 'h...
0d9bf9efc1ec22369d97600a76b9fa0be471d051242746b90184a590fa27816b
Python
995
30
# 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...
b50c4af569a528aee7de138eb09540fc4c3e8cfa1665e6d7f5af4a1fa77bc49e
Python
996
35
# # Implementation of the Wigner D-matrices via sympy. # import numpy as np import sympy from sympy.physics.quantum.spin import WignerD class Memoize: # https://stackoverflow.com/a/1988826/1142217 def __init__(self, f): self.f = f self.memo = {} def __call__(self, *args): if not ar...
c819d90525560a4eadfe50bc9187f3adfe861a300f97a1993f823cc415788e91
Python
996
37
import numpy as np import pytest import pandas as pd import pandas._testing as tm @pytest.mark.parametrize( "index_without_na", [ pd.TimedeltaIndex(["1 days", "2 days"]), pd.PeriodIndex(["2011-01-01", "2011-01-02"], freq="D"), pd.DatetimeIndex(["2011-01-01", "2011-01-02"]), pd...
f3f6060448b629a1e22b42297f14ee8e8bfb533b49ebd93154009cc894d04a07
Python
997
39
import sys import glob import pandas as pd import numpy as np import h5py file_list = glob.glob(sys.argv[2]) total_data = pd.DataFrame() for ff in file_list: data = pd.read_csv(ff, sep=',', index_col=0, header=0) data = data.transpose() c = list(range(data.shape[0])) total_data = pd.concat([total_data...
42b10cd1efc5f12f091860aee5cb7220b93d72237881e52b0d9b4b84179eddf2
Python
998
40
# --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: percent # format_version: '1.3' # jupytext_version: 1.16.0 # kernelspec: # display_name: ol-connectome # language: python # name: ol-connectome # --- # %% from pathlib import Path import sys ...
bfea2eb3b497aab82b3f0ebeded2a4da5a11805faf1c610be7be4ed35e30ef59
Python
998
28
import numpy as np align_to_nbytes = 512 max_raidfile_entries = 64 # 8B MrParcRaidFileHeader = [("hdSize_", "<u4"), # ID??? ("count_", "<u4")] # # of meas # 152B MrParcRaidFileEntry = [("measId_", "<u4"), # MeasID ("fileId_", "<u4"), # FileID ...
990abcd8c724491a55ff106d00fa64f39a59c7ef4e3382c66fd1653a04238002
Python
1,000
31
from setuptools import find_packages, setup with open("README.md", "r") as fh: long_description = fh.read() with open('requirements.txt') as f: requirements = f.read().splitlines() requirements = [l for l in requirements if not l.strip().startswith('#')] setup( name='neuronbridge-python', package...
b91ec19749158f514561718d4d7f1a0ffd3fa02f148dd1a500f8798818fa6c04
Python
1,000
41
import numpy as np import vegas import math from outputsplitter import log_stdout, unlog_stdout import gvar gvar.ranseed(12345) DIM = 5 @vegas.rbatchintegrand def f(xd): r = xd['r'] phi = xd['phi'] # construct Euclidean coordinates, Jacobian x = np.zeros((DIM,) + np.shape(r), float) x[:] = r ...
c96326f52231009a60ae4fc2f06109e0174dbd2c7e76fd604e2c5ef3970ad29c
Python
1,001
40
"""Plot module for gradec.""" import os from neuromaps.datasets import fetch_fslr from surfplot import Plot from surfplot.utils import threshold from gradec.utils import get_data_dir def plot_surf_maps( lh_grad, rh_grad, cmap="viridis", color_range=None, threshold_=None, data_dir=None, ): ...
6313de065213ffc22c0bc8dc2a1bd036945205ff5c512c43e64d499b207ccf66
Python
1,003
28
import sys import argparse try: import importlib.resources as pkg_resources except ImportError: import importlib_resources as pkg_resources from .. import templates if __name__ == '__main__': argparser = argparse.ArgumentParser(''' Initialize a CDR(NN) config file template. ''') argparser.add_a...
7bfa9b63fb8b73c532bf6ec71b915ea00aa8d055bc3df0982d75f1e2c2079537
Python
1,003
24
import dgl import torch import torch.nn as nn import torch.nn.functional as F class GVAE(nn.Module): def __init__(self, in_dim, hid_dim, z_dim): super(GVAE, self).__init__() self.encoder1 = dgl.nn.pytorch.GraphConv(in_dim, hid_dim) self.encoder2 = dgl.nn.pytorch.conv.GraphConv(hid_dim, z_di...
98a469233248022e867fd2e380fd8ee036b962b86c063de24a028f4c53b4e9f1
Python
1,005
33
from io import StringIO import pytest import pandas as pd import pandas._testing as tm class TestSas: def test_sas_buffer_format(self): # see gh-14947 b = StringIO("") msg = ( "If this is a buffer object rather than a string " "name, you must specify a format str...
9855a307fe05bc7218f912a7d2f36b1151fc0ad5f7bdf1f27e525429e805bfe5
Python
1,007
24
# 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...
5b695d07c2b6476fee83bd51688e19c0ed5b620b9ccb7aa7b8aac8d0ba74cbd8
Python
1,008
39
import sys import cuegraphcontexts import pdb ## for each article until eof... article_number = 0 eof = False while ( not eof ): ## for each sentence in article... G = cuegraphcontexts.CueGraph() for linenum,sent in enumerate(sys.stdin): if '!article' in sent: break ## for each dep... for dep in sen...
ba088cbb0350c86d283d9d835fbd678b555e9444eca18c389432460388600475
Python
1,008
41
""" 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 torch from .math_fn import complex_abs_sq def rss(data: torch.Tensor, dim: int = 0) -> torch.Tensor: """ Compute the Root Su...
c483dc6391f48af50140b41a7ea040ddf273eb9e1ff87a191935295ef6e69793
Python
1,008
36
import pytest import pandas as pd import pandas._testing as tm class TestPipe: def test_pipe(self, frame_or_series): obj = pd.DataFrame({"A": [1, 2, 3]}) expected = pd.DataFrame({"A": [1, 4, 9]}) if frame_or_series is pd.Series: obj = obj["A"] expected = expected["...
a69ce6c1e558168b33117700aca3dcf10d143e15cc9817b5b163418fb0e5c694
Python
1,009
29
import pytest from pandas._libs.tslibs import Timestamp from pandas._libs.tslibs.dtypes import NpyDatetimeUnit class TestTimestampNormalize: @pytest.mark.parametrize("arg", ["2013-11-30", "2013-11-30 12:00:00"]) def test_normalize(self, tz_naive_fixture, arg, unit): tz = tz_naive_fixture ts =...
fd0dbc02c0bf37bb72b363387c827ce142ef6460b8a414c2131693c9d9985784
Python
1,009
30
import os from unittest import TestCase import dynast.estimation.alpha as alpha import dynast.estimation.pi as pi import dynast.preprocessing.conversion as conversion import dynast.utils as utils from .. import mixins class TestAlpha(mixins.TestMixin, TestCase): def test_read_alpha(self): alpha.read_al...
f3bc41a54dc01ae0058b8e68252078004c9c9e8a467a6524d01cf965254af4f2
Python
1,010
39
from src.paths import Paths import os import pytest import json TEST_FILE = 'test_json.json' def setup_module(): test_paths = {'PATHS':{'Test1':1, 'Test2':2}} with open(TEST_FILE, 'w') as f: json.dump(test_paths, f, indent=4) def teardown_module(): os.remove(TEST_FILE) def test_paths_call(): ...
253c9c278f579c65dbe825439a02354b5d6fcfb750096c4df7ea39708aeb162a
Python
1,011
17
"""Give the T1 MRI a FLAIR-like contrast: dark CSF, grey matter brighter than white matter, bright caps around the ventricles and a few white matter lesions.""" import sys import numpy as np import nibabel as nib t1, sdt, out = sys.argv[1], sys.argv[2], sys.argv[3] im = nib.load(t1) v = im.get_fdata().squeeze() d = nib...
45a63df9f4961f9d386f0ae2d157e6e882fa06ad7dfb245194f9688076989e1c
Python
1,011
23
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved. # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and relat...
9f0b36a66211ea2fcbc24fe7fde48494eedf6bf6f2ad2676014f29d16a840a1c
Python
1,011
33
# # Equivariant batch normalization layer # # Uses L_batch_norm.py to take batch norm across all Ls of inputs # from keras import backend as K from keras.engine import InputSpec from keras.layers import BatchNormalization import tensorflow as tf import protein_holography.network.L_batch_norm_gpu as lbn class Spherica...
a1177c84272be4f56c563f447bc598248d7e602c74945efb0de0ffba644c51a1
Python
1,011
38
import json import os from datetime import datetime def start(params, sys_desc): """Capture exp start """ exp_start = datetime.now() experiment_id = params['experiment_id'] search_space = [] for key, val in params.items(): search_space.append("{}: {}".format(key, val)) msg = [{ ...
123b82079876acbc4d4e1ab90d664275a0abc6693da81b12ff798a08aab47e58
Python
1,012
38
#! /usr/bin/python3 # -*- coding: utf-8 -*- # @FileName: setup.py # @Author: Li Chengxin # @Time: 2023/7/4 13:43 import setuptools with open('readme.md', 'r', encoding='utf-8') as f: long_description = f.read() with open('requirements.txt', 'r') as fr: pkg_requirements = fr.read().split('\n') pkg_requir...
ade2ceb0945b1d1e3fe76c7b3e537806740f99bdaeb4c9ea0f8cc41c59eacc53
Python
1,012
26
# Copyright 2018-2024 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...
f0eb4f735160caa9cd403ac7435a4024bd2deeb0dddc20136e63fb0d6a3919fd
Python
1,012
35
import numpy as np nonlin_c = [4.9048901e-33, -1.0354900e-27, 8.3495897e-23, -3.2744900e-18, 6.5422602e-14, -7.0451200e-10, 7.7333998e-6, 9.0207702e-1] nonlin_corr = np.poly1d(nonlin_c) wavelen_c = [3.8541e-1, -1.8392e-5, -1.5460e-9, 1.7836e2] wavelen_corr = np.poly1d(wavelen_c) probe_A_cm2 = 1 #Load calib_file calib...
e5bcbbc6a276a8fda6cdc188e30f679dce518eab45065da383d346f60bcb3019
Python
1,014
34
import cv2 import math import numpy from utils.logging import init_log def psnr1(img1,img2): mse = numpy.mean((img1/1.0 - img2 / 1.0)**2) if mse < 1e-10: return 100 psnr1 = 20 * math.log10(255/math.sqrt(mse)) return psnr1 def psnr2(img1,img2): mse = numpy.mean((img1 / 255.0 ...
fe7c0c7a9ac6a9b9493fad895b2c4a73e3e009b1dd4338ddc621bb6eb43ab6ed
Python
1,015
28
import numpy as np def Normalize(images, type, show=0): show = 0 if show == 1: print("min", np.min(images)) print(" max", np.max(images)) if type == 1: # values from 0 to 1 (2) im_n = (images - images.min()) / (images.max() - images.min()) if type == 2: # random ...
d4c33c058c13c96830d6066ab19e48398bee4e2e611ec9497b96ce6879131231
Python
1,016
40
from ._cohens_d import cohens_d, gene_selection from ._data_loader import SuematsuData from ._go import go, gprofiler, get_go from ._preference import ( kwarg_savefig, eda_longitudinal_args, sgoa_longitudinal_args, venn3_palette1, venn3_palette2, venn3_palette_alias, artist_pipeline_adgile, eda_pipeline_ad...
f8367d1bb81238fcf27cba3004a8a36d906e394da4384ad113b65a33e72dd65a
Python
1,016
33
"""torch_compile is off unless a config asks for it.""" import torch from tests.test_critical_fixes import make_cartpole_runner def _count_compiles(monkeypatch): # the runner compiles modules; example networks may decorate a function at import calls = [] def fake_compile(model, *args, **kwargs): ...
0b5658ffbceca86153cebcbeffdad41eeaf1c60f6ff34283d35a11f2a7606855
Python
1,017
30
from typing import List import torch from ...image import Stack, Volume def stack_intersect(stacks: List[Stack], box: bool) -> Volume: return volume_intersect([stack.get_mask_volume() for stack in stacks], box) def volume_intersect(volumes: List[Volume], box: bool) -> Volume: volume = volumes[0].clone() ...
774e9cd733dddf83134a4979384ec8e1fe18396df8a1eb1dfd2cffb440661660
Python
1,017
31
# Copyright 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 agre...
aaa9387445637ae43028f2384f4628600bffa0bfd3279f4745ec3ead4b7ae54e
Python
1,017
28
import sys, argparse argparser = argparse.ArgumentParser(''' Reads a space-delimited data table and renames user-specified columns. Column source and target names must alternate: col_1_source col_1_target [col_2_source col_2_target [etc... ''') argparser.add_argument('cols', nargs='+', type=str, help='column names to ...
485229d012cbf8bfc23c73e9b5b050f7a01fb5a0d32a6d9d725698833b9e66b0
Python
1,018
34
from enum import Enum # This assumes a list with dicts, loop over all dicts, and get the unique # keys def get_fieldnames(data): fieldnames = set() for item in data: [fieldnames.add(key) for key in item.keys()] return list(fieldnames) class SnifferType(Enum): list_with_dicts = 1 list_wit...
7b83fb021e95da2bcb670a62fb98119a6d98361f026b9f2608828899b2e3ab6f
Python
1,018
27
# License: see [LICENSE, LICENSES/legged_gym/LICENSE] import inspect class BaseConfig: def __init__(self) -> None: """ Initializes all member classes recursively. Ignores all namse starting with '__' (buit-in methods).""" self.init_member_classes(self) @staticmethod def init_member_cl...
0438ecc10f45adb514cbc5854c80ab6528241702e47b69607c63412c066a3a97
Python
1,019
36
import numpy as np from abc import ABC class AcquisitionParameters(ABC): """Acquisition parameters.""" def __init__(self, b, td, small_delta=None): """Initialize the acquisition parameters.""" # b-values or shells self.b = np.array(b) # diffusion time Δ self.td = np.ar...
b2252a2c40ead461e383f18377ed4e2ab477293ca28716d87547aed3d4e02071
Python
1,019
26
import pandas as pd import numpy as np ### Enable logging snake_log_obj = snakemake.log # class(snakemake.log) = 'snakemake.io.Log sys.stdout = open(str(snake_log_obj), "w") # could not find better ways than calling str(snake_log_obj) to get the log filepath ### Get parameters from snakemake GENELOC_FILE = snakemak...
f76c888a2f2592bdbd860e5d870331bc1ce84f2a17efef3e8e0cc70532a8ef42
Python
1,019
27
# Copyright 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 agre...
fab01421e2ca13b1e8e86ca35b52780fcd66d67b8586714aaeb77b9ac02ec0d9
Python
1,019
23
from .spike_detection import spike_detection import barrel_cortex #from . import spaciotemporal_binning excitatory = barrel_cortex.excitatory inhibitory = barrel_cortex.inhibitory def split_synapse_activation(sa, selfcheck = True, excitatory = excitatory, inhibiotry = inhibitory): '''Splits synapse activation in ...
952f42501c21972585b68b270375e823c20a72482e86f401f2d7ddef7f2a9743
Python
1,020
41
"""common utilities""" from __future__ import annotations from typing import ( Any, Literal, ) def _mklbl(prefix: str, n: int): return [f"{prefix}{i}" for i in range(n)] def check_indexing_smoketest_or_raises( obj, method: Literal["iloc", "loc"], key: Any, axes: Literal[0, 1] | None = ...
b00053f1ce80e495251bb3e3177aad405c19552f978909d7495394844ba53431
Python
1,021
31
# code from https://github.com/theislab/scanpy/blob/master/docs/extensions/typed_returns.py # with some minor adjustment import re from sphinx.application import Sphinx from sphinx.ext.napoleon import NumpyDocstring def process_return(lines): """Process the return section of a docstring.""" for line in lines...
ffb32e829635683e15e0c70b96ab5b0324a81c0d347b929369d87925641d2cd7
Python
1,021
29
from isaacgymenvs.pbt.launcher.run_description import ParamGrid, RunDescription, Experiment from isaacgymenvs.pbt.experiments.run_utils import version, seeds, default_num_frames kuka_env = 'allegro_kuka_throw' _frames = default_num_frames _name = f'{kuka_env}_{version}' _params = ParamGrid([ ('seed', seeds(8)),...
2a7fb9bb2794ad0f8c0b9d61973aff980850df13a5848721d0028b13951e0cf4
Python
1,022
42
import re import dependency #read dependencies from file #[[deps of s1], [deps of s2],...] def readDepsFromFile(f): fdeps = [] sDeps = [] for line in f: # print(line) if line != "\n": d = dependency.Dependency() d.read(line.strip()) #print(d.label) ...
7a849b9986e54cc3135ec60787e8439e69ce0c24c6c87ad5a0a4f101a928fa30
Python
1,023
42
# JN 2016-08-26 """ Converts refscheme.mat to refscheme.csv The format of refscheme.csv is file_name;ref_file_name """ from __future__ import division, print_function, absolute_import import csv import os from scipy.io import loadmat from argparse import ArgumentParser OUTFNAME = 'refscheme.csv' def convert(fname_i...
2e8081cfb4f2f26769a13acc72cf22cc4e776e1e4f9ef0c869c60bdfa1ca6b54
Python
1,025
28
#!/usr/bin/env python """This script is used to merge the coverage and PIR if introns Usage: %prog <PIR_bed> <cov_bed> <merged_bed> """ import pandas as pd from sys import argv, exit try: PIR_bed = argv[1] cov_bed = argv[2] merged_bed = argv[3] except: exit(__doc__) PIR = pd.re...
4b723d03f1009c4ebf4fe1122960c6b2e212b945bf944fbe95127159ed6b4aa1
Python
1,025
38
""" stats.py : stats module for ScanOMetrics software """ import numpy as np def fdr(p, q=0.05): """Compute False Discovery Rate (FDR)'s parametric and non-parametric thresholds. Returns 0.0 if no sample is found below the FDR. :param p: vector of input p-values :type p: numpy (N,) array :param...
d31f440a181b8ed78bd044bad3720463188fb68c857c9341b249f026d714db87
Python
1,025
47
# # File for testing the Batch Normalization layer # import numpy as np import tensorflow as tf import protein_holography.network.L_batch_norm as lbn import protein_holography.network.spherical_batch_norm as sbn s = [2,3,1] L_MAX = 5 sbnl = sbn.SphericalBatchNorm(0,L_MAX) #make spherical input input = {} for l i...
5652df842575309805d5c796e207a116489deed69187d98a7cb6c07e4c181d9b
Python
1,027
40
__all__ = [ "normalize_by_max", "normalize_by_sum", "dot_product", "spectral_angle", ] import numpy as np import torch import torch.nn.functional as F def normalize_by_max(x: torch.Tensor) -> torch.Tensor: x_max = x.max() if x_max > 0: x = x / x_max return x def normalize_by_sum...
0c361b6d9c45d7fa0e84e39e5f8772383a86da67371bb8f8e5c3c53222b2c310
Python
1,028
29
from isaacgymenvs.pbt.launcher.run_description import ParamGrid, RunDescription, Experiment from isaacgymenvs.pbt.experiments.run_utils import version, seeds, default_num_frames kuka_env = 'allegro_kuka_regrasp' _frames = default_num_frames _name = f'{kuka_env}_{version}' _params = ParamGrid([ ('seed', seeds(8)...
04538654ff367daab0ad0892e91bdd9bf8e6f38ccd8ab4960835cd3b7094286c
Python
1,029
35
import numpy as np, sys, matplotlib.pyplot as plt import pumpprobe as pp head_only = "--head-only" in sys.argv funa = pp.Funatlas(merge_bilateral=True,merge_dorsoventral=False,merge_AWC=True) funa.load_extrasynaptic_connectome_from_file() esconn_ma = funa.esconn_ma # Monoamines esconn_np = funa.esconn_np # Neuropept...
160452a7b2f75730944f13e40a69e8e0ad5ad0a85f87574c2742ad3607323d32
Python
1,029
18
"""Convert labeled datasets from other pose estimation tools into Lightning Pose projects. Two converters, one per source format: - :func:`lightning_pose.converters.dlc.convert` -- reads a DeepLabCut project directory (``labeled-data/<video>/CollectedData*.{csv,h5}``) and writes a Lightning Pose project directory...
5a5647d096fbad3f3c77fe0afaf11a5b70b27f31a7e6912ec3b4393a80acd458
Python
1,029
34
"""empty message Revision ID: 8450b363cf25 Revises: 35fca522d209 Create Date: 2021-10-06 09:46:34.517521 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = '8450b363cf25' down_revision = '35fca522d209' branch_labels = No...
ff6f48e0d3de044fa9edae14897706ef775c8cd4da21825c32cc1a14b7313482
Python
1,029
26
from isaacgymenvs.pbt.launcher.run_description import ParamGrid, RunDescription, Experiment from isaacgymenvs.pbt.experiments.allegro_kuka_pbt_base import kuka_env, kuka_base_cli from isaacgymenvs.pbt.experiments.run_utils import version _pbt_num_policies = 8 _name = f'{kuka_env}_manip_{version}_pbt_{_pbt_num_policie...
6e39976183fe4cdc8823eeb6b524e47c5366669b131b027630edf87ad83a8d2f
Python
1,031
30
from sys import path as sys_path sys_path.append('..') from base import loggingUtils from base.imageMatchingLDDMM import ImageMatching, ImageMatchingParam import matplotlib matplotlib.use("qt5agg") import matplotlib.pyplot as plt import pyfftw pyfftw.config.NUM_THREADS = -1 loggingUtils.setup_default_logging('', stdO...
c53576708802ee6495ffcd97af8f58b128cc7e4bc63494042b87d5e35468d246
Python
1,031
24
from datetime import datetime import sys sys.path.append("..") from app import db from sqlalchemy.dialects.postgresql import JSON class Visit(db.Model): __tablename__ = 'visit' id = db.Column(db.Integer, primary_key=True) external_id = db.Column(db.String(255)) subject_id = db.Column(db.Integer, db.F...
c7bbb1f0177676c90a7ba689e852bdb56fbd68312a4150e7bb44f7c0d439a7f2
Python
1,033
27
from Surfaces.surfaces import * from Common.kernelFunctions import * from Surfaces.surfaceMatching import * from affineRegistration import * def compute(): fv0 = Surface(filename='/Users/younes/Dropbox/ADNI_toyExample/test/amgy_length7_sub101.byu') fv1 = Surface(filename='/Users/younes/Dropbox/ADNI_toyExampl...
dff4e22fe82e84f733df957f3ad9dc2c9b815bcc35385a080cc2003da34eaf55
Python
1,034
25
# 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...
934df0b026b9d1481f509ba90248515e17989fc600c5910fdf9fc62c862c6bcb
Python
1,036
38
"""Data containers, loading and saving data.""" from mrpro.data import enums, traj_calculators, acq_filters from mrpro.data.AcqInfo import AcqIdx, AcqInfo from mrpro.data.CsmData import CsmData from mrpro.data.Dataclass import Dataclass, InconsistentDeviceError from mrpro.data.DcfData import DcfData from mrpro.data.En...
91a2e4a39963cefbe6c4198d6d044aa529778165421fab480c54f300637ec36d
Python
1,037
31
# 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...
bf23d70c9eb6cb0541ec87d9b46772acf1cf652a5401e913909686df0d39ee7d
Python
1,037
29
from isaacgymenvs.pbt.launcher.run_description import ParamGrid, RunDescription, Experiment from isaacgymenvs.pbt.experiments.run_utils import version, seeds, default_num_frames kuka_env = 'allegro_kuka_reorientation' _frames = default_num_frames _name = f'{kuka_env}_{version}' _wandb_activate = True _wandb_group =...
55b506b9a567c77581a8916d53e026909bfb85c7b2d3acf2af3d949015915d8d
Python
1,038
40
import time import numpy as np from StimulationProcess.BasicStimulationProcess import BasicStimulationProcess from psychopy import visual, core, event import math class IdleProcess(BasicStimulationProcess): def __init__(self) -> None: super().__init__() def change(self): self.co...
eb346d58b2fa3b2817817a7c7985be9e97fe44844eaa6ed6ab68cf8dbcfd4fca
Python
1,039
39
from setuptools import setup, find_packages from Cython.Build import cythonize setup( name='dissect-deconv', version='0.1.1', packages=find_packages(), install_requires=[ # 'numpy>=1.19.5', # 'scikit-learn>=1.1.2', # 'pandas>=1.4.3', # 'anndata>=0.8.0', # 'h5py>=...
0b528b5770dd06f12d9800b18b6bc5321fb63eafdcd9c37a79fb7521d7a789cc
Python
1,042
29
#!/usr/bin/env python-real # -*- coding: utf-8 -*- from __future__ import print_function import sys from radiomics.scripts import parse_args if __name__ == '__main__': if sys.argv[1] == '--xml' or sys.argv[1] == '-x': with open(__file__[:-6] + '.xml', 'r') as xmlFP: # Cut off "Script" from filename prin...
3d98199c406e66998c06f77de86973466e77f1c6136afbd5f02c48b3230d13d1
Python
1,042
24
from functools import partial import pandas as pd import dask import numpy as np from single_cell_analyzer.membrane_potential_analysis import simple_spike_detection def spike_in_interval(st, tmin, tmax): return ((st>=tmin) & (st<tmax)).any(axis = 1) def _helper(x, threshold = 0): '''reads out a voltage trac...
858d583633a6422e50f772b765444364e0fc39f391c2d1e27f7de6df9ba4fc5a
Python
1,042
38
""" Tests involving custom Index subclasses """ import numpy as np import pandas as pd import pandas._testing as tm class CustomIndex(pd.Index): def __new__(cls, data, name=None): # assert that this index class cannot hold strings if any(isinstance(val, str) for val in data): raise T...
d8bf55746f90383827e3d2ed8a25e19bde0dac74c4886d12ecf3902b7cf1f565
Python
1,043
27
import os import cv2 image = cv2.imread("figure/2-1.jpg",cv2.IMREAD_GRAYSCALE) # imput origin image data zoomScale = 0.8 res_image = None res_image = cv2.resize(image, dsize=None, fx=zoomScale, fy=zoomScale, interpolation=cv2.INTER_LINEAR) # resize image blur_image = cv2.GaussianBlur(res_image,(13,13),cv2.B...
06df4b2dcec5404932eb6389a0b2a9e3559c9d05b02d01dc01039f04279e5821
Python
1,045
29
from isaacgymenvs.pbt.launcher.run_description import ParamGrid, RunDescription, Experiment from isaacgymenvs.pbt.experiments.run_utils import version, seeds, default_num_frames kuka_env = 'allegro_kuka_two_arms_reorientation' _frames = default_num_frames _name = f'{kuka_env}_{version}' _params = ParamGrid([ ('...
029d7c49e0f14b58cce25e4880d1faace7dd3197cece0eb28db9f51ae2809b27
Python
1,046
34
############################ Speed and Acceleration ############################ PIPE_VEL_X = -4 PLAYER_MAX_VEL_Y = 10 # max vel along Y, max descend speed PLAYER_MIN_VEL_Y = -8 # min vel along Y, max ascend speed PLAYER_ACC_Y = 1 # players downward acceleration PLAYER_VEL_ROT = 3 # angular speed PLAYER_FLAP_ACC...
b3332e8b2b3f0ec9e1bdec0d20d3a7442618375a1176aa177fab0b8abe78e8c7
Python
1,047
37
import os from flask import Flask, jsonify, g, request from flask_sqlalchemy import SQLAlchemy from flask_cors import CORS, cross_origin from flask_migrate import Migrate from psycopg2.extensions import register_adapter, AsIs import numpy db = SQLAlchemy() migrate = Migrate() def create_app(config_name): """Creat...
85bc4b43122798a57553646425630e8e8ba7d874d9b03646170cc21d9d544b88
Python
1,049
29
from glob import glob from os.path import basename, splitext from setuptools import setup, find_packages # from distutils.core import setup, find_packages setup( name="pgen", version="0.2.3", description="Generating new protein sequence by gibbs sampling masked protein language models", author="Sean Jo...
c16d677a964c0975351ec0d594158ba927c4f2695a5cb2fd9a39f2b305d8f025
Python
1,049
39
# 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...
75df8de001a4e53139f1568b57d36d52835d7e28ddf2fb53cfcc2c045425ee19
Python
1,051
26
import pandas as pd import os import sys 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 app import create_app, db from app.models import FileType from config.globals import ENVIRONMENT import pdb ...
03aefd242434300ce8e5a4e2c65c5f6e9dc9fc6340393aaf755c930b492571d6
Python
1,052
28
"""LLM advisory layer for the PyCaret Control Plane. Implements the router pattern from `docs/revamp/DECISIONS.md § session 13 · 3`: provider-agnostic from day one, with Anthropic (Claude) and OpenAI as two first-class backends. The ``FakeLLMProvider`` backs tests so CI never hits a real API. Every consultation retur...
0be2e50812a7cc712b839bd13138e60a1646d33d61f3adade0eab2fd605a8fc9
Python
1,052
29
"""qMRI signal models.""" from mrpro.operators.models.SaturationRecovery import SaturationRecovery from mrpro.operators.models.InversionRecovery import InversionRecovery from mrpro.operators.models.SpoiledGRE import SpoiledGRE from mrpro.operators.models.MOLLI import MOLLI from mrpro.operators.models.WASABI import WAS...
2dbb3167c3826e608e13681a03de2766688d5056563cac0ba7f9765d5966006c
Python
1,052
35
"""Install package.""" import re import os import sys import subprocess import traceback from setuptools import setup, find_packages, Command from setuptools.command.bdist_egg import bdist_egg as _bdist_egg from setuptools.command.develop import develop as _develop from distutils.command.build import build as _build ...
0045dc2d3e8b005873572537872f5b910494c9df17e3d2ce43cc321b5a789f76
Python
1,055
45
import os seqs = ['hifi', 'ont'] coverages = ['5x', '10x','20x', '40x'] input_path = "/mnt/d/workspace/svision-pro/paper_revision/run_time/pc_8_s5" # input_path = "/mnt/d/workspace/svision-pro/paper_revision/run_time/cluster_24_s5" for seq in seqs: for coverage in coverages: file_path = os.path.join(...
e13b4aba3f66355dcf724b1ae88ca0a1c96f6ce0b16541bba52089c8e5d80872
Python
1,055
32
# Copyright 2018-2024 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...
285606b198989c44d7ac6e1bb23feca0a91401313a18cd92454e47e8acf6bbbd
Python
1,056
33
"""Transforms for gradec.""" import numpy as np from neuromaps import transforms from nilearn import image from gradec.utils import _rm_fslr_medial_wall, _zero_fslr_medial_wall N_VERTICES = { "fsLR": { "32k": 59412, "164k": 298261, } } def _mni152_to_fslr(metamaps, fslr_density="32k", neurom...
3a0646fe902c3a8261bccd9d7492aef0ebcec7ba2db16315685bea32e7e7de9b
Python
1,056
41
import torch import torch.nn as nn import torch.nn.functional as F class CNN(nn.Module): def __init__(self): super(CNN, self).__init__() self.conv1 = nn.Conv2d(3, 64, kernel_size=3, padding=1) self.conv2 = nn.Conv2d(64, 128, kernel_size=3, padding=1) self.conv3 = nn.Con...
930dd2831cd7775c9c3c0e6c6eedc2e1f8cad5a4339afff9a72e4294ae6186fb
Python
1,056
24
# 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...
cd41dddf228ea94fd999831b02721309ca233aa8dab9dd6cb1c391e0c8e78c30
Python
1,057
34
from sys import path as sys_path sys_path.append('/cis/home/kstouff4/Documents/MeshRegistration/MeshLDDMMQP/master-KMS/py-lddmm/') sys_path.append('/cis/home/kstouff4/Documents/MeshRegistration/MeshLDDMMQP/master-KMS/py-lddmm/base') from base.meshes import Mesh ########################################################...
805de1600e58e5c9a1489d304ecaf0b89a8b642337f7ecd607663c25c170be1e
Python
1,058
35
# Copyright (c) 2018-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # import torch def repackage_hidden(h): """Detaches hidden states from their history.""" if isinstance(h, torch.Tensor):...
036ea3fb15e67cdb9ddb4a69588c86ab611a746ff41a1abcd5fb48b2aa48a3da
Python
1,059
40
import pickle from scipy.io import savemat import glob import os import time import sys try: # for Python2 import Tkinter as tk import tkFileDialog as filedialog except ImportError: # for Python3 import tkinter as tk from tkinter import filedialog def pickle2mat(filename, overwrite=False): matname = filename.re...
20b8bdc9860bcb75e5238b459e55a2e1a4616fc6ec8978f2d113ef02a29bb002
Python
1,059
34
"""Tests the Knoise class.""" import pytest import torch from mrpro.data import KNoise def test_knoise_to_complex128(random_test_data) -> None: """Change dtype to complex128.""" noise = KNoise(data=random_test_data).to(dtype=torch.complex128) assert noise.data.dtype == torch.complex128 @pytest.mark.cud...
800eae64d2d57ed9fb1a723c0a9e598b8a9343a3762ae4dc1897d83154122951
Python
1,059
38
# Configuration file for the Sphinx documentation builder. from scanometrics import _version_major, _version_minor, __version__ # -- Project information project = 'scanometrics' copyright = '2024-2025, SCAN-Lab' author = 'SCAN-Lab' release = '%d.%d' % (_version_major,_version_minor) version = __version__ # -- Gene...
84de909246355f343669587d52a91d4862028ee4bf56359e4eafae64167138e2
Python
1,059
34
import torch.nn as nn #diff class EMA(object): def __init__(self, mu=0.999): self.mu = mu self.shadow = {} def register(self, module): for name, param in module.named_parameters(): if param.requires_grad: self.shadow[name] = param.data.clone() def updat...
26fc48e0e3b75603b0ccfeca49e5607fd1b079f99c1c2a761aee73e6457cf0fa
Python
1,061
29
import sys with open(sys.argv[2],'r') as fin: line = fin.readline() line = fin.readline() if sys.argv[1] == '-b': while line != "": line = line.strip().split() if int(float(line[-1])) == 1: sa = line[-3] sb = line[-2] namea,alr ...
69de5d2bd5c2470cae6d1ecf22f47c3ae6a14308cee320af648fbf1e58a0d0cf
Python
1,061
32
# Copyright 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 agre...
5f27876dbe53832e5df6fbce70b61038dbcf8b4cc1c8abe25859fd314308c99a
Python
1,062
29
from sys import path as sys_path sys_path.append('..') sys_path.append('../base') from base.loggingUtils import setup_default_logging from base.kernelFunctions import Kernel from base import surfaceMatching from base import surfaces as surfaces, surfaceTimeSeries as match setup_default_logging('../Output/Temp', fileN...
15d18e57b88c67b31176d79c014427a3546ffad0372f09bc9706d42883436812
Python
1,065
33
#----------------------------------------------------------------------------- # SASA Feature #----------------------------------------------------------------------------- import os import sys import fileinput from DXGB.featureSASA import sasa def cal_SASA(out,fn,lig,pro,datadir): """ Calculate SASA features ...
801c180f470ab03f09c6192fb549accc7b7492df4d879d67ee7b658dec4c544d
Python
1,065
25
# -*- coding: utf-8 -*- import numpy as np from pydrake.all import MathematicalProgram, Solve import matplotlib.pyplot as plt from matplotlib.patches import Polygon as matplotlib_polygon import matplotlib import math from pydrake.math import sin, cos, sqrt import pickle as pkl from scipy.interpolate import interp2d imp...
24eb288bc983c58afd926ec7ed481a13857b3b6aaae957e4fe485b7f603b4f2f
Python
1,066
39
#!/usr/bin/env python from __future__ import print_function import argparse import windseer.utils as utils import windseer.nn as nn_custom parser = argparse.ArgumentParser( description='Training a neural network for predicting wind data from terrain' ) parser.add_argument('-y', '--yaml-config', required=Tru...
dbdc5579448072b534e11dcb543490fae2875860352d33aa8c1696769cab493d
Python
1,066
37
# -*- coding: utf-8 -*- import numpy as np from .red_blue import RedBlueMove __all__ = ["WalkMove"] class WalkMove(RedBlueMove): """ A `Goodman & Weare (2010) <https://msp.org/camcos/2010/5-1/p04.xhtml>`_ "walk move" with parallelization as described in `Foreman-Mackey et al. (2013) <https://ar...
0562a21ffba8b53ed27fae7b767c89ab86a053ec66e1a87dc6af383443e36f26
Python
1,067
29
# Copyright 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 agre...
c6498115649bdc6b21e0c5e6bb9dc0a4789b8801f9dd9f41a1466dc4d4c324ca
Python
1,068
44
""" pandas._config is considered explicitly upstream of everything else in pandas, should have no intra-pandas dependencies. importing `dates` and `display` ensures that keys needed by _libs are initialized. """ __all__ = [ "describe_option", "detect_console_encoding", "get_option", "option_context", ...
6a1c27a879a02941de02008cecf427d52a2487e7b60aacae7a0d099eee76ca4b
Python
1,069
30
from isaacgymenvs.pbt.launcher.run_description import ParamGrid, RunDescription, Experiment from isaacgymenvs.pbt.experiments.run_utils import version, seeds, default_num_frames kuka_env = 'allegro_kuka_reorientation' _num_gpus = 8 _frames = default_num_frames * _num_gpus _name = f'{kuka_env}_{version}_{_num_gpus}gp...
79d483f8be7492efb07c37ec88068446fba1abe1f8f9ff879cb4ed2a6846b9f0
Python
1,069
24
import sys, re, argparse, pandas as pd argparser = argparse.ArgumentParser(''' Reads a space-delimited data table and outputs only user-specified columns. ''') argparser.add_argument('-c', '--cols', dest='c', nargs='+', action='store', help='column names to output') argparser.add_argument('-x', '--exclude', dest='x', ...