sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
4e8a1ec484a5e933afe14b8bb8ada1cd62b9d67d7a1623858613bef4b4460c8a
Python
1,622
54
"""Reinvent transfer learning Train a given model with new data. The data comes from a file with SMILES strings. The file is assumed to be in multi-column format separated by commas (CSV) or spaces. The SMILES string is extracted from the first column. The SMILES strings is expected to be a complete molecule. """ ...
a85da7c3d2141341498c2d3293ddb6e7ba5338d76e193cc641f6bf2aeb0231c3
Python
1,622
49
import pandas as pd import matplotlib.pyplot as plt import seaborn as sns # ========================================== # 1. LOAD DATA (updated re-run Phase-1 results) # ========================================== data = { 'Model': [ 'YOLOv8-Nano', 'YOLOv10-Nano', 'YOLOv11-Nano', 'YOLOv12-Nano', 'D-F...
d68dd98190a8307d683118d8f8d5b1301c115ed3905c02fa7ffc864af73ace0f
Python
1,622
64
from __future__ import annotations from typing import TYPE_CHECKING, Literal, TypedDict, cast from typing_extensions import TypeAlias from snakebids.paths import specs from snakebids.paths._factory import BidsFunction, bids_factory if TYPE_CHECKING: from snakebids.paths._utils import BidsPathSpec # <AUTOUPDATE...
4a8a0cbd0e6c748820a9c8d60ee04ecb1a37e5299ca9da108befa73dbf92b87e
Python
1,623
38
import torch import torchvision class VGGPerceptualLoss(torch.nn.Module): def __init__(self, resize=True): super(VGGPerceptualLoss, self).__init__() blocks = [] blocks.append(torchvision.models.vgg16(pretrained=True).features[:4].eval()) blocks.append(torchvision.models.vgg16(pretr...
66c48ed52d944d729c20209e16621de9ae7c99a0c2f7c4261eb70d301cd53768
Python
1,624
62
import random import pytest import geomstats.backend as gs from geomstats.geometry.functions import HilbertSphere from geomstats.test.parametrizers import DataBasedParametrizer from geomstats.test_cases.geometry.manifold import ManifoldTestCase from geomstats.test_cases.geometry.mixins import ProjectionTestCaseMixins...
0bd0ed564ef92c9d8d207b9a34a855ec7754a32926e3c5c881eac81d1f46d98d
Python
1,626
57
import json import flammkuchen as fl from pathlib import Path from split_dataset import Blocks def loading_function(f): f.loading_function = True return f class StackSaver(Blocks): """""" def __init__( self, *args, destination=None, name="original", verbose=False, **kwargs ): "...
21b4181642752ff452a324cb72ef7e0e75ad10b06bbcaa3b6a889784338bf8cf
Python
1,626
59
import random import pytest import geomstats.backend as gs from geomstats.geometry.euclidean import Euclidean from geomstats.geometry.spd_matrices import ( SPDAffineMetric, SPDLogEuclideanMetric, SPDMatrices, ) from geomstats.learning.incremental_frechet_mean import IncrementalFrechetMean from geomstats.t...
9d1c6e03287b2196234ac2783064328b2cd80a0b285f5ce29e41af081967bc65
Python
1,628
58
import numpy as np from skimage.metrics import ( mean_squared_error, structural_similarity, peak_signal_noise_ratio) from sparse_ct.data import create_circular_mask class Reconstructor(object): def __init__(self, name): self.name = name self.image_r = None def eval(self, gt): ...
930f810815c2e5415caca87c58e5c529fc1c05c11895f74310d0d1404b4892db
Python
1,629
45
from .set_transformer_modules import * class SetTransformer(nn.Module): def __init__( self, dim_input, num_outputs, dim_output, num_inds=32, dim_hidden=128, num_heads=4, ln=False, num_sabs=2, dropout=0.0, ): super(SetTrans...
947a8cb11d812ace2565369105969e5c2b3938ae73012c509a78c5a340ec1cbd
Python
1,629
47
from reinvent.scoring.compute_scores import compute_component_scores from reinvent_plugins.components.RDKit.comp_physchem import Qed def test_scorer_cache(): smilies = [ "CC(=O)Oc1ccccc1C(=O)O", "O=S(=O)(c3ccc(n1nc(cc1c2ccc(cc2)C)C(F)(F)F)cc3)N", "Cc1ccc(-c2cc(C(F)(F)F)nn2-c2ccc(S(N)(=O)=O...
10b77be7db4d100489e9b1e73c502c56a54d8c6874f582f9c761edd0ee3a6620
Python
1,630
66
"""Sigmoid functions FIXME: there is only a sign change for the two sigmoid functions """ __all__ = ["Sigmoid", "ReverseSigmoid"] from dataclasses import dataclass import numpy as np from .transform import Transform from .sigmoid_functions import hard_sigmoid, stable_sigmoid @dataclass class Parameters: type:...
4ff119dabefcf99c83839e9440a5156d6bc2b43b92a8bcec2aa6e30076b09f04
Python
1,631
59
import random import pytest from geomstats.geometry.skew_symmetric_matrices import SkewSymmetricMatrices from geomstats.test.parametrizers import DataBasedParametrizer from geomstats.test_cases.geometry.matrices import MatricesMetricTestCase from geomstats.test_cases.geometry.skew_symmetric_matrices import ( Skew...
f535de744fe524d810d6ce4e384ccaa850819cc01df43c3fae4e195035bce3b2
Python
1,631
56
class Record(object): __attributes__ = [] def __eq__(self, other): return ( type(self) == type(other) and all( (getattr(self, _) == getattr(other, _)) for _ in self.__attributes__ ) ) def __ne__(self, other): retu...
fa47a27c5f04ffa681ebcb0d10c3802154f3b6546d261f97700c64751542864f
Python
1,631
77
import time import numpy as np from brian2 import ( StateMonitor, SpikeMonitor, defaultclock, prefs, NeuronGroup, run, Synapses, plot, ms, mV, float32, ) import matplotlib.pyplot as plt from globparams import * defaultclock.dt = 1.0 * ms prefs.core.default_float_dtype = floa...
1df41559f31e5f7014adf0be79a4cd374faa2b8078035c539a98009bbf48824e
Python
1,632
57
# coding=utf-8 from typing import List, Tuple import torch import torch.utils.data as tud from torch import Tensor from torch.nn.utils.rnn import pad_sequence from reinvent.models.linkinvent.model_vocabulary.model_vocabulary import ModelVocabulary class Dataset(tud.Dataset): """Dataset that takes a list of SMIL...
0a1af761529508e1455b4c499348e551a86e31d588fc721fb4d62a6c39cb33a6
Python
1,633
50
""" Train LearnedPDReconstructor on 'lodopab'. """ import numpy as np from dival import get_standard_dataset from dival.measure import PSNR from dival.reconstructors.learnedpd_reconstructor import LearnedPDReconstructor from dival.reference_reconstructors import ( check_for_params, download_params, get_hyper_params...
6fbba7781ce04c6ca9a81f14ee42d9e06df28dfe20f71066140e104649ba1de0
Python
1,633
50
""" Train LearnedGDReconstructor on 'lodopab'. """ import numpy as np from dival import get_standard_dataset from dival.measure import PSNR from dival.reconstructors.learnedgd_reconstructor import LearnedGDReconstructor from dival.reference_reconstructors import ( check_for_params, download_params, get_hyper_params...
7026b8cdc750f3f3b933a6d720533a351c0caee0d8c9d4cbddeb18ba82101e22
Python
1,633
41
import torch import os from molx.dataset import Molecule3D from molx.model import Deepergcn_dagnn_dist from molx.mol3d import Mol3DTrainer, eval3d conf = {} conf['epochs'] = 100 conf['early_stopping'] = 200 conf['lr'] = 0.0001 conf['lr_decay_factor'] = 0.8 conf['lr_decay_step_size'] = 10 conf['dropout'] = 0 conf['weig...
8b5728c6c63bc92f1f31219ac746e0495673028e33a59cba78d337650d3b1fe7
Python
1,633
50
""" Train IRadonMapReconstructor on 'lodopab'. """ import numpy as np from dival import get_standard_dataset from dival.measure import PSNR from dival.reconstructors.iradonmap_reconstructor import IRadonMapReconstructor from dival.reference_reconstructors import ( check_for_params, download_params, get_hyper_params...
c6c4196fb692b5c3b6a98b1196f4f95018393d00ea48c8343ed792ea80fe436f
Python
1,633
50
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. from nequip.nn import SequentialGraphNetwork, AtomwiseReduce, ForceStressOutput from nequip.nn.embedding import EdgeLengthNormalizer from nequip.data import AtomicDataDict from nequip.nn.pair_potential ...
af7e779aa3bf4c1643063479c336bd679e52891d1a9d5cc994c742869d0b899c
Python
1,634
55
# -*- coding: utf-8 -*- import os import argparse import logging import glob # use this format to tell the parsers # where to insert certain parts of the script # ${imports} def parse_args(): # Argument Parser parser = argparse.ArgumentParser() # my args parser.add_argument("--verbose", action = "sto...
f98e078a26e6e53ca9e17c094ab92d57ebe24f00bcd2c68efc6e5b115b8d8604
Python
1,634
42
import pytest import geomstats.backend as gs from geomstats.test_cases.geometry.base import LevelSetTestCase from geomstats.test_cases.geometry.riemannian_metric import RiemannianMetricTestCase from geomstats.test_cases.information_geometry.base import ( InformationManifoldMixinTestCase, ) def fisher_rao_dist(po...
3e64a987193d2cbc997bca45a28376799f0779280fc71c1f3a336898952b6039
Python
1,635
62
"""Tests for atlas loading from the HF dataset.""" import polars as pl import pytest from nltools.data.atlases import _Atlas, list_atlases, load_atlas # All 11 atlases hosted at huggingface.co/datasets/nltools/niftis under atlases/. EXPECTED_ATLASES = { "aal", "aicha", "desikan_killiany", "destrieux"...
52be1128141d0587b110cd444b53ebd686d315f5a69adb55e77ed875421003e3
Python
1,636
53
import os from funcs import evaluate import numpy as np import glob import nrrd import argparse if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('--data_folder', type=str, required=True) args = parser.parse_args() folder = args.data_folder f1_score_list = [] h...
3a4c812eee26b0a3fb0053b097df782cc55fa06a22463c680231b521417d6ec2
Python
1,637
58
"""A simple plugin system for scoring components""" __all__ = ["get_registry"] import importlib import pkgutil import dataclasses from typing import Tuple import logging from reinvent_plugins import components # FIXME: this is not the solution if components.__file__ is not None: # this is not a namespace package ...
98cf31454234cbdd98213a757d0c6f081c53881eae3ec72b8189083c980f4772
Python
1,639
81
# Adapted from https://lukas-snoek.com/NI-edu/fMRI-introduction/week_3/neurodesign.html import os import matplotlib.pyplot as plt import numpy as np from rich import print import neurodesign # Neurodesigninternally parallelizes some computations using multithreading, # which is a massive burden on the CPU. So let's...
9b11ad77cebcd3cce7a6c7e337a28db024ca7e680abcfa0283ed9c46ee898ece
Python
1,639
59
from __future__ import absolute_import import numpy as np from numpy.testing import assert_allclose from nose.tools import assert_equal, assert_true import pycircstat from pycircstat import event_series as es def test_vector_strength_spectrum(): T = 3 # 2s sampling_rate = 10000. firing_rate = 10 # 10...
26e176d300949ed93ffa4ae93aca0aef9edfce27bbe7d42051c401e356bebc49
Python
1,640
69
import json from pathlib import Path import click from tqdm import tqdm @click.command() @click.option( "-d", "--directory", required=True, type=click.Path(exists=True, file_okay=False, readable=True, path_type=Path), ) @click.option( "-s", "--scores", required=True, type=click.Path( ...
4d329acfab37407721387d5194606967ef7021f028a5a6c68e00977044624f69
Python
1,641
56
#!/usr/bin/env python3 import argparse import os import matplotlib.pyplot as plt import numpy as np from odil import plotutil def load_csv(path): if path and os.path.isfile(path): return np.genfromtxt(path, delimiter=",", names=True) parser = argparse.ArgumentParser() parser.add_argument("--odil", de...
7c5d206ff4bb71bdc106a0aec001fe92d123b0644d05f4aebf2487e36bf6f33f
Python
1,641
55
""" Schema Registry for Embedding Functions This module provides a registry of all available schemas for embedding functions. It can be used to get information about available schemas and their versions. """ from typing import Dict, List, Set import os import json from chromadb.utils.embedding_functions.schemas.schem...
dd6c43b8e2d3b05290431abe4474d62eafa187b21c900091b223c86b51621395
Python
1,641
41
import unittest import pytest import torch from reinvent.models import LibinventTransformerAdapter, SampledSequencesDTO from reinvent.models.transformer.libinvent.libinvent import LibinventModel from reinvent.runmodes.utils.helpers import set_torch_device from tests.test_data import ETHANE, HEXANE, PROPANE, BUTANE fr...
b4fade429240526f91c265db05c26d6f6a3145950ea9c1766dc1a75eff7a8786
Python
1,643
49
import numpy as np import warnings from . import sensitivity def optimize(sr_grid, init=None, eps=1e-4, max_iter=100000, verbose=False, expense_factor=1, basal_expense=0, expense=None): n = sr_grid.shape[0] # TODO sjednotit uvodni cast kodu s cutting plane if expense is None: expense = sr_grid.d...
e7706cda4df74447919988da0eee370e9f6af5087333f7179f5e65dbd5b67d23
Python
1,644
59
""" Wrapper to load in a PDB file as a pyrosetta pose, relax it, and write back out the relaxed pose as a PDB file. """ import os import glob import multiprocessing as mp import logging import argparse import pyrosetta from pyrosetta import rosetta pyrosetta.init() logging.basicConfig(level=logging.INFO) def relax_...
0f36bdc44fac590fc91c26faf9c3e7bb23a62ea647cec33903c6ce8807da3ddd
Python
1,646
51
import pytest from geomstats.information_geometry.geometric import ( GeometricDistributions, GeometricDistributionsRandomVariable, GeometricMetric, ) from geomstats.test.parametrizers import DataBasedParametrizer from geomstats.test.random import RandomDataGenerator from geomstats.test_cases.geometry.riema...
a28d2a83a26fee31ca76ec3f7e272201e980d0f8047b1098821bd90d03915aaf
Python
1,646
57
"""Some auxiliary functionality that does not fit anywhere else. FIXME: may need to move some/all of these """ from __future__ import annotations __all__ = ["disable_gradients", "set_torch_device"] import logging from typing import List, TYPE_CHECKING import torch if TYPE_CHECKING: from reinvent.models import ...
0ddca5191a44d64a712a1a73339defd3543e39db9e29d1dbcfeb6e9d7aeed64e
Python
1,647
52
import os import pandas as pd import matplotlib.pyplot as plt #from Code.utils import plot_heatmap import seaborn as sns from matplotlib.colors import LinearSegmentedColormap import numpy as np def plot_heatmap(df,df_std, cmap='Reds'): # Create an array to annotate the heatmap labels = ["{0:.4f}\n$\pm$\n{1:.4f...
9abcc28d32e17a38785786e8a0d7ae265b815f8c1972291b02ec16a23b105631
Python
1,647
49
# Author: Guoqing Bao # School of Computer Science, The University of Sydney # Date: 2019-12-12 # GitHub Project Link: https://github.com/guoqingbao/Pathofusion # Please cite our work if you found it is useful for your research or clinical practice from django.shortcuts import render from django.http import HttpRespon...
f53e462815aa6c39f1fb57d2faf9c539a8a5bf8019e44a3ec02dab1296993f5a
Python
1,647
70
from unittest.mock import MagicMock import unittest from sleepy.test.core import TestBase from sleepy.gui.tagging.model.event import PointEvent import numpy as np import pdb class EventTest(unittest.TestCase): def getSettings(): settings = TestBase.getSettings() settings.intervalMin...
2af9dc1435222cc27e79776a2ed786a9a580825a9e3b5339be193439817b02a4
Python
1,649
48
import geomstats.backend as gs from geomstats.geometry.euclidean import Euclidean from geomstats.geometry.hypersphere import Hypersphere from geomstats.learning.agglomerative_hierarchical_clustering import ( AgglomerativeHierarchicalClustering, ) from geomstats.test.data import TestData class AgglomerativeHierarc...
27155b96e957dfedac2dddb592d3f971156e87a9a597da26ef5dcd4e41f481c2
Python
1,658
50
""" Calculate the time from the first to the last trigger in each wave. """ import numpy as np 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, ...
62c790168712cbb99a631fd19f7a6562272daca4c3fbd191c2b77d4387075b7d
Python
1,658
47
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon May 6 10:09:27 2019 @author: rubendries """ import igraph as ig import leidenalg as la import pandas as pd import networkx as nx def python_leiden(df, partition_type, initial_membership=None, weights=None, n_iterations=2, seed=None, resolution_parame...
95ad1029515342eac72638b397d30eaa4b041cb9e98883e75c9dc537970ff043
Python
1,658
32
import sys, json, argparse, torch import torchvision.transforms as T from PIL import Image ap = argparse.ArgumentParser() ap.add_argument('--root'); ap.add_argument('--config'); ap.add_argument('--ckpt') ap.add_argument('--items'); ap.add_argument('--out'); ap.add_argument('--min_score', type=float, default=0.001) ap....
2ea1b37fa62bae64d07c9dcb54d332150664d27891874ceb4692d48403c11eb5
Python
1,659
42
import unittest from rdkit import Chem from reinvent.chemistry.library_design import bond_maker, attachment_points from reinvent.chemistry.library_design.reaction_filters import ReactionFiltersEnum from tests.chemistry.fixtures.test_data import ( REACTION_SUZUKI, SCAFFOLD_TO_DECORATE, TWO_DECORATIONS_SUZU...
5c97bc6fa0fd3cf87bad7e70f8879fc51a89a3c6e76dfaf461f929538dabc30a
Python
1,660
48
"""Tests for CPU parallelization functionality and correctness.""" import pytest import numpy as np from nltools.algorithms import one_sample_permutation_test def _one_sample_at(n_jobs): data = np.random.RandomState(0).randn(20, 5) return one_sample_permutation_test( data, n_permute=60, return_null=...
587aaa9e73a1e7b7bdaec8b2488e1f64f465a7f9b8df239aa34ead76fcb609d9
Python
1,662
60
import os import re import numpy as np def get_subject_files(dataset, files, sid): """Get a list of files storing each subject data.""" # Pattern of the subject files from different datasets if "mass" in dataset: reg_exp = f".*-00{str(sid+1).zfill(2)} PSG.npz" # reg_exp = "SS3_00{}\.npz$...
6485ab5ff71fef37607c57fca2542167552ff1bc88a8e25c0a4ae8119f028eab
Python
1,662
44
import numpy as np # define the FI curve function. for either excitatory neurons and inhibitory neurons. def current_to_frequency(input_current,population_type,p): # input_current is all the current to target neuron. # population_type is either 'E' for excitatory neurons or 'I' for inhibitory neurons. # ...
1fa4af7eb5274e2f72b83e7dcf407476993a7252b5167aecf5e3453693382fe3
Python
1,663
61
"""Test suit for saving PyRates objects to or loading them from file.""" __author__ = "Daniel Rose" __status__ = "Development" import filecmp import os import pathlib import pytest def setup_module(): print("\n") print("=======================") print("| Test Suite File I/O |") print("=============...
45ba6be7ef7a6caf181c7a04d421c37a8241aabd7a4fda14d374a0f72ef45627
Python
1,663
31
import pandas as pd, matplotlib.pyplot as plt, seaborn as sns, matplotlib as mpl mpl.rcParams['pdf.fonttype'] = 42 # ALL 12 numbers clean (warmup+median). D-Fine FP32 (FP16 unstable); its ~7ms preprocess # uses an unoptimized PIL path so its end-to-end is conservative. D-Fine A100>T4 is real: # the model is too small ...
1abd32a83896eedf0a7c43844ea509229dc9d31535458c3a5b8e89cd0a360482
Python
1,665
39
# -*- coding: utf-8 -*- # # # PyRates software framework for flexible implementation of neural # network models 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 Cognitiv...
811a3ce9928d12a6ec21e1ccdd7238052bc15311a99799bc440c8092e2397e09
Python
1,665
45
import math import torch from torch import nn as tnn class AttentionLayer(tnn.Module): def __init__(self, num_dimensions: int): super(AttentionLayer, self).__init__() self.num_dimensions = num_dimensions self._attention_linear = tnn.Sequential( tnn.Linear(self.num_dimensions...
3ce6b0c53a6e0e1f3b079920f3685b35bf83d9268b64d3facc284f1547419aed
Python
1,667
52
""" This code calculates the efficiencies for different values of P_ext (xc) from the simulation results Change the constant ADJUST_REST to True to make the resting cost independent of the coupling strength (group). """ import numpy as np import matplotlib.pyplot as plt import pickle from tqdm import tqdm import warn...
7732d8b758799c55a2c4c093dc7f86585eee03a4f8c8c28c7a40f41ca4774a8b
Python
1,668
50
from __future__ import print_function, division, absolute_import import torch.nn as nn import torchvision.models as tm from efficientnet_pytorch import EfficientNet import timm # Defining a class named 'Brainmodels' for model management class Brainmodels: def __init__(self, models_name, num_classes, resume_model):...
46db794517bee3125e653eaf69a145118a0dfb17f83b677d53448168504d93e8
Python
1,669
54
""" Similarity and Distance ======================= This tutorial illustrates how to calculate similarity and distance between images. """ ######################################################################### # Load Data # --------- # # First, let's load the pain data for this example. from nltools.datasets i...
6490ed01278106c371c24700826752e66c681a08901379e3660ed7e19cc1d167
Python
1,670
66
import platform import time import numpy as np import matplotlib.pyplot as plt from globparams import * from brian2 import * import brian2cuda set_device("cuda_standalone", clean=True) defaultclock.dt = 1 * ms prefs.core.default_float_dtype = float32 if platform.node() == 'saeed-Swift-SF315-51G': prefs.devices.cu...
8fa43b6398c0d3cb2128a5e08cae9d636cd86a1468aaf8338e5cd4a4307a70b6
Python
1,670
50
""" Calculate the time from the first to the last trigger in each wave. """ import numpy as np 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, ...
3b7c8e93190a4a5840249cc8d6ff73884411921febad2ec0e6d4a748f3743a7c
Python
1,671
42
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Custom GaNDLF DataLoader module.""" from openfl.federated.data.loader_gandlf import GaNDLFDataLoaderWrapper class GaNDLFDataLoader(GaNDLFDataLoaderWrapper): """A custom data loader for the Generally Nuanced Deep Learning Framework ...
95b9384e945ca7e15aa09eac318866fdba8241c8dc03b66f7baf890869074ca1
Python
1,671
69
import random import pytest import geomstats.backend as gs from geomstats.geometry.euclidean import Euclidean from geomstats.geometry.hypersphere import Hypersphere from geomstats.geometry.spd_matrices import SPDMatrices from geomstats.learning.mds import MDS from geomstats.metric_geometry.bhv_space import TreeSpace ...
c83c7179c33d409bb3f3da914c6dae6510a536bb1a5d9a813a2cc9dbf483ad80
Python
1,673
54
import setuptools from dig.version import __version__ with open("README.md", "r") as fh: long_description = fh.read() setup_requires = ['pytest-runner'] tests_require = ['pytest', 'pytest-cov', 'mock'] setuptools.setup( name="dive_into_graphs", version=__version__, author="DIVE Lab@TAMU", author...
f69a78306717bb2df6558e00f05edeeabec2209616a404b40c32911975eb86cc
Python
1,673
40
# -*- coding: utf-8 -*- # # # PyRates software framework for flexible implementation of neural # network models 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 Cognitiv...
c2762b896245cafd807470741a51704ff6e947758f1f1d48455e03969b86c3fb
Python
1,677
51
from pathlib import Path import click from nnunetpaper.data import read_json @click.command() @click.argument("file", type=click.Path(readable=True, path_type=Path)) @click.option("-m", "--metric-name", required=False, default=None) @click.option("-v", "--value", required=False, default=None) def main(file: Path, m...
34b16ce2515a26e86b53f5c4404143ba67589ff133678fd628087088e3b77218
Python
1,678
63
import inspect import asyncio from typing import Any, Callable, Coroutine, TypeVar from typing_extensions import ParamSpec P = ParamSpec("P") R = TypeVar("R") def async_to_sync(func: Callable[P, Coroutine[Any, Any, R]]) -> Callable[P, R]: """A function decorator that converts an async function to a sync functio...
def65aec7c0adfadb0ad4eb36eba422da64bc4c615bb14c8735dcef997d06cee
Python
1,678
52
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 DirichletDistributionsTestData( Informati...
fc2657c4b4b303be9c8c373cfaf63f4eeccfe50e2867e82e4e397d9183517231
Python
1,678
56
import logging import warnings from importlib_metadata import version from sklearn.exceptions import ConvergenceWarning warnings.simplefilter('ignore', category=ConvergenceWarning) warnings.simplefilter('ignore', category=DeprecationWarning) DEFAULT_IP = 'localhost' DEFAULT_PORT = 6000 def start_live2p(params_dict, ...
1e9969d2ddcff4ffbffbf1875a511fe29f22ecbc517841538fa3e201c1003663
Python
1,681
49
"""`_Glm` must fit and compute contrasts without emitting warnings. The estimator no longer builds a `FirstLevelModel` or a masker, so nilearn's mask-generation `RuntimeWarning` and its deprecated-accessor `FutureWarning` have no path into nltools. `run_glm` itself is quiet at `verbose=0`. """ import warnings import...
998c581fa5d6e62fc1ccf8b4f86df16ff9ec1cc7ab379edef6900fe0f94614b6
Python
1,682
49
from time import time class JSExperiment: def __init__( self, experiment_description, experiment_name, experiment_parameters, experiment_model): self.description = experiment_description self.name = experiment_name self.paramet...
366005b5ad7767a02e45a169db1878438f1bf45478dbd7241c0e99f633cd832c
Python
1,683
57
import argparse import importlib import os import tensorflow as tf from train import train def run(db, gpu, from_fold, to_fold, suffix='', random_seed=42): # Set GPU visible to Tensorflow os.environ["CUDA_VISIBLE_DEVICES"] = str(gpu) # Config file config_file = os.path.join('config', f'{db}.py') ...
61a8365f910ca90e9778fd1af0b82d1198452b1a48dd8997d26d98a171296fc8
Python
1,684
58
"""Plot an Agglomerative Hierarchical Clustering on the sphere.""" import logging import os import matplotlib.pyplot as plt import geomstats.backend as gs import geomstats.visualization as visualization from geomstats.geometry.hypersphere import Hypersphere from geomstats.learning.agglomerative_hierarchical_clusteri...
8e5fefd984903d93c2e407ffa9919f5ca3e59dffeafa0a8838a65c047161e2b1
Python
1,685
50
""" 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 quantities as pq from utils.io_utils import load_neo from snakemake.logging import logger CLI = argparse.ArgumentParser() CLI....
557aec7a7623df85e64747832a47c11a30419652081995fc11b2ae3decd69849
Python
1,686
91
import sys sys.path.append('../../') from PymoNNto.NetworkCore.Network import * from PymoNNto.NetworkCore.Synapse_Group import * from NetworkBehavior.EulerEquationModules.Equation import * from matplotlib.pyplot import * from PymoNNto.NetworkBehavior.Structure.Structure import * from Examples_Paper.Eqation.Experimenta...
f014d3a3fd0ea67b0250529276051aba735eb716240ddf38f4f1cb3481d9fbea
Python
1,686
60
#!/usr/bin/env python3 __description__ = \ """ Test the use of the * format. It sends a random list of longs (without a pre- specified length of the list) and then receives it (again, without a specified list length). """ __author__ = "Michael J. Harms" __date__ = "2016-06-08" __usage__ = "./duplex.py serial_device (l...
325dfa0db096ed0b0aad3d5cdacf59cc748ef712c98b3d21762ca7933f97620f
Python
1,687
37
import os from PIL import Image from tqdm import tqdm from typing import List, Callable class ImageDatasetTransformer: def __init__(self, name: str, transform: Callable[[Image.Image], Image.Image], n_samples: int = 1): self.name = name self.transform = transform self.n_samples = n_samples...
8212bdc435ddaf81ca8e8f6a018f973ebf15dd438fd5082b1b335f133b8f57c8
Python
1,687
60
"""Use RDKit's filter catalogs to filter for unwanted structures""" __all__ = ["UnwantedSubstructures"] import sys from dataclasses import dataclass from typing import List import logging import numpy as np from rdkit import Chem from rdkit.Chem.FilterCatalog import FilterCatalog, FilterCatalogParams from ..compone...
c2d049d4f01b54b02609898d5da0d012c3692a7d6e74cfd5f35e0c2b6dbec356
Python
1,688
78
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. from ._key_registry import ( register_fields, deregister_fields, _register_field_prefix, get_field_type, _NODE_FIELDS, _EDGE_FIELDS, _GRAPH_FIELDS, _LONG_FIELDS, _CAR...
d9cc2dd9e244052c83a6b0e24807ed977de394409cf9dd6507c624ed43e6a29c
Python
1,688
34
from .torchvision_wrapper import create_torchvision_dataset_wrapper from .spoken_mnist import SpokenMNIST from .davis import Davis from .alov300 import ALOV300 from .nat_images import NatImages from .collate import time_aware_collate from .dataloader import DataLoader CIFAR10 = create_torchvision_dataset_wrapper("CI...
e846916944076d8342e93e9fa81583a484405ab578db6ac2dca5b167cce95e8c
Python
1,688
53
import experiment as exp from canvas import Canvas class CanvasNoiseExperiment(exp.Experiment): default_params = { "canvas_id": "1", "fill": "red", "duration": 20, "max_noise": 10, "background": "black", } async def run_block(self): self.canvas = Canvas(exp...
1bdf34abaf9f13d1ca98f309679b37e0c878cbdfa86a21d1394d22f740d8b324
Python
1,690
39
from PymoNNto.Exploration.Network_UI.TabBase import * class spiketrain_tab(TabBase): def __init__(self, parameter, title='Spiketrain', timesteps=1000): super().__init__(title) self.parameter=parameter self.timesteps=timesteps def add_recorder_variables(self, neuron_group, Network_UI):...
cbfd79ff6217b0f15da597dba0aaae2d8ed1ed9e5c6afe57c5cb3fb37e4ae309
Python
1,690
61
import numpy as np from scipy.optimize import minimize def skew_sym_regress(X, X_dot, tol=1e-4): """ Original data tensor is C x L x N where N is number of Neurons, L is length of each trial and C is number of conditions. We stack this to get L*C x N array. Args ---- X_dot: First difference of (reduced...
2ed6a3f4fb11697fc178dd7596d54425b76bd6f64aa1a41de03a6998b90b5701
Python
1,691
50
""" 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 quantities as pq from utils.io_utils import load_neo from snakemake.logging import logger CLI = argparse.ArgumentParser() CLI....
5c110cd09642866d5bab525dcbdc8c69b2b69d5eed0db71b8960645cf4ece27f
Python
1,691
44
import pytest import unittest import numpy import torch from reinvent.models import meta_data from reinvent.models.reinvent.models.model import Model from reinvent.models.reinvent.models.vocabulary import SMILESTokenizer, Vocabulary from reinvent.runmodes.utils.helpers import set_torch_device from tests.test_data imp...
d971d7e9e556aa39e4f1ae1337a4b88b1ecd6c8137294f0baa1f46f771578b41
Python
1,691
67
import sys import numpy from collections import defaultdict contigs = [] genes = {} introns = {} confs = {} strands = {} with open(sys.argv[1], "r") as f: previous_end = 0 previous_strand = -1 previous_contig = "" for line in f: if line.startswith("#"): previous_end = 0 previous_strand = 0 if not line.st...
c339796cd1f5106f1cd882273e988bf0255cd8872b8dc8876f9230e05197a255
Python
1,692
53
import pytest from geomstats.information_geometry.gamma import ( GammaDistributions, GammaDistributionsRandomVariable, NaturalToStandardDiffeo, ) from geomstats.test.parametrizers import DataBasedParametrizer from geomstats.test.random import GammaRandomDataGenerator, RandomDataGenerator from geomstats.tes...
313fd5f31d70bb3f94befa5eed78d0921b7144c71fab0c83fe006895fdb022f9
Python
1,696
88
import numpy as _np from geomstats._backend._dtype_utils import _pre_allow_complex_dtype _DTYPES = { _np.dtype("int32"): 0, _np.dtype("int64"): 1, _np.dtype("float32"): 2, _np.dtype("float64"): 3, _np.dtype("complex64"): 4, _np.dtype("complex128"): 5, } _COMPLEX_DTYPES = [ _np.complex64, ...
3c785912020fc27c400e2d6c4e556f3211b50c9b2db9bf528d70b69c9382893a
Python
1,696
66
# Copyright (C) 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from copy import deepcopy import random from Crypto.PublicKey import ECC import torch import torchvision # Download Train and Test datasets mnist_train = torchvision.datasets.MNIST( "../files/", train=True, download=True, ...
0554a5552ce4c23b74d7eac15cd6cd6ff266dd30c0e88f825f0202a141e9a950
Python
1,699
49
#!/usr/bin/env python """ CLI for wandb sweeps. """ import wandb import os from deeperwin.configuration import Configuration, set_with_flattened_key from ruamel.yaml import YAML from deeperwin.process_molecule import process_molecule import re def _get_current_run_nr(): directories = "\n".join([d for d in os.list...
81e1edb258dce9afab7488606d92c4d18eccdbcdaf604f5d328b200d3cdc4541
Python
1,700
47
import wandb import argparse import pandas as pd from tqdm import tqdm def main(source_wandb_project_name, reserved_run_ids_file_name, top_k): # Read the text file with the ids with open(reserved_run_ids_file_name+'.txt') as f: ids = f.readlines() # Strip newline characters and conver...
9a676d9c81e4a9f4bdb09683f26f8804c1a2da713241d5789f0b95bac823f501
Python
1,702
66
# Copyright (C) 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from copy import deepcopy import random from Crypto.PublicKey import ECC import torch import torchvision # Download Train and Test datasets mnist_train = torchvision.datasets.MNIST( "../files/", train=True, download=True, ...
f32882301bcd668072378c61d444c14065dec5f5747de8e0b1ce44e435e6f14c
Python
1,702
60
from argparse import ArgumentParser import torch from mace.tools.scripts_utils import remove_pt_head def main(): parser = ArgumentParser() grp = parser.add_mutually_exclusive_group() grp.add_argument( "--head_name", "-n", help="name of the head to extract", default=None, ...
bcda74076dffd89f70929443224f1349f07a0617d06549c283bf6f9e2e624dfe
Python
1,704
56
import random import pytest from geomstats.geometry.euclidean import Euclidean from geomstats.geometry.hyperboloid import Hyperboloid from geomstats.geometry.hypersphere import Hypersphere from geomstats.geometry.spd_matrices import ( SPDAffineMetric, SPDLogEuclideanMetric, SPDMatrices, ) from geomstats.l...
c38e571e710dbd4c7d2ddf60e9f1148d469048dddf193d4ecb110f06c2b873ba
Python
1,704
55
import os.path as osp import pickle from tqdm import tqdm from rdkit import Chem from multiprocessing import Pool def check_mol(mol_dir): cid = mol_dir.split('/')[-1] file_path = osp.join(mol_dir, cid+'.mol') if osp.exists(file_path): try: mol = Chem.MolFromMolFile(file_path, removeHs=...
48dec0308222b44f6849b8c12655974f69c470c6b7ccbab5b40ffa7331de10ed
Python
1,705
49
import numpy as np import scipy.spatial from deeperwin.utils.utils import get_distance_matrix BOHR_IN_ANGSTROM = 0.529177249 def distort_molecule(R, n, d_min_factor, d_max_factor, noise_scale): R_out = [] n_atoms = len(R) if n_atoms == 2: center = (R[0] + R[1]) / 2 diff_vec = (R[1] - R[0...
fe46a93bd5d77f65fe98e748e62871b9d4b071cc0ef84034455f59afca93cc9e
Python
1,705
58
#!/usr/bin/env python """The setup script.""" from setuptools import setup, find_packages with open("README.rst") as readme_file: readme = readme_file.read() with open("HISTORY.rst") as history_file: history = history_file.read() requirements = [] with open("requirements.txt") as f: for line in f: ...
0534fd8c3f72c29d6b19ab5ef110a3796f8a620c3d76b9a64e431ce2b70bab3a
Python
1,706
74
# The data used for testing was obtained from the repository https://github.com/brain-networks/edge-ts. [no license] import dynfc as dyn from numpy import pi, load, hstack def test_phDiff1(): assert round(dyn.phDiff(pi, pi),1) == 1 def test_phDiff2(): assert round(dyn.phDiff(pi, pi/2), 1) == 0 def test_phDi...
d610661eeb0e08ac5ec8fa3109433bc6ed1e3053c54d0452172d31e3cc3bfe9d
Python
1,708
39
# -*- coding: utf-8 -*- # # # PyRates software framework for flexible implementation of neural # network models 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 Cognitive...
e39ae0275d6381907cb51235115ed9191a927e6c1553fafa09ed44c4a7ee1818
Python
1,708
88
import autograd.numpy as _np from geomstats._backend._dtype_utils import _pre_allow_complex_dtype _DTYPES = { _np.dtype("int32"): 0, _np.dtype("int64"): 1, _np.dtype("float32"): 2, _np.dtype("float64"): 3, _np.dtype("complex64"): 4, _np.dtype("complex128"): 5, } _COMPLEX_DTYPES = [ _np.co...
2ea62ac819421df0d2d530eefdc4b89e22d642d0333eccdb89be86d096aa5cfe
Python
1,709
52
"""Load an example ABF recording and plot one voltage sweep.""" from pathlib import Path import matplotlib.pyplot as plt import sanpy def main() -> None: """Load an ABF file, print its basic properties, and plot one sweep. Raises: RuntimeError: If SanPy cannot load the recording. """ # Loc...
36bec4d9333fdfe01ee75e1a2926981beb492379bfb91fa58f7341831f845518
Python
1,709
49
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # from torch import nn, Tensor from typing import Optional, Tuple from . import register_norm_fn @register_norm_fn(name="group_norm") class GroupNorm(nn.GroupNorm): """ Applies a `Group Normalization <https...
30be181705ae26925da7e144145d3267cc0b5711c937390e10c262a458f186cd
Python
1,711
46
"""Common interface to hyperbolic spaces. Lead author: Thomas Gerald. """ import geomstats.errors as errors from geomstats.geometry._hyperbolic import HyperbolicDiffeo # noqa from geomstats.geometry.hyperboloid import Hyperboloid from geomstats.geometry.poincare_ball import PoincareBall from geomstats.geometry.poinc...
7f530414057a2a2809348ae072598144a045070867d244b7f03541e572e8db81
Python
1,711
49
from pathlib import Path from idtrackerai import ListOfBlobs, ListOfFragments, Session from idtrackerai.utils import wrap_entrypoint def populate_groundtruths(blobs: ListOfBlobs, fragments: ListOfFragments): """Sets the groundtruth identity of every fragment from the final identities of its blobs. Crossings ...
9d7f8f7d5dab7fb0b5fed1d7a5c856c2fcf324660440cfdf8ff319741ffc12ed
Python
1,711
51
""" 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 quantities as pq from utils.io_utils import load_neo from snakemake.logging import logger CLI = argpa...
7cb52f80e28a93a7564bda32e3166aa0bc7dd2a897f5bebf1300c99489176de8
Python
1,712
53
from sklearn.ensemble import RandomForestClassifier from matplotlib.backends.backend_pdf import PdfPages import pandas as pd import numpy as np import matplotlib.pyplot as plt data = pd.read_csv("Feature_3102.csv", sep='\t') feature = data.iloc[:, 5:-1] label = data.iloc[:,-1] rfc = RandomForestClassifier(random_sta...