sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
818d0afbe3da240260d32585f3550d92071a855174d1f4c1f15184aa66fe5f60 | Python | 2,362 | 83 | # 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
#
# Unle... |
47d66634103e8f62ea4b007fbf97148acce5967e4e11ee6198b34ca2724183cd | Python | 2,363 | 61 | # 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... |
6ca31f30dc8775120660181ecc66264cb14886faf3385f1751144820dc885be7 | Python | 2,363 | 79 | #
# For licensing see accompanying LICENSE file.
# Copyright (C) 2022 Apple Inc. All Rights Reserved.
#
import torch
import os
from typing import Optional
from utils import logger
def load_pretrained_model(
model: torch.nn.Module,
wt_loc: str,
is_master_node: Optional[bool] = False,
*args,
**kwa... |
adb58ef27eb4c906a1d6f1173fdd16c77410a8d079810cae51fe9a0aff2215c7 | Python | 2,364 | 64 | import unittest
import pytest
import torch
import torch.utils.data as tud
from reinvent.models import TransformerAdapter, Mol2MolModel
from reinvent.models.transformer.core.dataset.dataset import Dataset
from reinvent.models.transformer.core.enums.sampling_mode_enum import SamplingModesEnum
from reinvent.models.trans... |
b749ca8db4973067c3ce00c3dbf58c59236486b8f0a6fefd82eb717a56e4bfef | Python | 2,364 | 64 | import pytest
import unittest
import torch
import torch.utils.data as tud
from reinvent.models.transformer.core.dataset.dataset import Dataset
from reinvent.models.transformer.core.enums.sampling_mode_enum import SamplingModesEnum
from reinvent.models.transformer.core.vocabulary import SMILESTokenizer
from reinvent.r... |
e11f96a8aefa5c525f1d79b277276526cef3619324fa13d3292a66e77d5740aa | Python | 2,364 | 66 | # 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... |
e0ee8234c269e09528dba0b4e7b023cd557fd0e715a25603c246934e7c7bcf5d | Python | 2,365 | 48 | import anndata
import numpy as np
import pandas as pd
from scipy import sparse
def gem2h5ad(gem_path, binSize=50, Cellbin=True):
'''
transform a gem pd.DataFrame to a anndata object
if Cellbin (default = True) is True and 'CellID' in gem, generate gem by Cellbin, otherwise use binSize
'''
... |
47ace8c21c1f564352702c1f56ddc7cec3ecfc63cbb2684c93d4f3e5d58bdf72 | Python | 2,367 | 68 | import unittest
import numpy as np
from numpy.testing import assert_almost_equal
from reinvent.models.linkinvent.model_vocabulary import ModelVocabulary
from reinvent.models.linkinvent.model_vocabulary.vocabulary import (
SMILESTokenizer,
create_vocabulary,
)
from tests.test_data import (
CELECOXIB,
C... |
6a79134ebd887d1522432025798c4054510aa7038acfc81d53347221b8142203 | Python | 2,367 | 64 | from nequip.data import AtomicDataDict
from nequip.data.datamodule import ASEDataModule
from nequip.utils.file_utils import download_url
from nequip.utils.logger import RankedLogger
import os
from typing import Union, Sequence, List, Callable
logger = RankedLogger(__name__, rank_zero_only=True)
_URL_WATER = "https:... |
0686a635510ae71a6aacefc025dc24fdafa28e3cb60d81e75901d4409b29fcbe | Python | 2,368 | 75 | from ...test_geometry.data.base import VectorSpaceOpenSetTestData
from ...test_geometry.data.poincare_half_space import PoincareHalfSpaceTestData
from ...test_geometry.data.product_manifold import (
ProductManifoldTestData,
ProductRiemannianMetricTestData,
)
from ...test_geometry.data.pullback_metric import Pul... |
50381fa4ac32cdc79fbb6474301d1660065045d01d1708f251595aa0464aad39 | Python | 2,369 | 68 | """
Calculate the timing of each wave.
"""
import numpy as np
import matplotlib.pyplot as plt
import argparse
import pandas as pd
from utils.io_utils import load_neo, save_plot
from utils.parse import none_or_str
CLI = argparse.ArgumentParser()
CLI.add_argument("--data", nargs='?', type=str, required=True,
... |
d291cfb12f58e4ddc5b78ddca387e4a6a2762f5b377b35089dc81606b45766ae | Python | 2,369 | 61 | import torch
import numpy as np
from torch_geometric.data import Data
from dig.xgraph.dataset import MarginalSubgraphDataset
def graph_build_zero_filling(X, edge_index, node_mask: torch.Tensor):
""" subgraph building through masking the unselected nodes with zero features """
ret_x = X * node_mask.unsqueeze(1... |
bbf4ac8330eb4f5be12bcc85f72c4ec92928b789657acdf86bf655e2cf1bf89e | Python | 2,371 | 68 | # 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 appli... |
b7e064a7eb851d7118186cdeee7011496c09eb46d37f6ce3b16db7b8afb900b8 | Python | 2,372 | 75 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# ------------------------------------
# file: zca.py
# date: Thu May 21 15:47 2015
# author:
# Maarten Versteegh
# github.com/mwv
# maartenversteegh AT gmail DOT com
#
# Licensed under GPLv3
# ------------------------------------
"""zca: ZCA whitening with a sklearn-like inte... |
ec6d2518ea4e81b070ec287120b5bad987bf2789b8a8736a3961f9f82e99814a | Python | 2,372 | 71 | import sys
import subprocess
import os
import tempfile
from types import ModuleType
from typing import Dict, List
base_install_dir = (
tempfile.gettempdir()
+ f"/worker-{os.environ.get('PYTEST_XDIST_WORKER', 'unknown')}"
+ "/persistence_test_chromadb_versions"
)
def get_path_to_version_install(version: s... |
fbcbbe960e43f10faa2d7594c3676d196bdb2aa102ccf2792143011ef4f6bf3c | Python | 2,373 | 68 | import geomstats.backend as gs
from geomstats.test.data import TestData
from ...test_geometry.data.base import VectorSpaceOpenSetTestData
from ...test_geometry.data.riemannian_metric import RiemannianMetricTestData
from .base import InformationManifoldMixinTestData
class GeometricDistributionsTestData(
Informati... |
53eabdb428c556c6dbc71f5c091536ae4f839e3a5110a0c8353f3e86d600fcd7 | Python | 2,374 | 64 | # Copyright 2020-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
import logging
from tests.end_to_end.utils.tr_common_fixtures import (
fx_federation_tr,
fx_federation_tr_dws,
)
from tests.end_to_end.utils import federation_helper as fed_helper
log = logging.getLogger(__name__)
# ... |
59f53181a1b018467edc59c244d13409a3d8f7863ec52c45cc41b54845e0779a | Python | 2,374 | 81 | import geomstats.backend as gs
from geomstats.test.data import TestData
from ...test_geometry.data.base import VectorSpaceOpenSetTestData
from ...test_geometry.data.riemannian_metric import RiemannianMetricTestData
from .base import InformationManifoldMixinTestData
class BinomialDistributionsTestData(
Informatio... |
b626a5015e1867fdc0b17facbe1704df48d3bfb7c07650ca0d057cb1a349b0f6 | Python | 2,374 | 37 | #*----------------------------------------------------------------------------*
#* Copyright (C) 2024 ETH Zurich, Switzerland *
#* SPDX-License-Identifier: Apache-2.0 *
#* *
... |
f78f41dab34b13559e2696dd842dc960869f22bb97f850f784ad2e8fca53481e | Python | 2,374 | 77 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""RandomShiftPipeline module."""
import numpy as np
from openfl.pipelines.pipeline import Float32NumpyArrayToBytes, TransformationPipeline, Transformer
class RandomShiftTransformer(Transformer):
"""Random Shift Transformer class.""... |
165d5d89ee1f83792dfd16e72ee1bfa660dc57a5f6a864fb82871c79cb61870d | Python | 2,376 | 82 | """Group count
Allow groups of atoms defined by SMARTS only a certain number of times in a
molecules.
"""
from __future__ import annotations
__all__ = ["MatchingSubstructure"]
from typing import List
from rdkit import Chem
import numpy as np
from pydantic.dataclasses import dataclass
from ..component_results impo... |
777c44c514c8617b8158b5d8b4fd4edcb2929594f33b495f49be703fd094d675 | Python | 2,376 | 59 | """Immutable metadata describing a loaded recording file."""
from __future__ import annotations
from dataclasses import dataclass, field, fields
from typing import Any
@dataclass(frozen=True, slots=True)
class FileMetadata:
"""File-derived acquisition facts shared by loaders and consumers.
Attributes:
... |
ce12272e2e150f4fd171de93be68870601ddb988221b6cf4e5120bc3dbdbc7ff | Python | 2,379 | 87 |
# open the file and close file each iteration, clanky, but had some system file issues with keeping file open.
import esm
import pickle
import numpy as np
import importlib
import pandas as pd
import time
import sys
import torch
models_dir = 'models'
device = 'cuda' if torch.cuda.is_available() else 'cpu'
model_id = ... |
a7ac1ad0b80d3140d4d885d7603d2b6aeee7b0a652f18d3c82042c96b8feaf53 | Python | 2,381 | 70 | import os
import simba as si
import scanpy as sc
import pandas as pd
import anndata as ad
workdir = '/simba/brain'
si.settings.set_workdir(workdir)
si.settings.set_figure_params(dpi=80,
style='white',
fig_size=[5,5],
... |
6e19a991570489a2f44ca3a6adeb13591ec26f9a49f6b068d14861c1d5b7f1a9 | Python | 2,384 | 60 | from PymoNNto import *
import tensorflow as tf
class Basic_Behavior_Tensorflow(Behavior):
def initialize(self, neurons):
neurons.voltage = tf.Variable(neurons.vector(), dtype='float32')
neurons.spike = tf.Variable(neurons.vector(), dtype='bool')
self.threshold = tf.constant(0.5, dtype='flo... |
a2e6b7316b7cf47c6ed66b4e25b7d8a78fa2347139d1959eab06691720343362 | Python | 2,384 | 52 | """
Configuration file
"""
conf = {}
######################################################################################################################
# Settings for experimental setup
## 'model' chooses model from 'ml2' and 'ml3': ml2 is the proposed hierachical message passing model; ml3 is the model with... |
fe3572680a695488fa81bb760df7d8aa80c23f1f98e0efc0946678c776b5a0db | Python | 2,384 | 68 | """
Calculate the timing of each wave.
"""
import numpy as np
import matplotlib.pyplot as plt
import argparse
import pandas as pd
from utils.io_utils import load_neo, save_plot
from utils.parse import none_or_str
CLI = argparse.ArgumentParser()
CLI.add_argument("--data", nargs='?', type=str, required=True,
... |
7838cef118fa2664531ec67df715f705b80887c5c27ef4405bae3c7467834cc3 | Python | 2,385 | 76 | from pymonntorch import *
import torch
import time
from matplotlib import pyplot as plt
from globparams import *
settings = {'dtype': torch.float64, 'synapse_mode': "SxD", 'device': 'cpu'}
class LeakyIntegrateAndFire(Behavior):
def initialize(self, neurons):
neurons.spikes = neurons.vector(dtype=torch.bo... |
b95ba741369f72114d9db5d1b9d512f406ab5792a3a6da086e44773e5c2108f9 | Python | 2,385 | 64 | import torch
from nequip.data import AtomicDataDict
from ._ghost_exchange_base import GhostExchangeModule
# NOTE: can't use custom ops https://docs.pytorch.org/tutorials/advanced/python_custom_ops.html#python-custom-ops-tutorial
# because of complications with `lmp_data` type and PyTorch custom ops registration syst... |
e168983ed3dd75cccd853b4dc3eeeef3d248600dc9255aefcd8de5f4b62649e0 | Python | 2,385 | 76 | from pymonntorch import *
import torch
import time
from matplotlib import pyplot as plt
from globparams import *
settings = {'dtype': torch.float32, 'synapse_mode': "SxD", 'device': 'cpu'}
class LeakyIntegrateAndFire(Behavior):
def initialize(self, neurons):
neurons.spikes = neurons.vector(dtype=torch.bo... |
800f2def6d7db00ead59a0221e8889523fb54d223b0db2386471be877fb0e0a9 | Python | 2,386 | 77 | import numpy as np
import pytest
from reinvent.scoring.aggregators import arithmetic_mean
from reinvent.scoring.aggregators import geometric_mean
def test_arithmetic_mean():
data1 = np.array([-4.43, -1.94, -2.93, 8.50, 3.71], dtype=np.float32)
weight1 = 2.71828
data2 = np.array([0.90, -7.40, 0.47, 2.29,... |
12387ac561aa6ff4cc9899f55897ea32ee701f8b34c657c090958ca06d3a9d36 | Python | 2,388 | 80 | """Compute weighted means"""
__all__ = ["arithmetic_mean", "geometric_mean", "custom_product", "custom_sum"]
from typing import List, Literal, Tuple
import logging
import numpy as np
logger = logging.getLogger(__name__)
def _aggregate(
all_scores: List[Tuple[np.ndarray, float]], mode: Literal["sum", "prod"]
)... |
14e399a6e63a1369c0dd6503a59c5223382a178016fafb97496eae136a3d6985 | Python | 2,388 | 77 | # 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... |
607c8fcb801b5b3d9acba650121bcfee55242d72ea294f0e63954e7372c87041 | Python | 2,388 | 76 | """Lazy loading of atlas NIfTI + label CSV files from the HF dataset."""
import functools
from dataclasses import dataclass
import nibabel as nb
import polars as pl
from nltools.templates.fetch import fetch_resource
from .registry import ATLASES, AtlasKind
@dataclass(frozen=True)
class _Atlas:
"""A loaded atl... |
35137d72d8f65f1e3f0fcffe101f4fe22ef1d03914bfe1413adeb31cbf3a7c9b | Python | 2,389 | 84 | from functools import partial
from PyQt5 import QtWidgets, QtCore
import sanpy
import sanpy.interface
import sanpy.bDetection
from sanpy.interface.bFileTable import pandasModel
from sanpy.sanpyLogger import get_logger
logger = get_logger(__name__)
class fileListWidget(QtWidgets.QWidget):
"""A widget showing
... |
a8b373d4f0abf50c1dd2df1780ba4fab279ff7048abf8c2566da9a297b7d6eb2 | Python | 2,389 | 63 | from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
from mlspm.datasets import download_dataset
# # Set matplotlib font rendering to use LaTex
# plt.rcParams.update({
# "text.usetex": True,
# "font.family": "serif",
# "font.serif": ["Computer Modern Roman"]
# })
if __name__ == "_... |
448ee5e8f0e091db584f7cc864bbdcdf6f5142b9eafbde61d63dbfd90d6543a9 | Python | 2,390 | 69 | import numpy as np
import nrrd
import os
import funcs.utils as utils
import vtk
import glob
import json
label_name = [
"1_Tympanic_Membrane",
"2_Malleus",
"3_Incus",
"4_Stapes",
"5_Promontory",
]
@utils.decorator_timer
def convert_vtk(label_map_path, output_folder=None):
# Step 1: Load the ... |
00b2154cc0a8d03b481860d84144e7bee0969dabc06a3270236464ff8ea4c5f3 | Python | 2,391 | 70 | import numpy as np
import os
from mpi4py import MPI
def output(path, nb_neurons):
"""
Simulate some random spike train input
:param path: the file for the configurations of the connection
:return:
"""
# Start communication channels
path_to_files = path
# For NEST
# Init connection
... |
6e9578fb37701eb336a3a5a3887003a2f3b9a9f11c41572e788dcb2584308aaf | Python | 2,391 | 90 |
import random
from tqdm import tqdm
import glob
import numpy as np
import torch
from sparse_ct.reconstructor_2d.dataset import (
DeepLesionDataset, EllipsesDataset )
from sparse_ct.reconstructor_2d.supervised import SupervisedReconstructor
if __name__ == "__main__":
params= {'batch_... |
9387c182afec5605eb3c2d006647bf105d9a224ff6d8ef6d528ddcaaf03ebc83 | Python | 2,391 | 60 | from PymoNNto.Exploration.StorageManager.StorageManager import *
#sm = StorageManager('X_1', 'X')
#sm = StorageManager('RALN_Test_2_0', 'RALN_Test_2')
#sm = StorageManager('MemoryCapacity_2', 'MemoryCapacity')#('RALN_Test_MT_Small_0', 'RALN_Test_MT_Small')
#sm = StorageManager('SORN_One_layer_all_600_0', 'SORN_One_la... |
f5fe58b5a471906c201b3ab2953dd1817df15c0f6638a39311f4591dff0dc9c0 | Python | 2,391 | 70 | # 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... |
33b25002e5fac7ca10b25e740abbafab85b8907b23f37ec07431717fad3f4dbf | Python | 2,392 | 75 | from typing import Optional, Union, Iterable, Iterator
import torch
from .encodings import bernoulli, poisson, rank_order
def bernoulli_loader(
data: Union[torch.Tensor, Iterable[torch.Tensor]],
time: Optional[int] = None,
dt: float = 1.0,
**kwargs
) -> Iterator[torch.Tensor]:
# language=rst
... |
50d87712d07baaa92ea111a92dcea39578b9fffac0bc392f003fbf8f9c750625 | Python | 2,393 | 97 | """Compute statistics on a grid."""
import numpy as np
import scipy as sp
__all__ = ["stationary_distribution", "forecast", "aftcast"]
def stationary_distribution(generator):
"""
Compute the stationary distribution.
Parameters
----------
generator : NDArray[float], shape=(n_states, n_states)
... |
4646270ead7bd320e632ac2c8cd38d5730fae6cb0cf8aacaf11eb6024dd310f5 | Python | 2,394 | 76 | from geomstats.test.data import TestData
class FiberBundleTestData(TestData):
def riemannian_submersion_vec_test_data(self):
return self.generate_vec_data()
def riemannian_submersion_belongs_to_base_test_data(self):
return self.generate_random_data()
def lift_vec_test_data(self):
... |
8e8a2d8fe25835503580a83d74ce1aad3d293da51e980ac1a6d0d9e36788145f | Python | 2,396 | 60 | """
Configuration file
"""
conf = {}
######################################################################################################################
# Settings for experimental setup
## 'model' chooses model from 'ml2' and 'ml3': ml2 is the proposed hierachical message passing model; ml3 is the model wi... |
2d0c613525640004996c5b1c91461c8f90c7410dd2c803d8fe97e84d7b3cb639 | Python | 2,397 | 51 | """The reader strips surrounding whitespace, because it forks one value into two."""
from __future__ import annotations
import polars as pl
from vdjdb.io.chunks import READABLE, read_chunk
from vdjdb.schema import ALL_COLUMNS
#: A real J-gene call in the corpus carried one of these. Named, because a literal is unrea... |
0dc8a3b3ea0c283392c176184c172bf5061a84b418f7b9180b877c7d9ef27cec | Python | 2,398 | 76 | from pymonntorch import *
import torch
import time
from matplotlib import pyplot as plt
from globparams import *
settings = {'dtype': torch.float32, 'synapse_mode': "SxD", 'device': 'cuda'}
class LeakyIntegrateAndFire(Behavior):
def initialize(self, neurons):
neurons.spikes = neurons.vector(dtype=torch.b... |
152378b2395e04e9abcdcf2033ff9bc78f50762b749c6cdd8ee27e0de97b4fd2 | Python | 2,398 | 76 | from pymonntorch import *
import torch
import time
from matplotlib import pyplot as plt
from globparams import *
settings = {'dtype': torch.float64, 'synapse_mode': "SxD", 'device': 'cuda'}
class LeakyIntegrateAndFire(Behavior):
def initialize(self, neurons):
neurons.spikes = neurons.vector(dtype=torch.b... |
2a66bcac195678fce58030edb8ab90ab0593a504f41d42b01ca2f0b10c9fefeb | Python | 2,398 | 76 | "This is copied from https://github.com/scikit-learn/scikit-learn/blob/main/doc/sphinxext/github_link.py"
import inspect
import os
import subprocess
import sys
from operator import attrgetter
REVISION_CMD = "git rev-parse HEAD"
def _get_git_revision() -> None | str:
try:
revision = subprocess.check_outp... |
ba099c058d8fec322b8e1d9308f2396b79f62bcd5f846381e0875f812d3e7bef | Python | 2,398 | 66 | """
Subtract the background of the input data by subtracting the mean of each channel.
"""
import numpy as np
import matplotlib.pyplot as plt
import argparse
from pathlib import Path
import os
from utils.io_utils import load_neo, write_neo, save_plot
from utils.parse import none_or_str
CLI = argparse.ArgumentParser()... |
c2c30146b525cbdca217ac841f47e93aaa0aa87389b4017115c42b0e8cd2897d | Python | 2,398 | 80 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: barplot_annotate_brackets
# CreatedDate: 2019-06-14 19:21:50 +0900
# LastModified: 2019-06-14 23:20:00 +0900
#
import matplotlib.pyplot as plt
def barplot_annotate_brackets(num1,
num2,
data,
... |
fc80f0d24d983b87a52e85d88cdd158e584e3bd9088944dada5cbb710a7cfd53 | Python | 2,398 | 47 | import itertools
from typing import List, Tuple, Dict
from deeperwin.configuration import set_with_flattened_key, PhisNetTrainingConfiguration
from deeperwin.run_tools.dispatch import dispatch_job, build_experiment_name, setup_experiment_dir, dump_config_dict, idx_to_job_name
import ruamel.yaml as yaml
def setup_cal... |
2124a6c5077437aa258a98ac8a06869f4a803cdaf612ebabdeb78981c0fe78d0 | Python | 2,399 | 67 | import sys, os
import numpy as np
import random
from sklearn.externals import joblib
from sklearn.ensemble import ExtraTreesClassifier
classifierPickleFileName, armDir, desiredFpRate, outDir = sys.argv[1:]
desiredFpRate = float(desiredFpRate)
statsToUse, header, grid_search = joblib.load(classifierPickleFileName)
st... |
9cf49f85956369bee38b3ea271c28bc05dd05eb9aec3bd723181536f9824d99d | Python | 2,399 | 64 | import torch.nn as nn
from .bert_embedding import BERTEmbedding
class BERT(nn.Module):
"""
BERT model : Bidirectional Encoder Representations from Transformers.
"""
def __init__(self, vocab_size, hidden=768, n_layers=12, attn_heads=12, dropout=0.1, activation='gelu', seq_len=512):
"""
... |
14f98b018a740d33e4200a98a9c334a578a38ca4d244e0706a602ae15f8fb87b | Python | 2,400 | 55 | """Execute the workflow selector with controlled Git inputs and external commands."""
import subprocess
from pathlib import Path
import pytest
import yaml
WORKFLOW = Path(__file__).parents[2] / '.github/workflows/assessment.yml'
def script():
workflow = yaml.load(WORKFLOW.read_text(), Loader=yaml.BaseLoader)
... |
2736e266e04a8ef4882b0aad149125c7cf8bc351773502e2be6454c08cda960d | Python | 2,400 | 59 | """
Configuration file
"""
conf = {}
######################################################################################################################
# Settings for experimental setup
## 'model' chooses model from 'ml2' and 'ml3': ml2 is the proposed hierachical message passing model; ml3 is the model wit... |
38e44d364565b29c9bf5cd0e3f6b3b76bf832f601ebba85107ee67f2a4c2b44c | Python | 2,400 | 83 | import geomstats.backend as gs
from geomstats.geometry.diffeo import AutodiffDiffeo
from geomstats.test_cases.geometry.riemannian_metric import RiemannianMetricTestCase
class LowerMatrixLog(AutodiffDiffeo):
"""Matrix logarithm diffeomorphism.
An alternative implementation for testing
purposes.
"""
... |
3ad6b25d85ece7001c0975838d24c329e7d2274306b36a4a715611d8829b1fd4 | Python | 2,400 | 60 | """
Configuration file
"""
conf = {}
######################################################################################################################
# Settings for experimental setup
## 'model' chooses model from 'ml2' and 'ml3': ml2 is the proposed hierachical message passing model; ml3 is the model wi... |
7ac2246ebe726fbc03cd8df2366da2182d863b6c6fcd5094e58c819e615ca3ea | Python | 2,400 | 84 | from PymoNNto import *
class Izhikevich_main(Behavior):
def initialize(self, n):
self.set_parameters_as_variables(n)
n.I = n.vector()
n.a += n.vector()
n.b += n.vector()
n.c += n.vector()
n.d += n.vector()
n.v *= n.vector('uniform')
n.u *= n.vector('... |
81b4063736f1e011d8f86eb7ca6f25c156621d232d57b289e6ebb834a3785103 | Python | 2,400 | 37 | #*----------------------------------------------------------------------------*
#* Copyright (C) 2024 ETH Zurich, Switzerland *
#* SPDX-License-Identifier: Apache-2.0 *
#* *
... |
90968c9151cc65e2aa0ff4ce086f260133116e614c3d4c02afa7e327ecace2bf | Python | 2,400 | 60 | """
Configuration file
"""
conf = {}
######################################################################################################################
# Settings for experimental setup
## 'model' chooses model from 'ml2' and 'ml3': ml2 is the proposed hierachical message passing model; ml3 is the model wi... |
2a1c8379130ad7e03874b8e31f48d757bcef424e25aea0af20f9b3a334a9834d | Python | 2,401 | 60 | """
Configuration file
"""
conf = {}
######################################################################################################################
# Settings for experimental setup
## 'model' chooses model from 'ml2' and 'ml3': ml2 is the proposed hierachical message passing model; ml3 is the model wi... |
50057780a81eca72973754491c15c8836284e54c0529894c752543ee496e5280 | Python | 2,401 | 66 | """
Subtract the background of the input data by subtracting the mean of each channel.
"""
import numpy as np
import matplotlib.pyplot as plt
import argparse
from pathlib import Path
import os
from utils.io_utils import load_neo, write_neo, save_plot
from utils.parse import none_or_path
CLI = argparse.ArgumentParser(... |
dc77293158bd1c05650f60ed3d6f06bb0bc79eac948c78dbda49e134be88699a | Python | 2,401 | 100 | import math, sys, time
from PyQt5.QtCore import Qt, QTimer
from PyQt5.QtGui import *
from PyQt5 import QtCore, QtWidgets, QtGui
class Overlay(QtWidgets.QWidget):
def __init__(self, parent = None):
QtWidgets.QWidget.__init__(self, parent)
palette = QPalette(self.palette())
palette.setColor(palette.Background... |
ef47e53a8fd1e5fc6ba10e35d262825f968e96723ed170db05b92a8a0e38b2c2 | Python | 2,401 | 60 | """
Configuration file
"""
conf = {}
######################################################################################################################
# Settings for experimental setup
## 'model' chooses model from 'ml2' and 'ml3': ml2 is the proposed hierachical message passing model; ml3 is the model wi... |
23770c8932cf2f82a1751a31b42039ce811a72af1f09c61e4776ede8467d2519 | Python | 2,402 | 60 | """
Configuration file
"""
conf = {}
######################################################################################################################
# Settings for experimental setup
## 'model' chooses model from 'ml2' and 'ml3': ml2 is the proposed hierachical message passing model; ml3 is the model wi... |
43f2813d7c594a1a191b06d2f055a5b8fc5f165cb9304047a8a6bca657c14aa4 | Python | 2,402 | 60 | """
Configuration file
"""
conf = {}
######################################################################################################################
# Settings for experimental setup
## 'model' chooses model from 'ml2' and 'ml3': ml2 is the proposed hierachical message passing model; ml3 is the model wi... |
ae93b7c43f64ae5b1066ed4627bd78c1580f60f315fb9dbb8e774836d430b3d7 | Python | 2,403 | 61 | import unittest
import numpy as np
import numpy.testing as npt
import pytest
import torch
import torch.utils.data as tud
from reinvent.models import TransformerAdapter, Mol2MolModel
from reinvent.models.transformer.core.dataset.dataset import Dataset
from reinvent.models.transformer.core.enums.sampling_mode_enum impo... |
1dd74d6a0fe0ffd3a315e0f04828487efce91e60ee13816c02319012ac080362 | Python | 2,404 | 67 | from PymoNNto import *
from PymoNNto.Exploration.Evolution.Interface_Functions import *
import os
import sys
#def get_gene_string(gene): # same implementation as interface_function get_gene_id
# id = ''
# for key, value in gene.items():
# id += '#' + key + '$' + str(value)
# return id + '#'
#def exec... |
78ff741ad9e8723ebc97206d4f1f3cc78ecfacbdff0a8f681939e79a221dc4f4 | Python | 2,404 | 74 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 12 15:25:17 2018
@author: ngritti
"""
from csbdeep.data import RawData, create_patches
from csbdeep.utils import axes_dict
from csbdeep.models import CARE, Config
from csbdeep.io import load_training_data
import time, os, glob
import numpy as np
#... |
a1de9de2ae03eceeac2f680fb365925b4c1efe6fd27157173427b577384d856e | Python | 2,405 | 60 | """
Configuration file
"""
conf = {}
######################################################################################################################
# Settings for experimental setup
## 'model' chooses model from 'ml2' and 'ml3': ml2 is the proposed hierachical message passing model; ml3 is the model wi... |
f14988c223a94d7e01625a2943de6cda47ffe30681973eef6d44fa45b7d3bb13 | Python | 2,405 | 68 | import pytest
import unittest
import torch
import torch.utils.data as tud
from reinvent.models.transformer.core.dataset.dataset import Dataset
from reinvent.models.transformer.core.enums.sampling_mode_enum import SamplingModesEnum
from reinvent.models.transformer.core.vocabulary import SMILESTokenizer
from reinvent.r... |
9927a21197fe191876d25b46d88453c321755b307d5c3e6fe84dab0683099831 | Python | 2,406 | 59 | """The snapshot JSONs for the two tiny anchors.
Only for those two. Other families snapshot their own checkpoints, because
the calculator arguments and the channels worth recording differ per model
class; this target would otherwise evaluate, say, a dipole model as if it
were an energy model and record a reference tha... |
5c31a37d4d7b81d1a9566615b9ce442769b265ff6a21e056e8ba58f458d6f0f4 | Python | 2,408 | 120 |
import sys
from itertools import groupby
from heapq import (
heappush,
heappop,
)
from ..glove import (
load_glove_vocab,
format_glove_vocab,
load_glove_cooc,
format_glove_cooc
)
def merge_vocabs(args):
iters = [load_glove_vocab(_) for _ in args.paths]
records = merge(iters)
re... |
43722e79a4e319fcf4b68b2cd98ffe874ba3921edf28fdb5fd4a43838f4ac405 | Python | 2,409 | 70 | # -*- coding: utf-8 -*-
import logging
import argparse
import os
def parse_args():
# Argument Parser
parser = argparse.ArgumentParser()
# my args
parser.add_argument("--verbose", action = "store_true", help = "display messages")
parser.add_argument("--idir", default = "None")
parser.add_a... |
947c0b0fd14c0651d29cb54571b08dfcb1a8ea4bed5608cbf9a1e943def34e0d | Python | 2,409 | 63 | import os
import random
import pickle
import numpy as np
import torch
import scipy.io
def _fetch(path, name):
if name == 'train':
token_file = os.path.join(path, 'bow_tr_tokens.mat')
count_file = os.path.join(path, 'bow_tr_counts.mat')
elif name == 'valid':
token_file = os.path.join(pa... |
9c255ee2f2a22315dcf287261967780fbeb0d1437adeaace416b275e27c514a0 | Python | 2,409 | 59 | from keras.preprocessing.image import img_to_array
import imutils
import cv2
from keras.models import load_model
import numpy as np
#PATHS FOR TRAINED MODELS
face_detection_path = 'faceDetection/haarcascade_frontalface_default.xml'
emotion_model_path = 'modelTraining/_mini_XCEPTION.102-0.66.hdf5'
#ASSIG... |
5f76ea9eb77085506b0b2b546f5ceaf1f9e567ef3b7e50414da9d6bf746cc345 | Python | 2,410 | 75 | import random
import pytest
from geomstats.geometry.special_euclidean import SpecialEuclidean
from geomstats.geometry.special_orthogonal import SpecialOrthogonal
from geomstats.learning.exponential_barycenter import (
ExponentialBarycenter,
GroupGradientDescent,
)
from geomstats.learning.frechet_mean import F... |
0f35ab9eba624679050a5e9bdb614ddc6eeb79475c4c9de05a69cdeb7b2ef17e | Python | 2,412 | 37 | #*----------------------------------------------------------------------------*
#* Copyright (C) 2024 ETH Zurich, Switzerland *
#* SPDX-License-Identifier: Apache-2.0 *
#* *
... |
b1a952c3fe234eb2d79d7600474f6929b5cad1d02b34672911bae18a6d946f7d | Python | 2,413 | 75 | import pandas as pd
from torch.utils.data import Dataset
class DataFrameDataset(Dataset):
"""Dataset based on ``pandas.DataFrame``.
Parameters
----------
root : str
Path to root directory of input data.
meta_data : pandas.DataFrame
Meta data of data and labels.
parse_item_cb :... |
d9dbe84aa8b07369c72115fd47172a6b900d0de704b70f3a33ffdb3a63f3c43b | Python | 2,413 | 69 | import sanpy
from sanpy.interface.plugins import basePlotTool
from sanpy.sanpyLogger import get_logger
logger = get_logger(__name__)
class plotToolPool(basePlotTool):
"""Plot tool pooled across all open analysis"""
myHumanName = "Plot Tool (pool)"
def __init__(self, tmpMasterDf=None, **kwargs):
... |
bdb8bf42068702c3400db607612a880c2e7f5d0f46e4c5d9edc069ab7134ae1c | Python | 2,414 | 73 | from preprocessing import sparse_to_tuple
import networkx as nx
import numpy as np
import scipy.sparse as sp
import tensorflow as tf
import warnings as wn
flags = tf.app.flags
FLAGS = flags.FLAGS
wn.simplefilter('ignore', UserWarning)
"""
Disclaimer: functions from this file originally
come from the deezer/fastga... |
d2c77740c9de6bdb5d8bb3e58c6b6459e2576139b7bcd3cfa4b1523457fb9952 | Python | 2,414 | 75 |
from pathlib import Path
import tarfile
import matplotlib.pyplot as plt
import numpy as np
# # Set matplotlib font rendering to use LaTex
# plt.rcParams.update({
# "text.usetex": True,
# "font.family": "serif",
# "font.serif": ["Computer Modern Roman"]
# })
if __name__ == "__main__":
stats_dir = Pa... |
15718ece70b307b1d0f073ae003a283e360d8d4c5b1dd1b1cbc6e58a3b81527f | Python | 2,415 | 37 | #*----------------------------------------------------------------------------*
#* Copyright (C) 2024 ETH Zurich, Switzerland *
#* SPDX-License-Identifier: Apache-2.0 *
#* *
... |
958cd568889dbf570b40cb165f905d74bf41dbe57b22c665bac8bcb89c9c595f | Python | 2,415 | 37 | #*----------------------------------------------------------------------------*
#* Copyright (C) 2024 ETH Zurich, Switzerland *
#* SPDX-License-Identifier: Apache-2.0 *
#* *
... |
a50b3191a3ed8f88fd2d2edffbf798bc4d3147311856e73ff2fc4a859f740892 | Python | 2,415 | 88 | from functools import lru_cache
import numpy as np
from apted import APTED, Config
from reinvent_plugins.components.synthsense.reducers import reaction_classes
@lru_cache()
def nextmove_top2(classification: str) -> str:
"""Return 2 top-level classification parts in NextMove reaction classification
NextMove... |
36f57fe500650f7c12ad0ed41858ee8adbc943672ac9f172c5237e37372c0ef6 | Python | 2,419 | 68 | """Display typed published DANDI metadata in a NiceGUI side panel."""
from __future__ import annotations
from nicegui import ui
from gui.app_state import DandiAppState, DandiAppStateStore
from gui.widgets.base import DandiWidget
class DandisetMetadataWidget(DandiWidget):
"""Render dandiset metadata supplied by... |
1ce1dd743041fd1b30f5004b812aaa1d1e39ee8adcd0d6e2564511e5d4855f32 | Python | 2,421 | 81 | """Run the maintained example scripts in the ``examples`` directory root."""
from __future__ import annotations
import ast
from pathlib import Path
import runpy
import pytest
_EXAMPLES_DIR = Path(__file__).resolve().parents[1] / "examples"
_EXAMPLE_SCRIPTS = sorted(_EXAMPLES_DIR.glob("*.py"))
def _imports_matplot... |
37c98eea65bfff71ff4f3064e3e6523d9d39c4fb05aa383c3d6adc6060da083d | Python | 2,423 | 63 | import torch
from molx.dataset import Molecule3DProps
from molx.model import Deepergcn_dagnn_dist, SchNet
from molx.mol3d import TransformPred3D, TransformGT3D, TransformRDKit3D
from molx.proppred import RegTrainer, eval_reg
conf = {}
conf['epochs'] = 100
conf['early_stopping'] = 200
conf['lr'] = 0.0001
conf['lr_deca... |
3a09183d3799778f012d1a02a424ae278d9aa7d64d212e37953be23ff9a47562 | Python | 2,423 | 117 | import numpy as np
import torch
import os, sys
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/..")
from model import *
from train import *
from tasks.seqDS import *
import time
print("cuda available = " + str(torch.cuda.is_available()))
# Set up the output dir where the output model will be saved
out... |
7a2f8a8c0874b3cbe9c2483b0e8772cdcc586456f2538739b28dd26960f694c6 | Python | 2,423 | 74 | import math
import random
import pytest
import geomstats.backend as gs
from geomstats._mesh import Surface
from geomstats.test.test_case import TestCase
from geomstats.test_cases.geometry.mixins import DistTestCaseMixins
class VarifoldRandomDataGenerator:
def __init__(self, point, amplitude=2.0, max_vertices_re... |
a5ff73c2b14c6e34d132b82d6b2d560d48ce8884f5802e6c682c888c23647b3f | Python | 2,423 | 76 | from pymonntorch import *
import torch
import time
from matplotlib import pyplot as plt
from globparams import *
settings = {'dtype': torch.float64, 'synapse_mode': "DxS", 'device': 'cpu'}
class LeakyIntegrateAndFire(Behavior):
def initialize(self, neurons):
neurons.spikes = neurons.vector(dtype=torch.bo... |
b319d70a21b0013ec7496353e8f93b27b022199295e3536c1ad2b12a9a60705d | Python | 2,423 | 76 | from pymonntorch import *
import torch
import time
from matplotlib import pyplot as plt
from globparams import *
settings = {'dtype': torch.float32, 'synapse_mode': "DxS", 'device': 'cpu'}
class LeakyIntegrateAndFire(Behavior):
def initialize(self, neurons):
neurons.spikes = neurons.vector(dtype=torch.bo... |
fba5031a90ad6736e8f5f35d254361a4a8004bd6e71d009358a3f92597c7246b | Python | 2,423 | 58 | """The ML-IAP wrapper's own buffers must follow the model, not the process.
`total_charge` and `total_spin` are handed to the forward beside the model's own
tensors, so a float32 pair under a float64 model does not raise: promotion makes
it a quietly less accurate number, and it is LAMMPS that consumes it.
They used ... |
8c96cf47b32e041dda62a60dee2e21bb2ae0be351ee224931228cb491de66bc3 | Python | 2,426 | 37 | #*----------------------------------------------------------------------------*
#* Copyright (C) 2024 ETH Zurich, Switzerland *
#* SPDX-License-Identifier: Apache-2.0 *
#* *
... |
4c0b45c7e88d898f9de5308ef20217a17b1679f5110d9d2c381d837f47670b97 | Python | 2,427 | 37 | #*----------------------------------------------------------------------------*
#* Copyright (C) 2024 ETH Zurich, Switzerland *
#* SPDX-License-Identifier: Apache-2.0 *
#* *
... |
8bb0181ca498edf49fc4a0c868b7d4408ff5b4f6e493237c0c48493c3a80a0ce | Python | 2,427 | 101 | import os
from pathlib import Path
from utils import (
do_plate_metadata,
do_long_protocols,
do_img_metadata,
save_dataset,
)
def parse_args():
import argparse
parser = argparse.ArgumentParser(
description='...'
)
parser.add_argument(
'-1',
'--img_folder',
... |
f0a672340a2fb0762a439202b8912851cf6269d72c6b94356f5042160a7818e7 | Python | 2,428 | 51 | from PymoNNto.Exploration.Network_UI.TabBase import *
from PymoNNto.Exploration.Visualization.Analysis_Plots import *
class stability_tab(TabBase):
def __init__(self, parameter, title='Autocorrelation', timesteps=500):
super().__init__(title)
self.parameter=parameter
self.timesteps=timeste... |
1347e5a24274970d39a61967b031f7a6d385bf1ebfe32016e1035c67b38280fd | Python | 2,429 | 61 | """Every file the build reads must actually be in the repository.
A source file that `.gitignore` swallows is invisible locally -- it is right there on disk, the code
finds it, the tests pass -- and missing everywhere else. `summary/embed.html` was ignored by
`summary/*.html`, a rule that exists for the *rendered* das... |
862b8835e6cf06b26168367c2855615b6e08b524cce0ec9cc00504b538af4c3f | Python | 2,429 | 55 | import pandas as pd
from uniprotparser.betaparser import UniprotSequence
from sequal.sequence import Sequence
import re
reg_positon_residue = re.compile("_(\w)(\d+)")
# a function to read fasta file into a dictionary where the key is the uniprot accession id extracted from the fasta
def read_fasta(fasta_file:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.