sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
c2597d715ada1c188d9271117486b4c30530f21657aef11e070e4ae6c52ef828
Python
2,429
79
r"""Compute a geodesic regression on Grassmann manifold (2, 3). The generative model of the data is: :math:`Z = Exp_{\beta_0}(\beta_1.X)` and :math:`Y = Exp_Z(\epsilon)` where: - :math:`Exp` denotes the Riemannian exponential, - :math:`\beta_0` is called the intercept, - :math:`\beta_1` is called the coefficient, - :m...
c797fc7e654b803ae607754b5bcfc10bb28b719ec8feb72890cd861fc02b751b
Python
2,430
37
#*----------------------------------------------------------------------------* #* Copyright (C) 2024 ETH Zurich, Switzerland * #* SPDX-License-Identifier: Apache-2.0 * #* * ...
5d22a24722780194f1ac762fe3554f1e8a4659d3cc33eb68fe6fe7aa419712d9
Python
2,431
37
#*----------------------------------------------------------------------------* #* Copyright (C) 2024 ETH Zurich, Switzerland * #* SPDX-License-Identifier: Apache-2.0 * #* * ...
798100b125ae7d1190d10e8d80774ac5c1959ae80ba8b40c5b34a285cfdecbdd
Python
2,431
37
#*----------------------------------------------------------------------------* #* Copyright (C) 2024 ETH Zurich, Switzerland * #* SPDX-License-Identifier: Apache-2.0 * #* * ...
319b59b02d0dbe858e91577f9063dc6d17810363e429155faab6144721dfa6e6
Python
2,433
72
import numpy as np import os import numpy.random as rgn from mpi4py import MPI def input(path, nb_neurons, t_synch): """ Simulate some random spike train input :param path: the file for the configurations of the connection :return: """ # Start communication channels path_to_files = path ...
ba2277bf435326bf7aa77596ad710a50805c53970c873a329cc40a3b90012316
Python
2,434
79
from geomstats.test.data import TestData from .base import LevelSetTestData from .fiber_bundle import FiberBundleTestData from .pullback_metric import PullbackDiffeoMetricTestData from .quotient_metric import QuotientMetricTestData class FullRankCorrelationMatricesTestData(LevelSetTestData): def from_covariance_...
82c7c443966d0b87c2e9256eef54f5b8638fe29d07ef39ef3b6a0113b0f883f6
Python
2,436
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': 'cuda'} class LeakyIntegrateAndFire(Behavior): def initialize(self, neurons): neurons.spikes = neurons.vector(dtype=torch.b...
cb9bf8a14dc202e57bae8353c5a77675e8403df8fa3f38a5046fdaa9d90bf3f2
Python
2,437
77
from pymonntorch import * import torch import time from matplotlib import pyplot as plt from globparams import * settings = {'dtype': torch.float64, 'synapse_mode': "DxS", 'device': 'cuda'} class LeakyIntegrateAndFire(Behavior): def initialize(self, neurons): neurons.spikes = neurons.vector(dtype=torch.b...
0fa5ffdde5692e5fa36128dbc1197bef838de76514bba1be55fa593df1f923ae
Python
2,438
70
""" Calculate the timing of each wave. """ import numpy as np import matplotlib.pyplot as plt import argparse from pathlib import Path import pandas as pd from utils.io_utils import load_neo, save_plot from utils.parse import none_or_path CLI = argparse.ArgumentParser() CLI.add_argument("--data", nargs='?', type=Path...
dbc05c76b48acff8cb7909b3e841ba11c642a43af8278767aeb683a86764a090
Python
2,438
49
import argparse from dig.auggraph.method.SMixup.smixup import smixup parser = argparse.ArgumentParser() parser.add_argument('--dataset', type=str, default='IMDBB', choices=['IMDBB','PROTEINS', 'MUTAG', "REDDITB", 'IMDBM', 'REDDITM5', 'REDDITM12', 'NCI1']) parser.add_argument('--GMNET_nlayers', type...
0cbb3cce564514f6e902416ffc2d9dc90112a1302e9abffffefdfee3bbbf0e90
Python
2,440
67
""" 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()...
c9a209848d8346cce0e1925be69577afd029ee64d656e23e055c180e86888f3d
Python
2,440
76
import pytest import numpy as np from reinvent.runmodes.RL.memories.identical_murcko_scaffold import IdenticalMurckoScaffold from reinvent.models.model_factory.sample_batch import SmilesState @pytest.fixture def diversity_filter(): diversity_filter = IdenticalMurckoScaffold( bucket_size=2, mins...
ea04297c4d0e158c04a2e693f12015812a729bda8297a2c9bedc558900a628de
Python
2,440
77
"""Plot the pole ladder scheme for parallel transport on S2. Sample a point on S2 and two tangent vectors to transport one along the other. """ import matplotlib.pyplot as plt import geomstats.backend as gs import geomstats.visualization as visualization from geomstats.geometry.hypersphere import Hypersphere from ge...
434936617955684be3217897bcea579a5a88c9b8086d9b041b839dcacd9bc5ec
Python
2,441
83
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import shutil import urllib.request from click import confirm VERSION = "0.16.0" ARCHITECTURE_ALIASES = { "x86_64": "amd64", "armv6l": "armv6", "armv7l": "armv7", "aarch64": "arm64", } FILE_EXTENSIONS = {...
c1c75e348588fe8a0962c9c6182f3fddfcfe26add1b56cb119b1344ee5a30a70
Python
2,441
51
import os import pickle import argparse import pandas as pd from tdc.multi_pred import DTI from hyper_dti.utils.bio_encoding import precompute_drug_embeddings, precompute_target_embeddings if __name__ == "__main__": parser = argparse.ArgumentParser(description='Bio-embedding') parser.add_argument("--data_di...
cc1adcdfcb2fda4512c578e2779cb0810c259026953a73e0edbe850289694dcc
Python
2,441
67
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...
55a3b5061607c59f4083e6f0d6a3bb54d7cfedd26a68179a12fbaaf36aba279a
Python
2,442
73
# 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 e3nn.util.jit import script from nequip.nn import graph_model from nequip.utils.compile import prepare_model_for_compile from nequip.utils.global_state import TF32_KEY from typing ...
b478b27293521e7af5728f3de735a02ac936c7fc975b2e41557927ffcfd581cc
Python
2,442
74
from typing import Sequence from chromadb.test.conftest import ( reset, skip_if_not_cluster, ) from chromadb.api import ClientAPI from kubernetes import client as k8s_client, config import time @skip_if_not_cluster() def test_reroute( client: ClientAPI, ) -> None: reset(client) collection = client...
bf9f3faa51cc888b3e8015dfd9c230be7d3ba0707444da29f9265e01eac1d626
Python
2,442
73
# 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 List, Optional import torch from e3nn.o3._irreps import Irreps from nequip.data import AtomicDataDict from ._graph_mixin import GraphModuleMixin class Concat(GraphModuleMixin, to...
8d983df1605403d4442f548ea3a8ce62d329b1f2bd0a10a18e9aa858ba11e0ee
Python
2,444
74
import pytest import torch from nequip.data import AtomicDataDict from nequip.nn.embedding import NodeTypeEmbed from nequip.nn import SequentialGraphNetwork, AtomwiseLinear def test_basic(): type_names = ["A", "B", "C"] node_type = NodeTypeEmbed(type_names=type_names, num_features=13) linear = AtomwiseLi...
782cab324bb06572b421c61906a487f4ff67b5eb57958f4e0b93218b52da82e9
Python
2,449
74
# Copyright 2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from abc import abstractmethod from typing import Any, Dict import torch class LabelMapper: """ A utility class for mapping class names (labels) to unique integer indices and vice versa. This ensures consistent labeling across data...
651fd5d183571209d58ab62372ecbb252f3f3c29741433414a9324e4f227cf0b
Python
2,450
74
#!/usr/bin/env python from glob import glob from subprocess import Popen, PIPE from valgrindwrapper import ValgrindWrapper import difflib import os import re import shlex import shutil import sys import tempfile import unittest class IntegrationTest(): exe_path = None def setUp(self): self.test_dir = ...
5df62b13988c96eb929da704dfadcd1f587aacb6b6a827f4bb22e767f77f4874
Python
2,451
70
""" Tests for the ``progress_bar`` keyword across the inference family. Progress bars are written to stderr by tqdm. A library should not write to stderr unless asked: calling these functions in a loop (e.g. a calibration simulation running 100 permutation tests) otherwise emits one progress bar per call. Per the cano...
9356081dc1c305b2d7a0cc146d4c2d4d9503ffce44ea01d64ea94d2f532e7019
Python
2,451
72
import statistics import os.path from common.common import load_pickle from osa.configuration import DATA_FOLDER, OUTPUT_FOLDER def trial_average(summary_list, name, return_list=False): value_list = list() for s_i, s in enumerate(summary_list): if name in s.keys(): value_list.append(s[nam...
30d82ddfc2e3d4a6103bfd06ae760f893129ec207118f5a901ec877dc8353a88
Python
2,454
70
import statistics import os.path from common.common import load_pickle from safe_msmt.configuration import DATA_FOLDER, OUTPUT_FOLDER def trial_average(summary_list, name, return_list=False): value_list = list() for s_i, s in enumerate(summary_list): if name in s.keys(): value_list.append...
6acc005ea725c5407847adf93ef8ee498821be4354acd4dd312a171a678c86ba
Python
2,454
60
from PymoNNto.Exploration.Evolution.Devices.Evolution_Device_Multi_Thread import * import sys from PymoNNto.Exploration.Evolution.SSH_Functions import * def ssh_thread_worker(slave_file, name, ssh_string, root_folder, conn): print('ssh thread started') while True: time.sleep(np.random.rand()) i...
8c7f3ec916ab6d38f80b492cdd25fff3a2acedf1aae0dc19e9530a4eb8c4e537
Python
2,455
86
import random import pytest from geomstats.geometry.hyperbolic import Hyperbolic, HyperbolicDiffeo from geomstats.test.parametrizers import DataBasedParametrizer from geomstats.test_cases.geometry.diffeo import DiffeoTestCase from geomstats.test_cases.geometry.riemannian_metric import ( RiemannianMetricComparison...
afcefd9d3b50314f99931e02ba7721651b7cdbc7dc15fa6f320f077cba2c7d2b
Python
2,455
88
import h5py import random import torch from deeprank_gnn.GraphGenMP import GraphHDF5 from deeprank_gnn.ginet import GINet from deeprank_gnn.NeuralNet import NeuralNet # example of creating hdf5 file def create_graph(): pdb_path = "./data/pdb/1ATN/" pssm_path = "./data/pssm/1ATN/" embedding_path = "./data...
b3f624f8eb0543b55a3867cd11ff9f3ad7395efac1854b182638f45772e0ccdd
Python
2,455
52
from PymoNNto.Exploration.Network_UI.TabBase import * from PymoNNto.Exploration.Network_UI.Basic_Tabs.Helper.PCA import * class PCA_tab(TabBase): def __init__(self, parameter='output', title='PCA', timesteps=1000): super().__init__(title) self.parameter = parameter self.timesteps = timeste...
1c3129310418989a43adf549ef976a97e7320fd09c68d35697074461e343b40c
Python
2,456
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...
a23e13a13fd4eccd544823e1d80ea81b005a9d70892bb8c6125d05612d3b2d53
Python
2,457
74
import math import numpy as np from warnings import warn def fsolve_bounded_monotonic(func, bounds, tol=1e-5, max_iter=50): assert max_iter > 0 and tol > 0 bounds = (float(bounds[0]), float(bounds[1])) # Check if the function is monotonically increasing or decreasing ymin, ymax = func(bounds[0]), fun...
d0e546018a759b3897c2ef975f939e9338d3aeec42aca8227c2f3670cf571fd7
Python
2,459
96
import numpy as np import NALSM_GEN_SUPPORT as sup import os SAVE_VER_INP = input('VERSION? [int]: ') VER = int(SAVE_VER_INP) main_Path = os.getcwd() data_path = main_Path + '/train_data/ver_'+str(VER) net_path = main_Path + '/networks' SAVE_VER_INP = input('DATASET? [M: mnist, N:nmnist]: ') ds = str...
10ba1be1f3a36c5a977f0e995394b0bb42825e6be50ebc68496b376fe99172c1
Python
2,460
68
# Generated by Django 4.1.1 on 2022-11-21 13:21 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('celsus', '0027_project_project_type'), ] operations = [ migrations.AlterField( model_name='project', name='cell_type...
ed2547c7ccaf0235a85c49c8a106c3c18a274da36c193acd0ec4ed8ac7f24554
Python
2,463
84
#!/usr/bin/env python # -*- coding: utf-8 -*- # # FileName: main # CreatedDate: 2019-06-14 19:20:26 +0900 # LastModified: 2019-10-05 16:42:26 +0900 # from pathlib import Path import matplotlib.pyplot as plt import numpy as np import pandas as pd from scipy import stats from barplot_annotate_brackets import barplot...
0fd1dabd0effe9765dd05d688aeff32c07d6c0e91a7ccf0b7e0e74afbbb85643
Python
2,464
66
from pathlib import Path import click import numpy as np from tqdm import tqdm from nnunetpaper._utils import get_multi_method_dataframe @click.command() @click.option( "-m", "--methods", multiple=True, type=click.Tuple([str, click.Path(exists=True, readable=True, path_type=Path)]), ) @click.option(...
becaeffff40e16c79a18c55331282ac335b6ab9ee25f69486fe4c2f1b8238664
Python
2,464
74
import os import argparse import warnings warnings.simplefilter(action="ignore", category=FutureWarning) import pandas as pd from activation_models.generators import get_activation_models from custom_model_tools.eigenspectrum import EigenspectrumImageNet from custom_model_tools.hooks import LayerZCA from utils import ...
4440732253ed88e28abc86752ce5377dd9e09e83fd94dc17198397e6422f8902
Python
2,466
85
import torch import torch.optim as optim import torch.nn as nn import numpy as np import os from IPython.display import clear_output from torch.utils.data import Dataset, DataLoader import json def weighted_bceloss_logits(pred, y, decay=1): weight = 1/(decay*torch.abs(y)) weight[weight>3] = 3 y[y>0] = 1 ...
1b4338094e29b33e56207fe1a4b5b26edc37c338a06cfee1c2debd7620dff4cf
Python
2,468
99
# -*- coding: utf-8 -*- import pyqtgraph as pg from pyqtgraph.Qt import QtCore, QtGui import numpy as np from pyqtgraph.dockarea import * app = QtGui.QApplication([]) gui = QtGui.QMainWindow() area = DockArea() gui.setCentralWidget(area) gui.resize(1000,500) gui.setWindowTitle("Scroll and Zoomed Plot") dockCtrl = Do...
e1c78738d75fa9426988dd3f1a37a8eeb3a348931a532a4ffda917fe6da803fc
Python
2,468
66
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Aggregation function interface module.""" from abc import abstractmethod from typing import List, Tuple import numpy as np import pandas as pd from openfl.interface.aggregation_functions import AggregationFunction from openfl.utilitie...
144565caf5b33cabf9031a93c9bdeec8e4850c35b6ec2d4c5349bd7430fe606b
Python
2,469
54
class Config: def __init__(self): self.model = 'vae' self.batch_size = 8 self.nb_epoch = 150 #300 self.n = 75 self.kl = 2 self.weight = 2 self.lr = 5e-4 #self.in_shape = (1, 80, 72, 96) # input size with padding #### FOR SC: #self.in_s...
7ab1d3c4408597df04d62488cc7cacbf5e0dddeeef3a2e11e6d88ddcc9be319d
Python
2,471
74
from dataclasses import asdict, dataclass @dataclass(slots=True) class ConfParams: """Global tracking hyperparameters, overridable from parameter files or the CLI""" DEVICE: str = "" """Device name as given by the user (empty for automatic selection). Use idtrackerai.base.network.DEVICE to get the ac...
e8e3bd1c15b5079fc8c0d07facbb55cae3f7037802fb3afee0c038eb765cc511
Python
2,474
70
import anndata import numpy as np import pandas as pd import plotly.io as pio import scanpy as sc import plotly.graph_objects as go import os import scipy.sparse as sp from scipy.spatial import distance from sklearn.neighbors import NearestNeighbors import warnings from tqdm import tqdm warnings.filterwarnings("ignore"...
23bc5ebcaa3f80e61ce08bae704a847534b8d746ba8fffa1d565dfa277f0fb4b
Python
2,475
76
from numpy import zeros from .butter_bandpass_filter import butter_bandpass_filter from .doHilbert import doHilbert from .dPL import dPL def run_multiPatLEiDA(RSsig, delt, flp, fhi, k): """Run LEiDA Routine for BOLD signal. Args: RSsig (ndarray): BOLD signal array for all parcels/voxels in the forma...
cbe6c7fb2cf976dd1b6144215a2cde25a325ee45027561de52363bad532c16d8
Python
2,477
69
import os import argparse import pandas as pd import matplotlib.pyplot as plt from experiments import ROOT_DIR benchmark_path = os.path.join(ROOT_DIR, "benchmark") figure_path = os.path.join(ROOT_DIR, "figures") if not os.path.isdir(benchmark_path): os.makedirs(benchmark_path) def main(start=100, stop=1000, st...
8b81d72da93249bf2400c58855020f57095238abb020326c2b6d2f20b61ae605
Python
2,480
73
import os from jinja2 import Environment, FileSystemLoader import json def render_json_template(env, template_file, **kwargs): template = env.get_template(template_file) d = json.loads(template.render(**kwargs)) return d TEST_DATA_ROOT = os.environ.get( 'RENDER_TEST_DATA_ROOT', '/allen/aibs/pipe...
2baa41bcf50b6b49ae164a768f073160da4f3e5fa353cdb3114c5e5311252620
Python
2,481
85
import NALSM_GEN_SUPPORT as sup import multiprocessing as mp class multi_process: def __init__(self,num_processes,save_path): self.dataPath = save_path # Define IPC managers manager1 = mp.Manager() # Define lists (queue) for tasks and computation results s...
abce7eaac0b48dee08060566046886620a276799ba2e39e796508209be4bb459
Python
2,481
66
from geomstats.test.test_case import TestCase class LocalizationTestCase(TestCase): def test_propagate(self, state, sensor_input, expected, atol): res = self.model.propagate(state, sensor_input) self.assertAllClose(res, expected, atol=atol) def test_propagate_jacobian(self, state, sensor_inpu...
fe3232225e3fd7918e198f041f1daf6c6cc2869ae5510fa62f003a21283b7cc8
Python
2,481
70
from PymoNNto import * from PymoNNto.Exploration.Visualization.Reconstruct_Analyze_Label.Reconstruct_Analyze_Label import * def compute_temporal_reconstruction(network, single_neuron_group=None, single_neuron_id=None, recon_group_tag='recon'): RALN = Reconstruct_Analyze_Label_Network(network) RALN.zero_recon()...
bd479ad7298d0b19dcc9b365d0debbbfb828910034166fca5219148593e645c1
Python
2,482
91
# NIBR substructure filter # # adapted from RDKit commit 4a69bc3493dd3e9bb9f7a519e306fbcb545f1452 which # # assign the filter from collections import namedtuple import numpy as np from rdkit import Chem FilterMatch = namedtuple( "FilterMatch", ( "SubstructureMatches", "Min_N_O_filter", ...
2ea092c32fac0edcd97f6a7a5a79c9209c8ad272752dbb736d33999b4b0085ad
Python
2,483
80
# Copyright (C) 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """You may copy this file as the starting point of your own model.""" import logging import keras from openfl.federated import KerasTaskRunner from src.model import CNNModel logger = logging.getLogger(__name__) class KerasCNN(KerasT...
a4458b15b3530c3c3871552e95daa45b21591b0220af6b8a51d0f3c52399c64c
Python
2,483
72
"""Facade-level ``progress_bar`` threading tests. The engine-layer permutation/bootstrap functions expose ``progress_bar`` (default False). Before that, the facades below showed bars unconditionally — so unless each facade exposes and forwards the kwarg, the capability is lost entirely (always-off with no knob). These...
1c899e47dcf1145b6c7958cd733a5a9a49f5314c60bea8fcbcbc7ab14c89dffd
Python
2,484
75
# lexical_selection_check.py # Checks the dix file for multiple translations for a single entry for both sides. # Generates two files for each side with ambigious translations. # Output file names: left_variants.txt, right_variants.txt from argparse import ArgumentParser from collections import defaultdict # importin...
19a8031811266f9a6625ac65b6523fed389b6c9deb34c35a8bf7b1f74127334d
Python
2,485
61
from setuptools import setup, find_packages PYRATES_TEAM = "Richard Gast, Daniel Rose" INSTALL_REQUIREMENTS = ['numpy', 'networkx<=3.5', 'pandas', 'ruamel.yaml', 'sympy', 'scipy' ...
6a6000bde4f5dec8852998ea0d4f2d086e016ca7f6f061b663b968acb658507a
Python
2,485
74
from PymoNNto import * from Examples_Paper.STDP_Hom_Norm.Normalization import * from Examples_Paper.STDP_Hom_Norm.STDP import * from Examples_Paper.STDP_Hom_Norm.Homeostasis import * class Basic_Behavior(Behavior): def initialize(self, neurons): neurons.voltage = neurons.vector() self.threshold = ...
d6c319aece0db9e13947e58f8fa704a4b41ce31c8146de5dc27b457e4f1130a9
Python
2,485
90
# ============================================================================== # Copyright 2023 Technical University of Denmark # Author: Nikolas Borrel-Jensen # # All Rights Reserved. # # Licensed under the MIT License. # ============================================================================== from functools i...
3c554ce4eed4d015f4f3cac6b72cae93c67aa508c6a3d4822f5d2728174e0eea
Python
2,486
82
''' Example showing software-timed analog input using nidaqmx-python pynidaqmxegs.ai.softwareTimedVoltageContinuous Purpose Describes how to do software-timed analog input using using nidaqmx-python This is unbuffered or "on demand" acquisition. Demonstrated steps: 1. Create a task. 2. Cr...
3b6f059f747030a67adfaa3fad9dc7474c73d7f81ea4f2769d7c380aed4fe551
Python
2,488
61
import numpy as np import pandas as pd class GetGenes: def __init__(self, gene_tsv): self.genes_df = pd.read_csv(gene_tsv, sep="\t") @staticmethod def _get_first_element_in_list(empty_value, input_list): for i, list_value in enumerate(input_list): if list_value != empty_value:...
7dadb5e8c0bb2540e1513a8f344d9822be21635503573efaf66f0d1bd171fe48
Python
2,489
97
from PyQt5.QtWidgets import QApplication from sleepy.gui.view import View from sleepy.gui.settings.core import Settings from sleepy.gui.exceptions import UserCancel from sleepy.gui.processing.supported import SUPPORTED_FILTERS, SUPPORTED_ALGORITHMS, SUPPORTED_DATASETS class Gui(QApplication): """Used to l...
5485c3138ac0b0b316b94e6eb7bfaf36354db226a3ff18bfd389483f21a48a8a
Python
2,490
94
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Custom input types definition for Click""" import ast import click from openfl.utilities import utils class FqdnParamType(click.ParamType): """Domain Type for click arguments. This class is used to validate that a command l...
be1d923c6eb895a1aab27166050a477e62f564ea159ed094130e198b01836b96
Python
2,490
73
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 List, Callable logger = RankedLogger(__name__, rank_zero_only=True) _URL_TRAIN = "https://figshare.com/ndownloader/files/25605734" _URL_VAL = "h...
d129152977c9bfae0dc12627209681707e9a7b67764607b965dd3e93e036fc56
Python
2,492
73
import pytest import unittest import torch import torch.utils.data as tud from reinvent.runmodes.utils.helpers import set_torch_device from reinvent.models.model_mode_enum import ModelModeEnum from reinvent.models.libinvent.models.dataset import Dataset from reinvent.models.libinvent.models.model import DecoratorMode...
5198f49cbe0ea248a493c27ef93354a692e6a4ee93d5ce2335e21185e4b748e2
Python
2,495
94
import matplotlib as mpl import matplotlib.pyplot as plt from sanpy.sanpyLogger import get_logger logger = get_logger(__name__) import sanpy from sanpy.interface.plugins import sanpyPlugin class exampleUserPlugin1(sanpyPlugin): """ Plot x/y statistics as a scatter Plot-stat definitions come from sanpy...
9c74111aaa22c82f764e108048f5af020037c04efaa1ccedd1c162acf4dc63fc
Python
2,496
73
""" Calculate the period between two consecutive waves for each wave. """ from pathlib import Path import neo import numpy as np import quantities as pq import matplotlib.pyplot as plt import seaborn as sns import os import argparse import scipy import pandas as pd from utils.io_utils import load_neo, save_plot from u...
acd340e2a7172ece0a03c305e53dde62de616b4ff9626860b9d9042d901eb100
Python
2,496
72
# Copyright (C) 2020-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """You may copy this file as the starting point of your own model.""" from openfl.federated import PyTorchDataLoader from src.mnist_utils import load_mnist_shard class PyTorchMNISTInMemory(PyTorchDataLoader): """PyTorch data loade...
168867ced5ec0f1f59744f0d6bdce55b4fbb0add5e014cc3437fe8e5825400dc
Python
2,497
73
# Copyright (C) 2020-2023 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """You may copy this file as the starting point of your own model.""" from openfl.federated import PyTorchDataLoader from src.mnist_utils import load_mnist_shard class PyTorchMNISTInMemory(PyTorchDataLoader): """PyTorch data loade...
9c3d38e08853da738e81a25658780684a72a235b33e08b7b996890cb16b4012b
Python
2,498
89
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 14 12:06:13 2023 @author: egemo """ from .component_utils import (refractory, refractory_variabletimestep, delayed, WinnerTakeAll, ...
b7404d5f3e08d0eb32a29f75acbe10b73061ec34a02b2b9320a930d14f51fe16
Python
2,502
63
from pathlib import Path def write_launch_file(file_path: Path, function_call_str: str, on_berzelius: bool): assert not file_path.exists(), 'launch file already exists' print(f'{file_path.stem}: {function_call_str}') with open(file_path, 'w') as f: f.write('#!/bin/bash \n\n') if on_berzeli...
7d0d7fe83699508e9a82fb428dc17961cdc383c26ab4764a52b18061910006eb
Python
2,503
78
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
40c6b5fc2d05dc176e48c4c3ed61d3284fcca8b787771284288256fb8d0e26ff
Python
2,505
67
import numpy as np from neuron import h import LFPy def morph2Segs(cellID): data = np.loadtxt(cellID) arbours = list() somaPoints = np.argwhere(data[:,1]==1) for i in somaPoints: temp = get_child(int(data[i,0]),data).tolist() if(len(temp)>0): arbours.append((i,temp)) seg...
822bf6def527454b031cc2a1ca73dff780805dd5d342122a56fe4ff02c00bcc2
Python
2,505
87
"""Standalone benchmark script. Run with ``python tests/benchmarks.py`` for the default backend, or pass ``--backends <b1>[,<b2>,...]`` to time the same workload against any subset of PyRates' active backends. Examples: python tests/benchmarks.py python tests/benchmarks.py --backends default,jax python te...
1b0fe5061e5e4a36c35b414bb3dfadc7c0dfdaff196a58528caf1ad5bcce150a
Python
2,507
67
""" Check whether the input data representation adheres to the stage's requirements. Additionally prints a short summary of the data attributes. """ import numpy as np import argparse import warnings import re from utils.io_utils import load_neo from utils.parse import none_or_str CLI = argparse.ArgumentParser() CLI...
0168a44c2c2d5c15dea077480b1c1f5fec897b8d225ff95aac7d8d8c1dbff041
Python
2,508
56
# 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 torch.utils.data import Dataset from typing import Dict, Union class SubsetByRandomSlice(torch.utils.data.Subset): """Subset of dataset by slicing a random permutation of the dat...
2905adb546be199a414de306f9a22767a8f09589f6c9b0b9a3e66bddb5629ad0
Python
2,508
73
""" Calculate the period between two consecutive waves for each wave. """ from pathlib import Path import neo import numpy as np import quantities as pq import matplotlib.pyplot as plt import seaborn as sns import os import argparse import scipy import pandas as pd from utils.io_utils import load_neo, save_plot from u...
7cfef30ec59f960873b2693a476467646dbd810dd2f93ed1033338e18a845a26
Python
2,510
70
# 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...
fd1f53183d91bb0e5c78de7de0d67aff45a761801f39d668929078d48c4eae58
Python
2,511
61
import torch import torch.nn as nn from torch_geometric.utils.loop import add_self_loops from dig.xgraph.models.utils import subgraph from dig.xgraph.method.base_explainer import ExplainerBase class RandomSelectorExplainer(ExplainerBase): def __init__(self, model: nn.Module, explain_graph: bool = False): ...
85365b95457d014e2da1f7651f6987472553fa05eae532c644f310e8e316fcf2
Python
2,512
81
# Copyright (C) 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """You may copy this file as the starting point of your own model.""" import logging import keras from openfl.federated import KerasTaskRunner from src.model import CNNModel logger = logging.getLogger(__name__) class JAXCNN(KerasTas...
4b430af2235d17bbed9a18d307de37db4b3f67de7e3adb03ad75b4dac9114bcc
Python
2,513
54
import unittest from rdkit.Chem.rdmolfiles import MolToSmiles from reinvent.chemistry import conversions from reinvent.chemistry.library_design import bond_maker, attachment_points from reinvent.chemistry.library_design.fragment_reactions import FragmentReactions from tests.chemistry.library_design.fixtures import ( ...
f1aedd6fe9656553dd4d1e81f4e260fdf30581885f54ebed246fc2e91cfb1450
Python
2,514
82
from tensorflow import math from tensorflow.keras.layers import Layer import tensorflow.keras.backend as K def gelu_(X): return 0.5*X*(1.0 + math.tanh(0.7978845608028654*(X + 0.044715*math.pow(X, 3)))) def snake_(X, beta): return X + (1/beta)*math.square(math.sin(beta*X)) class GELU(Layer...
599ca30a1ebb06745e8727ebbf56a20d9feb111505f141fb978d38abb660105a
Python
2,516
67
""" Check whether the input data representation adheres to the stage's requirements. Additionally prints a short summary of the data attributes. """ import numpy as np import argparse import warnings import re from utils.io_utils import load_neo from utils.parse import none_or_str CLI = argparse.ArgumentParser() CLI...
eded00728ac11bec759d543c934c0bcace7197ce9904c19166e5e027a1da2bd0
Python
2,516
77
import numpy as np from .record import Record class PQ(Record): __attributes__ = ['vectors', 'dim', 'qdim', 'centroids', 'indexes', 'codes'] def __init__(self, vectors, dim, qdim, centroids, indexes, codes): self.vectors = vectors self.dim = dim self.qdim = qdim self.centroi...
2d919084993ddd867a5cf5e3d3d07504bfb32c80391d107766bc341522a13615
Python
2,519
77
import os import pickle import torch from torch.utils.data import Dataset, DataLoader from torch_geometric.data import Batch import lmdb import random class ConfLmdbDataset(Dataset): def __init__(self, root, split, max_confs, training=False): self.max_confs = max_confs self.split = split s...
473fdef9a1ffb7bca81bd2e62eab526c3f06d5f7688cfd4b11709f4f9f9fd5f2
Python
2,519
71
import geomstats.backend as gs from geomstats.geometry.base import ImmersedSet from geomstats.geometry.euclidean import Euclidean from geomstats.geometry.invariant_metric import BiInvariantMetric from geomstats.geometry.pullback_metric import PullbackDiffeoMetric from geomstats.test_cases.geometry.diffeo import CircleS...
5f1a77ad2d0847a66fd5bb5c345538b617336890c1b4d5a92e0704be852f33b2
Python
2,522
66
"""A failed model download must not leave anything at the cache path. _urlretrieve_with_timeout renames the body into place as soon as the HTTP fetch succeeds, which is before the caller inspects the content type. An error page served with 200 therefore lands exactly where the checkpoint belongs. Since every loader gu...
a52c2375e363b4f35a5f9287cb9684f4d9b67584184b12b7e7b45df78a63316f
Python
2,522
73
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # import torch from torch import nn from typing import Optional from copy import deepcopy import argparse class EMA(object): """ For a given model, this class computes the exponential moving average of weigh...
164c44656fe54abca4deb1b4150267f4959ce85dd9c9b43532f8fc107aac6470
Python
2,524
42
#*----------------------------------------------------------------------------* #* Copyright (C) 2024 ETH Zurich, Switzerland * #* SPDX-License-Identifier: Apache-2.0 * #* * ...
44b11205db586240e76aafe9ca9d5a65e93d8c1ed910e32da6eefa28a8501e7c
Python
2,525
79
from unittest import result import pandas import pubchempy import json from urllib.error import HTTPError import time def get_map_inchikey_to_CID(inchikey): mols = pubchempy.get_compounds(inchikey, 'inchikey') return {mol.inchikey: mol.cid for mol in mols if mol is not None} def get_map_inchikey_to_synonyms(...
6fcaf5c742be97ca558e0373da01b025b73d88bb9353c6442029989b9ffd8e4e
Python
2,527
63
""" Create a plot of the channel-wise and average power spectrum density. """ import numpy as np import quantities as pq import argparse import matplotlib.pyplot as plt import seaborn as sns from elephant.spectral import welch_psd from utils.io_utils import load_neo, save_plot from utils.parse import none_or_float CL...
b4ab0aac45202e7e0f00702a28583ce1348ea29d47b7ddc520e7e6b6bdb21606
Python
2,528
87
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # from .base_criteria import BaseCriteria import os import importlib from utils import logger import argparse LOSS_REGISTRY = {} def register_loss_fn(name): def register_loss_fn_class(cls): if name in L...
efa2a9afb3374d73403fc03a8f040ee4474d678e35c8e69e4411457d0499501f
Python
2,528
81
# -*- coding: utf-8 -*- # # # PyRates software framework for flexible implementation of neural # network model_templates and simulations. See also: # https://github.com/pyrates-neuroscience/PyRates # # Copyright (C) 2017-2018 the original authors (Richard Gast and # Daniel Rose), the Max-Planck-Institute for Human Cogn...
4f3b8f30f7bbf4d6ad653a5e9f45ad79833da9a2f0c586cd9bbc1889b4ac9911
Python
2,529
81
import torch import numpy as np from corgie import constants, exceptions from corgie import helpers STR_TO_LTYPE_DICT = dict() def register_layer_type(layer_type_name): def register_layer_fn(layer_type): STR_TO_LTYPE_DICT[layer_type_name] = layer_type def get_layer_type_name(obj): ...
f7e285ecee706adcb1e056341c8ecff28ef19b71ac4604d9cd1e3269d51fe034
Python
2,529
56
import numpy as np # import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from sklearn.manifold import TSNE if __name__=="__main__": best_split_id = [2, 2, 2, 2] # correspoding to split index for S1, S1, S3, and S3 hcp_sessions_list = ['LR_S1', 'LR_S1', 'RL_S1', 'RL_S1'] # models S1, S1...
82cef8bd973981e874228ac40f1350b44adf5daefdf4ef8545610649cf861363
Python
2,532
108
import unittest from reinvent.models.reinvent.models.vocabulary import SMILESTokenizer from tests.test_data import IBUPROFEN, NONSENSE class TestSmilesTokenizer(unittest.TestCase): def setUp(self): self.tokenizer = SMILESTokenizer() def test_tokenize(self): self.assertListEqual( ...
c4c1b5245759f5b9228e661fab1b8ae239cf42a802fd9754e58c57b8508e5ce7
Python
2,532
79
"""Shared helpers for Adjacency submodules. These are internal utilities used by the facade and submodules — not part of the public API. """ from copy import deepcopy import numpy as np import polars as pl def _perform_arithmetic(adj, y, op, op_name, reverse=False): """Perform arithmetic operation with validat...
900a574a83fe7d8384e9b584b4d34397265d07a3d423bec9f175748230daccc6
Python
2,533
98
"""Callables to provide a termination criterion for Reinforcement Learning""" from __future__ import annotations __all__ = ["terminator_callable"] import logging from typing import Callable import numpy as np from numpy.polynomial import Polynomial logger = logging.getLogger(__name__) terminator_callable = Callable...
93b494fcb24f6614bd6877e1090794f4484a9289c8fe98df22844d4c861601b7
Python
2,533
61
"""Decide whether a requested GNC should run, from the inputs' BIDS sidecars.""" import json import warnings from collections.abc import Sequence from pathlib import Path from colorama import Fore def _read_nonlinear_gradient_correction(sidecar: str | Path) -> bool | None: """Return the BIDS NonlinearGradientCo...
d67cad94e14ac9ff5d4cfd3ff525776c710bceaa24b3e1453aacc6d1e671f972
Python
2,533
68
""" Check whether the input data representation adheres to the stage's requirements. Additionally prints a short summary of the data attributes. """ import numpy as np import argparse from pathlib import Path import warnings import re from utils.io_utils import load_neo from utils.parse import none_or_str CLI = argp...
1f2037764177795930168c52cb1e0a0f883930a46c75833960c8900904f496e1
Python
2,534
42
#*----------------------------------------------------------------------------* #* Copyright (C) 2024 ETH Zurich, Switzerland * #* SPDX-License-Identifier: Apache-2.0 * #* * ...
70962e7cd9233b7c39b05756e576226c90300617cd6c146351f628d6a0895f23
Python
2,534
68
""" Check whether the input data representation adheres to the stage's requirements. Additionally prints a short summary of the data attributes. """ import numpy as np import argparse from pathlib import Path import warnings import re from utils.io_utils import load_neo from utils.parse import none_or_str CLI = argp...
7ac154ea95ab21b4fc489aad16dffffcea757d3afc2fb02989f9bcf526001e9f
Python
2,534
74
""" Calculate the period between two consecutive waves for each wave. """ from pathlib import Path import neo import numpy as np import quantities as pq import matplotlib.pyplot as plt import seaborn as sns import os import argparse import scipy import pandas as pd from utils.io_utils import load_neo, save_plot from u...
c6feea2a9713b7f92aba59cdf9f75576601569ae140da197aa7cfaef787508ed
Python
2,535
85
""" credit: https://github.com/gpleiss/temperature_scaling/blob/master/temperature_scaling.py """ import torch from torch import nn, optim import utils import train import random class ModelWithTemperature(nn.Module): def __init__(self, model): super(ModelWithTemperature, self).__init__() self...