sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
33ea060e7d5c1bdd4dd06b424ac2ed0cc6b40ef85afc39ba623d076262664106
Python
4,082
128
# Taken from a PyTorch Lightning tutorial # https://pytorch-lightning.readthedocs.io/en/stable/notebooks/lightning_examples/cifar10-baseline.html import os import argparse import random import torch import torch.nn as nn import torch.nn.functional as F import torchvision from pl_bolts.datamodules import CIFAR10DataMo...
70bcb90df18d8b21c48599f4b4d1b0b393c2adad0163153b4f4069adacc0d94d
Python
4,082
96
''' airPLS.py Copyright 2014 Renato Lombardo - renato.lombardo@unipa.it Baseline correction using adaptive iteratively reweighted penalized least squares This program is a translation in python of the R source code of airPLS version 2.0 by Yizeng Liang and Zhang Zhimin - https://code.google.com/p/airpls Reference: Z....
8d5caa833285160a756e888d36c81df37ac875dea4c88c2bfe66cf99a21afe10
Python
4,083
120
import os import numpy as np import requests from collections import Counter from rdkit import Chem from tqdm import tqdm from time import sleep import logging import matplotlib.pyplot as plt import seaborn as sns def seq2rat(sequence): # dict count stores information for each sequence dict_count = dict(Cou...
ab36e767dbe01711fde264601dbc03dd09a5b99458925012c9b2ffb4b8a5dc1d
Python
4,084
119
# -*- 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 ...
11f64c921cd5605c12648b3586f9f9864ef050aa99d446e5cf5757c677322984
Python
4,085
116
"""I/O functions for Adjacency objects.""" from pathlib import Path import numpy as np import polars as pl from nltools.io.h5 import _read_polars_frame, _reject_legacy_h5, _require_h5 def _write(adj, file_name, method="long"): """Write an Adjacency to a `.csv` or `.h5` file. HDF5 is the round-trip format:...
a1e2e6285c0184a83a9ff5b9c66df4548bc322aef9654c0e60f8e0122eebcfb9
Python
4,085
111
""" The GOOD-Arxiv dataset adapted from `OGB <https://proceedings.neurips.cc/paper/2020/hash/fb60d411a5c5b72b2e7d3527cfc84fd0-Abstract.html>`_ benchmark. """ import os import os.path as osp import gdown import torch from munch import Munch from torch_geometric.data import InMemoryDataset, extract_zip class GOODArxi...
a776a65449bf41991656c8b28ff49403100546448ad7158c2f7caf617b109d3a
Python
4,086
122
""" Is the max-tree really the exact TFCE integral? This is the claim the whole transform rests on, so it is checked against an *independent* implementation: the obvious one, which steps the height over a grid and labels connected components with ``scipy.ndimage.label`` at each step. That reference has a discretisatio...
3dede757eacc989588f0028cce46c4ba43f3cb5108bddad032c6547b1395f45e
Python
4,087
84
import os import tarfile from os import PathLike from pathlib import Path from tempfile import TemporaryDirectory from urllib.request import urlretrieve from .utils import _print_progress DATASET_URLS = { "AFM-ice-Cu111": "https://zenodo.org/records/10047850/files/AFM-ice-Cu111.tar.gz?download=1", "AFM-ice-Au...
9623b5abd22de2ceea31bb142b696cdce7e80d818ee39fbc22ab72abe35cc013
Python
4,088
117
# 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...
0d6313ba5ba60509d5087ec4c54821f7dd5d7c41720e923ca5a52ed4cf9d2b00
Python
4,089
145
#!/usr/bin/env python3 """Create the build metadata bundled with a packaged SanPy application.""" from __future__ import annotations import argparse import json import platform import subprocess from datetime import datetime from importlib.metadata import PackageNotFoundError, version from pathlib import Path PACKA...
719686c2dbcde661537e4cef7e6f91f12605a7bdea934e2fed097d2b9348424c
Python
4,089
128
# ------------------------------------------------------------------------------ # Copyright (c) Microsoft # Licensed under the MIT License. # Written by Bin Xiao (Bin.Xiao@microsoft.com) # Modified by Ke Sun (sunk@mail.ustc.edu.cn) # ------------------------------------------------------------------------------ from ...
0ee4d1678bbcdbc3b14a3c3843481e7f2790a0cfa1f65d5410f7df7b0c67ad41
Python
4,091
97
# Copyright 2020-2023 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from enum import Enum # Define the model names. This is a non exhaustive list of models that can be used in the tests class ModelName(Enum): """ Enum class to define the model names. """ # IMP - The model name must be same (...
31029431f63a832c781f79b3de9e1e26b24290dbf276a6448e16b3be49bde41c
Python
4,092
101
"""Keep proprietary held-out data out of the repository and out of every release. TCRvdb / MATCHMAKERS (Messemaker et al., doi:10.1101/2025.04.28.651095) is licensed for academic, non-commercial use with no redistribution, in whole or in part. So TCRvdb may be read during validation and must never be written anywhere ...
d16a5b6fb8c7e939863f67274ecd875ee8ba1dc1e71f292a420a2d1181b68a2f
Python
4,092
121
import sys import os import numpy as np import LFPy import json from cortical_neuron import cortical_neuron as init_neuron import csv from neuron import h, load_mechanisms from scipy.stats import poisson from math import ceil def load_spike_times(spikingFile): """ Load spike times from the file specified by th...
663e7e7c17a3fcee0693a5ce2a5d1bfb89aa1951074a3e5b3d12aa2d00375455
Python
4,093
93
""" Detect waves by clustering triggers that are close to each other in time and space. """ import neo import numpy as np import quantities as pq import argparse from sklearn.cluster import DBSCAN from utils.io_utils import load_neo, write_neo from utils.neo_utils import remove_annotations CLI = argparse.ArgumentPars...
95028dbb32b55a0507a88d751c719e7dedcbe94263d70d822a3902765741bcdb
Python
4,093
112
import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from sklearn.linear_model import LinearRegression from sklearn.metrics import mean_squared_error from sklearn.preprocessing import MinMaxScaler import matplotlib.pyplot as plt df...
e01dc9adeb6d4bb3fa842062f4aad6b23c24c4d3e21b13574173a235e49b64fe
Python
4,096
142
# 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 IPython import get_ipython import os # os.environ["CUDA_VISIBLE...
359a73c4633a9a2183df8dd281fa49977380aa2a7cea01ec0c54f4fd7df44f0a
Python
4,097
114
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
393fc8c01c1e9a0a5e2614596eed72cfcbc49d755c1cabaa2febf8079bbbddf5
Python
4,099
94
""" Detect waves by clustering triggers that are close to each other in time and space. """ import neo import numpy as np import quantities as pq import argparse from pathlib import Path from sklearn.cluster import DBSCAN from utils.io_utils import load_neo, write_neo from utils.neo_utils import remove_annotations CL...
4555048736ac548b89f696396625b2ad11f1f90881bd2c3e8f1cfbd75efa8fcd
Python
4,099
112
import torch import torch.nn.functional as F import torch.nn as nn import pytorch_lightning as pl import torchvision class VisionTransformer(pl.LightningModule): def __init__(self,classes,multiLabel=False,LR=1e-3,optim='SGD',momentum=0.99,pretrained=False): #LR:learning rate #optim: SGD or Adam ...
00578af9341688334dfd133e0668d6ec258087fd07337bc596f5a4fbbd987ff2
Python
4,100
108
# Copyright 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openfl.experimental.workflow.interface import FLSpec from openfl.experimental.workflow.placement import aggregator, collaborator import logging logging.basicConfig(level=logging.INFO) log = logging.getLogger(__name__) class TestFlowIn...
0cb079592df9676697a7048897e87a0edd9bc9ff09e8baa3ef664d4033e6e394
Python
4,100
87
#Import the Libraries import numpy as np from scipy.io import loadmat # this is the SciPy module that loads mat-files import matplotlib.pyplot as plt from datetime import datetime, date, time import pandas as pd import os from natsort import natsorted import re #Make a list of the files #Mat_Beh_dir='/ZPOOL/data/proj...
54d8978f515932db9c7ce8dcab12ce8974ae586231c365f5973f1650b6c5595a
Python
4,100
82
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Script for training a CNN model, parameters are currently set to values used in final model. """ import numpy as np import functions as f import tensorflow as tf import matplotlib.pyplot as plt runs = 50 #Number of training runs to pe...
5af307e7df5e9a7acbff9d7be566d58b07dadebfd3dac766a75c895b3e978a20
Python
4,102
114
import numpy as np import xarray as xr from numpy.testing import assert_allclose from xarray.testing import assert_allclose as assert_xr_allclose from gemmr.sample_analysis.postproc import * def test_power(): ds = xr.Dataset(dict( between_assocs=xr.DataArray(np.linspace(0, 1, 10).reshape(1, -1), dims=('...
ee64b1abc8b575bb4a1c4f0ceedd9a4d15a7c8d2a4c2de4187ea6ecaf0781b9e
Python
4,103
122
import pickle from typing import cast import numpy as np Value = float | str | np.float32 | np.float64 | np.ndarray | None class History: def __init__(self, csvpath: str | None = None, warmup: int = 0): """ warmup: `int` Write only if `self.count > warmup`. Useful if unkn...
78a04c74f5a9ca3d933a37e0445616d9be01ade768741b550f638f669507cea1
Python
4,104
98
""" Remove detected triggers (state transitions) when the corresponding Up and Down states are shorter than a minimum duration. """ import numpy as np import neo import argparse import quantities as pq from utils.io_utils import load_neo, write_neo from utils.parse import str_to_bool CLI = argparse.ArgumentParser() ...
200c3d9446b39379fe24be3604901aa9787827b1dee8b19525501b2a04b88121
Python
4,105
130
import pytest from corgie.helpers import BoolFn from corgie.cli.create_segmentation_masks import ( DetectSlipMisalignmentsJob, DetectStepMisalignmentsJob, DetectConsecutiveMasksJob, ) def misalignment_evaluation(stack, result, exp): bf = BoolFn(exp) mask = [False] * len(stack) def stack_simi...
9c53ebbd99e954ce1e73a3578d76a23cf13c7e92307dba3b075207fda47ecde3
Python
4,106
106
import numpy as np def generate_stim(duration, dt=1e-4, stim_on=.2, I_stim=[1.], nr_of_trains=5, nr_of_pulses=4, stim_freq=5, pulse_width=[.2e-3], pulse_freq=100, ipi=.1e-3): ''' Generate a pulse train to be used as the stimulation waveform. Parameters: ----------------------------------------------------...
03d9a6bb92152f4c7915729e3315451f24cdb8508f61a0541a917e35723afc5b
Python
4,107
134
from .objparser import load_obj, save_obj, WavefrontOBJ import numpy as np from scipy.spatial.transform import Rotation class ObjHandler: """ Handler for .obj files. """ @classmethod def read(cls, filename): """Load an .obj file. :param filename: The path of the file. :ty...
65033131a26296a04a09ce403e4c18030f4640f74d1c9c62e85fc9040917a46c
Python
4,107
105
"""Module that defines optimizers to train a model.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf from sleeprnn.common import constants from sleeprnn.nn import adam_w def generic_optimizer_fn(optimizer, loss, clip_norm): ...
c91d68e85e8b4a4d96fc9c82810f97a07ec4217d8d980008e68b0f71ce89a11c
Python
4,107
114
"""`--keep_checkpoints`, `--save_all_checkpoints` and `--clip_grad`. Three flags whose effect is a file that is or is not deleted, and a gradient that is or is not shortened. All three are invisible in a passing run, which is why none of them had a test: the training finishes either way. `--keep_checkpoints` is the o...
ce37a7401313bd05003d323bf3c49680dc731f633766d116d45e35dafb7915b6
Python
4,107
113
from video_stream import ImageSource, AcquireException import cv2 import time from pathlib import Path class VideoImageSource(ImageSource): """ VideoImageSource - an image source that reads images from a video file or a camera using openCV. """ default_params = { **ImageSource.default_params,...
2da95d37e2fefa63dd409b997013be490f6c4ab8a9b6bc113a7656222c2157d7
Python
4,111
93
""" Detect waves by clustering triggers that are close to each other in time and space. """ import neo import numpy as np import quantities as pq import argparse from sklearn.cluster import DBSCAN from utils.io_utils import load_neo, write_neo from utils.neo_utils import remove_annotations CLI = argparse.ArgumentPars...
15cf50edcded580f9920a61766d8774a3ba5736fa1fbb0a0fda61723d126d587
Python
4,113
80
"""No metric may depend on the order of the rows it is handed. CLAUDE.md hard rule 7: same inputs, same bytes, in another process, on another host, at another core count. A metric that reads a tie off the incoming row order breaks that without raising, and it breaks it *selectively* -- purity survived because it sums ...
beb6654d76fd8b12a8d8b3f7e20cd2e9f9ba4c5ad45a39f2ffe432d10be58f91
Python
4,114
127
import json import os from pathlib import Path from typing import List, Optional import pandas as pd import pytest import torch from ase import build from mace import data as mace_data from mace.calculators.foundations_models import mace_mp from mace.tools import AtomicNumberTable, torch_geometric, torch_tools def ...
3f49e03dbded7797434af8fe6d34bc81f36a53b567911902719e8183e9c4126e
Python
4,116
106
# this script reads in a csv file containing smiles (in "smiles_column") and enumerates ring systems and their precedence, # resulting in a .json database that can be used in the "comp_ringprecedence" scoring component # example use # python compute_database_precedence.py --dataset [CSV_FILE] --smiles_column SMILES --o...
6c6f2ed56a6d3c460c550764a3e3370c0afbb298287906bf2a3898006611b473
Python
4,117
126
import argparse from tqdm import tqdm import torch.nn as nn import torch.nn.functional as F import torch from bindsnet.network import Network from bindsnet.pipeline import EnvironmentPipeline from bindsnet.encoding import bernoulli, poisson from bindsnet.network.topology import Connection from bindsnet.environment im...
72000a41503aae3baf7e1cde547d1e86f89a0f9656c50a09e5352fd5ee923335
Python
4,117
110
import torch import numpy as np from torch_geometric.utils import to_dense_adj, dense_to_sparse, subgraph from torch_geometric.data import Batch, Data class UniformSample(): r"""Uniformly node dropping on the given graph or batched graphs. Class objects callable via method :meth:`views_fn`. Args: ...
b13d63caaa719c4e922dedfc0db6e8e98212b678cdc5385a94a10e2f13d73aa7
Python
4,118
115
from PymoNNto import * import time from globparams import * import scipy as sp settings = {'dtype': float32, 'synapse_mode': SxD} def segIndex(inp_list, size): import numpy as np arr = [[] for _ in range(size)] for idx,value in enumerate(inp_list): arr[value].append(idx) arr = [np....
c77e8c83716e6069dec60c852b63821bad3be33633ea4f39d0a315998bbb7b9c
Python
4,118
98
""" Remove detected triggers (state transitions) when the corresponding Up and Down states are shorter than a minimum duration. """ import numpy as np import neo import argparse import quantities as pq from distutils.util import strtobool from utils.io_utils import load_neo, write_neo CLI = argparse.ArgumentParser()...
167427400af6a4a2df98b83acc343921b2ab30cbf31a78176298eb9a0517f800
Python
4,120
106
from typing import Dict, List import numpy as np from rdkit.Chem.rdChemReactions import ChemicalReaction from reinvent.chemistry.library_design import FragmentReactions from reinvent.chemistry.library_design.reaction_filters.base_reaction_filter import ( BaseReactionFilter, ) from reinvent.chemistry.library_desi...
e17be70758a743430383fd1de6501544de9e79d81eabc92f109dbed8760a650e
Python
4,120
94
""" Detect waves by clustering triggers that are close to each other in time and space. """ import neo import numpy as np import quantities as pq import argparse from pathlib import Path from sklearn.cluster import DBSCAN from utils.io_utils import load_neo, write_neo from utils.neo_utils import remove_annotations CL...
1eb89abf30aa64c875724f0983805dfa6513e89d3ab1506ac0450f2ad8796643
Python
4,126
115
import torch as T import torch.nn as nn from Networks.network import Network class UNet4(Network): def __init__(self, base, expansion): super(UNet4, self).__init__() self._build(base, expansion) def forward(self, image, segbox=None): layer_0, layer_1, layer_2 = self._analysis(image) ...
c81b12e6b4c020aa23aacadc1f20ad7ff40e1e04120cabf7359f586b918a90f6
Python
4,128
91
# -*- coding: utf-8 -*- import functions.rate_coding import numpy as np import functions.Graphs import matplotlib.pyplot as plt import time_locked_functions import functions.glm_to_predict_speed_from_neuronal_activity as glm import functions.glm_tst_50_neurons_no_iterations as glm_50 import functions.statis...
18b10e61d57afe29f11e04eb695e4430bc526591c399d7323051d1016e601b02
Python
4,129
119
import os, argparse, logging from tqdm.auto import tqdm, trange from pathlib import Path import numpy as np import torch from model import SpiceMix from util import config_logger logger = config_logger(logging.getLogger(__name__)) def parse_arguments(): parser = argparse.ArgumentParser() # dataset parser.add_...
4d7e56d3df4b00c88b6a113f104bcc7595b5c9f0674a786618d48de90a2b2d08
Python
4,130
112
import numpy as np import os,glob import shutil from tifffile import imsave, imread from PyQt5.QtWidgets import QFileDialog, QApplication def get_meta(paramFile): param_list={} with open(paramFile) as f: lines = f.readlines() for l in lines: try: (val,p)=l.split(":")...
852d2260378dd50b4bbf68c741f2ad2e0bdb863b2d2078e7a769696361354675
Python
4,130
99
""" Remove detected triggers (state transitions) when the corresponding Up and Down states are shorter than a minimum duration. """ import numpy as np import neo import argparse from pathlib import Path import quantities as pq from utils.io_utils import load_neo, write_neo from utils.parse import str_to_bool CLI = ar...
6bd117295401df24fd65c47e4e8e2f69ecf2a1837cca346c9abdb1cff9911306
Python
4,131
99
""" Remove detected triggers (state transitions) when the corresponding Up and Down states are shorter than a minimum duration. """ import numpy as np import neo import argparse from pathlib import Path import quantities as pq from utils.io_utils import load_neo, write_neo from utils.parse import str_to_bool CLI = a...
a77a59aed61a758106b5fa76c501bbae238a5c9421fb2f7ffac573e00fe0bdcd
Python
4,133
107
"""The tiny AtomicDipolesMACE anchor and its reference. Its own family, not part of ``references``: the dipole anchor emits no energy, so an ase calculator cannot be driven for it at all, and its channels reach no calculator's results dict. It is snapshotted through the model forward instead. """ from __future__ impo...
77039c415ac946f31172c4e84a426a21d7532ba1784fed5ad946c69285a3b025
Python
4,134
126
import math import pytest import geomstats.backend as gs from .base import ComplexVectorSpaceOpenSetTestData from .complex_riemannian_metric import ComplexRiemannianMetricTestData LN_3 = math.log(3.0) EXP_4 = math.exp(4.0) SQRT_2 = math.sqrt(2.0) SQRT_8 = math.sqrt(8.0) class ComplexPoincareDiskTestData(ComplexVe...
cd95cd0787cdc7eed5a1495521bb591c87730e1e6136ea83882826040377f027
Python
4,135
123
"""Internal module for console introspection. Module modified from [pandas](https://github.com/pandas-dev/pandas) `pandas.io.formats.console` under BSD 3-Clause License LICENSE ======= BSD 3-Clause License Copyright (c) 2008-2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData \ Development Team All r...
68d8b5863323ac9a4a838ff8c25309e79b5bedf3b08aa2d1d411d741d9ad25eb
Python
4,136
171
"""Class for Stratified Spaces. Lead authors: Anna Calissano and Jonas Lueg """ from abc import ABC, abstractmethod import geomstats.backend as gs class Point(ABC): """Class for points of a set.""" @abstractmethod def equal(self, point, atol=gs.atol): """Check equality against another point. ...
ee44f49e196b4d30433d808bcefc4899e928e430be847b329c993ae2050012bc
Python
4,137
97
import torch import numpy as np def collect_bond_dists(mols_dict, valid_list, con_mat_list): """ Collect the lengths for each type of chemical bond in given valid molecular geometries. Args: mol_dicts (dict): A python dict where the key is the number of atoms, and the value indexed by that key is...
fb0ed655fc8a7c48f10b56f66ffbeb30af99df331d6be92247714c7400e4306b
Python
4,138
123
import csv import os import pytest from reinvent.runmodes.scoring.run_scoring import run_scoring SCORING_CONFIG = { "type": "custom_sum", "parallel": 1, "component": [ { "custom_alerts": { "endpoint": [ { "name": "Unwanted SMA...
8b4415876839f09dede521ef106bb140b56d34719082be6e152b83c2964e9369
Python
4,146
112
# -*- 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...
1bf9681aeb1a48c5e2d88bdc535ca3a058faeb8d17f1d258484dbf892fb68fef
Python
4,149
132
""" Partially noise the structures and reconstruct them using the trained model """ import os import argparse import logging from pathlib import Path import json from typing import * import numpy as np import torch from huggingface_hub import snapshot_download from foldingdiff import datasets, sampling, utils, mode...
2838bb98f45c6bf72f52dd7c38592a658a480464f09d9a36b6c44f6c55ba9e62
Python
4,151
151
"""Compute scores with Therapeutics Data Commons Example TOML config (staged learning): [[stage.scoring.component]] [stage.scoring.component.TDCommons] [[stage.scoring.component.TDCommons.endpoint]] name = "tdc_jnk3" weight = 1 [stage.scoring.component.TDCommons.endpoint.params] type = "JNK3" """ from __future__ ...
81a2408f5e62342272081af1ad7c51bd90cf40fad6c60f812f5b1fa8a31bc0fc
Python
4,152
131
""" Does the accelerated GLM return what the unaccelerated one returns? The whole point of :class:`tfce.glm.PermutedGLM` is that it never forms the permuted dataset and never forms the residual matrix. That is an algebraic rearrangement, not an approximation, so it must agree with an honest refit to floating-point pre...
b545a7437908d848b1071f7998799c076e8ef970d2fa555e12fb2785afc17e66
Python
4,153
135
"""Machinery to handle global control of dtypes. Notes ----- Functions starting with "_pre" are shared functions that just need access to specific backend functions. e.g. `_pre_set_default_dtype` requires access to `as_dtype`. `set_default_dtype` can then be created in each backend by doing `set_default_dtype = _pre_s...
9186f2941378665c33531ec0de119e28c0dcdf26986be604f86a7ac1ff87f160
Python
4,154
130
import random import time from pathlib import Path import numpy as np import ppafm.ml.AuxMap as aux import ppafm.ocl.field as FFcl import ppafm.ocl.oclUtils as oclu import ppafm.ocl.relax as oclr import torch from ppafm.ml.Generator import InverseAFMtrainer from ppafm.ocl.AFMulator import AFMulator import mlspm.prep...
9c1125ee8f230f300b1e8349ed9a4ae899e4cf40a3a82497d1cfede716c6b74e
Python
4,155
139
#!/usr/bin/env python """Tests for `pymonntorch` package.""" import pytest # from click.testing import CliRunner # from pymonntorch import cli import pymonntorch def test_network_cpu_annotated(): from pymonntorch import ( Network, Behavior, NeuronGroup, SynapseGroup, Re...
5c38f0f6928dfb3aeb9789efaf50597a393ff9ee39f4c13f1c614285a5eabbf8
Python
4,156
93
from DeepPurpose import utils, dataset from DeepPurpose import DTI as models from DeepPurpose.utils import * import pandas as pd import wandb from tqdm import tqdm import sys import warnings warnings.filterwarnings("ignore") import argparse def main(run_id, cuda_id, wandb_project_name, general_architecture_version): ...
8c2386682079752567335524b1bdd23f0646b57c0b93f9cae2b6ab07ca446cb9
Python
4,156
115
# Copyright (C) 2024 Intel Corporation # Licensed subject to the terms of the separately executed evaluation license agreement between # Intel Corporation and you. import numpy as np from typing import Iterator, Tuple from openfl.federated import PyTorchTaskRunner from openfl.utilities import Metric class Template...
05284a14f6320fc0d01e63442552e54c65bbc8d01e0ef6e2eb8cf483057a8548
Python
4,157
135
import os import pytest import numpy as np from chromadb.utils.embedding_functions.morph_embedding_function import ( MorphEmbeddingFunction, ) def test_morph_embedding_function_with_api_key() -> None: """Test Morph embedding function when API key is available.""" if os.environ.get("MORPH_API_KEY") is None...
de1804fbe7a38566e45655a6e7661310aa8db3dabbb78977a9d723de4fd6a26e
Python
4,159
115
"""ICA/PCA component viewer — interactive decomposition explorer.""" import matplotlib.pyplot as plt import numpy as np import sklearn from numpy.fft import fft, fftfreq from nilearn.plotting import plot_stat_map from nltools.utils import _attempt_to_import # Optional dependencies ipywidgets = _attempt_to_import( ...
5cdb26a58c0959bb2de9690a53acd47d9647562a384fe317972336511baa5415
Python
4,160
90
import tensorflow as tf flags = tf.app.flags FLAGS = flags.FLAGS class OptimizerAE(object): """ Optimizer for GAE """ def __init__(self, preds, labels, degree_matrix, num_nodes, pos_weight, norm, clusters_distance): preds_sub = preds labels_sub = labels # Reconstruction t...
621a418f2716f3ba052325cd6f2fa1bbaf05e7ee316592cff976562dd3a70f26
Python
4,160
106
""" Plot snapshots of the input data showing the detected waves. """ import os import numpy as np import quantities as pq import argparse import matplotlib.pyplot as plt from utils.io_utils import load_neo, save_plot from utils.neo_utils import analogsignal_to_imagesequence CLI = argparse.ArgumentParser() CLI.add_arg...
e7b523c41fc2c9935bb24801f0f52fb0249e3002638d6c604ad7a851d8b0b38c
Python
4,160
147
from numba import deferred_type, int64, boolean, types, float64, int32, optional from numba.experimental import jitclass import numpy as np TreeType = deferred_type() spec = [ ('children', optional(TreeType)), ('dataIndex', int64[:]), ('dataClass', int64[:]), ('dataLabel', int64[:]), ...
c987dbcb799983a140d94aa340c66ae726c6216a0ea8e6b6e72d9e13fcffe3fd
Python
4,162
104
"""`--foundation_model_kwargs`, and the one path that reads it. The flag is a string holding a Python dict literal, parsed with `ast.literal_eval` at the very top of `run()` -- before any data is read, and whether or not a foundation model was asked for. So the parse is what every run pays for, and it had no test. Wh...
c9c0d22903b0f3d8d9a40f9572ba8817bcd701efe5357a924f0dcc91866340ac
Python
4,162
130
r"""Compute and visualize a geodesic regression on the sphere. 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, - :ma...
5ffa51b0a9e1ea231b0a7ea5d811de64dca519c58e2cf5b8c1ec568204a1d2e9
Python
4,163
134
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. import subprocess import tempfile import zipfile import pytest from conftest import _check_and_print @pytest.fixture(scope="session") def package_from_training(fake_model_training_session, tmp_path_...
5c309207e64e06357502bf31b6e5bfb5fb0742c2874673b23475da60a762c5d7
Python
4,166
108
import time import torch from torch import Tensor from torch_sparse import SparseTensor from torch.utils.data import DataLoader from torch_geometric.data import Data from typing import NamedTuple, List, Tuple from dig_ext.relabel import relabel_one_hop relabel_fn = relabel_one_hop class SubData(NamedTuple): dat...
cbe3e4cabd4b00806fdeaaa499d4a8e1bbdd300be63996e6bdf18462092c0d24
Python
4,167
117
""" Script to add oxygen to backbone. This is not strictly included in the original set of dihedral/bond angles, and it is not technically a part of the backbone, but is required for some downstream tools to work (e.g. pymol). This script is meant to be run directly on generated backbones, that have not yet have side c...
f37c8dace4224321b8bb54272bab224c46b6ac9c13df5e7fa1b8c8ea31e5c8b4
Python
4,167
109
from typing import NamedTuple, List, Tuple import time import torch from torch import Tensor from torch.utils.data import DataLoader from torch_sparse import SparseTensor from torch_geometric.data import Data from dig_ext.relabel import relabel_one_hop relabel_fn = relabel_one_hop class SubData(NamedTuple): da...
e8c039b1fa3f336faef667fcb584c779ecc5583d612bf4d278fdcb2aadb9a7d9
Python
4,170
127
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch import torch.nn as nn from fairseq.modules import Fp32GroupNorm class KmeansVectorQuantizer(nn.Module): def __init__( ...
1a87c1a5a6e6a7414fcad3ae4c36d6343e6f60540e370414768b78c276664b8c
Python
4,171
160
"""Resolve the SanPy source identity used for spike detection.""" from __future__ import annotations import json import subprocess from dataclasses import dataclass from importlib.resources import files from pathlib import Path from typing import Any import sanpy @dataclass(frozen=True) class SanPyProvenance: ...
0fd3ace4604cca63650021e93d18bfe63ca3762d1526c34477f76a4630dca8f8
Python
4,173
143
import deep_convolutional_representation as dcr import numpy as np import statsmodels.api as sm import statsmodels.formula.api as smf from sklearn.metrics import mean_absolute_error, r2_score, max_error from sklearn.metrics import explained_variance_score, mean_squared_error import matplotlib.pyplot as plt import ...
961d1cd1458e2e41ab511471f3190a4c17e2656c0d7341e609f37e5da4601a4a
Python
4,174
91
"""AIRR conformance and the legacy-vs-tables property, on a real build. Marked ``release``: needs a built directory (``VDJDB_TABLES``, default ``out/tables``) and the legacy projection beside it. The unit tests cover the mappings; these two properties only mean something at corpus scale. """ from __future__ import ann...
626d655c3f90524a1bb05af574da2394f007b9f366ff39ace4e096629cfb6f42
Python
4,175
98
# Author: Youzhi Luo (yzluo@tamu.edu) # Updated by: Anmol Anand (aanand@tamu.edu) import torch from torch_geometric.data import Batch, Data from torch.nn import Linear, Sequential, ReLU, Softmax, BatchNorm1d as BN from torch.distributions import Categorical from .aug_encoder import AugEncoder from .node_fm import Node...
0cc780d6f95ab0d91b8d1361303f2962965325d412598639e0310e3a92bc6bac
Python
4,176
108
import argparse import os import re import numpy as np import matplotlib.pyplot as plt import seaborn as sns import pandas as pd from sklearn.preprocessing import MinMaxScaler import torch.nn as nn from models.models import Brainmodels from data.data_loader import * from rsa import * # Define model names and their cor...
813259104efe520057c56149cfcd65de6af51a24bb2539ec5611f5f793e3ec67
Python
4,179
144
#!/usr/bin/env python3 # # Sniffles2 # A fast structural variant caller for long-read sequencing data # # Created: 14.01.2024 # Author: Hermann Romanek # Maintainer: Hermann Romanek # Contact: sniffles@romanek.at # """ Resource monitoring utilities (currently memory) for Sniffles """ import logging import...
ec7b941308aa8182cd3c2aba8d28000ea15fea482f2809833f15f953ff755bfd
Python
4,183
115
import unittest import numpy.testing as npt import pytest import torch from reinvent.models import ReinventAdapter from reinvent.models.reinvent.models.model import Model from reinvent.runmodes.utils.helpers import set_torch_device from tests.test_data import PROPANE, BENZENE, METAMIZOLE @pytest.mark.integration @p...
bade3819c78daf2ca62cbe08fa1f539d393563875228266eb52c6054a8cf0ac7
Python
4,189
113
from pathlib import Path import mne from .. import io from ... import logger def set_eeg_reference(inst, ref_channels, ref_old=None, **kwargs): """ Reference to new channels. MNE raw object is modified in-place for efficiency. Parameters ---------- inst : mne.io.Raw | mne.io.RawArray | mne....
197ee435365f50a1ec33e9709a117079f22d524621cde6b147602768547831c1
Python
4,190
132
from __future__ import annotations import argparse import re from pathlib import Path from typing import Any import attrs from snakebids import bidsapp from snakebids.exceptions import ConfigError from snakebids.io.yaml import get_yaml_io def _make_underscore_dash_aliases(name: str) -> set[str]: """Generate --...
88d49763e973528ade234686ea909dba884f13792bc10922e2540f02feb57050
Python
4,190
121
import torch from mace.tools import torch_geometric def _zeros_with_size0(tensor: torch.Tensor, size0: int) -> torch.Tensor: if tensor.dim() == 0: return torch.zeros_like(tensor) shape = list(tensor.shape) shape[0] = size0 return torch.zeros(shape, dtype=tensor.dtype, device=tensor.device) ...
0eff85fefd87e4e5e7d94e983bfba12df60a226702de97c20d3e38ee5a49daa1
Python
4,193
122
import random import pytest from geomstats.metric_geometry.bhv_space import Tree, TreeSpace, TreeTopology from geomstats.test.parametrizers import DataBasedParametrizer from geomstats.test.test_case import TestCase, np_only from geomstats.test_cases.metric_geometry.point_set import ( PointSetMetricTestCase, P...
322b11fc513a60601e2edf65fa29c1c57abee9580577ff3e7b9d1cfcd44e409f
Python
4,194
145
"""Filter SMILES with regular expressions Assumes correct SMILES syntax e.g. that elements other than the basic ones are in brackets. """ from __future__ import annotations __all__ = ["RegexFilter", "SMILES_TOKENS_REGEX"] import re from collections import Counter from typing import Optional, TYPE_CHECKING from . im...
350eb6e54bca6be1376e67127d2768bbcc3d0275819c538ee72aed71494f6f48
Python
4,194
90
import os, sys, argparse, logging, warnings import numpy as np from configs import configs from train_eval import train_eval, evaluate, predict from metrics import RMSE, MAE, ROC, PRC from datasets import get_dataset, get_splitted parser = argparse.ArgumentParser() parser.add_argument('--mode', type=str, default="trai...
f20961aef037493ccac9f585364a7e8f3897f203652cf1d194be8e63290eb63b
Python
4,194
147
import torch class TaggableObject(torch.nn.Module): """This is the base class for all taggable objects. This class is used to add tags to objects and to search for objects with a specific tag. It is a torch.nn.Module, so that any object class inheriting from this class can be used as a torch.nn.Modul...
86456b81ab2c0b21ed4752cbf6807919565b60fa6cd69891d87affc88e7f50a6
Python
4,195
96
# -*- 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...
afdefff0cfd6684dfa2284fcf4230b22dd1f22fb34a00e5b41f5bbf7b80b7c09
Python
4,195
141
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Module with auxiliary CLI helper functions.""" import os import re from itertools import islice from os import environ from pathlib import Path from sys import argv from click import echo, style from yaml import FullLoader, load FX = ...
9f60ca0b851fe7789c4f95c5f906fc2b6f111fb02c8f47b7ba1bb11a1219e358
Python
4,196
97
from collections.abc import Sequence from qtpy.QtCore import Qt, Signal # type: ignore[reportPrivateImportUsage] from qtpy.QtWidgets import QComboBox, QHBoxLayout, QLabel, QWidget from idtrackerai.GUI_tools import InvertibleSlider, LabelRangeSlider class IntensityThresholds(QWidget): newValue = Signal(tuple) ...
3a1e1e4607fd3532a8cf34104cad41f73e823a14451d1e8cb0d30c0cd7ab01c2
Python
4,198
136
from PymoNNto.Exploration.StorageManager.StorageManager import * class StorageManager2: # %nr %rnd def __init__(self, folder, subfolder='folder+"_"+id', mainfolder='StorageManager', datafolder=get_data_folder(), print_path=True): if os.path.exists(folder): path = folder ...
80ca03159400271654b3a3e874990ccffa3ad85680ce242cc5a17c05f5a70b2f
Python
4,198
105
# Copyright 2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """This module contains the LocalDataSource class.""" import hashlib import os from hashlib import sha384 from pathlib import Path from typing import Callable, Generator from openfl.federated.data.sources.data_source import DataSource, DataSourc...
d8af023ebf00e686a71e9ba1f1b26960087c6f1232423c54ad7f613c0f3968cd
Python
4,200
139
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 14 11:55:56 2023 @author: egemo """ from torch.cuda import is_available from sys import stdout def get_device(p=False): """ Simple helper that returns "cuda" if a cuda-available device is present, else "cpu" Parameters ------...
0c7f9e2a8d5fdaa0c97ba4866db4658069f3c0035b00f3dfce66aa4c73d28134
Python
4,201
109
# 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.o3._tensor_product._tensor_product import TensorProduct from .utils import scatter from .model_modifier_utils import replace_submodules, model_modifier class TensorProductScatt...
6571425eaf590d0bab046fbf63d2a980e4f66199514db708d479e65c4574258f
Python
4,202
126
from pathlib import Path import random import time import numpy as np import ppafm.ml.AuxMap as aux import ppafm.ocl.field as FFcl import ppafm.ocl.oclUtils as oclu import ppafm.ocl.relax as oclr import torch from ppafm.ml.Generator import InverseAFMtrainer from ppafm.ocl.AFMulator import AFMulator import mlspm.prep...
72e6ba60bff89869f170d0623cab924242ca440952042349937d8e26881335c9
Python
4,203
117
"""Canonical kwarg vocabulary for the ISC family (v0.6.0 follow-up to #474). Historically the isc engine used `metric` for the mean/median central-tendency choice and `sim_metric` for the actual similarity metric, while the public `isc()` wrapper spoke the canonical names (`summary`, `metric`) and translated. The cons...
e15836af820871dc78d929ff703a2378dd46ee1d9eb2e864f228bee3be5fa2b8
Python
4,204
136
# Copyright 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import logging from openfl.experimental.workflow.interface import FLSpec, Aggregator, Collaborator from openfl.experimental.workflow.placement import aggregator, collaborator from openfl.databases import TensorDB from openfl.utilities import...
686343f56180ff75e9186dd9ea792e2d7ec21d4d4634ce9590f2c3110954b014
Python
4,206
86
"""The mature variable domain of a chain, for AIRR ``Receptor``. AIRR's ``receptor_variable_domain_{1,2}_aa`` is the complete mature variable domain -- *"from and including the first AA after the signal peptide to and including the last AA that is completely encoded by the J gene"* -- and it is non-nullable. VDJdb has...