sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
cc25d5ea8e520e90afbb04c27d01a4e6bdf580391d5843e17c26848083402583
Python
3,751
105
import unittest import numpy as np import numpy.testing as npt from reinvent.models.reinvent.models.vocabulary import Vocabulary from tests.test_data import SIMPLE_TOKENS class TestVocabulary(unittest.TestCase): def setUp(self): self.voc = Vocabulary(tokens=SIMPLE_TOKENS) def test_add_to_vocabulary...
047259f8f1037ee3faffe7668a66acae5bc580b06fbed5ed6155813b285ba034
Python
3,753
112
from sklearn.cluster import KMeans from sklearn.metrics import silhouette_score,calinski_harabasz_score,davies_bouldin_score from sklearn.metrics import adjusted_mutual_info_score, adjusted_rand_score, average_precision_score, roc_auc_score import numpy as np import community as cm import networkx as nx #import tensorf...
f4b8450a753f2a64c910efd11b08fc7197c5bc13de02af00572f1732c8302dce
Python
3,754
98
import os import torch def xpu_device_index(local_rank: int) -> int: """ Map a local rank onto a visible XPU device index. Under ZE_AFFINITY_MASK each rank sees a single tile, so local_rank can exceed the number of visible devices; torch then rejects the index with "value cannot be converted to ...
fbc4781d035f1fde2d431d5768e799c07a051102eab8024a936d81f4a4d9ad0b
Python
3,755
107
from typing import Dict, List, Optional import torch from e3nn.util.jit import compile_mode from mace.tools.deprecation import warn from mace.tools.scatter import scatter_sum @compile_mode("script") class LAMMPS_MACE(torch.nn.Module): def __init__(self, model, **kwargs): super().__init__() warn(...
b700e7e1945083051286300a489845739e8207731d65ad0bae11ef1976ff0b3e
Python
3,759
74
__author__ = 'palmer' import argparse import numpy as np def centroid_imzml(input_filename, output_filename, step=[], apodization=False, w_size=10, min_intensity=1e-5, prevent_duplicate_pixels=False): # write a file to imzml format (centroided) """ :type input_filename string - source file path (must be ....
ebbf43e002d0ea1c79bfb5f8f03de1fef8b01009ca9f4777ab80aa6441019af5
Python
3,759
74
import numpy as np import pandas as pd import os import pickle if __name__ == "__main__": hcp_sessions_list = ['REST1_LR', 'REST2_LR', 'REST1_RL', 'REST2_RL'] cv_sessions_list = ['LR_S1', 'LR_S2', 'RL_S1', 'RL_S2'] # to save subject ids and head motions across sessions to files output_path = 'PROJECT...
7c2f2fa5f22a153b531730a13eaf8b9dedd6f9abf70b985e0578b48ab25960b0
Python
3,764
103
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
c7f15d7d1932627eaf56d1f1ffd55e1962e4cc77896751ffbf4d39aaf018d250
Python
3,765
85
from torch import nn import torch from transformers import AutoImageProcessor, SwinModel import torch import cv2 from copy import deepcopy from transformer import * from position_encoding import * class BioTransformer(nn.Module): def __init__(self, num_classes,d_model=768,nhead=8,num_decoder_layers=6, dim_feedfor...
c90d84117774dd8a57b9c51e45b5d8b1c9c22a80534db560cc521c3608b9bfe3
Python
3,766
113
import os import matplotlib.pyplot as plt import numpy as np from matplotlib.axes import Axes from matplotlib.colors import Colormap # Make subpackage plotting tools also available from .graph._visualization import * from .image._visualization import * from .utils import _calc_plot_dim def plot_input(X: np.ndarray,...
2a2ab65b735faec12b43f633c2d4d3a6e3ed4f76d1a1a7083ee9b2bafe936eda
Python
3,767
120
# Copyright (C) 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """You may copy this file as the starting point of your own model.""" import jax import keras class CNNModel(keras.Model): def compute_loss_and_updates( self, trainable_variables, non_trainable_variables, ...
1ed3708121b3cc435c2b4706790c8af7ded9fda5e943bfbc3058304be7bd53f9
Python
3,768
114
# Copyright (C) 2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ Base classes for Federated Analytics. This file can serve as a template for creating your own Federated Analytics experiments. """ from openfl.federated.task.runner import TaskRunner from openfl.utilities import TensorKey from openfl.u...
d6672a06f428c579a5dd95a0001cdf90d13d77c4e2d41d4d5d9dd0f53e3d766f
Python
3,772
103
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
64d6d4bee9c5cd30e78d7258fc8a9ba586b9f86e82e267d71f0744d358537695
Python
3,775
125
import unittest import numpy as np from fimpy.roi_extraction.local_correlations import grow_rois, correlation_map from fimpy.roi_extraction.anatomical import extract_traces_around_points def test_positive_corr(): video = np.array( [ [ [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1...
d1213f6eda31bcb65d300210a6e3b42cc50af16e4da7b56167b3200fcde4a52f
Python
3,776
118
from __future__ import annotations import argparse import sys from typing import ( TYPE_CHECKING, Any, Callable, Generic, Iterable, TypedDict, TypeVar, overload, ) from typing_extensions import Required, TypeAlias, Unpack if TYPE_CHECKING: from argparse import _SUPPRESS_T, _Action...
329246d99fa699109a7317ee93270822c8d8605729c89892a19e8fb1b47a6d65
Python
3,777
99
#### make_image_from_bin.py # Copyright (C) 2010 R. Cameron Craddock (cameron.craddock@gmail.com) # # This script is a part of the pyClusterROI python toolbox for the spatially # constrained clustering of fMRI data. It converts a NPY file generated by # binfile_parcellation.py, group_binfile_parcellation.py, or # group...
c0ea54047264cdc54d90b60e7d78eae5ecb3843dcc52ccfb70346f12105c1ae9
Python
3,779
141
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """PKI CLI.""" import logging import os import sys from pathlib import Path from click import Path as ClickPath from click import echo, group, option, pass_context, password_option from openfl.utilities.ca.ca import ( CA_CONFIG_JSON,...
2d973d343e4383e262fc8b2dfb7af735b4c97c50913d9570c67ce37437f3dfbf
Python
3,780
110
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
b7bbbcaa06ba1cbfd82aeed879e93b10f8c16c1c76d7308bf34fd14c3e3730a2
Python
3,784
104
# 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...
4393cea2c5f17090b87dcfaae8e0e8ae836f4ae6396c599f201c734cde92ef62
Python
3,786
123
import os from pathlib import Path import re import openpyxl from openpyxl.styles import Font import csv import codecs import sys import argparse import subprocess import io def generate_unique_id(base_id, id_list, num): num_list = [] split_base = base_id.split(":") split_base_num = int(split_base[1]) + nu...
8ad6e62cdc4a2b86c94053145fb2f96abbf43b0a1ffc7e1e122a4f2f3350e372
Python
3,786
124
"""Checks and associated errors.""" import math import geomstats.backend as gs def check_integer(n, n_name): """Raise an error if n is not a > 0 integer. Parameters ---------- n : unspecified Parameter to be tested. n_name : string Name of the parameter. """ if n is not No...
39aea124058de6c8e91bec44364b76b7b513fb28f3e5681b3029965914d95f65
Python
3,787
112
# -*- coding: utf-8 -*- import os import argparse import logging import matplotlib.pyplot as plt import numpy as np import pickle # use this format to tell the parsers # where to insert certain parts of the script # ${imports} def chunks(lst, n): """Yield successive n-sized chunks from lst.""" for i in rang...
c176882bceaacb602f9e372a39b7175fae71374a6613e7bf99a67367933b37e7
Python
3,787
139
"""Run K-medoids on manifolds for K=2 and Plot the results. Two random clusters are generated in separate regions of the manifold. Then K-medoids is applied using the metric of the manifold. The points are represented with two distinct colors. For the moment the example works on the Poincaré Ball and the Hypersphere. ...
3994ebd909581f4f262ccec9cc69b25efc5e551e9e2ffd969855553f05a51151
Python
3,789
118
# pylint: disable=protected-access, redefined-outer-name from __future__ import absolute_import import copy import sys from argparse import ArgumentParser from os import PathLike from pathlib import Path import pytest from configargparse import Namespace from pytest_mock.plugin import MockerFixture from snakebids.cl...
8a15b4972a9f3e10e9269d8ebf4b3c3907582351a39af83df735661c5ffac233
Python
3,793
86
import os import argparse import pandas as pd import numpy as np import matplotlib.pyplot as plt parser = argparse.ArgumentParser() parser.add_argument('--run1', '-r1', type=str, default=None, required=True) args = parser.parse_args() sbs_mapped_arr = np.load(os.path.join(args.run1,'sbs_mapped_arr.npy')) R_mean = np....
8c6e7ccac3c92c75b925c096d6b4b275e20649ef583a33ec8fe213a25667e602
Python
3,794
114
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. import torch import os from nequip.nn.compile import ListInputOutputWrapper, DictInputOutputWrapper from nequip.data import AtomicDataDict from nequip.data._key_registry import get_dynamic_shapes from ...
62abefaeecac62a3fd7ce93f6a0b6f9cbff215c84247c2e1dc74bca681886987
Python
3,795
101
"""A collection of constants for testing""" SIMPLE_TOKENS = { t: i for i, t in enumerate( ["$", "^", "(", ")", "1", "2", "3", "=", "C", "F", "N", "O", "S", "c", "n"] ) } PARACETAMOL = "CC(=O)NC1=CC=C(C=C1)O" SCAFFOLD_SUZUKI = "Cc1ccc(cc1)c2cc(nn2c3ccc(cc3)S(=O)(=O)N)[*]" INVALID = "INVALID" NONSE...
4939d40de2daecdbecd40fa4f81f119a27a33903e1f9524636cfbc450300d03a
Python
3,796
106
"""Pure path-resolution helpers for MNI template files. Resolves logical (template, resolution, file_type) tuples to local paths. Files are fetched on first use from the `nltools/niftis` HF dataset; see `nltools.templates.fetch`. """ from .fetch import fetch_resource from .registry import SUPPORTED_RESOLUTIONS, VERSI...
bd7fa652a88077bb0dc9acc01bdcb1317314c3a2172bf3d9b40a3346430c0e19
Python
3,796
110
import json import click from corgie.log import configure_logger from corgie.log import logger as corgie_logger from corgie.argparsers import corgie_option, corgie_optgroup from corgie.data_backends import get_data_backends, str_to_backend, \ DEFAULT_DATA_BACKEND, DataBackendBase from corgie.cli.downsample im...
ee2522848f6b7fb5afc8c7d4e0cf40f8920f1bf603b8c1c79d1b4e773bef4aa6
Python
3,797
115
"""Centralized filesystem paths used by SanPy.""" from __future__ import annotations import shutil import sys from pathlib import Path from platformdirs import user_documents_dir from sanpy.sanpyLogger import get_logger logger = get_logger(__name__) class SanPyPaths: """Build and initialize SanPy's bundled a...
b8c7d870573c3927759d7e3c72adc2db7a11003902b890bd2a7b95524356d843
Python
3,798
126
#!/usr/bin/env python import os import sys import matplotlib.pyplot as plt import nibabel as nib import nilearn.image as nimage import numpy as np import pandas as pd import seaborn as sns import scipy.linalg as la from glob import glob from budapestcode.utils import compute_tsnr from budapestcode.viz import make_mo...
13e69005b0f8d6490645138bab9078aaf1941f42fcaf2045b6965474a43a08da
Python
3,801
93
import argparse import sys from Utils.fileconverter import itk_to_nrrd from Engine.train import initiate as train_initiate from Engine.evaluate import initiate as evaluate_initiate from Utils.MSD_utilities import generate_training_data from Utils.plot import plot_train_data from Utils.PETCT_LungDx_utilities import con...
423f33c09a6a99cfcff81f95c92d754623698dee8155a26470bc3d546cc521d8
Python
3,805
104
# Copyright (C) 2020-2023 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """You may copy this file as the starting point of your own model.""" from logging import getLogger import numpy as np from torchvision import datasets, transforms logger = getLogger(__name__) def one_hot(labels, classes): """ ...
452d56af365da8a8748187e8b6122ae032b8e30ab4998b8f2f1375ce6d4da804
Python
3,806
88
"""Check TCREmp stages across fresh processes and Linux CPU allocations. Uses generated productive junctions, no assay data or stored fitted state. Each invocation re-embeds and refits through the production entry point. """ from __future__ import annotations import argparse import faulthandler import hashlib import ...
53acbb9c645c404d299efca863516291a9f810d5dbe360dc3c258c311ced49bf
Python
3,809
84
# import tensorflow as tf import tensorflow.compat.v1 as tf tf.disable_v2_behavior() import os import numpy as np class CUBA_LIF_network: def __init__(self): self.main_Path = os.getcwd() self.dataPath_TRAIN = self.main_Path + '/train_data' self.netPath = self.main_Path + '/netwo...
022c2030cfa07fe46abac898c84de1aabc108fdf887f7253efdeaea4d07dcae2
Python
3,811
120
# -*- coding: utf-8 -*- import numpy as np from sklearn import preprocessing import copy from scipy import signal def standardize_transients(transients, method='standard'): if method == 'standard': scaler = preprocessing.StandardScaler().fit(transients) elif method == 'quantile': scal...
527ba0676552bc47330e22339d8be75c5e7b0c774c71bb0a5bd5fd77acdc2206
Python
3,814
112
import numpy as np import tensorflow as tf import matplotlib.pyplot as plt import sys sys.path.append('/n/groups/marks/users/david/github/pareSingleLibrary2/codebase/pairedEnd/ex62_gvp/') import importlib import dataTools as dt importlib.reload(dt) import regressionTools as rt importlib.reload(rt) from regressionToo...
80661d4c1a9a8ca246c7cf05ef40c40341f188742b3e776c3a03870c4f37a5c6
Python
3,814
102
# 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...
88dabbb480f90bc5217d2d1167aec820b248257f8f391840de8d13aa0b64e202
Python
3,814
101
import torch from torch.utils.data import DataLoader from torch import optim, nn from dataset import MultiModalDataset from model.classifier import ClassifierModel from torch.utils.data import DataLoader, random_split # Replace these with your actual data paths and labels face_image_paths = ['path/to/face/image1.jpg'...
daf69922efa19819a254989488b13bfe72bcf08354d15d519079b4a4468e3cd2
Python
3,816
106
# Copyright (C) 2020-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """You may copy this file as the starting point of your own model.""" from logging import getLogger import numpy as np from torchvision import datasets from torchvision import transforms logger = getLogger(__name__) def one_hot(labe...
d3aff35c2b5a9dec78c9bd4440b6345e1346a1e9164ad959174ee8a9d10d66fd
Python
3,820
87
# -*- 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...
15fcb464d27713ac8934d478bd1a5ce69a24c7b020612ef7cfb2ad5c57517c89
Python
3,823
131
# Copyright (C) 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Director CLI.""" import logging import sys from pathlib import Path import click from click import Path as ClickPath from click import group, option, pass_context from dynaconf import Validator from openfl.experimental.workflow.comp...
173768b610acc3b24e77d52ad59131821682ece857b138a87b340c2d20291959
Python
3,825
80
import sys import numpy as np from neurolib.models.aln import ALNModel from neurolib.utils.loadData import Dataset import matplotlib.pyplot as plt from nest_elephant_tvb.utils import create_logger def run_example(co_simulation, path="", simtime=100, level_log=1, resolution=0.1, time_syn...
d812c2426214e820f268407f4b5e38cecb98d4aba22609f60d5c870a4f0db60f
Python
3,825
158
# -*- coding: utf-8 -*- """ The main module. Start all system components and shutdown gracefully. Author: Tal Eisenberg, 2021 """ import multiprocessing import os import threading import logging import flask import flask_cors from flask_socketio import SocketIO, emit import json import sys import argparse from dotenv ...
32ac0be9081e5f5cf077e3ffcea2a15b5f32f75a38349fd73b699c689240977c
Python
3,826
137
import inspect import numpy as np import pytest import geomstats.backend as gs # TODO: remove backend influence # TODO: simplify most of this def autograd_backend(): """Check if autograd is set as backend.""" return gs.__name__.endswith("autograd") def np_backend(): """Check if numpy is set as backen...
872b1f3dd6e58692ec281f9752adaaee31474232ae347fee41c5861ee4b834ea
Python
3,834
119
import numpy as np import cv2 as cv from ctypes import c_int, pointer import image_observers.YOLOv4.darknet as darknet import bbox class YOLOv4Detector: """ Bounding box detector using the YOLOv4 algorithm, based on the paper "YOLOv4: Optimal Speed and Accuracy of Object Detection" Code from: https://...
c36dec28cd483caadb129810e478a53bc4ac04fd5c5709708dec832fd2a0873d
Python
3,834
102
''' Module focused on the implementation of Auxiliary Convolutional Layers ''' import torch.nn as nn import torch.nn.functional as F class AuxiliaryConvolutions(nn.Module): """ Additional convolutions to produce higher-level feature maps. see the original paper where SSD300 is implemented for further ...
efefea88a8f1b707a11c16f27e79418fead7ae4e68c133d5fdaae176f7ba2ecb
Python
3,834
111
from geomstats.test.data import TestData from .base import LevelSetTestData from .fiber_bundle import FiberBundleTestData from .quotient_metric import QuotientMetricTestData from .riemannian_metric import RiemannianMetricTestData class PreShapeSpaceTestData(LevelSetTestData): def is_centered_vec_test_data(self):...
e84cd28d16dc156d18ad017bde8c2dc9b42f7fc5ad0aa7c74b9d66ac2a9cfd00
Python
3,835
106
import pytest import geomstats.backend as gs from geomstats.geometry.euclidean import Euclidean from geomstats.geometry.general_linear import SquareMatrices from geomstats.geometry.special_euclidean import ( SpecialEuclidean, homogeneous_representation, ) from geomstats.test.random import LieGroupVectorRandomD...
fdcbad33866c6408cb11c29d291f08b5c809a0701c3107166cc7764651dac791
Python
3,835
122
import os import argparse import warnings warnings.simplefilter(action="ignore", category=FutureWarning) import pandas as pd import tensorflow as tf tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR) from activation_models.generators import get_activation_models from custom_model_tools.manifold import ( ...
764a962b28233e3576f08474e0490f34c7b1fbd1efbe7e9758731a3a89e11f33
Python
3,836
123
# Tests the CustomResourceMemberlist provider from dataclasses import asdict import threading from chromadb.test.conftest import skip_if_not_cluster from kubernetes import client, config from chromadb.config import System, Settings from chromadb.segment.distributed import Memberlist, Member from chromadb.segment.impl.d...
fecaf047c7f9a2e0724c8c258ca25ef0cf68cf512b9624abe8a153725f11ce63
Python
3,838
98
# -*- 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...
38be8e2926cdf03d5c531ec375d001fe7450a6f11e8a6671c725b7876bdabfcc
Python
3,839
142
""" Functions for querying or mutating values in arbitrarily nested dictionaries and lists. Author: Tal Eisenberg, 2021 Each of the functions in this module are "path functions" - f(d, path), where d is a collection, and path is either a string key, an int index, or a tuple representing a path in the collection. A pat...
6a178172c3be1e333681c678cf178b4db78bde4a81f9052e2698fb8117ddbe71
Python
3,840
134
"""Hardwre reporting""" from __future__ import annotations import platform import subprocess as sp import logging from typing import Optional import torch from torch import device try: import resource except ImportError: # Windows does not provide the "resource" module resource = None SYSTEM = platform.sy...
b814bbf7dbc7c7a45dbb19420a8a661fe7240dc13d7b6d41af40cea0cd6b6873
Python
3,840
154
# -*- coding: utf-8 -*- import os import argparse import logging import glob import numpy as np from data_functions import load_data from itertools import groupby from operator import itemgetter import matplotlib matplotlib.use('Agg') import pandas as pd import matplotlib.pyplot as plt from mpi4py import MPI # us...
17ed1e7fe86b3fc5745e7f48ef4b5476c9f3bbc614c89a4fdea2fe92a7d3d252
Python
3,843
121
from torch import nn, Tensor from typing import Optional, Union, Tuple from utils.math_utils import make_divisible from . import BaseModule from ..misc.profiler import module_profile from ..layers import ConvLayer class InvertedResidual(BaseModule): """ This class implements the inverted residual block, as ...
287afa622dc8dac0bec38d0b3384995ae09c8b4245e68ecf654a4c0fa888b889
Python
3,843
115
# Copyright (C) 2020-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """You may copy this file as the starting point of your own model.""" from logging import getLogger import numpy as np from tensorflow.python.keras.utils.data_utils import get_file logger = getLogger(__name__) def one_hot(labels, cl...
5bda2a2e6c48b1d214fd92ee33c20a3bbb90da35ffd71f3ae631b309f5411291
Python
3,843
107
import paddle.distributed as dist import math import paddle import paddle.nn as nn class _AllReduce(paddle.autograd.PyLayer): @staticmethod def forward(ctx, input): input_list = [paddle.zeros_like(input) for k in range(dist.get_world_size())] # Use allgather instead of allreduce since I don't ...
a9e848c3dbb79a25db9736b84613a0822453697d1f05d0a262f7a49cda735fc8
Python
3,843
115
""" DATA LOADERS ==================== This module is only a reorganization of Gabriel Guimaraes' original implementation (http://github.com/gablg1/ORGAN). Carlos Outeiral has only added documentation. The code was initially borrowed from the SeqGAN code: https://github.com/LantaoYu/SeqGAN """ import nump...
63f36d3ffdff398bb92c80d6e7d1d3053f7346b15b9f1e399032a00e13320b5f
Python
3,850
108
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Un...
a16d434e9fbb5546877cc8e4924cbda54824687ac63e0a5906c9eaf3bcb65100
Python
3,850
100
"""Real tier: drive an actual LAMMPS binary with an exported MACE model. Uses the ML-IAP unified path (`pair_style mliap unified`), which works with a stock LAMMPS build that has the ML-IAP package and Python support — no MACE plugin compilation required. The native `pair_style mace` route needs a patched LAMMPS build...
fc6a7aa67da5ee0f24cb04db35c302638b62b6066c6bc29d9c5b53bd2a595b6c
Python
3,850
92
import os import torch import hydra from omegaconf import OmegaConf from dig.xgraph.evaluation import XCollector from dig.xgraph.utils.compatibility import compatible_state_dict from benchmarks.xgraph.gnnNets import get_gnnNets from benchmarks.xgraph.dataset import get_dataset, get_dataloader from benchmarks.xgraph.Ra...
40169d274856725efbe17218e74bac72796d9200d560923b39e81b6eac01df48
Python
3,851
119
r"""Compute and visualize a geodesic regression on SE(2). 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, - :math:`\...
83276d5bcdaa4aee33199bcb68d86013628dc8a42a185a69067dd13c5311e1e2
Python
3,855
145
"""Numpy based linear algebra backend.""" import numpy as _np import scipy as _scipy from numpy.linalg import ( cholesky, det, eig, eigh, eigvalsh, inv, matrix_power, matrix_rank, norm, svd, ) from scipy.linalg import expm from ._common import atol def _transpose(array): ...
cf4597c10a45a655e57556170366f399aea369e7742887ad4b6e4fcc5c43973a
Python
3,855
107
from PymoNNto.Exploration.Network_UI.TabBase import * class weight_tab(TabBase): def __init__(self, title='Weights', weight_attrs=['W']): super().__init__(title) self.weight_attrs = weight_attrs def add_recorder_variables(self, neuron_group, Network_UI): return def initialize(sel...
aee4ffb2eb36c14a7af518090924160cec255baf5154e55e689e53f24f09350d
Python
3,857
157
import nest import matplotlib.pyplot as plt import numpy as np import os import time from globparams import * import random from pynestml.codegeneration.nest_code_generator_utils import NESTCodeGeneratorUtils ############################################################# # model generation ################...
cba10c99f7dcc09219aadbc6964baa971c0eb127ba1d5282541bce278e4d6a5a
Python
3,858
135
#!/usr/bin/env python3 from __future__ import annotations import argparse import copy import datetime import hashlib import json import pathlib from typing import Any, Dict, List, Sequence, Tuple SHARD_KIND = "chroma-python-test-inventory-shard" MERGED_KIND = "chroma-python-test-inventory" def main() -> None: ...
b707f2d1fc3ef10187c7d245b428d67b5f28352e0e2af275115653f172a26b43
Python
3,861
101
from sparse_ct.tool import plot_grid from sparse_ct.data import image_to_sparse_sinogram, ellipses_to_sparse_sinogram from sparse_ct.reconstructor_2d import ( IRadonReconstructor, SartReconstructor, SartTVReconstructor, Sar...
4371fe1254a460f07a098195efb0cc852d810a4c400a24f21609a84c595bd736
Python
3,862
124
import pytest import geomstats.backend as gs import geomstats.datasets.utils as data_utils from geomstats.geometry.discrete_surfaces import DiscreteSurfaces, L2SurfacesMetric from geomstats.test.parametrizers import DataBasedParametrizer from geomstats.test.test_case import pytorch_backend, torch_only from geomstats.t...
c2a26500f24ab1177ec9c37d870fabd38f9842494f0ef2c6517cb45eb532a2d9
Python
3,862
124
"""Matched molecular pairs""" from __future__ import annotations __all__ = ["Icolos"] import os import shlex import json import tempfile import time from typing import List, IO import numpy as np from pydantic.dataclasses import dataclass from .component_results import ComponentResults from .run_program import run...
c572278698fe36f90556b3851ffe81d27f6e69eb7cbf4b99ffa3c315e4b7cc83
Python
3,863
94
# Copyright (C) 2020-2023 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import time import argparse from pathlib import Path from subprocess import check_call from concurrent.futures import ProcessPoolExecutor from openfl.utilities.utils import rmtree from tests.github.utils import create_collabor...
eaa39a23b3dc5799c678aa474909c68798ecc52fb9b93960830c559b7db63919
Python
3,863
95
""" Plot an excerpt of the input data and corresponding trigger times. """ import matplotlib.pyplot as plt import seaborn as sns import argparse import os from utils.io_utils import load_neo, save_plot from utils.parse import none_or_int, none_or_float from utils.neo_utils import time_slice CLI = argparse.ArgumentPar...
fbdfedf270a5e4785c1a2d189a36731de6685a6b3a7869d1a17d6081b69ca996
Python
3,864
92
import os from rdkit import Chem from rdkit.Chem import rdChemReactions import time import pickle from collections import defaultdict from rdkit import RDLogger RDLogger.DisableLog('rdApp.*') def filter_duplicate_invalid(uspto_file=os.path.join("..", "data", "original_data", "data_from_USPTO_utf8"), ...
5fc498e6e5d67019092fa50479c35ba1f072729e6b3bd5c7319e494ffc33d7c7
Python
3,866
121
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
4b78095c2208befd961e3b91ebbeb706442929862c9435ac39ad940a2ea959f7
Python
3,868
109
import geomstats.backend as gs from geomstats.geometry.spd_matrices import SPDMatrices from geomstats.geometry.symmetric_matrices import SymmetricMatrices from geomstats.test.data import TestData rand = gs.random.rand class AgainstNumpyTestData(TestData): def _array_data(self): func_name = "array" ...
9128d42bea9cc7288523399da14752c71bca5bb640cde9d234b503b53d8bfd5e
Python
3,869
103
import gradio as gr from .utils import load_ct_to_numpy, load_pred_volume_to_numpy from .compute import run_model from .convert import nifti_to_glb class WebUI: def __init__(self, class_name:str = None, cwd:str = None): # global states self.images = [] self.pred_images = [] ...
d173599117e521dd02fc49f976066015a94a3c209daf607f30dfbba685a7e6e6
Python
3,869
125
from typing import List, Dict, Any, Optional, Union import numpy as np import pandas as pd from chromadb.api.types import QueryResult, GetResult def _transform_embeddings( embeddings: Optional[List[np.ndarray]], # type: ignore ) -> Optional[Union[List[List[float]], List[np.ndarray]]]: # type: ignore """ ...
a099201e0520ebed52353b83d90571ac748126715091380e7e8e317a7a4cfabf
Python
3,870
96
""" Plot an excerpt of the input data and corresponding trigger times. """ import matplotlib.pyplot as plt import seaborn as sns import argparse from pathlib import Path import os from utils.io_utils import load_neo, save_plot from utils.parse import none_or_int, none_or_float from utils.neo_utils import time_slice C...
838835e11e7c97e2e31c8b94ace29193904cf4c3e74a2ba5e88399efd7841e2e
Python
3,875
77
from PymoNNto.Exploration.Network_UI.TabBase import * from PymoNNto.Exploration.Visualization.Reconstruct_Analyze_Label.Reconstruct_Analyze_Label import * class sidebar_image_module(TabBase): def add_recorder_variables(self, neuron_group, Network_UI): return def initialize(self, Network_UI): ...
1a171abcc81096adc8cee1f0ca9c714b211c7b21da9ff8dd6ebaacf0dd95a018
Python
3,877
143
"""The video generator tool is used to generate videos from the tracking data generated by the idtracker.ai software, see :ref:`video generator`.""" import argparse import logging from pathlib import Path from idtrackerai import IdtrackeraiError, Session from idtrackerai.utils import wrap_entrypoint from .general_vi...
4b5b889692ee6a6823458cd784223a20e57ec617c91144db189ad722d699d168
Python
3,878
114
"""Run a small stochastic Myokit current-step experiment and save it for SanPy. See: https://github.com/MichaelClerx/myokit/blob/main/examples/1-1-simulating-an-action-potential.ipynb 20260910 had to install: brew install sundials then check sundials with uv run python -m myokit sundials """ import numpy as np impo...
bc7f094ce0bb8390f05f72ad6566fe89f5ce00351294f062b5bea3a135c7020e
Python
3,879
102
#!/usr/bin/env python import pandas as pd import numpy as np import argparse def parse_data(data, blacklist=None): blacklist = blacklist or set() tokens = data.split("; ") data_dict = dict() geom_id = None epoch = None for t in tokens: key, value = t.split("=") if key in blackli...
3e34fdbc706749ac10f49d958664b55036d9a4028c2e8e76677233b922cd9d1e
Python
3,881
134
from typing import Optional from urllib.parse import urlparse import pytest from hypothesis import given, strategies as st from chromadb.api.fastapi import FastAPI def hostname_strategy() -> st.SearchStrategy[str]: label = st.text( alphabet=st.characters(min_codepoint=97, max_codepoint=122), min...
eee1ba4c974aad819f46d86c98024fbddf52670aa4f050b649a7d651a7cd4a16
Python
3,883
109
import unittest import torch.utils.data as tud from torch import Tensor from reinvent.models.linkinvent.dataset.dataset import Dataset from reinvent.models.linkinvent.model_vocabulary import ModelVocabulary from reinvent.models.linkinvent.model_vocabulary.vocabulary import ( SMILESTokenizer, create_vocabulary...
e9903c35898c323719e5385b915bd345fb9bf390432ed7260d7c59fcaee772f6
Python
3,884
95
""" Plot an excerpt of the input data and corresponding trigger times. """ import matplotlib.pyplot as plt import seaborn as sns import argparse import os from utils.io_utils import load_neo, save_plot from utils.parse import none_or_int, none_or_float from utils.neo_utils import time_slice CLI = argparse.ArgumentPar...
6305104c530bd437da663cfab06671974273965b7f45aeb3bab5dc9e119934cf
Python
3,885
119
from live2p.start_live2p import start_live2p ### ----- THINGS YOU HAVE TO CHANGE! ----- ### # Set these first to match makeMasks3D!!! # I recommend using removing 110 pixels from each side. Maybe 120 for holography. Maybe less for vis stim. But # it has to match whatever you did in MakeMasks3D. # also set the max num...
a76f1884814fe03bb97b0526fd93a48b3cbbe1f8c5749258bdabec475b94ed26
Python
3,886
133
from geomstats.test.data import TestData from .fiber_bundle import FiberBundleTestData from .nfold_manifold import NFoldManifoldTestData from .pullback_metric import PullbackDiffeoMetricTestData from .quotient_metric import QuotientMetricTestData from .riemannian_metric import RiemannianMetricTestData class Discrete...
1c11543a91f943c200dc56c88fdcaa62fa8dfa41ebca795f746885161ca5d391
Python
3,887
121
"""Core parametrizer classes for Stratified Spaces.""" import pytest import geomstats.backend as gs from geomstats.test.random import get_random_times from geomstats.test.test_case import TestCase from geomstats.test_cases.geometry.mixins import ( DistTestCaseMixins, GeodesicBVPTestCaseMixins, ) class Rando...
d585711274c99517788e7fcb26f6a25da2244f7fc8ab2128d8b29f3dadd033d1
Python
3,889
129
from __future__ import annotations import itertools as it import json import operator as op import textwrap from math import ceil, floor, inf from typing import Sequence import more_itertools as itx from snakebids.types import ZipList def quote_wrap(val: str) -> str: """Wrap string in quotes, with additional c...
2b89a386dc0d3ff92f38d68ff72ba05a3f4d78b857f87bdb829e2c9515a3690b
Python
3,890
136
#!/usr/bin/env python # -*- coding: utf-8 -*- # # FileName: main # CreatedDate: 2017-11-20 14:05:59 # import argparse import os from datetime import datetime import matplotlib.pyplot as plt import pandas as pd def main(): # setting option parser = argparse.ArgumentParser( description="draw graph f...
946ea41cadfe982ccbab0569da995c5a542af2cf4871e23f984adb4c6d7b4adf
Python
3,890
96
""" Plot an excerpt of the input data and corresponding trigger times. """ import matplotlib.pyplot as plt import seaborn as sns import argparse from pathlib import Path import os from utils.io_utils import load_neo, save_plot from utils.parse import none_or_int, none_or_float from utils.neo_utils import time_slice C...
8a71966f9620566c6e68340544237574a5f0fc67b943d7fd383c99021e27448e
Python
3,891
97
import argparse import onnx import onnx_graphsurgeon as gs import numpy as np from pathlib import Path from paddle2onnx.legacy.command import program2onnx from collections import OrderedDict def main(opt): model_dir = Path(opt.model_dir) save_file = Path(opt.save_file) assert model_dir.exists() and model...
97f8d15fb7c019100ba61dc85ae2b0a5be93938ca0cda38a71937dc2df480d4f
Python
3,892
122
import logging import time from pathlib import Path import scipy.io as sio from live2p.offline import run_plane_offline_multifolder from live2p.utils import tic, ptoc # logging setup # change for more or less information... caiman_loglevel = logging.INFO live2p_loglevel = logging.DEBUG # changes how logs/updates ar...
3daa99b9dfc762566b663f2e67c6f1b86583d4c12d971de056a74c9d7459563f
Python
3,896
79
import argparse from .ConvNet import load_model from .seqsharp_fcts import handle_args, load_data, validate, model_test, train, \ model_figures from .train_eval import print_model_performance def main(): sep_line = '-------------------------------------------------------' \ '---------' # ...
95b80521f7db1369f2e9fa3c708972104fc663d3bc751d3db95f8fda69a8d2d9
Python
3,899
134
import argparse import os import torch from src.dataset import build_datasets_from_cv_folds, get_dataloader from src.models import ModelWrapper from src.setup import setup from src.trainer import Trainer def parse_args(): parser = argparse.ArgumentParser("arguments for training") # Model selection pars...
cc90a3b0d8c07910a74c6ea1d6e51d275c277aac0943b3733f0f6a5ec66a9372
Python
3,902
136
#!/usr/bin/env python # -*- coding: utf-8 -*- # # FileName: main # CreatedDate: 2017-11-20 14:05:59 # import argparse import os from datetime import datetime import matplotlib.pyplot as plt import pandas as pd def main(): # setting option parser = argparse.ArgumentParser( description="draw graph f...
d62b1f43c09ca912deecd0af2313eea0eef489a18082188e5bd51c6c12691d06
Python
3,904
156
""" Django settings for WebLabelling project. Generated by 'django-admin startproject' using Django 2.1. For more information on this file, see https://docs.djangoproject.com/en/2.1/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.1/ref/settings/ """ # Author: ...
677bbe7719a1da9b36f0c61a85c5322ada0c30a7c9d6752d105713b4dff0def7
Python
3,906
98
"""Regeneration targets: one module per family of goldens. ``regenerate.py`` does not know what can be regenerated. It asks this package, which discovers every module beside this one and reads four names off it: ``ORDER`` an integer. ``--target all`` runs the targets in ascending order, ties broken by name, b...
f135af88156c586ea5cc4075611e3c1445d9b718407aad545fe289ef2bf49dea
Python
3,906
100
#### make_image_from_bin_renum.py # Copyright (C) 2010 R. Cameron Craddock (cameron.craddock@gmail.com) # # This script is a part of the pyClusterROI python toolbox for the spatially # constrained clustering of fMRI data. It converts a NPY file generated by # binfile_parcellation.py, group_binfile_parcellation.py, or #...
e56a4c700958a7101cccfcb7b09aa6b5d403e6551e6a7a9b728f9e1d566d5b6d
Python
3,908
110
"""Model output visualization — ROC curves and the cross-validated decoding figures. Every function here takes arrays, not a result table: `BrainData.predict` returns a `PredictResult` record plus the row-aligned out-of-fold decision values that go with it, and these draw from those directly. """ import matplotlib.py...
a251c28b08ece3065c890e5c392b85f480e66c136e7396d22d0a1e2df500f1c7
Python
3,911
82
import io import click import pandas as pd from uniprotparser.betaparser import UniprotSequence, UniprotParser from curtainutils.common import read_fasta import re reg_positon_residue = re.compile("_(\w)(\d+)") def lambda_function_for_msfragger_ptm_single_site(row: pd.Series, index_col: str, peptide_col: str, fasta...