sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
fe15018b2b138b2f842d8eb9606b41c2ac5f1b135c4ddfcf2085cdf4ecbce6ff
Python
2,289
56
from __future__ import print_function import numpy as np from itertools import groupby from featureExtractor import FeatureExtractor class FeatureExtractorFreqHisto(FeatureExtractor): def __init__(self, params): self.params = params self.extractorType = 'freqHisto' def getFeatures(self, eegSe...
d91f060110567615de121f0f423bee9890cf24503bf4c6743aaf7142c4866045
Python
2,291
77
import cv2 import matplotlib.pyplot as plt import numpy as np import pdb from scipy.signal import find_peaks def peaker(data): peaks,_ = find_peaks(data,prominence=0.5) peakDist = np.mean(np.diff(peaks)) /2 # peaks, _ = find_peaks(data,distance=peakDist) peaks = [0] + list(peaks) + [len(data)-1] ret...
be365120fe0c548b820d24cefdfa225d9a4946341f233e44e8244c9c7664b6a7
Python
2,292
80
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect def swiglu(a: np.ndarray, b: np.ndarray, alpha: float) -> np.ndarray: sw...
37e9eee0ad0d19cafc98855116e579f16182d93bbad5de2438bbe190bb79c192
Python
2,293
48
"""Script for the direct comparison of the GNN performance compared to DFT.""" import argparse import sys sys.path.insert(0, "../src") import matplotlib.pyplot as plt from gnn_eads.functions import get_graph_sample from gnn_eads.graph_tools import visualize_graph from gnn_eads.nets import PreTrainedModel if __name_...
4736c4cd1eedaa85475ea589bc899bd60b9d6563aa6944bb88351ac1c2a9392a
Python
2,295
82
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class QLinearConv(Base): @staticmethod def export() -> None: ...
4fa756e8c47739efea2feb79444f2e5be655f0357c5f6df571e61e452404d70c
Python
2,296
62
#------------------------------------------------------------------------------- # elftools example: dwarf_die_tree.py # # In the .debug_info section, Dwarf Information Entries (DIEs) form a tree. # pyelftools provides easy access to this tree, as demonstrated here. # # Eli Bendersky (eliben@gmail.com) # This code is i...
f818556f1589dcb87e8a7a1da4c833a60a483995a5c4262c0622d1e3912289a2
Python
2,296
71
from __future__ import division import numpy as np import pylab as plt import os from helper_lib import filelib from SPHARM.classes.orbital import Orbital def test_single_orbitals(gridsize, path): value = 'amplitude' filelib.make_folders([path + 'surfaces/', path + 'heatmaps/', path + 'frequencies/']) f...
34a94df31b1c8cef424ee7ee3fe4d13389b29ed48afbe6bad4c97d4cb9ce4acc
Python
2,297
65
""" Modified from torch.utils.data.distributed.DistributedSampler Support enlarging the dataset for *iter-oriented* training, for saving time when restart the dataloader after each epoch """ import math import torch from torch.utils.data.sampler import Sampler import torch.distributed as dist class DistIterSampler(Sa...
57417bd32454ef341d49a29548d16b038e07124924b7cafdbfa683c0a4f41350
Python
2,298
79
# + [markdowmn] """ # Tutorial 2: Visualization ### Views The view is the angle which the brain is viewed from in the plot. You can specify it as a string: | Argument | View | | :-------------: | :----------: | | 'L' | Left | | 'R' | Right | | 'A' | Anterior | | 'P' | Posterior | | 'S' ...
88860a20150c874da9ca33172efcaa1a9a4eb46ba70cb7c40a95e33273383c70
Python
2,298
87
# Copyright 2019-2026 The AmpliGraph Authors. All Rights Reserved. # # This file is Licensed under the Apache License, Version 2.0. # A copy of the Licence is available in LICENCE, or at: # # http://www.apache.org/licenses/LICENSE-2.0 # import warnings class experimentalWarning(Warning): """Warning that is tr...
dd551f0a712e54cc13ee9980bcabc20ef7658e292214f949907d464717e1fbc3
Python
2,301
83
# roifile/setup.py """Roifile package setuptools script.""" import sys import re from setuptools import setup def search(pattern, code, flags=0): # return first match for pattern in code match = re.search(pattern, code, flags) if match is None: raise ValueError(f'{pattern!r} not found') ret...
69309260016ced9c57a0a21dfe92dfde069c8c8e03041c4f7d0009d350132ac4
Python
2,302
70
from pytest import mark import numpy as np from asreview.models.classifiers import get_classifier from asreview.models.query import get_query_model from asreview.models.query import list_query_strategies @mark.parametrize("query_strategy", [ "max", "random", "max_random", "uncertainty", "max_unce...
73651ded753607e5028136dbd2885380eacb350fbacc890d008ecf5a1f34f9f9
Python
2,303
82
import numpy as np from brian2 import * # import matplotlib.pyplot as plt import time import pickle """ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% NEURON AND SYNAPSE DEFINITIONS """ globalStart = time.time() eqs_neuron = ''' dv/dt = (-v+I+Is...
40c9ab2bcc2bcb59e449bd31f7951564081e54206686ee3aae714308e819695a
Python
2,304
65
from pathlib import Path from nltk.translate.bleu_score import sentence_bleu from statistics import mean # DIVIDED_BY_THREE_DOTS works well for T2E, and worst for C2E. DIVIDED_BY_THREE_DOTS = False if DIVIDED_BY_THREE_DOTS == True: BASE_DIR = Path("../NMT_input") / Path("tokenization") TRAIN_INPUT = BASE_DIR ...
83b1d9adc360e9a74e479b986c3eb5492c8f1f33d98b6c5b192fd0733436655b
Python
2,304
63
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Nov 11 17:21:09 2021 @author: sam """ import os import argparse from pipeline_utils import submit_job import glob from natsort import natsorted if __name__ == '__main__': p = argparse.ArgumentParser('Running pipeline on remote', add_help=False) ...
fc29d0a7014f91fa8e44c5e63481039a902c14fed89744e35f7bc82d36cd2db1
Python
2,304
76
import matplotlib.pyplot as plt import pandas as pd from rdkit import Chem from rdkit.Chem import rdChemReactions, rdDepictor, Draw from rdkit.Chem.Draw import rdMolDraw2D, DrawingOptions DrawingOptions.atomLabelFontSize = 15 DrawingOptions.dotsPerAngstrom = 100 DrawingOptions.bondLineWidth = 3.0 file = r'C...
b620463bece42352b744d534ea00e152206c028d038603b3e1ed4a9be27eb5d9
Python
2,305
77
# SPDX-License-Identifier: LGPL-3.0-or-later from collections.abc import ( Callable, ) from deepmd.dpmodel.descriptor.base_descriptor import ( BaseDescriptor, ) from deepmd.dpmodel.fitting.base_fitting import ( BaseFitting, ) from deepmd.utils.data_system import ( DeepmdDataSystem, ) # use "class" t...
bee6236f84d50c375e145febe904f4ecf734051cebad252fb593a4b64a810e54
Python
2,305
58
# Copyright 2019 DeepMind Technologies Ltd. All rights reserved. # # 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 appl...
3e2df6a5c996bb07eb9a7e92d619a4effb44ad2a8500f090fec6ce2dcdf7720f
Python
2,306
80
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Mar 11 17:56:21 2022 This code identifies and creates pdb files of chains and interacting glycans. It workd on multi chain pdb files given in a directory. Note: Input directory has only glycan interacting pdbs. // @author: sudhanshu """ from mpl_toolk...
06f5fb0f322b549db46b7485ec479c948ffc202756ef88438620aaf7264c986c
Python
2,308
72
# coding=utf-8 # Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved. # # 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 # # ...
793f1000361cdd11092bbdd82545009931efffec815d5c589f155dc5454f6cc2
Python
2,308
66
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file) """Tests for BaseObject universal base class that require sktime or sklearn imports.""" __author__ = ["fkiraly"] def test_get_fitted_params_sklearn(): """Tests fitted parameter retrieval with sklearn components. Raises ------ As...
6614ca0bb6322f0425363c2334ea8b3a6f27a071931e234000195cb2c45bb16b
Python
2,310
79
from copy import deepcopy from pathlib import PosixPath from typing import Optional import ants from ants.core.ants_image import ANTsImage from rich import print def register( fixed: ANTsImage, moving: ANTsImage, type_of_transform: list, outprefix: str = "", path: Optional[PosixPath] = None, ...
97d988f745750c71f2a8a76bee2e8a93b0754b465550276c40fb8ca4c540e98b
Python
2,315
59
"""Tests for bycycle.features.burst.""" import pytest import numpy as np from bycycle.features import * ################################################################################################### ################################################################################################### @pytest.mar...
a2cccbc2aca04401f8b3c39f87c244a83282b921c347658fbcbfe7f99a27520a
Python
2,316
59
#!/usr/bin/env python3 """Given a ttl file get ILX ids for ILXREPLACE terms. Usage: ilxcli [options] <file>... Options: -l --logfile=LOG the file mapping ILXREPLACE to ILX [default: ilx-records.json] -o --ontology=ONT manually set the ontology where ILX identifiers will live -g --get a...
e19c0be999fa989d0764fa0a2df5492af1889613b6d8afe9e351501556639f89
Python
2,316
79
import unittest import rdflib from neurondm.core import (LabelMaker, Phenotype, NegPhenotype, Neuron, LogicalPhenotype, AND, OR,) class TestLabelMaker(unitt...
e900bbf932fd52320dc0f590bc98e873b46552efee2f3543e092c91b150b1aa5
Python
2,317
63
import argparse def get_parser(): parser = argparse.ArgumentParser(description='Process some integers.') parser.add_argument('--action', type=str, default=None, help= 'the simulation to perform.\n new_data requires new_data_path\n ...
2a98d51b70a9396b54ac592cb5dd0081be21336b3ed98853e4d012ad10dd2ee0
Python
2,318
63
''' import numpy as np from nibabel import trackvis as tv from dipy.segment.clustering import QuickBundles from dipy.io.pickles import save_pickle from dipy.data import get_data from dipy.viz import fvtk fname = get_data('fornix') streams, hdr = tv.read(fname) streamlines = [i[0] for i in streams] qb = QuickBundles(...
4679bf92d55407cd38f6552161bdd0da41ed7d8bc524a50761409ac70a64d4ea
Python
2,319
64
import numpy as np class HyperParam: def __init__( self, min_samp, max_samp, init=None, sample_fn="loguniform", explore_wt=0.2, enforce_limits=False, ): """Represents constraints on hyperparameter values that will be used during PBT. ...
c18b62990c228216dd34e2d6aa1044ebc485f85d9e6ac5d8d6f622fd2a9aed6e
Python
2,319
78
# Copyright 2019-2020 The ASReview Authors. All Rights Reserved. # # 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 appl...
109a820335c94a2b253845feefe56a6dfa2e679b273152fad0294b54330c39b4
Python
2,320
66
import pickle import numpy as np from ksstatistics import StatisticalTester from fileManagement import readStandardMice, getFileIDs from parameterSetup import ParameterSetup eegFilePrefix = 'eegAndStage' params = ParameterSetup() pickledDir = params.pickledDir standardMiceData, standardMiceFileFullNames = readStanda...
6829d26aaad393fcdcee389bd764c0df687aae3cac97bdbeb22de9f8e861e46e
Python
2,320
72
# Copyright 2019 DeepMind Technologies Limited # # 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 agr...
921eff397e00249daa9e8858bf65fa9ea1642447246472b83e5577bc3a5eadee
Python
2,320
72
import pandas as pd from netplotbrain import plot as npbplot import pytest # Example node and edges dataframes included with package nodes = pd.read_csv('./examples/example_nodes.tsv', sep='\t', index_col=0) edges = pd.read_csv('./examples/example_edges.tsv', sep='\t', index_col=0) @pytest.mark.mpl_image_compare def...
a142a9030691a3780ff12a86ac28bea59747e020af41f09fe54a197df48d4a9f
Python
2,320
71
# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch from mmcv.utils.parrots_wrapper import _BatchNorm from mmcls.models.backbones import Res2Net def check_norm_state(modules, train_state): """Check if norm layer is in correct train state.""" for mod in modules: if isinstance(mo...
c64bb3e7c66aebcbe255a75616c9c937d8ec0f397726a2003631b41a08db8ffa
Python
2,320
90
import numpy as np import matplotlib as mpl from matplotlib.colors import to_rgb, to_rgba from numpy.testing import assert_array_equal USE_PROPS = [ "alpha", "edgecolor", "facecolor", "fill", "hatch", "height", "linestyle", "linewidth", "paths", "xy", "xydata", "sizes",...
427275022d99adac21c114cd38d72df17e2843651be7c89bd586620f3503db23
Python
2,322
69
# Copyright 2019 DeepMind Technologies Limited # # 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 agr...
0f522fa56e6b88489c2dccd108c6af462fc3669e9c397adbe8d946350e51c6d2
Python
2,324
63
# Copyright 2019 DeepMind Technologies Ltd. All rights reserved. # # 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 appl...
62b2ca93bb40b2e9c74635a78401e28383e4796c99d5ba5f4717d4173f7d4f28
Python
2,324
86
#!/usr/bin/env python3 # tifffile/tiff2fsspec.py """Write fsspec ReferenceFileSystem for TIFF file. positional arguments: tifffile path to the local TIFF input file url remote URL of TIFF file without file name optional arguments: -h, --help show this help message and ...
57bb273ac5793439455336c68f2bcfa55acc41dc99201eb4743f6235a29e6f11
Python
2,325
73
# Copyright 2019 DeepMind Technologies Limited # # 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 agr...
e17fb202631d4ead1686feeda3c23b6d8122cd6101c5e562757f8e85d17fd8e6
Python
2,325
71
import json from urllib.request import urlopen import requests from packaging.version import parse from rich import print as pprint from hsf import __version__ def get_version(url_pattern: str = 'https://pypi.python.org/pypi/HSF/json'): """Returns version of HSF on pypi.python.org using json.""" req = reque...
218d0e48cc5c411ae3d8366124e630288a03729525461685cf60e8e7916a97d2
Python
2,326
59
"""ByCycle setup script.""" import os from setuptools import setup, find_packages # Get the current version number from inside the module with open(os.path.join('bycycle', 'version.py')) as version_file: exec(version_file.read()) # Load the long description from the README with open('README.rst') as readme_file:...
96b3db69ba2eb7d5e7a7d87d347a8da6c44dd4b94f701563b795e3610f803b18
Python
2,326
84
# Copyright (c) OpenMMLab. All rights reserved. from copy import deepcopy import pytest import torch from torch.nn.modules import GroupNorm from torch.nn.modules.batchnorm import _BatchNorm from mmcls.models.backbones import T2T_ViT def is_norm(modules): """Check if is one of the norms.""" if isinstance(mod...
4063405f87d90f416785b0a3a50248765ea90a4af30c8b5bcd8f197242a25e63
Python
2,327
63
# Copyright 2024 The TensorFlow Authors. All Rights Reserved. # # 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 applica...
4e0a91d30e252ec772eb205d9d105166bd6e19641d4eb44a22a0655e6feb4f47
Python
2,327
73
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
8c29cfd2ae76a020bf681021a274bfd2438cf3b9940c6163ac0270568d5faeee
Python
2,328
65
""" modulation_transfer_function.py - calculate rate modulation transfer function Calculates rate modulation transfer function from a spike train, for the specified frequency This module is part of *vcnmodel*. Support:: NIH grants: DC R01 DC015901 (Spirou, Manis, Ellisman), DC R01 DC004551 (Manis, 2013-...
999600d18d45df85cc83d23d6341dc8837da005fa1c44b80e18f4898b04fd84b
Python
2,328
60
from netplotbrain import plot as npbplot import pytest import pandas as pd import matplotlib.pyplot as plt import templateflow.api as tf # Example node and edges dataframes included with package nodes = pd.read_csv('./examples/example_nodes.tsv', sep='\t', index_col=0) edges = pd.read_csv('./examples/example_edges.tsv...
51a38f084a96a46ed914bc7bd586646371c2666f88290b675efd060b1e239cf0
Python
2,329
47
# Copyright 2019-2026 The AmpliGraph Authors. All Rights Reserved. # # This file is Licensed under the Apache License, Version 2.0. # A copy of the Licence is available in LICENCE, or at: # # http://www.apache.org/licenses/LICENSE-2.0 # from ampligraph.latent_features.layers.scoring import DistMult import pytest ...
e150439c55a208037c109cdc40723b18dfd4c2dfb82a237f98bee5afc34969b0
Python
2,329
41
# Copyright 2019-2021 The AmpliGraph Authors. All Rights Reserved. # # This file is Licensed under the Apache License, Version 2.0. # A copy of the Licence is available in LICENCE, or at: # # http://www.apache.org/licenses/LICENSE-2.0 # r"""This module includes neural graph embedding models and support functions. ...
a828b75f40262bc6f9e74e10e986b3dcd1be8aba71a3d0f2b432145abef15bfe
Python
2,330
59
""" Test construction of a complete circuit build from cell populations. This script: 1. Creates populations of sgc, bushy, and stellate cells. 2. Connects the populations together. 3. Instantiates 10 bushy and 10 t-stellate cells near 16kHz. 4. Resolves all required synaptic dependencies. No simulation is executed;...
de2ce3dd8372c9d92328ad62cd1e44312add28df6d64f09015ca88aa36464406
Python
2,330
48
# Copyright 2019-2020 The ASReview Authors. All Rights Reserved. # # 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 appl...
c97ad718379f5e2a407640793c4a5d793bdc7a98e3565518483f52013b2c9bd8
Python
2,332
78
import numpy as np import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib import cm from matplotlib.colors import ListedColormap, LinearSegmentedColormap import seaborn as sns mpl.rcParams['pdf.fonttype'] = 42 mpl.rcParams['ps.fonttype'] = 42 mpl.rcParams['font.family'] = 'Arial...
5e42b926b9a3770ad069b1d543d17f07dc158d93ca11fa5cd89ccaa5c34a7445
Python
2,335
71
# Copyright 2019 DeepMind Technologies Ltd. All rights reserved. # # 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 appl...
9984918778b47a2fddb5266ca20c7055a575c4ddd6b7cd009fc7b71ac84f6937
Python
2,335
62
import argparse import csv import pickle from tqdm import tqdm import time from rxnebm.data.preprocess import canonicalize parser = argparse.ArgumentParser() parser.add_argument('--output_format', type=str, default='gln', help='["gln", "retroxpert"]') # TODO...
9e9d197590b54ff43f11f2116f3d1f29b9517894401efaa5729ce5e809f81bdc
Python
2,336
75
# -*- coding: utf-8 -*- # # Copyright © 2013 Charles E. Vejnar # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # """Interface with the `Cufflinks <http://cole-trapne...
defa20ee9f4652123c0a3ee851652a0f6ca962fa64f2b9bc43e2295a8f59276e
Python
2,336
73
# Copyright 2019-2020 The ASReview Authors. All Rights Reserved. # # 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 appl...
ab55aad5ae9b5858dacf21813aed972443d3ad7902f9bdda8733a41291b8bcac
Python
2,337
72
# # # Visualizing a single network # # [Open interactive notebook in Binder](https://mybinder.org/v2/gh/wiheto/netplotbrain/main?filepath=docs/gallery/plot_connectivitymatrix.ipynb) # # ## Goal # Here we are plot the nodes on the brain from the Schaefer atlas and plot the connectivity matrix next to it # # So this code...
6ef88fb3dc5903c8af9981f49f72b093b6167a115dcea2f91a331364604380ef
Python
2,339
59
# Copyright (c) OpenMMLab. All rights reserved. import copy import os.path as osp import numpy as np from mmcls.datasets.pipelines import LoadImageFromFile class TestLoading(object): @classmethod def setup_class(cls): cls.data_prefix = osp.join(osp.dirname(__file__), '../../data') def test_loa...
3b48cdcf194f9fe34ff03d8412ed2be0120403756522eb53195e8f1d429d9269
Python
2,340
65
import unittest from pyontutils import combinators as cmb from pyontutils.core import OntGraph from pyontutils.namespaces import owl, rdf, rdfs, ilxtr class TestCmb(unittest.TestCase): def _doit(self, gen): OntGraph().populate_from_triples(gen).debug() def _doit_fail(self, gen): try: ...
acb98599cd165df91662134f8703b4d9fea00501b99123abe18ab5cbc00de163
Python
2,341
93
from neuron import h import numpy as np import scipy import scipy.integrate import scipy.stats try: import pyqtgraph as pg HAVE_PG = True except ImportError: HAVE_PG = False from ..util.stim import make_pulse from .protocol import Protocol class CurrentClamp(Protocol): def __init__(self): sup...
f136c82ced12b4dac91835d87bd20824524940d022a3b0d67e0d2027641efcd1
Python
2,345
61
# Copyright 2023 DeepMind Technologies Limited # # 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 agr...
938bfae680bcd207ea03793990cca46a5bbc240b346df8e1f29a5101f45adb63
Python
2,347
76
"""Distribution plot of predicted per-read alignment penalties.""" import logging from typing import Optional, Sequence import matplotlib # Select a non-interactive backend before pyplot is imported so the command # works over SSH and in CI, where no display is available. matplotlib.use('Agg') import matplotlib.pyp...
9d74380327bbadd73bbd92db40d8b5cbc973236a839cfc5aa4ce25f6af95a04c
Python
2,348
76
from __future__ import division import os import sys import pandas as pd from SPHARM.classes.surface import Surface from helper_lib import filelib from mayavi import mlab ################################# args = sys.argv[1:] if len(args) > 0: path = args[0] if path != 'test': if not path.endswith('/'...
5b47ff56917e4313b63a066dbd87c2a59852e8f0e7d6547cddaea9d27043e346
Python
2,349
107
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from onnx.reference.ops.op_pool_common import CommonPool class AveragePool_1(CommonPool): def _run( self, x, auto_pad=None, ceil_mode=None, kernel_shape=None...
76ea5ec4167c288d9ccab08214a6bdfb6a13249cd943df017660665aa42a4fcc
Python
2,349
64
from dill import load, dump from mprl.utils import ensure_dir class WeightsUtilsPolicyMixin(object): def get_model_weights(self, remove_scope_prefix:str = None): if remove_scope_prefix and not remove_scope_prefix.endswith("/"): remove_scope_prefix += "/" weights_dict = {} f...
7921fb28c1dac020030896b11d6adf3d6720ea4e6f27cc0278bf03c7f3018d34
Python
2,350
63
""" This script will combine multiple LMDBs in a directory into a single LMDB dataset. """ import click import sys import pandas as pd import lmdb import io import gzip import logging import tqdm from atom3d.datasets.datasets import LMDBDataset, make_lmdb_dataset, serialize logger = logging.getLogger(__name__) @click...
98c1ca83dbb1ab5757f3e346c11f409ce842ada929d302ede7929a5d7e3636c1
Python
2,350
66
import pandas as pd import pytest from sktime.detection.bs import BinarySegmentation from sktime.tests.test_switch import run_test_for_class __author__ = ["Alex-JG3"] @pytest.mark.skipif( not run_test_for_class(BinarySegmentation), reason="run test only if softdeps are present and incrementally (if requeste...
952f4d234cd8d868ba60e5ea0e1a9028f5a2b7da096e4c7ac19290b977b89927
Python
2,351
85
#!/usr/bin/env python import click from Bio import motifs import logomaker from matplotlib import font_manager as fm import matplotlib.pyplot as plt import numpy as np import os import pandas as pd import warnings warnings.filterwarnings("ignore") # Specify font f = os.path.join(os.path.dirname(os.path.realpath(__fil...
638d63b1228589ddc155fd3048e93b8fe3f9ac9af061dcf7b4277ad49a291637
Python
2,353
67
""" Parameters: --------- subjects directory, subject name, hemi (should be defined in the main script curveball.py) reads {h}.pial.ply and {h}.white.ply (outputs from mesh_pial_white.py scrips) files to calculate the cortical thickness for each hemisphere. Returns: -------- {h}.thickness.asc for each hemisphere ""...
87178b0a439f4e26beb8678f7836afe56cd0219dbd7c65ecb038a3f2e9b69747
Python
2,353
82
"""Longley dataset for forecasting with exogenous variables.""" from sktime.datasets._single_problem_loaders import load_longley from sktime.datasets.forecasting._base import _ForecastingDatasetFromLoader __all__ = ["Longley"] class Longley(_ForecastingDatasetFromLoader): """Load the Longley dataset for forecas...
d30ef2a5056e02b584fa761247a59ec70e584ccbee2e2569d98edea8e7b3a661
Python
2,354
58
''' Canonicalize product SMILES by re-assigning atom mapping numbers according to the canonical atom order. Since the original mapping numbers may indicate the reaction atoms, which results in information leak. ''' import pandas as pd from rdkit import Chem from tqdm import tqdm from pathlib import Path input_folder...
75edb65c1fba5a8dd7aa8e8e82437480d6029c3ee88a1066d8916ef0010c1f3d
Python
2,356
59
#------------------------------------------------------------------------------- # elftools tests # # Andreas Ziegler (andreas.ziegler@fau.de) # This code is in the public domain #------------------------------------------------------------------------------- # The lib_relro.so.elf file was generated as follows (on Deb...
5060163a032476af6fde467fc3fec4e56e2d0689eb8b16d8f9763130a26fe907
Python
2,359
47
# Copyright 2019-2026 The AmpliGraph Authors. All Rights Reserved. # # This file is Licensed under the Apache License, Version 2.0. # A copy of the Licence is available in LICENCE, or at: # # http://www.apache.org/licenses/LICENSE-2.0 # from ampligraph.latent_features.layers.scoring import TransE import pytest im...
626116cef91ebbdaf76633a5d62d75bceb63fc6a20889dc53d79d833078bcc57
Python
2,359
68
from __future__ import annotations from typing import Dict, List, Sequence import numpy as np Array = np.ndarray def evaluate_usage_metrics( pred_usage: Array, y_usage: Array, y_counts: Array, groups: Sequence[Array], eps: float = 1e-8, ) -> Dict[str, float]: """Evaluate predicted within-ge...
f00b7d22b3883d7bfdb085f6ab9f6b6e9bb3acf2902b906dec518c06aaa08628
Python
2,359
69
import re from setuptools import setup def find_version(filename): _version_re = re.compile(r"__version__ = '(.*)'") for line in open(filename): version_match = _version_re.match(line) if version_match: return version_match.group(1) __version__ = find_version('ttlser/__init__.py'...
39d4527bcce91089301b56c351a9268519dd78291cbed6ca7e9060d2d931ddb3
Python
2,361
73
# -*- coding: utf-8 -*- import os import numpy as np import nibabel as nib def float_in_filename(num): """ Function to remove the "." of the float to avoid it in filenames. It convert the Numeric input into a str If the input is simply an int, it just converts it into str Parameters ---------- ...
f5928afbf4c33a729447e551364ba3f5fad28c42dce3e2a7b3d887308ee8eb9c
Python
2,361
54
import torch import flair from flair.datasets import IMDB from flair.distributed_utils import launch_distributed from flair.embeddings import TransformerDocumentEmbeddings from flair.models import TextClassifier from flair.trainers import ModelTrainer def main(multi_gpu): # Note: Multi-GPU can affect corpus load...
3a5f512bf6781ec71bd9362adc98b5be1cb38ab51a869df27efe453201ce7b82
Python
2,363
70
""" This script is both a demo for those who are new to running LFADS and a test script to rapidly test changes. The main steps to running LFADS are: 1. Create a configuration YAML file to overwrite any or all of the defaults 2. Create an LFADS object by passing the path to the configuration...
76210fbbb3cb74c5a2c1585adf2ea4762b32d0526d069e6cc97a0b56c65f3b2a
Python
2,363
56
import sys import numpy as np from parameterSetup import ParameterSetup from evaluationCriteria import y2sensitivity, y2confusionMat, printConfusionMat, mathewsCorrelationCoefficient, multiClassMCC args = sys.argv test_path = args[1] pred_path = args[2] params = ParameterSetup() stageLabels = params.stageLabels4evalu...
f1ffd29042def789eecdadb94ada194f39f0194903ae432ed1571c4aa2f03c50
Python
2,363
81
import numpy as np from scipy.signal import periodogram from numba import njit @njit def fill_feat_mat( feat_mat: np.ndarray, win_id: int, Pxx: np.ndarray, n_chan: int, freq_idx: np.ndarray, ): for ch in range(n_chan): for kk, freq_lims in enumerate(freq_idx): feat_mat[win...
586139a0b5ae1e2ece9c468596890afde2aa81a0e487442b1738496aa2f7d57f
Python
2,364
77
# Copyright 2019-2021 The ASReview Authors. All Rights Reserved. # # 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 appl...
4e16e76971a34962a29616c66b75dbf06f8f8a9bc10c617812f70401d75064b2
Python
2,365
86
""" Build synconfig (print to terminal) based on reading the ASA file e.g., make this:: VCN_c18 = [ [(216.66), 0., 2, np.nan, np.nan, 49.2, 1.222, 'e' ], [(122.16), 0., 2, 82.7, 1.417, np.nan, np.nan, 'e'], [(46.865), 0., 2, 67.3 , 1.309, 62.1, 0.717, 'e' ], [(84.045), 0., 2,...
bd6af03fe14f56c6e1c1fe7ccea8fdba82af43ba1061b59da17cc27a496cfd61
Python
2,367
97
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jun 1 16:54:07 2022 @author: sudhanshu Trains the CAPSIF:G model on the dataset Note, must be run after preprocess.py has been performed Usage: python train.py Returns: prediction model into "models_DL/capsif_g_model.pth.tar" """ import egnn.egnn as...
36358e3370b0ec6a59c07f11d4a27e063c0a0a87d6e0e7a56a1ea2ba14a33a09
Python
2,369
93
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class Identity(Base): @staticmethod def export() -> None: no...
81dce7bbd2a010331ce9334e715dd956a9a4477b950966c2a9c3812b5f84552b
Python
2,370
65
# Short script used to create the blosum matrices necessary when using "use_blosum" argument import pickle import numpy as np from sklearn.decomposition import PCA as PCA alphabet='ARNDCEQGHILKMFPSTWYVX' def subsmatFromAA2(identifier, data_file='aaindex2.txt'): """Retrieve a substitution matrix from AAindex2-file...
aa8ec1816c40c1ccd606640ed9723b71168749ceb96be70e24fa90e9e7acf6a6
Python
2,371
68
import pandas as pd import numpy as np from bids import BIDSLayout import itertools import os def generate_group_cm(nodes, subjects, community_size, community_str, scale=0.25, seed=2022): """ Quick way to simulate group differences for visualization purposes. Input ----- nodes : int numbe...
4a5133a57c0143298c8800979b3905bf475ae1c1e95d6082b5d60a0518ff0ade
Python
2,372
78
"""Tests for time series Lloyds partitioning.""" from collections.abc import Callable import numpy as np import pytest from sklearn.model_selection import train_test_split from sklearn.utils import check_random_state from sktime.clustering.partitioning._lloyds import ( BaseTimeSeriesLloyds, _forgy_center_ini...
ff0d10338162a825b844d5b5b64b40ecc8a33c31ceee03cef68bf492ad28b82e
Python
2,372
61
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.helper import tensor_dtype_to_np_dtype from onnx.reference.op_run import OpRun class MelWeightMatrix(OpRun): def _run( self, num_mel_bins, dft_...
3dd35bdf597730ea808629cf3cb0be1b6c7bb710287a5e9638e8a9d4a505b443
Python
2,373
74
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file) """State-aware clone and set_params for arbitrary objects.""" __author__ = ["SimonBlanke"] from sktime.base._base import _safe_clone _VALID_TARGET_STATES = ("new", "pretrained") def _check_target_state(state): """Raise ValueError if state ...
3471d2ecbff51b951d79fb5bd6d7a281546508d71987574c27426d8eeda4e028
Python
2,378
91
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class Gather(Base): @staticmethod def export_gather_0() -> None: ...
fad004dc915d895092525dad91c725f0148a6667ca95c1fb99842b760391cf70
Python
2,378
77
import torch def pairwise_distance_sq( p, q, norm_choice="cartesian", device=torch.device("cuda" if torch.cuda.is_available() else "cpu"), ): """ Compute the squared pairwise distance between jet 4-momenta p and q. Args ---- p, q: `torch.Tensor` The 3- or 4-momenta of shap...
fdb4d641a62e9f6c3e0dda513084c47b7e44783271c137efed8aa581780f77b1
Python
2,379
76
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file) """Base classes for classification datasets.""" __author__ = ["felipeangelimvieira"] from sktime.datasets.base import BaseDataset, _DatasetFromLoaderMixin __all__ = [ "BaseClassificationDataset", "_ClassificationDatasetFromLoader", ] ...
676d625ba9d10393917edea2eeedaa247dc1d63e71b12043917097e090e3ee35
Python
2,382
88
import numpy as np from ..lddmm._lddmm_utilities import _validate_ndarray def _verify_data_is_ndarray(data): if not isinstance(data, np.ndarray): raise TypeError(f"data must be of type np.ndarray.\ntype(data): {type(data)}.") def cast_to_typed_array(data, dtype=float): """ Returns a copy of data...
a1368de75646071f34d52880779e3c7eef9dc77cad8bb1a86838f5ad3921e40e
Python
2,383
66
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Aug 13 08:48:12 2021 @author: sam """ import os import argparse import configparser as ConfigParser import glob import shutil from ssh_tools import retry_ssh #%% if __name__ == '__main__': # Arguments used in run_pipeline p = argparse.Argumen...
8a8052ecf8d40990cfc86f6b4b50aa5689c9f77a9f4b03dbfde9f885a7415842
Python
2,384
71
# Copyright 2019 DeepMind Technologies Ltd. All rights reserved. # # 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 appl...
4e2e8949585dfb6d9eb969a60f4cdbe50b55a50abef32a0ce3a1c15316474031
Python
2,385
56
# ---------------------------------------------------------------------------- # Copyright (c) 2017-2026, QIIME 2 development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------------...
1fc6977c9f65e244f34371cddc93096a8b72e848ad87fee0d842ea3ce22c1fe6
Python
2,386
75
"""Tests for igts module.""" import numpy as np import pytest from sktime.detection.igts import IGTS, InformationGainSegmentation, entropy from sktime.tests.test_switch import run_test_for_class @pytest.fixture def multivariate_mean_shift(): """Generate simple mean shift time series.""" x = np.concatenate(t...
4e9df66b087e78e878220ee477f376dbdaec34e81a5f68931fe47455084a3f2f
Python
2,386
68
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class Less(Base): @staticmethod def export() -> None: node =...
b5caadbc5fe2854b9e70c8a6b4c04f9d724d1f51e069f0b87ca85f4c3021559c
Python
2,386
78
import numbers import wandb from ray import tune from ray.tune.util import flatten_dict import ray def make_dict_items_yaml_representable(repr_dict): for k, v in repr_dict.items(): if type(v) is dict: make_dict_items_yaml_representable(v) if isinstance(v, tuple): repr_dict...
45b9f644a7e6518e7f38b2780cf3892013192fb85fbdacc1e2499d5bb017f915
Python
2,390
59
#!/usr/bin/env python # # Copyright 2019 Google LLC. All Rights Reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list o...
6c6d700c147bf16eaffa4dd7c78348083d3fc7e8aeec0d5a01e0a3a91af0ace0
Python
2,393
64
from typing import Union import time import pytest import siibra from siibra.core.structure import BrainStructure from siibra.core.space import Space from siibra.features.image.image import Image all_image_features = [f for ft in siibra.features.Feature._SUBCLASSES[siibra.features.image.image.Image] for f in ft._get_...
26ae352a8f47dbf19b0783bc8e70ce002f93910121a09e9bd3ad2d196718270d
Python
2,394
84
#!/usr/bin/env python import click from functools import partial from multiprocessing import Pool import os import re import subprocess as sp import sys sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), os.pardir, os.pardir)) ...