sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
6f869072d1a133c7e55b9c330c585909746e107cf36721e64f16c8fb6f71c797 | Python | 481 | 28 | import seaborn as sns
from analysis_utils import nature_relplot
import matplotlib
def process_analysis_df(df):
"""Pre-process analysis_df.
"""
df.insert(
1,
'Update weights to',
df.apply(
lambda row: learning_duration_to_w(
row['learning_duration']
... |
d35de232b3eb3de48f0711fffa4806393c01b80670ee9546e70e208c93409d28 | Python | 481 | 18 | # Generated by Django 4.1.1 on 2022-12-28 12:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('celsus', '0044_socialplatform'),
]
operations = [
migrations.AddField(
model_name='curtain',
name='curtain_type',
... |
f80eaa684be1f067d14b99bd085712a2c3019df0295d72cf661d4403b2a4526a | Python | 481 | 14 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
import warnings
from nequip.integrations.ase import NequIPCalculator
warnings.warn(
"DEPRECATION WARNING: `nequip.ase.NequIPCalculator` has moved to "
"`nequip.integrations.ase.NequIPCalculato... |
57e2f2bb4343bcb5541d88107cf978eebb4aec5bf0099736fc4c421c27c047a8 | Python | 482 | 22 | from sleepy.processing.algorithms import Massimi, Walkthrough, Relative, Percentile, BiLSTM, RandomForest, DTW1NN, Custom
from sleepy.processing.filters import BandPassFilter
from sleepy.processing.mat.core import MatDataset
SUPPORTED_ALGORITHMS = [
Massimi,
#Walkthrough,
Relative,
Percentile,
... |
4bb9f483099bc8976f97643422362041c9f900eacff706ce56916f68724b20b7 | Python | 483 | 18 | """Meta information for Reinvent"""
__all__ = ["__version__", "__maintainer__", "__email__", "__copyright__"]
__progname__ = "REINVENT"
__version__ = "4.8.24"
__authors__ = [
"Hannes H Loeffer",
"Jiazhen He",
"Alessandro Tibo",
"Jon Paul Janet",
"Alexey Voronov",
"Lewis Mervin",
]
__maintainer_... |
9734473c5723b0f4748675315dd572b661ba1371e769a0e73b0a04f19ef5c3f0 | Python | 483 | 25 |
from navec import Navec
from navec.meta import Meta
from navec.vocab import Vocab
from navec.pq import PQ
from ..log import log_info
def open_bin(path):
return open(path, 'rb')
def pack(args):
meta = Meta(args.id)
with open_bin(args.vocab) as file:
vocab = Vocab.from_file(file)
with open... |
d1f16b520896ae9bcc5264fdc0adbd65407e374a6d687109654d2fd10a40eb86 | Python | 483 | 19 | # Generated by Django 4.1.1 on 2022-10-05 14:18
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('celsus', '0004_alter_differentialsamplecolumn_file_and_more'),
]
operations = [
migrations.AlterField(
... |
d563dd8eda6c49d8ce2f0515a4c6dded8af3ab88113021b2db7b8055731bec5b | Python | 484 | 9 | '''
Module providing a decoder for BCI and neurofeedback experiments.
It assumes that a classifier has already been trained; Look at the protocol trainer_mi.py to learn how to train the classifier.
Currently, LDA, regularized LDA, Random Forests, and Gradient Boosting Machines are supported as classifier types.
'''
... |
d8f035a965ccb4703af35deb5a352388396055664269c0174290457bc587b764 | Python | 484 | 14 | # test_data_loader.py
import unittest
from plasticity import data_loader
class TestDataLoader(unittest.TestCase):
def test_load_data(self):
# Test that data is loaded correctly
data = data_loader.load_data('path/to/data')
self.assertIsNotNone(data)
def test_invalid_path(self):
... |
fdfcc6a9cd0a659aad6961bc5618c730e78a2eb40749f89a7ca513e9a2906066 | Python | 484 | 20 | from geomstats.test.data import TestData
from ..test_geometry.data.mixins import DistMixinsTestData
class KernelTestData(TestData):
N_RANDOM_POINTS = [1]
trials = 1
def against_other_random_test_data(self):
return self.generate_random_data()
class VarifoldMetricTestData(DistMixinsTestData, Tes... |
10e5e3878d509cf9e55083f0e0db25c2284bf0e13a24c67d06759fabd7b88aaa | Python | 485 | 16 | from dig.ggraph.evaluation import RandGenEvaluator
from rdkit import Chem
import shutil
def test_RandGenEvaluator():
smile = 'CCCS(=O)c1ccc2[nH]c(=NC(=O)OC)[nH]c2c1'
mol = Chem.MolFromSmiles(smile)
res_dict = {'mols':[mol], 'train_smiles': [smile]}
evaluator = RandGenEvaluator()
results = evaluator... |
045440fc4d3518a395b4e0ea0f2ae0c1b608863a8926b7bb2bc3d62cd393616e | Python | 486 | 21 | # -*- coding: utf-8 -*-
#import os
#import sys
#dir_path = os.path.dirname(os.path.realpath(__file__))
#sys.path.append(dir_path + '/lib/JSLog')
#sys.path.append(dir_path + '/lib/JSData')
#sys.path.append(dir_path + '/lib/JSModels')
#sys.path.append(dir_path + '/lib/JSExperiment')
#sys.path.append(dir_path + '/lib/J... |
1d145617130c7067415b32948f44aba5f332100cdc5f49db110dc06520f87857 | Python | 486 | 20 | import os
import shutil
"""
Usage: if using resonet with a CCTBX Python installation
then use this script to update the shebang in
simulate and train scripts
"""
shebang="#!/usr/bin/env libtbx.python\n"
scripts = ["resonet-simulate", "resonet-train", "resonet-imgeater"]
for s in scripts:
s_path = shutil.whi... |
274866b1cdb6c0fa2480d3bbe9ba3b4365ce606f9b232a15d21481ac55320279 | Python | 487 | 23 |
from os.path import basename
from ..s3 import S3
from ..log import log_info
def s3_upload(args):
key, path = args.key, args.path
s3 = S3.from_env()
if not key:
key = basename(path)
log_info('%s -> %s/%s', path, s3.bucket, key)
s3.upload(path, key)
def s3_download(args):
key, path =... |
dd10ec430e285a02c4972cd24b4285d46b83fa384758d2ac44ccce989284c616 | Python | 487 | 9 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openfl.callbacks.callback import Callback
from openfl.callbacks.callback_list import CallbackList
from openfl.callbacks.lambda_callback import LambdaCallback
from openfl.callbacks.memory_profiler import MemoryProfiler
from openfl.callbac... |
7a46d824826e29a769f597824f8bfbc949a691e01452d4de670d1372e5efe571 | Python | 488 | 15 | from dig.ggraph.utils import gen_mol_from_one_shot_tensor
import torch
from rdkit import Chem
def test_gen_mol_from_one_shot_tensor():
adj = torch.ones(1, 4, 6, 6)
x = torch.ones(1, 4, 6)
atomic_num_list = [6, 7, 8, 0]
gen_mols = gen_mol_from_one_shot_tensor(adj, x, atomic_num_list)
gen_smiles = Ch... |
11b7374e920eb202499ee7cd512733ae98e56b59ac0ee2549f845343d284f485 | Python | 489 | 25 | import sys
PLOT = not 'no_plot' in sys.argv
MEASURE_INDIVIDUALLY = False
DURATION = 300
SIZE = int(sys.argv[1])
A, B, C, D = 0.02, 0.04, -65.0, 2.0
THRESHOLD = 30.0
V_MEAN, U_MEAN = -65.0, 12.0
V_STD, U_STD= 7.0, 7.0
TRACE_TAU = 20.0
DIRAC_STRENGTH = 1.0 / SIZE
A_PLUS, A_MINUS = 0.01, 0.012
W_MIN, W_MAX = 0.0, 1.0
... |
d8c31408f35b1e0df41c9837353158c273b4222838c52809120aad669fbbd144 | Python | 490 | 19 | import importlib
def extra_dependencies(*library_names):
def decorator(func):
def wrapper(*args, **kwargs):
execute_function = True
for lib in library_names:
try:
importlib.import_module(lib)
except ImportError:
... |
82a094cde126e655d84eb17bd021b6a0b15711497a244601cd871fee21b47859 | Python | 491 | 26 | """Configurations for TL."""
__all__ = [
"StepLRConfiguration",
"LambdaLRConfiguration",
]
from dataclasses import dataclass
@dataclass(frozen=True)
class StepLRConfiguration:
lr: float = 1e-4
min: float = 1e-07
gamma: float = 0.95
step: int = 10
@dataclass(frozen=True)
class LambdaLRConfig... |
ad298b41e331498affb742a6fae35a20ff3966114dfca936114cc4216ef1a856 | Python | 491 | 14 | import unittest
from plasticity import synapse
class TestSynapse(unittest.TestCase):
def test_synapse_initialization(self):
# Test that the synapse is initialized correctly
my_synapse = synapse.MySynapse()
self.assertIsNotNone(my_synapse)
def test_synapse_activation(self):
# Te... |
d1dd71bca8ee16e33a577bb91bbf148ea7785ee3dab1a7b80be1445eebb15a4e | Python | 491 | 16 | import numpy as np
import warnings
with warnings.catch_warnings():
warnings.simplefilter('ignore', category=FutureWarning)
import caiman as cm
def make_images(caiman_obj):
Yr, dims, T = cm.load_memmap(caiman_obj.mmap_file)
return np.reshape(Yr, [T] + list(dims), order='F')
def find_com(A, dims, x_1st... |
d0c9226ddd9733515a33fbea11a2c76800bb40fcde3ee4949d90e895f9074dfe | Python | 493 | 14 | from setuptools import setup, find_packages
setup(
name='sniffles',
version='2.8.1',
packages=find_packages(),
url='https://github.com/fritzsedlazeck/Sniffles',
license='MIT',
author='Moritz Smolka, Hermann Romanek',
author_email='moritz.g.smolka@gmail.com, sniffles@romanek.at',
descrip... |
bcde986526b820d834bfb16981e0cbafb4db041a1c11997df20c9634591a4cd0 | Python | 494 | 20 | from scipy.signal import butter
def butter_design(flp, fhi, delt, order):
"""Butterworth filter design.
Args:
flp (float): Low-pass frequency.
fhi (float): High-pass frequency.
delt (int): Sampling interval.
order (int): Filter order.
Returns:
double: Filter design... |
36f1247acbfaef0e19047f2ae69abbcf3c131fb71fbddb19a6104dbfc0569915 | Python | 495 | 16 | import pandas as pd
csv = pd.read_csv("all_indels_chimp_sorted_uniq_NC.bed", sep = "\t", header = None)
output = []
l = []
for index, row in csv.iterrows():
if not l:
l.append(list(row))
else:
if l[0][1] == row[1]:
l.append(list(row))
else:
i = len(l) - 1
... |
eea6003f38780f6a81f196a6066927be7e9484efc71ba382d8d80c076939b5bc | Python | 495 | 16 | import pandas as pd
csv = pd.read_csv("all_indels_human_sorted_uniq_NC.bed", sep = "\t", header = None)
output = []
l = []
for index, row in csv.iterrows():
if not l:
l.append(list(row))
else:
if l[0][1] == row[1]:
l.append(list(row))
else:
i = len(l) - 1
... |
a14e2752c769c40cc4ac9ada42e4ab9d2cc739357d603615e535f44c22c2a572 | Python | 497 | 15 | """Autograd based random backend."""
import autograd.numpy as _np
from autograd.numpy.random import randint, seed
from ._dtype import _allow_complex_dtype
rand = _allow_complex_dtype(target=_np.random.rand)
uniform = _allow_complex_dtype(target=_np.random.uniform)
normal = _allow_complex_dtype(target=_np.random.norm... |
b60da73acb38b4cd3bf0133f81583f233c6a089a81bd42a8d4fcd138a7221af5 | Python | 498 | 10 | import pandas as pd
left=pd.read_csv('Disease_02-filter-SNP.recode.dbsnp.vcf', sep='\t')
right=pd.read_csv('Disease_sort_uniq_02.vcf', sep='\t')
data_merge=pd.merge(left, right, on='ID')
data_merge=data_merge.groupby(['CHROM','POS','ID','REF','ALT'])
data_merge=data_merge['DISEASE/TRAIT'].unique()
data_merge=data_merg... |
1d62872930f839b57bbff15560aa2f4b616ebe07a330ecafc7545c6d09c53432 | Python | 500 | 18 | # ==============================================================================
# Copyright 2023 Technical University of Denmark
# Author: Nikolas Borrel-Jensen
#
# All Rights Reserved.
#
# Licensed under the MIT License.
# ==============================================================================
import json
de... |
8817d26a42244a3d8ef9dd43e530aef917fcfe5bcfc4b5f52d951912e9c5b7a2 | Python | 500 | 17 | from __future__ import annotations
from typing import Optional, List
import numpy as np
from .diversity_filter import DiversityFilter
class IdenticalMurckoScaffold(DiversityFilter):
"""Penalizes compounds based on exact Murcko Scaffolds previously generated."""
def update_score(
self, scores: np.nd... |
fe489b4d6fe6570b3f8cc48789a3575fa90ee8ac9d918836cea0fea1576fce3a | Python | 500 | 21 | from sklearn.metrics import auc, precision_recall_curve, roc_auc_score
def RMSE(y, pred):
mse = ((y-pred)**2).mean()
return mse**0.5
def MAE(y, pred):
mae = (((y-pred)**2)**0.5).mean()
return mae
def prc_auc(targets, preds):
precision, recall, _ = precision_recall_curve(targets, preds)
retur... |
f4059ef86bcf3bfaa81a1e5e10f9076ba0195c32baca31c9779cbb0c6484797a | Python | 502 | 19 | from .nfold_manifold import NFoldManifoldTestData, NFoldMetricTestData
class PoincarePolydiskTestData(NFoldManifoldTestData):
skips = ("not_belongs",)
tolerances = {
"projection_belongs": {"atol": 1e-6},
}
class PoincarePolydiskMetricTestData(NFoldMetricTestData):
fail_for_not_implemented_er... |
2c862f523c015715ac5dabc2e74c0b9e48a9a7ee7f3b0a25c29fdfe8cbca71c4 | Python | 504 | 18 | from uuid import UUID
from starlette.responses import JSONResponse
from chromadb.errors import ChromaError, InvalidUUIDError
def fastapi_json_response(error: ChromaError) -> JSONResponse:
return JSONResponse(
content={"error": error.name(), "message": error.message()},
status_code=error.code(),
... |
2dd2384e3d8478b4b5a08406dd0a323ea29fea0eecaf1036df990f47f093a566 | Python | 504 | 15 | import random
import numpy as np
output_folder = 'PROJECT_DIR/data/imaging/roi/\
multiple_cv_datasets/'
fname = output_folder + 'randomSeedsList.npz'
randomlist1 = [] # this is for initial train-test split
randomlist2 = [] # this is for further split of train into train-valid
for i in range(100):
randomlist1.appe... |
513b7a88f2ce0413ad6686363c17693a0d1a950941d00bfd6be5c29bb0e3c606 | Python | 504 | 10 | import pandas as pd
left=pd.read_csv('Disease_00_filter-SNP.recode.dbsnp.vcf', sep='\t')
right=pd.read_csv('Disease_sort_uniq_00.vcf', sep='\t')
data_merge=pd.merge(left, right, on='ID')
data_merge=data_merge.groupby(['CHROM','POS','ID','REF','ALT'])
data_merge=data_merge['DISEASE/TRAIT'].unique()
data_merge=data_merg... |
c9c546daea567671c8bc55765f2bf92276736a7a1471f03d6fca23659778ff0d | Python | 505 | 22 | """
Modified from the GNNAutoScale https://github.com/rusty1s/pyg_autoscale
"""
from .history import History # noqa
from .pool import AsyncIOPool # noqa
from .metis import metis, permute # noqa
from .utils import compute_micro_f1, gen_masks, dropout # noqa
from .loader import SubgraphLoader, EvalSubgraphLoader # ... |
fa413cff22b109e31d06a3e36727686e217ec070c2e89fd676b1e99cb9bdcebc | Python | 505 | 19 | from .product_manifold import ProductManifoldTestData, ProductRiemannianMetricTestData
class ProductPositiveRealsAndComplexPoincareDisksTestData(ProductManifoldTestData):
pass
class ProductPositiveRealsAndComplexPoincareDisksMetricTestData(
ProductRiemannianMetricTestData
):
trials = 3
skips = Prod... |
1792f6f4b32cf32eb895ec88bafcf991afb41c4ff1c233558f3b648458c8219a | Python | 506 | 22 | import math
from .scaffold_penalty import ScaffoldPenalty
class TanhPenalty(ScaffoldPenalty):
"""Penalize extrinsic reward using hyperbolic tangent function."""
def calculate_penalty(self, scaffold: str) -> float:
bucket_size = self.scaffold_memory.max_size
n_scaffold_instances = self.scaff... |
295b16de8905616b386e14b2f56fea100ff58f5cb1665a2a26bd3fdb6d625df6 | Python | 507 | 16 | import geomstats.backend as gs
from geomstats.test.parametrizers import DataBasedParametrizer
from geomstats.test_cases.backend import BackendTestCase
from .data.backend import BackendTestData
def test_where_without_values():
"""Check that where without values returns matching indices."""
(indices,) = gs.whe... |
334a4720899a67ee1618ee7fb6d607911a9ac08d09cdc5cc91409c4b3a2d13d8 | Python | 507 | 17 | from ._base import BaseEstimatorTestData
class GeodesicRegressionTestData(BaseEstimatorTestData):
fail_for_autodiff_exceptions = False
tolerances = {"predict_and_score": {"atol": 0.1}}
xfails = ("predict_and_score",)
def loss_at_true_is_zero_test_data(self):
return self.generate_random_data(... |
731b96053d6d57680361f7e35215a150792d8c216607f01f904bd65684fc7e96 | Python | 509 | 17 | from __future__ import annotations
from typing import List, Optional
import numpy as np
from .diversity_filter import DiversityFilter
class IdenticalTopologicalScaffold(DiversityFilter):
"""Penalizes compounds based on exact Topological Scaffolds previously generated."""
def update_score(
self, sco... |
4ffed2fb5b3cb376461412d7d98de1df95c4dcd9e8047076084844ce9610058f | Python | 510 | 14 | from PymoNNto import *
class refractory(Behavior):
def initialize(self, neurons):
neurons.refractory_counter = neurons.vector()
self.decayfactor = self.parameter('decayfactor', 0.5, neurons)
self.strengthfactor = self.parameter('strengthfactor', 1.0, neurons)
def iteration(self, neuro... |
53150677371f76c12e4f964da69133ac20512cad948326fcfdbd8a7df6a14e7a | Python | 512 | 18 | import numpy as np
def sympsd_inv_sqrt(M):
assert np.allclose(M, M.T)
assert np.all(np.linalg.eigvalsh(M) > 0)
evals, evecs = np.linalg.eigh(M)
evals = np.where(evals > 1e-15, 1 / np.sqrt(evals), 0)
Minvsqrt = evecs.dot(np.diag(evals)).dot(evecs.T)
assert np.allclose(
Minvsqrt.dot(M).... |
ebe0a88164d2fa17c37befe835de9ccad63125cedc17133a6b012fa9aa02ef67 | Python | 512 | 27 | import pytest
from live2p.alerts import Alert
@pytest.fixture
def msg():
return 'test_message'
@pytest.fixture
def level():
return 'info'
@pytest.fixture
def alert(msg, level):
return Alert(msg, level)
def test_msg(alert, msg):
assert alert.message == msg
def test_level(alert, level):
asser... |
06759f51c585744bc7f6b79544c62e32b02a11bc44ba8432a26f8d5efefbcc19 | Python | 517 | 10 | import pandas as pd
left=pd.read_csv('Intersection_GWAS_merge.vcf', sep='\t')
right=pd.read_csv('ImmuNexUT.vcf', sep='\t')
data_merge=pd.merge(left, right, on=['chr','pos','REF','ALT'])
data_merge=data_merge.groupby(['chr','pos','REF','ALT','DISEASE/TRAIT'])
data_merge=data_merge['Cell_Subset'].unique()
data_merge=dat... |
90df7218b54f9bb52661354be25fc1682339d2c5f68b54c0849ec23e3f44571e | Python | 517 | 16 | import unittest
from reinvent.chemistry.standardization.rdkit_standardizer import RDKitStandardizer
from tests.chemistry.fixtures.test_data import CELECOXIB2
class TestRDKitStandardizerNoConfig(unittest.TestCase):
def setUp(self):
filter_configs = []
self.standardizer = RDKitStandardizer(filter_c... |
17ee8fd9922c035dad8b465a10a5653e577c82a5f6bb060ac496f8bb00c906eb | Python | 518 | 14 | import unittest
import os
from plasticity import utils
class TestUtils(unittest.TestCase):
def test_save_logs(self):
# Test that logs are saved correctly
utils.save_logs('cfg', 'df')
self.assertTrue(os.path.exists('path/to/log'))
def test_experiment_list_to_tensor(self):
# Test... |
dc03e21e4fc40e5fe03b451b71979f0a7ff8e976b4b671fc69212a548ce52927 | Python | 518 | 22 | #
# For licensing see accompanying LICENSE file.
# Copyright (C) 2022 Apple Inc. All Rights Reserved.
#
from torch import nn, Tensor
from typing import Tuple
from . import register_act_fn
@register_act_fn(name="gelu")
class GELU(nn.GELU):
"""
Applies the `Gaussian Error Linear Units <https://arxiv.org/abs/1... |
040f476a9d178aa901557c51118b04c5013c8d6efbaf0d83b1b70849901fe190 | Python | 519 | 24 | #
# For licensing see accompanying LICENSE file.
# Copyright (C) 2022 Apple Inc. All Rights Reserved.
#
from torch import Tensor
from typing import Tuple
from .base_layer import BaseLayer
class Identity(BaseLayer):
"""
This is a place-holder and returns the same tensor.
"""
def __init__(self):
... |
740202d4b3e35e83b7efb3b256ae3e35aa330a1adfafc43c04df1867a5d5566c | Python | 519 | 22 | #
# For licensing see accompanying LICENSE file.
# Copyright (C) 2022 Apple Inc. All Rights Reserved.
#
from torch import nn, Tensor
from typing import Optional, Tuple
from . import register_act_fn
@register_act_fn(name="relu6")
class ReLU6(nn.ReLU6):
"""
Applies the ReLU6 function
"""
def __init__... |
7914dc3521c848285d201e1f85ce3499f0791c1bc1341f1cb3d51b53971ee8a7 | Python | 519 | 16 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
from typing import Optional
import torch
def find_first_of_type(m: torch.nn.Module, kls) -> Optional[torch.nn.Module]:
"""Find the first module of a given type in a module tree."""
if isinsta... |
848166c3dbe7931fdd5850b694bb74386685561b1f5701b0defca5206e02ec1c | Python | 519 | 22 | """Dataclass for reporting"""
__all__ = ["TLReportData"]
from dataclasses import dataclass
from typing import Sequence, Optional
@dataclass
class TLReportData:
epoch: int
model_path: str
mean_nll: float
isim: Optional[float]
sampled_smilies: Sequence
sampled_nlls: Sequence
fingerprints: S... |
a646e09c17d960a3fef4cab63d6bb497b5dea69079d3e2ce8fdaaa534d13675b | Python | 519 | 17 | import torch
import torch.nn as nn
class LayerNorm(nn.Module):
"Construct a layernorm module (See citation for details)."
def __init__(self, features, eps=1e-6):
super(LayerNorm, self).__init__()
self.a_2 = nn.Parameter(torch.ones(features))
self.b_2 = nn.Parameter(torch.zeros(feature... |
eed0a30b966e14284617f3236b128aec3fabfbe106476a58f5225672526cb613 | Python | 519 | 18 | import math
from .scaffold_penalty import ScaffoldPenalty
class ErfPenalty(ScaffoldPenalty):
"""Penalize extrinsic reward using error function."""
def calculate_penalty(self, scaffold: str) -> float:
bucket_size = self.scaffold_memory.max_size
n_scaffold_instances = self.scaffold_memory.buc... |
335a6a477cc2161c73f2f81739ed4420d4b9d1f4d99e1ca7f7921d58b460d63a | Python | 520 | 16 | # submit all
import os
#for n_pos_mutate in [5,10]:
#for t in [1e-3,1e-2,1e-1,0.5,0.75,1, 1.25, 1.5, 1.75, 2, 3, 4, 5, 10]:
#for t in [20,30,40,70,80,100,200,1000]:
# max pos mutate range scan at low temperatures
#for n_pos_mutate in list(range(5,21,2)):
# for t in [0.5, 0.75, 1.0]:
#temp... |
d50bd5fdee096aea25361fe514cbb770a2681cf6ea51d13759e4bfb53ee5d88d | Python | 520 | 19 | from dig.ggraph.evaluation import PropOptEvaluator
from rdkit import Chem
import shutil
def test_PropOptEvaluator():
smiles = ['C', 'N', 'O']
mols = []
for s in smiles:
mol = Chem.MolFromSmiles(s)
mols.append(mol)
res_dict = {'mols':mols}
evaluator = PropOptEvaluator()
results =... |
f8974da33ab9d1fe22e4cf5d8fd24216b580d90a8485d0d904d6773ce7ae9267 | Python | 520 | 26 | TRIGGER_DEVICE = 'SOFTWARE'
DATA_PATH = ''
TRIGGER_FILE = ''
FEEDBACK_TYPE = 'BAR'
FEEDBACK_IMAGE_PATH = ''
SCREEN_SIZE = (1920, 1080)
SCREEN_POS = (0, 0)
REFRESH_RATE = 50
DIRECTIONS = ['L', 'R']
DIR_RANDOM = False
TRIALS_EACH = 15
TRIAL_PAUSE = False
TIMINGS = { 'INIT':2, \
'GAP': 3, ... |
05e4bb099df8efd3cd2ab625518be34af4887d27f474a22f7af391dd144decd5 | Python | 521 | 16 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain ... |
302721d4ff86a800ebc08e33b3cb684b7cee98d4185ad396acccb7299a1fbcbe | Python | 521 | 22 | """Various data classes defining DTOs needed in RL sampling."""
from dataclasses import dataclass
from typing import List
import torch
# Reinvent
@dataclass
class SampledBatchDTO:
sequences: torch.Tensor # 2D: tokens per sequence, each token is integer
smiles: List[str]
nlls: torch.Tensor # 1D: negati... |
34924c47b6493f0b44dcedf174eccda306ac2d5de7abd348c38c539efa7466ad | Python | 521 | 21 | #!/usr/bin/env python
"""Tests for `fimpy` package."""
import pytest
@pytest.fixture
def response():
"""Sample pytest fixture.
See more at: http://doc.pytest.org/en/latest/fixture.html
"""
# import requests
# return requests.get('https://github.com/audreyr/cookiecutter-pypackage')
def test_co... |
442799e63e6125764168aa59e4396a6a61d2d2f3130cc9b6f21c5696c6bf52e5 | Python | 522 | 10 | import pandas as pd
left=pd.read_csv('Disease_01_chr_pos_sort_uniq_dbsnp_tabix.vcf', sep='\t')
right=pd.read_csv('Disease_sort_uniq_01_edit.vcf', sep='\t')
data_merge=pd.merge(left, right, on=['chr','pos'])
data_merge=data_merge.groupby(['chr','pos','ID','REF','ALT'])
data_merge=data_merge['DISEASE/TRAIT'].unique()
da... |
4aa3e70d74f76846f486ada2ba84d2681d1d81bf04f5888e2b2a203691b1afd4 | Python | 522 | 21 | from scipy.signal import filtfilt
from .butter_design import butter_design
def butter_bandpass_filter(x, flp, fhi, delt, order):
"""Butterworth filter design.
Args:
x (array_like): Signal to be filtered.
flp (float): Low-pass frequency.
fhi (float): High-pass frequency.
delt (i... |
da8ec0a6e334cc82dc81605aeb8078af6ee49ecc19cf05b2671efdf7f9ea51c7 | Python | 523 | 20 | import random
import numpy as np
import torch
def fix_random_seed(random_seed: int):
r"""
Fix multiple random seeds including python, numpy, torch, torch.cuda, and torch.backends.
Args:
random_seed (int): The random seed.
"""
random.seed(random_seed)
np.random.seed(random_seed)
t... |
fc1f419447b93d454e63e793bced406207fb0fc07da226ed3e36d39a7cd08def | Python | 523 | 17 | from ._base import BaseEstimatorTestData, MeanEstimatorMixinsTestData
class ExponentialBarycenterTestData(MeanEstimatorMixinsTestData, BaseEstimatorTestData):
pass
class AgainstFrechetMeanTestData(BaseEstimatorTestData):
tolerances = {"against_frechet_mean": {"atol": 1e-3}}
def against_frechet_mean_tes... |
34cde013b83d1d2bedb4404dd2fa5e6ff397997a2d70072e34571d1d0e11c40a | Python | 525 | 10 | import pandas as pd
left=pd.read_csv('Disease_00_filter-SNP.recode.1000Genomes.vcf', sep='\t')
right=pd.read_csv('Disease_sort_uniq_00_reduce.vcf', sep='\t')
data_merge=pd.merge(left, right, on=['chr','pos'])
data_merge=data_merge.groupby(['chr','pos','REF','ALT'])
data_merge=data_merge['DISEASE/TRAIT'].unique()
data_... |
3206d56ebcc0ad89c69892cf72324e5c2390b8c1a51d464dd496cdb07f014206 | Python | 526 | 18 | # Generated by Django 4.1.5 on 2023-04-29 13:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('celsus', '0055_datafilterlist_default_datafilterlist_user'),
]
operations = [
migrations.AlterField(
model_name='curtain',
... |
6a1f6dcba244267ad4e6193db51e063d194fb50166aa57da649b434122e5d37f | Python | 526 | 17 | import pytest
from geomstats.test.parametrizers import DataBasedParametrizer
from geomstats.test_cases.learning.kernel_density_estimation_classifier import (
KernelDensityEstimationClassifierTestCase,
)
from .data.kernel_density_estimation_classifier import (
KernelDensityEstimationClassifierTestData,
)
@py... |
ae241fd06ebd3ec229595f37b4d3230376c65d6a671b47a6a346bb087b782550 | Python | 528 | 21 | #!/usr/bin/env python
import matplotlib
from nilearn import plotting
def vis_qc_probseg(img: str, seg4d: str, out_png: str) -> None:
matplotlib.use("Agg")
# Save output png
display = plotting.plot_prob_atlas(bg_img=img, maps_img=seg4d, display_mode="ortho")
display.savefig(out_png)
display.close... |
e00d8c7a839d895581036bb7285e2de144f8cdd5a63edc8dd7522117b82d33d8 | Python | 528 | 22 | #
# For licensing see accompanying LICENSE file.
# Copyright (C) 2022 Apple Inc. All Rights Reserved.
#
from torch import nn, Tensor
from typing import Optional, Tuple
from . import register_act_fn
@register_act_fn(name="relu")
class ReLU(nn.ReLU):
"""
Applies Rectified Linear Unit function
"""
def... |
070a2facc8489fa4e95387fe6afd5938243916ac9b84c0795034157c76c404db | Python | 529 | 16 | """Numpy based random backend."""
import numpy as _np
from numpy.random import default_rng as _default_rng
from numpy.random import randint, seed
from ._dtype import _allow_complex_dtype
rand = _allow_complex_dtype(target=_np.random.rand)
uniform = _allow_complex_dtype(target=_np.random.uniform)
normal = _allow_comp... |
e1c3c513ab0505d7393d08d352b0d365b4b15c007c74cb8cb6e8f452f91949f0 | Python | 532 | 20 | import torch
import torch.nn as nn
class Classifier(nn.Module):
def __init__(self, input_dim, hidden_dim) -> None:
super(Classifier,self).__init__()
self.model = nn.Sequential(
nn.Linear(input_dim,hidden_dim),
nn.ReLU(),
nn.Linear(hidden_dim,1)
)
... |
d74d59bf6b48165de5757a1e71f4f5863f99ca54af58b42c25924ae02eee9aa5 | Python | 533 | 25 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Experimental CLI."""
import os
from pathlib import Path
from click import group, pass_context
@group()
@pass_context
def experimental(context):
"""Manage Experimental Environment."""
context.obj["group"] = "experimental"
@e... |
1fcc581c6eb627f359874d16e103627d7d5ce1db532e82f918537ab7d9d09b80 | Python | 535 | 21 | """The :mod:`pydfc.dfc_methods` contains dFC methods objects."""
from .base_dfc_method import BaseDFCMethod
from .cap import CAP
from .continuous_hmm import HMM_CONT
from .discrete_hmm import HMM_DISC
from .sliding_window import SLIDING_WINDOW
from .sliding_window_clustr import SLIDING_WINDOW_CLUSTR
from .time_freq im... |
8692e8423d888ba4caef8d95718a627ca4b056f71d005bdc81be7b13ac8b38a0 | Python | 535 | 20 | # Generated by Django 4.1.1 on 2022-11-11 10:01
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('celsus', '0025_labgroup_project_lab_group'),
]
o... |
d66c325596ca93fe3be12ffa433b31b41a9040cf764733ba272559bd1378225b | Python | 536 | 12 | from PymoNNto import *
class Static_Classification(AnalysisModule):
def initialize(self, neurons):
self.add_tag('classifier')
self.name = self.parameter('name', super()._get_base_name_())
classes = self.parameter('classes', None) #array with size neurons.size where each entry is a number t... |
851ff063d2fd6548627873a391f7387419abcee633958be2e9e89e883236a5cb | Python | 538 | 17 | import pytest
from geomstats.test.parametrizers import DataBasedParametrizer
from geomstats.test_cases.learning.agglomerative_hierarchical_clustering import (
AgglomerativeHierarchicalClusteringTestCase,
)
from .data.agglomerative_hierarchical_clustering import (
AgglomerativeHierarchicalClusteringTestData,
)... |
af92418b114d0c21d5a7ede4e1da7af7267736b96970a9c4999af95c3066e9f1 | Python | 538 | 20 | from .riemannian_metric import (
RiemannianMetricComparisonTestData,
RiemannianMetricTestData,
)
class SPDBuresWassersteinQuotientMetricCmpTestData(RiemannianMetricComparisonTestData):
fail_for_autodiff_exceptions = False
fail_for_not_implemented_errors = False
tolerances = {"geodesic_bvp_random"... |
2a8e4d14dc80a5a99ea98e559dbc4cf16fcd4f018f5f798d70b82c771932d8b0 | Python | 541 | 15 | from geomstats.test.test_case import TestCase
class KernelDensityEstimationClassifierTestCase(TestCase):
def test_predict(self, estimator, X_train, y_train, X_test, y_test):
estimator.fit(X_train, y_train)
y_pred = estimator.predict(X_test)
self.assertAllEqual(y_pred, y_test)
def tes... |
30ac373bb23bea7c4a109bf72fbd3b95c3689c8bff79faa3dc1aec462cdedc4e | Python | 541 | 23 | # Generated by Django 2.1 on 2018-08-14 06:01
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='imagelist',
fields=[
('pid', models.IntegerFi... |
9dcfbdd7aac4557080acdead5097e5fc6f939572a27686583b124f39b8278a5d | Python | 541 | 19 | from .area_ths import AreaThresholds
from .bkg_widget import BkgWidget
from .blob_info_widget import BlobInfoWidget
from .frame_analyzer import FrameAnalyzer
from .intensity_ths import IntensityThresholds
from .open_video_widget import OpenVideoWidget
from .ROI_widget import ROIWidget
from .track_intervals_widget impor... |
459cc61f660166da2e74aab97baa15e3f8c228e016bc02acb40ac43808e6221b | Python | 544 | 23 | from functools import partial
import os
import numpy as np
from reinvent.models.utils.parallel import parallel
def sigmoid(data, *, weights):
for _ in range(1000):
x = 1 / (1 + np.exp(-data * weights))
return x
def test_parallel():
data = np.random.default_rng(42).standard_normal(1000)
w =... |
876d99857c121d440581883bb9930c64e135189120101887b47e62325ffaf120 | Python | 544 | 15 | #!/usr/bin/env python
import os
import sys
if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'WebLabelling.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django.... |
8977b2811afcc2172f317b8e5b52bfe3e7fe2cb034b6a8eec9aaa665596a9282 | Python | 545 | 7 | from .HelmholtzModel import HelmholtzModel, helper_get_alpha
from .TransportModelPVT import TransportModel_PVT, TransportModel_PVT_Tinv
from .TransportModelEntropy import TransportModel_entropy
from .TransportModelEntropy import diffusivity_scaling, viscosity_scaling, thermal_conductivity_scaling
from .TransportModelPV... |
ecd0f4c433c7f8a49e589a6d03aa93a2d35bacc2ff33e3c164bfd0caf66681b4 | Python | 548 | 6 | from pynidaqmxegs.ai.hardwareContinuousVoltage import hardwareContinuousVoltage
from pynidaqmxegs.ai.hardwareContinuousVoltageWithCallBackNoPlot import hardwareContinuousVoltageWithCallBackNoPlot
from pynidaqmxegs.ai.hardwareContinuousVoltageWithCallBackPyQtPlot import hardwareContinuousVoltageWithCallBackPyQtPlot
from... |
3e04e8053ece5b59c7a9c8fc468cfc831ef1dcfffa0fe20f090ac617d2cf8128 | Python | 549 | 19 | # Generated by Django 4.1.1 on 2022-12-03 14:49
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('celsus', '0037_projectsettings'),
]
operations = [
migrations.AddField(
model_name='project',
... |
5afd4755a253cb01a5872506f6b24413616b33a31c407d5cbda6ac0d9aeed4af | Python | 549 | 20 | import torch.nn as nn
from model_angelo.gnn.multi_layer_ipa import MultiLayerSeparableIPA
class Model(nn.Module):
def __init__(self):
super().__init__()
self.voxel_size = 1.0
self.ipa = MultiLayerSeparableIPA(
1280,
256,
num_layers=8,
... |
62529baa8200fb7ae8e1b55009ba86230abb9a873c2d565700fea56c1b259c2b | Python | 549 | 13 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""openfl.experimental.workflow.transport.grpc package."""
from openfl.experimental.workflow.transport.grpc.aggregator_client import AggregatorGRPCClient
from openfl.experimental.workflow.transport.grpc.aggregator_server import AggregatorG... |
ec11ef0f2df63d0cf32fe1a8016a22c65faf5c0c50fe5d3f121c7229b43d039d | Python | 549 | 13 | """Expose the installed nltools version. Single source of truth: pyproject.toml.
`__version__` is read from the installed package metadata (populated by hatchling
from the `version` field in pyproject.toml), so the release bump in pyproject.toml
flows through automatically — there is no version string to keep in sync ... |
88396e6bea30bf1fd50f576895f9c6fdd670d343cc419163f336fb3ed9f4cce8 | Python | 550 | 15 | # submit all
import os
#for n_pos_mutate in [5,10]:
#for t in [0.0001, 0.1, 0.15, 0.2, 0.25, 0.3, 0.5, 0.7, 1.0]:
#for t in [0.7, 1.0, 1.5,1.75, 2,2.25, 2.5,3,4,5,10,20,40,70,100]:
# to scan max pos range at low temps
#for n_pos_mutate in list(range(5,21,2)):
# for t in [0.7, 1, 1.5]:
# to scan temps ... |
fc79151b85619d780d47cba3bfe2fcbf06f1b4df424a8b07d743f37c075f0757 | Python | 550 | 24 | from unittest import TestCase
import unittest
import numpy as np
import filecmp
import os
from smithers.io import VTUHandler as Handler
test_file = "tests/test_datasets/cube.vtu"
def test_points():
data = Handler.read(test_file)
np.testing.assert_array_almost_equal(data["points"][0], [-0.5] * 3)
def test_... |
fe27abce194ea9423f59188fc118104e5556fa248d5b2fbb797cf43d816f0464 | Python | 550 | 20 | # 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.
"""
transpose last 2 dimensions of the input
"""
import torch.nn as nn
class TransposeLast(nn.Module):
def __init__(self, deconstruct_id... |
682d921ed3550a232618a38c66bda673bb1e40554b73610bae050b3562d2b7d8 | Python | 551 | 23 | from geomstats.geometry.euclidean import Euclidean
class EuclideanGroup(Euclidean):
@staticmethod
def compose(point_a, point_b):
return point_a + point_b
def log(self, point, base_point=None):
if base_point is None:
base_point = self.identity
return point - base_point... |
6fc07b549cfbe4017a9d5f18d3b253daac09c1cc473a8e0098938fcd1f62833c | Python | 552 | 21 | # 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 torch import nn
class SamePad(nn.Module):
def __init__(self, kernel_size, causal=False):
super().__init__()
if cau... |
8e7a7710931890a32a1bfcbddafb03225191bf5e4f4aa2a400b8a5e294d02612 | Python | 552 | 23 | #!/usr/bin/env python
import pandas as pd
def create_missing_subj_tsv(
missing_subj_list: dict,
out_tsv: str,
) -> None:
df = pd.DataFrame()
df["participant_id"] = missing_subj_list["subject"]
if "session" in missing_subj_list:
df["session"] = missing_subj_list["session"]
df.to_csv(... |
26e549e946a1f3f1260ad636d872856b3217ba0a44ccf08935250569216bf359 | Python | 553 | 16 | import sys
import pandas as pd
import numpy as np
#convert a narrow peak format file to a gtf file
f = sys.argv[1]
file = open(f)
out = open(f.replace(".bed", ".gtf").replace(".narrowPeak", ".gtf"), 'w')
for line in file:
l = line.split("\t")
to_write = [l[0], "macs2", "peak", l[1], l[2], l[4], l[5], "."]
... |
2c2ff7fa80a52aa0afa78630c764405979e73d63535ddd3deec031b9c8cafb2a | Python | 554 | 22 | """Pytest module-wide configuration file."""
import pytest
import os
# @pytest.fixture(scope="session", autouse=True)
# def ensure_test_directory():
# if os.getcwd().endswith("PyRates"):
# os.chdir("tests/")
@pytest.fixture(autouse=True)
def run_around_tests():
# Code that will run before your test... |
acd02b7e9fecc82ad9e4d3934831e1134f5756db51cb39bd7406b87f6ba1b975 | Python | 556 | 16 | # ==============================================================================
# Copyright 2023 Technical University of Denmark
# Author: Nikolas Borrel-Jensen
#
# All Rights Reserved.
#
# Licensed under the MIT License.
# ==============================================================================
import numpy as ... |
63ab5ef7e384d98c02f4461f8898ad867d7ab82577c0464af595c1bd7b1e27fe | Python | 557 | 27 | """Nomralize SMILES
Implemented as a decorator.
"""
__all__ = ["normalize_smiles"]
from typing import List, Callable
import logging
from . import normalizers
logger = logging.getLogger("reinvent")
def normalize_smiles(func: Callable):
def wrapper(self, smilies: List[str]):
if getattr(self, "skip_norm... |
a22521beededc51584a46e559af1e7edf8c1e779bc2bbfb1aa7af3d010070652 | Python | 557 | 22 | # Generated by Django 4.1.1 on 2022-11-29 16:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('celsus', '0034_file_file_parameters'),
]
operations = [
migrations.RemoveField(
model_name='genenamemap',
name='unip... |
f68fb478cc6cf6c1ad196a48b2cec1d1395f382cbcafafb1632da3f03e04b593 | Python | 557 | 15 | import subprocess
# Needs to be a module, not a file, so that local imports work.
TEST_MODULE = "chromadb.test.client.create_http_client_with_basic_auth"
def test_main() -> None:
# This is the only way to test what we want to test: pytest does a bunch of
# importing and other module stuff in the background, ... |
6ab3f8219d5b7213816c89d42388343f28287ef9a51d4fc15597c6a7d76185d8 | Python | 559 | 14 | import geomstats.backend as gs
from geomstats.test_cases.geometry.base import VectorSpaceOpenSetTestCase
from geomstats.test_cases.information_geometry.base import (
InformationManifoldMixinTestCase,
)
class BinomialDistributionsTestCase(
InformationManifoldMixinTestCase, VectorSpaceOpenSetTestCase
):
def... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.