sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
a402556faf318df5ec0c18d4c9fb912f4d39fdc8490dbdf3164551a6f8ca45dd
Python
972
35
def win_ops(): data = "" with open("D:\\Repos\\LungTumorSegmentation\\Resources\\train_data_win.yaml", "r") as f: data = f.read() data_split = data.split("label") new_data = "" ds = [] for i in data_split[3:]: ds.append(i.split(",")[0].split("\\")[2].split("'")[0]) for...
ed1bf14e2ba90e2b04da6d35469b213daa867b6d7ee90b031b4d3f638edbb32a
Python
972
36
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """openfl.utilities.data_splitters.data_splitter module.""" from abc import ABC, abstractmethod from typing import Iterable, List, TypeVar T = TypeVar("T") class DataSplitter(ABC): """Base class for data splitting. This class s...
3ecaa2b660776c4c5d5403125a3530475e520656f93c8893783d0a7385d42d51
Python
973
40
class Parameter: def __init__(self, title, fieldType, default): self.descriptor = { "title" : title, "fieldType" : fieldType, "default" : default } class ParameterBase: def getBuildTree(control): """Creates a build tree from the list...
59e9f11312dab803a09153c43aaf18a37747e566637835eca2a221f56c89f1f3
Python
973
29
from pymonntorch.NetworkCore.Behavior import Behavior from sympy.physics.units import convert_to, second, seconds class Clock(Behavior): def __init__(self, *args, step="1*ms", **kwargs): super().__init__(*args, step=step, **kwargs) def initialize(self, neuron_or_network): super().initialize(...
db156591626380adf6346620e3ece9f88e78fb78d34d675b2cd63e55aafd3229
Python
975
29
import numpy as np from dival.evaluation import TaskTable from dival.measure import PSNR, SSIM from dival.reconstructors.odl_reconstructors import FBPReconstructor from dival.datasets.standard import get_standard_dataset np.random.seed(0) # %% data dataset = get_standard_dataset('ellipses', impl='astra_cpu') test_dat...
a54ebef755c2cc7a3434101c92200c8f63f2eb9e0792b6ea1f9722e2dba6e333
Python
976
32
"""Data classes for neuroimaging analysis. `BrainData` (masked voxel data), `Adjacency` (similarity/distance matrices), `DesignMatrix` (regressors), the `Roc` analysis class, the `Simulator`/`SimulateGrid` data simulators, and the frozen result records those classes return (`FitResult`, `PredictResult`, `BootstrapResu...
aca10501560fa53f19e02934af8e436907cd083b544a83335d81f271e97fd847
Python
976
31
import subprocess import os def extract_seqs(genomes_folder, output_folder, labels): genome_files = [] for file in os.listdir(genomes_folder): if file.endswith(".fasta"): genome_files.append(file) for genome_file in genome_files: genome_name = os.path.splitext(genome_file)[0]...
388114e3ae9ea784631880a21e041068bbd8aeef3192b7593a1406e7730cdd98
Python
977
31
import unittest from reinvent.chemistry import tokens from reinvent.models.linkinvent.model_vocabulary.paired_model_vocabulary import ( PairedModelVocabulary, ) from reinvent.models.linkinvent.model_vocabulary.vocabulary import ( create_vocabulary, SMILESTokenizer, ) from tests.test_data import WARHEAD_PA...
dabc1de71c441cbbd7ea3039eb9a4905a7e561b88bff13209191685580168573
Python
979
37
import os import subprocess import time from collections import defaultdict, deque import datetime import pickle from packaging import version from typing import Optional, List import torch import torch.distributed as dist from torch import Tensor # needed due to empty tensor bug in pytorch and torchvision...
dea206f9d8a9da248fcbecd641bb3290030de33aae74040bafeeb03a9046c9e5
Python
980
38
''' Remove words occur less than min_count times throughout the corpus ''' import sys import numpy as np import pandas as pd from scipy import sparse import itertools import os w2cnt = {} DATA_DIR = 'D:/UB/research/dataset/20newsgroups/' def wordCount(pt): print('counting...') for l in open(pt)...
0b672ea4ce2e7cd1e2f617ecdb5ba41d8bf6825d44cf6670e8c737f887139a1d
Python
982
26
from unittest import TestCase from curtainutils.client import parse_curtain_from_json, CurtainClient class Test(TestCase): def test_parse_curtain_from_json(self): json_path = r"C:\Users\Toan Phung\curtain_media\files\curtain_upload\0a0d33de-478b-4654-8cec-811a86400062.json" parse_curtain_from_json...
0a7d361c33127698b9c2d9619922cc5e5174f831c62b4227b3fee5c8ba5aca67
Python
983
34
"""The pydFC toolbox. Submodules --------- dfc_methods --- implementation of dFC methods multi_analysis --- multi analysis class implementing multiple dFC methods simultaneously time_series --- time series class dfc --- df...
914a50aaa91846b38a9a9866272d1cf2da1ec1e1016107904fea85db186d8e10
Python
984
16
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openfl.interface.aggregation_functions.adagrad_adaptive_aggregation import ( AdagradAdaptiveAggregation, ) from openfl.interface.aggregation_functions.adam_adaptive_aggregation import AdamAdaptiveAggregation from openfl.interface.a...
0a5a9ac084eda6514605a133abc0e5d1f1b9a4e181f1ccb39b6f82d8cf4a6076
Python
986
31
# Copyright (C) 2020-2023 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Path checks tests module.""" import os from pathlib import Path import pytest from openfl.utilities.path_check import is_directory_traversal @pytest.mark.parametrize( 'directory,expected_result', [ ('first_level', Fals...
305fe353bc918624f19a65b26e4a94c38206626b6419a21e172bf209ef7393c2
Python
986
37
"""The Reinvent optimization algorithm""" from __future__ import annotations __all__ = ["ReinventLearning"] import logging from typing import TYPE_CHECKING import numpy as np from reinvent.models.model_factory.sample_batch import SmilesState from .learning import Learning if TYPE_CHECKING: from reinvent.scorin...
9467406a1bd9c05ca7b57420fd6daf2f054752e600ff88890cf2718816277b6a
Python
986
53
from brian2 import * import time from globparams import * defaultclock.dt = 1*ms prefs.core.default_float_dtype = float32 eqs_neurons = ''' dv/dt = (ge + rand() - v * OM_DECAY) / (1*ms) : 1 dge/dt = -ge / (1*ms) : 1 dspiked/dt = -spiked / (1*ms) : 1 ''' N = NeuronGroup(SIZE, eqs_neurons, threshold='v>VT...
02e0d23daeb5ae32e66bfe2adbe0f9d16133cfb5366a846f18d4c447c6ee4317
Python
987
28
import torch import torch.nn as nn def get_initializer(non_linearity: str = "relu"): non_linearity = non_linearity.lower() if non_linearity == "selu": # fix pytorch gain for SNN non_linearity = "linear" def initializer(m): if isinstance(m, nn.Linear): if non_linearity...
c87026261507c595916814fc78454d18418b0ca574ce38bf8d7c399b7df21e77
Python
987
33
import os import glob import paddle from paddle.utils.cpp_extension import CppExtension, CUDAExtension, setup def get_extensions(): root_dir = os.path.dirname(os.path.abspath(__file__)) ext_root_dir = os.path.join(root_dir, 'csrc') sources = [] for ext_name in os.listdir(ext_root_dir): ext_dir...
ce83d904c7034d26efbb90c0caf4baca6fcc50452a5fc9e5492fcdc75c3439b7
Python
988
33
import SimpleITK as sitk import glob import os import platform directory_split = "\\" if platform.system() == "Windows" else '/' def read_itk(filename): return sitk.ReadImage(filename) def read_dicoms(dicom_folder): reader = sitk.ImageSeriesReader() dicoms = reader.GetGDCMSeriesFileNames(dicom_folder) ...
01fd77ab60ac5df9b562f72ff95c1a6991dd6be4d3db993c8b1d7c534d63fe4f
Python
989
47
#!/usr/bin/env python """ Setup module for ModelAngelo """ import os import sys from setuptools import setup, find_packages sys.path.insert(0, f"{os.path.dirname(__file__)}/model_angelo") import model_angelo project_root = os.path.join(os.path.realpath(os.path.dirname(__file__)), "model_angelo") setup( name=...
e77039cd4f31c753dbd80ce1ab7dd28b8e0e0ea48a4c1736fa6a3ef99f01acca
Python
989
28
import torch.nn as nn from reinvent.models.transformer.core.network.encode_decode.clones import clones from reinvent.models.transformer.core.network.encode_decode.sublayer_connection import ( SublayerConnection, ) class DecoderLayer(nn.Module): "Decoder is made of self-attn, src-attn, and feed forward (defin...
23c2a13e494a1ccddc32d7935eaebd8ef840c0cd3f9e520a5234293b9d63952a
Python
990
42
import argparse from ase.io import iread from nequip.utils.test import compare_neighborlists def main(): parser = argparse.ArgumentParser( description="Compares neighborlist implementations (ase, matscipy, vesin) on an ASE-readable file." ) parser.add_argument( "-fname", help="nam...
dfb4a271885fd672d2ce9a99e459d007744d42ccc73005e78d36f00a5d00ca53
Python
990
38
"""BrainData-specific test fixtures.""" import pytest import numpy as np from nltools.data import BrainData @pytest.fixture(scope="function") def small_brain_data_for_cv(): """Fast fixture for CV testing: 24 samples, 10 features, 5 voxels.""" import nibabel as nib np.random.seed(42) spatial_shape ...
a60d54a053a8db1d242d08affb164c13a716dbc0d99872db1bbfa35a39a40a6e
Python
991
43
import itertools as it from typing import Iterable, Sequence, TypeVar import more_itertools as itx T = TypeVar("T") def unpack(iterable: Iterable[T], default: Sequence[T]) -> Iterable[T]: """Return default if iterable has no elements. Allows safe unpacking of possibly empty iterables Parameters --...
ab3f0d0af45824843ba2d9607049fe59b6800a3efa1786bc144a77eaf834a587
Python
991
35
"""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" amino_acid_library_file: str = "nnaas.csv" smiles_column: str = "SMILES" aa_na...
3bdb9cb5d6fd641b43b64328b3aed012829e81c5332a5aed257d20e432c529df
Python
992
29
# Generated by Django 4.1.1 on 2022-11-23 12:32 from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('celsus', '0031_curtain_file'), ] operations = [ migrations.CreateModel( ...
85483bd6ec498731b86decb86167d15d60c019b07db920cfc8803f44f71c660a
Python
993
35
from setuptools import find_packages, setup setup( name='NeuroDecode', version='0.9dev', author='Kyuhwa Lee, Arnaud Desvachez', author_email='lee.kyuh@gmail.com, arnaud.desvachez@gmail.com', license='The GNU General Public License', url='https://github.com/fcbg-hnp/NeuroDecode/', descriptio...
06a5bbe4e3236cab1312b5bf1d3da6612099499e3bbe7376de663ebf81182a8c
Python
996
37
from setuptools import setup from codecs import open from os import path current = path.abspath(path.dirname(__file__)) INSTALL_REQUIRES = [ 'matplotlib>=3.5.1', ] EXTRAS_REQUIRE = {} with open(path.join(current, 'README.md'), encoding='utf-8') as f: long_description = f.read() setup( name='myforestplot'...
0b1ce548322c595a9cdcd7b2640ea6d5975875fecc1e0391da8a2346c30325c5
Python
997
36
# 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. """isort:skip_file""" import importlib import os from fairseq import registry from fairseq.criterions.fairseq_criterion import ( # noqa ...
34f8c01cba434ede2d849482849df8ac23cc2a54e78400cd8eb6ac94a642f9b7
Python
997
25
import pytest import geomstats.backend as gs from geomstats.test_cases.learning._base import BaseEstimatorTestCase class ClusterInitializationTestCase(BaseEstimatorTestCase): @pytest.mark.random def test_initialization_belongs(self, n_samples, atol): X = self.data_generator.random_point(n_points=n_sa...
67fba83b2e306df23119c8cdc55eac00321cf4bff502b6420203d5de9d3a533c
Python
998
38
import re from docutils import nodes from docutils.parsers.rst import Directive from docutils.statemachine import StringList from sphinx.application import Sphinx from sphinx.util.nodes import nested_parse_with_titles from idtrackerai.start.arg_parser import get_argparser_help class IdtrackeraiArgparser(Directive):...
60ae4c28d43785fbb83a78458c9b996c8bd12729e78da5e96bde13c27ebcc4f6
Python
999
32
""" Replace the data signal value with their corresponding Hilbert phase. """ import numpy as np from elephant.signal_processing import hilbert import argparse import os from utils.io_utils import load_neo, write_neo CLI = argparse.ArgumentParser() CLI.add_argument("--data", nargs='?', type=str, required=True, ...
8c443a6c8e15dfba46e59e3a73ab33648491a0841e72a84ffd44bcebed885627
Python
999
40
import numpy as np from enum import Enum, auto from .mesh_parser import FoamMesh def polyarea(x, y): return 0.5 * np.abs(np.dot(x, np.roll(y, 1)) - np.dot(y, np.roll(x, 1))) def project(points, vectors): return np.dot(points, vectors.T) class Parser(Enum): POINTS = auto() FACES = auto() BOUNDA...
627d55253463756818af02e09a8553d5be118178e2a4851e3c88e43728ceaf17
Python
1,000
21
from PymoNNto.Exploration.Network_UI.Sequence_Activation_Tabs.sidebar_grammar_module import * from PymoNNto.Exploration.Network_UI.Sequence_Activation_Tabs.sidebar_image_module import * from PymoNNto.Exploration.Network_UI.Sequence_Activation_Tabs.reconstruction_tab import * from PymoNNto.Exploration.Network_UI.Sequenc...
25a6dd8ff55991e1986eda0e0043d0b555ecb515e405474883565e53f5275ad4
Python
1,001
26
import os import boto3 from botocore.exceptions import ClientError from celsus.models import Curtain s3 = boto3.resource( service_name='s3', aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', 'your-spaces-access-key-id'), aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', 'your-spaces-secret-...
2b14507df6e4754c05ca8334520981494dcf6bbaa731ebaa196b074d48e6a295
Python
1,002
48
# Copyright (C) 2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openfl.federated.data.loader import DataLoader class NoOpDataLoader(DataLoader): """No-op data loader. This class is used when no data loader is needed. """ def __init__(self, **kwargs): """Initializes the NoOp...
cf5a06aae562e1a59255828c54221e6b254c5fab0376cb64754c90937b6377c3
Python
1,002
39
from PymoNNto import * import nest class Nest_embedding(Behavior): def initialize(self, neurons): # define resolution nest.SetKernelStatus({'resolution':1.0}) # define neuron model self.G = nest.Create( "iaf_psc_delta", 1, params={ 'E_L': 1.0, ...
dbd036bce07ae287637e79b4afa9678d47fd19e87c1066decb267e44f2192ff3
Python
1,002
41
#!/usr/bin/env python3 """Update the contents of CONTRIBUTORS.txt based on .all-contributorsrc.""" from json import load from os import chdir from pathlib import Path HEADER = """\ Thanks go to these wonderful people: """ FOOTER = """\ This project follows the [all-contributors][1] specification. Contributions of...
124f030dad9a41a07c51eca41d7dff2791c6f044057896d07ee2a1cd5358ae3d
Python
1,003
28
# 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 appli...
87702fabb9bfed7c50b44ba3ca3a56a1aa95ad92a4d5a295d3c9ea59bb0b9fb1
Python
1,003
37
import torch.nn as nn from reinvent.models.transformer.mol2mol.mol2mol import Mol2MolModel from reinvent.models.transformer.core.network.encode_decode.model import EncoderDecoder from reinvent.models.transformer.core.vocabulary import Vocabulary from reinvent.models import meta_data def _init_params(parameters): ...
fc5c69ac6c03252c0299ff638d32366b797afb46b64d15695cd6681111aeafe2
Python
1,003
38
# ============================================================================== # Copyright 2023 Technical University of Denmark # Author: Nikolas Borrel-Jensen # # All Rights Reserved. # # Licensed under the MIT License. # ============================================================================== import jax as jn...
45738a5c79c76be426a9d2b865e0291b712bb4f31505d716636882bd4042b9ff
Python
1,005
31
"""nltools.plotting — visualization utilities for neuroimaging analysis. `component_viewer` is the one function users call directly. Everything else here is the drawing internal behind a data-class method — `BrainData.plot_surf`, `Roc.plot`, `Adjacency.plot_silhouette` and friends — organized into focused submodules: ...
81c4fc69c428c7df57027a1287d765249b9dadc95645177abcadee857383c728
Python
1,005
30
# 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...
e509f3b907de07f2004fc2e8d508e665d3ab0eb5fe8b530370d7c49700a829dc
Python
1,007
32
"""Shared pytest fixtures for SanPy interface tests.""" import pytest from sanpy.interface.sanpy_app import SanPyApp from sanpy.sanpy_paths import SanPyPaths @pytest.fixture(scope="session") def qapp_cls(tmp_path_factory: pytest.TempPathFactory) -> type[SanPyApp]: """Use an isolated SanPy application for every ...
022ec309aa9cd4cc02213aa0892bf4c4c6ec6112df001485b0c2b8bf68b0c4d3
Python
1,008
43
from typing import TYPE_CHECKING if TYPE_CHECKING: from sniffles.config import SnifflesConfig from sniffles.sv import SVCall def get_config(*args, **kwargs) -> 'SnifflesConfig': if '--input' not in args: args = list(args) + ['--input', 'input.bam'] if '--vcf' not in args: args = list...
6770d5c823272676a492a38070a2f62f2143a0895f11e2d08ae58b8dec59c220
Python
1,009
37
from setuptools import setup, find_packages def readme(): with open('README.md') as f: return f.read() setup(name='gemmr', version='0.4.0', author='Markus Helmer', url='https://github.com/murraylab/gemmr', description='Generative Modeling of Multivariate Relationships', long_...
21e130153a7ef6d2a164e8190fe7c64a14ecde795a040daec05bde6f3de0e468
Python
1,010
39
import random from geomstats.test.data import TestData class BaseEstimatorTestData(TestData): MIN_RANDOM = 2 MAX_RANDOM = 5 def generate_random_data(self, marks=()): return self.generate_tests( [dict(n_samples=random.randint(self.MIN_RANDOM, self.MAX_RANDOM))], marks=mark...
4fb3887d739d342252552cad4bc47c8a87aaf5f98c2db5935f62d79a5af5de83
Python
1,010
34
""" Merge pandas DataFrames based on the values of selected columns. """ import argparse import pandas as pd from copy import deepcopy CLI = argparse.ArgumentParser() CLI.add_argument("--data", nargs='+', type=str, help="path to input data in neo format") CLI.add_argument("--output", nargs='?', type=...
858205f7ff87744d4c4c54610d4e63a3e3d4778dd9c852f1925ca0f697d326df
Python
1,011
26
import geomstats.backend as gs from geomstats.test.test_case import TestCase class HyperbolicEmbeddingTestCase(TestCase): def test_log_sigmoid(self, point, expected, atol): res = self.embedding.log_sigmoid(point) self.assertAllClose(res, expected, atol=atol) def test_grad_log_sigmoid(self, po...
1065ace89b39a46163ba02e58730cd38cf6ad065af9274d52aca9436bcfcc293
Python
1,013
50
from IPython.core.display import display, HTML from sleeprnn.common import constants PALETTE = { constants.RED: "#c62828", constants.GREY: "#455a64", constants.BLUE: "#0277bd", constants.GREEN: "#43a047", constants.DARK: "#1b2631", constants.CYAN: "#00838F", constants.PURPLE: "#8E24AA", } ...
7353395f2589ed40f1830a0557b7706dc68bb3d21fd28f0c0e0f59ce3b1e77ee
Python
1,013
40
import os from pathlib import Path def read_params_from_file(folderPath, txtFile): """ Loads the parameters from a txt file. path = folder path txtFile = file containing the params to load """ file = open(os.fspath(folderPath / txtFile)) params = file.read().splitlines() file.close() ...
98266c2f5bbebcd4e9adcf0b8a7f8a4f1f891642958ca505500bc15cb3ffa389
Python
1,013
33
import cv2 import time from overlay import ConfigurableOverlay, ImageOverlay class TimestampVisualizer(ConfigurableOverlay): default_params = { **ConfigurableOverlay.default_params, "time_format": "%Y-%m-%d %H:%M:%S", "color": 255, } def apply(self, img, timestamp): stime ...
86ece9275317fd5e2bd4152ea6b8a8ccdcf296d7d8c6323a2f6d72192241d64f
Python
1,014
35
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # from torch.nn import functional as F from torch import Tensor import argparse from . import register_classification_loss_fn from .. import BaseCriteria @register_classification_loss_fn(name="binary_cross_entropy"...
24d0e70a1b09f287bc5cc0213f4fb669b389beb20b35f5300049c91859cf2561
Python
1,015
29
import torch import torch.nn as nn from torch.autograd import Variable class LabelSmoothing(nn.Module): "Implement label smoothing." def __init__(self, size, padding_idx, smoothing=0.00): super(LabelSmoothing, self).__init__() self.criterion = nn.KLDivLoss(size_average=False) self.pad...
cd9c5fdd59c11f6ae63ffc1d9a35810313e39a640714e58542a7375865c44fef
Python
1,016
34
""" Merge pandas DataFrames based on the values of selected columns. """ import argparse import pandas as pd from copy import deepcopy CLI = argparse.ArgumentParser() CLI.add_argument("--data", nargs='+', type=str, help="path to input data in neo format") CLI.add_argument("--output", nargs='?', type=...
ffa41ad41f59b683a1b596c911392de00781ac0935b117fe9e7f014b4b773d97
Python
1,016
21
"""Proofread the pinned structure dataset against completed current VDJdb tables. Run via the repository environment. --fetch stages immutable hosted inputs; the default verifies an existing local mirror. No source records or coordinates change. """ from pathlib import Path import argparse import json from vdjdb.vali...
aef6f80cfde65b81d51aed3bad848a91e1d7edde5dca90e4839753713d0c102c
Python
1,018
32
import argparse import pandas as pd import numpy as np from keras.models import load_model # Create an argument parser parser = argparse.ArgumentParser(description='Load data, make predictions, and save results.') parser.add_argument('file_name', type=str, help='Path to the data file') args = parser.parse_args() # L...
8c317806c4eeb69b5339dcd0cfa2750a56e7ae2f6aff06504c3a25dfa3685265
Python
1,019
36
from dig.ggraph.dataset import ZINC800 import shutil def test_zinc800(): root = './dataset/ZINC800' dataset = ZINC800(root) assert len(dataset) == 800 assert dataset.num_features == 9 assert dataset.__repr__() == 'zinc_800_jt(800)' assert dataset.get_split_idx() is None assert len(da...
b59dcf8454a65afa8983f90a4d30f3534be3810f8cc3952036b2fb87b5b9a540
Python
1,019
35
from setuptools import setup, find_packages with open("README.md") as f: long_description = f.read() setup( name="BindsNET", version="0.2.8", description="Spiking neural networks for ML in Python", license="AGPL-3.0", long_description=long_description, long_description_content_type="text/m...
3ea7fb8c7f95482c1492af0b26a6d6dda700db0b8e92f8097fb8d9e89b1acaac
Python
1,020
36
"""The pydFC toolbox. Submodules --------- dfc_methods --- implementation of dFC methods multi_analysis --- multi analysis class implementing multiple dFC methods simultaneously time_series --- time series class dfc --- df...
4785f0db17b78476ac21e98339d2fe7b999fd8a5ef5d858f9f243b2b2fa650d2
Python
1,020
61
# ruff: noqa: F401 from . import ( core, core_min, linsolver, ) from .backend import ( ModBase, ModNumpy, ModTensorflow, ) from .core import ( Array, Domain, Field, MultigridField, NeuralNet, Problem, State, restrict_to_coarser, ) from .history import ( Histo...
5fb23be39972070b4d02f3c207f6abf5aca6bd46361f6abb543938d42a88e47e
Python
1,020
34
# ============================================================================== # Copyright 2025 Technical University of Denmark # Author: Nikolas Borrel-Jensen # # All Rights Reserved. # # Licensed under the MIT License. # ============================================================================== import meshio i...
22bcc1e8215e81b98d00a7672d041c8090500c01f0a58c293eeab5f04f153aed
Python
1,021
47
# List of input file names input_files = [ "CD16p_Mono.vcf", "CL_Mono.vcf", "CM_CD8.vcf", "DN_B.vcf", "EM_CD8.vcf", "Fr_II_eTreg.vcf", "Fr_III_T.vcf", "Fr_I_nTreg.vcf", "Int_Mono.vcf", "LDG.vcf", "mDC.vcf", "Mem_CD4.vcf", "Mem_CD8.vcf", "Naive_B.vcf", "Naive_C...
f7429be82a7e92c35c04623c2087e8d8c870cde145a42f6bcb1cd29ccd345468
Python
1,021
45
import experiment as exp import schedule import time import arena class TimerExperiment(exp.Experiment): default_params = { "interval": 1, } default_blocks = [ {"$num_trials": 2}, {"$num_trials": 3, "interval": 2}, {"$num_trials": 6, "interval": 0.5}, {"interval": ...
2461e036b03b4b95747c6969eb2f41ed36b884ed187e9f8f64d6438ec85c40a2
Python
1,022
27
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. import os import nequip.nn.compile as compile_module from nequip.nn.compile import CompileGraphModel def test_distributed_warm_compile_gate(monkeypatch): """The node-parallel path must be opt-in,...
3d6a9767e287597de4d40eede2fbfb967fb962d0dcef3bb13eebdf46af3589b2
Python
1,022
28
# 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 appli...
20af251927169df156776db16952cde39f6c05850bc51f0dfdd4375a2f9a1e4c
Python
1,023
28
# 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 appli...
44afc90e9bffaa3e3f818dd24e3a340a9d9d401579a12349f6cea18212d372fd
Python
1,023
32
from setuptools import setup from os import path from io import open this_directory = path.abspath(path.dirname(__file__)) def readme(): with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f: return f.read() with open(path.join(this_directory, 'requirements.txt'), encoding='utf-8') as ...
53bb48c9636e03a30363c2608443a9ce1364d96c1a4681dda2ce3f4d0695070c
Python
1,023
40
import tensorflow.keras.backend as K from tensorflow.keras.losses import categorical_crossentropy def generalized_dice(y_true, y_pred): """ Generalized Dice Score https://arxiv.org/pdf/1707.03237 """ y_true = K.reshape(y_true,shape=(-1,4)) y_pred = K.reshape(y_pred,shape=(...
16f640ef988d3029086898dffae93e090b242aeeef4e0204ad9b04fcb6b5df1a
Python
1,025
33
""" Replace the data signal value with their corresponding Hilbert phase. """ import numpy as np from elephant.signal_processing import hilbert import argparse import os from utils.io_utils import load_neo, write_neo CLI = argparse.ArgumentParser() CLI.add_argument("--data", nargs='?', type=str, required=True, ...
e9b4df8201aa183baf4f32426cccedabf6d7f11f0484acdadcba181be0f7c198
Python
1,025
27
# 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 # # Un...
d5b89ba307c83859c7801859ba15e4ebf6949072812025076d374c24ee36e990
Python
1,026
32
"""Tests for canonical experimental metadata.""" import sanpy def test_metadata_uses_canonical_keys_and_schema_defaults() -> None: """Keep values and presentation definitions aligned in display order.""" metadata = sanpy.MetaData() definitions = metadata.getMetaDataDefinitions() assert list(metadata...
de654783232e7c478a25c33fb41b9c523abf1421b358d327ab2c70a9072e884b
Python
1,026
33
""" Replace the data signal value with their corresponding Hilbert phase. """ import numpy as np from elephant.signal_processing import hilbert import argparse from pathlib import Path import os from utils.io_utils import load_neo, write_neo CLI = argparse.ArgumentParser() CLI.add_argument("--data", nargs='?', type=P...
df5c5f72a8998334e08a9b3b2966ba8fc7eca1c5944465bca8aa8a32d114d00e
Python
1,029
28
# 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...
ff974bf97bdcb06ef87da43f956d78cbf104d102d525bf83d806a7013381ce27
Python
1,030
28
from ..abstract_dataset import AbstractDataset import os import numpy as np import matplotlib.pyplot as plt class UnsteadyHeatDataset(AbstractDataset): parametric = True time_dependent = True description = "Parametric heat transfer problem dataset" data_directory = os.path.join(os.path.dirname(__file...
636a10c47cb1f3cadf6704931a775ce946310f8ef0950ed10a15607a3e1106eb
Python
1,031
28
# 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...
1027310b581ed0c2b8f2a7f51f0e18c96039162b3e6e381d3b0992eb7d78f08b
Python
1,032
35
import tensorflow as tf import numpy as np from PIL import Image import os os.sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import lattice_filter_op_loader module = lattice_filter_op_loader.module theta_alpha = 8.0 theta_beta = 0.125 im = Image.open('Images/input.bmp') rgb = np.arra...
ac7fb7a0337b5e692f36bc7839aabe027224b70e228b0c323d8872f24f0186a5
Python
1,033
34
import geomstats.backend as gs from geomstats.test.data import TestData from .lie_algebra import MatrixLieAlgebraTestData class SkewSymmetricMatricesTestData(MatrixLieAlgebraTestData): def baker_campbell_hausdorff_with_basis_test_data(self): return self.generate_tests([dict()]) class SkewSymmetricMatri...
7abeb3b05eec50402c3a526de62c13f0135446159f1c71992730bdd69224a80e
Python
1,035
49
#before experiment Main code import random txt_size = 0.07 title_size = 0.1 image_Yloc = [-0.50,-0.2] image_Ploc = [0.50,-0.2] #no control offer debug version noControl = [3,2,3] random.shuffle(noControl) #offer list nc_first = [5] nc_offer = [1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8...
65e33d6c4ad45781ebfa50e85a54d65b1a9c311b35140dba52306b3de6716844
Python
1,036
33
import numpy.testing as npt import pytest from reinvent_plugins.components.comp_mmp import MMP, Parameters from tests.test_data import CHEMBL4442703, CHEMBL4469449, CHEMBL4546342 from tests.test_data import CHEMBL4458766, CHEMBL4530872, CHEMBL4475647 from tests.test_data import CHEMBL4440201, CHEMBL4475970 @pytest.m...
688cd59c7ea58a57fbcfa53e30871183f974d4d47a263a6b51540624a36b9522
Python
1,037
45
import pingpong_test_ag as p import numpy as n c = p.ArdCom2(port="\\.\COM3") c.SendChar('a') c.Receive() c.SendNum(13242) c.Receive() c.SendString('asdqwugdqwufgdwqda') c.Receive(typeSingleIn=False) def SC(x): c.SendChar(x) y = c.Receive() return y[1]==x #print(c.Receive()) def SBC(x): c.SendBC...
e320d6c0fc4e4794906838cbe7bdc335154407f3f43fed26dda4b48654b32184
Python
1,039
26
# 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 appli...
eedbe393d8fa12f49b81322559fbdb9be0b74a7829da56455d398d72951b5518
Python
1,041
27
""" Trigger events sending Triggers are used to mark event (stimulus) timings during a recording. It supports the following types: - Desktop native LPT ('DESKTOP') - Commercial USB2LPT adapter ('USB2LPT') - Software trigger ('SOFTWARE') - Arduino trigger box ('ARDUINO') - Mock trigger device for testing ('FAKE') Th...
489b39df1529deb0b626e3bbd00aaa07172868b29769846989f18003833c4db9
Python
1,042
28
# ============================================================================== # Copyright 2023 Technical University of Denmark # Author: Nikolas Borrel-Jensen # # All Rights Reserved. # # Licensed under the MIT License. # ============================================================================== import matplotli...
586cf66a7e5c5c986607d0d76447536b5cd9822eec65d4899225f2c31ddf47cd
Python
1,042
43
from sympy import symbols import sympy.physics.units as units from sympy.physics.units import * def eq_split(eq): str=eq.replace(' ', '') parts = [] str_buf = '' for s in str: if s in ['*', '/', '+', '-', '%', ':', ';', '=', '!', '(', ')', '[', ']']: parts.append(str_buf) ...
430ee140d221ae7d0f8ffa0110d5c64adc744175c507507eb5ddd4c5ca01b56b
Python
1,043
39
# Copyright (C) 2020-2023 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Shared test configurations for transport tests.""" import pytest import logging from pathlib import Path @pytest.fixture(autouse=True) def setup_logging(): """Configure logging for tests.""" logging.basicConfig(l...
a780c03b130bd4dce1fb491c0f2be7c68686c4917e9b943fadf5f24e7df1474f
Python
1,043
35
import random from geomstats.test.data import TestData class ForwardDifferenceTestData(TestData): N_TIME_POINTS = random.sample(range(5, 10), 1) trials = 1 def forward_difference_last_test_data(self): return self.generate_random_data_with_time() class CenteredDifferenceTestData(TestData): ...
57af09df7d054e6254c6d9e4e2a25890979665134efd4c236897c5560a677059
Python
1,044
30
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # from torch import nn, Tensor from typing import Tuple, Optional class Flatten(nn.Flatten): """ This layer flattens a contiguous range of dimensions into a tensor. Args: start_dim (Optional[int...
640f3f2ac08e06d05f27a5426ae33aba1c5bf19a94a2a093530b451cb09db8c7
Python
1,046
34
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """openfl.experimental.workflow.utilities.resources module.""" from logging import getLogger from subprocess import PIPE, run logger = getLogger(__name__) def get_number_of_gpus() -> int: """Returns number of NVIDIA GPUs attached to...
d305ec0632be106b42c571dd829828a9f76fea4b1301b6f81b9b8f567c3082dc
Python
1,046
46
import pytest from geomstats.learning.kalman_filter import ( KalmanFilter, Localization, LocalizationLinear, ) from geomstats.test.parametrizers import DataBasedParametrizer from geomstats.test_cases.learning.kalman_filter import ( KalmanFilterTestCase, LocalizationTestCase, NonLinearLocalizati...
137b4e3b5d5bd8b8fbd53e595fb51d2629352f64f4477f4467645bf6e6982bb0
Python
1,049
38
import pandas as pd import re import numpy as np if __name__ == "__main__": fullname1 = "/home/hoang/data/ANDI/Metadata/UCSFFSL51ALL_08_01_16.csv" fullname2 = "/home/hoang/data/ANDI/tadpole_challenge/TADPOLE_D1_D2.csv" df1 = pd.read_csv(fullname1) df2 = pd.read_csv(fullname2) suffix = "_UCSFFSL_02...
57a75450d10fb30044533d4a8db870c08c4500c87454c37f773c1d7f188927c3
Python
1,049
33
class CorgieException(Exception): pass class IncorrectArgumentDefinition(CorgieException): def __init__(self, command, argument, argtype, reason=''): self.msg = "\nCommand: {}, Argument: {} {}\n Reason: {}".format(command, argtype, argument, reason) super().__init__(self.msg) ...
ea4d851e47ee9e24646e6438f04e5ce5c6db919dc2e969c0c124f6dd9b960b1e
Python
1,049
33
# 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 appli...
dcb7075973853fba281dc7c3a169be79d872c492ddc7205a48f9a4ec44916dbf
Python
1,050
33
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # from torch import nn, Tensor from typing import Tuple class PixelShuffle(nn.PixelShuffle): """ Rearranges elements in a tensor of shape :math:`(*, C \times r^2, H, W)` to a tensor of shape :math:`(*, C...
9173b98ccf5fbab2c2aa00376686013070fce6bcda4fbb9edd9a3ab3ef9d8f2f
Python
1,052
40
""" Haiku NN modules representing orbital functions """ from typing import Tuple def _determine_n_output_orbitals( n_up: int, n_dn: int, determinant_schema: str ) -> Tuple[int]: """ Function to determine the dimensionality of the outputted up & down MO matrix blocks given the number of up & d...
c7a87f04d8e32c6c0a4f61b711a58773427e92aeec015d31b66aed2b3feeb366
Python
1,053
33
# -*- coding: utf-8 -*- """ Created on Wed Aug 26 14:28:11 2020 @author: Tom """ from keras_preprocessing.image import DataFrameIterator import numpy as np class DataFrameIteratorPat(DataFrameIterator): def __init__(self, dataframe, patid_col, *args, **kwargs): super().__init__(dataframe, *args, **k...
0cfde31b30e1380d9cb6643ad0d6903ab5c0418928c14c221156dc552cc38172
Python
1,055
29
import matplotlib.pyplot as plt #overhead test: 0.001092708 labels = [] values = [] #{1: 5.002260208129883, 2: 20.522356033325195, 3: 15.061616897583008} #100 iterations pymonnto_fast_LIF = {'Overhead':0.001092708, 'Input': 20.522356033325195/300, 'LeakyIntegrate-\nAndFire': 5.002260208129883/300, 'STDP': 15.06161689...
f0d53ceba4964be600607383f991865f560776d2e707637e28cd4502d476bec1
Python
1,055
27
import numpy as np import warnings def sensitivity(sr_grid, prior): # prior = stimulus_pdf.dot(sr_grid) top_lim = 1e2 specificity = np.ones_like(sr_grid) * np.inf # specificity[:,prior > 0] = sr_grid[:,prior > 0] / prior[prior > 0] with warnings.catch_warnings(): warnings.filterwarnings('i...
c2d79ec72de0be9b168b5bf349ecdc9600ddf071febc7b561785763aefa753e2
Python
1,056
31
import pytest import unittest import torch from reinvent.models import LibinventAdapter, SampledSequencesDTO from reinvent.runmodes.utils.helpers import set_torch_device from tests.test_data import ETHANE, HEXANE, PROPANE, BUTANE from tests.models.unit_tests.libinvent.RNN.fixtures import mocked_decorator_model @pyt...
0bfc3b25e3456cec923cdbed66d1e012d6ef93d92c53c366efb374f58a56ca2e
Python
1,058
31
import numpy as np import torch from reinvent.runmodes.RL import Learning def get_distance_to_prior(likelihood, distance_threshold: float) -> np.ndarray: # FIXME: the datatype should not be variable if isinstance(likelihood, torch.Tensor): ones = torch.ones_like(likelihood, requires_grad=False) ...