sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
79b7316cb83b0e7a5d8f3e712b4961c975764dedadfef6db8e03b71402dbec56
Python
559
21
import numpy as np import imageio def _stack_from_tif(file): reader = imageio.get_reader(file) img = reader.get_data(0) n_frames = reader.get_length() stack = np.full((n_frames, *img.shape), 0, dtype=np.uint16) for i in range(n_frames): try: stack[i, :, :] = reader.get_data(i) ...
7bd16f019d480f7648f8a76b3b854681635bda95836f77906a0a0a4ad34c00db
Python
559
20
import os import pandas as pd __all__ = ["write_output"] def write_output(imputed_gwas, output, append=False): """ Write GWAS data to file in tab-delimited format :param imputed_gwas: pandas.DataFrame object containing GWAS data :param output: file-object or path to write file to :param append: ...
c47269329eb8e9ad14108b482320f895ec9470395fa0800d603a82b2d9c6cd6e
Python
559
21
from __future__ import annotations from typing import List import numpy as np from .diversity_filter import DiversityFilter class PenalizeSameSmiles(DiversityFilter): """Penalize previously generated compounds.""" def update_score(self, scores: np.ndarray, smilies: List[str], mask: np.ndarray) -> None: ...
44d02aedc83c3d593949090e8e13c80efcb305b37db026622aec1cbc77fba856
Python
562
19
from infomap import infomap infomapWrapper = infomap.MemInfomap("--two-level --expanded") # from (layer, node) to (layer, node) weight infomapWrapper.addMultiplexLink(2, 1, 1, 2, 1.0) infomapWrapper.addMultiplexLink(1, 2, 2, 1, 1.0) infomapWrapper.addMultiplexLink(3, 2, 2, 3, 1.0) infomapWrapper.run() tree = infoma...
6339dfbb358b6af179d066fc006b0c451fa745060f0f7465995a4871f0b43e50
Python
563
23
__all__ = [ "data", "datasets", "analysis", "cross_validation", "plotting", "stats", "utils", "file_reader", "mask", "prefs", "external", "__version__", ] from .analysis import Roc from .cross_validation import set_cv from .data import Brain_Data, Adjacency, Groupby, Des...
29796597b898e67035df4cd28287b7f25cf1a817ca79ae0c893c8d2f2b8921fd
Python
564
31
__submodules__ = ["core"] # <AUTOGEN_INIT> from snakebids.core import ( BidsComponent, BidsDataset, BidsDatasetDict, bids, filter_list, generate_inputs, get_filtered_ziplist_index, get_wildcard_constraints, print_boilerplate, write_derivative_json, ) __all__ = [ "BidsCompo...
30d8e2246fb21bbcb357cebd437cbecdcba043396f4033c5b77b970532e72364
Python
565
14
import unittest import reinvent.models.linkinvent.model_vocabulary.vocabulary as mv from tests.test_data import CELECOXIB, COCAINE, METAMIZOLE, ASPIRIN, SIMPLE_TOKENS class TestCreateVocabulary(unittest.TestCase): def setUp(self): smiles = [ASPIRIN, METAMIZOLE, COCAINE, CELECOXIB] self.voc = mv.c...
43319a823b8f5e0c86a5aeb5e25cb0e040a921fdbf80e1c69c37995a9055cd65
Python
565
23
import pytest from neurodesign import generate @pytest.mark.parametrize("model", ["uniform", "exponential"]) def test_iti(model): generate.iti(ntrials=20, model=model, min=1, mean=2, max=4, seed=1234) generate.iti(ntrials=40, model=model, min=2, mean=3, max=8, resolution=0.1, seed=2134) @pytest.mark.para...
c6af10fcad7dedd1be39b50a81794a9ce0153b6150e26a9ce0692e7d793d730a
Python
565
27
import pytest @pytest.fixture def tf(): import tensorflow as tf return tf def test_tf_version(tf): major_version = int(tf.__version__.split('.')[0]) assert major_version >= 2 def test_tf_cuda(tf): assert tf.test.is_built_with_cuda() def test_tf_gpu(tf): assert tf.test.is_gpu_availabl...
d7ef9687ecf784ab3d8520c44686d7183f397f753430d0a82a1a0b7946079993
Python
565
13
# Copyright 2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 from importlib import util from openfl.pipelines.kc_pipeline import KCPipeline from openfl.pipelines.no_compression_pipeline import NoCompressionPipeline from openfl.pipelines.random_shift_pipeline import RandomShiftPipeline from openfl.pipelines.skc_...
2bf81465867055c8dcde2bf7e9308dc6a2dbb633d71100d949dfe0009f34ba67
Python
566
27
from Bio import SeqIO import sys import glob import khmer def calc_tetra(seqs): ktable = khmer.new_ktable(4) for seq in seqs: ktable.consume(str(seq.seq)) tetramers = {} for a in ['A', 'C', 'G', 'T']: for b in ['A', 'C', 'G', 'T']: for c in ['A', 'C', 'G', 'T']: for d in ['A', 'C', 'G', 'T']: te...
50a4315373361d41da1cd060f631a0e1d30631e02bbc912ecdf5834ebb7f50a2
Python
566
16
from sklearn import manifold, datasets def manifold_embedding(pos,method='tsne'): n_components = 2 n_neighbors = 100 if method == 'tsne': tsne = manifold.TSNE(n_components=n_components, init='pca', random_state=0) Y = tsne.fit_transform(pos) elif method == 'spectral': se = mani...
c720d5d3388e74fba14af57278e555977796c545b3c2936080ed9300cc062c95
Python
566
20
import torch.nn as nn from model_angelo.gnn.multi_layer_ipa_no_seq import MultiLayerSeparableIPANoSeq class Model(nn.Module): def __init__(self): super().__init__() self.voxel_size = 1.0 self.ipa = MultiLayerSeparableIPANoSeq( 1280, 256, nu...
0160ed828934701d13e13038ad1cd8a3910c890da6aae8bc9fcdd29a7880694b
Python
567
20
"""Auxiliary functions.""" __all__ = ["suppress_output"] from os import devnull import re from contextlib import contextmanager, redirect_stdout, redirect_stderr @contextmanager def suppress_output(): """Context manager to redirect stdout and stderr to /dev/null""" with open(devnull, "w") as nowhere: ...
9b4e5f078bc480fbdbdefa15fba82bcebe2037b5ac5405af89bb2fbde420fdb5
Python
567
16
""" Module containing functions for processing files/directories, loading/saving data and converting to other formats. For converting to '.fif', it supports MNE supported formats to '.fif'. c.f. https://mne.tools/stable/generated/mne.io.read_raw.html For exporting, it supports: - EEGLAB: '.set' """ from .convert...
72eafd57af881fe758a50895135df5ad3549c4356133d68501e026aaf0d87035
Python
571
25
"""The Mol2Mol optimization algorithm""" from __future__ import annotations __all__ = ["Mol2MolLearning"] import logging from typing import TYPE_CHECKING from .learning import Learning from .distance_penalty import score as _score if TYPE_CHECKING: from reinvent.scoring import ScoreResults logger = logging.get...
e199a6d7edd938e42c822f460440d5cdb37a0952c0db254c1dc3842eda760067
Python
572
21
import torch def to_cpu(x: torch.Tensor or torch.cuda.FloatTensor, required_grad=False, use_numpy=True): x_cpu = x if isinstance(x, torch.Tensor): if x.is_cuda: if use_numpy: x_cpu = x.to('cpu').detach().numpy() elif required_grad: x_cpu = x.to(...
fc75080fd36ba8d2dadb284ae6247bb545fef462124ab37357e4dfcded7c96a3
Python
573
20
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. from .node import NodeTypeEmbed from .node_tensor import AppendVectorFieldEmbed from ._edge import ( EdgeLengthNormalizer, BesselEdgeLengthEncoding, SphericalHarmonicEdgeAttrs, AddRadial...
2419afb73d8f17fe6e5e9e502703b589e331f6a45c13bfb87fe014daca82f3b3
Python
575
14
"""Some utility functions for template loading/writing""" def _complete_template_path(target_path: str, source_path: str) -> str: """Check if path contains a folder structure and prepend own path, if it doesn't""" if "." not in target_path: if "/" in source_path or "\\" in source_path: im...
8f40f77e616a78023206778809fc7de79dfe4cee7ea1af355bf7d418d3d01e80
Python
575
21
from .additional_info import AdditionalInfo from .errors_explorer import ErrorsExplorer from .id_groups import IdGroups from .interpolator import Interpolator from .length_calibrator import LengthCalibrator from .mark_metadata import MarkMetadata from .paint_blobs import find_selected_blob, paintBlobs, paintTrails from...
0e6e779d165bd6987fbe1e22d298b31a02cb6cc8537aa008144aff1f673286cd
Python
576
19
# Generated by Django 4.1.1 on 2022-12-01 10:37 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('celsus', '0035_remove_genenamemap_uniprot_record_and_more'), ] operations = [ migrations.AddField( ...
25135e3ccc7dc9892c28d4a30299016cf7f2313ddce3c97d59efdc048e6960b7
Python
576
23
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """openfl.utilities.data package.""" from openfl.utilities.data_splitters.data_splitter import DataSplitter from openfl.utilities.data_splitters.numpy import ( DirichletNumPyDataSplitter, EqualNumPyDataSplitter, LogNormalNumPyD...
4d9996e14d3fb5ecee06fbcef19cb82bdf54a0e28ea32c86bd4af7727838f378
Python
577
24
# -*- coding: utf-8 -*- """ Provides physical and numerical constants. """ MU_WATER = 20 # M^-1 """ Linear attenuation of water in SI unit ``m^-1``. Source: `nist.gov <https://www.nist.gov/pml/x-ray-mass-attenuation-coefficients>`_. """ MU_AIR = 0.02 # M^-1 """ Linear attenuation of air in SI unit ``m^-1``. Source:...
9ccdf4f9e40b3f487058f5a38e3d60abf6d69d03aec298238346a5988f77cf28
Python
578
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="swish") class Swish(nn.SiLU): """ Applies the `Swish (also known as SiLU) <https://arxi...
a04c9e45756523de74ceedeabea3b4e7c799a1b685f2d14c4d6fad1369f060a2
Python
579
19
from geomstats.datasets.prepare_graph_data import HyperbolicEmbedding from geomstats.test.parametrizers import DataBasedParametrizer from geomstats.test_cases.datasets.prepare_graph_data import HyperbolicEmbeddingTestCase from .data.prepare_graph_data import HyperbolicEmbeddingTestData class TestHyperbolicEmbedding(...
c1040b59f309bcd7427beee789ec24e4a4ce3f0fd09ca07183b3dba5a8449333
Python
580
16
from dig.ggraph.evaluation import ConstPropOptEvaluator from rdkit import Chem import shutil def test_ConstPropOptEvaluator(): smile = 'C' mol = Chem.MolFromSmiles(smile) res_dict = {'inp_smiles': smile, 'mols_0':[mol], 'mols_2': [mol], 'mols_4': [mol], 'mols_6': [mol]} evaluator = ConstPropOptEvaluat...
0aaab67b4b3df40cd001b14602f336f5da1e8d8eeb3a6c0429b122152d641085
Python
581
16
# -*- coding: utf-8 -*- from .reconstructor import (Reconstructor, IterativeReconstructor, StandardIterativeReconstructor, LearnedReconstructor, FunctionReconstructor) __all__ = ['Reconstructor', 'IterativeReconstructor', 'S...
23e2a73f867a40e9382d6b684911f0dbd3a17722535d1dccbc50d872422ad42c
Python
581
23
import experiment as exp class ActionsExperiment(exp.Experiment): def setup(self): self.update_actions(None, False) exp.session_state.add_callback("is_running", self.update_actions) def update_actions(self, _, new): if new: self.actions = { "Stop": {"run": ...
62fa0cac61be9d0099746ef4016bacc7fe55ffb8fd240d2dace7f4eec9f85494
Python
581
19
import shutil import config from learning.utils import get_checkpoint res_path = config.results / 'model_evaluation' for res_folder in res_path.iterdir(): prediction_folder = res_folder / 'test_predictions' if prediction_folder.exists(): print(prediction_folder) shutil.rmtree(prediction_folde...
aa2e602f0b73cbed1f8f871c5ec3bf2294ac3ae2194f24cb0933f59322052ec8
Python
581
24
import logging # Use logging.DEBUG to log every message passed through the bridge. log_level = logging.INFO # Path of the arena configuration file. arena_config_path = "../system/config/arena_config.json" # Serial communication settings serial = { # Serial port baud rate. Do not change unless you really want to....
b5e45be997f046c7f0074723f7c4fe691e163f7d2b0940028b09a1d3c4d74350
Python
581
22
from . import solve_scipy from . import solve_petsc # uses petsc if available. Can set default solve by modifying this. default_solve = (solve_petsc.solve if solve_petsc.HAS_PETSC else solve_scipy.solve) def solve(*args, **kwargs): # py2 compatible version of kw-only ...
453174dbfbfbeabe768176552ff1f4c434991cbf83030e5d8dd75673d3b106aa
Python
583
20
from ._base import BaseEstimatorTestData class WrappedGaussianProcessTestData(BaseEstimatorTestData): MIN_RANDOM = 10 MAX_RANDOM = 20 tolerances = {"predict_at_train_zero_std": {"atol": 1e-4}} def score_at_train_is_one_test_data(self): return self.generate_random_data() def predict_at_t...
eb87d8b058c0d1090e334531a2c40a60d2d0e0f74a34ebbe9f78a538559c8ee4
Python
584
32
import geomstats.backend as gs if gs.__name__.endswith("pytorch"): import torch def gpu_is_available(): return torch.cuda.is_available() def to_device(array, device="cuda"): # TODO: check autodiff return array.to(device) def get_device(array): return array.device ...
64fe5636509a0d7a50453ee1f55a6094cf9c775c0396dce217627907f8cfb13f
Python
585
31
# --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: percent # format_version: '1.3' # jupytext_version: 1.18.1 # kernelspec: # display_name: Python 3 (ipykernel) # language: python # name: python3 # --- # %% [markdown] # # Maize workflow visua...
ad84846bef69a2e82627565aefe69f55c6c3567f85d23654799084decabd4343
Python
588
23
# Generated by Django 4.1.1 on 2023-01-07 14:24 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('celsus', '0049_extraproperties_curtain_post'), ] operations = [ migrations.AlterField( model_name='differentialanalysisdata', ...
d522409cd87157ffcb85cd883eb885af68a4fc4506d0c0cd1997fca1759b9f8b
Python
589
16
from .environment import check_chemical_validity, check_valency, calculate_min_plogp, reward_target_molecule_similarity, qed from .environment import convert_radical_electrons_to_hydrogens, steric_strain_filter, zinc_molecule_filter from .gen_mol_from_one_shot_tensor import gen_mol_from_one_shot_tensor __all__ = [ ...
17ddc66473863aec919f4d6f6be2d39c8c4ea8af9953da6a86c4a0905c7d2275
Python
590
31
#constants # to go from 3 letter amino acid code to one letter amino acid code AA3_TO_AA1 = { "CYS": "C", "ASP": "D", "SER": "S", "GLN": "Q", "LYS": "K", "ILE": "I", "PRO": "P", "THR": "T", "PHE": "F", "ASN": "N", "GLY": "G", "HIS": "H", "LEU": "L", "ARG": "R", ...
a5c30a7aef7ecfdc9e65e1311776154bb663ef1250fe72026dfed80814baaefd
Python
590
27
import os project = "IVAC" author = "Chatipat Lorpaiboon" year = "2020" copyright = "{}, {}".format(year, author) version = release = "0.0.0" extensions = [ "sphinx.ext.autodoc", "sphinx.ext.mathjax", "sphinx.ext.napoleon", "sphinx.ext.viewcode", ] master_doc = "index" on_rtd = os.environ.get("READT...
f7f694b370277c4bbfe2d8ea60eae9f9da09fd40ddc1f47e63fa3a09c9701f60
Python
590
21
import numpy as np import tensorflow as tf """ Disclaimer: the weight_variable_glorot function from this file comes from the tkipf/gae original repository on Graph Autoencoders """ def weight_variable_glorot(input_dim, output_dim, name = ""): """ Creates a weight variable with Glorot and Bengio's initializ...
ce2e9feb166157ec7bf41bd69fd69a1c589ce53abda3bd1e4fb9587be9065147
Python
591
19
import re from collections import OrderedDict from torch_geometric import __version__ def compatible_state_dict(state_dict): comp_state_dict = OrderedDict() for key, value in state_dict.items(): comp_key = key comp_value = value if int(__version__[0]) >= 2: comp_key = re.s...
2d46e930bfecae18c3219803b0a4460068cc72a0948e396eef322f7fdeac3a97
Python
592
20
import torch.nn as nn from reinvent.models.transformer.core.network.encode_decode.clones import clones from reinvent.models.transformer.core.network.encode_decode.layer_norm import LayerNorm class Decoder(nn.Module): "Generic N layer decoder with masking." def __init__(self, layer, N): super(Decoder...
caaabe637284a889d66b04a35800760cf735c2f63ab4f806185fdd0bcf0f575b
Python
593
18
import unittest from numpy import testing from reinvent.chemistry import conversions from reinvent.chemistry.similarity import calculate_tanimoto from tests.chemistry.fixtures.test_data import ASPIRIN, CELECOXIB class Test_similarity(unittest.TestCase): def setUp(self): self.aspirin_fp = conversions.smi...
a22d0357f3d7887db16ff0cb48516c6d43657084f66c84896ea032480ac23173
Python
594
24
# Import libraries from configparser import ConfigParser def config_db(filename, section='postgresql'): """ config to connect to PostgreSQL server chemosimdb. """ parser = ConfigParser() parser.read(filename) res = {} if parser.has_section(section): params = parser.items(section) ...
dce0a48084f16c55daae283e700abd2a0872879ebf43b61b64954e334d8631f2
Python
594
24
"""Config Validation""" from typing import Optional from pydantic import Field from reinvent.validation import GlobalConfig class SectionParameters(GlobalConfig): smiles_file: str output_csv: str = "score_results.csv" smiles_column: str = "SMILES" standardize_smiles: bool = True class SectionRespo...
1b1d7bd595fa857fcb7fffe8c0fcac823caa5fb9e93556028403f736cd9a6b22
Python
595
21
# Generated by Django 4.1.5 on 2023-02-17 11:54 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('celsus', '0053_alter_collaborator_project_alter_curtain_project_and_more'), ] operations = [ migrations.CreateModel( name='DataF...
4adae68314ee64301d7dd3a1b7b0ab76639f76480e6d08c86fc85569ba70fe34
Python
595
23
# ------------------------------------------------------------------------------ # Copyright (c) Microsoft # Licensed under the MIT License. # Written by Bin Xiao (Bin.Xiao@microsoft.com) # ------------------------------------------------------------------------------ from __future__ import absolute_import from __futu...
2938ce307e395d02cc9fcfca59eb0e4453ae768139ac73288e08ede80039c284
Python
596
19
# 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. import torch.nn.functional as F def unfold1d(x, kernel_size, padding_l, pad_value=0): """unfold T x B x C to T x B x C x K""" if ker...
c13a3ded54411b8badd36cbe946a9ffff3d9d5ced5774df5ad66df347aa29709
Python
596
25
# Generated by Django 2.1 on 2018-08-28 00:26 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('tcgalist', '0001_initial'), ] operations = [ migrations.AddField( model_name='tcgapatient', name='num', fi...
d08fe13acc84359b200dff47937e58a2beaa036bd157da6e3832c7f11aa6bbea
Python
596
24
import math from .scaffold_penalty import ScaffoldPenalty class SigmoidPenalty(ScaffoldPenalty): """Penalize extrinsic reward using sigmoid function.""" def calculate_penalty(self, scaffold: str) -> float: bucket_size = self.scaffold_memory.max_size n_scaffold_instances = self.scaffold_memo...
14c858a95564f63903f63d50b0158c30c68daad59581dcc06a19f0821f5633d0
Python
597
26
# os import os import sys from pathlib import Path # sci import numpy as np # ephys import neo sys.path.append('/home/georg/code/SSSort') import sssio # plotting import matplotlib.pyplot as plt if __name__ == '__main__': path = Path(sys.argv[1]) print("dumping %s" % path.stem) seg = sssio.smr2seg(path...
c2b42a68d50e726ee617d0668e669dc1dd0e368e4ed232dc4185be507ef2aa80
Python
598
15
import pytest from geomstats.geometry.hypersphere import Hypersphere from geomstats.geometry.sasaki_metric import SasakiMetric, TangentBundle from geomstats.test.parametrizers import DataBasedParametrizer from geomstats.test_cases.geometry.sasaki_metric import SasakiMetricTestCase from .data.sasaki_metric import Sasa...
92ea82d7b8d759c8b77c58f6f5d8eadbc11084a7db7e7db642c33ce1e7d9d567
Python
601
20
import torch import torch.distributed as dist class GatherLayer(torch.autograd.Function): """Gather tensors from all process, supporting backward propagation.""" @staticmethod def forward(ctx, input): ctx.save_for_backward(input) output = [torch.zeros_like(input) for _ in range(dist.get_w...
14bdd790f2145e0aef0a5757ca42e61359fabbd679f3448b641a980be526bd4f
Python
602
24
# type: ignore try: from snakemake.cli import get_argument_parser, main from snakemake.common import configfile from snakemake.common.configfile import load_configfile except ImportError: import snakemake.io as configfile from snakemake import get_argument_parser, main from snakemake.io import ...
0c46513fe3934dc16d13071de5fbc05ce7036cd29688f70c1ac50fbc42fd0ab6
Python
603
19
import os import pytest from chromadb.utils.embedding_functions.voyageai_embedding_function import ( VoyageAIEmbeddingFunction, ) voyageai = pytest.importorskip("voyageai", reason="voyageai not installed") def test_with_embedding_dimensions() -> None: if os.environ.get("CHROMA_VOYAGE_API_KEY") is None: ...
ab9e1bf4c2ea951b41b20a67f969c15f6479b8728ce2a3367e3e1dd67097da59
Python
603
22
import pandas as pd def cal_error_frame_ratio(input_csv_path): # read csv data = pd.read_csv(input_csv_path) if len(data) == 0: # empty case error_frame_ratio = 1 elif data['timestamp'].values[-1] != (len(data) - 1): # file time length / expected timestamp error_frame_ratio...
02a7684845a81cf79d5716a7067e4101d70e0049b57f0cbc0c2cc42d79c159c3
Python
604
13
from geomstats.geometry.hypersphere import Hypersphere from geomstats.geometry.special_orthogonal import SpecialOrthogonal from geomstats.test.parametrizers import DataBasedParametrizer from geomstats.test_cases.geometry.diffeo import AutodiffDiffeoTestCase, CircleSO2Diffeo from .data.diffeo import AutodiffDiffeoTestD...
4d86786451e2291dc2d3d810fc07070bc87ad3eed4809506b55b90bcb3418130
Python
604
22
# Generated by Django 4.1.1 on 2022-10-20 09:11 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('celsus', '0010_alter_rawdata_value'), ] operations = [ migrations.AddField( model_name='author'...
ab4cf1aab525a1f11192ce784f51d67e1ccf748dab9a67b09c045950fed19f31
Python
604
21
from ._base import BaseEstimatorTestData class TangentPCATestData(BaseEstimatorTestData): MIN_RANDOM = 5 MAX_RANDOM = 10 def fit_inverse_transform_test_data(self): return self.generate_random_data() def fit_transform_and_transform_after_fit_test_data(self): return self.generate_rando...
8f4f11a3ce76581ecf9de450f2bedea63980249cfb1fe77dc27cdac334775f31
Python
605
27
r""" This module includes 8 GOOD datasets. - Graph prediction datasets: GOOD-HIV, GOOD-PCBA, GOOD-ZINC, GOOD-CMNIST, GOOD-Motif. - Node prediction datasets: GOOD-Cora, GOOD-Arxiv, GOOD-CBAS. """ from .good_hiv import GOODHIV from .good_arxiv import GOODArxiv from .good_pcba import GOODPCBA from .good_cmnist import GO...
3b910e5d3fa46bdaa103c0378569b010acfde5dd22ca39cf2b282ba21bcb22a4
Python
606
23
from geomstats.test.data import TestData from .quotient import AlignerAlgorithmCmpTestData class GraphAlignerCmpTestData(AlignerAlgorithmCmpTestData): N_RANDOM_POINTS = [1, 2] trials = 5 class PointToGeodesicAlignerTestData(TestData): fail_for_not_implemented_errors = False tolerances = {"dist_alo...
87c1399a8cfa1331717291f0f3ea0771fed4e7976f968b517e402c2840845545
Python
608
17
import numpy as np from chromadb.api import ClientAPI def test_invalid_update(client: ClientAPI) -> None: client.reset() collection = client.create_collection("test") # Update is invalid because ID does not exist collection.update(ids=["foo"], embeddings=[[0.0, 0.0, 0.0]]) collection.add(ids=["...
ccf80802fa782393ae4908277b38411bcea4e1f89e2f4bd23bca0f26a51d22c4
Python
608
25
import os import random import numpy as np import torch def set_random_seed(SEED): torch.manual_seed(SEED) torch.cuda.manual_seed_all(SEED) random.seed(SEED) np.random.seed(SEED) def setup(opt): if opt.random_seed is not None: set_random_seed(opt.random_seed) os.environ["CUDA_VISIBL...
3e04071a497d083193d81a86c393be3cc3a80b1d262c710955c1b2fa5484cf9e
Python
609
20
import torch.nn as nn from reinvent.models.transformer.core.network.encode_decode.clones import clones from reinvent.models.transformer.core.network.encode_decode.layer_norm import LayerNorm class Encoder(nn.Module): "Core encoder is a stack of N layers" def __init__(self, layer, N): super(Encoder, ...
9e40a044d85a04a752ad7c1121059a80298e0a817c42bd107cdc62529b8fe109
Python
609
13
# Copyright (c) 2021 PaddlePaddle 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 appli...
a54be9b6f7cf729452d0a2da4d8a875d2d95f16d4ac33a4e7a7f38ef38d46c2b
Python
609
10
from sleepy.processing.algorithms.massimi import Massimi #rom sleepy.processing.algorithms.core import Algorithm #from sleepy.processing.algorithms.parameter import Parameter from sleepy.processing.algorithms.walkthrough.walkthrough import Walkthrough from sleepy.processing.algorithms.relative.relative import Rel...
875c2dc6c0fdbd6bb7d4fe4729a4f50b9f2ced68f95efb276ab1aa468e9a96b3
Python
610
19
import uuid import pytest from chromadb.api import ServerAPI from chromadb.config import DEFAULT_TENANT def test_delete_database_requires_rbac_permission( api_with_authn_rbac_authz: ServerAPI, ) -> None: database_name = f"db_{uuid.uuid4().hex}" api_with_authn_rbac_authz.create_database(database_name, te...
c9a59224392232d56f358f8d1c8afd21d2f6b3063a307a07b59dd484b64f7d74
Python
610
15
# -*- coding: utf-8 -*- import numpy as np import functions.manifold #%% Load data data = np.load('C:/Users/Ole/Documents/script/Analysis/Data/tst_pfc_March23.npy', allow_pickle=True).item() res_day1, order_day1, shuff1 = manifold.manifolds(data, 'day1', 'struggle_time', 'immobility_time') #%% Get vector f...
f386d4c47668edba4d361acb25b9e712a7bb183b88af4682613728a67ff91dc1
Python
610
13
# Copyright (c) 2022 PaddlePaddle 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 appli...
78a1af397093dd9745df059b9ae1ee650199bfae06e9c89408f239df68dbb592
Python
611
26
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # import argparse from typing import Dict class BaseTransformation(object): """ Base class for augmentation methods """ def __init__(self, opts, *args, **kwargs) -> None: self.opts = opts ...
032300c763a8e067163a424d33a7196b71fa8360c997edc057ab611cbf734360
Python
612
18
# Generated by Django 4.1.1 on 2022-11-08 15:50 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('celsus', '0023_project_ptm_data'), ] operations = [ migrations.AlterField( model_name='differentialsamplecolumn', na...
9ee269cdc6c91d9503514e7976752a047612298c74ea058350d9588cb12f5b43
Python
612
13
# Copyright (c) 2020 PaddlePaddle 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 app...
fb507cf5e242808427d645d89287d48a37f08adc22e36c4da9802e167392ce3e
Python
612
13
# Copyright (c) 2021 PaddlePaddle 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 app...
95f3d1205ac51ac10886f7a6c584a87e4490c465872341ace41ad896a27705ce
Python
614
14
REACTION_SUZUKI = "[*;$(c2aaaaa2),$(c2aaaa2):1]-!@[*;$(c2aaaaa2),$(c2aaaa2):2]>>[*:1][*].[*:2][*]" SCAFFOLD_SUZUKI = "[*]c1ccc2c(c1)cc(cc2)OC" DECORATION_SUZUKI = "[*]c1ncncc1" TWO_DECORATIONS_SUZUKI = "[*]c1ncncc1|[*]c1ncncc1" TWO_DECORATIONS_AFTER_SUZUKI = "c1ncncc1c2ncncc2" TWO_DECORATIONS_ONE_SUZUKI = "[*]c1ncncc1|...
f45926476db37b20de9ae111c1d1227bdd69b082dcf19ab315215ad7f8d7f2cc
Python
615
25
from geomstats.test.test_case import np_backend from ._base import BaseEstimatorTestData, MeanEstimatorMixinsTestData IS_NOT_NP = not np_backend() class AACFrechetMeanTestData(MeanEstimatorMixinsTestData, BaseEstimatorTestData): pass class AACGGPCATestData(BaseEstimatorTestData): trials = 5 tolerance...
564c8227ddc8d94f80ef5bf44a4961f6e0917acf54b2b21196d93b221e1aa285
Python
619
24
import numpy as np from nltools.data import Brain_Data def test_length(sim_groupby): assert len(sim_groupby) == len(sim_groupby.mask) def test_index(sim_groupby): assert isinstance(sim_groupby[1], Brain_Data) def test_apply(sim_groupby): mn = sim_groupby.apply("mean") assert len(sim_groupby) == le...
bc55418efe752dac227ff665291d2dfb919aa7cb650c221bb740f7f20cd82440
Python
619
24
from __future__ import annotations from pathlib import Path from typing import TYPE_CHECKING, TypedDict from typing_extensions import TypeAlias if TYPE_CHECKING: from argparse import _ArgumentGroup __all__ = ["ArgumentGroups", "SnakebidsConfig"] ArgumentGroups: TypeAlias = "dict[str, _ArgumentGroup]" class S...
eabf81743af8027d10c42c51be1e7a3250ad6961960f7ff18be3b442f5449382
Python
619
27
"""Get SMILES tokens from a SMILES file or CSV""" import os import sys import polars as pl from reinvent.datapipeline.filters.regex import SMILES_TOKENS_REGEX fn = sys.argv[1] ext = os.path.splitext(fn)[1] if ext == ".smi": df = pl.read_csv(fn, has_header=False, new_columns=["canonical_smiles"]) else: df ...
b0c2b2ac0d67ea34349d0130eb3b11a26797df7878c7517ceacf5ecec60a419c
Python
620
19
import torch.nn as nn from reinvent.models.transformer.core.network.encode_decode.layer_norm import LayerNorm class SublayerConnection(nn.Module): """ A residual connection followed by a layer norm. Note for code simplicity the norm is first as opposed to last. """ def __init__(self, size, dropo...
f5d75e33a793339a95840cfc03514b4b761b600517fc0a78d783c4c69c162943
Python
620
18
import matplotlib as mpl page_width = 180 # in mm SMALLEST_SIZE = 4 SMALL_SIZE = 5 MEDIUM_SIZE = 6 mpl.rc('font', size=SMALL_SIZE) # controls default text sizes mpl.rc('axes', titlesize=MEDIUM_SIZE) # fontsize of the axes title mpl.rc('axes', labelsize=SMALL_SIZE) # fontsize of the x and y labels mp...
0713374689ad3b5f992b9d2458c68d2415204ee96011835c602ed868313bda00
Python
622
22
import os def get_directory_size(directory: str) -> int: """ Calculate the total size of the directory by walking through each file. Parameters: directory (str): The path of the directory for which to calculate the size. Returns: total_size (int): The total size of the directory in bytes. ...
091e0b517a0c555fb366ed0c86c45f9734e4bc9793c500da4492420c0103053a
Python
622
19
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. import torch from nequip.data import AtomicDataDict class DatasetIndexTransform(torch.nn.Module): """Add a dataset index to ``AtomicDataDict``.""" def __init__(self, dataset_index: int): ...
318696cb77be0f1b6bd329bf02cc302b60fd18d0fd2f60068aecede346ec6266
Python
623
26
#!/usr/bin/env python import numpy as np import csv diffs = [] labels = np.empty((0,6), dtype=float) with open('stats.txt') as csv_file: csv_reader = csv.reader(csv_file, delimiter=',') line_count = 1 for row in csv_reader: diff = float(row[1]) - float(row[3]) diffs.append(diff) ...
b17c4dc711b94886e9fbb8dd396744fd51b38143061092c2dbd11caf074612fb
Python
623
21
"""Optional PUMAS transforms and aggregations""" __all__ = ["aggregation_catalogue", "desirability_catalogue", "check_pumas_available"] try: from pumas.aggregation import aggregation_catalogue from pumas.desirability import desirability_catalogue have_pumas = True except ModuleNotFoundError: aggregat...
f54fc8bcdabb7e599e7b672f1621536f36bedff6d4b5cbce26c34458f3e50383
Python
623
17
from geomstats.test.data import TestData from .manifold import _ManifoldMixinsTestData class ComplexManifoldTestData(_ManifoldMixinsTestData, TestData): def random_point_is_complex_test_data(self): return self.generate_random_data() def random_point_imaginary_nonzero_test_data(self): return ...
df2fd496df63d0c2b339939e4bb453e19cd96e1a186740a251bb66aef09bd0b7
Python
626
24
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # import torch from torch import nn, Tensor from typing import Tuple, Union, Any class BaseModule(nn.Module): """Base class for all modules""" def __init__(self, *args, **kwargs): super(BaseModule, ...
7b7a9dff6a0cd8215cedb668199b099a4df01cecc5c3a107de9c68d43bff3948
Python
627
24
import schedule as sc import experiment as exp import datetime as dt class SchedulingExperiment(exp.Experiment): def setup(self): self.cancel_tick = None self.cancel_next_block = None def run(self): self.cancel_tick = sc.repeat(self.tick, interval=2, repeats=True) def end(self...
4374681f06eae1b6c483df05635845a772e06bb61967bde350a2ed6af691f76b
Python
628
24
from infomap import infomap infomapWrapper = infomap.Infomap("--two-level") # Set the start index for bipartite nodes infomapWrapper.setBipartiteNodesFrom(5) # Add weight as an optional third argument infomapWrapper.addLink(5, 0) infomapWrapper.addLink(5, 1) infomapWrapper.addLink(5, 2) infomapWrapper.addLink(6, 2) i...
d267afd2b7564b19ef202c5124da123a0c38b88460aeacf8279e2d6af6b791ab
Python
629
24
from video_stream import ImageObserver import numpy as np class TestObeserver(ImageObserver): """An image observer that does nothing except output random integers on each image update.""" def _on_start(self): self.log.info("on_start") def _on_image_update(self, img, timestamp): self._upd...
88b077f9398e8bf59c83ae30bd19333e5e1f54a2f14317bca9104651a949496f
Python
630
16
__all__ = ["get_pair_generator"] from reinvent.models.transformer.mol2mol.dataset import preprocessing def get_pair_generator(pair_generator_name: str, *args, **kwargs) -> preprocessing.PairGenerator: """Returns a PairGenerator object. :param pair_generator_name: name to retrieve the PairGenerator object. ...
2607962e18f53678cd116eaf0a9953deb6f03d5cb96e4a6f505a00e42450f0af
Python
634
20
"""The committed input structures and the tiny training set.""" from __future__ import annotations from tests.golden.paths import REPO_ROOT ORDER = 10 HELP = "the committed .xyz structures and their manifest" def run() -> None: # Imported here, not at module scope: the targets package is imported to # buil...
ef4646aa39dca6c003d1e64d35a646bd0e49b8e6212e9450e0d6fa0b008438bf
Python
634
15
# Copyright (c) 2019 PaddlePaddle 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 app...
ce30d032a517103ccc8f4619d7eecf7efe879c0ed548c01fc12b526047ba3ac6
Python
636
25
"""Static registry of supported MNI templates.""" from typing import Literal TemplateName = Literal["default", "nilearn", "fmriprep"] """Which MNI template a brain space is built from.""" Resolution = Literal[1, 2, 3] """Voxel size of a template, in millimetres.""" VERSION_MAP: dict[str, str] = { "default": "fs...
33198f77d1f4adb0805eb13e2f2a26ab668fc22dda6b8a5fcf7eea306e8a5f0e
Python
637
26
"""Element handling""" from typing import Sequence from rdkit import Chem BASE_ELEMENTS = {"C", "O", "N", "S", "F", "Cl", "Br", "I"} _PT = Chem.GetPeriodicTable() PERIODIC_TABLE = { elem: _PT.GetAtomicWeight(elem) for elem in [_PT.GetElementSymbol(an) for an in range(1, 119)] } def valid_elements(elements: Se...
68602e408fc47fdc1c220908f28e833f8a655d3f8a627d1798cb916e76e394a9
Python
639
23
# Generated by Django 4.1.1 on 2022-10-24 09:40 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('celsus', '0015_remove_file_comparison_comparison_file'), ] operations = [ migrations.RemoveField( ...
efe7fa1556e1a9e29702601a8749367242703b3a4334ef966969f9c1a5dd8307
Python
639
26
"""SMILES deduplication""" __all__ = ["inchi_key_deduplicator"] from typing import Sequence from rdkit.Chem import MolToInchiKey, Mol def inchi_key_deduplicator(mols: Sequence[Mol], smilies: Sequence[str]) -> list[str]: """Deduplicate using the InchiKey :param mols: RDKit molecules :param smilies: SMIL...
453d0b3e2b187b2ef3c1e1c08d5d8068ebf10fe385f82a74fc2bce992dd373b1
Python
640
16
import sys sys.path.append(' /home/kusch/Documents/project/co_simulation/TVB-NEST-proof/lib/soft/lib/python3.8/site-packages/') from neurolib.models.hopf import HopfModel from neurolib.utils.loadData import Dataset import matplotlib.pyplot as plt ds = Dataset("gw") model = HopfModel(Cmat = ds.Cmat, Dmat = ds.Dmat) mod...
1e8822d6166fecca1ec6e23fc863942e1b29030c104770be20f17c48cd24a831
Python
641
23
from ._base import BaseEstimatorTestData, ClusterMixinsTestData class ClusterInitializationTestData(BaseEstimatorTestData): MIN_RANDOM = 5 MAX_RANDOM = 10 def initialization_belongs_test_data(self): return self.generate_random_data() class RiemannianKMeansTestData(ClusterMixinsTestData, BaseEst...
05b4fbd3929aeeaa3815c8ea315bfd3780defedc73cb851868fe99ca57cf294f
Python
643
24
from .manifold import ManifoldTestData from .riemannian_metric import RiemannianMetricTestData class ProductManifoldTestData(ManifoldTestData): skips = ("not_belongs",) def embed_to_product_after_project_from_product_test_data(self): return self.generate_random_data() class ProductRiemannianMetricT...
6c93aa2da0a0b89c54c6cb6e7c176711b0482050b654792a79db7863e237f65f
Python
643
23
# Generated by Django 4.1.1 on 2022-10-21 10:44 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('celsus', '0014_remove_comparison_file_file_comparison'), ] operations = [ migrations.RemoveField( ...
9a30742a6d068f3b12a08f539a639cd06132f2be729acfea520ef01337c65654
Python
643
20
import pytest from geomstats.test_cases.learning._base import BaseEstimatorTestCase class LinearRegressionTestCase(BaseEstimatorTestCase): @pytest.mark.random def test_runs(self, n_samples): X = self.data_generator.random_point(n_points=n_samples) y = self.data_generator.random_image_point(n_...