sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
82b2dbee69ae0466ab77f0ef6c2a061d0e79fdf7cd82d388762a697c5786c72b
Python
9,374
273
import numpy as np import pandas as pd from scipy import signal, ndimage, interpolate, stats from scipy.interpolate import CubicSpline import matplotlib.pyplot as plt import matplotlib.ticker as ticker from matplotlib.ticker import FormatStrFormatter import warnings import seaborn as sns from pathlib impor...
e06943de6c03f79d41640166f0e41f7fc11b566e90764c2b5c46022be298d802
Python
9,380
304
# 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...
f9182c585d19d857a28c17d16f02dc928ef13bc07db5558789a79485fc454d8c
Python
9,393
266
# Copyright (c) 2021-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the LICENSE file in # the root directory of this source tree. An additional grant of patent rights # can be found in the PATENTS file in the same directory. import logging import math from ty...
af77d9f79bcdc49238ad4ba62b65274f571ba1c8ee128662836dd9fd013d4913
Python
9,402
238
# Copyright (c) 2023 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...
a4faa235192a6f30214fa85e4ad31a6af5807bd2a7c291375aa0bf143113ef7b
Python
9,404
231
# 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 # # Un...
dbdfa0b956c0d7bd253979ba38159dbb14ab6afa637a4c08026d8fc3390aa758
Python
9,409
249
""" data loader for adaptive sampling based on binary maps. compare randomly cropped image to corresponding binary map area. I. pseudo code A. initialize i. grap image crop/binary map ii. calculate total binary area w/in crop (sum) B. iterate i. while (binary map < 50%): a. ...
95294c50620c590085329c84f463d6ac320969083da22ea7cc3c45b387c1175d
Python
9,412
283
# -*- coding: utf-8 -*- """ Provides the abstract :class:`Measure` base class and some popular measures. Measure instances are identified by a unique :attr:`~Measure.short_name`, which is used by the :mod:`~dival.evaluation` module. """ from abc import ABC, abstractmethod from warnings import warn import numpy as np t...
c06dffaadeacda6abd342eb13ae01ff7d3032c2700b67289c497114d6eb8961b
Python
9,417
260
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """openfl.experimental.workflow.runtime package FederatedRuntime class.""" from __future__ import annotations import logging import os import sys from datetime import datetime from pathlib import Path from typing import Any, Dict, List, O...
2277bd0cb76a5bbdb12e7a0780f9e92a348d0a45d2657e043b89f218963ebb42
Python
9,425
292
# 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...
f32ce944e961633f9f9a037cd80559b338b14d98195d2c0a3bf7c7ff8e966c47
Python
9,430
273
import logging from chromadb.db.impl.sqlite_pool import Connection, LockPool, PerThreadPool, Pool from chromadb.db.migrations import MigratableDB, Migration from chromadb.config import System, Settings import chromadb.db.base as base from chromadb.db.mixins.embeddings_queue import SqlEmbeddingsQueue from chromadb.db.mi...
59880504bc75b62ade7656a793b74a54e9e0f0676dabeebb0c13e906ca89f96b
Python
9,432
256
from time import sleep from chromadb.api import ClientAPI from chromadb.api.types import IndexingStatus from chromadb.test.conftest import skip_if_not_cluster from chromadb.test.utils.wait_for_version_increase import ( get_collection_version, wait_for_version_increase, ) @skip_if_not_cluster() def test_index...
e3173bec41923b90854181799c7d11cdcbad57ca3aa1cfec2e461be3f459fbd0
Python
9,435
271
import logging import multiprocessing import shutil import sys from argparse import ArgumentError from importlib.metadata import version from importlib.resources import files from pathlib import Path from typing import Any from idtrackerai import IdtrackeraiError, Session, conf from idtrackerai.utils import ( LOGG...
5c7ed8645fe5ef9d442b4586e36ae82464bef3d8cf62faf740e2f2efe1779011
Python
9,439
230
# 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 lightning.pytorch.utilities.seed import isolate_rng from nequip.nn.graph_model import GraphModel from nequip.nn.compile import CompileGraphModel from nequip.utils import ( dtype_f...
9712643ac27cdfc847cb8acd19ede2c9c33f40bf27dfa21784116663f513f31a
Python
9,448
279
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Components Timeout Configuration Module""" import asyncio import logging import os import time from contextlib import contextmanager from functools import wraps from threading import Thread logger = logging.getLogger(__name__) class ...
11d236e4cb0f7461c4a68af1ac1f38a9ca08f5ce4cb8a35b378591e28a4c1060
Python
9,450
232
# Copyright (c) 2024 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...
9485fef4c2118263a94035d4066ab31a6d2373c859bd63280708cac9791ddbe0
Python
9,457
272
"""Utility functions for managing collection statistics. This module provides standalone functions for enabling, disabling, and retrieving statistics for ChromaDB collections. These functions work with the attached function system to automatically compute metadata value frequencies. Example: >>> from chromadb.uti...
3247972a71a3b4df42a4daea2e15b254af68a35e8d84a376637d16a7e72ad957
Python
9,458
264
# -*- 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...
e2ce05c71a0cf1a60374cc9794eccbbd08d4bb2d3f2e9a6166ede9bfa3472307
Python
9,463
311
import torch import numpy as np torch.set_printoptions(precision=9) if torch.cuda.is_available(): device = "cuda" else: device = "cpu" def test_PosNet(): from mlspm.models import PosNet cnn = PosNet( encode_block_channels=[4, 8, 16, 32], encode_block_depth=2, decode_block_ch...
6c62d1065565c07f895760b96f3f67cf7b5c309c1bc835a71b22cb758ac3098b
Python
9,465
233
import pytest import numpy as np from nltools.data.designmatrix import DesignMatrix class TestDownsampleNonIntegerRatio: """F083: non-integer sampling ratios must not produce an oversized final group.""" def test_non_integer_ratio_no_oversized_final_group(self): """2 Hz -> 0.7 Hz (ratio ~2.857) must ...
8b753b07b13ec02c04b4bf4fdee8784d95a733a7c6d6f200349b3c725d0d9e59
Python
9,479
260
"""Lazy fetcher for files hosted in the `nltools/niftis` HF dataset. Covers MNI templates, parcellation label maps, the parcel-names CSV, and any other resources living under huggingface.co/datasets/nltools/niftis. First call for a given file downloads it into the local HF cache (`~/.cache/huggingface/hub` by default)...
a708a3ebd6977d13966f292233cb235fea51680c2a3b4a7863e73572c80e0b4e
Python
9,481
270
import torch import os import numpy as np import pandas as pd import pytorch_lightning as pl from lightning.pytorch.utilities.combined_loader import CombinedLoader from rdkit import Chem from torch.utils.data import Dataset as TorchDataset from torch_geometric.data import Data as GeometricData from torch_geometric.loa...
3da4c8d030fc096ea6354bed5b6f222cc4a8d5b164a6b754ddd9dd98faef8099
Python
9,483
242
# Copyright (c) 2023 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...
66cee0629421326cd2f0ed03d25555b4a00a22a28a9408956620c59fde88a921
Python
9,492
295
# 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 app...
9a34b6de813a6a5393f220205d753dd2bae9b53adc36aefdaba11799944d22bf
Python
9,493
262
import math from typing import Iterable import numpy as np import torch from model_angelo.utils.misc_utils import assertion_check from model_angelo.utils.residue_constants import ( restype_1_order_to_hmm, index_to_hmm_restype_1, num_prot, restype_1_to_index, restype_3_to_index, ) from pyhmmer.pla...
e3a258071fb826ab3b2c2956e2556d629726f47ce0c8a876fe261486a2e236fe
Python
9,493
231
""" Algorithm: - leave one row (seed) out - run ppca on remaining data - apply the extracted dimensions to each set of left-out ratings for each country, resulting in component scores for each country and seed image - to compute significance, loop through each pair of countries - correlate their component scores and ...
a7009d23fd7db3c15e6f4c5c84d40f91b42395c14bd477590c5f8d3c0f2817fb
Python
9,496
253
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """openfl.experimental.workflow.interface.participants module.""" from typing import Any, Callable, Dict, Optional class Participant: """Class for a participant. Attributes: private_attributes (dict): The private attribu...
797efe377e0c4e9835e01499e64894c82febfc629c84d5f0c8ce2580a693f458
Python
9,500
291
# Reference: https://xylambda.github.io/blog/python/pytorch/machine-learning/2021/01/04/pytorch_trainer.html import time import numpy as np import pandas as pd import torch import torch.nn.functional as F from sklearn import metrics from tqdm import tqdm class Trainer: """ Parameters ---------- mode...
0ae818cc3e64475d3da037439f77ac0db45c51487705599f8df9c8750c131172
Python
9,502
247
import PySpin from video_stream import ImageSource import time class FLIRImageSource(ImageSource): default_params = { **ImageSource.default_params, "exposure": 8000, "trigger": True, "frame_rate": None, "stream_id": 0, "acquisition_timeout": 5000, "pyspin": ...
1be87ca548ca92b89f093b62e232260858ac23c7ad4ae7d0a8aac36092d138c0
Python
9,503
290
# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve. # # 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 applica...
0a09657930d486ca653fad9b4ed520969d83190c85002d7c3acca7aaf1536ad7
Python
9,504
321
"""Class for the spider. Lead authors: Anna Calissano & Jonas Lueg """ import geomstats.backend as gs from geomstats.geometry.euclidean import Euclidean from geomstats.metric_geometry.point_set import ( Point, PointBatch, PointSet, PointSetMetric, ) from geomstats.metric_geometry.vectorization import ...
b99d40a170debe33995959339887e707ec55f18976c5a0b809eb6ca6bf6212e3
Python
9,509
210
# 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 lightning.pytorch import seed_everything import e3nn from .global_dtype import _GLOBAL_DTYPE from .versions.torch_versions import ( _TORCH_GE_2_6, _TORCH_GE_2_9, _TORCH_...
cbbd7fe89f2d60ed34c9120f1bd138df66bf417e1e67ed66eaad050a3a6160b5
Python
9,512
330
import numpy as np # import matplotlib.pyplot as plt import torch import h5py import torch.nn as nn from torch.utils import data import itertools # number of available gpu ngpu = 1 batch_size = 16 ################################################### ## Loading the data dataRoot = "../../data" labelFiles = "labels-...
cda4214857f9f54dc05eb0dd88fae501c62d21e9bfa7609c1b06f1af7c95dee2
Python
9,513
250
#!/usr/bin/python3 import os, sys import argparse, serial, threading import datetime,time ## Input Parameters parser = argparse.ArgumentParser() parser.add_argument("Experimenter_ID", help="Please indicate the experimenters ID") parser.add_argument("Subject_ID", help="Please the Subject's ID") parser.add_argument("Ex...
1ef4d48a4986973ed31e935de3cbf185d6280fcb6551316469452a6f1648bab4
Python
9,517
323
import numpy as np from sleepy.gui.tagging.model import DataSource class Dataset: def load(path): """Static API-method that returns a raw data object for a given path. Must be implemented by direct subclasses. :param path: An absolute path to a file whose contents should be loa...
656c59471654b4b94e6852b0cc022cda3bbd352216fd5d3144ab7dc2d1ed1d06
Python
9,518
323
import numpy as np from sleepy.gui.tagging.model import DataSource class Dataset: def load(path): """Static API-method that returns a raw data object for a given path. Must be implemented by direct subclasses. :param path: An absolute path to a file whose contents should be loa...
f57dd8b5f16128b6897101cfb64c089d4ce4098fac82bcd4caecfff076da02fe
Python
9,525
232
# -*- 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...
e3c48c73d3783f84e8bdebe1b176dac82821794119f9623b7e8a6bc4f5cffac8
Python
9,527
216
# -*- coding: utf-8 -*- """ Helper file cotaining custom functions Clean code for publication @author: Sebastian Molina-Obando """ #%% #Importing packages import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.stats import pearsonr, levene from itertools import combinations...
e1190d8d233adc4488c2f51238a758b883e9064fd891f23f8e9ae77fcc2ddcf2
Python
9,533
243
"""Build and filter per-spike waveform clips for one SanPy analysis.""" from __future__ import annotations from typing import TYPE_CHECKING, Any import numpy as np from sanpy.sanpyLogger import get_logger if TYPE_CHECKING: from sanpy.bAnalysis_ import bAnalysis logger = get_logger(__name__) class SpikeClips...
945d9173b85cddf4e752a57dc6ef49e61bc3e59d0d9cefdc86aa89956e3271fd
Python
9,534
311
# 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...
214b3297b8d3a62dc01df15b57cee7c02801019174a50e66a3249ce50943d6e2
Python
9,540
299
from sleepy.test.core import TestBase from sleepy.gui.processing.core import Preprocessing from sleepy.gui.processing.supported import SUPPORTED_DATASETS from sleepy.processing.dataset import Dataset import unittest from unittest.mock import MagicMock, patch import numpy as np class MockingDataset(Dataset)...
295afeb6e5c442c8251c8e9633a75de5ceb7df334113946a7884c759f3477016
Python
9,546
283
""" Utils for featurizing a small molecule (amino acid residue) from their structures. """ import dgl from typing import Union, List from transformers import T5Tokenizer, T5EncoderModel import torch import torch.nn as nn import numpy as np from dgllife.utils import ( mol_to_bigraph, PretrainAtomFeaturizer, ...
0cbab5eb36eb844c6dce812df5a3916b313918d54303caf99317c1daaf1bce5d
Python
9,547
266
"""Prototype for the new heart of the scoring component A scoring function is composed of components. An aggregation function combines components into the final scoring function. Each component has a weight and cna be transformed from a function. Components report a primary score for training and possibly secondary...
6472217a67dab6131ea3e95a870517e391d011341784572d0182256c6dba3dc3
Python
9,555
263
import numpy as np import glob import pickle from umap.parametric_umap import ParametricUMAP import tensorflow as tf #tf.compat.v1.disable_eager_execution() sess = tf.compat.v1.Session() tf.compat.v1.keras.backend.set_session(sess) from tensorflow.keras import backend as K from tensorflow.keras.layers import Lambda,...
8c15783ad261cb35b8a747b40dea7ebafa5255a01341e6ab1cbeed5c3ec06e14
Python
9,557
183
# %% import os import numpy as np import time import h5py import sys from scipy import sparse from scipy.io import savemat, loadmat import multiprocessing as mp sys.path.insert(1, '../..') # the path containing "suns" folder os.environ['KERAS_BACKEND'] = 'tensorflow' # os.environ['CUDA_VISIBLE_DEVICES'] = '0' # Set w...
9203604ca89c4ce2295971831ca03da15bd5a614b2c944ecd7768dfb1b39deec
Python
9,563
161
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # This work is licensed under the Creative Commons Attribution-NonCommercial # 4.0 International License. To view a copy of this license, visit # http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to # Creative Commons, PO Box 1866, Mountain ...
bafe00b85b988ad083ea57710fa675bfb12b4e949d0e4a6173834ac117bb019c
Python
9,566
181
import os import requests import numpy as np from Humatch.utils import ( get_ordered_AA_one_letter_codes, get_CDR_loop_indices, get_indices_of_selected_imgt_positions_in_canonical_numbering ) # gl arrays added to compiled env package_data HUMATCH_CODE_DIR = os.path.dirname(os.path.abspath(__file__)) GL...
f8130aa5c9365de3c1e01dd46c3f48c72d98fb145c12f99c0d914aab4b5b30b3
Python
9,573
303
import os import numpy as np import pandas as pd import json import torch from torch_geometric.data import HeteroData import torch_geometric.transforms as T from sklearn.metrics import roc_auc_score, average_precision_score from GeNNius import Model, EarlyStopper, shuffle_label_data def train(train_data): mode...
f5435eebfc7d6e24fa1fd5fe156c061292e8381e7e9934624a1df72b2e2e2c5f
Python
9,579
166
from DeepPurpose import utils, dataset from DeepPurpose import DTI as models import warnings import itertools import numpy as np import pandas as pd import wandb from tqdm import tqdm import sys warnings.filterwarnings("ignore") import random import argparse def main(num_samples, val_setting, cuda_id, num_workers, da...
470b87b977d432a00e710689ba66e1866e386586942f0bec16c93e83f58e6104
Python
9,580
250
from sparse_ct.tool import plot_grid from sparse_ct.data import image_to_sparse_sinogram from sparse_ct.reconstructor_2d import ( IRadonReconstructor, SartReconstructor, SartTVReconstructor, DgrReconstructor, SartBM3DReconstructor) import logging logging.basicConfig( filename='dgr_example_32_...
9ba7a4ad30e5c58c050277eacbe03708ef83f8fa447b25a48f149d86dd5f10ab
Python
9,583
234
from PymoNNto.Exploration.Network_UI.TabBase import * from PymoNNto.Exploration.Visualization.Visualization_Helper import * class criticality_tab(TabBase): def __init__(self, title='Criticality', param='output', mask_param='Input_Mask', timesteps=500, mask_color_add=(-100, -100, -100)): super().__init__(t...
f845acfd141038e40d17aac7e1b836604881343a75b47699ed34a64afe886624
Python
9,585
122
# -*- coding: utf-8 -*- import functions.rate_coding import numpy as np import functions.manifold import functions.Graphs import matplotlib.pyplot as plt import functions.statistics_test as st from scipy import stats #%% Load data data = np.load('/datapath/dataset.npy', allow_pickle=True).item() #%% 3B ...
5dcc0285e4f93412506db9c264596b75139331836bf25e3b66e20a70f38e9e86
Python
9,586
299
#!/usr/bin/env python3 # # Sniffles2 # A fast structural variant caller for long-read sequencing data # # Created: 05.12.2023 # Author: Hermann Romanek # Maintainer: Hermann Romanek # Contact: sniffles@romanek.at # import logging import os from sniffles.config import SnifflesConfig from sniffles.snf impo...
9f65f0f6f16b2a965a2aed38a4e98f61c5437e3cbb9ca9fb4997648c908ce537
Python
9,599
223
""" Detect trigger times (i.e., state transition / local wavefronts onsets) by finding local minima preceding a prominent peak in the channel signals. """ import neo import numpy as np import quantities as pq from scipy.signal import find_peaks import argparse from pathlib import Path from utils.io_utils import load_n...
954da97c7d31e29bd05c53f3f137fcb4e4ceca67adb908f03df07d17a76a609a
Python
9,601
196
"""The junction-anchor check: what it flags, and what it refuses to call a defect. It proposes no repair. That is `arda.cdr3fix`'s job and it does it (#711); this classifies the **submitted** sequence, which is what a chunk edit would change. """ from __future__ import annotations import polars as pl import pytest f...
69be2cec6001b51dcda1910932a3410bd237d66b3cc7ea857459222696112193
Python
9,603
223
""" Detect trigger times (i.e., state transition / local wavefronts onsets) by finding local minima preceding a prominent peak in the channel signals. """ import neo import numpy as np import quantities as pq from scipy.signal import find_peaks import argparse from pathlib import Path from utils.io_utils import load_...
a93c3375523e0e94e79100827634b17e3b3241a6cc368c8bf7c08a458c612125
Python
9,605
271
""" Functions for removal of neuropil from calcium signals. Authors: - Sander W Keemink (swkeemink@scimail.eu) - Scott C Lowe Created: 2015-05-15 """ import numpy as np import numpy.random as rand import scipy.signal as signal from sklearn.decomposition import FastICA, NMF, PCA def separate( S, ...
1bf8dcbf5003ac814580a3e1ce55917ed2324fe3b97c39814ce6a5c2483fe30d
Python
9,606
248
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """openfl.experimental.workflow.utilities package.""" import inspect import itertools from types import MethodType import numpy as np from openfl.experimental.workflow.utilities import ResourcesAllocationError def parse_attrs(ctx, excl...
29b9ce1fe98b15a37c0cfcc61b33e80c5aa4495ce0e44cf0a4e91b0e639449ab
Python
9,607
268
import time import h5py import json import sys import os import six import copy import argparse import torch import torchfields import numpy as np from pathlib import Path from tqdm import tqdm from cloudvolume import CloudVolume def get_dset_path(dst_folder, x_offset, y_offset, ...
5de19ad2e8f3c83220c87845d216e99f243f35cff180809bd96b854ea8cdd6e6
Python
9,614
281
from dataclasses import dataclass, field from typing import List, Dict, Any, Union, Set, Optional from chromadb.execution.expression.operator import ( KNN, Filter, GroupBy, Limit, Projection, Scan, Rank, Select, Where, Key, ) @dataclass class CountPlan: scan: Scan @datac...
3cd5cf6393f275f5f1f44fe781670e9c9de6bed85f7b945dfa14dba19aaaebfe
Python
9,618
279
# ============================================================================== # Copyright 2025 Technical University of Denmark # Author: Nikolas Borrel-Jensen # # All Rights Reserved. # # Licensed under the MIT License. # ============================================================================== import os from p...
dc389a1381145a4ce1699cf218d4d5deba271ff52ab21b502b99901b4c07efa1
Python
9,618
264
# Based on the code from: https://github.com/klicperajo/dimenet, # https://github.com/rusty1s/pytorch_geometric/blob/master/torch_geometric/nn/models/dimenet_utils.py import numpy as np from scipy.optimize import brentq from scipy import special as sp import torch from math import pi as PI import sympy as sy...
2f2d693d16d3846be8016cd1a0b9876bbf0fa9aaabc0c5f9e6dc227e70d0e388
Python
9,627
315
# -*- coding: utf-8 -*- import os import argparse import logging import torch from torch.nn import CrossEntropyLoss, KLDivLoss, NLLLoss, SmoothL1Loss, BCELoss, BCEWithLogitsLoss import torch from torch import nn import torch.optim as optim from torch.optim.lr_scheduler import ReduceLROnPlateau import torch.utils.dat...
1c2da9617624b97c636fe987471a9c883f179a49e4250f4c51b46e204de91a76
Python
9,630
276
import sys from typing import Sequence from typing_extensions import TypedDict, NotRequired from importlib_resources.abc import Traversable import re import hashlib from chromadb.db.base import SqlDB, Cursor from abc import abstractmethod from chromadb.config import System, Settings from chromadb.telemetry.opentelemetr...
8170fc8735ddb6bb7750a6e3e4adc6bbc0b5fb2aed158ad12517004280eac6a3
Python
9,631
262
import argparse import glob import importlib import os import numpy as np import shutil import sklearn.metrics as skmetrics import tensorflow as tf from data import load_data, get_subject_files from model import TinySleepNet from minibatching import (iterate_minibatches, iterate_batch_seq_min...
6f88fb25bd8a944ce3542cdd8ef45f21aa07dc2e0bf685300d02d78df3f1de61
Python
9,642
274
from PymoNNto.NetworkCore.Base_Tagable_Object import * import numpy as np from numpy.random import * from numpy import * from functools import wraps import builtins bool = builtins.bool def lognormal_real_mean(mean=1.0, sigma=1.0, size=1): mu = -np.power(sigma, 2) + np.log(mean) return lognormal(mu, sigma, si...
7c250279e08c69c78c7df9e61867b39d896b9e58f2d2c112f698f16e83674981
Python
9,642
283
""" See: https://github.com/easy-electrophysiology/load-heka-python And the older code https://github.com/campagnola/heka_reader I clones and pip install -e Needed to comment this out in load_heka_python/readers/data_reader.py in def run_checks() # abb 2023 # assert not data_kind["IsLeak"],...
2628afbef95bcc5e6d5cc159f7089a06b7ed15ea86e7b07399cfbe821ebee489
Python
9,647
245
import random import matplotlib.pyplot as plt import numpy as np import os from skimage.color import rgb2gray, gray2rgb from skimage.metrics import ( mean_squared_error, structural_similarity, peak_signal_noise_ratio ) from skimage.transform import iradon, iradon_sart import torch from torchvision impo...
bea8beb3763c1def9f34ccdb328bdea43b994a1455346f52d51a97fa80a29a42
Python
9,647
253
import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.discriminant_analysis import LinearDiscriminantAnalysis from sklearn.model_selection import train_test_split from sklearn.linear_model import RidgeClassifier from sklearn.preprocessing import StandardScaler from sklearn.metrics import C...
533c68b071dc9bcfdb5702d393b83cb6682a12c0c19ff81d05cece7b0b949b78
Python
9,652
250
# 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 # # Un...
51b95dcd9a50353f9e2e9d9f0523a8f97455f8d4ab069d8a4615102e405bb81a
Python
9,661
267
# Based on the code from: https://github.com/klicperajo/dimenet, # https://github.com/rusty1s/pytorch_geometric/blob/master/torch_geometric/nn/models/dimenet_utils.py import numpy as np from scipy.optimize import brentq from scipy import special as sp import torch from math import sqrt, pi as PI try: im...
678c17e139f8f1e7358d424d2ddeda3bc3a7056a7dd6c8a6ed7bca629986d281
Python
9,663
236
"""How the ``MACELES`` anchor is driven, for both of its goldens. Shared by ``tests/golden/regenerate.py`` and ``tests/golden/test_tiny_maceles.py`` so that the reference and the assertion cannot drift into evaluating two slightly different things -- the failure mode that makes a golden either mysterious or, worse, va...
7107cbdba646b4493a003cac9a1e208b5a7a59834e62a2c39ce6b2114d5bd305
Python
9,673
287
""" Train a baseline autoregressive model that uses a causal LM approach to generating series of angles """ import os from pathlib import Path import json import argparse from datetime import datetime import logging import multiprocessing from typing import * import numpy as np import torch from torch.utils.data impor...
76be06716c05436426b5936ec6a6a6400112ed48897c28270332b7f2fec7663e
Python
9,673
254
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Multi-Head Attention layer definition.""" import math import torch from torch import nn from fairseq.modules.rotary_positional_embedding import ( RotaryPositionalEmbedding...
0c8766a4ca1a2bd317204f487a02f59b150c1b6f3694e2fc55bbbe8008dcaa01
Python
9,679
266
r""" Large-Scale Networks with PopulationTemplate and Connectivity ============================================================= Building large networks of coupled neural populations is a core workflow in computational neuroscience. With the *legacy* PyRates API, a network of :math:`N` all-to-all coupled nodes require...
c28384a64edcc63e4155d6215593fd1757dc089396cd90331e04b9197472b50c
Python
9,683
230
# 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...
3f6f1657aaa44b6d991a5390f482b587cdb984c78138b02259c5021f074ec74c
Python
9,692
185
import math import numpy as np import time from scipy import special import h5py import fissa import os from scipy.io import loadmat def generate_masks(network_input:np.array, file_mask:str, list_thred_ratio:list, dir_save:str, Exp_ID:str): '''Generate temporal masks showing active neurons for each SNR frame in "...
f6d628792f085a217aa562480ad4d156e9be4f02f78e9490614fe656f31bdabc
Python
9,693
179
import numpy as np # import tensorflow as tf import tensorflow.compat.v1 as tf tf.disable_v2_behavior() ''' -NEW BRANCH CREATED FROM P1NAN_ASTRO_CORE_SLIMv0_local.py made for main run file v5_2 with astrocyte bias optimization DIRECT COPY OF P1NAN_ASTRO_CORE_SLIMv1_local.py - HERE FIXED MODEL OF ASTROCYTE W...
f4ff1ba65d2e6191178309632ca40d707ec5cd558d8f87cf18c81511b793e2b4
Python
9,695
277
"""The six `MACE_*` variables the ML-IAP coupling reads. `MACELammpsConfig.__init__` is the only place they are read, and nothing exercised any of them. They are the knobs a user reaches for when a LAMMPS run is slow or on the wrong device, which is the worst time to discover that one of them is spelled differently th...
36a1a7076b6471341053cd3c6fc3c0342b4a39bc42ea8831cb58b807372301c8
Python
9,696
231
import argparse import json import os import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np from sklearn.decomposition import PCA from sklearn.metrics import silhouette_score from pydfc.ml_utils import ( LE_transform, PLSEmbedder, dFC_feature_extraction, find_available_subjects, ...
c7fae8f9fc1e1cdd67b7ce5060c3663645c29221e465f6196a13208248f2c2d5
Python
9,713
236
import os.path as osp import h5py import numpy as np import warnings from tqdm import tqdm import torch import torch.nn.functional as F from torch_geometric.data import Data from torch_geometric.data import InMemoryDataset class FOLDdataset(InMemoryDataset): def __init__(self, root, ...
fe5d269e51f1f901e4976ea2fbbd8c2c0a0cce31160559ea0eb60c95ea48ca67
Python
9,713
257
"""Train the ``ScaleShiftMACE`` parity anchor. Unlike its plain-``MACE`` sibling this anchor *is* produced by the training CLI, because ``ScaleShiftMACE`` is exactly what the CLI emits and pinning the class a user actually gets is the point. The command is built here as an explicit argv list and recorded verbatim in t...
61741611a82d5424a6962a190156a0d436074256496405bfebeb48b1f1905262
Python
9,718
282
########################################################################################### # Higher Order Real Clebsch Gordan (based on e3nn by Mario Geiger) # Authors: Ilyes Batatia # This program is distributed under the MIT License (see MIT.md) #######################################################################...
bfcd58936a848c6224f73d245e6100370a990cc789bebc618fbf61103881c66c
Python
9,726
258
#!/usr/bin/python3 ### # Script for the control of phase 3 of training. This builds on the base ArduinoComm.py # scripts, and automates trials that show the cue and with appropiate sequence of goal events. # option includes to change the if there's a light at the reward well when cue present. ### import os, sys impor...
2b353229794055ec2748bb31230c6aa96c0f8aea6a216e181241c45089832b20
Python
9,729
308
import argparse import logging import os from typing import Dict, List, Tuple, Union import torch from e3nn import o3 from mace.modules.wrapper_ops import CuEquivarianceConfig from mace.tools import deprecation from mace.tools.cg import O3_e3nn from mace.tools.cg_cueq_tools import symmetric_contraction_proj from mace...
b197bd35422dcce7a46bb965a13032ffc1909b65ea61af72cc4b982589992929
Python
9,733
184
# %% import os import numpy as np import time import h5py import sys from scipy import sparse from scipy.io import savemat, loadmat import multiprocessing as mp sys.path.insert(1, '../..') # the path containing "suns" folder os.environ['KERAS_BACKEND'] = 'tensorflow' # os.environ['CUDA_VISIBLE_DEVICES'] = '0' # Set w...
c3007a43ebf942be6fdfedc995a2f2709c9b76851d464163fabb73bd853224d2
Python
9,744
250
""" Pure-torch gated equivariant nonlinearity, drop-in replacement for e3nn nn.Gate. Eliminates graph breaks caused by: - if gates.shape[-1]: (data-dependent control flow) - _Sortcut / Extract (fx.Graph codegen with dynamic slicing) - ElementwiseTensorProduct (TorchScript) Supports both mul_ir (e3nn default) an...
6e26cdcb78be1a2917784d60fb72d74290831da7e67ce57b2066e54526328369
Python
9,748
266
# 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...
fb37fddf9914dda9c00297cf71c1d6dae8458168b489b49316a057803af44553
Python
9,751
286
import torch import os import numpy as np import pandas as pd import pytorch_lightning as pl from rdkit import Chem from torch.utils.data import Dataset as TorchDataset from torch_geometric.data import Data as GeometricData from torch_geometric.loader import DataLoader as GeometricDataLoader from sklearn.preprocessing...
0db6e033adfd22ace1a3b79877e4cabb0c710b401f9742bccba92a8dea637fa1
Python
9,753
263
import numpy as np import torch from nequip.data import AtomicDataDict from nequip.data import ( DataStatisticsManager, EnergyOnlyDataStatisticsManager, PerAtomModifier, EdgeLengths, NumNeighbors, ) from nequip.data import ( Count, Mean, RootMeanSquare, StandardDeviation, Max, ...
a4a55a06df57cf8301774a23bf86eb4ace902a8ce19aaabe0e5240ec7791c876
Python
9,758
207
""" Functional Alignment ==================== When performing any type of group analysis, we assume that each voxel is reflecting the same computations across all participants. This assumption is unlikely to be true. Several standard preprocessing steps assist in improving 'anatomical alignment'. We spatially normaliz...
7dab43293faa58375d23147d93c6c6624e2946c5759af0255b730db83f59ef02
Python
9,763
320
""" Provide facilities for multiprocess logging, logging exception, logging handlers for session log files and socketio logging. Author: Tal Eisenberg, 2021 Starts a listening thread that receives log records from other processes, and outputs them through the main process. Processes should call logger_configurer() fro...
382ecd0ee15ca9677976302955459a533c71b7570c3815ce62c9de0f0e3316f3
Python
9,765
258
#!/usr/bin/python3 ### # Script for the control of phase 2 of training. This builds on the base ArduinoComm.py # scripts, and automates trials that show the cue and with appropiate sequence of goal events. # option includes to change the if there's a light at the reward well when cue present. ### import os, sys impo...
312c2609cfdc971289a178e41e6b8ffbf5c85480d5df00a0206eb26d88c9b746
Python
9,767
310
from __future__ import print_function from __future__ import division import os import sys import json import csv import multiprocessing as mp import math import pandas as pd from pandas.io.json import json_normalize from Bio.Seq import Seq # Minimal number of nucleotides to make alignment MIN_NUC_V = 5 MIN_NUC_J ...
352ad40df9dc913c446905bdcc6eea206235f153de5d8c1f574b2b335fb4a97b
Python
9,768
267
import math import einops import torch import torch.nn as nn from einops.layers.torch import Rearrange from model_angelo.gnn.backbone_distance_embedding import BackboneDistanceEmbedding from model_angelo.models.bottleneck import Bottleneck from model_angelo.models.common_modules import FcResBlock, SpatialAvg, LayerNo...
f3ab2108f087cfe7201a4b8ede266db05c0bf7e3c4f82aeab0ef2cd2266baae3
Python
9,774
241
import matplotlib.pyplot as plt import numpy as np import pickle from aux_fun import get_selected_features import pandas as pd import seaborn as sns # --- Bar plot with SS and FPR/h for each patient considering all SOPs--- def fig_performance(patient, SOP_list , info_test, approach): # Information ...
04e79ab69ffcce9590f232204be790b63aaa2c6a552c5690a9d2e746c30f0bdb
Python
9,777
244
"""Wrapper for NequIP framework models in torch-sim""" import torch import torch_sim as ts from torch_sim.models.interface import ModelInterface from nequip.data import AtomicDataDict from nequip.data._nl import NEIGHBORLIST_BACKEND_ALCHEMIOPS from .mixins import _IntegrationLoaderMixin from collections.abc import...
7b14d12d725629e128bd4469ae8e5df14ad9cf89e4a0223858f5131b885fe0d7
Python
9,781
313
import numpy as np # import matplotlib.pyplot as plt import torch import h5py import torch.nn as nn from torch.utils import data import itertools # number of available gpu ngpu = 1 batch_size = 16 dataRoot = "../../data" labelFiles = "labels-1.h5" matFiles = "matrices-1.h5" labelsh5 = h5py.File(dataRoot+"/"+label...
85fc7debcd80979d9adfddd0782b79b6216566925cba6d8a0f766bc6a6b264b1
Python
9,781
308
import os import string from collections import namedtuple from itertools import islice from typing import List, Tuple import warnings import numpy as np from Bio import SeqIO FASTASequence = namedtuple("FASTASequence", field_names=["seq", "rep", "chains"]) class FASTAEmptyError(RuntimeError): def __init__(sel...
749d82099110923108c0c355e733599869175983d547d1bd408c49471d7d0fb2
Python
9,782
255
from __future__ import annotations import argparse from pathlib import Path from typing import Any, Sequence, cast import attrs from typing_extensions import override from snakebids import bidsapp from snakebids.plugins.base import PluginBase from snakebids.types import OptionalFilter from snakebids.utils.utils impo...
983cb0021c3b99bbc4dadb4205c0758c4c37db3d441c3f4c7b888998476f5fee
Python
9,782
234
import os import pickle import random import numpy as np import pandas as pd from sklearn.preprocessing import StandardScaler import torch from torch.utils.data import Dataset from hyper_dti.settings import constants from hyper_dti.utils.bio_encoding import precompute_target_embeddings, precompute_drug_embeddings ...