sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
3915631ca2897f53be1da4b7a14478f51bcce6caeee944247d5498a15795b83a
Python
1,564
57
# coding: utf-8 # -------------------------------------------------------- # Fast R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Ross Girshick # -------------------------------------------------------- import os from os.path import join as pjoin import num...
cde8560d6b097365246f84488dcc1e17a49b05531921b486a604cf666e4a7bab
Python
1,564
46
import numpy as np def merge_overlapping_bboxes(bboxes): candidate_count = 0 while candidate_count < len(bboxes): candidate_count += 1 overlap = False candidate_box = bboxes.pop(0) for index, compare_box in enumerate(bboxes): overlapping, new_bbox = merge_if_overlap...
f5d4e51716e5ce1a90f9ff67afcc671a6ab0db6e31dbd2e91c91b9889dbd1527
Python
1,564
80
import numpy as np import math import matplotlib.pyplot as plt x = np.arange(-90, 90, 0.1) vhm = -12.8 ka = 15.8 vhw = -1.1 kiw = 28.8 aw = 0.5 bw = 0.5 vhs = -45.3 kis = 12.3 ass = 0.3 bs = 0.7 atmf = 395.3 btmf = 38.1 ctmf = 33.6 atms = 5503.0 btms = -5345.4 ctms = 0.0283 dtms = -23.9 etms = -4590 ftms = 0.0357 gtm...
13906d8c9b757b32d90a4dede84bf695790793ac49a9041cba9a32efa0582153
Python
1,565
43
import numpy as np from scipy.stats import pearsonr import h5py # 导入 h5py 库来处理 HDF5 文件 from scipy.io import savemat # 创建示例数据 N = 266484 num_runs = 60 # 初始化奇数和偶数的beta系列数组 beta_series_odd = np.zeros((N, 0)) beta_series_even = np.zeros((N, 0)) # 加载所有run的数据 for run in range(1, num_runs + 1): # 构造文件路径...
2b3d0b569878cdae704bbf99dc5c8c7d4c6ed07016967929c4eccf7c2d6e2cc6
Python
1,565
58
#!/usr/bin/env python import os from setuptools import setup, find_packages def readme(): with open('README.md') as f: return f.read() def get_requirements_filename(): if 'READTHEDOCS' in os.environ: return "REQUIREMENTS-RTD.txt" elif 'DOCKER' in os.environ: return "REQUIREMENTS-...
be8e1e637c1c16f8519bd88a517e0ffb7cc96055673cd02a040d232fe06785d5
Python
1,565
42
from torch import Tensor, flatten from elasticai.creator.arithmetic import ( FxpArithmetic, FxpParams, ) def parse_fxp_tensor_to_bytearray( tensor: Tensor, total_bits: int, frac_bits: int ) -> list[bytearray]: tensor = flatten(tensor.permute([0, 2, 1]), start_dim=1) fxp_params = FxpParams(total_b...
13a87b93fbf1aefb7581cd939f3799d14eb4d11d45eedd63b0aae61edc965284
Python
1,566
54
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, MaiaEnvironment import common_setup from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport DIR = os.path.dirname(os.path.abspath(__file__)) BENCHMARKS_DIR = o...
4a6cd76173d426206839dcd5a856ad20895c4e933074bbbee1e2f36a23aa0acf
Python
1,566
54
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, MaiaEnvironment import common_setup from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport DIR = os.path.dirname(os.path.abspath(__file__)) BENCHMARKS_DIR = o...
7874faece3656fde7e28c4b9ca42b1ce188fb6602a57025548a2f47b44156102
Python
1,566
57
import time from watchdog.observers import Observer from watchdog.events import FileSystemEventHandler from config import DIRECTORY_TO_WATCH from restore_predict import predict_restored import os class Watcher: def __init__(self, models): self.observer = Observer() self.models = models def r...
c1498f9eb1ec6739203da88272baa7f54d007134b7b1bcf9d59365bf40ceb858
Python
1,566
48
from __future__ import annotations from wikibaseintegrator.models.basemodel import BaseModel class Sitelinks(BaseModel): def __init__(self) -> None: self.sitelinks: dict[str, Sitelink] = {} def get(self, site: str | None = None) -> Sitelink | None: if site in self.sitelinks: ...
08d6c614ff11012aecc1132a0a49987487fcb6832ad94f0c4c08d9adaadf0e16
Python
1,567
34
# Perform Signal Space Projection # Mainly working from tutorial https://mne.tools/stable/auto_tutorials/preprocessing/50_artifact_correction_ssp.html # SSP uses singular value decomposition to create the projection matrix import os import mne import numpy as np import pandas as pd def apply_SSP(subject, task, sampl...
edc84504af434e92e3351d341f84b056dd3dbea568faa4a05afa09db54eb6685
Python
1,567
37
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
1c81d0ffd45521d2e836247c0aee1367f5ad568809a3eecb65dd46d211a012eb
Python
1,568
43
import datasets import lightning.pytorch as pl from hicdiffusion_model import HiCDiffusion from lightning.pytorch.callbacks import ModelSummary import os import shutil from lightning.pytorch.loggers import WandbLogger import time def main(): hic_filename = "4DNFIPNP9H9T.mcool" model_ckpt= "models/hicdiffusion_...
4577ec449e5cfa4bb1a1737953bd2e9c41b786572d7bec1c37466fad8a57b0b9
Python
1,568
44
import numpy as np from sklearn import metrics from joblib import Parallel, delayed, cpu_count def k(x, y, gamma=1.0): #return metrics.pairwise.rbf_kernel(x.reshape(-1, 1), y.reshape(-1, 1), gamma=gamma) return metrics.pairwise.linear_kernel(x.reshape(-1, 1), y.reshape(-1, 1)) #return metrics.pairwise.poly...
9f1f3900bb705bb7fdf0745d9105edbe7261f7b74be7263e8c26096206ac78bf
Python
1,568
39
import warnings import numpy as np from ase.build import molecule from ase.calculators.lj import LennardJones from sella.internal import Internals from sella.peswrapper import InternalPES def test_get_binv_rank_deficient_fallback_matches_primary(): """The _get_Binv cache-miss fallback must reproduce the SAME tr...
cb5e15e9f7c6e3d2d961bccbe0498ff527815c7e03a831fc7626dea8089a0865
Python
1,568
69
""" Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Marius Pachitariu. """ import setuptools install_deps = [ "numpy>=1.24.0", "scipy", "scikit-learn", "numba>=0.57.0", "natsort", "tqdm" ] gui_deps = [ "pyqtgraph>=0.11...
0665cc8f0ee43899b1adc5cc43aba0c91a4f118c0b4c9f1bb3b4c4a604041418
Python
1,569
45
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
9df5a4687c8855641b08571d3a0e65c2680fba23549eb6ff2aa28572259e1d57
Python
1,570
50
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment import common_setup from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport DIR = os.path.dirname(os.path.abspath(__file__)) BENCHMARKS_D...
e92900c05779cd0ffca45689d80e2e2c4aa26c729faa5fa5d8816007908b667b
Python
1,570
41
import numpy as np import nibabel as nib from regtools.registration.gui.atlas_edit_io import atlas_edit_run_template_shape, save_atlas_edit_mask def test_shape_whole_is_identity(): assert atlas_edit_run_template_shape( template_path=None, ccf_index=None, is_2d=True, atlas=None, full_shape=(40, 50),...
b6def9df49c4d96790c29382ae6585ec764906696d81df226b65d7948b9bc49b
Python
1,571
76
from invoke import task import pandas as pd @task def unpack(c): """ Unpack downloaded `tar.gz` file """ c.run("tar -xzf raw_data.tar.gz --directory data") @task def get(c): """ Download the data from the online archive """ c.run( "wget https://zenodo.org/record/3753498/files/...
200b21455fdb5cf236ad172d62cf67e2d431fbc2337c230e0c5df38fe3d29fa6
Python
1,572
37
import tensorflow as tf from pinn.optimizers.ekf import EKF, default_ekf from pinn.optimizers.gekf import gEKF default_adam = { 'class_name': 'Adam', 'config': { 'learning_rate': { 'class_name': 'ExponentialDecay', 'config':{ 'initial_learning_rate': 3e-4, ...
56e73be10a391b58196ebb0e591a845b0e45b74f62e7d0854c94f8257361b2c7
Python
1,572
41
import argparse import github import os def bioimageio_upload(resource_id: str, package_url: str): #, token:str): # Get bioimage-io/collection repodistory g = github.Github(auth=github.Auth.Token(os.environ["PAT_GITHUB"])) repo = g.get_repo("bioimage-io/collection") # Get the stage.yaml workflow (CI/G...
963bc41120c36a99a2951758989b2d21bdc885556e423754569ba9930a6f0539
Python
1,573
41
# # MIT License # # Copyright (c) 2022 GT4SD team # # 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,...
adece71a91e3e3b48a07fe4675663647bed653ddde562b62e492e4ae0e142d2b
Python
1,573
16
"""posthoc_margin_finegrid_2026-10-02.py — POST HOC (after SURVIVE P3, 2 Oct late night). The pre-registered grid of P3 (excitatory local-neuron synapses scaled by g = 1.25 ... 3, no sign changed) was too coarse: g = 1.25 already broke the lobe (34 of 50 healthy), so the test could only see the laboratory prior (g = 1)...
5eae3b9e893269f5538322fa6e888c8ab20f7eaff6fa4a61122e723b9d92bfba
Python
1,574
46
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites from common_setup_no_benchmarks import IssueConfig, IssueExperiment, get_script_dir from relativescatter import RelativeScatterPlotReport import os def main(revisions=None): exp = IssueExperiment(benchmarks_dir=".", suite=[]) exp.ad...
e268e5f6dbb5ca86466772d7786fa4862e18d9572dfb9af3d748a8fe1e08680f
Python
1,574
46
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites from common_setup_no_benchmarks import IssueConfig, IssueExperiment, get_script_dir from relativescatter import RelativeScatterPlotReport import os def main(revisions=None): exp = IssueExperiment(benchmarks_dir=".", suite=[]) exp.ad...
0d212c57e840d026c73a0972b22a4762a6b3b759f8a97a0114e2cbf8584a32a0
Python
1,575
37
import os import tempfile import unittest from torcheeg.model_selection import Subcategory from .test_utils import _make_dataset class TestSubcategory(unittest.TestCase): def test_string_numeric_and_mixed_categories_preserve_values(self): for categories in ([0, 1, 2, 3, 4], ['001', '002', '003', '004',...
cd2956892f41b2dbefb2d6df068c172d36eeade44387f2089f2a1fb274ea8948
Python
1,575
36
from typing import Callable, List, Dict, Optional import torch from torch import nn from .base import AtomicModule from ..layer import EmbeddingLayer, CutoffLayer from ..utils import _scatter_add, find_distances class TwoBody(AtomicModule): def __init__(self, embedding_layer : EmbeddingLayer, ...
21023e6be3d05d617b8c016386729c381a32d36beb01b8a72992cc13c8bb80a0
Python
1,576
44
""" Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Marius Pachitariu. """ import numpy as np from scipy.stats import zscore def grid_upsampling(X, X_nodes, Y_nodes, n_X, n_neighbors=50, e_neighbor=1): e_neighbor = min(n_neighbors - 1, e_neighbor) xy = [] n_clusters = Y_no...
ebeb79cc74b3860eaf0ddd57f92e1a5c0a7d5f8ecc6bed105eaafd057ebf3aea
Python
1,577
62
from . import datasets from . import encoders from . import decoders from . import losses from . import metrics from .decoders.unet import Unet from .decoders.unetplusplus import UnetPlusPlus from .decoders.manet import MAnet from .decoders.linknet import Linknet from .decoders.fpn import FPN from .decoders.pspnet imp...
eee3fd752de17d25c028b05f6dd8ec7b03f397aa5fb0495f88a61e1c146edd02
Python
1,578
56
""" Tests module pyto.util.scipy_plus. # Author: Vladan Lucic (Max Planck Institute for Biochemistry) # $Id$ """ from __future__ import unicode_literals __version__ = "$Revision$" import unittest import numpy import numpy.testing as np_test import scipy from pyto.util.scipy_plus import * #from ..scipy_plus impor...
224f2ed5ed6e06613d4c7a5ed779ed14923d84a70ab60bdfd87ed6232d992fee
Python
1,580
48
#!/usr/bin/env python3 import os import sys def second_newest_directory(path): dirs = [] for entry in os.scandir(path): if ( entry.is_dir(follow_symlinks=False) and not entry.is_symlink() and entry.name != "GSvarServer-current" and entry.name != "default-...
4b188ec9797f45d082ea6f6ada21b50d92516b09c9cf1ae2fc4a5189a9e75733
Python
1,581
33
from pyproteonet.data import Dataset from gnn_imputation import impute_gnn def main(): for ds_name in ['prostate_cancer']: # Remove skip connection # print('Imputing ' + ds_name + ' without skip connection') # ds = Dataset.load(f'data/datasets_imputed/{ds_name}') # impute_gnn(ds, s...
4e03b987f51c61e9febe6e5decbbce9872e1299026bbee447a2fdf0fd41af56c
Python
1,581
50
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment import common_setup from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport DIR = os.path.dirname(os.path.abspath(__file__)) BENCHMARKS_D...
6c9e518540d7849b3080b7b9c54b715667c107439b0c6f4a5f60649733f7ce5a
Python
1,581
50
import torch import torch.nn as nn import numpy as np class DensityNetwork(nn.Module): def __init__(self, encoder, bound=0.2, num_layers=8, hidden_dim=256, skips=[4], out_dim=1, last_activation="sigmoid"): super().__init__() self.nunm_layers = num_layers self.hidden_dim = hidden_dim ...
1028b6bb5080df9b5040c5fb1776b0311c683bf7e2c833b45ecf604799bc7a62
Python
1,582
50
#!/usr/bin/env python3 import logging import argparse # https://stackoverflow.com/questions/2130016/splitting-a-list-into-n-parts-of-approximately-equal-length def split(a, n): k, m = divmod(len(a), n) return (a[i * k + min(i, m) : (i + 1) * k + min(i + 1, m)] for i in range(n)) def parse(): """Split zmw...
ea84d0f16eeb0ec1b376b4b77f9722b1d3d90f1a159f28f1e3d435e0780f69d1
Python
1,582
50
"""Matching input resolution to the template leaves moving-pitch controls usable.""" import os import sys PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) if PROJECT_ROOT not in sys.path: sys.path.insert(0, PROJECT_ROOT) os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") ...
4bb0c087eb168791364c4aec32ca1174270a9389eee945cbbf2c40d124089165
Python
1,583
56
import re from typing import List, Union, Dict from ..base_transform import LabelTransform class StringToInt(LabelTransform): r''' Identify numbers in strings and convert strings to numbers. If there is no number in the string, the output corresponding to the string is 0. .. code-block:: python ...
9c4aeb1d3d5dc37f60625ee71f8a6a5c1771ccafeb41023338630a22621efa43
Python
1,583
67
from __future__ import annotations import pytest redun = pytest.importorskip("redun") from quacc import flow, job, subflow @pytest.fixture def scheduler(): return redun.Scheduler() def test_redun_decorators(tmp_path, monkeypatch, scheduler): monkeypatch.chdir(tmp_path) @job def add(a, b): ...
60fd0447c48b921df6aeb7aac6cac967c41835eb6df99ea5933401dd6477edb4
Python
1,584
66
# \file TestLinearImageQualityTransfer.py # \brief Class containing unit tests for module DifferentialOperations # # \author Michael Ebner (michael.ebner.14@ucl.ac.uk) # \date July 2016 import unittest # Import libraries import numpy as np from scipy import ndimage from niftymic.definitions import DIR_TEST # ...
8f8e29d2e502c514e2e92da8c6500cc8b3488198834e73012b35fac4351fe2ad
Python
1,584
72
from __future__ import annotations import csv from pathlib import Path from typing import Iterable def format_seconds(seconds: float | int | None) -> str: """ Convert elapsed seconds to HH:MM:SS using whole seconds. Examples -------- 0 -> 00:00:00 126 -> 00:02:06 4472 -> 01:...
f2abf6b114b2b56a3f2cc7b13f7a973113514665f0ff79ade52efc27722be6ba
Python
1,584
52
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment from downward.reports.compare import ComparativeReport import common_setup from common_setup import IssueConfig, IssueExperiment, RelativeScatterPlotReport DIR = os.path.dirname(os.path.ab...
fc2f96e3b5cdbd32305f0aa2632dff447b87308a3285bd38dd399f9ae8c92185
Python
1,584
49
import logging from pupil_recording_interface.decorators import process from pupil_recording_interface.process import BaseProcess from pupil_recording_interface.device.video import VideoFileDevice logger = logging.getLogger(__name__) @process("video_file_syncer") class VideoFileSyncer(BaseProcess): """ Syncer f...
68a6602514cc9cb5fae2916fbaa53ea24a083fac43fe24536de4dc2f46865f8f
Python
1,585
67
from __future__ import annotations import pytest redun = pytest.importorskip("redun") from quacc import flow, job, subflow @pytest.fixture() def scheduler(): return redun.Scheduler() def test_redun_decorators(tmp_path, monkeypatch, scheduler): monkeypatch.chdir(tmp_path) @job def add(a, b): ...
77351f4ba389f995c5291b013c9f4a6ea42961db13c64d853dcb5177d42f3b60
Python
1,585
52
"""Test functions for interface classes.""" import tempfile from concurrent.futures import ThreadPoolExecutor from pathlib import Path import numpy as np from console.interfaces.acquisition_data import AcquisitionData def test_acquisition_data(acquisition_parameter, test_sequence, random_acquisition_data): """T...
0c34159d7379f6ef394cb12ca365000b9f68f52e27e9c2940b5b4bdca82c820a
Python
1,586
44
import torch @torch.jit.script def gaussian(x, mean, std): pi = 3.14159 a = (2 * pi) ** 0.5 return torch.exp(-0.5 * (((x - mean) / std) ** 2)) / (a * std) # From Graphormer class GaussianRadialBasisLayer(torch.nn.Module): def __init__(self, num_basis, cutoff): super().__init__() self...
1ce98dbbaa5f8c6d1a9b1f97e8374c038a40e668af554a5947da5064952ea6e9
Python
1,586
66
#!/usr/bin/env python from __future__ import print_function import os, shutil, sys #sys.args.append('build') from distutils.core import setup, Extension # pr2_without_sensor_ik_files # python setup.py build LEFT_IK = 'ikLeft' RIGHT_IK = 'ikRight' LIBRARY_TEMPLATE = '{}.so' # might need to be '{}.pyd' on windows l...
d9338c11fbcdc05e6be7d616fbb5b0287d531b48738ffff303005a79ae3a6a33
Python
1,586
45
import pandas as pd import pickle as pkl from Bio import Align utr_data = pd.read_csv('/fast/AG_Ohler/frederick/projects/mlcis/data/riboseq/calviello_te_processed.csv') mrl50 = pd.read_csv('/fast/AG_Ohler/frederick/projects/mlcis/data/mrl25to100/GSM3130443_designed_library.csv').drop('Unnamed: 0', axis=1) mrl50 = mrl...
803f5ed9536986dbd8151839888fdd2902a238595832993845cee7cc380ff815
Python
1,587
48
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment import common_setup from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport DIR = os.path.dirname(os.path.abspath(__file__)) BENCHMARKS_DI...
d0caf0d13e8c69cfd6b011fcb3aad8e32eb6a83e55199e7d88b2d31ffff65d58
Python
1,587
57
import numpy as np import os import torch from .base import AtomsDataset from typing import List, Optional from ase import Atoms __all__ = ["RevisedMD17"] class RevisedMD17(AtomsDataset): file_names = [ "aspirin", "azobenzene", "benzene", "ethanol", "malonaldehyde", ...
f37e32c021db348eb241cb02bf5c02d2c67f0de8f43125afc0e2c7c2963b75a3
Python
1,587
47
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment import common_setup from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport DIR = os.path.dirname(os.path.abspath(__file__)) BENCHMARKS_DI...
4ff1761b2670c674c61be925f0f181b2d36839bddef5232417e7ec7cc990fb09
Python
1,588
49
"""Headless checks that the Parameters tab exposes N4 properties. Constructing the QWidget needs a QApplication, so we introspect the class and its source instead of instantiating it (mirrors the Qt-free style of test_registration_cli_args.py). """ import inspect import pytest def _params_tab_cls(): ...
9ebf950d1cea007d273c4ae6919f3116dd9a291dfc7722dd605ecba1b9c2cada
Python
1,588
52
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
a61214ef78f6b8e4eee8abbde9f82b62d7a03e87e51c449d3f43cb81f2dd7800
Python
1,588
52
from __future__ import annotations import pytest sella = pytest.importorskip("sella") from ase.build import bulk, molecule from ase.calculators.emt import EMT from ase.calculators.lj import LennardJones from ase.io import read from sella import Sella from quacc.runners.ase import Runner def test_sella(tmp_path, mo...
b4fc69ea787db65e7131f90d1f522e1facb4bd5bddca87afb47deddd5ac5028f
Python
1,588
40
""" Created on Mon Jul 17 13:14:11 2023 @author: trianaa1 """ import os, glob import pandas as pd path = "/m/cs/project/networks-pm/behavioral" savepath = "/m/cs/scratch/networks-pm/effects_externalfactors_on_functionalconnectivity/data/behavioral" files = [] pattern = f'*device-smartphone*' for dir,_,_ in os.wal...
cb2ceb2123a0ba86fe318842c96e67c09db6014e64f54a7277ae8267985f8b0d
Python
1,588
41
#!/usr/bin/env python3 import os import pandas as pd from itertools import combinations # ------------------------------------------------------------------ # paths # ------------------------------------------------------------------ projpath = "/project/3011157.03/Simon/proj_2022_CABB_movie" subjlist_path = os.path.j...
e0c9ed29cb4621cba1341be57ddc1d9a386ec4de278e629293decbb1b171ea93
Python
1,588
40
import torchaudio from speechbrain.pretrained import Tacotron2 from speechbrain.pretrained import HIFIGAN import simpleaudio # # Intialize TTS (tacotron2) and Vocoder (HiFIGAN) # tacotron2 = Tacotron2.from_hparams(source="speechbrain/tts-tacotron2-ljspeech", # savedir="tmpdir_tts") #...
e9d39c7930c00a2b4e783039957f50505e4ac64d4f0bb7388c56f5a24ec56981
Python
1,588
54
"""Experiment to acquire a spin echo spectrum.""" # %% import matplotlib.pyplot as plt import numpy as np import console from console.interfaces.acquisition_data import AcquisitionData from console.spcm_control.acquisition_control import AcquisitionControl from console.utilities import sequences # Create acquisition ...
881c433f870edf77487d6dde77ce0d51a13f2fcf795d9cde77d399e068acccba
Python
1,589
45
from codex.configuration import RedirectHomeError from codex.data.local_data_loader import unpickle_neuron_db, DATA_ROOT_PATH from codex.data.versions import DEFAULT_DATA_SNAPSHOT_VERSION, DATA_SNAPSHOT_VERSIONS from codex import logger # Singleton _instance = None class NeuronDataFactory(object): def __init__(s...
8d20b523a85625e07809227233a8faf1c2e0cbe3dea9d86d6c0abaca8ab1b142
Python
1,589
45
#!/usr/bin/env python3 import os import pandas as pd from itertools import combinations # ------------------------------------------------------------------ # paths # ------------------------------------------------------------------ projpath = "/project/3011157.03/Simon/proj_2022_CABB_movie" subjlist_path = os.path.j...
c7faf5c13b8195733454dd674b8f1f2adbe24390f88aae1fa6be75be2c96028b
Python
1,589
45
# -*- coding: utf-8 -*- """ """ import scipy.stats as stats import matplotlib.pyplot as plt from scipy.io import loadmat, savemat import numpy as np import os if __name__=='__main__': pwd_current = '%s/' % os.getcwd() pwd_data = '%sdata/' % pwd_current if not(os.path.isdir('%sfigures' % pwd_cur...
93f9605dcb097604bd1ac39d5bd66628a9e23910b3b103a73ae05fb6869b0255
Python
1,590
43
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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 # # ht...
dcb28b0cf90fe032f355e9266e2343c3230281d90cb3a5086be80935379a39e8
Python
1,590
48
import os from collections import defaultdict from torch.utils import data as torch_data from torchdrug import data, utils from torchdrug.core import Registry as R @R.register("datasets.MOSES") @utils.copy_args(data.MoleculeDataset.load_csv, ignore=("smiles_field", "target_fields")) class MOSES(data.MoleculeDataset...
37ae6d922c9d1b44e9d493d6e8a28a4e83af81938d1196f6276579d5522ae19c
Python
1,591
56
"""Base jobs for Psi4.""" from __future__ import annotations from typing import TYPE_CHECKING from ase.calculators.psi4 import Psi4 from quacc.runners.ase import Runner from quacc.schemas.ase import Summarize from quacc.utils.dicts import recursive_dict_merge if TYPE_CHECKING: from typing import Any from ...
59970564b80ceb348c7315b0bcf493026a767a741e9c16cc88e5d9db63fcef7c
Python
1,591
45
import pandas as pd import numpy as np import rpy2.robjects as robjects import os fitdistPath=os.path.join(os.path.dirname(__file__), "fitdistrplus/fitdist.R") quantilePath=os.path.join(os.path.dirname(__file__), "fitdistrplus/quantile.R") def main__DBLsMark_wEmpty(DBLmetricsDF, FullDrops): ''' Iterating over ra...
b100149f2dd33550f3831ab88063ae1bb4b96f2d39b4ffd382fab629cd0bdc6f
Python
1,591
37
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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 # # ht...
e64ec5f55838789203e6727d9e5693576d72f7b0801a252bb9a2484ec4e72727
Python
1,591
57
import argparse def add_subparser_args(subparsers: argparse) -> argparse: '''Add tool-specific arguments. Args: subparsers: Parser object before addition of arguments specific to `preprocess`. Returns: parser: Parser object with additional parameters. ''' subparser = s...
fc2185713cb24d82009f758fa144e610859f79402cb8a1e1f5cf5b593c3a00f3
Python
1,591
44
#!/usr/bin/env python3 import pandas as pd from pathlib import Path # ------------------------------------------------------------------ # Paths # ------------------------------------------------------------------ base_dir = Path("/project/3011157.03/Simon/proj_2022_CABB_movie/MRI") subjectlist_file = base_dir / "su...
8e18ed69e9df84db66f1a658960400f576fe1bbf1755d4d23c4c32fed4f2ac53
Python
1,593
60
import pdb from typing import Dict, List, Callable from ..base_transform import BaseTransform class PDB(BaseTransform): r''' For debugging, insert breakpoints in transforms. The transformation itself does not change the input data. .. code-block:: python from torcheeg import transforms ...
2f8f383ea67b54a7f9a0bfee149cc94cea524a8e6cc67bc9a4e4a5ba8ba3b4c1
Python
1,594
43
"""Re order the empatica files and name it using the pre-established convention. This script will unify the different measurements splitted in several files into one dataframe per day. The dataframe is stored as a csv file. The input should be done in the following order: Parameters --------...
660b604eab1c21364588590988ee99da83f739bde71738f0dc4a4542dad354a8
Python
1,594
52
""" This script visually test the deconv layer. Construct an MLP with conv ,and deconv layer, set their W to same values and show the original input and the output of the mlp side by side. They are supposed to look same. """ import theano from adversarial.deconv import Deconv from pylearn2.datasets.mnist import MNIST...
dacf9531092d9728e3f3858e4ca144af41218536c585c447d68057639afe18a7
Python
1,594
57
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """Logging.""" import time import os import logging import functools import sys from fvcore.common.file_io import PathManager @functools.lru_cache(maxsize=None) def _cached_log_stream(filename): return PathManager.ope...
1d7b396793719edd5862ca8a84b280bde3b4bcb55f62fdecb1a85be83e93ffb6
Python
1,595
49
# This script runs the pipeline on all folders in a directory import warnings import os warnings.filterwarnings("ignore") os.environ["TF_CPP_MIN_LOG_LEVEL"]="2" # Here you can choose which GPU to use os.environ["CUDA_VISIBLE_DEVICES"]="0" import cryovesnet dataset_directory = "/mnt/data/amin/Handpicked/" dataset_dir...
f71d6068af37cd57d68ee5d9443aed9424811a7a5493ce943e246b5ee7c3d9d0
Python
1,595
66
#!/usr/bin/env python from __future__ import print_function import os, shutil, sys #sys.args.append('build') from distutils.core import setup, Extension # pr2_without_sensor_ik_files # python setup.py build LEFT_IK = 'ikLeft' RIGHT_IK = 'ikRight' LIBRARY_TEMPLATE = '{}.pyd'#'{}.so' # might need to be '{}.pyd' on w...
4810ba22f5c7acc2709cc0f08d8e97d5cd8bcf70c72ac2ab0e9ab2a82ce6d09f
Python
1,596
57
from ray import tune def _tune_config(params, cli_report_columns=[]): result = {} for key, val in params.items(): if isinstance(val, dict): # not an end-point val, _ = _tune_config(val, cli_report_columns) if not val: # continue if ...
8340dc0fe5f054febce468e9601b14a469aad06582a3679a1cf9acd40e8189b9
Python
1,596
57
import os import re from setuptools import setup, find_packages from setuptools.command.install import install __pkg_name__ = 'bonito' verstrline = open(os.path.join(__pkg_name__, '__init__.py'), 'r').read() vsre = r"^__version__ = ['\"]([^'\"]*)['\"]" mo = re.search(vsre, verstrline, re.M) if mo: __version__ = ...
eff02b81abf05aaa4b3e182b42028a64c39ba62f79f70c575add660521d11202
Python
1,596
46
"""Progress-queue engine tests for installer.wizard: run_steps() is a pure, module-level function driven with a real queue.Queue and fake Steps - NO threads, NO tkinter mainloop. Kept in its own module per the smoke-test isolation convention (see test_wizard_smoke.py).""" import os import queue import sys _R...
78db3093469f68af5a00f1f6279cd2595e805101f82ef643a2fc126edce2f47e
Python
1,597
50
# -*- coding: utf-8 -*- from __future__ import print_function import logging import sys from . import aliases from . import arguments from . import cleanup from . import run_components def main(): args = arguments.parse_args() logging.basicConfig(level=getattr(logging, args.log_level.upper()), ...
c8b73d3e93a2770d079e1ef466a5076767de0acf2d57e1dbbbd3c206b8fc47f5
Python
1,597
50
import sys from cuppa.runners.args import RunnerArgParser from cuppa.runners.prediction_runner import PredictionRunner from cuppa.runners.training_runner import TrainingRunner class TestRunnerArgParser: def test_can_add_and_parse_one_arg(self): sys.argv = [ "example_module.py", "...
49b959a0f9b929e47ff36a89e4738df63f16f8d8f0902b8e2d85c944262ac6ce
Python
1,598
42
"""Regression guard for the gain-compensation name-shadowing bug. The module does ``from . import gain_compensation`` (the module). The standalone ``__main__`` block used to also do ``gain_compensation = args.gain_compensation`` (a bool) at module/global scope, which rebound that global. ``compute_gain_field`` ...
661241694b2dcf8547ca9c7ce6249bfc7a34ccfeb3fc81bb505a1723100cca8f
Python
1,598
59
import os from flask import Flask, request, redirect, url_for from codex.blueprints.app import app from codex.blueprints.base import base from codex.data.neuron_data_factory import NeuronDataFactory from codex.configuration import RedirectHomeError from codex import logger import logging # Set logger level logger.se...
9dc37d07f6866140d54075aff8425518224d4b55f7b8420e43b73f283fc93ca4
Python
1,598
60
"""Module with helper functions for plotting """ from vispy.app import Application from PyQt5.QtWidgets import QApplication app = Application('pyqt5') from vispy.scene import SceneCanvas, TurntableCamera from vispy.visuals import Visual from vispy.scene.visuals import create_visual_node from vispy.geometry import cre...
1c6ff43ce25b4fac78517c9dad275171c73672e877f4e4a2512187484228823d
Python
1,600
51
import os from torch.utils import data as torch_data from torchdrug import data, utils from torchdrug.core import Registry as R @R.register("datasets.Stability") @utils.copy_args(data.ProteinDataset.load_lmdbs, ignore=("target_fields",)) class Stability(data.ProteinDataset): """ The stability values of prot...
f6e8938f5d927d93e38bc7c4843e63e4876512a1f127d6847b4f986dc7d3c4e1
Python
1,600
60
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
4d26d1996cd3736eb0d2082c5756f15697960c1f10348adeeadc1897b1886411
Python
1,601
43
class BaseReporter(object): """Delegate class to provider progress reporting for the resolver.""" def starting(self): """Called before the resolution actually starts.""" def starting_round(self, index): """Called before each round of resolution starts. The index is zero-based. ...
9ea79041785a10b9d4e463f45046fb0baec2bbbe27d95608ad485e1da7e10629
Python
1,601
44
#!/bin/env python3 ''' Define a Feynman diagram ''' import pdlfeynman as fy import yaml diagram = fy.diagram.Diagram() x = 1 n00 = fy.diagram.Node.Reaction(time=x, reaction=fy.particle.growth.pair_production) diagram.add_node(n00, x=x, y=0) x += 1 n10 = fy.diagram.Node.Reaction(time=x, reaction=fy.reaction.growth_de...
cc91f0c0487ae44b508e57f43ab3cc00d658a4e79e2f1ceda95e2ea631bd7709
Python
1,601
68
"""raw.py - read and write .raw files """ import numpy as np def raw_imread(path): """Read a .raw file :param path: path to the file :returns: a Numpy read-only array mapping the file as an image """ as_uint32 = np.memmap( path, dtype=">u4", mode="r", shape=(2,)) wid...
2759cb98c7da06ce46991a51eebc125b46c66a09cd02502803f57a59adfa6aa9
Python
1,603
50
"""Atlas segmentation - port of utils/atlas_segmentation.m.""" from __future__ import annotations import numpy as np from skimage import feature from .edges import largest_connected_component, canny_edge def atlas_segmentation(image: np.ndarray) -> np.ndarray: """Extract registration contours from a...
02af20d5d715f9aa85bdc2c7ce33cc1600446bedffcd3ced0a59e6f89e431c6a
Python
1,604
58
from dreamcoder.program import * from dreamcoder.type import * def _addition(x): return lambda y: x + y def _subtraction(x): return lambda y: x - y def _division(x): return lambda y: x / y subtraction = Primitive("-", arrow(tint, arrow(tint, tint)), _subtraction) ...
afdc4c15e52f46690371797fefd532cd847a2d9417178ebed16f68b2b8d20330
Python
1,604
60
from __future__ import annotations import pytest from quacc import job from quacc.wflow_tools.customizers import customize_funcs def test_basic_customizers(): def add(a, b=1, c=2): return a + b + c def mult(a, b=1, c=2, d=2): return a * b * c * d add_, mult_ = customize_funcs( ...
b449089fbb1965244159aa76e477ff50fa36e93cec8576b465fae4459bbf2a2b
Python
1,604
48
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
57c9ad3962d3349b582d6fb3f248e20b517474f50dd39a284288af3758d8a0f5
Python
1,605
48
# ---------------------------------------------------------------------------- # Contributors: Thiago O. Bezerra # Antonio C. Roque # ---------------------------------------------------------------------------- # File description: # # Run all simulations specified in text files from the Input direct...
ae9a809a9bd82665799b95e32df5e47af6627438910217807bb39639997815d9
Python
1,605
55
# -*- coding: utf-8 -*- from setuptools import find_packages, setup setup( name='supar', version='1.1.4', author='Yu Zhang', author_email='yzhang.cs@outlook.com', license='MIT', description='State-of-the-art parsers for natural language', long_description=open('README.md', 'r').read(), ...
69f011e21be7b8355f5dfb889846102479d4802e162e5700d16b31d0e32fb87f
Python
1,606
45
import pandas as pd import pickle as pkl from Bio import Align utr_data = pd.read_csv('/fast/AG_Ohler/frederick/projects/mlcis/data/riboseq/calviello_te_processed.csv') mrl50 = pd.read_csv('/fast/AG_Ohler/frederick/projects/mlcis/data/mrl25to100/GSM3130443_designed_library.csv').drop('Unnamed: 0', axis=1) mrl50 = mrl...
acee1b177ffb039c56e0f15891b2899a89c5ca73907baa73d85f44515f419f7a
Python
1,606
46
"""Unit tests for the SSC (Self-Similarity Context) descriptor generator.""" import os import sys PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) if PROJECT_ROOT not in sys.path: sys.path.insert(0, PROJECT_ROOT) import numpy as np import pytest from regtools.registration....
54d92bbc65e365d19ad4da34dc0e5cf9d025fa809865771ebae5fd1ec23c16eb
Python
1,607
70
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Author: Maximilia F. S. Degenhardt <frazaodesouzam2@nih.gov> Hermann F. Degenhardt <degenhardthf@nih.gov> """ import os, sys, math sys.path.append("../src") from hornet.uml import uml_analysis def help(): return """ uml.py: Run the UML approach f...
696b4092631b9b8e081dc7d03960355f6a2182f110b40880088c24c2154d908b
Python
1,607
46
# Defining color-blind friendly color palettes import tol_colors as tc cmap_iridescent = tc.tol_cmap("iridescent") cset_bright = list(tc.tol_cset("bright")) cset_light = list(tc.tol_cset("light")) cset_vibrant = list(tc.tol_cset("vibrant")) cset_high_contrast = list(tc.tol_cset("high-contrast")) cset_muted...
a50a253766ae2b47c408f49efb588ca793877d51bc1711c3bcb085d13c747944
Python
1,607
47
import numpy as np from pandas import read_json from .deprecation import deprecated from .model_assembly import ( CompartmentContainer, ParameterContainer, ReactionContainer, SpeciesContainer, ) from typing import Union from pathlib import Path __all__ = ["json_to_ObjectContainer"] @deprecated def js...
bbdb704ca0b961ef47ee960e2be77779ee0d99eaf262e585fbd52b6313015cb8
Python
1,607
34
# -*- coding: utf-8 -*- import os import supar from supar import Parser def test_parse(): sents = {'en': ['She enjoys playing tennis.', 'Too young too simple!'], 'zh': '她喜欢打网球.', 'de': 'Sie spielt gerne Tennis.', 'fr': 'Elle aime jouer au tennis.', 'ru': 'Она ...
21f56622a01f6bdd78f306c11b73644d92c00d166147190d44ae9a2c130eb56d
Python
1,608
65
import pandas as pd from sklearn.compose import make_column_selector from tests.mock_data import MockTrainingData from cuppa.components.feature_selection import Chi2FeatureSelector class TestChi2FeatureSelector: X = pd.DataFrame([ [10, 0, 0, 0], [10, 1, 0, 0], [10, 0, 0, 0], [0,...