sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
53c545d39de47f0efff7eedf8bd2536fb46f7dee45f8bb255829f7ddce097992 | Python | 227 | 11 | """Adapter for Mol2Mol"""
from __future__ import annotations
__all__ = ["Mol2MolAdapter"]
from reinvent.models.model_factory.transformer_adapter import TransformerAdapter
class Mol2MolAdapter(TransformerAdapter):
pass
|
97136d4e64fc9caab19b87fd8d8babd53f9f9cf8e1eeadb559526cbe933ddacc | Python | 229 | 6 | # Copyright 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openfl.transport.grpc import AggregatorGRPCClient, AggregatorGRPCServer
from openfl.transport.rest import AggregatorRESTClient, AggregatorRESTServer
|
4d4d058dcbcfa8f6e2d162ddb12e0c836b56dfd1a9167515f11f2fdfc8be4347 | Python | 231 | 11 | from typing import List, Tuple
from dataclasses import dataclass
from rdkit.Chem.rdchem import Mol
@dataclass
class ReactionOutcomeDTO:
reaction_smarts: str
reaction_outcomes: List[Tuple[Mol]]
targeted_molecule: Mol
|
622fd78094511a33554224da483b5178c94ec881b25733d7c50d90d82a732937 | Python | 231 | 9 | """Geomstats custom exceptions."""
class AutodiffNotImplementedError(RuntimeError):
"""Raised when autodiff is not implemented."""
class NotPartialOrder(Exception):
"""Raise an exception when less equal is not true."""
|
745d35601132a501477ced6a51f4a22204a985e5b4796b7e7f2557a461b2494d | Python | 231 | 9 | from dataclasses import dataclass
@dataclass(frozen=True)
class ModelParametersEnum:
NUMBER_OF_LAYERS = "num_layers"
NUMBER_OF_DIMENSIONS = "num_dimensions"
VOCABULARY_SIZE = "vocabulary_size"
DROPOUT = "dropout"
|
1d49931b32c91edf69b37c18f1135ece73447e325084c50f387136d1a7ccd278 | Python | 233 | 11 | """Adapter for Pepinvent"""
from __future__ import annotations
__all__ = ["PepinventAdapter"]
from reinvent.models.model_factory.transformer_adapter import TransformerAdapter
class PepinventAdapter(TransformerAdapter):
pass
|
5a632dda8f92de3b83038b289f3e0bb1c51a36bcde328f781e8033302a696ef1 | Python | 233 | 10 | """Transformation functions
All transforms must be imported here to trigger registration.
"""
from .steps import *
from .sigmoids import *
from .double_sigmoid import *
from .value_mapping import *
from .exponential_decay import *
|
b2a49903e227bc835a8dda31a0c7bafd97964a824c918c50f5837889eceff7cb | Python | 233 | 2 | # Copyright 2020 Forschungszentrum Jülich GmbH and Aix-Marseille Université
# "Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; and to You under the Apache License, Version 2.0. "
|
23f7736e035de6a2ba9315b6266f99573ab6a11c1b74894ec5c9a53c2812f6fa | Python | 235 | 8 | from .pullback_metric import PullbackDiffeoMetricTestData
class OpenHemispherePullbackMetricTestData(PullbackDiffeoMetricTestData):
fail_for_autodiff_exceptions = False
fail_for_not_implemented_errors = False
trials = 3
|
22914116dbe6fb53df9789ee6ea8d152a299032f67973e50cd89de6490627c4b | Python | 236 | 12 |
from .base_module import BaseModule
from .mobilenetv2 import InvertedResidual
from .transformer import LocationPreservingVit
from .hblock import HBlock
__all__ = [
"InvertedResidual",
"LocationPreservingVit",
"HBlock",
]
|
33f9fd0dfb44194cff5f75d07501f280551c7ce48968aa3fc2d8af876c74eac8 | Python | 236 | 8 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from importlib import util
if util.find_spec("tensorflow") is not None:
from openfl.utilities.optimizers.keras.fedprox import FedProxOptimizer # NOQA
|
d878d7874ac5b7953138c761662629810874fcc853caa1e49016598a8d69f372 | Python | 237 | 13 | from .contrastive.model import Contrastive, GraphCL, GRACE, InfoGraph, MVGRL, NodeMVGRL, pGRACE
__all__ = [
'Contrastive',
'GraphCL',
'GRACE',
'InfoGraph',
'MVGRL',
'NodeMVGRL',
'pGRACE'
]
classes = __all__
|
d8a563351af622074427136c5f00eea04c957ec5c839ba8d9e24ad48cd438eba | Python | 237 | 11 | import torch as T
class Network(T.nn.Module):
def __init__(self):
super(Network, self).__init__()
def forward(self, image, segbox):
pass
def train_step(self, image, segment, criterion, segbox):
pass |
e0439e21e1daf21b8990de58ed4106b24e264503bea4651504ced74914fd794e | Python | 238 | 10 | import experiment as exp
import arena
class ArenaControl(exp.Experiment):
def run(self):
arena.run_command("periodic", "LED", [1, 200], False)
def end(self):
arena.run_command("periodic", "LED", [0], False)
|
c2720bf3fce1e1df5fbfb172994e0e78e696e1d1ca31835bc8667fe95c728837 | Python | 239 | 10 | import warnings
def ignore_warnings(test_func):
def do_test(self, *args, **kwargs):
with warnings.catch_warnings():
warnings.simplefilter("ignore")
test_func(self, *args, **kwargs)
return do_test
|
6b83b65c82b76de1ab050a24217f7fa13af4e72b534a1fa1fbc272ae4954b60e | Python | 241 | 10 | from .eval_validity_utils import xyz2mol
from .eval_bond_mmd_utils import collect_bond_dists, compute_mmd
from .eval_prop_utils import compute_prop
__all__ = [
'xyz2mol',
'collect_bond_dists',
'compute_mmd',
'compute_prop'
] |
aa463c8b2053d2d80e6494eae44c3ffe0dd1be5a1ec4d1a4780eaaff83a528a2 | Python | 241 | 7 | # submit all
import os
for pos in [3,4,10]:
#for t in [1e-3, 1e-2, 1e-1,0.5,1, 10]: # first run
for t in [0.75, 1.25, 1.5, 1.75, 2, 3, 4, 5]: # second run aug 28 2022
os.system('sbatch gpujob_gen.sh {} {}'.format(pos, t))
|
6d0344a997117de1e9adf72f37cdd5302c20ff04e0c77cb78f844c54a227c9a9 | Python | 242 | 10 | import sys
code="""code {
white-space : pre-wrap !important;
}
"""
s = open("index.html", 'r').read()
s = s.replace('<style type="text/css">', '<style type="text/css">\n%s' % code)
print(s)
with open("index.html", "w") as o:
o.write(s)
|
d6f329e137d7e3078bc7bf281591662d4d3dc13f0d5057825833be7957f6802a | Python | 243 | 5 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
from .nequip_calculator import NequIPCalculator
from .nosehoover import NoseHoover
__all__ = [NequIPCalculator, NoseHoover]
|
321ee9c6bb8a0dd9808fb031ffb12bf3bf77efc927fadb0d1253d4094358fe61 | Python | 244 | 6 | from deeperwin.model.definitions import *
from deeperwin.model.mlp import *
from deeperwin.model.input_features import *
from deeperwin.model.embeddings import *
from deeperwin.model.orbitals import *
from deeperwin.model.wavefunction import *
|
cfe75a9619541ee8ef8b0e096912193cb46250a87e3d8d50d6af33931e206f59 | Python | 244 | 9 | # Copyright (C) 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
collaborator_private_attributes = {
"train_loader": np.random.rand(1 * 50, 28, 28),
"test_loader": np.random.rand(1 * 10, 28, 28),
}
|
d9b469e2a100ad53efc0a1edbd291e3212ee23cadfe4a6cf65e60c7290028fd5 | Python | 244 | 4 | """Validation against held-out data, and the guards that keep it held out."""
from .guard import PROPRIETARY_PATTERNS, ProprietaryLeak, scan_paths, tcrvdb_path
__all__ = ["PROPRIETARY_PATTERNS", "ProprietaryLeak", "scan_paths", "tcrvdb_path"]
|
34b9be541df2e86a88db5169895a5528bc7dcff04482adacb5591847476d0f5e | Python | 245 | 8 | # Copyright (C) 2020-2024 Intel Corporation
# # SPDX-License-Identifier: Apache-2.0
import numpy as np
collaborator_private_attributes = {
"train_loader": np.random.rand(1 * 50, 28, 28),
"test_loader": np.random.rand(1 * 10, 28, 28),
}
|
000aaf6993e1495eb3449d169fb016f3b104526e4dbd9b75ecb799fcd80f7aed | Python | 246 | 9 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Exceptions that occur during service interaction."""
class EnvoyNotFoundError(Exception):
"""Indicates that director has no information about that Envoy."""
|
43a7ccaa9f369adbd1ec636d6b6a7ee7d02733a80e2a9168e667196cf10152a2 | Python | 249 | 7 | from paddle.utils.cpp_extension import CUDAExtension, setup
if __name__ == "__main__":
setup(
name='deformable_detr_ops',
ext_modules=CUDAExtension(
sources=['ms_deformable_attn_op.cc', 'ms_deformable_attn_op.cu']))
|
4e1b634257258f93beeb56de6394ac88a8d04edf6908904d16ea635a25febb0d | Python | 249 | 9 | # Copyright 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""OpenFL Connector Module."""
from importlib import util
if util.find_spec("flwr") is not None:
from openfl.component.connector.connector_flower import ConnectorFlower
|
f1a80a55c80f0dcd66152269d999fc1901fcc80983f210d721e6f65a86463eda | Python | 250 | 14 | import yaml
import json
import sys
yamlf = sys.argv[1]
assert yamlf.endswith(".yml")
with open(yamlf, 'r') as rf:
yaml_data = yaml.safe_load(rf)
jsonf = yamlf[:-4] + ".json"
with open(jsonf, 'w') as wf:
json.dump(yaml_data, wf, indent=4)
|
a5b8226563066d961dfd24bff6a84accfcb780ce12978acb1115678e7bc2e1d6 | Python | 251 | 14 | import pytest
import threading
server_settings = {
'ip': 'localhost',
'port': 6000
}
@pytest.fixture
def server():
pass
# thread = threading.Thread(target=TestServer(**server_settings))
# thread.daemon = True
# thread.start() |
26eef33119514c99b0eb3b65050a05d3ee4c65264f568a58874aac87e7cf92c0 | Python | 253 | 8 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""openfl.experimental.workflow.placement package."""
# FIXME: Unnecessary recursion.
from openfl.experimental.workflow.placement.placement import aggregator, collaborator
|
605e321fafbcbffe4f91e173ff5e77b07ca2e5d76e6bd80af532a46d7382e11d | Python | 253 | 9 | import numpy as np
import torch
def subsequent_mask(size):
"Mask out subsequent positions."
attn_shape = (1, size, size)
subsequent_mask = np.triu(np.ones(attn_shape), k=1).astype("uint8")
return torch.from_numpy(subsequent_mask) == 0
|
4dddc1739634bffa5132647115943f0b21507200e6676d5f615f8d33b66bdddf | Python | 254 | 14 | from .generator import Generator
from .GraphEBM.graphebm import GraphEBM
from .GraphDF import GraphDF
from .GraphAF import GraphAF
from .JTVAE.jtvae import JTVAE
__all__ = [
'Generator',
'GraphEBM',
'GraphDF',
'GraphAF',
'JTVAE',
]
|
d38bbe9b7f271f6e056723665392f349c7907045abe9f250c0606bfb27ed2588 | Python | 255 | 10 | """
Module for signal acquisition.
Acquire signals from LSL streams, used by other modules such as StreamViewer
and StreamRecorder.
"""
from ._buffer import Buffer
from ._stream import StreamMarker, StreamEEG
from .stream_receiver import StreamReceiver
|
c8d012f534c9bbb22838a8bceaf9b1ad87e1f629300af524c6fb4602a487917b | Python | 257 | 5 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
import torch
# singular source of global dtype that dictates the dtype of the data, which is always float64
_GLOBAL_DTYPE = torch.float64
|
16fc397407c0bfdc98b123299a631b77cda920450c425fb39649969e39e1ff74 | Python | 258 | 10 | import pytest
from neurodesign import msequence
@pytest.mark.parametrize("stimtypeno", [2, 4, 8, 9])
def test_msequence_smoke(stimtypeno):
ntrials = 100
order = msequence.Msequence()
order.GenMseq(mLen=ntrials, stimtypeno=stimtypeno, seed=42)
|
9fd552cd40dd4102e6b468040204cdc295dfe4abbdf57866630dd4a64e529cea | Python | 258 | 11 | from chromadb.telemetry.product import (
ProductTelemetryClient,
ProductTelemetryEvent,
)
from overrides import override
class Posthog(ProductTelemetryClient):
@override
def capture(self, event: ProductTelemetryEvent) -> None:
pass
|
23035ef0c711315dbfac4d023e007d19b6803a4316c75f060bf03a962387cf17 | Python | 259 | 8 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""openfl.experimental.workflow.component.aggregator package."""
# FIXME: Too much recursion.
from openfl.experimental.workflow.component.aggregator.aggregator import Aggregator
|
58d30611269d3c4a156a2bc0f2fa3e34017f565c096bd062b97e420ef39b426f | Python | 259 | 8 | from geomstats.test.parametrizers import DataBasedParametrizer
from geomstats.test_cases.backend import DtypeTestCase
from .data.dtype import DtypeTestData
class TestDtype(DtypeTestCase, metaclass=DataBasedParametrizer):
testing_data = DtypeTestData()
|
865b6cdb44e3edc20e2b15f09876d961ed38c671ea6823be98e2344ebe674459 | Python | 262 | 11 | from .deepergcn_dagnn import Deepergcn_dagnn_dist, Deepergcn_dagnn_coords, make_mask
from .schnet import SchNet
from .schnet_2d import SchNet2D
__all__ = [
"Deepergcn_dagnn_dist",
"Deepergcn_dagnn_coords",
"make_mask",
"SchNet",
"SchNet2D"
] |
4d86e2ab68126092629f15126495ea3aaf5641bd751dfca243c6dd1fc2ddf8fe | Python | 263 | 7 | from geomstats.test.test_case import TestCase
class RadialKernelFunctionsTestCase(TestCase):
def test_kernel(self, kernel, distance, bandwidth, expected, atol):
res = kernel(distance, bandwidth)
self.assertAllClose(res, expected, atol=atol)
|
96c72d542cbb58759ac1e40b1d70faa4403f2588594255dd63de914e624c0bf8 | Python | 263 | 6 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openfl.interface.aggregation_functions.core.adaptive_aggregation import AdaptiveAggregation
from openfl.interface.aggregation_functions.core.interface import AggregationFunction
|
fb4ee3e14a77c37065543c7242e566270c2511df80a484e0788c61ac957c5bb5 | Python | 263 | 10 | from .__version__ import __version__
from .myforestplot import *
from .cleaning_utils import (
statsmodels_fitting_result_dataframe,
add_pretty_risk_column,
count_category_frequency,
sort_category_item,
statsmodels_pretty_result_dataframe,
)
|
e9178c88a4bc8bdc14022baaa14834a2d93e319937711106ee96478caae6a4e6 | Python | 266 | 12 | from geomstats.test.data import TestData
class TimeSeriesCovarianceTestData(TestData):
def covariance_shape_test_data(self):
return None
def covec_shape_test_data(self):
return None
def diag_shape_test_data(self):
return None
|
0a8a69874175d13f8dfd106c84eb7cd5a2e59801f2316ef4c29d6452778ef412 | Python | 267 | 18 | from pathlib import Path
from . import (
utils,
network,
models,
analysis,
preprocessing,
datasets,
encoding,
pipeline,
learning,
evaluation,
environment,
conversion,
)
ROOT_DIR = Path(__file__).parents[0].parents[0]
|
9e461a5071335e4a8c299aaa07a9c29acaaa21c8979aaad2403e1110c7b07108 | Python | 267 | 8 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""openfl.experimental.workflow.component.collaborator package."""
# FIXME: Too much recursion.
from openfl.experimental.workflow.component.collaborator.collaborator import Collaborator
|
0463a33e78eab5c2ba2ce12955bffc7c041b6ed563d4f437e8329829bd67b102 | Python | 270 | 3 | from deeperwin.optimization.evaluation import evaluate_wavefunction
from deeperwin.optimization.pretraining import pretrain_orbitals, pretrain_orbitals_shared
from deeperwin.optimization.variational_optimization import optimize_wavefunction, optimize_shared_wavefunction |
1684c6b4a4b5f9222e5cb29bfe96ab0b31a30bf27769ab0e4c41423f4fafbbaa | Python | 271 | 10 | from reinvent.runmodes.scoring.run_scoring import uniquify_header
def test_uniquify_header():
header = ["A.1", "B", "C", "A.2", "B.2", "B"]
result = ["A", "B", "C", "A.2", "B.2", "B.3"]
new_header = uniquify_header(header)
assert new_header == result
|
36b52ab58aee585107ca74ea8330d9e28fabe14f479c6cb30e19373da2c4a897 | Python | 271 | 15 | from unittest import TestCase
import matplotlib.pyplot as plt
import numpy as np
from smithers.dataset import UnsteadyHeatDataset
"""
Tests for all the implemented datasets
"""
def test_init():
pass
def test_unsteady_heat():
UnsteadyHeatDataset().plot(10,20)
|
50984423a0ed30d72008b4c2827b0890891117d4d490f49ecdb2af18632c8145 | Python | 272 | 8 | """Learning algorithms on manifolds."""
__all__ = ["TemplateEstimator", "TemplateClassifier", "TemplateTransformer"]
from ._sklearn import _enable_array_dispatch
from ._template import TemplateClassifier, TemplateEstimator, TemplateTransformer
_enable_array_dispatch()
|
a488dfe0ba2d7b236880a87e604c6cae5b70d568472904de784be034b8b88d83 | Python | 272 | 10 | from PymoNNto.Exploration.Evolution.Interface_Functions import *
score = get_gene('a', 0) + get_gene('b', 0) + get_gene('c', 0) + get_gene('d', 0)
set_score(score)
#print('genes: ', get_genome())
#print('gene a: ', get_gene('a', None))
#print('gene b: ', gene('b', 1)) |
eaeb651938f51e36d114a04df7bc9d5267a4631dff97ad95bf7ee28e428ff0e5 | Python | 272 | 8 | def int_to_bytes(int: int) -> bytes:
"""Convert int to a 24 byte big endian byte string"""
return int.to_bytes(24, "big")
def bytes_to_int(bytes: bytes) -> int:
"""Convert a 24 byte big endian byte string to an int"""
return int.from_bytes(bytes, "big")
|
15881fe652fbbe1d2c25ba5d65803f7c4240ba1bfa6325ad26dc69772a69b449 | Python | 273 | 12 | import logging
import sys
logger = logging.getLogger('corgie')
def configure_logger(verbose):
log_level = logging.DEBUG if verbose else logging.INFO
logger.setLevel(log_level)
ch = logging.StreamHandler()
ch.setLevel(log_level)
logger.addHandler(ch)
|
5fd80dc045611b997d4b14791e1c2c00c491e82fa7bc218118a7893c6e13f509 | Python | 273 | 16 | from .run import run
from .schnet import SchNet
from .dimenetpp import DimeNetPP
from .spherenet import SphereNet
from .comenet import ComENet
from .pronet import ProNet
__all__ = [
'run',
'SchNet',
'DimeNetPP',
'SphereNet',
'ComENet',
'ProNet'
] |
94227b005d37a958b2203d0442e89c9c0f08bc79ee293f7a3fcd015bf34b3089 | Python | 273 | 8 | from .vocab import Vocab
from .mol_tree import Vocab, MolTree
from .jtnn_vae import JTNNVAE
from .jtnn_enc import JTNNEncoder
from .jtmpn import JTMPN
from .mpn import MPN
from .nnutils import create_var
from .datautils import MolTreeFolder, PairTreeFolder, MolTreeDataset
|
b8b8719d0ded8cedb0497109517a3d212bf7027f1ad93f0f027e90f3c0bf6fb1 | Python | 273 | 10 | """
Script to download tutorial data
"""
from nequip.utils import download_url
import os
url = "https://archive.materialscloud.org/records/ycbvx-knj69/files/fcu.xyz?download=1"
path = download_url(url, os.getcwd(), filename="fcu.xyz")
print(f"Downloaded data to {path}")
|
68d8718a6d94807cafb1ebe5b2f7d4826e789b36668d61e94ebfa696224c8e20 | Python | 274 | 10 | """Configure imports for standalone NWB export tests."""
from __future__ import annotations
import sys
from pathlib import Path
NWB_IO_DIRECTORY = Path(__file__).resolve().parents[1]
if str(NWB_IO_DIRECTORY) not in sys.path:
sys.path.insert(0, str(NWB_IO_DIRECTORY))
|
ce12d31d042c5ee81e750aa70ab70a3360d98a284bcd25de79d1337668e30cd3 | Python | 274 | 14 | import video_system
from rl_logging import get_main_logger
log = get_main_logger()
def start_record():
log.info("Starting video recording.")
video_system.start_record()
def stop_record():
log.info("Stopping video recording.")
video_system.stop_record()
|
34f42216126e5f41f115b2128ab32686702ec65f848f29b02397ec2597c89fd1 | Python | 275 | 9 | from ._base import BaseEstimatorTestData, ClusterMixinsTestData
class OnlineKMeansTestData(ClusterMixinsTestData, BaseEstimatorTestData):
MIN_RANDOM = 5
MAX_RANDOM = 10
tolerances = {"n_repeated_clusters": {"atol": 1e-6}}
xfails = ("n_repeated_clusters",)
|
baf94c1dadbd75fbffb886cfcb0a6bcdde8b8940a69ee3d76105cd8fb77a4dae | Python | 276 | 9 | from geomstats.test.data import TestData
class InterpolatorTestData(TestData):
def interpolate_with_given_data_test_data(self):
return self.generate_tests([dict()])
def interpolate_half_interval_test_data(self):
return self.generate_tests([dict()])
|
1a1d2c1fec9af85b472ba254990834bb1c77606bc2362373892a4e7e4328a90e | Python | 277 | 8 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from .wav2vec import * # noqa
from .wav2vec2 import * # noqa
from .wav2vec2_asr import * # noqa
|
6c04f5103c25f0ccb78eccb65abc0b6845d5d5f281ad88b3312685f806e483c2 | Python | 278 | 15 | """Custom RDKit normalization transformtions
Transformation names are optional.
"""
__all__ = ["four_valent_nitrogen"]
# FIXME: needs review
four_valent_nitrogen = """\
[#7-0D3:1]=[*:2]>>[+:1]=[*:2]
[#7-0D2H:1]=[*:2]>>[+:1]=[*:2]
[#7-0D3H:1]>>[+:1]
[#7-0D4;z0:1]>>[+:1]
"""
|
86a9cb46073b3dbc77f805c7e28f14283b3e366ac83c9784401f4e71cd2b7a9d | Python | 280 | 10 | # Copyright (C) 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
def collaborator_private_attrs(index):
return {
"train_loader": np.random.rand(index * 50, 28, 28),
"test_loader": np.random.rand(index * 10, 28, 28),
}
|
4edbcca96dd3ec81f06eb9c7e18ed93276ed7900e1ebca9f8997a8134d7cf471 | Python | 281 | 6 | import pandas as pd
left=pd.read_csv('Negative.vcf', sep='\t')
right=pd.read_csv('../1000Genomes/1000Genomes.vcf', sep='\t')
data_merge=pd.merge(left, right, on=['chr','pos','ID','REF','ALT'])
data_merge.to_csv('Negative_1000Genomes_merge.vcf', sep='\t', header=None, index=None)
|
6d95d4e338a0e3c7bee6f558303d1ed4af28e4c36c8da01f2442017c12b400ac | Python | 281 | 12 | import numpy as np
from data.dataset import Brats184
dataset = Brats184(None, None, None)
label_counts = {i: 0 for i in range(4)}
for _, target in dataset:
vals, counts = np.unique(target, return_counts=True)
for v, c in zip(vals, counts):
label_counts[v] += c
|
ba79923689a31a4d03f112dafc8d12787c66732e67f6fcf2afe846b288693043 | Python | 281 | 15 | import pandas as pd
import numpy as np
from scipy import stats
data = pd.read_csv("ChaosAndLearningData.txt", sep="\t")
data = np.array(data)
acc = data[:,1]
le = data[:,2]
corr = stats.pearsonr(acc,le)
print(corr)
corr2 = stats.ttest_ind(acc,le,equal_var = False)
print(corr2) |
2040fde1006911c062f7c87c320c607dab2a6d2be2a1fea254bb5fd59b32785c | Python | 282 | 10 | # Copyright (C) 2020-2024 Intel Corporation
# # SPDX-License-Identifier: Apache-2.0
import numpy as np
def collaborator_private_attrs(index):
return {
"train_loader": np.random.rand(index * 50, 28, 28),
"test_loader": np.random.rand(index * 10, 28, 28),
}
|
c24bb67da14236514f31af2d44a866846dfbbc8aa8338c117d37b1d3946bd63a | Python | 282 | 7 | from PymoNNto.Exploration.AnalysisModules.Weight_Classifier_Base import *
class Weight_Classifier_Pre(Classifier_base):
def get_data_matrix(self, neurons):
syn_tag = self.parameter('syn_tag', 'EE')
return get_partitioned_synapse_matrix(neurons, syn_tag, 'W').T |
e5bc3b2d6723a43aaec35320da7fce105eb7401c8934bd3df69dc6fb31199c0a | Python | 282 | 7 | from PymoNNto.Exploration.AnalysisModules.Weight_Classifier_Base import *
class Weight_Classifier_Post(Classifier_base):
def get_data_matrix(self, neurons):
syn_tag = self.parameter('syn_tag', 'EE')
return get_partitioned_synapse_matrix(neurons, syn_tag, 'W')
|
5b6723e0dce345f019dc76c3c33d6623a35e452b71528ac1c8eba58144abec87 | Python | 283 | 15 | """
nltools data types.
"""
from .brain_data import Brain_Data, Groupby
from .adjacency import Adjacency
from .design_matrix import Design_Matrix, Design_Matrix_Series
__all__ = [
"Brain_Data",
"Adjacency",
"Groupby",
"Design_Matrix",
"Design_Matrix_Series",
]
|
e74b813b12db0757a7eadc9263c00e7ac05a1dc58d1fa44d6b3bfd1bbd681667 | Python | 284 | 12 | import os
import numpy as np
_data_path = '/'.join(os.path.realpath(__file__).split('/')[:-2] + ['data/'])
def load_kuiper_table():
"""
Loads the lookup table for the kuiper test
:return: table as numpy array
"""
return np.load(_data_path + 'kuiper_table.npy')
|
14ae48b52354f34576b11f5fd756b8ef4c47a9d2bdf0b176446f6106d09a486a | Python | 285 | 8 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from .tacotron2 import * # noqa
from .tts_transformer import * # noqa
from .fastspeech2 import * # noqa
|
975d5c6254c25f6502022cc6cf01a033071e410137bc4987fa999677594aff70 | Python | 285 | 8 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from .modules import * # noqa
from .s2s_transformer import * # noqa
from .s2s_conformer import * # noqa
|
c61cad45855373a8df34a1ea825fea78d6e13fd238670a749e03109ae6edef46 | Python | 285 | 11 | from pybind11.setup_helpers import Pybind11Extension, build_ext
from setuptools import setup
ext_modules = [Pybind11Extension("cocoeval_ext", ["cocoeval.cc"])]
setup(
name="cocoeval_ext",
version="0.0.0",
ext_modules=ext_modules,
cmdclass={"build_ext": build_ext},
)
|
c23b0998abe33752759b5760974452c4f2c759c44a451d3075e20c28f10b1d12 | Python | 286 | 4 | from .models import GCNConv, GINConv, GINConv_mask, GCNConv_mask, GCN_2l_mask, GCN_2l, GCN_3l, GCN_3l_BN, GIN_2l, GIN_3l, \
GIN_2l_mask, GNNPool, GNNBasic, GlobalMeanPool, GraphSequential, IdenticalPool
from .model_manager import load_model, config_model
from .utils import ReadOut
|
aabc8812b59163ed6f809d13c0c83b4b4f702033ffc9aed7b0cd4a75c2b4dbe1 | Python | 290 | 8 | import pytest
from chromadb.errors import NotFoundError
from chromadb.test.conftest import ClientFactories
def test_get_database_not_found(client_factories: ClientFactories) -> None:
with pytest.raises(NotFoundError):
client_factories.create_client(database="does_not_exist")
|
db3e7eae7f7c1623cfff740450512640fd5d320c0be305308738e615ee95c05b | Python | 290 | 8 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""openfl.experimental.workflow.interface package."""
from openfl.experimental.workflow.interface.fl_spec import FLSpec
from openfl.experimental.workflow.interface.participants import Aggregator, Collaborator
|
e4e9d518d6c62bc3373b640d276a5d7faaf86e0cb7f745cc58ed272061ce75ef | Python | 290 | 8 | from conftest import TrainingInvarianceBaseTest
class TestTrainingInvariance(TrainingInvarianceBaseTest):
# Test restarts and validation loss invariance with
# exactly the same model config
def modify_model_config(self, original_config):
return original_config.copy()
|
28183c0117f3654b56df375f4cf0a05b4de9b80118af7c399253c4f28a851dbc | Python | 291 | 11 | """Configure imports for focused tests outside the repository test root."""
from __future__ import annotations
import sys
from pathlib import Path
_NWB_SCRIPT_DIR = Path(__file__).resolve().parents[1]
if str(_NWB_SCRIPT_DIR) not in sys.path:
sys.path.insert(0, str(_NWB_SCRIPT_DIR))
|
bf98d0e9ca2540b6e7424d01a7a81b30af28b06bbb36b5dc2042c8103f25397f | Python | 291 | 8 | """Generative Modeling for Multivariate Relationships"""
from .sample_size.linear_model import cca_sample_size, pls_sample_size
from .sample_size.univariate_correlations import pearson_sample_size
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
|
3d2fae45aefebd7beef5e06287b82a65740836e3076e3871bc11c6b906d4c4eb | Python | 292 | 12 | try:
from ._torch import TorchAdam, TorchLBFGS, TorchRMSprop, TorchSGD
except ImportError:
pass
try:
from ._torchmin import TorchminMinimize
except ImportError:
pass
from ._optimization import Minimizer, NewtonMethod, RootFinder
from ._scipy import ScipyMinimize, ScipyRoot
|
9f26a792628615270b7ff29a72ea825186ff19fc23d973722d887e88a00aa97a | Python | 292 | 11 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openfl.component.aggregator.aggregator import Aggregator
from openfl.component.aggregator.straggler_handling import (
CutoffTimePolicy,
PercentagePolicy,
StragglerPolicy,
WaitForAllPolicy,
)
|
b7a52ff633b922d3a3fcba4678536bca1f0793c4ef10031e42cb6997bf6275db | Python | 293 | 8 | # submit all
import os
#for ds in ['gb1']:
#for ds in ["at_3p", "at_10p", "pabp", "aav", "gfp", "gb1", "grb2"]:
for ds in ['gb1', 'aav']:
os.system("sbatch /n/groups/marks/users/david/github/pareSingleLibrary2/codebase/pairedEnd/ex62_gvp/subsampling_all/subsample_job.sh {}".format(ds))
|
787d56c966a68159fcdc792694fc29fe303b6580004d762954bd7cef050cea55 | Python | 294 | 13 | """Code to find an optimal experimental design \
for fMRI experiments using the Genetic Algorithm.
.. moduleauthor:: Joke Durnez <joke.durnez@gmail.com>
"""
from neurodesign.classes import Design, Experiment, Optimisation
__all__ = [
"Design",
"Experiment",
"Optimisation",
]
|
28c0592fb85b105882031dfaf149a6629ae5e8a81a1db66a258a199f542b583b | Python | 296 | 11 | import experiment as exp
import arena
class FeederTestExperiment(exp.Experiment):
default_params = {
"feeder_interface": "Feeder 1",
}
def run_trial(self):
interface = exp.get_params()["feeder_interface"]
arena.run_command("dispense", interface, None, False) |
a60fb5d322d4223cafff4975cf1d4500ee6d58b78d7ff33d89f213526425f88a | Python | 296 | 17 | #!/bin/env python3
#
# Simple script to convert a TOML file to a JSON file
#
import sys
import json
import tomli
if __name__ == "__main__":
with open(sys.argv[1], "rb") as tf:
config = tomli.load(tf)
with open(sys.argv[2], "w") as jf:
json.dump(config, jf, indent=2)
|
c38c4e841057c33b5339502d82f5e0da597914219e8be33456d68cb451ed650e | Python | 298 | 7 | import logging
logging.basicConfig(format="%(levelname)s: %(message)s")
logging.getLogger().setLevel(logging.INFO)
loggers = [logging.getLogger(name) for name in logging.root.manager.loggerDict]
if loggers and loggers[0].name.startswith("nose2"):
logging.getLogger().setLevel(logging.WARNING)
|
c857225f259bf6da2906eb645a4cff6da0cc3bdb8315462c55b060b1f7ae8d01 | Python | 298 | 4 | from pynidaqmxegs.ao.HardwareBasic import HardwareBasic
from pynidaqmxegs.ao.OnDemand import OnDemand
from pynidaqmxegs.ao.hardwareContinuousVoltageCallback import hardwareContinuousVoltageCallback
from pynidaqmxegs.ao.hardwareContinuousVoltageNoCallback import hardwareContinuousVoltageNoCallback
|
e105a8a6e9d5ca2b84603545896568f430738603ba8775b62dbee526914613cb | Python | 298 | 12 | """
NeuroDecode provides a real-time brain signal decoding framework.
"""
import logging
from .logger import init_logger
# set loggers
logging.getLogger('matplotlib').setLevel(logging.ERROR)
logger = logging.getLogger('neurodecode')
logger.propagate = False
init_logger(logger, verbosity='INFO')
|
233924199da328ecc0d6a428ff9ef89e808960e851eebd79c398d5fdcc3723d6 | Python | 299 | 12 | file = open("Negative.vcf")
lines = file.readlines()
for line in lines:
line = line.rstrip('\n')
line_split = line.split('\t')
chr = line_split[0]
pos = line_split[1]
rsid = "."
ref = line_split[3]
alt = line_split[4]
print(chr+'\t'+pos+'\t'+rsid+'\t'+ref+'\t'+alt)
|
40f619413057effe7f8a547b3d19d43b894d13c01c9bb27a9eb3058277a6110b | Python | 299 | 7 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openfl.utilities.optimizers.numpy.adagrad_optimizer import NumPyAdagrad
from openfl.utilities.optimizers.numpy.adam_optimizer import NumPyAdam
from openfl.utilities.optimizers.numpy.yogi_optimizer import NumPyYogi
|
4dd2dda9990354e841b49680235f7f7433d6842bf41686228bea57924f444580 | Python | 299 | 17 |
from ..log import log_info
from ..glove import Glove
def emb_fit(args):
glove = Glove.from_env()
log = glove.emb(
args.cooc,
args.vocab,
args.output,
args.dim,
args.threads,
args.iterations
)
for line in log:
log_info(line)
|
015f93afb1d8d3cf35c7a0d47b5fe1395ef1fbee43fe534ddb97f3e27f16bddf | Python | 300 | 12 | """Module containing some utilities for testing."""
from pathlib import Path
import pkg_resources as pkg
__all__ = ["PATH_DEEPRANK_GNN", "PATH_TEST"]
# Environment data
PATH_DEEPRANK_GNN = Path(pkg.resource_filename('deeprank_gnn', ''))
ROOT = PATH_DEEPRANK_GNN.parent
PATH_TEST = ROOT / "tests"
|
ace086928691d27873cec2b846f9099fb5066c9bc39c1231b61d6bead8fb9dd3 | Python | 300 | 10 | from geomstats.test.data import TestData
class UniformlySampledPathEnergyTestData(TestData):
N_TIME_POINTS = [100]
tolerances = {"dist_from_path_energy_per_time": {"atol": 1e-2}}
def dist_from_path_energy_per_time_test_data(self):
return self.generate_random_data_with_time()
|
fc86e07ea26d0a5af823747c34d561c3fdd4c1eac1b73848e331ecaf1d317571 | Python | 301 | 11 | from .encodings import single, repeat, bernoulli, poisson, rank_order
from .loaders import bernoulli_loader, poisson_loader, rank_order_loader
from .encoders import (
Encoder,
NullEncoder,
SingleEncoder,
RepeatEncoder,
BernoulliEncoder,
PoissonEncoder,
RankOrderEncoder,
)
|
086d5f0a3fee36e3ff0ba1004c2cda9d193238fdf30a772a48316b6ecbe33a57 | Python | 302 | 8 | from geomstats.test.parametrizers import DataBasedParametrizer
from geomstats.test_cases.backend import AgainstScipyTestCase
from .data.against_scipy import AgainstScipyTestData
class TestAgainstScipy(AgainstScipyTestCase, metaclass=DataBasedParametrizer):
testing_data = AgainstScipyTestData()
|
6c00f3c9a9ef66fcc984515151d6a69fc3bd8bf870200a72e87595b5a07192a3 | Python | 302 | 12 | from __future__ import absolute_import
from collections import namedtuple
CI = namedtuple('confidence_interval', ['lower', 'upper'])
from .descriptive import *
from .tests import *
from .utils import *
from . import distributions
from . import data
from . import clustering
from . import event_series |
b7deb2d94f5acc732d2fb18682c88bf599062bac6b3accee0bba67db83d848ca | Python | 302 | 10 |
from sleepy.test.data import TestSignal
import matplotlib.pyplot as plt
# Create the x- and y-axis data of a signal with std. dev. 2, 300 samples per sub-wave and 50 sub-waves.
x, y = TestSignal.generate(scale = 2, numberOfSamples = 300, size=50)
# Plot the data
plt.plot(x, y)
plt.show()
|
d2a1de910ae7ee66b06476d39202bcc0a78cec9aec0e46f9fd02295e2266ea99 | Python | 302 | 8 | from geomstats.test.parametrizers import DataBasedParametrizer
from geomstats.test_cases.backend import AgainstNumpyTestCase
from .data.against_numpy import AgainstNumpyTestData
class TestAgainstNumpy(AgainstNumpyTestCase, metaclass=DataBasedParametrizer):
testing_data = AgainstNumpyTestData()
|
c64ed29aab1419b560ff8760b9dfc8ea34d0a75cdb6c274f7c4a12f92f090f28 | Python | 303 | 14 | import random
import numpy as np
import torch
def set_seed(seed):
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
np.random.seed(seed)
random.seed(seed)
torch.backends.cudnn.benchmark = False
torch.backends.cudnn.deterministic = True
|
da247259109e201da21462ed9d48a6bdc8bccd9d76fdada65f5d719bf83ce2bb | Python | 303 | 9 | import os
# path for generated data
output_path = os.path.join(os.path.expanduser('~'), 'path/to/pipeline/output/folder/')
# optional alternative path for config files
# directory must contain stageXY_<stage-name>/config_<PROFILE>.yaml
# if None uses the pipeline working directory
configs_dir = None
|
12b985a857d13edd5579e313e3122c45fc1c023c816ec178fd903f7266501eed | Python | 305 | 29 | #global variables for the ISNet
global LayerIndex
global X
global XI
global t
global mean_l
global mean_L
global Ml
global detach
global LRP
global e
global multiple
global W
#First definition
LayerIndex=0
X=[]
XI=[]
t=0
mean_l=0
mean_L=0
Ml=0
detach=True
multiple=False
W=[]
#LRP-Flex
LRP=False
e=0.01
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.