sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
adf1d3f3f626cd91ebb1f7ef5f2fb445659c73f1759e762ac46ee6ccbd0811b7 | Python | 1,886 | 70 | """
This module is part of *vcnmodel*.
Support::
NIH grants:
DC R01 DC015901 (Spirou, Manis, Ellisman),
DC R01 DC004551 (Manis, 2013-2019, Early development)
DC R01 DC019053 (Manis, 2020-2025, Later development)
Copyright 2017-2022 Paul B. Manis
Distributed under MIT/X11 license. See license.txt for... |
0e02e7c6fa0fec3ccf5e28c874ad463586fa50f77cb3e61f48f890c6e5078959 | Python | 1,887 | 51 | from abc import ABC
from .base_handler import BaseHandler
from .contractions import CONTRACTION_MAP
from torchtext.data.utils import get_tokenizer
import re
import string
import torch
import unicodedata
class TextHandler(BaseHandler, ABC):
def __init__(self):
super(TextHandler, self).__init__()
se... |
42c29c32f09c1c0a986beb72ed058c87cbaccf757278ea426acaf9d0dcbd7d2e | Python | 1,887 | 59 | #!/usr/bin/env python3
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
def read_requirements(file_name):
reqs = []
with open(os.path.join(here, file_name)) as in_f:
for line in in_f:
line = line.strip()
if not line or li... |
ab77edc0a2a788d957ab93e436b5b978c268e2be9aafbe2998dc56835a2ad60c | Python | 1,890 | 47 | import scipy.stats
import numpy as np
from .population import Population
from .. import cells
class Tuberculoventral(Population):
type = 'tuberculoventral'
def __init__(self, species='mouse', **kwds):
# Note that `cf` is the mean value used when selecting SGCs to connect;
# it is NOT the ... |
35286c4062fe7aa4ba05737835d4dfa07cba479a68c48e50b69c6b5abb0a9f9e | Python | 1,891 | 49 | import os
import pandas as pd
import torch
from torch.utils.data import Dataset
import numpy as np
class DSECDatasetLite(Dataset):
def __init__(self, root:str, file_list: str, num_frames_per_ts: int = 1, stereo = False, transform=None):
self.events_path = os.path.join(root, 'event_tensors', '{}fra... |
37297126f1e0a5ff907de9fef28b1f3c74edec52160db332bc59c771e275d464 | Python | 1,891 | 59 | import argparse
from collections import OrderedDict
from pathlib import Path
import torch
def convert(src, dst):
print('Converting...')
blobs = torch.load(src, map_location='cpu')
converted_state_dict = OrderedDict()
for key in blobs:
splited_key = key.split('.')
splited_key = ['norm... |
b672dc1543d3d63f59514d2219c3ad22ddd709bb002a9b4836dd28f5dd55e57c | Python | 1,891 | 59 | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from torch import nn
from torch.nn.modules.batchnorm import _BatchNorm
from mmcls.models.backbones import TIMMBackbone
def check_norm_state(modules, train_state):
"""Check if norm layer is in correct train state."""
for mod in modules... |
15de4f3a06ff7e9978506276e267e0909b0c57704aabe1be8fa9e126b149f0ee | Python | 1,892 | 73 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import onnx
import onnx.onnx_cpp2py_export.parser as C # noqa: N812
class ParseError(Exception):
pass
def parse_model(model_text: str) -> onnx.ModelProto:
"""Parse a string to build a Model... |
c5c88ebb4a5f053d51d60ac3c739df4cfcb1aa9f75ed2f4989ae3a923e17a186 | Python | 1,892 | 71 | from __future__ import annotations
import re
from pathlib import Path
from setuptools import find_packages, setup
install_requires = [
"numpy >= 1.21.0",
"torch >= 1.8.0",
"energyflow >= 1.3.0",
"scipy >= 1.6.2",
"awkward >= 1.4.0",
"coffea >= 0.7.0",
"h5py >= 3.0.0",
"pandas",
"t... |
4e83e3e3971e05a82b683f275775647d83a50543536baf4a9bcc05191b9471f3 | Python | 1,894 | 50 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import pytest
import onnx.version_converter
from onnx import TensorProto, checker, helper
class TestVersionConverter:
@pytest.mark.parametrize("used", [False, True])
@pytest.mark.parametrize(... |
b701c4771b6d5d5b70e40663a4b03bc46a4aded3ee1dce8c858741a209ec68b7 | Python | 1,895 | 52 | ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
## Created by: Yaoyao Liu
## Modified from: https://github.com/Sha-Lab/FEAT
## Tianjin University
## liuyaoyao@tju.edu.cn
## Copyright (c) 2019
##
## This source code is licensed under the MIT-style license found in the
## LICENSE file in the r... |
534c4137ebf865d81ac67bd32fc03aa2e6ccd4634e66fe07b14e3d1fd8395033 | Python | 1,896 | 76 | # Copyright 2026 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... |
b003cf0192f9a3b07b3d92e8d701c23a0c953259420289f84c73dbdf55d1ce98 | Python | 1,896 | 53 | # Copyright (c) OpenMMLab. All rights reserved.
from unittest.mock import MagicMock, patch
import numpy as np
from mmcls.datasets import BaseDataset, RepeatAugSampler, build_sampler
@patch.multiple(BaseDataset, __abstractmethods__=set())
def construct_toy_single_label_dataset(length):
BaseDataset.CLASSES = ('f... |
4b8842bebe4d42b470ec57e6f5bab606f7c9c3ff1bb63e5a17922e60807ba3d9 | Python | 1,897 | 74 | # 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... |
7acd8db104b09e450d3362cf19718b03915a5acba29315c5812e8f6c78190d31 | Python | 1,899 | 48 | # This is a demo of running face recognition on a Raspberry Pi.
# This program will print out the names of anyone it recognizes to the console.
# To run this, you need a Raspberry Pi 2 (or greater) with face_recognition and
# the picamera[array] module installed.
# You can follow this installation instructions to get ... |
e720e466e24d631791e71abcca605c3fffb5dba590f9f975091cac3494c9b256 | Python | 1,900 | 46 | from sklearn.ensemble import RandomForestRegressor
from sklearn.feature_selection import VarianceThreshold
import pandas as pd
import os
def select(cfg, args):
matrix_genus = pd.read_hdf(args.i, key='genus')
phylo = pd.read_csv(args.phylo, index_col=0)
C = args.C
print(matrix_genus)
if not args.use_... |
ff20764750231a6a2cdd7933179f1f5435c30955ee6ee108bf9b863810d4443a | Python | 1,903 | 82 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Backend-independent training abstractions."""
from .checkpoint import (
CheckpointStore,
build_checkpoint_stores,
resolve_keep_ckpt_count,
)
from .data import (
TrainingTaskConfig,
iter_training_task_configs,
make_task_maps,
print_data_summari... |
de721658a3961d17ec041c626934922995559e076fdb71c2f2a4884eb873d0b2 | Python | 1,904 | 57 | # Copyright (c) OpenMMLab. All rights reserved.
from collections import OrderedDict
import torch.distributed as dist
from mmcv.runner import OptimizerHook
from torch._utils import (_flatten_dense_tensors, _take_tensors,
_unflatten_dense_tensors)
def _allreduce_coalesced(tensors, world_size,... |
1245ec0172126a399f0bf00f3fa4ed13a66349e60d48eb56fcf5a7bc612d38bd | Python | 1,905 | 62 | """Isolated numba imports for _dtw."""
__author__ = ["chrisholder", "TonyBagnall"]
import warnings
import numpy as np
from skbase.utils.dependencies import _check_soft_dependencies
from sktime.utils.numba.njit import njit
if _check_soft_dependencies("numba", severity="none"):
from numba.core.errors import Numb... |
cf3d04fea2c0a418400c77dd0684596e3f645a66015c299c47e8f73f905d0ab4 | Python | 1,906 | 58 | from torch.utils.data import Dataset
import torch
import logging
from typing import Dict, Union
class JetDataset(Dataset):
"""
PyTorch dataset.
"""
def __init__(self, data: Dict[str, torch.Tensor], num_pts: Union[int, float] = -1, shuffle: bool = True):
self.data = data
self.shuffle ... |
1f4a77ceff48d242c7475faa2b198ad10d23ad618740ddc874513173511a4387 | Python | 1,907 | 71 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 3 15:51:18 2022
To make cluster file for glycan-interacting protein names only.
works on directory containing glycan interaction proteins.
@author: sudhanshu
"""
def main():
# reading pdb cluster file
file = "./data_files/clusters-b... |
29f6de733cf389ed53daa0e4de8d3cbed7a4ba76dd43e792f669e74eb1c1a8b8 | Python | 1,907 | 56 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
def reshape_input(
value: np.ndarray,
shape: tuple[int, ...],
axis: int,
block_size: int | None = None,
) -> np.ndarray:
"""Reshape/Replicate scale/zero-point to ... |
7d42205cd306e48fd1375283a7929ae7321c4ffd1ef6c95eb4b528d3c4cfc081 | Python | 1,907 | 55 | import math
from typing import Tuple, Union
import jetnet
import torch
from torch import nn
EPS = 1e-16
class EMDLoss(nn.Module):
"""EMDLoss Wrapper for jetnet.losses.EMDLoss"""
def __init__(self, *args, **kwargs):
"""EMDLoss Wrapper for jetnet.losses.EMDLoss"""
super(EMDLoss, self).__init__... |
9f25284030666f12287d3790cec7d9cd016798287d7a5f481bcd02f5fa0e589a | Python | 1,907 | 54 | import torch
import flair
from flair.data import Sentence
from flair.models import Lemmatizer
def test_words_to_char_indices():
sentence = Sentence("Hello look what a beautiful day!")
lemmatizer = Lemmatizer() # lemmatizer uses standard char dictionary
d = lemmatizer.dummy_index
e = lemmatizer.end... |
edaa131434684209237e81b0f400b902542086fae52ed9f93573076e63f839f0 | Python | 1,907 | 55 | # 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... |
aeca4f31c5816af7d6747b29ae4c038c39050e8389bd06890027143ed2036ada | Python | 1,908 | 62 | """Test benchmarking using dummy catalogues."""
import pandas as pd
import pytest
from sktime.benchmarking.classification import ClassificationBenchmark
from sktime.benchmarking.forecasting import ForecastingBenchmark
from sktime.catalogues import (
DummyClassificationCatalogue,
DummyForecastingCatalogue,
)
f... |
7c3cac7c7d6a1b7b1b9bfca299d0226e6509a24f8c809a293b4bc0150dd77965 | Python | 1,909 | 58 | from typing import List
import pandas as pd
from sklearn.linear_model import LogisticRegression
from sklearn.multiclass import OneVsRestClassifier
class LogisticRegressionModel:
"""Logistic regression model with same interface as DepthWiseXGBPipeline.
Trains on concatenation of training and validation sets.
... |
694d25a4ce3b3dac834e53ed786fcffa4ed211325b0208ed48da90ac3cdb34bc | Python | 1,910 | 53 | # Copyright 2021 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... |
8e842b7d789975815cd6882c551fe62c963adb834e537e65fc6dcf6e15bfd6bd | Python | 1,910 | 72 | import numpy
class Highlighter:
def __init__(self) -> None:
self.color_map = [
"#ff0000",
"#ff4000",
"#ff8000",
"#ffbf00",
"#ffff00",
"#bfff00",
"#80ff00",
"#40ff00",
"#00ff00",
"#00ff40... |
4e264e92c1f24d9019209b681a3caf8840a42c71aef4d5be6553487970eb6d1c | Python | 1,911 | 65 | # -*- coding: utf-8 -*-
# Written (W) 2008-2012 Christian Widmer
# Written (W) 2008-2010 Cheng Soon Ong
# Written (W) 2012-2014 Daniel Blanchard, dblanchard@ets.org
# Copyright (C) 2008-2012 Max-Planck-Society, 2012-2014 ETS
# This file is part of GridMap.
# GridMap is free software: you can redistribute it and/or m... |
3151260c427a2dbc3e93325c83172c1c895ba788214b532c7a872080af48e9e6 | Python | 1,912 | 49 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.op_run import OpRun
class TensorScatter(OpRun):
def _run(self, past_cache, update, write_indices=None, mode="linear", axis=-2):
if mode not in {"line... |
1e7a6b422af20b3c215aeb04cedcabd665b7c1a3f327d29abe5d5cfe68d5675b | Python | 1,913 | 60 | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import mmcv
from packaging.version import parse
from .version import __version__
def digit_version(version_str: str, length: int = 4):
"""Convert a version string into a tuple of integers.
This method is usually used for comparing two versions... |
8bcde8caeec885cf5fe7c90eb77d420534310d56f05b0e4948fd0988c665b3ed | Python | 1,913 | 53 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
class OneHotEncoder(OpRunAiOnnxMl):
def _run(self, x, cats_int64s=None, cats_strings=None, zeros=None):
... |
9b6aee4d64ae5c6ccb2bf11998b55ee09b49a9f40ee1644d2a7c993261ffaa84 | Python | 1,913 | 70 | import h5py
import numpy as np
from scipy import signal
def load_data(filename, start, end, step, channels):
"""
Load neuropixel data in HDF5 format.
Parameters
----------
filename: str
HDF5 file path
start: int
end: int
step: int
channels: List[int]
Returns
-------
... |
a2c054b06fda68a8c19111cf98bb2de836fd3c4ecaab5d938d8f3b82cfdf497b | Python | 1,914 | 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 RegexFullMatch(Base):
@staticmethod
def export_basic() -> None... |
5579a1e2374730672ec7ade6471263bbffc6170217af92910b2bfe8cc88c37a7 | Python | 1,916 | 55 | import torch
import numpy as np
def mod_loss_function(pred, label, mask):
n_pixels = torch.sum(mask)
#print(torch.sum(pred), torch.sum(label))
#print(pred)
error_mod = torch.sqrt(torch.pow(pred[:,0] - label[:,0], 2) + torch.pow(pred[:,1] - label[:,1], 2))
return torch.sum(error_mod * mask... |
0c53bf59e287073860c77fd386db81d0ceb52074b82228cff6f31bbea2f22460 | Python | 1,917 | 64 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops.aionnx_preview_training._op_run_training import OpRunTraining
def _apply_adagrad(r, t, x, g, h, norm_coefficient, epsilon, decay_factor):
# Compute adjus... |
1c70daf4e34dd3e163e3e589d2b7a5b77b1c26401b001b7799d1ccb459118f0b | Python | 1,918 | 52 | r"""akkadian <https://github.com/gaigutherz/Translating-Akkadian-using-NLP> is a tool for transliterating akkadian.
Transliterating akkadian signs::
>>> import akkadian.transliterate as akk
>>> print(akk.transliterate("𒁹𒀭𒌍𒋀𒈨𒌍𒌷𒁀"))
"{m}-{d}-30-ŠEŠ.MEŠ {URU}-ba-"
Transliterating akkadian signs usin... |
5463d687df8a26a4658204ed7ce1e0e5118310616f727b99a1c9e78098f56339 | Python | 1,920 | 59 | from setuptools import setup, find_packages
import os
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
def find_version():
path_to_version = os.path.join(ROOT_DIR, "siibra", "VERSION")
with open(path_to_version, "r", encoding="utf-8") as f:
return f.read()
with open(os.path.join(ROOT_DIR, "REA... |
e60403f9e65889c7a66e4ce7bbe83bce19c0e2f996e019703f7c29b717bc61c2 | Python | 1,921 | 58 | import collections as col
import os
import pandas as pd
import atom3d.util.file as fi
def get_target_name(filename):
filename = str(filename)
_, ext = os.path.splitext(filename)
if ext in ['.dat', '.ss2']:
return os.path.splitext(os.path.basename(filename))[0]
elif ext in ['.pdb', '.mmcif', ... |
f885f1aabe579b35b72ae59b9cc4582fa09d5f50187c6228cabc59ba07d47a58 | Python | 1,924 | 65 | import logging
from multiprocessing.pool import ThreadPool
import torchio as tio
from omegaconf.dictconfig import DictConfig
from rich.logging import RichHandler
FORMAT = "%(message)s"
logging.basicConfig(level=logging.INFO,
format=FORMAT,
datefmt="[%X]",
ha... |
963ac7ef1d98b015a46a4f96c06eed3cdeb6f6aa661f28c6aebb479f4db6aaba | Python | 1,925 | 55 | # 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... |
8dd6a30efb0c1b44f069e8dc2d3a79aecf7d5e32644058cd748e5020a779dfa1 | Python | 1,926 | 75 | # 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 MlpMixer
def is_norm(modules):
"""Check if is one of the norms."""
if isinstance(mo... |
f46220545ed798a271d88ea17954b770bba1c4668a4f1b725e05d3cf81794d2c | Python | 1,926 | 52 | import warnings
import json
def dend_json_2_nodes_n_edges(path_to_json):
f = open(path_to_json, 'r')
j = json.loads(f.read())
out = {}
tree_recurse(j, out)
f.close()
return out
def tree_recurse(tree, out, parent_node_id=''):
"""Convert Allen Taxonomy JSON to a list of nodes and edges, wh... |
1da4558d4101b374923c844fdb3593e0d645a95f10c66fd190abe0f69cda257d | Python | 1,928 | 54 | # 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... |
28b437f32a5b82f40737fa1904d004aa822950270821def50c88a0d5c890713e | Python | 1,928 | 62 | """
Read a hoc file, and rescale x,y,z with an anisotropic set of factors
Designate an output file
"""
from __future__ import print_function
import sys
import os
import re
import numpy as np
import os.path
sf = 0.02
minimum_diameter = 0.25
scaleFactor = np.array([sf, sf, sf, sf])
path='VCN_Cells/VCN_c18/Morphology/'
... |
c76689d28dc9b0c3166ec80133c2eb1ad6f7b4582a67f721af3ed36601bed97b | Python | 1,928 | 79 | # SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
def compute_logistic(val: float) -> float:
v = 1.0 / (1.0 + np.exp(-np.abs(val)))
return (1.0 - v) if val < 0 else v
logistic = np.vectorize(compute_logistic)
def compute_softmax_zero(values: np.ndarray) -> np.nda... |
ec93ba53d6d83f99772513da6f83fa0991a6460bc6af42e307e038855194e612 | Python | 1,928 | 56 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from typing import TYPE_CHECKING, Any
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
if TYPE_CHECKING:
from collections... |
ef2508b09fd7e74a6565234c3f316a9659cd39a657ed62d0369c9c723ee6424b | Python | 1,930 | 56 | """
@file: plane_representation
Created on 24.09.18
@project: crazy_ara_refactor
@author: queensgambit
Please describe what the content of this file is about
"""
import numpy as np
from DeepCrazyhouse.src.domain.util import multi_axis_by_vec
from DeepCrazyhouse.src.domain.variants.constants import (
BOARD_HEIGHT,
... |
78530e06fe0aa21ef2ce3fa18d7e47abc7c881fc7606bff3719b575de75b07de | Python | 1,932 | 65 | # 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 Flatten(Base):
@staticmethod
def export() -> None:
sha... |
824d716bdc674772e47ba58ebaeb5f0d95a21b41b35488f965b202b80dbd88e8 | Python | 1,932 | 54 | # 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... |
440d9b6412bfe09a4e249a43cb556becd43d6bcd448a4b598290b4bde551acfa | Python | 1,935 | 52 | # 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... |
c5f214d0debc9cb441fba44fb38a016d19a77d7b717d0efa7a7b1a6c428b940c | Python | 1,935 | 80 | # %% [markdown]
"""
# Preset viewing angles
This notebook shows the preset combinations that exist in netplotbrain that can be specified by setting the keyword argument `view` to the following
"""
# %%
# import necessary packages and load example data
import pandas as pd
import netplotbrain
nodes = pd.read_csv('.... |
f72652882be312758c16755b5cf5852ae0f216404f05609848a02b5f625f6691 | Python | 1,939 | 67 | """Code for loading rosetta score files."""
import os
import re
import pandas as pd
import atom3d.util.file as fi
def form_score_filter(score_dir):
"""Filter by decoys present in score file."""
scores = load_scores(score_dir)
def is_present(x):
if x['ensemble'] not in scores:
return... |
890688250e5ecd483ae6a85c057e227b8b81a66a74374a33e9d315e72e94270f | Python | 1,940 | 59 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 18 17:54:23 2018
@author: tpisano
"""
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 18 15:47:10 2018
@author: tpisano
"""
import numpy as np
from matplotlib import rcParams
rcParams['font.family'] = 'serif'
# 3D plot of t... |
403fc1daf110c2b3e70b5ba2ffb3afde93cb219ebacd9859c1e0eb34ae59bf20 | Python | 1,942 | 61 | import logging
import torch
import numpy as np
from pathlib import Path
from torch.utils.data import Dataset
from typing import List, Optional, Tuple, Union
from scipy import sparse
Tensor = torch.tensor
class FingerprintDataset(Dataset):
"""
Dataset class for fingerprint representation of products for templ... |
c5489c9de11bb0f5284c0f77ebe50343854e7e22e21eeeca84b7a2a6f69c9e48 | Python | 1,942 | 71 |
def _get_presetviews(view):
"""
If view is one of the following preset strings:
preset-3 - plots a 1x3 figure with SsLR views
r1, c1, left view, both hemispheres
r1, c2, right view, both hemisphere
r1, c3, left view, both hemispheres
preset-4LR - plots a 2x2 figure of each ... |
8c8aa9b037f1d6d25748e09c766fee7ed4d7c2fff9fa4e4fe5c0785eae6c40af | Python | 1,944 | 56 | import numpy as np
import torch.nn as nn
class CNN3D_SMP(nn.Module):
def __init__(self, in_channels, spatial_size,
conv_drop_rate, fc_drop_rate,
conv_filters, conv_kernel_size,
max_pool_positions, max_pool_sizes, max_pool_strides,
fc_units,
... |
23d29843faf11122ec4f4969c51eb9656cc39226d97e32415cc7099a660db89c | Python | 1,945 | 57 | import numpy as np
import torch.nn as nn
class CNN3D_PSR(nn.Module):
def __init__(self, in_channels, spatial_size,
conv_drop_rate, fc_drop_rate,
conv_filters, conv_kernel_size,
max_pool_positions, max_pool_sizes, max_pool_strides,
fc_units,
... |
55144d4b2016f3d26e4525414abb9d898544cb4fbe4093d49a98f6a5fa2a77ac | Python | 1,945 | 61 | #import context
import pymtrf
import numpy as np
from .simulate_test_data import build_test_data
def test_lag_builder_positive_lags():
# Test lag_builder for the creation of a positive lag vector
lags = pymtrf.lag_builder(1, 4)
assert np.all(lags == [1, 2, 3, 4])
def test_lag_builder_negative_lags():
... |
64c185cff8ffb542ef787b892c32b7f08f3cf452dd6922f2d0967764a605d76c | Python | 1,945 | 64 | from dataclasses import dataclass
from typing import List, Dict, Optional, Union
from numbers import Number
import logging
from pciSeq import config
from pciSeq.src.core.utils import log_file, check_redis_server
config_manager_logger = logging.getLogger(__name__)
@dataclass
class ConfigManager:
exclude_genes: Lis... |
a3b31b47c94fabe842854b7d822f2b5728c8c8cb4f8047b914e4e202aa765ef3 | Python | 1,945 | 57 | import numpy as np
import torch.nn as nn
class CNN3D_LBA(nn.Module):
def __init__(self, in_channels, spatial_size,
conv_drop_rate, fc_drop_rate,
conv_filters, conv_kernel_size,
max_pool_positions, max_pool_sizes, max_pool_strides,
fc_units,
... |
ad737dd03f7b9dd37a7657947417ef54e9fbcb33a72aeb2fd7174ccc4f07ea16 | Python | 1,945 | 77 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.op_run import OpRun
def _gemm00(a, b, c, alpha, beta):
o = np.dot(a, b) * alpha
if c is not None and beta != 0:
o += c * beta
return o
def ... |
bae7af8f9f19775bf7662ab6f1600ebd2afa99815cd68fa53cc60987696523e1 | Python | 1,945 | 57 | import numpy as np
import torch.nn as nn
class CNN3D_RSR(nn.Module):
def __init__(self, in_channels, spatial_size,
conv_drop_rate, fc_drop_rate,
conv_filters, conv_kernel_size,
max_pool_positions, max_pool_sizes, max_pool_strides,
fc_units,
... |
f0b237574e4d0e8a811fec2b23193d6723d04c9ff654ebcacd3807e73db0e48c | Python | 1,945 | 51 | # Copyright 2026 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... |
9db6e04c7ee530267e40e6d787118e86707a3b9d64308333462903712d0f66bc | Python | 1,946 | 51 | import argparse
import numpy as np
import atom3d.splits.splits as splits
def generate_split(excl_uncharacterized=True, excl_rdkitfails=True, out_dir_name='.', seed=42):
num_molecules = 133885
# Load the list of molecules to ignore
if excl_uncharacterized and not excl_rdkitfails:
unc_file ... |
196b9ef5525532809e99066df4038591058a8f02e30697b061867dae41fe0ad4 | Python | 1,947 | 66 | # 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 Expand(Base):
@staticmethod
def export_dim_changed() -> None:
... |
a39e212f2de2fe7151d8af9f35179ee8e6bbfaae2b55348b83a3a1651b947a78 | Python | 1,947 | 52 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcls.models.utils import Augments
def test_augments():
imgs = torch.randn(4, 3, 32, 32)
labels = torch.randint(0, 10, (4, ))
# Test cutmix
augments_cfg = dict(type='BatchCutMix', alpha=1., num_classes=10, prob=1.)
augs = Augments... |
426eb15b713d8b5ad757839e4b71195652a565a20371ad91f2a2ce0179dd3c7a | Python | 1,948 | 64 | import logging
import os
from dendrogram_tools import dend_json_2_nodes_n_edges
from abc import ABC, abstractmethod
from os.path import isfile, join
log = logging.getLogger(__name__)
DENDROGRAM_FOLDER = join(os.path.dirname(os.path.realpath(__file__)), "../dendrograms")
class BaseChecker(ABC):
@abstractmethod
... |
6bd5333edb3e7941178209e26afeebd1191d723254f1322466b30387bfb396bb | Python | 1,948 | 57 | from __future__ import print_function
import sys
from os import listdir
from os.path import splitext
import numpy as np
from parameterSetup import ParameterSetup
from featureDownSampler import FeatureDownSampler
#---------------
# set up parameters
args = sys.argv
if len(args) > 1:
option = args[1]
else:
option... |
c72b5877051f08b21d8da8ab50733e0dfb33682fe299839b5941bcefbc49ce68 | Python | 1,951 | 51 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_array_equal
from onnx import checker, helper
from onnx.reference import ReferenceEvaluator
@pytest.mark.parametrize("d... |
714d8d9b73707655feea4472297e1a67ae6cac9eacec7956e08b3b2581db53a8 | Python | 1,952 | 56 | #!/usr/bin/env python
#
# Copyright 2007 Neal Norwitz
# Portions Copyright 2007 Google 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... |
c55a3379d473c66f3308a615195b9ae52bfdbddc4e69d45a82cf50c7012cb92b | Python | 1,952 | 81 | import os
import Switches_Static as st_switches
rootpath = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
def set_rootpath(rootpath0):
global rootpath
rootpath = rootpath0
return
def get_rootpath():
return rootpath
def set_atlasnum(atlasnum0):
global atlasnum
a... |
25a90ab929de2cc8efb887273f45e82bc55669ee3caa70ebd85eb0dea48dcceb | Python | 1,953 | 60 | # Copyright 2022 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... |
c5a613cdfac447c5706c7f0811ec618b8d535197010597a4d847189861141090 | Python | 1,953 | 55 | # Copyright 2022 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... |
8622b5e056174a4ea58c2907779c040680fa4e6432a5f66154ba1a5c0517ccc9 | Python | 1,954 | 60 | # Copyright contributors to the TSFM project
#
"""PatchTST-FM model configuration"""
from transformers.configuration_utils import PretrainedConfig
from transformers.utils import logging
logger = logging.get_logger(__name__)
PATCHTSTFM_PRETRAINED_CONFIG_ARCHIVE_MAP = {}
class PatchTSTFMConfig(PretrainedConfig):
... |
2d47da64a21a22673ca71534119180ce14b628e2b1daf1df0efdb54b0f2da8a4 | Python | 1,956 | 65 | from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
from typing import Any
@dataclass(frozen=True)
class AtlasInfo:
"""Resolved atlas information shared by all subject jobs in a run."""
atlas_spec: Any
atlas_name: str
roi_values: tuple[Any, ...]
node_labe... |
2ed2d4c72f50e539296de0a8b20fe7df09a057b084673699f094d24949f22130 | Python | 1,958 | 55 | """
This scripts generates figure 4c of the paper
This is the full model error (AV + interaction term) + movement vs. additive model error + movenet, during active conditions
"""
import pandas as pd
import matplotlib.pyplot as plt
import sciplotlib.style as splstyle
import numpy as np
import os
data_folder = '/Volum... |
3748eb0d8e9609e92b48a647a16c010afbc7b8ce4e67b50f40ce2ff77bc379f6 | Python | 1,958 | 69 | # 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... |
9bbae458484e7c1e23d18426314698097774ed13b866f55ca3c753c28ee54fe6 | Python | 1,958 | 49 | # In Nomine Functions Team
# distributed under license: GPL 3 License http://www.gnu.org/licenses/
import argparse
from utils.RadareFunctionAnalyzer import RadareFunctionAnalyzer
def get_functions_data(input_executable, symbolic):
analyzer = RadareFunctionAnalyzer(input_executable, use_symbol=False, depth=1)
... |
ba5a320ad06193fefd2053f7f8690b32b3dc469f48f64099ab36c805b4f32bfe | Python | 1,958 | 41 | # Copyright 2026 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... |
f0453534337fa6a243de271a1928948fa6f558fd6c0b667470a192eba4a160fb | Python | 1,958 | 61 | import matplotlib.pyplot as plt
import numpy as np
def imgarray_show(x, nrows=1, ncols=1, row_label=None, vmin=None, vmax=None,
figsize=(10, 6), cmap='coolwarm', cbar=False, frame_on=True,
img_names=None, show=True, save_path=None):
"""
create a figure showing multiple imag... |
d2d20cdd5b006b673869295bc42c2dd1ccb488c68031ab69fcc38a64ac3e4004 | Python | 1,960 | 58 | #------------------------------------------------------------------------------
# elftools tests
#
# Yann Rouillard (yann@pleiades.fr.eu.org)
# This code is in the public domain
#------------------------------------------------------------------------------
import os
import unittest
from typing import ClassVar
from el... |
ea6e791645592bebdfb3c73ea8f3092bcb544d38bfc5e75281461190804d4808 | Python | 1,962 | 53 | from sagemaker.local import LocalSession
from sagemaker.pytorch import PyTorch
sagemaker_session = LocalSession()
sagemaker_session.config = {'local': {'local_code': True}}
# To run SageMaker locally, you need a role that has access to AWS SageMaker and S3.
# You can call this role `SageMakerRole` (as below), or you ... |
eecfc2578bcaf7e5b5757f62ae908ef127e6368fe9c33f4d5d9b99c44d60edc5 | Python | 1,962 | 63 | """US Macroeconomic dataset for multivariate time series forecasting."""
from sktime.datasets._single_problem_loaders import load_macroeconomic
from sktime.datasets.forecasting._base import _ForecastingDatasetFromLoader
__all__ = ["Macroeconomic"]
class Macroeconomic(_ForecastingDatasetFromLoader):
"""Load the ... |
5fd7aaae4fea199ce997dc008e63f925103387ec43517fe28f3b7d8c9b913857 | Python | 1,963 | 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... |
11001992ca5c9330a74716db1207ad1bb19fbd5c114da8b84731979006676e19 | Python | 1,964 | 47 | from visdom import Visdom
from datetime import datetime
import numpy as np
class VisTorch:
DEFAULT_HOSTNAME = "127.0.0.1"
DEFAULT_PORT = 8097
VIS_CON = None
def __init__(self, env_name = None):
if env_name is None:
env_name = str(datetime.now().strftime("%m%d%H%M%S"))
sel... |
44d8da9d2ec47164934e740bd5ed0237dae3babac0cb9e90b9729a675f6996b6 | Python | 1,964 | 79 | from figures.clean_data import prepare_data
from figures.figure1 import figure1
from figures.figure2 import figure2
from figures.figure3 import figure3
from figures.util import load_data, fig_config, get_subplots, produce_figure, plot_grid, plot_annotations, plot_scatter
import numpy as np
import pickle
def main():
... |
ff79d50dd1adc155f48b8b7ba6a3c62c0720f11e7150ff374b29c7ae005a1974 | Python | 1,964 | 63 | import tensorflow as tf
import keras.backend as K
from .UNet_3d import UNet_3d
from .UNet_3d555 import UNet_3d555
from .UNet_3d2 import UNet_3d2
from .UNet_3d1 import UNet_3d1
from .UNet_3d_sigmoid import UNet_3d_sigmoid
from .customized_layer import DipoleConv
from keras.models import Model
#
#create model
#
# Copyri... |
a39e8a45b48f7a59ae08aa8038788b8edd9363ccb0ef1106f3ed44309e6bdb04 | Python | 1,969 | 62 | # Copyright 2026 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... |
3b2c6ede8949f6bb854f9528e094c36a59f7c04a703cb8744530d254da902e0e | Python | 1,970 | 68 | """Lynx dataset."""
from sktime.datasets._single_problem_loaders import load_lynx
from sktime.datasets.forecasting._base import _ForecastingDatasetFromLoader
__all__ = ["Lynx"]
class Lynx(_ForecastingDatasetFromLoader):
"""Load the Lynx dataset for univariate time series forecasting.
Examples
--------
... |
b6675dccafc061e712eacb7420c89857e244e449454437aa5cdac01c8b4dbcc8 | Python | 1,971 | 88 | import numpy as np
def diff(l1, l2):
return list(set(l1) - set(l2))
def inters(l1, l2):
return list(set(l1) & set(l2))
def inters_many(L):
return list(set.intersection(*map(lambda x: set(x), L)))
def intinters(I1, I2):
l = list(I1) + list(I2)
if I1[1] > I2[0] or I2[1] > I1[0]:
l.sort... |
dc40da1d7e090c15871b71fe8c8339195efe48aaf1f40608a2b23ec9641f0d00 | Python | 1,971 | 60 | import pandas as pd
from ..data.var_names import diagnoses
from .classifier_chain import ClassifierChainEnsemble
from .logistic_regression import (
LogisticRegressionOVRPredictor, LogisticRegressionModel
)
from .xgboost_pipeline import DepthwiseXGBPipeline
logistic_regression_args = {
'solver': 'lbfgs',
'... |
333cb625cbd41a2b8e8cc67492387c012bba22c4810b91d2276e6a6548e73475 | Python | 1,972 | 72 | # 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... |
55a28ed3f83cc86d314c82241c8c6c0e00b59f62127ead04f0f0cac7aae9ea1e | Python | 1,972 | 62 | # 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... |
59d47de23c4c9ee90d6a043e36b601e8b8bea20e912f486d32c5fac043bf368b | Python | 1,972 | 51 | # Author: Proloy Das <proloy@umd.edu>
import numpy as np
from matplotlib import pyplot as plt
def visualize_connectivity(con, label_names, n_eigenmodes, ax=None, title=None, cbar_kw={}, cbarlabel="", cmap='seismic'):
lh = []
rh = []
for i, label in enumerate(label_names):
lh.extend(list(range(n_e... |
69e9585daf5cd88488b57cabd19faa0dcd03ca78ea2bd4a76ec1b6c0f314ef9b | Python | 1,972 | 56 | '''
Pure-python implementation of UCSC ``liftOver`` genome coordinate conversion.
Setup script.
Note that "python setup.py test" invokes pytest on the package. This checks both xxx_test modules and docstrings.
Copyright 2013, Konstantin Tretyakov.
http://kt.era.ee/
Licensed under MIT license.
'''
from setuptools im... |
781e0ee3c2451a7198a4ddfbdec3b53f3f314cc4a13aa9b8c78fd78176d9555f | Python | 1,974 | 60 | import logging
import pytest
from pyxdf import load_xdf
logger = logging.getLogger("pyxdf.pyxdf")
@pytest.fixture(autouse=True)
def restore_level():
"""Guard the test session against the very leak these tests check for."""
level = logger.level
yield
logger.setLevel(level)
@pytest.mark.parametrize... |
979d79e50eb9c8cd2c1ae027ad4708b0d2c8d15d26c9ed650e78f247ea3655fb | Python | 1,975 | 77 | import logging
from pathlib import Path
import requests
import xxhash
from omegaconf import DictConfig
from rich.logging import RichHandler
FORMAT = "%(message)s"
logging.basicConfig(
level=logging.INFO, format=FORMAT, datefmt="[%X]", handlers=[RichHandler()]
)
log = logging.getLogger(__name__)
def get_hash(fn... |
95e32edb52122cbad0660b93cbcd3a9aa482b80bf5d804cee6a9c96060efe72f | Python | 1,976 | 52 | # 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
#
# ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.