sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
f2f29d0161feecdb5a3c6ae1b1b5ae3e0c6e33c04e5a5d5bd18431431746094e
Python
1,165
47
""" Tests to make sure the example SeqData object works """ import os import eugene as eu import pytest from pathlib import Path HERE = Path(__file__).parent @pytest.fixture def sdata(): sdata = eu.datasets.random1000() eu.pp.ohe_seqs_sdata(sdata) eu.pp.reverse_complement_seqs_sdata(sdata) eu.pp.tra...
5d6653c40825ed7c097b58bf553ddb5669b8f5f29f2934b1280b3b6828071aea
Python
1,166
28
from gluoncv.auto.tasks import ImageClassification import autogluon.core as ag from nose.tools import nottest IMAGE_CLASS_DATASET, _, IMAGE_CLASS_TEST = ImageClassification.Dataset.from_folders( 'https://autogluon.s3.amazonaws.com/datasets/shopee-iet.zip') def test_torch_image_classification(): from gluoncv.a...
912427dd827711a6f3bca3a06830da3ecd77e6e050163a5a548dd14fae202805
Python
1,166
37
import sys from typing import TYPE_CHECKING if TYPE_CHECKING: from ._domain import Domain from ._hoverlabel import Hoverlabel from ._insidetextfont import Insidetextfont from ._legendgrouptitle import Legendgrouptitle from ._marker import Marker from ._outsidetextfont import Outsidetextfont ...
9efe1d5dc6551a55dea045a57870fef2d9683aae97aabdcad2ba53d8bc2e4326
Python
1,166
43
import sys from openbabel import openbabel, pybel def main(): if len(sys.argv) == 3: process(sys.argv[1], sys.argv[2]) else: print("Usage: convert_pdbqt_to_sdf.py <input-pdbqt-file> <output-sdf-file>") exit(1) def add_property(mol, prop_name, prop_value): newData =...
fbbcfdb7bbc298836a789b20dfdbcc95e5f599a724544be69aa1f2a200cb74c7
Python
1,166
38
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["num_motifs"] = 82 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec"]["motif_width"] = 13 msp.architecture["motif_model_spec"]["motif_feature...
132671a246938dc50138ff87890e3ea157688f57188acdf38de57cd4dfe508f0
Python
1,167
32
from os.path import abspath, join def run(): from spitfire.chemistry.mechanism import ChemicalMechanismSpec from spitfire.chemistry.tabulation import build_nonadiabatic_defect_eq_library import spitfire.chemistry.analysis as sca test_xml = abspath(join('tests', 'test_mechanisms', 'h2-burke.yaml')) ...
dc6e138411b31f8450fdadeb8d193cedfa49d54936bf61fa3579de8800864021
Python
1,167
40
import numpy as np from gym.spaces import Discrete def test_space_legacy_pickling(): """Test the legacy pickle of Discrete that is missing the `start` parameter.""" legacy_state = { "shape": ( 1, 2, 3, ), "dtype": np.int64, "np_random": np.r...
a8152f842520b447aa3cbe6ea6dd95acdde3da1cf38a02e5ee111d965967a183
Python
1,168
39
import math import torch import torch.nn as nn class PositionalEncoding(nn.Module): """ from the tutorial https://pytorch.org/tutorials/beginner/transformer_tutorial.html Input: (L, N, C) Output: (L, N, C) """ def __init__(self, d_model, dropout=0.1, max_len=5000): super(PositionalE...
ab2deea50cd287001b40b003084054ea7cab088881ba955b5b9b71b7b473fa70
Python
1,168
39
"""Utilities for working with functions, inlcuding input / outputs.""" ################################################################################################### ################################################################################################### def resolve_aliases(kwargs, aliases): """Ch...
a495082179f63dfab88a53acd9f8f5f578c120f8e15cd971022e2b2ad9ad7991
Python
1,169
42
"""add label, requires_path_in_url and requires_path_in_header_named columns to interactivetool_entry_point Revision ID: 8a19186a6ee7 Revises: ddbdbc40bdc1 Create Date: 2023-11-15 12:53:32.888292 """ from sqlalchemy import ( Boolean, Column, Text, ) from galaxy.model.migrations.util import ( add_col...
c66929ea02611650efcb5ca562aa6f0359be288b73a29b21ec2e499cb8c775b0
Python
1,170
32
from os.path import abspath, join def run(): from spitfire.chemistry.mechanism import ChemicalMechanismSpec from spitfire.chemistry.tabulation import build_nonadiabatic_defect_bs_library import spitfire.chemistry.analysis as sca test_xml = abspath(join('tests', 'test_mechanisms', 'h2-burke.yaml')) ...
13195772b2a05236e1e4f191f85bea27e08674389130b81d7912738439bc6868
Python
1,171
33
import setuptools with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setuptools.setup( name="gradient-accumulator", version="0.3.1", author="André Pedersen and David Bouget", author_email="andrped94@gmail.com", description="Package for gradient accumulation in Te...
2559531e8e6d6c4fe5fb33e3b4da8c64bd9cc680e2f602a8a2c5d9c1e56966fb
Python
1,171
40
"""Tests for minimal static export helpers.""" from __future__ import annotations from pathlib import Path import torch from torch import nn import torchlens as tl def test_export_html_minimal_self_contained_without_viewer(tmp_path: Path) -> None: """tl.export.html should write pan/zoom/hover HTML without vie...
445a666a0242e6c485b0ad8ceda4b36de0a64b27958a17b70267c6cc9358ffd6
Python
1,171
33
""" Integration tests configuration. Auto-applies ensure_datasets_ready fixture to all tests in this folder. This solves the timing issue where imports trigger dataset loading before the fixture has a chance to run. """ import os import pytest @pytest.fixture(autouse=True, scope="session") def _auto_en...
65055ae8c0fe98d27c0ee047fc8dfb6c470362770ef97965faf0d1b2f805c3da
Python
1,171
35
#### Modified from TAURUS Lee et al., Nat Methods 2019 (https://github.com/dixonlab/Taurus-MH) import sys fn=sys.argv[1] dfh=open(fn,'r') dfh.readline() rfh=open(fn+'_man_dedupped.txt','w') stat=open(fn+'_Aligned_Fragment_count.txt','w') pre='' duplicate=0 total=0 First_aligned=0 Second_aligned=0 Used_Frag=0 for i in...
f69404414017bf2aba5ac409bf5ff999b9cb66cc39d987f594b5b1f40769ce3c
Python
1,171
30
class EarlyStopping(): """ Early stopping to stop the training when the loss does not improve after certain epochs. """ def __init__(self, patience=5, min_delta=0): """ :param patience: how many epochs to wait before stopping when loss is not improving :param m...
bef16b2ae24bd3917539a662b52c8f3b77c4ed2b97f952d62baffa07bef18a80
Python
1,172
43
from anndata import AnnData def annotation( adata: AnnData, label_list: list[str], use_label: str = "leiden", copy: bool = False, ) -> AnnData | None: """\ Adding annotation for cluster Parameters ---------- adata Annotated data matrix. label_list List of the l...
552506e8f19121c3f94e39ccd181e41c643c4685c1d8c3f7e828095fbe006d74
Python
1,173
38
''' str(np.ndarray(stuff)) returns a different string depending on numpy version. develop a standard way to print arrays and multidimensional arrays which will never change. ''' import numpy as np def standardNumpyText(data): """return a numpy array as a standard string regardless of numpy version.""" if isi...
55fa3b8863667541077df2b2093eb8257b9966c056b9a9e25314b4a00023d225
Python
1,173
49
#!/usr/bin/env python3.4 import sys import getopt def usage(): print('''Useage: python script.py [option] [parameter] -l/--list input the filter bed list -o/--results the results -h/--help show possible options''') ####################### opts, args = getopt.getopt...
6a7f86a891c683ff5158f80d5373c29d44516f9b15ead5ff7de512c317512492
Python
1,173
33
# Copyright 2019 Novartis Institutes for BioMedical Research Inc. Licensed # under the Apache License, Version 2.0 (the "License"); you may not use # this file except in compliance with the License. You may obtain a copy # of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless # required by applicable law...
721a37cbed0ac6718cb75c60c3deefab5c5e5455582bcea3687af7241c08a0d9
Python
1,173
27
# Copyright 2018 The Sonnet 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 applicable l...
0a55d81dc5c8dff99a23bf6bf7d6e542294b3a85dbe3a4ae79c9fe25c2c581e2
Python
1,174
35
__version__ = "0.6.0dev" __author__ = "PyTorchLightning et al." __author_email__ = "name@pytorchlightning.ai" __license__ = "Apache-2.0" __copyright__ = f"Copyright (c) 2020-2021, {__author__}" __homepage__ = "https://github.com/PyTorchLightning/lightning-bolts" __docs__ = "PyTorch Lightning Bolts is a community contri...
0f0cf759ce457900b872001cb74d37f663ba9d191c05bcc12a09c4af54c588d5
Python
1,174
45
"""Add unique constraint to user_role_association Revision ID: 349dd9d9aac9 Revises: 1cf595475b58 Create Date: 2024-09-09 16:14:58.278850 """ from alembic import op from galaxy.model.migrations.data_fixes.association_table_fixer import UserRoleAssociationDuplicateFix from galaxy.model.migrations.util import ( c...
c7e7a02f3c9357fe683b0874d25428e9deebcc1ed6cd7fca4a369e93b38618bf
Python
1,174
32
from typing import List from carbonserver.api.errors import NotAllowedError, NotAllowedErrorEnum, UserException from carbonserver.api.infra.repositories.repository_experiments import ( SqlAlchemyRepository, ) from carbonserver.api.schemas import ExperimentReport from carbonserver.api.services.auth_context import A...
f7855be7650a87819b8696dd0045342b822906fa806d58e1c773e8a8e04075ac
Python
1,174
38
from typing import Tuple import torch from torch import Tensor class IRFFT2DTransform: """Inverse 2D Fast Fourier Transform (IRFFT2D) Transformation. This transformation applies the inverse 2D Fast Fourier Transform (IRFFT2D) to an image in the frequency domain. Input: - Tensor of shape (C,...
a10057ccb18cadbe6ae2a109478198def0ee5c2a025ccf23b1f786689f0d232b
Python
1,175
34
from modular_splicing.psams.motif_types import motifs_types from modular_splicing.utils.construct import construct def get_motif_names(motif_names_source): """ Get the names of the motifs for the given motif names source. """ from modular_splicing.eclip.test_motifs.names import peak_names psam_na...
f1327d3654edac69eb498b6f45040e56a957c007e40117868de2f8a676c4f5f7
Python
1,176
54
import os from enum import Enum, auto # scales of parameters class EnumTrans(Enum): transNone = 0 transLog = auto() transLogit = auto() transLogitAndSample = auto() # indices of model parameters class EnumModelParams(Enum): EmissionRate = 0 ParticleDensity = auto() ParticleSig = auto() ...
41e929fe958bb25dde6ccf69db0d26de5fe1bea5d5e8b024d8da689351798fd5
Python
1,177
38
""" Generate source estimate and BEM solution. """ import sys sys.path.append('..') import mne from config import fname import argparse # Be verbose mne.set_log_level('INFO') # Handle command line arguments parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('subject', type=int, metavar='sub###'...
41e9dd9cca87f054ca92f0ede4c08892e7dc0cb4caa9155d405b33f22893cc2e
Python
1,177
43
"""Root __init__ of the gym module setting the __all__ of gym modules.""" # isort: skip_file from gym import error from gym.version import VERSION as __version__ from gym.core import ( Env, Wrapper, ObservationWrapper, ActionWrapper, RewardWrapper, ) from gym.spaces import Space from gym.envs impo...
59e907b1c9cbf2536217a451b986fe0e23f287faf294f3c6906e103ade7c10be
Python
1,177
36
from __future__ import annotations import pytest from pybind11_tests import unnamed_namespace_a as m from pybind11_tests import unnamed_namespace_b as mb XFAIL_CONDITION = ( "(m.PYBIND11_INTERNALS_VERSION <= 4 and (m.defined___clang__ or not m.defined___GLIBCXX__))" " or " "(m.PYBIND11_INTERNALS_VERSION ...
b12e2df80ffe39fcb46d35618495750007a0be0234e3de3b6e7d9bcab906a8e9
Python
1,177
38
"""Minify a JSON file and write it as a C++ raw string literal .inc file. Usage: minify_json_to_inc.py <input.json> <output.inc> The output file contains a single raw string literal expression suitable for use with #include inside a C++ variable declaration: static const char kFoo[] = #include "output.inc" ...
d30c78cb9b51d67d324afcc834a5388caec892c38a946efa915110df1308caa3
Python
1,177
37
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ This script: Extracts face encodings from training images. Saves image features, labels, and addresses into a Pandas DataFrame. Stores this DataFrame in a pickle file. """ import pickle import glob import face_recognition import pandas as pd training_folder = './fea...
af14294ba61768ac32b5ac4958f1a63a3c940b35a326b6d4730ed35b4d5eeabe
Python
1,178
39
import numpy as np from permacache import permacache, stable_hash from modular_splicing.data_for_experiments.standardized_sample import ( standardized_sample_memcache, model_motifs_on_standardized_sample, ) @permacache( "modular_splicing/other_experiments/motif_positioning/compute_motif_positioning_relat...
bd5e10cfcf7681d93e99cdce9db151fdaab5dc481a00de4baea64bf8abe57c69
Python
1,178
43
"""SimCLR Model""" # Copyright (c) 2020. Lightly AG and its affiliates. # All Rights Reserved import warnings import torch import torch.nn as nn from lightly.models.modules import SimCLRProjectionHead class _SimCLR(nn.Module): """Implementation of SimCLR used by the command-line interface. Provides backw...
24299c0217d8d5fe844137c585b5a42f8afe433f7cd3e53c152f20ed6fb2b56c
Python
1,179
28
import numpy as np from .metrics._multiclass_classification import calculate_auroc, calculate_aupr from .metrics._regression import calculate_mse, calculate_pearsonr, calculate_spearmanr def evaluate_model(y_test, pred, task, verbose=True): if (task == "regression"): mse = calculate_mse(y_test, pred) ...
d6984d88800cff342d3e9fc08a90218754ec6a4581d2dedb84cb5ee32dd1ea21
Python
1,179
42
from pathlib import Path from typing import Literal from pydantic import PositiveInt from neurogym.config.base import ConfigBase class MonitorPlotConfig(ConfigBase): """Plotting configuration during monitoring. Attributes: create: Whether to generate plots. step: Number of steps to visualiz...
ec905f98eabc249d9780f8559a1f809314b70ad40867a6eb9e6fede24e8ad108
Python
1,179
52
from __future__ import annotations import os import pytest import env # noqa: F401 from pybind11_tests import eval_ as m def test_evals(capture): with capture: assert m.test_eval_statements() assert capture == "Hello World!" assert m.test_eval() assert m.test_eval_single_statement() ...
1386e04dd7e9573c35de24fd89d402878fbf6a2b556bcefe05e0373611319201
Python
1,180
27
# coding: utf-8 # Name: logger2file # Author: tyler # Data: 2022/4/19 import logging def init_logger(log_file=None, log_file_level=logging.NOTSET): log_format = logging.Formatter("[%(asctime)s %(levelname)s] %(message)s") # 设置输出格式 logger = logging.getLogger() logger.setLevel(logging.INFO) ...
2a400e844d1800c405f333d507998e4eb26ac9fbb830ee0ba9baa92fae7af33b
Python
1,180
25
""" Transformers for autoregressive normalizing flows in PyTorch. All the layers defined in this module are invertible and implement an ``inverse()`` method (not to be comfused with the ``Tensor``'s ``backward()`` method which backpropagate the gradients). The forward propagation of the modules here return both the t...
53615c80e4ed61c7a56687a239bd6880e19d09e9b9c0dec41f65778874f0d8b4
Python
1,180
42
# Copyright (c) 2021. Lightly AG and its affiliates. # All Rights Reserved import numpy as np from PIL import ImageOps from PIL.Image import Image as PILImage class RandomSolarization(object): """Implementation of random image Solarization. Utilizes the integrated image operation `solarize` from Pillow. Sol...
54ef9c08d2937a0ca6739670269806fe7b22766b9f4cd865a7b4027c142a6fbb
Python
1,180
45
"""Add unique constraint to user_group_association Revision ID: 56ddf316dbd0 Revises: 1fdd615f2cdb Create Date: 2024-09-09 16:10:37.081834 """ from alembic import op from galaxy.model.migrations.data_fixes.association_table_fixer import UserGroupAssociationDuplicateFix from galaxy.model.migrations.util import ( ...
77da44120f9d94a89cdaee01bebd7343051f75ffd313c422f380c1af1ee75c6c
Python
1,180
49
""" test_metadata.py Unit tests for metadata. """ import unittest import pathlib import pandas as pd from fused_org_ephys import FusedOrgSpikes ################################ class TestMetdata(unittest.TestCase): def setUp(self): # default dir to tc metadata metadata_path = pathlib.PurePat...
8e3dc51c4bc1404b9e7d9f3fbdc00cd440826e8833cef8c7f22be706117f2af1
Python
1,180
45
# All these transforms are taken from brainbox but copy-pasted because prednet requires older packages not # compatible with brainbox :( import torch class BBTransform: @property def hyperparams(self): hyperparams = {"name": self.__class__.__name__} return hyperparams class ClipGrayscale(B...
967282088b6778093e5f2aa38911ec7920bd96b15b305c03f3adae161ce41017
Python
1,180
38
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> """Feather data format reader After https://arrow.apache.org/docs/python/_modules/pyarrow/feather.html """ from pyarrow.lib import FeatherReader, DictionaryType import numpy as np from .._data_obj import Dataset, Factor, Var class Reader(FeatherReader): ...
17a07e8aa9d02a82863f11e08806c0a47f68260581c8c37876c8ddb10c218f0a
Python
1,181
45
"""Add unique constraint to group_role_association Revision ID: 9ef6431f3a4e Revises: 13fe10b8e35b Create Date: 2024-09-09 15:01:20.426534 """ from alembic import op from galaxy.model.migrations.data_fixes.association_table_fixer import GroupRoleAssociationDuplicateFix from galaxy.model.migrations.util import ( ...
6adbf6710193a481e4afc8507b9770578c969e7962101fb68d0dd476d142cc5e
Python
1,181
43
""" This code demonstrates how to perform measurements on small ranges of sweeps. """ # import the pyabf module from this development folder import os import sys PATH_HERE = os.path.abspath(os.path.dirname(__file__)) PATH_SRC = os.path.abspath(PATH_HERE+"/../src/") PATH_DATA = os.path.abspath(PATH_HERE+"/../data/abfs/...
7d9dede61f4f617ce2085878b44df5b7632d4dbbf030ca802f399b7c86d13c9e
Python
1,181
34
# Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master...
fc442328dcb7a742d94537fafbca193f573fb688e00a2d21aac7fab54fcb0d6e
Python
1,181
42
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.batch_size = 10 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec"] = dict( type="AdjustedMotifModel", model_to_adjust_spec=dict( type="PS...
351ded47512f7c751c3c917c958031969f36fc16584f072e7da79db718b575a7
Python
1,182
38
import pytest from PCA.src.utils import * def test_img_to_casorati_matrix(): # Create a sample image and mask img = np.array([[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]]) mask = np.array([[1, 0], [1, 1]]) # Call the function with the sample image and mask casorati_matrix = img_to_casorati...
0156d9b03578671c2a9d1477843b3161f2ecc1b3b5ce053165ee25a13ecea59a
Python
1,183
38
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["num_motifs"] = 82 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec"]["motif_width"] = 13 msp.architecture["motif_model_spec"]["motif_feature...
433b59706c69d67d495a9fc7c81e82d26e3030e6536c413d287a2177756d77d9
Python
1,183
47
"""add project tokens Revision ID: caf929e09f7c Revises: 7ace119b161f Create Date: 2024-07-25 19:51:43.046273 """ import sqlalchemy as sa from alembic import op from sqlalchemy.dialects.postgresql import UUID # revision identifiers, used by Alembic. revision = "caf929e09f7c" down_revision = "7ace119b161f" branch_la...
ad72b142e307b300a987edafcd352e381f7b0322ec20895133cb0b6125bf288c
Python
1,183
44
"""add_utilization_metrics_to_emissions Revision ID: 20251119_add_utilization Revises: 3212895acafd Create Date: 2025-11-19 18:52:00.000000 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "20251119_add_utilization" down_revision = "3212895acafd" branch_labels =...
fe3803fe6027e73c879db15b11372417149626639ec9eee085a5eba41c1fe944
Python
1,183
43
import numpy as np from numpy import testing as npt from tns.astrocyte import context as tested def _input_params(): return { 'endfeet_targets': np.array([[0., 0., 0.], [1., 1., 1.]]), 'space_colonization': { 'point_cloud': np.array([[2., 0., 0.], [2., 1., 1.]]), 'kill_dist...
8e224dfc848435b929dc9dc780d6cea5b8d89b2b4907d5edf7ada23cb74dfc7a
Python
1,184
37
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license try: from ray import tune assert hasattr(tune, "get_context") # verify Ray>=2.41 Tune API, also required by tuner.run_ray_tune except (ImportError, AssertionError): tune = None def on_fit_epoch_end(trainer): """Report training metr...
4cca631077dedf998f80a6b3af1c377518325b5cec5ecb12d993030c2ac23f59
Python
1,185
39
import glob import os import os.path as osp from setuptools import find_packages, setup from torch.utils.cpp_extension import BuildExtension, CUDAExtension this_dir = osp.dirname(osp.abspath(__file__)) _ext_src_root = osp.join("pointnet2_ops", "_ext-src") _ext_sources = glob.glob(osp.join(_ext_src_root, "src", "*.cpp...
fe0ee6acfed0c806db175a8600e7cb180cf8fdf19822fd8a67abc56fad6db0a0
Python
1,185
34
"""Helpers for emitting deprecation warnings.""" from __future__ import annotations import warnings def warn_deprecated( name: str, alternative: str, removed_in: str, stacklevel: int = 3 ) -> None: """Warns that ``name`` is deprecated and will be removed. Uses ``FutureWarning`` rather than ``Deprecatio...
40b5626ea7429a2f653dfea83e213e279dcbe61bd5bd4c927a3aaab46f42932f
Python
1,186
32
# __init__.py # Copyright (C) 2013 Bastian Venthur # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program i...
a27532fdcc1306f6c884b0f140f5f57c9a21c8d59cf7cb0c52bfd2ac06e0fe64
Python
1,186
36
""" DataProvider related exceptions. """ class InvalidDataProviderSource(TypeError): """ Raised when a unusable source is passed to a provider. """ def __init__(self, source=None, msg=""): msg = msg or f"Invalid source for provider: {source}" super().__init__(msg) class NoProviderAv...
9ed0a8f16e516d89faaa7adb9d44cea2607043474e1d18a2372f60379169833a
Python
1,187
44
import sys if sys.version_info >= (3, 9): from importlib.resources import files else: from importlib_resources import files from ._nmodl import * RESOURCE_DIR = "ext/example" def list_examples(): """Returns a list of examples available The NMODL Framework provides a few examples for testing R...
ab4414b8941fb6bc792c96b9f7eaec9d54587efae36422a167dd794b30b54a55
Python
1,187
36
"""Shared machinery for the real-model tree (testing MEMO; lanes P04+B1). Registers the realism SELECTION markers (memo D8: orthogonal to the smoke/heavy/slow/rare cost tiers). The pyproject marker declarations are P03's single-owner territory (declared once in its first commit); this in-tree registration keeps the tr...
598aef7b1f0e41a8dbec48eda0f8165c704fc282bff5e422f47802c6a8e15fb4
Python
1,188
38
import sys from typing import TYPE_CHECKING if TYPE_CHECKING: from ._caps import Caps from ._colorbar import ColorBar from ._contour import Contour from ._hoverlabel import Hoverlabel from ._legendgrouptitle import Legendgrouptitle from ._lighting import Lighting from ._lightposition import...
94a503ba4f5a6357da4479a477e025faa0f16c460b5e0dcda3dd75eb965b1963
Python
1,188
42
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["num_motifs"] = 82 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec"]["motif_width"] = 13 msp.architecture["motif_model_spec"]["motif_feature...
9874a917153d1053b3cf9e824ab2ab7edf8218d302efd647d10e0ffdfcef977f
Python
1,188
42
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["num_motifs"] = 82 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec"]["motif_width"] = 13 msp.architecture["motif_model_spec"]["motif_feature...
bcd24b86bb1b343d068a1d55a198a51f56d3679995ed700179556d7a03b3fffe
Python
1,188
43
import torch import torch.nn as nn from models.dymn.dy_block import DynamicConv def get_values(x): return (x, x) if isinstance(x, int) else x def receptive_field_cnn(model, spec_size): kernel_sizes = [] strides = [] dilation = [] def conv2d_hook(obj, input, output): kernel_sizes.append(...
dd0d91a1c485307375fc0faeca046e916e93af5d8297c81c73310ceb8bc61b97
Python
1,188
43
""" --- Distance measures --- """ import numpy as np from scipy import stats def minkowski(p1,p2,k): '''Minkowski distance between points p1 and p2 if k equals 1, it is a Manhattan (cityblock) distance if k equals 2, it is a Euclidean distance ''' if isinstance(p1, np.ndarray) and isinstance(p2...
35ba1c755fda26340c66cf43259ad2b694e7905670fcaf1220210cc1a96c3ea2
Python
1,189
35
"""Private keys for the security serializer.""" from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives.asymmetric import padding, rsa from kombu.utils.encoding import ensure_bytes from .utils import reraise_errors __all__ =...
47fdc3a666bac4a6abfb7043bf6f5bb8e753ec5cdc8e54f872c951d104e44532
Python
1,189
49
from MarkovModels import common from MarkovModels.BeattieModel import BeattieModel import matplotlib.pyplot as plt import argparse import numpy as np import pandas as pd import os from matplotlib.gridspec import GridSpec from matplotlib import rc rc('font', **{'family': 'serif', 'serif': ['Computer Modern'], 'size'...
dc27db9556a76b6fb8edd8147ba21a8cbae9e67def8a119d9af1ed83ddd9f59f
Python
1,189
56
#!/usr/bin/env python # coding: utf-8 # In[1]: import tpot import pandas as pd import numpy as np from tpot import TPOTRegressor from sklearn.model_selection import TimeSeriesSplit from sklearn.model_selection import train_test_split # In[2]: features = pd.read_csv('SCADA-FINAL-1daybiogas-lags.csv') features['T...
affa380e0b08eb2bbe70c853c64e5ae6273c2914b1d2e0f1c26c30d8a177832b
Python
1,191
44
import tensorflow as tf from tensorflow.keras.callbacks import Callback from codecarbon import EmissionsTracker """ This sample code shows how to use CodeCarbon as a Keras Callback to save emissions after each epoch. """ class CodeCarbonCallBack(Callback): def __init__(self, codecarbon_tracker): self.co...
f902924bd5c5822b574dfe24cd3906a0fb310cfb5222093a5bb8c8ea535e2425
Python
1,191
39
import tensorflow as tf from cvnn import logger import cvnn.initializers as initializers from pdb import set_trace import sys shape = (3, 3, 3) dtype = tf.dtypes.float32 def compare(key, tf_init, my_init): tf_version = tf_init(seed=100)(shape=shape, dtype=dtype) my_version = my_init(seed=100)(shape=shape, dt...
6f59dbc0e65bb6957ae97670f4b116b7986ec45f19eb747f97bc336858113f9b
Python
1,192
45
import numpy as np def gaussian_preprocess_filter( orig_vox, orig_spacing, sample_spacing=None, param_beta=0.98, mode="nearest", separate_slices=False ): from scipy.ndimage import gaussian_filter # If no sample spacing is provided, assume original spacing. Not...
8f2af6a11c5a118c18f5429a390cb985fb5942518381fde05f48b814a530f811
Python
1,192
39
from __future__ import annotations import unittest from coco_froc_analysis.utils import build_gt_id2annotations from coco_froc_analysis.utils import build_pr_id2annotations class TestId2Annotation(unittest.TestCase): def setUp(self): self.gt = { 'images': [{'id': 1}, {'id': 2}], ...
4194c4d46d65fdf0b5833f5e9f66827d3a1436fedbd09c34cb9230057884f87f
Python
1,193
43
from sklearn.metrics import roc_auc_score, roc_curve import numpy as np import matplotlib.pyplot as plt def auc(scores, contributions): """ function to obtain the AUC values based on ground truth and feature attribution scores Args: scores (_type_): Feature attribution scores contribu...
6ba68e140c486381b97d9c58d799d0704883e728f636303ebc0a8fa5fc5cb114
Python
1,193
34
from local_extractor.states.DL import DelhiExtractor from local_extractor.states.GA import GoaExtractor from local_extractor.states.HR import HaryanaExtractor from local_extractor.states.KA import KarnatakaExtractor from local_extractor.states.KL import KeralaExtractor from local_extractor.states.MH import MaharashtraE...
8ad383668f7cad13f99930936c64fb6aa641c3270cfe60d8fd2299bc6528c16d
Python
1,193
42
import numpy as np import torch.nn as nn from .sparsity import SparseLayer from .spatially_sparse_by_channel import SpatiallySparseByChannel class SpatiallySparseAcrossChannels(SparseLayer, nn.Module): """ Like SpatiallySparseByChannel but uses the same threshold for all channels. """ def __init__(...
c121fda100b70e65bf93fd8289dce369fe9ba444310cb15f1a526faded2b11fc
Python
1,193
56
import torch as ch import cox from cox import store # dog (117), cat (5), frog (3), turtle (5), bird (21), # monkey (14), fish (9), crab (4), insect (20) RESTRICTED_IMAGNET_RANGES = [(151, 268), (281, 285), (30, 32), (33, 37), (80, 100), (365, 382), (389, 397), (118, 121), (300, 319)] CKPT_NAME =...
d9b50e0b0ebab5428fefbe6918f7794938f452646ec2f06d2390a063c1de1ca2
Python
1,193
28
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Tests for random projection""" import unittest from sknetwork.data.test_graphs import test_graph, test_bigraph, test_digraph, test_disconnected_graph from sknetwork.embedding import RandomProjection class TestEmbeddings(unittest.TestCase): def test_random_projec...
4dc1c98f5b4872bf1d0d205b9c0823abb04b59004596bd40caaed67751a48231
Python
1,194
41
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> from contextlib import ContextDecorator import os import sys IS_OSX = sys.platform == 'darwin' IS_WINDOWS = os.name == 'nt' if IS_OSX: from . import macos as c else: from . import dummy_os as c class ActivityContext(ContextDecorator): """Context d...
2754b4896d35638a42e01ed7918d5c80ed0294fc1d8ca09e3afcf8ff45dbe571
Python
1,195
39
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["num_motifs"] = 82 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec"]["motif_width"] = 13 msp.architecture["motif_model_spec"]["motif_feature...
307e3a1e05a8906ca1d4903ec60baa5698f57b4791ad3b2e3d6c908734963db7
Python
1,195
47
from setuptools import setup, find_packages from distutils.command.install import install import os HOME = os.path.expanduser('~') # this is where the non-python dependencies will be installed. DEFAULT_INSTALL_DIR = os.path.join(HOME, 'split_seq_reqs') class CustomInstall(install): """Customized setuptools ins...
3ae6e395d1c91f528613508ab7591153e439e6479fb474f779ad58a0bd1949ca
Python
1,195
55
import dis import array import collections try: import html except ImportError: html = None from setuptools.extern import six from setuptools.extern.six.moves import html_parser __metaclass__ = type OpArg = collections.namedtuple('OpArg', 'opcode arg') class Bytecode_compat: def __init__(self, code): ...
3e466f205f3349a61f7cde7171c41b24e8d016be432e75dafacff7a1c9dc5030
Python
1,195
36
""" core.metrics — Balanced accuracy and PPV/NPV. """ from __future__ import annotations import numpy as np def balanced_accuracy(y_true, y_pred) -> float: """Balanced accuracy = mean of per-class recall.""" y_true = np.asarray(y_true, int) y_pred = np.asarray(y_pred, int) n0 = int((y_true == 0).sum()...
3e6b1239f336d430ee09ca52c51e1b0eddd699ca0c654619e683f063a46cbaf0
Python
1,195
39
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["num_motifs"] = 82 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec"]["motif_width"] = 13 msp.architecture["motif_model_spec"]["motif_feature...
dfbc84d37e89baf0fb69f46dee94011a401ab2923e77224a7047f139a0b284df
Python
1,196
41
#!/usr/bin/env python """ Input: molecular input file. Output: Molecule file with removed ions and fragments. Copyright 2013, Bjoern Gruening and Xavier Lucas """ import argparse from openbabel import openbabel, pybel openbabel.obErrorLog.StopLogging() def parse_command_line(): parser = argparse.Arg...
a0e0f3471ff2d5546f99c0d4ac8a854b3d91f8fc365054c014c28c81c4e668ea
Python
1,197
27
import chcochleagram cochleagram_1 = {'rep_type': 'cochleagram', 'signal_size':40000, 'sr':20000, 'env_sr': 200, 'pad_factor':None, 'use_rfft':True, 'coch_filter_type': chcochleagram.cochlear_filters.ERBCosFilters, ...
f96024ba4097f45a2e51977fa1d9b18b0f586b7bb92dcc89fb841d97d13d7c34
Python
1,197
49
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["num_motifs"] = 20 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec"] = dict( type="AdjustedMotifModel", model_to_adjust_spec=dict( ...
3715973a0f57fa9a71dae73187f97a9f9a3c7f371bbd5f7690ea9d31e7ecb51b
Python
1,198
47
#from cox_nnet_v2 import * import numpy import sklearn import sklearn.model_selection import pandas as pd import time import dill from sklearn.preprocessing import MinMaxScaler d_path = "BRCA/" #x = numpy.loadtxt(fname=d_path+"259p_phenotypic27.csv",delimiter=",",skiprows=1) #x = numpy.loadtxt(fname=d_path+"259p_mic...
3ef747d77a5439ee2c1e7418b98405dd6c1838e6c3ce6b7a7683b68a242c70e0
Python
1,198
38
import os from modular_splicing.data_pipeline.create_dataset import create_dataset datafiles_from_chenxi = { "fly": "../data/drosophila_model_and_data/drosophila_datafile_test_0.h5", "mouse": "../data/mouse_model_and_data/musculus_datafile_test_0.h5", } def dataset_for_species(species): """ Provide t...
8fda9406dad51a6c48eaf5bf75989ef2694a25eb114f5a507178dc4dcc6f5751
Python
1,198
46
from typing import ( cast, TYPE_CHECKING, ) from galaxy.files.models import FileSourcePluginsConfig from galaxy.util.plugin_config import ( load_plugins, PluginConfigSource, plugins_dict, ) if TYPE_CHECKING: from galaxy.files.sources import BaseFilesSource class FileSourcePluginLoader: d...
c6d9e6d6f5c9f7eea2432ead749d71fc1253d7a36c9bf0b17f017f38d9bce46e
Python
1,198
39
#!/usr/bin/env python # Dan Blankenberg import sys import bx.align.maf from galaxy.datatypes.util import maf_utilities def __main__(): output_name = sys.argv.pop(1) input_name = sys.argv.pop(1) count = 0 with open(output_name, "w") as out, open(input_name) as infile: for count, block in enu...
cd24ccdc9772f4e7c1d6f7f21f9d60f3665737ace34ca0a683ae1e0742004960
Python
1,198
49
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["num_motifs"] = 32 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec"] = dict( type="AdjustedMotifModel", model_to_adjust_spec=dict( ...
8f76183343f7c56a959c19de3ff36ea18996e10751106b0d99073a38a35be827
Python
1,199
59
import numpy as np from neuron import h, gui from neuron.units import ms def assert_equal(a, b): assert a == b, f"{a} != {b}" def test_for_netcons(): nseg = 1 soma = h.Section() soma.nseg = nseg syn1 = h.ForNetconsSyn(soma(0.5)) syn1.a0 = 1.0 syn2 = h.ForNetconsSyn(soma(0.5)) syn...
953203eebe2a532e0281fc3e8590b25819a309928d516e762911ed4b1bc42970
Python
1,199
43
import os import sqlite3 class Database(object): def __init__(self, datadir): self.datadir = datadir self.db_name = os.path.join(datadir, 'covid-india.db') self.conn = self.make_conn() def init_tables(self): self.tables = {} def make_conn(self): conn = sql...
992b4ae1988dd6155d66bf10f51efc005068bae03d4488674389f01ab7c28c26
Python
1,199
40
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """"tests for search.py""" import unittest import numpy as np from sknetwork.data import cyclic_digraph from sknetwork.data.test_graphs import * from sknetwork.path import breadth_first_search class TestSearch(unittest.TestCase): def test_bfs(self): adjac...
4c5568c0b45bab5f4b16794a196b1a28495c22c0c0cfe22ff31dda9123a9b3a6
Python
1,200
45
"""project tokens hashed Revision ID: 54d9cae546ad Revises: 711ce9f88326 Create Date: 2024-10-15 10:03:34.722490 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "54d9cae546ad" down_revision = "711ce9f88326" branch_labels = None depends_on = None def upgrade()...
61906ac5e60f4fbf5ce9a8bcaf4d5bd8251ce69c579d121890fe9fd1f7bd4e5f
Python
1,200
55
from neuron import h def check_defaults(obj, parameters): defaults = { "b": 0.1, "y": 2.1, } for p in parameters: actual = getattr(obj, f"{p}_default_parameter") expected = defaults.get(p, 0.0) assert actual == expected def test_default_values(): nseg = 10000...
c533531e3edd0714cafb9aff510069adc9fba2a436035162126798e9093d75a7
Python
1,200
42
"""Tests for specparam.reports.save.""" import os from specparam.tests.tsettings import TEST_REPORTS_PATH from specparam.reports.save import * ################################################################################################### #########################################################################...
3dc4439d406144c4270bb643a0b8608e2842d67aaf114a6e4b8637d4cb925c42
Python
1,201
38
# Copyright Niantic 2019. Patent Pending. All rights reserved. # # This software is licensed under the terms of the Monodepth2 licence # which allows for non-commercial use only, the full terms of which are made # available in the LICENSE file. from __future__ import absolute_import, division, print_function import o...
6e5eb305eb4f92e845ebfb89dbabb1a0aeca83e6df442d36aadf32305ca77fdb
Python
1,201
44
import os import pandas as pd pd.set_option('display.max_columns', 10) from tqdm import tqdm tqdm.pandas() from drug_interactions.utils.calc_metrics import calc_metrics test_df = pd.read_csv('./data/csvs/data/test_new_old_chemprop_similar.csv') test_df = test_df.sort_values(by=['Drug1_ID', 'Drug2_ID'], ascending=Tr...
9ffce6c5dfa7a3bfc86d011e214b7cb565ce2c16e9128a6e7cc60d3a3020b373
Python
1,201
39
"""Check changed translation units using their CMake compilation commands.""" import json from pathlib import Path import subprocess import sys base, build_directory, clang_tidy = sys.argv[1:] commands = json.loads((Path(build_directory) / "compile_commands.json").read_text()) compiled_files = { (Path(command["d...