sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
85063b38ae5b2e1dce44bbcdcf224d4c901dfcff4b0799480d52871aad576a99
Python
2,227
78
# from torch.dataloaders.preprocessing import Dataset # import torch # import numpy as np # import os # # from constants import DATA_DIR, BIN_LOCATIONS_DENSE, BIN_LOCATIONS # class ROCFDatasetRegression(Dataset): # """Face Landmarks dataset.""" # # def __init__(self, df_metadata=None): # """ # ...
1ec16097e15460b7b8bd64a671aa11b8c697f26c4fb62242c7989e3254252565
Python
2,228
68
from .bace import BACE from .bbbp import BBBP from .cep import CEP from .clintox import ClinTox from .delaney import Delaney from .freesolv import FreeSolv from .hiv import HIV from .lipophilicity import Lipophilicity from .malaria import Malaria from .moses import MOSES from .muv import MUV from .opv import OPV from ....
68011293af6cd2cde11819e2caa9b56a63ebd7ca91410bc36baf22d0bc6cca13
Python
2,228
52
"""Regression: the custom-atlas hemisphere status must not raise NameError. ``_resolve_hemisphere_plane`` returns ``(plane, status_text)`` for the current template. Its custom-atlas branch - reached when the user has DRAWN a midline on a custom template and the run can read it back - built its status by appending ...
e884935430145a9d00cf9c55e38fa5bee15c6f2f2de0be52ccd9a651d242334e
Python
2,228
76
from pathlib import Path from typing import Any import elasticai.creator.ir2verilog as ir from elasticai.creator.file_generation import find_project_root as get_path_to_build from elasticai.creator.ir import Registry, attribute from elasticai.creator.ir2verilog import Ir2Verilog, factory def _load_and_plugin( ty...
fdad7606953bef56af7f153f805eb531b49445826e3f5213febc9e74c292dd51
Python
2,228
43
import numpy as np import pandas as pd import os import sys import subprocess def do(cmd, get=False, show=True): if get: out = subprocess.Popen(cmd,stdout=subprocess.PIPE,shell=True).communicate()[0].decode() if show: print(out, end="") return out else: return subpro...
2ef15754613ff778170e49fa58ed6681ec65cfc77a1f70322371de3e437416dc
Python
2,229
66
from __future__ import division import numpy as np class DiscreteProcessEstimator(object): """ This class estimates the emperical distribution of a discrete random variable over time. It forgets the distribution with a user-specified time constant. """ def __init__(self, num_states, sample_rate,...
49fdd088d051ad68fc771ef0760e4e2fafd462079bdaebcad4ae05e57a30bc28
Python
2,229
64
import torch import torch.distributed as dist import torch.nn as nn import torch.nn.functional as F from collections import OrderedDict class MLP(nn.Module): def __init__(self, in_channels=1, out_channels=3, feature_channels=12, dropout_prob=0.2): super().__init__() self.in_channels = in...
93f629ebe7d193347eb86849dddc0548fc26334444181677e1bff9b513ebaa3c
Python
2,229
72
import torch from torch import nn from typing import List, Optional, Dict from .base import CutoffLayer, EmbeddingLayer from ..utils import find_distances, _scatter_add, EnvPara __all__ = [ "AtomicOneHot", "AtomicNumber", "AtomicEmbedding", ] class AtomicOneHot(EmbeddingLayer): def __init__(self, ele...
b6877a484ce058dc46d329b6763e03f0790db2a0f12c70804336ecfcf3119f29
Python
2,229
52
from scipy import linalg from sklearn.covariance import EmpiricalCovariance,LedoitWolf import numpy as np def partial_corrconn(activity_matrix,estimator='EmpiricalCovariance', target_ts=None): """ activity_matrix: Activity matrix should be nodes X time target_ts: Optional, used when only a s...
016c6f38beae057ba0ef7e4b063e35a68d75b34de3d08d0fafa62b23d9a355d8
Python
2,230
52
import read_files import write_files import data_handler import offline_prep as prep import online_use as use import main_config as conf import printer if __name__ == '__main__': # create files in results to save optimal parameters achieved by offline preparation if conf.MODE == 'I': write_files.init_...
77dce424918a35a9bf3814c423b28d8f7f68494140ab0442784f2e7af87e2a43
Python
2,230
54
#!/usr/bin/env python import os import pandas as pd ## location of main project directory on HPC proj_path = '/project/3011157.03/Simon/proj_2022_CABB_movie/' ## location of R output files to visualize r_path = os.path.join(proj_path, 'Scripts', 'MovVar_CommsBio_Revision01', 'control_length','r_output') ## location wh...
8453fe0fd38c14fefdf42c2ee207ad643d8a74720ceaa6ff78e434e19aa81e84
Python
2,230
80
import numpy as np from .basic_euclidean import eucl_dist, eucl_dist_traj from .basic_spherical import great_circle_distance ###################### # Euclidean Geometry # ###################### def e_erp(t0, t1, g): """ Usage ----- The Edit distance with Real Penalty between trajectory t0 and t1. ...
a1165531bc52a372d524c089eab88d292de577b380017e4f4ba886dced8dbb2f
Python
2,230
82
from __future__ import annotations import pytest from ase.atoms import Atoms from quacc import get_settings from quacc.calculators.mrcc import mrcc from quacc.calculators.mrcc.mrcc import ( MRCC, MrccProfile, MrccTemplate, _get_version_from_mrcc_header, ) MRCC_EXECUTE = MrccTemplate.execute def tes...
bdbcc8cef41f83882788be7513d6c2102130697298b369dff9265b26489d7772
Python
2,230
51
"""Real-pair parity guard: matched ``affine`` split vs fused ``default``. Guards the spec claim that ``--affine_method affine`` (explicit affine pass + SyNOnly) reproduces the fused ``default`` path (``ants.registration(type_of_transform=...)`` unchanged) within ANTs run-to-run non-determinism. This is a real-data...
0233ee2c3030e5b536e13213fa4094358b62033f075fcd301c255e1b497fe383
Python
2,231
50
import os.path import re from collections import defaultdict from ckg.graphdb_builder import builder_utils def parser(databases_directory, download=True): config = builder_utils.get_config(config_name="gwasCatalogConfig.yml", data_type='databases') url = config['GWASCat_url'] entities_header = config['ent...
cefabf97029abb5a49fac310b6cc1543aa0159eac17d25a5b578b52cead09ace
Python
2,232
68
"""Run plotting --------------- Create plots of the network activity of the mesocircuit. """ ############################################################################### # Import the necessary modules. import os import sys import numpy as np import h5py import mesocircuit.mesocircuit_framework as mesoframe import...
50ab9cd1ed3742b2b20a8d6eca0406e21fc7943a0ef220f79df0b40162f06c87
Python
2,233
58
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, MaiaEnvironment from common_setup import IssueConfig, IssueExperiment, is_test_run BENCHMARKS_DIR = os.environ["DOWNWARD_BENCHMARKS"] REVISIONS = ["issue657-v2", "issue657-v3"] CONFIGS = [ IssueConfig(heuris...
e32695be3ce0baa7c6691014930e01d84125b7d866d754901ff1ca25eb150a9f
Python
2,233
96
# Node-group asset "LCh to OKLab" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump. from typing import TYPE_CHECKING ...
f521367ee91ac31f1d8729f69c321de1c273c50be42e2b6e43161a3fc93857f3
Python
2,233
58
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, MaiaEnvironment from common_setup import IssueConfig, IssueExperiment, is_test_run BENCHMARKS_DIR = os.environ["DOWNWARD_BENCHMARKS"] REVISIONS = ["issue657-v3", "issue657-v4"] CONFIGS = [ IssueConfig(heuris...
3fe52db7c86f30692425dc3b54fcd9d34ba28de03d76885408c4dc0db6de4245
Python
2,235
88
import functools import operator import itertools from .errors import OptionError from .extern.jaraco.text import yield_lines from .extern.jaraco.functools import pass_none from ._importlib import metadata from ._itertools import ensure_unique from .extern.more_itertools import consume def ensure_valid(ep): """ ...
33f3b70d5756c42e8a5d345d7144cd458d5f1a67d3021fb567b4f145ce993b77
Python
2,236
61
# coding=utf-8 # Copyright 2018 The HuggingFace Inc. team. # # 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...
897d2f81cd5a76e97aea4cb136906b73831403684df2cb17a95d42e84a8abb24
Python
2,236
70
# 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...
90a19989ce9c260a37e92cd52a9322a615895f9c76cfd56924e0084a24257fc7
Python
2,236
53
# ---------------------------------------------------------------------- # Copyright (C) 2015, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This program is free software: you can redistribute it and/or mo...
c1ad391d3527fd2f5c9601dcddf70610f5a95b0bdda44430765a999e73638bf6
Python
2,236
56
# Copyright (c) 2020, Ko Sugawara # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and t...
ded51532c4c5e51970901e458b1230b51c5a0d964710023d2c0c4b2368c5fec0
Python
2,236
71
from typing import Any, Callable import elasticai.creator.ir as ir from elasticai.creator.ir2vhdl import ( Instance, LogicSignal, LogicVectorSignal, NullDefinedLogicSignal, Signal, ) from elasticai.creator.ir2vhdl import ( Node as VhdlNode, ) from .node_factory import ( InstanceFactoryForC...
44352ebcca8534b1fb20acf383211c8676947b33fecb8729c747ed85999df617
Python
2,237
54
#!/usr/bin/env python import os import pandas as pd ## location of main project directory on HPC proj_path = '/project/3011157.03/Simon/proj_2022_CABB_movie/' ## location of R output files to visualize r_path = os.path.join(proj_path, 'Scripts', '04_2ndLev_ISRSA','r_output') ## location where visualizations and niftis...
6aca20f0963612288606bf1b8d2cc7a2275a809bad0432302ebe35dd178fedfe
Python
2,237
92
import os import sys import numpy as np import argparse def check_actg(seq): ret = "" for x in range(len(seq)): if seq[x] not in "ACTG": ret = ret + seq[x] return ret def seq2kmer(seq, k): kmer = [seq[x:x+k] for x in range(len(seq)+1-k)] kmers = " ".join(kmer) return kmers ...
85512abae61e045b5f70eb4f7589d4b379f0bc7e180636c6e668d4a5e9b6d3b0
Python
2,237
71
"""Testing CLI command measure.""" import os import subprocess def test_measure(): """Tests for morphometric mesurements.""" os.chdir(os.path.dirname(__file__) + '/data') proc = subprocess.Popen(['swc', 'measure', 'pass_simple_branch.swc', '-a', 'path', 'sholl'], ...
8a9eff6f62d4e3427f2bbdef5bc81882baad61f87c0e4d0fe0a11dd981fb24de
Python
2,238
62
import math import pytest import smart def test_Species_initialization(species_kwargs_A): """Test that we can initialize a SpeciesContainer""" A = smart.model_assembly.Species(**species_kwargs_A) assert A.name == species_kwargs_A["name"] assert A.latex_name == species_kwargs_A["name"] assert str...
9c42e05fbedba4f8e6b24d932ff301817b709b2af5f936ae7069e880901e5c27
Python
2,238
56
import os import pandas as pd from collections import defaultdict from ckg.graphdb_builder import mapping as mp, builder_utils def parser(databases_dir, download=True): config = builder_utils.get_config(config_name="goaConfig.yml", data_type='databases') url = config['url'] rel_header = config['header'] ...
2e30f04191898a5d7fbd7be105e48c8fd3e3fc7f58c26ebe3fa266acdccf347e
Python
2,239
58
import os import tempfile import unittest import numpy as np import torch from torcheeg import transforms from torcheeg.datasets import DEAPDataset from torcheeg.io import EEGSignalIO from torcheeg.models import FBMSNet, ViT class TestInputValidation(unittest.TestCase): def test_label_input_type_is_checked(self...
e607cc1cd1f9d40a7bc0f02e75f2a0ae5013db51312528ead5e59543c6e41a67
Python
2,239
74
# # 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,...
30efb26ca2d62cc8dbd651f9bc368bb0dc9713f8d6a98b18859303d9b5a6ee7e
Python
2,240
61
import os import random import unittest import shutil from torcheeg.io import MetaInfoIO class TestMetaInfoIO(unittest.TestCase): def setUp(self): shutil.rmtree('./tmp_out/') os.mkdir('./tmp_out/') def test_init(self): io_io_path = f'./tmp_out/{"".join(random.sample("zyxwvutsrqponmlk...
3c22486f2bc298a5bc13401bcdd2d3d6bfbd79697c34e0abe932371c10ca1e51
Python
2,240
85
import numpy as np # registration from pystackreg import StackReg # parallel processing from joblib import Parallel, delayed, parallel_backend def get_tmats(arr, reg, n_bin=1): """Get transformation matrices for frames in array Apply one of the methods in pystackreg.StackReg to align frames in array to...
fae93cb90bc5466104432ad669d6ceaa6b87a0912dfe96e961deb90fa32f9727
Python
2,240
70
# flake8: noqa # There's no way to ignore "F401 '...' imported but unused" warnings in this # module, but to preserve other warnings. So, don't check this module at all. # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use thi...
83deed7a06fc032f4e6c7d43c5178a0a49b39e0d3035d66edf0fdaa7ccdb5de6
Python
2,241
63
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites from downward.experiment import FastDownwardExperiment from downward.reports.compare import CompareConfigsReport from relativescatter import RelativeScatterPlotReport import common_setup REPO = common_setup.get_repo_base() REV_BASE = 'issue58...
d34611e8de1757262ffbf64ebdbb16eb550101ab64c13b916a9ae6f55c19e982
Python
2,242
75
#!/bin/env python3 """ Example script: calculate phases and find phase defect lines (PDLs) """ import ithildin as ith import numpy as np import matplotlib.pyplot as plt # plotting preparations: subplots in 2 rows and 2 cols fig, ((ax00, ax01), (ax10, ax11)) = plt.subplots(2, 2, figsize=(11,9), dpi=360) # load data pr...
39c6f110287136241004156edfecc65321ade8c5cc1733ddfd57f315d309cb07
Python
2,243
68
""" Tests for CALIB module FIXME need satrecov tests FIXME need sensitivity correction tests FIXME need test with edge correction """ import os import pytest import numpy as np from fsl.data.image import Image from oxasl import Workspace, reg, AslImage, brain def get_wsp(): wsp = Workspace(debug=True) wsp....
2ce4c295d426a8c588c6a6989475d3166b69d3aeeafd4ca711212f5015398f7b
Python
2,244
66
""" Bonito basecall """ import torch import numpy as np from functools import partial from bonito.multiprocessing import process_map from bonito.util import mean_qscore_from_qstring from bonito.util import chunk, stitch, batchify, unbatchify, permute def basecall(model, reads, beamsize=5, chunksize=0, overlap=0, ba...
aa15502e642a1146d836297192a362d0dd47fe407092752e4b731323966f3033
Python
2,244
90
# -*- coding: utf-8 -*- # # Top-level interfaces for the plotting functionality # from syncopy import __plt__ from syncopy.plotting.config import pltErrMsg from syncopy.shared.errors import SPYWarning __all__ = ["singlepanelplot", "multipanelplot"] def singlepanelplot(data, **show_kwargs): """ Plot Syncopy...
eb1c4b93cf050fa68eb2cab20b4430bf862ac2abb93a757a070e85075ddffe37
Python
2,244
76
import torch import torch.nn as nn class Concater(nn.Module): """ Concatenates an output of some module with its input alongside some dimension. Parameters ---------- module : nn.Module Module. dim : int, optional Dimension to concatenate along. The default is -1. """ d...
0a26dc8efe0a5ee0ad078ebccc3d06dac17d95ac45e367702503b1d837bcf6f8
Python
2,245
68
# 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...
b1d15e4d870a944c4cd361d3eceb9cf55c41ba7e84ff8fbfabcb4c850e36b103
Python
2,245
74
"""Model wrappers. Copyright (c) 2024 University of Michigan. All rights reserved. Licensed under the MIT License. See LICENSE for license information. """ from typing import Dict, List from itertools import chain import torch from torch import nn as nn class MLP(nn.Module): """MLP for classification head. ...
b95d9424d273b2f64b116dcd023f2ce0b031f9771d15b3d4a0c5058eefdabc91
Python
2,245
60
"""Tests for regtools.cell_counting_legacy.count_labels. These are regression guards for the parameter-name fix in 95fbc31 plus basic shape coverage. """ import os import pandas as pd import pytest class TestLoadSummaryStructures: def test_reads_csv_via_filepath_param(self, tmp_path): # The...
cec3aed565e5d57e95b82b666a6105eca22709ea34331bb786a415311da5eddc
Python
2,245
72
# 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...
03c37aedd5d694a39a82b0bda59311213817f80deb74a62032b218d3092f0bbd
Python
2,246
66
# THIS FILE HAS BEEN AUTOGENERATED. To update: # 1. modify the `_deps` dict in setup.py # 2. run `make deps_table_update`` deps = { "Pillow": "Pillow", "black": "black>=20.8b1", "cookiecutter": "cookiecutter==1.7.2", "dataclasses": "dataclasses", "datasets": "datasets", "deepspeed": "deepspeed>0...
c23ea3a49647a037815a0b826895221aecbbd328f46d83669e5e4e0f673d106c
Python
2,246
57
from cloudvolume import CloudVolume import numpy as np cv_path = "gs://neuroglancer/basil_v0/son_of_alignment/v3.04_normalized/split_masks" def scale_slice(sl, dst_mip=1, src_mip=0): scale = 2**(dst_mip - src_mip) dst_sl = () for s in sl[0:2]: dst_sl += (slice(s.start/scale, s.stop/scale), ) return dst_sl + (sl...
6d0b73ac1cb3ef1e2843cc86c31d78c153003b5dfc0304d295de60481e0d09bc
Python
2,248
50
############################################################################### # This code generates the Supplementary Figure 7 of the paper "Longitudinal # # single-subject neuroimaging study reveals effects of daily environmental, # # physiological and lifestyle factors on functional brain connectivity" # ...
4271c33db484350361fe4f2f8001643fca50f8c7afa33e13a7316b2d09d789e1
Python
2,249
54
from pathlib import Path import argparse import dolfin as d from smart import mesh_tools import mito_parser_args import numpy as np def main(input_mesh_file, output_mesh_file, input_curv_file, output_curv_file, num_refinements, single_compartment_im=False): if not Path(input_mesh_file).is_file(): ...
49a06a8fd9c4aa344f549002cff34474f89e94184208594ce2ae8dcca92f734e
Python
2,249
87
# Node-group asset "Fallback Geometry" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump. from typing import TYPE_CHEC...
3944d369156a3d62f05c501d55b4b883296848933608113c012ea1c4e79042ec
Python
2,250
74
import click import pandas as pd from prediction import max_value, weighted_mean transformation = { "maxvalue" : max_value, "weightedmean" : weighted_mean } # options @click.command() @click.option('--predicted', 'predicted_tsv_file', required=True, type=c...
8de313d86d64f8b3c8bcec9fb851fc20614d0505f01bca9770db49b1b138d082
Python
2,252
67
from torch.utils.data import Dataset import numpy as np class DatasetNOE(Dataset): def __init__(self, temp_data, noe_flag=False): self.kssw_list = temp_data['ksw_1'].transpose()[:, 0] self.fss_list = temp_data['fs_1'].transpose()[:, 0] self.len = temp_data['ksw_1'].transpose().size ...
92d71deafc2000654a588375939fee6da48bab467a9006f86101ce38c6e7cf23
Python
2,252
69
import numpy as np import pickle as pkl import matplotlib.pyplot as plt import matplotlib.cm as cm import matplotlib as mpl from matplotlib import rc #rc('font',**{'family':'serif','serif':['Computer Modern Roman']}) ## for Palatino and other serif fonts use: #rc('font',**{'family':'serif','serif':['Palatino']}) font...
bac9b1af0196fe3db4b0de793d0c549db277d5f294c34dc7426e296315356345
Python
2,252
74
# 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...
6053118831b05cc76b0c41dcaf9d671868a6595742dd7d0751e32e4e31bfaafb
Python
2,253
56
from collections import defaultdict ######################### # Diagnose entity - ICD # ######################### def parser(ICDfile): """ Parses and extracts relevant data from ICD-10 files (Classification of Diseases). :param ICDfile: list of files downloaded from the ontology database and used to gene...
78ee29fc8c3556cf346d0bb99767e5a8219267e98c34c5111230d2b6af907e58
Python
2,253
57
""" toposampling - Topology-assisted sampling and analysis of activity data Copyright (C) 2020 Blue Brain Project / EPFL & University of Aberdeen This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation...
7b1bcbd1e3b4110e62cac7a682c5536e2e66a00544e4e5fe81083902e157cb04
Python
2,253
34
import os os.system("mkdir txtfiles") #os.system("mv *txt txtfiles/") for i in range(1,34): os.system(f"mkdir txtfiles/C{i}") os.system(f"cp patients/C{i}/plots/*.txt txtfiles/C{i}/") os.system(f"mmv -d 'txtfiles/C{i}/avg_vel_grey matter_*' txtfiles/C{i}/avg_vel_grey_matter_#1") os.system(f"mmv -d 't...
04fa4950a2187dd625cf748bfad147873e337e8f3222b0a97a009f657ed17222
Python
2,254
60
# # 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,...
d59f72e22f8197f857746eaef9a476ce85b03820663297b62653fa9ce49e5fde
Python
2,255
71
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment from lab.reports import Attribute, finite_sum from downward.reports.compare import ComparativeReport import common_setup from common_setup import IssueConfig, IssueExperiment DIR = os.path....
168cafc60621049acdd0f6313d2f0baa138989ff5c2a94648e964ff656bd51ee
Python
2,256
71
from ECGPV_visualisation import * import numpy from matplotlib import pyplot as plt from matplotlib.gridspec import GridSpec a = ECGPV_visualisation(0.8) ecgs = pickle.load(open('ecgs.pl', 'rb'), encoding='latin1') def plot_ecg_to_specified_time(fig, ax, lead_name, t_end, counter): ax.clear() CL = 0.8 be...
07b33378de18ce29e4751429d5cc6c81a9c7ccaa8d8f4476f05d4114bafae54c
Python
2,257
54
from ..region_1020 import (FRONTAL_REGION_LIST, GENERAL_REGION_LIST, HEMISPHERE_REGION_LIST) from ..standard_1020 import STANDARD_1020_CHANNEL_LOCATION_DICT from ..utils import (format_adj_matrix_from_adj_list, format_adj_matrix_from_standard, format_...
42b582dc6bf07121e9eda89df98c71dfb5edd5b2e087a0fc1cdf49c201405460
Python
2,257
90
# -*- coding: utf-8 -*- #from sys import argv import numpy as np from glob import iglob import shutil import os import readline from sys import argv #def readfile(filename): # f=open(filename) # out=f.readline() # f.close() # print "read" # except IOError: # print 'File %s does not exist!' %/ (filename)...
1cfd3f7e4026103a2ccfcadbbb9eddf51e376291ec8101c8d882a397e0797eb0
Python
2,258
86
#!/usr/bin/env python3 ## create personality distance matrix (correlation distance across 5 traits) import os import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from sklearn.metrics import pairwise_distances # ------------------------------------------------------------------ # paths # --------...
8d9b56c8740adfd004b0695e4403cf7fee79a41f34ac4f07693448300d7d81e6
Python
2,258
49
from batchgenerators.utilities.file_and_folder_operations import * import shutil from nnunet.paths import nnUNet_raw_data from nnunet.dataset_conversion.utils import generate_dataset_json if __name__ == '__main__': # this is the data folder from the kits21 github repository, see https://github.com/neheller...
aecffe070cbdb7d6f2d782745a17789945f1cb91e5844f4457cd97c5109065f1
Python
2,258
85
# 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...
c270fc2a5114d4ea185074d3ba5d9587ee07e896c218ba66701c174c9e458b6e
Python
2,258
64
from __future__ import annotations import re import urllib.parse from wikibaseintegrator.datatypes.url import URL from wikibaseintegrator.wbi_enums import WikibaseSnakType class CommonsMedia(URL): """ Implements the Wikibase data type for Wikimedia commons media files """ DTYPE = 'commo...
d653f99c0a24dab897d2ac54e68919dc741c2fbbca13f3990a65d3eded62b410
Python
2,258
70
import numpy as np import networkx as nx def minkowski_dist(x, y, c=1): """Minkowski separation between x and y, c = speed of light parameter""" d0 = -c**2 * (x[0] - y[0])**2 d1 = np.sum((x[1:] - y[1:])**2) return d0 + d1 def minkowski_interval(N, D): """ Sample N points from minkowski interval [a...
e7a47f31155d6e9e0fa4084a07c0938288d2366f47aba3a9601535ae9a1bdc20
Python
2,258
76
from typing import Dict, List, Optional, Callable from ..base_transform import LabelTransform class Multilabel(LabelTransform): r''' Apply multiple label transforms independently and combine their results into a list. .. code-block:: python from torcheeg import transforms t = transfo...
6487d10c094a78d134298487dc9a71d53b06836bbed91b5a8bf269cc05298bb4
Python
2,259
55
import subprocess # trigger = 'pe' # thresholds = [4.3e-1] # alfa = [2e-2] # for PE # lmda = [5e0] # for PE # trigger = 'always' # thresholds = [1e-1] # just as a placeholder # alfa = [1e-1] # for always # lmda = [5e5] # for always trigger = 'uncertainty' thresholds = [2.5e-3] # thresholds = [5e-4, 1.0e-3, 2.0e...
aa3b21337831ab0da1a43ff0265cc18bb80ea85cded7a6ae3628b0cbfdb12c75
Python
2,259
55
""" WikibaseIntegrator implementation of backoff python library. """ import logging import sys from functools import partial from json import JSONDecodeError import backoff import requests from wikibaseintegrator.wbi_config import config log = logging.getLogger(__name__) # Keyword arguments that may hold credential...
ca735fbdf3ca9932add78a7bacdb40ade0c8f8cdbda0063208cb3812c04df763
Python
2,259
45
# 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...
f58b87c5d25c2c00f7a2cbfe39621e0d01e597cf9ac21acfe7b4457172821f2e
Python
2,260
62
import numpy as np from scipy.stats import gamma, norm import sys sys.path.append("../../lib_c/") from state_estimation import smc_c import matplotlib.pyplot as plt import sys sys.path.append("../useful_functions/") import useful_functions as uf def get_smoothing_trajectory(actions, rewards, idx_blocks, choices, subj_...
4e7fa833dbe908bf07ff9c7d125a1415136658a254737b7e085f364656956b19
Python
2,261
68
# 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...
a13ed0aef14d375aaf1d6298467fa2be6ee0b41bd74d6ed40e3aabff16aa02e3
Python
2,261
71
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment from lab.reports import Attribute, finite_sum from downward.reports.compare import ComparativeReport import common_setup from common_setup import IssueConfig, IssueExperiment DIR = os.path....
c6fc5eff4f3ed87bb0182cec7b6cffa28e82d79d51c54a16966e4c3fe717dfec
Python
2,261
56
"""This example shows how to define the gradient of your own functions. This can be useful for speed, numerical stability, or in cases where your code depends on external library calls.""" import autograd.numpy as np import autograd.numpy.random as npr from autograd import grad from autograd.extend import defvjp, prim...
d1617fd1bf12ddfd640f7b055205c65ccef1f924e643e6c4ccd1b8a07f8464af
Python
2,261
85
import torch import torch.nn as nn import torch.nn.functional as F from rocf_scoring.config import CONV_LAYERS, DROPOUT_MC_RATE, DROPOUT_MC from rocf_scoring.data_preprocessing.loading_data import preprocess_dataset from rocf_scoring.data_preprocessing.preprocess import BIN_LOCATIONS import numpy as np class CNN(nn.Mo...
fcf41a3e808dd579b46d279e1d891c4263cdbd064ca577e1187671fb1cabde07
Python
2,261
89
import socket import globals.global_func as gf def to_bytes(seq): """convert a sequence to a bytes type""" if isinstance(seq, bytes): return seq elif isinstance(seq, bytearray): return bytes(seq) else: return bytes(bytearray(seq)) class SocketException(OSError...
1e426925df0521969658a354d42ddcf85103b53784591b8e9201374b88ffdf0c
Python
2,262
98
#!/usr/bin/env python # coding: utf-8 # In[8]: from pyteomics import mgf, mzxml, auxiliary import numpy as np import pandas as pd # In[30]: def input_from_mgf(path): # Load the MGF file into a Pyteomics "MGF" object mgf_file = mgf.MGF(path) # Create an empty list to store the MS2 spectra ms2_spec...
51121c5fffd4b8085a13696ebb1d4fa9ba4d8dcb928a4f181c440b25632b4d13
Python
2,262
71
#!/usr/bin/env python # Copyright (c) 2020 Intel Corporation # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ This module provides an example control for pedestrians """ import math import carla from srunner.scenariomanager.actorcontrols.bas...
be1a38a4cc653308ca4c2c09a4880364c725ae29017fd1bfc9fb96ed25de6075
Python
2,263
75
# \file TestNiftyReg.py # \brief Class containing unit tests for module Stack # # \author Michael Ebner (michael.ebner.14@ucl.ac.uk) # \date May 2016 # Import libraries import SimpleITK as sitk import numpy as np import unittest import sys import os import pysitk.python_helper as ph import pysitk.simple_itk_help...
4fab779da39901fa30bd6800ef6258a47ec51103e09cd0b30f16e8d7fd40557e
Python
2,264
70
from typing import Optional, Union, Any import torch if torch.distributed.is_available(): from torch.distributed import group, ReduceOp def distributed_available() -> bool: """ From pytorch lightning """ return torch.distributed.is_available() and torch.distributed.is_initialized() def sync_dd...
7814abd8e15fd79e85752faaf4dd1a0cb78a9601d42db1d887dc67e9db5aa76a
Python
2,264
85
from typing import Callable import torch import torch.nn.functional as F def cos_sim( x1: torch.Tensor, x2: torch.Tensor ) -> torch.Tensor: """ Calculates similarity matrix based on the cosine similarity measure Parameters ---------- :param x1: torch.Tensor First input. ...
15ff70980429b825612f183953f83f5ee0614677b532282e305ced094a0f2b8c
Python
2,265
74
from src.data_analysis.item import Item from src.data_analysis.constants import * class Assessment: def __init__(self, assessment_id: int, fn: str, cheater_score): self.__items = {} self.__id = assessment_id self.__filename = fn self.__person = None self.__inconsistent_row...
5481d5fdf0d6491616f9804e2e342380486d0d23c6f6e76ded64c4931a42e2fa
Python
2,265
93
# # Central pytest configuration # # Copyright © 2020-2025 Ernst Strüngmann Institute (ESI) for Neuroscience # in Cooperation with Max Planck Society # Copyright © 2026 Ernst Strüngmann Institute (ESI) of the Max Planck Society # # SPDX-License-Identifier: BSD-3-Clause # # Builtin/3rd party package imports import sys ...
0c70e252eefc0da6f3dc2f7f7afa8f9f43897bbebb30cf814b2f00711d382fc7
Python
2,266
83
"""3D turbo spin echo sequence.""" # %% import logging import matplotlib.pyplot as plt import numpy as np import console from console.interfaces.acquisition_data import AcquisitionData from console.interfaces.acquisition_parameter import Dimensions from console.spcm_control.acquisition_control import AcquisitionContr...
16f3172530049bacbce5ee9658487b81907a26185fe497bb062e9fc8600b963c
Python
2,266
45
# 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...
e2505c037a759e024ed0a2e3522f9c17f777cec6a084ce4cfc55310ab24d0406
Python
2,266
73
# === SOURCE CODE cfd-score-calculator.py provided by John Doench ===== import pickle, re from os.path import basename, join, splitext, isfile, dirname def get_mm_pam_scores(): """ """ # dataDir = join(dirname(__file__), 'CFD_Scoring') dataDir='CFD/' mm_scores = pickle.load(open(join(dataDir, 'mism...
2ed1c71105715280521526ce6f0466c6d88b70f48f2fcce46f16c84eaa9e8f79
Python
2,267
52
""" toposampling - Topology-assisted sampling and analysis of activity data Copyright (C) 2020 Blue Brain Project / EPFL & University of Aberdeen This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Found...
5dfbaecdba94ce536005a60fdd855c3123026c64b1b552a5dd2567e49c722d35
Python
2,267
95
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed May 15 14:34:49 2024 @author: felipe """ import os import sys sys.path.append(os.path.abspath('../')) from multiprocessing import Lock from model.KuramotoControlled import Kuramoto import concurrent.futures import itertools import gc import numpy as n...
2aaecdf2f077ab3ee74ca046fa0258694eb4de043f4947c74a3a2e2b14a77556
Python
2,268
72
#!/usr/bin/env python import argparse from pathlib import Path import skimage.io from tqdm import tqdm def main(): parser = argparse.ArgumentParser() parser.add_argument('dir', help='root path of CTC dataset') parser.add_argument( '--3d', dest='is_3d', action='store_true', ...
41f2bb287697acfe17d2b0b69358eb22960cea64508828ecd83fa164336ed59e
Python
2,268
72
import argparse from concurrent.futures import ThreadPoolExecutor from utils.api import get_filters_result_from_project from dataset import TCGA_Project_Dataset, TCGA_Program_Dataset from utils.logger import setup_logging from pathlib import Path from utils import set_random_seed SEED = 1126 set_random_seed(SEED) PRO...
c742bbe083933cc4741313ac8ef20a179fd30d6e2734f3a63c07c41ae9180da3
Python
2,268
80
from collections.abc import Iterable from datetime import datetime from elasticai.creator.file_generation.resource_utils import read_text from elasticai.creator.hdl_ir import DataGraph from elasticai.creator.ir2verilog import ( Code, Registry, TemplateDirector, type_handler_iterable, ) @type_handler_...
0182e42a028bcd8ecd744680daf4ba714843845e70004349a1a94de124db3fef
Python
2,269
86
import numpy as np from skfeature.utility.mutual_information import su_calculation def merit_calculation(X, y): """ This function calculates the merit of X given class labels y, where merits = (k * rcf)/sqrt(k+k*(k-1)*rff) rcf = (1/k)*sum(su(fi,y)) for all fi in X rff = (1/(k*(k-1)))*sum(su(fi,fj)...
e89e54cfa582443e6da4143148d0b506df8997c956f58aa46f9cdb239430d205
Python
2,269
103
from pytest import approx, raises from wonambi import Dataset from wonambi.detect.spindle import DetectSpindle from .paths import psg_file d = Dataset(psg_file) data = d.read_data(chan=('EEG Fpz-Cz', 'EEG Pz-Oz'), begtime=35790, endtime=35820) def test_detect_spindle_Moelle2011(): detsp = DetectSpindle() a...
13ea2ce71fd201cc975125269a52c9e2119422cc7368b8cfa6fb3efa8f8b68fa
Python
2,270
54
# -*- coding: utf-8 -*- ################################################################################ ## * ## * Function: merge output p values fron replicates of GSEA] ## * Author: Siyuan Feng ## * Mail: siyuanfeng.bioinfo@gmail.com ## * Created: 04.19.2022 ## * Last modified: 10.03.2022 ################...
600fa6c52a072fd0a5a2b5836bed8d22209726b22f95edc3d4c54dc2e974a841
Python
2,270
74
import gzip import json from typing import List from chemdataextractor.doc import Paragraph, Sentence from pandas._typing import FilePath from tqdm import tqdm """ 1. CDE requires `python3.8`, best to start with a new venv. 2. CDE auto download bert models when first run """ def json_dump(filename, obj, gz=False, i...
741e7f073a70e0039cc50e21c15622b43daf81df525b0a913e9e6cff4c68bb25
Python
2,270
76
import matplotlib.pyplot as plt import numpy as np from PIL import Image import cv2 from aug_utils import random_augmentation from random import randint def plot_figures(names, figures, nrows = 1, ncols=1): """Plot a dictionary of figures. Parameters ---------- figures : <title, figure> dictionary ...
7188848e131e7a47dafb29f4003c94d61fdacf2b7df9aa19e29d5e79c08dd60c
Python
2,271
78
from numpy import isnan from wonambi import Dataset from wonambi.dataset import _count_openephys_sessions from wonambi.ioeeg import openephys from wonambi.ioeeg.openephys import OpenEphys from .paths import openephys_dir as filename openephys.IGNORE_EVENTS = [] def test_openephys_count_sessions(): assert _coun...
333f2e43e17d076758e73be2ef69c44d2340626a03a6eafc82d711ff8771fb13
Python
2,272
77
#@ Context context from java.io import File from org.mastodon.mamut import WindowManager from org.mastodon.mamut.project import MamutProject from org.mastodon.tracking.mamut.trackmate import TrackMate from org.mastodon.tracking.mamut.trackmate import Settings from org.mastodon.tracking.mamut.detection import DoGDetec...
5b5c91f02debe60004ac714c9f0511b53a062bdf372a513a97045f1a9db3ed89
Python
2,273
73
# coding: utf-8 __author__ = 'ZFTurbo: https://kaggle.com/zfturbo' if __name__ == '__main__': import sys import os # For this test, make sure that only the tested framework is available sys.modules['jax'] = None sys.modules['torch'] = None gpu_use = 0 print(f"GPU use: {gpu_use}") os....