sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
15ba439cd728f6490d8972161722e9605634a3ab745ceac1b5c05c1432b1012a
Python
4,705
102
from PymoNNto.Exploration.Network_UI.TabBase import * class hist_tab(TabBase): def __init__(self, weight_attr='W', title='Weight Dist.', timesteps=1000, mask_param='Input_Mask', mask_color_add=(-100, -100, -100)):#mask_param=None # super().__init__(title) self.weight_attr = weight_attr sel...
4514cabf32ec253b0b469bb58c8f732ee94c44c60aea71c041d59e0fad181557
Python
4,705
143
"""Tests for core ABF, TIFF, and sweep-access file-loader behavior.""" from pathlib import Path import numpy as np import sanpy from sanpy.fileloaders.fileLoader_abf import fileLoader_abf from sanpy.fileloaders.fileLoader_base import fileLoader_base # from sanpy.fileloaders.fileLoader_tif import fileLoader_tif def...
4c8524e92c2e78acf2119a8bfcd9cfff2be90234f6ee5020637b66661f2e12ae
Python
4,706
135
import logging from contextlib import suppress import cv2 import numpy as np from idtrackerai import ( Blob, IdtrackeraiError, ListOfBlobs, ListOfFragments, ListOfGlobalFragments, Session, ) from idtrackerai.utils import track def fragmentation_API( session: Session, list_of_blobs: ListO...
dd1130ed814e590310af69e5a28ee62f8daf3a4908e4aaa2576611e2382b10c9
Python
4,712
165
import pytest import geomstats.backend as gs import geomstats.datasets.utils as data_utils from geomstats._mesh import Surface from geomstats.test.data import TestData from geomstats.vectorization import repeat_point from .manifold import ManifoldTestData from .riemannian_metric import RiemannianMetricTestData clas...
a8ff314ae8db05dab1dc9446356339cb8b16a51aef98d07b8eac0a158d315a50
Python
4,713
114
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...
e01c833923275f233b37be44e0969e1e1621118554726e427234111b57ef9e52
Python
4,714
190
## IMPORT BASIC LIBS FOR SCRIPT import scipy as sc from scipy import io from scipy import linalg import bstates as bs import pickle import numpy as np import feather import h5py import pandas as pd from sklearn.decomposition import PCA import os from sys import argv ## TREATING ARGV VARS nPats = int(argv[1]) # NUMBE...
d6a04bd7c6989230019b17ecf029ab1b77075857101abedb070f4fcb4dc00878
Python
4,716
126
# 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. from argparse import Namespace import logging from typing import Union, Tuple, Optional import torch import torch.nn as nn import torch.nn.fu...
04910495e45ea3c1d11c0d9184c626514d5d9c251050a4524733dac6b5607cc2
Python
4,717
117
import numpy as np import os from os import path from glob import glob import sys import h5py from tensorflow.python.ops.gen_batch_ops import batch sys.path.append('MEISTER') from utils import * from processing import * from signal_model import * from train import * import subspaceMSI as subspace fro...
78937e850e6a0c264968e3a21755c266f7e4b9956231aaf4f4a9677b8b5fce77
Python
4,719
148
"""A simple script to convert reinvent3 models to reinvent4 models This script will update the paths to the model classes and add meta information to the model file. Run this after having created the symlinks with the script in support. """ import os from dataclasses import dataclass from typing import Tuple import ...
53b84c5c692fc0ae0d9060d7b25aee5db6b2702bfbc83d7ee944c717aa224707
Python
4,720
125
# 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...
554634cda856f33f1a16e61a411b4cd49a1d4e67d34b9af048690a9a8cd29408
Python
4,725
133
# -*- coding: utf-8 -*- pepbdb_inputdir = '/home/ec2-user/SageMaker/efs/data/CAMP/paper/' #tar -xvzf'd version of pepbdb-20200318 querys=[] import csv import os def check_abnormal_aa(peptide_seq): len_seq = len(peptide_seq) cnt = 0 standard_aa = ['G','A','P','V','L','I','M','F','Y','W','S','T','C'...
4d593111352d2b1c5c174e5e654226bf2145dff56388f47847319fe4abaf47e3
Python
4,726
156
import pytest import torch from e3nn import o3 from nequip.data import AtomicDataDict, register_fields, deregister_fields from nequip.nn import GraphModuleMixin from nequip.utils.test import ( assert_AtomicData_equivariant, assert_permutation_equivariant, ) class BadModule(GraphModuleMixin, torch.nn.Module...
69f26154f15181904b08271b589f655d139416f22a1dfcc73a484afcf9c21238
Python
4,727
134
from PymoNNto.Exploration.Evolution.common_UI import * from PymoNNto.Exploration.Evolution.PlotQTObjects import * class Overview_UI(UI_Base): def update_order(self): for i in range(self.listwidget.count()): item = self.listwidget.item(i) #print(i, item.text()) smg=self....
f06113fc1a1d9805ca680227452f0e3efdbf1c923733f8ceeba2777fc5e2726f
Python
4,728
149
import ase.io import numpy as np import pytest import torch from mace.calculators import MACECalculator from tests.helpers import CUET_AVAILABLE, base_mace_params, run_mace_train # noqa: F401 # pylint: disable=unused-import pytestmark = [pytest.mark.network] device = "cuda" if torch.cuda.is_available() else "cpu" ...
bf14626576acc773aa32cfda0bc493bf2492cfce37eb8b62399cd425e21581fa
Python
4,729
136
import pytest import unittest import torch import torch.utils.data as tud from reinvent.models.transformer.core.dataset.paired_dataset import PairedDataset from reinvent.models.transformer.core.vocabulary import SMILESTokenizer from reinvent.runmodes.utils.helpers import set_torch_device from tests.test_data import E...
f92c6fdd3ee089a5283ac2b78fefaa405b3d82671764a4826668235fa6b5adb3
Python
4,735
148
import pickle import numpy as np import torch import pandas as pd from sklearn import model_selection from torch.utils.data import Dataset from torch.utils.data.sampler import Sampler try: # Handling API difference between pytorch 1.1 and 1.2 from torch.utils.data.dataloader import default_collate except ImportEr...
fa712cb066c6bd59a4999b32cfc43469b7065e124a70246604a065a1b8f77d3a
Python
4,737
185
import click import procspec import torchfields from corgie import scheduling, argparsers, helpers from corgie.log import logger as corgie_logger from corgie.layers import get_layer_types, DEFAULT_LAYER_TYPE, str_to_layer_type from corgie.boundingcube import get_bcube_from_coords from corgie.argparsers import ( L...
812c3d9589d3717aa656941e1eee4705e2e86b3c8bc2206dd9fe328d8298da80
Python
4,742
89
"""Author independence has strict boundaries and cannot use missing metadata.""" import polars as pl from vdjdb.curate.authors import author_pairs, parse_authors def fixture() -> pl.DataFrame: rows = [] for ref, names in [("1", ["a", "b", "senior"]), ("2", ["a", "d", "other"]), ("3", [...
7276b241dc2739126ed1ffa6b2a31ebf75b821b76ebf85dd4cacdbcb9b6fc291
Python
4,744
123
# Copyright 2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import importlib import logging from flwr.proto import grpcadapter_pb2 from google.protobuf.message import DecodeError from openfl.protocols import aggregator_pb2 logger = logging.getLogger(__name__) def flower_to_openfl_message(flower_messa...
a7161b8c6058db8a2d58807ee6b8d34eef47a3cb843ac874842bf2107bfeb4fe
Python
4,747
121
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. """ Utilities for `nequip-package`, mainly to handle externing and mocking modules. """ from nequip.__init__ import _DISCOVERED_NEQUIP_EXTENSION from typing import Callable, Dict, Final, List, Set, It...
0c18928569af4f336649a40d0e9659e24eb0ae2c8881cc426457a0fdd3a52460
Python
4,748
135
# ============================================================================== # Copyright 2025 Technical University of Denmark # Author: Nikolas Borrel-Jensen # # All Rights Reserved. # # Licensed under the MIT License. # # 3D: used for converting the full dome to quarter dome for domain decomposition # ============...
b1669eb754a1a9b75a1380bdc7aaeeb24f71a63faded255e7c39113a939caf2b
Python
4,748
130
# 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 math from fairseq import metrics, utils from fairseq.criterions import register_criterion from .label_smoothed_cross_entropy import (...
6338e94921265d9fa4227b9c0ee1e238b4312d029619414f6206c7ea5a384fd2
Python
4,756
163
""" """ import os, sys import logging import argparse import glob from typing import * import numpy as np import pandas as pd from matplotlib import pyplot as plt def timestep_from_fname(fname: str) -> int: """ Get the timestep from the given filename >>> timestep_from_fname("generated_0_timestep_0.cs...
d07cfc1f68a71cf075ad5d2eaa54fc400e349f439600ac39740e2b9877883700
Python
4,757
125
from chromadb.api.types import EmbeddingFunction, Space, Embeddings, Documents from typing import List, Dict, Any import numpy as np from chromadb.utils.embedding_functions.config_validation import ( validate_embedding_function_kwargs_are_safe, ) from chromadb.utils.embedding_functions.schemas import validate_confi...
d981517dbee8c807377de5204c2f35d319519c7e6df75fad58f93a2bb82d10b5
Python
4,757
123
from collections.abc import Iterable from qtpy.QtCore import Qt, Signal # type: ignore[reportPrivateImportUsage] from qtpy.QtWidgets import ( QHBoxLayout, QRadioButton, QScrollArea, QSpinBox, QVBoxLayout, QWidget, ) from idtrackerai import Blob, Fragment class MarkMetadata(QScrollArea): ...
2eda0ba0b0b6558a69973f7a695f7cbbaa9dcd2eea6fa864914058ec55303367
Python
4,763
101
# Module for calculating aSNR (arbitrary signal to noise ratio) of a fluorescence trace when the step boundaries are known # Copyright (C) 2023: Max F. K. Wills & Ian C. Eperon # FluoroTensor: identification and tracking of colocalised molecules and their stoichiometries in multi-colour single molecule imaging via de...
2695e65e7eea344242dd54e659ba7b943c895413fb22aa82e4b23bda74400c16
Python
4,765
118
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. from ._base_datamodule import NequIPDataModule from nequip.utils import download_url, extract_zip from nequip.utils.logger import RankedLogger import os from typing import Union, Sequence, Optional, Li...
3724d487761294deed807e156f7ab799c578c99d137f0dd4cfeb8aab0ce2029a
Python
4,768
111
from dig.threedgraph.dataset import MD17 import shutil def test_MD17(): root = './dataset' dataset = MD17(root=root, name='aspirin') assert len(dataset) == 211762 assert dataset.__repr__() == 'MD17(211762)' assert len(dataset[0]) == 4 assert dataset[0].z.size() == (21,) assert dataset[0].p...
f446f7f7ca8b3d4c53e2a35a111b66abc42c68aff188d9a3a1798f32cc18955b
Python
4,769
122
# Based on the code from: https://github.com/klicperajo/dimenet, # https://github.com/rusty1s/pytorch_geometric/blob/master/torch_geometric/nn/models/dimenet.py import torch from torch_scatter import scatter from torch_sparse import SparseTensor from math import sqrt, pi as PI from torch_geometric.nn import knn...
bc5410872c5787fff4f07a2027ad0c76a0a84dab9d2dfcce87055f7c302731c7
Python
4,771
110
# 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...
ab1ac0a0e588fded0ac30d37ce5e671129f27731b16495a07a844911223478c7
Python
4,772
138
# 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...
d18e0d80238db540738dfb13491d55f3646b2cf88bfea40d08a9ed86352020d8
Python
4,772
157
from copy import deepcopy import torch from odl.contrib.torch import OperatorModule from odl.tomo import fbp_op from odl.operator.operator import OperatorRightScalarMult from dival.reconstructors.standard_learned_reconstructor import ( StandardLearnedReconstructor) from dival.reconstructors.networks.iterative imp...
2defb2130aedb08c5f57e011a5c935b7ce174b4e5f862c690eea3d0892ff4e62
Python
4,775
158
import random import pytest import geomstats.backend as gs from geomstats.geometry.special_euclidean import ( SpecialEuclidean, SpecialEuclideanMatricesLieAlgebra, _SpecialEuclideanMatrices, ) from geomstats.test.parametrizers import DataBasedParametrizer from geomstats.test_cases.geometry.base import Lev...
4a3cfc81c5f3b30cb3a70a201676560d70e4e9015a56a22ef5b0ed7bb7991cd8
Python
4,779
113
"""Split data in sets and normalize (per recording).""" import glob import json import os import pickle import numpy as np if __name__ == "__main__": # Arguments for splitting and normalizing speech_features = ['envelope', 'mel'] splits = [80, 10, 10] split_names = ['train', 'val', 'test'] over...
c73f7ba9d8aa366db115065459e655fb1a5aef6930adad83c68ab7c8a8aa94c1
Python
4,779
146
import numpy as np import scipy.signal from PyQt5 import QtCore, QtGui, QtWidgets import matplotlib.pyplot as plt from sanpy.sanpyLogger import get_logger logger = get_logger(__name__) import sanpy from sanpy.bAnalysisResults import analysisResultDict, get_plot_result_definitions from sanpy.interface.plugins impor...
44be6b0a0524b72e2fd845c4c98cf7dd17011f437dadb99ce6a7128967d30f09
Python
4,780
124
import pytest import geomstats.backend as gs from geomstats.geometry.grassmannian import Grassmannian from geomstats.test.test_case import TestCase from geomstats.test.vectorization import generate_vectorization_data from geomstats.test_cases.geometry.base import LevelSetTestCase from geomstats.test_cases.geometry.rie...
b572fb8ce763242c45b6b96f3447f8b4ab4e740ab89bbd2ec9164fe7ca7c0a02
Python
4,781
137
# -*- coding: utf-8 -*- """ Created on Wed Mar 1 11:42:35 2023 @author: nicol """ # -*- coding: utf-8 -*- """ Created on Wed Feb 22 11:53:34 2023 @author: gritti """ import os, glob, tqdm from skimage.io import imread import numpy as np import matplotlib.pyplot as plt from matplotlib import rc import pandas as pd ...
25a033ac709872b411ebb4514ec81dde7f9f972d817673c6e3d3613592549bfa
Python
4,782
148
import os from glob import glob import logging import argparse import subprocess from pathlib import Path import tempfile from typing import * from tqdm.auto import tqdm PROTEINMPNN_SCRIPT = os.path.expanduser("~/software/ProteinMPNN/protein_mpnn_run.py") assert os.path.isfile(PROTEINMPNN_SCRIPT), f"Expected {PROTEIN...
67e15b73e42d6be6974736eab378afad51d0d01d84144018c0498ee175ce549a
Python
4,782
166
import sys import numpy as np import psi4 # read in args # structure file xyzfile = sys.argv[1] # orbital basis basisname = sys.argv[2] # auxiliary basis auxbasis = sys.argv[3] # level of theory theory = sys.argv[4] xyzprefix = xyzfile.split('.')[0] psi4.set_memory('128 GB') psi4.set_num_threads(16) psi4.core.set...
32871ce96332edbc26702b4d9760e9d18343ad379694c8dce66e8016e53bc327
Python
4,784
136
""" Time-frequency analysis using Morlet wavelets or multitapers TFR computed on each raw file, from the beginning until the end. The result is the grand average of TFRs over all epochs. Kyuhwa Lee, 2018 """ import sys import mne import scipy import numpy as np from pathlib import Path import mne.time_frequency imp...
1d14219cba5de8767029b2f10e1d4f016df0b5b68bb7beb724494f6c3b808ca1
Python
4,786
122
import numpy as np import pytest from openfl.databases.persistent_db import PersistentTensorDB from openfl.utilities.types import TensorKey ############################################# # Pytest Fixtures # ############################################# @pytest.fixture def persistent_db(): ...
a9a9734fe8d40e7ac46ae131b15950031db5b563f3d5061db53496ff51ed8641
Python
4,787
138
from chromadb.utils.embedding_functions.schemas import validate_config_schema from chromadb.api.types import Embeddings, Documents, EmbeddingFunction from typing import Dict, Any, cast import json import numpy as np class AmazonBedrockEmbeddingFunction(EmbeddingFunction[Documents]): """ This class is used to ...
e19a9786e619d500d00a5e0f8f49debea7c685c0d9b77a1c9c00a6799f21466a
Python
4,787
183
import numpy as np from skimage.data import shepp_logan_phantom from skimage.transform import radon, iradon, iradon_sart, resize from skimage.color import gray2rgb from skimage import io from scipy.io import loadmat import sys def db2ratio(db): """ For power: db=10*log(ratio) ratio=10**(db/10) ""...
3a2338325688386ac12820cfc1178a12750b037eda0e0769f42690544dd56715
Python
4,793
118
from typing import List, Dict import numpy as np from reinvent.chemistry.library_design import FragmentReactions from reinvent.chemistry.library_design.reaction_definitions.standard_definitions import ( StandardDefinitions, ) from reinvent.chemistry.library_design.reaction_filters.reaction_filter_configruation imp...
6a3458be39ff1cead5a4f804fc060bd4499f9c337c4dd31fb8308d76e0e49b14
Python
4,793
141
"""Define immutable application state for the DANDI NiceGUI demonstration.""" from __future__ import annotations from dataclasses import dataclass from typing import Protocol from dandi_dataset import ( DandiAssetSummary, DandiDataset, DandiDatasetMetadata, DandiSweepPlotData, ) @dataclass(frozen=T...
33c1a4b5db2ea073a34596abf91c19eebc0c077ca03db17acecdd2bb0fe68c05
Python
4,794
165
import warnings import numpy as np from sklearn.metrics import matthews_corrcoef def mcc_score(y_true, y_prob, threshold: float): """ Matthews Correlation Coefficient can be computed in three different ways, 1. for training computed on threshold 0.5 2. for validation computed for 0.5 but also include...
e8a3411d1b752d72f08dcd865000479e7f7614225233b9d5529c28ca29664c42
Python
4,794
99
""" Computation of local energies and forces. """ import jax import numpy as np from jax import numpy as jnp from deeperwin.configuration import ForceEvaluationConfig from deeperwin.utils.utils import get_el_ion_distance_matrix, get_full_distance_matrix import functools def get_el_el_potential_energy(r_el): n_el =...
7ec7fcf33c46f9e6ffcc9c9ca02ba6b0d502b278d3ea3822e063d6c437974e3b
Python
4,797
137
""" File containing a regular Multi-Layer Perceptron (MLP) implemented in haiku. """ from typing import Iterable, Optional, Callable, Literal import jax import jax.numpy as jnp import numpy as np import haiku as hk from jax import numpy as jnp from kfac_jax import register_scale_and_shift from deeperwin.configuratio...
e7ce2601592227d8aeffbcba15ecc79b8c12bbe412d368ca152f7faf8a4e54a4
Python
4,799
149
import torch from torch import nn, Tensor from typing import Optional, Tuple from ..layers import ( get_normalization_layer, ConvLayer, Dropout, LinearSelfAttention, ) from ..modules import BaseModule from ..misc.profiler import module_profile class LocationPreservingVit(BaseModule): """ Th...
c4dc5e45078920a7e1bef637b3ac4468ca6990ac70d005a854d131a15cb8bd24
Python
4,801
156
from pathlib import Path from typing import Union, Optional import openpyxl from openpyxl.styles import Font import sys import argparse ID_SPACE = (15000, 16000) FREE_IDS = list(range(ID_SPACE[0] + 1, ID_SPACE[1])) PREFIX = 'BCIO' ID_WIDTH = 6 def register_id(id: Union[str, int]) -> Optional[int]: if isinstanc...
31de3a9636c36775749cc1da41055e06426f542bf016d58fd9802c410bef0a8e
Python
4,802
139
import time import logging import pickle from pathlib import Path from typing import Any, Dict, Tuple import numpy as np import pandas as pd import jax from jax.random import split import optax import plasticity.synapse as synapse import plasticity.data_loader as data_loader import plasticity.losses as losses import ...
952e01a92f8fd930faf80c043aef75c4d672c6322ccf418a0bf6e43540afa44a
Python
4,806
125
"""Tests for two-sample permutation tests.""" import pytest import numpy as np from nltools.algorithms import two_sample_permutation_test class TestTwoSamplePermutation: """Test two-sample permutation tests.""" @pytest.mark.parametrize("n_features", [10]) def test_basic_functionality(self, n_features):...
1e546511f31b9f981f0004b44de9c7bae03a12ace0c33997405de23511b25973
Python
4,809
149
# ------------------------------------------------------------------------------ # Copyright (c) Microsoft # Licensed under the MIT License. # Written by Bin Xiao (Bin.Xiao@microsoft.com) # ------------------------------------------------------------------------------ from __future__ import absolute_import from __futu...
d86db8fdd6a63247c6333a60f41478d07ad32936f5f52d4c6070efd4460db737
Python
4,812
103
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. from ._ase_datamodule import ASEDataModule from nequip.utils.file_utils import download_url, extract_tar from nequip.utils.logger import RankedLogger import os from typing import Union, Sequence, List,...
31a194569ebc9751d972f5a4b326fcf01db936d43edf0e95b64777cf3674d1c4
Python
4,813
139
"""Round-trip tests for DesignMatrix.write() and the file constructor. Behavioral contract: - Text formats are symmetric: whatever ``.write()`` produces for a given extension, the constructor reads back. The separator follows the extension (``.csv`` -> comma, everything else -> tab) on both sides. - HDF5 is the me...
1067808dcd5badc6b0c04e3b697b921b6dffc1fd885fceaf7f2bc73d0a7891b9
Python
4,815
150
import gvp from atom3d.datasets import LMDBDataset import torch_geometric from functools import partial import gvp.atom3d import torch.nn as nn import tqdm, torch, time, os import numpy as np from atom3d.util import metrics import sklearn.metrics as sk_metrics from collections import defaultdict import scipy.stats as s...
3aca1680604b2dd1ecf8fa903b78636ad3e20139f31e837b845e70945188eaa0
Python
4,816
191
import math import numpy as np from scipy import stats import scipy.cluster.hierarchy as spc import seaborn as sns from matplotlib import pyplot as plt from matplotlib.gridspec import GridSpec from matplotlib.patches import Patch def annotate_corr_grid(g, x, y, method="pearson"): g.map_dataframe(annotate_corr, x=...
c199be974755465176cbb90449f8e66ee2430fab87e2a2d0a5f447dbc9401256
Python
4,817
135
# ------------------------------------------------------------------------------ # 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 ...
c002fdf909a0c38496120da587e39989d482e8954fc000c2621db76789cc903b
Python
4,819
93
""" Theta Neuron Mean-Field Model ============================= Here, we will introduce the mean-field model of a network of all-to-all coupled theta neurons. The theta neuron model is also known as the `Ermentrout-Kopell <http://www.scholarpedia.org/article/Ermentrout-Kopell_canonical_model>`_ model and takes the for...
4ce3fe03a27c48b1ef0c635bb061db4e3c7dd5da23e3a9b8c0d0b872e4b5ccf9
Python
4,820
156
#Loads normalized and paganin filtered PSI micro CT data from a single hdf5 file and reconstructs it. #Utilizes tomopy and astra toolbox to run a GPU-enabled FBP algorithm for quick recon times import tomopy import numpy as np import h5py import getopt, sys #populate default variable values sname = 'output.h5' data_f...
9639b856c128a1d9a0f91d910ab9a475bb5330ecd2fff07c659f0f9a63f06ea2
Python
4,822
156
import pytest import geomstats.backend as gs from geomstats.exceptions import AutodiffNotImplementedError from geomstats.test.test_case import TestCase from geomstats.test.vectorization import generate_vectorization_data class NumpyRaisesTestCase(TestCase): def test_raises(self, autodiff_func): with pyte...
e5749c491447c47d82b06b4469b72ef494426ec5bf6881fd16f4af5b349ed52a
Python
4,822
147
""" Here we compare the calculation time for the simulation of a large network (10^6 parameters) on SHIP, Brian2 and RockPool. """ ### main features rate = 100 # Hz N = 500 # neurons per layer nts = 1000 # number of time-steps DT = 0.001 # time-step size tau_beta = 0.01 # LIF neuron dynamics tau_alpha = 0.0...
444f3e741ffaa5100fed76970c73131f4b334c7dbc30e12d2b01ae5c9a91e8e1
Python
4,827
158
"""Create a Reinvent model from a list of SMILES strings""" import sys import tomllib from dataclasses import asdict import time import datetime import uuid import pprint import logging try: import torchinfo except ImportError: torchinfo = None from reinvent import version from reinvent.models import meta_da...
71fd4302c7e051df5b8e18e17a88cb4837c271fddb5861635e3eec65e7f79fac
Python
4,828
182
"""functions.py Miscellaneous functions """ import numpy as np from scipy import stats from scipy.interpolate import interp1d import pycircstat import scipy as sc # ------------------ Circular data operations ----------------------- # def unwrap(signal, period=360): unwrapped = np.unwrap(signal * 2 * np.pi /...
954ccd0b77827ebbe42fb53f2dff2e839ea081542cbb66874da6450d19a4f9f0
Python
4,828
151
""" For Fig 2B go to: Z:\people\gritti\IRIR\supFig2_3 """ import os import numpy as np import matplotlib.pyplot as plt from matplotlib import rc import pandas as pd plt.rcParams.update({'font.size': 15}) rc('font', size=8) rc('font', family='Arial') # plt.style.use('dark_background') rc('pdf', fonttype=42) if __n...
54d17ba621dca20934b5d539b106e83d55d73097316bc88389240c4874a6f7ee
Python
4,829
122
from pathlib import Path import tarfile import numpy as np import matplotlib.pyplot as plt # # Set matplotlib font rendering to use LaTex # plt.rcParams.update({ # "text.usetex": True, # "font.family": "serif", # "font.serif": ["Computer Modern Roman"] # }) if __name__ == "__main__": stats_dir = Pat...
c56cd02f8a609d284ff9ae65eb202326b4abefc936887cd98ca3c474905fa50d
Python
4,829
153
import numpy as np import renderapi from scipy.sparse import csr_matrix from .utils import AlignerTransformException __all__ = ['AlignerSimilarityModel'] class AlignerSimilarityModel(renderapi.transform.AffineModel): """ Object for implementing similarity transform. """ def __init__(self, transform...
c030f23955382c1f6040d2ec2ddd330dcc40f8968d301ea7d2249a1f13039f5e
Python
4,831
195
""" GP METRICS ==================== This module allows the use of Gaussian Processes for property prediction. It is basically a wrapper of GPmol within the ChemORGAN architecture. It has been entirely programmed by Carlos Outeiral. The author whishes to thank Rodolfo Ferro for sharing his library in the alpha phase....
9d435d7763dc2982ea5dce80ddeb8705557b80a7451d9af68ea54cac7ab0bcd5
Python
4,832
135
# 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 contextlib from typing import Optional import torch from fairseq.dataclass.configs import DistributedTrainingConfig from fairseq.distr...
380cc39f2f1da5f7798fa7fa6ddc6d609656d656f23d620d7acf3aacc93055be
Python
4,833
138
import torch import torch.nn as nn import torch.nn.functional as F class DoubleConv(nn.Module): """(Convolution => [BN] => ReLU) * 2""" def __init__(self, in_channels, out_channels, mid_channels=None): super().__init__() if not mid_channels: mid_channels = out_channels ...
4161a5b7a01ee76ef9657c526e3c5c727185bbdbd4e3feb6cc964a7b1f426758
Python
4,833
158
"""Write out a CSV summary""" from __future__ import annotations import logging from typing import TYPE_CHECKING import numpy as np from reinvent.runmodes.samplers import PepinventSampler if TYPE_CHECKING: from reinvent.runmodes.RL.reports import RLReportData csv_logger = logging.getLogger("csv") logger = logg...
edda5a63c9cd15463cc811b098b827b493590ad810036f8020de547233e646ac
Python
4,835
105
import sys import os import re import numpy as np import subprocess import math import scipy import silhouetteRank.spatial_genes as spatial_genes from shutil import copyfile from operator import itemgetter from scipy.spatial.distance import squareform, pdist from scipy.stats import percentileofscore from sklearn.metric...
071babd29dd392391593836c97bfd5d069d8b51ae86d6f6558fd4cf3f29c75b4
Python
4,841
109
import numpy as np import argparse import quantities as pq import neo from utils.parse import parse_string2dict, none_or_float, none_or_str from utils.neo_utils import imagesequence_to_analogsignal, time_slice from utils.neo_utils import analogsignal_to_imagesequence, flip_image, rotate_image from utils.neo_utils impor...
19bb94cfcbfbd7d7e05a52cb57f49dda547b7b0ba6833ccfdba2862fbcbf4fb6
Python
4,842
171
"""The MDM classifier on manifolds. Lead authors: Daniel Brooks and Quentin Barthelemy. """ from scipy.special import softmax from sklearn.base import BaseEstimator, ClassifierMixin import geomstats.backend as gs from geomstats.learning._template import TransformerMixin from geomstats.learning.frechet_mean import Fr...
f33255509d64b092635d03cebadaffb6940ecca2ad0e6c3e4bc467a03fa4f688
Python
4,842
131
import string from pathlib import Path import matplotlib.pyplot as plt import numpy as np import torch from matplotlib import cm import mlspm.preprocessing as pp from mlspm.datasets import download_dataset from mlspm.models import EDAFMNet # # Set matplotlib font rendering to use LaTex # plt.rcParams.update({ # ...
1093b6cc0ff3e45690512f71b0fce12f9b2a0c877c4376bc2cb39bb20924271a
Python
4,846
161
import logging from collections.abc import Callable, Iterable from datetime import timedelta from operator import length_hint from pathlib import Path from typing import IO, TypeVar from rich.progress import ( BarColumn, DownloadColumn, FileSizeColumn, Progress, TaskProgressColumn, TimeRemainin...
71065cb4bad1f44d06fe4d82bdb7321af2dca8cb5e230d38a68ec0005d63b4c0
Python
4,854
127
"""The registry against a real VDJdb release zip. Marked ``release``: needs ``VDJDB_REFERENCE_ZIP`` and runs nightly, not per-PR. It is the check that the positional contracts in ``vdjdb.schema`` describe the file consumers actually parse, rather than what the source code says they should. """ from __future__ import a...
f72cc3d316abc390f8e811b1100f2baf7a1404380fecefc97531c5be81c72e04
Python
4,854
146
# 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...
4062bbb16d91b78c499f6329b219cab99670ffbf5a7ab6c52695123dcb001dd7
Python
4,855
155
""" NeuroLearn datasets =================== functions to help download datasets """ ## Notes: # Need to figure out how to speed up loading and resampling of data __all__ = [ "download_nifti", "get_collection_image_metadata", "download_collection", "fetch_emotion_ratings", "fetch_pain", ] __autho...
da41a6ecc7aaee2f844eec3128d80078c0c91341c721a86d6317dc0139eb9ddd
Python
4,859
149
import json from functools import partial from PyQt5.QtCore import QSettings from sleepy.gui.settings.view import SettingsView from sleepy.gui.builder import Builder from sleepy import SLEEPY_ROOT_DIR from sleepy.gui.settings._view import VIEW import pdb class Settings: def __init__(self, application...
19f0a2027ff415af9f0366e49319c33ce74d0533f5305bfd29abaf039fdb2eca
Python
4,860
147
from __future__ import annotations from enum import Enum from pathlib import Path from typing import Dict, Generic, Iterable, List, Mapping, Protocol, Sequence, overload from typing_extensions import Self, TypeAlias, TypedDict, TypeVar from snakebids.utils.containers import MultiSelectDict _T_contra = TypeVar("_T_c...
d49412d5783c46d6b63d504c33660d501d980ddb5e1029626a84de08613c1865
Python
4,860
147
# Copyright (C) 2020-2023 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Pipeline tests module.""" import numpy as np import pytest from openfl.pipelines.pipeline import Float32NumpyArrayToBytes from openfl.pipelines.pipeline import TransformationPipeline from openfl.pipelines.pipeline import Transformer ...
8bb4e2fddd43967dc518035e60edfbd12ddfaa7f03b54690816147b989976b37
Python
4,863
144
"""MolScore adapter for REINVENT scoring Wraps any scoring function exposed by MolScore for use as a REINVENT scoring component. The user specifies the MolScore scoring function class name and its keyword arguments via the REINVENT config. """ from __future__ import annotations __all__ = ["MolScore"] import loggin...
a0e5e3d930e23b16eeb503e117520b39e08dbaa34651eeb08dc2bf3c8ba47e78
Python
4,863
138
import collections import numpy as np class Normaliser: def __init__(self, sample_iterable, normalisation_scope): self._sample_iterable = sample_iterable self._normalisation_scope = normalisation_scope if self._normalisation_scope not in ["sample", ...
2deff96fa79b954b74f3334ff41c46ffe2188cb0705ba661ff76c88ce5b61fd0
Python
4,864
111
import warnings warnings.filterwarnings("ignore") # import pickle5 as pickle # this is for local run import pickle # this is for sherlock run import matplotlib as mpl from utilityFunctions import * high_res=True parent_substitutions={ 'Amyg, Amygdala': 'Middle Temporal Gyrus', 'CG, Cingulate Gyrus': 'Cingulat...
c18b56b6bef488b9a8e1ecb0938dc66e74b2b994eb01f78ba4be6cd1f5e27206
Python
4,866
150
""" Code to read in a json describing hyperparam sweep and create scripts to execute each combination """ import os, sys import logging import argparse import itertools import json from typing import * logging.basicConfig(level=logging.INFO) def params_to_cli_args(param_dict: Dict[str, Any]) -> str: """Format t...
d84e2d0cd57d7c14a121951dbaa4119b7f4b2fac197a09f0c12d5dfd0bf5c804
Python
4,869
125
import numpy as np from odl import nonuniform_partition from odl.tomo import Parallel2dGeometry, RayTransform from dival.datasets.dataset import Dataset def get_angle_subset_dataset(dataset, num_angles, **kwargs): """ Return a :class:`AngleSubsetDataset` with a reduced number of angles. The angles in the...
25f295e208fd2bc08e721ab215002ba8b6d9913283bda170a081a15e7e6458e1
Python
4,871
120
"""Which first interaction block a `--model MACE` run actually gets. `configure_model` keeps an allowlist of three blocks for the first layer, and rewrites anything else to `RealAgnosticInteractionBlock` without saying so (mace/tools/model_script_utils.py:282-289). So `--interaction_first` can name a registered, valid...
7d265c0deac0c82fcb5a73f50951d2c28aa088939dbc93199beaffb723b0e244
Python
4,872
150
#!/usr/bin/env python3 """ Used for EMA tracking a given pytorch module. The user is responsible for calling step() and setting the appropriate decay """ import copy from dataclasses import dataclass, field import logging import torch from fairseq.dataclass import FairseqDataclass @dataclass class EMAModuleConfig...
edc9c280ab2f0abce71ac811533c03c61fef7ee5815680f70e8c128ec0805358
Python
4,872
131
# MODIFIED VERSION ONLY READING FILES # working here (11Aprl) import os import numpy as np import pandas as pd import torch import matplotlib.pyplot as plt from sklearn.manifold import TSNE from tqdm import tqdm import json import torch from torch_geometric.data import HeteroData import torch_geometric.transforms as...
f9f8b70f58cfd22675248e1bdde14563e80e2b8b41ddc0b17615fd4fe45721a5
Python
4,874
141
"""The LinkInvent sampling module""" __all__ = ["LinkinventSampler", "LinkinventTransformerSampler"] from typing import List import logging import torch.utils.data as tud from rdkit import Chem from .sampler import Sampler, validate_smiles from . import params from reinvent.models.linkinvent.dataset.dataset import D...
07f7325563e5684b7999332cd00fb85abfe734ccfcfe120805cd638eda893c06
Python
4,875
177
import pytest import numpy as np from reinvent.scoring.transforms import DoubleSigmoid from reinvent.scoring.transforms import ReverseSigmoid from reinvent.scoring.transforms import Sigmoid from reinvent.scoring.transforms import LeftStep from reinvent.scoring.transforms import RightStep from reinvent.scoring.transfo...
a25acb7055e39f7de3e6c06720c421a93da70c9e367dd4be46c85e5f4a5de861
Python
4,875
126
""" Run Time Optimization ===================== In this tutorial, we will go through some of the options you have to improve the run-time of vector-field evaluations based on the equation files generated by PyRates. As an example, we will use a model of :math:`N = 100` interconnected leaky integrator units, the evolut...
957fbdfb6a49668e3d40e6423fa632951276ece875084f878a26aba904af1401
Python
4,879
159
"""Pytorch based linear algebra backend.""" import numpy as _np import scipy as _scipy import torch as _torch from torch.linalg import ( cholesky, det, eig, eigh, eigvalsh, inv, matrix_power, qr, solve, ) from torch.linalg import matrix_exp as expm from ..numpy import atol from ..n...
7d387b913d3b45aa264ccbbe0fb4520f2e4db320f995f3eb58044ef8e392bbac
Python
4,882
120
# call sampler # call scoring # TODO: what is missing? Amino acid correct chemistry check (from pepinvent fragments), log out amino acid names, correct input, run mode exposure from __future__ import annotations import csv import logging import os from reinvent.models.model_factory import sample_batch __all__ = ["r...
ba8317c47da54dd0542f1476155faebd1612e2e1dcb8f5846520751796e668ee
Python
4,882
191
from __future__ import absolute_import from scipy import stats from scipy.stats import rv_continuous import numpy as np import sys from .decorators import swap2zeroaxis from .descriptive import resultant_vector_length @swap2zeroaxis(['alpha'], [0]) def kappa(alpha, w=None, axis=None): """ Computes an approxi...
6b7f1078071507da2ecdd348b335d4024257cb80811157a48a4cb5ec60daac1b
Python
4,884
142
from chromadb.api.types import EmbeddingFunction, Space, Embeddings, Documents from chromadb.utils.embedding_functions.schemas import validate_config_schema from typing import List, Dict, Any, Optional import os import numpy as np import warnings class VoyageAIEmbeddingFunction(EmbeddingFunction[Documents]): """ ...
3438fbd83750d00062c6361fffb4fd8253bea122274048155d699d9067f0565b
Python
4,885
168
""" Communicate with TimescaleDB databases. Author: Tal Eisenberg, 2021 This module requires the psycopg2 library. psycopg2 is an optional dependency, and only necessary when database communication is required. The module tries to make a default connection to a localhost """ import multiprocessing as mp try: im...
b55359caead77f461ca47c2f622bd5e4ec129270e3cc106c61e0010c4edc90df
Python
4,885
127
"""Tests for nltools.algorithms.signal — temporal signal processing.""" import numpy as np import polars as pl import pytest from nltools.algorithms.signal import downsample, upsample, calc_bpm, make_cosine_basis class TestDownsample: """Test downsampling algorithm.""" def test_downsample_mean(self): ...
db953e7015231535ce14c2294aa66771dc0f15d8deeec83b77aba6de502cbe86
Python
4,888
149
import sys import multiprocessing as mp from PyQt5.QtGui import QTextCursor from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot, QThread from PyQt5.QtWidgets import QDialog, QVBoxLayout, QTextEdit from neurodecode.logger import add_logger_handler from neurodecode.utils.lsl import list_lsl_streams #################...