sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
35c32c87aabee69b30e4e4c8a575d44b77a22924c8572f951cf1d3840ac58463
Python
13,480
357
from abc import ABC from typing import List, Tuple import torch from torch import nn as tnn from torch.autograd import Variable from reinvent.models import meta_data from reinvent.models.transformer.core.enums.sampling_mode_enum import SamplingModesEnum from reinvent.models.transformer.core.network.encode_decode.mode...
6053865d1ed9b4740a31bd6c0ea7429f611689b09cb030f43988dc6cb7e5a3dc
Python
13,501
398
# Script containing the modular version of the code # so far we have only implemented the non_linear_embedding layer # for simplicity we can just use dense layers for the merge operations import numpy as np # import matplotlib.pyplot as plt import torch import h5py import torch.nn as nn from torch.utils import dat...
2b82b6c26dd9842be0f026ceba60ce9585a713099835b399948b0a74a615859c
Python
13,503
373
""" Tests for ISC Group Difference (ISC Group) module. Test organization follows the TDD plan (isc-group-tdd-plan.md): Phase 1: Core ISC Group Difference Computation Phase 2: Permutation Method Phase 3: Bootstrap Method Phase 4: Main Function Phase 5: Statistical Correctness Tests Phase 6: Inte...
617361485970c0d5faa769ff7c00f259b00a16c1f89564e5e9cd8ce5af00ba3c
Python
13,503
343
# Copyright (c) 2017-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 os import to...
98bc4366345da181e743f87e6ba95e7e26d4458eee40d5c645934195c8cf6b38
Python
13,503
295
from utils_ds import * from models.reaction import * try: from torch.utils.tensorboard import SummaryWriter except: print("tensorboard, fail") import pickle from copy import deepcopy import matplotlib as mpl from rdkit import RDLogger RDLogger.DisableLog('rdApp.warning') mpl.use('Agg') os.environ["CUBLAS_WORK...
3f8ba4f0b048612a30902f04094675552f3194e57a9b5d9dc3411225ff653c1b
Python
13,513
320
"""The two tiny parity anchors reproduce their committed references. These are the numbers everything downstream is measured against: the converted-architecture gate, the live in-process parity run, and the backend parity goldens all reduce to "does this checkpoint still produce these values". They run per pull reques...
e6af7444f3a70d6dac45b3488443194040de5f7b8bb41a63433633c0c74e4229
Python
13,519
257
import os import math import tensorflow as tf if tf.__version__[0] == "2": tf = tf.compat.v1 import numpy as np from common.common import safe_make_dir from common.batch_generator import BatchGenerator import common.architecture as architecture def experiment_run(config_dict): tfrecords_folder = config_dic...
e4899debae80ad67fe958bdf0043b4d8ea4e255f54642a824b127eab73098af9
Python
13,520
402
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 import json import sys from os import path sys.path.insert(0, '../') from utilities import SequenceDataSet import gc gc.collect() nameScript = sys.argv[0].split('/')[-1] ...
40124cc863d8b4e4b0c2b7ee93fda0a03cae8a90bf1aff05b0411a0438c68231
Python
13,557
341
import os import pickle import numpy as np import pandas as pd from tqdm import tqdm from common.utils import read_sas7bdata_pd sides = [None, 'R', 'L'] def build_single_img_based_multi_progression_meta(oai_src_dir, only_baseline=False, use_sas=False): # visits = ['00', '12', '24', '36', '72', '96'] # ...
3e03b98bc55eb8ac77b239bba9304a764a07c84f1cd09ad7014341278dba43bc
Python
13,574
362
from math import pi as PI from typing import Optional import torch import torch.nn.functional as F from torch.nn import Embedding, Linear, ModuleList, Sequential from torch_scatter import scatter from torch_geometric.nn import MessagePassing, radius_graph from torch_geometric.utils import to_dense_batch import torch...
15d3cfc3c21a8792a46a7ce9f18e938bee339395c0b00215db1990a163a2abc2
Python
13,586
275
# 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 fairseq.dataclass.utils import gen_parser_from_dataclass from fairseq.models import ( register_model, register_model_architecture...
ff33f0336e4685ed30bf4c21c7ddc292b1bb52d37140f4d1a1f75a7f777ffd21
Python
13,586
256
"""AIRR export: Rearrangement and Reactivity, projected from the definitive tables. Two files, at the two levels AIRR models: =============================== ============================================================== ``vdjdb.rearrangement.tsv`` one row per chain -- AIRR Rearrangement ``vdjdb.reactivity.tsv`...
a99dbccd611e410243839f46d8f8384b2086b22dd2fc07cd9a82ab2a3bf09eee
Python
13,589
375
"""Temporal signal processing — resampling, filtering, and basis functions.""" import warnings import numpy as np import polars as pl from scipy.interpolate import interp1d from scipy.signal import butter, filtfilt def calc_bpm(beat_interval, sampling_freq): """Calculate instantaneous BPM from beat to beat inte...
c1e0708d38070635a5cd5574762d0fc7dc66b104b75848e92a62b4a8526fea14
Python
13,591
402
# copyright (c) 2020 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...
cff0dd5307340d0a233db6b7f1043ecaf0e3858ffae6fff4902666ea62e4cbbc
Python
13,598
350
"""Permutation tests for autocorrelated time series. Shuffling the samples of a time series destroys its autocorrelation and inflates false positives. These surrogate-data methods build the null while preserving temporal structure: - `circle_shift`: rotate the series (preserves autocorrelation exactly) - `phase_rando...
9adc7990a0bd54dd074872fc001c4dc4fd81612195b83536c8fa51f16a95be51
Python
13,607
359
"""Normalize relation matrices and construct owned, metadata-consistent results.""" from copy import deepcopy from dataclasses import dataclass from math import isqrt from pathlib import Path import numpy as np import polars as pl from scipy.spatial.distance import squareform from nltools.data.ownership import _copy...
8e92a8c953575bdf2173c7a2452e8a7a86dcb911cbf073382f26400c1bf288a5
Python
13,613
302
import numpy as np import torch import torch.nn as nn from torch.utils.data import DataLoader from metric import * from models import * import csv import random from data import * import argparse import os import sys class PreTester(): def __init__(self, smile_list, conf_tester): self.config = conf_teste...
1f8871285941f0904ba4d02a6c0f07939cc0fcb791650e7cf4137cb7ca975594
Python
13,614
354
import copy from pymonntorch.NetworkCore.Base import * class SynapseGroup(NetworkObject): """This is the class to construct synapses between neuronal populations. Attributes: src (NeuronGroup): The pre-synaptic neuron group. dst (NeuronGroup): The post-synaptic neuron group. net (Net...
0bc31bc13b867222fbe1329feacca2dd51a3b94843013468c50dda1420192408
Python
13,616
277
import numpy as np # import tensorflow as tf import tensorflow.compat.v1 as tf tf.disable_v2_behavior() import os class stdp: def __init__(self, stdp_LR_fixed_potentiation, res_LR_decay_factor, number_of_networks_IN, w_res_exc_min_m...
4b23f6c01e714299a378dd255e6337964c4422a2c484c4ec384d1b7a9c1c982c
Python
13,629
412
from abc import ABC, abstractmethod from typing import Dict, Optional import matplotlib.pyplot as plt import numpy as np import pandas as pd import torch from tensorboardX import SummaryWriter from torchvision.utils import make_grid from .plotting import plot_spikes, plot_voltages, plot_conv2d_weights from ..utils im...
e24f402d9eb122be6b0d0fe1aa798d661e1060ace56e66552a0e17dcca754370
Python
13,632
240
"""Where each self epitope occurs in its own species' reference proteome, and how exactly. #632. **What this is and is not.** The antigen a receptor engages is the **pMHC**, and the epitope is the part of it that is recognised (``docs/standards/terminology.md``). ``antigen.gene`` and ``antigen.species`` are neither: t...
37d2f5e68dcd0866fca2a207c5a74c660c2323ad4bf2fd743c67b0f51aec00cf
Python
13,633
414
"""Transfer learning (TL) Train a given model with new data. The data comes from a file with SMILES strings. The file is assumed to be in multi-column format separated by commas (CSV) or spaces. The SMILES string is extracted from the first column. The SMILES strings is expected to be a complete molecule. """ fro...
c032cdb5cc1458fe09f56e400c4522282be6e5ae2bf8e23499c833d4c0a40f06
Python
13,642
449
from copy import deepcopy from pathlib import Path import ase.io import numpy as np import pytest from ase.atoms import Atoms from mace.calculators.mace import MACECalculator from mace.cli.run_train import run as run_mace_train from mace.data.utils import KeySpecification from mace.tools import build_default_arg_pars...
f63e0cfc4098c3c34502b3dd314fa684011e93ec2dee6d02d59d0d4260dc70c7
Python
13,644
240
"""The definitive tables: tidy, flat, linked by ``record_id``. These are the pipeline's output. Everything shipped -- legacy, AIRR, the new format -- is a join and a pivot away from here, never a parallel assembly. One observational unit per table, one variable per column, one observation per row: =============== =...
0689cb881a9beb28434c545b59d039bd6040e00cde9b07e359d2ee3113de176b
Python
13,652
396
# sys import sys import os import dill import configparser from pathlib import Path # sci import numpy as np import pandas as pd import quantities as pq # ephys import neo import elephant as ele # plotting import matplotlib as mpl import matplotlib.pyplot as plt # own import sssort.functions as sf import sssort.plo...
195c7b5d587684e4e4cba6ee99912eace7b453c721f41301351fefc681b40606
Python
13,668
366
# 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...
ee076627e46f4f5fc84c1c3576a4ed64e113ad9b3c3fdc631d162beb307284c8
Python
13,671
347
import torch import torch.nn as nn from .mol_tree import Vocab, MolTree from .nnutils import create_var from .jtnn_enc_bo import JTNNEncoderBO from .jtnn_dec import JTNNDecoder from .mpn import MPN, mol2graph from .jtmpn import JTMPN from .chemutils import enum_assemble, set_atommap, copy_edit_mol, attach_mols, atom_e...
b2b8d4d7cbb044274c0265934acd588e3ee579d78ecdde5444ec7fba5e8f47a7
Python
13,673
350
import torch import torch.nn as nn from functools import partial from typing import Union, List import torch.nn.functional as F from torch_geometric.data import Batch from torch_geometric.nn.conv.gcn_conv import gcn_norm from torch_geometric.nn.conv import GCNConv from torch_geometric.nn.glob import global_mean_pool, g...
975e78914afa852803c0629d048deaebeebe8162686d2f0aefc965726f117931
Python
13,677
366
from __future__ import division from __future__ import print_function import os import re import sys from scipy.io import wavfile import numpy as np from numpy.lib.stride_tricks import as_strided # store as a global variable, since we only support a few models for now models = { 'tiny': None, 'small': None, ...
f6ba8f5c51f3afe559d4537269d01b01c3eb621bc42aec37d8a969e017cb669b
Python
13,679
393
# 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 logging import os import sys import io import numpy as np import torch import torch.nn.functional as F from .. import FairseqDataset...
9f4267841f7c2908223a91a457f8f35ea3e26b4dcffddd4d11e35c75b120b874
Python
13,681
466
"""Manifold module. In other words, a topological space that locally resembles Euclidean space near each point. Lead author: Nina Miolane. """ import abc import inspect import types import geomstats.backend as gs import geomstats.errors from geomstats.geometry.connection import ConnectionFromMetric from geomstats.g...
5648ed75498e2dcde088e1e869ffe4f37627e100a284128e797cc5c5cca16b2e
Python
13,690
389
""" Runs the network with given parameters. Saves the spike counts at different trials and the average Na current magnituted for different stimuli """ from brian2 import * import numpy as np from tqdm import tqdm import os from pathos.multiprocessing import ProcessingPool as Pool from scipy.ndimage import gaussian_fil...
e5c84b182b29f12457832b06ed08c42315ebbd71621b03bc39d02185fd07811d
Python
13,721
308
''' Description: Author: voicebeer Date: 2020-09-14 01:01:51 LastEditTime: 2021-12-28 01:46:52 ''' # standard import argparse import torch import torch.nn.functional as F import torch.nn as nn import numpy as np import copy import random import time import math from torch.utils.tensorboard import SummaryWriter # impo...
7e1f036b364fe124418bd54e1c927b0a01d550f730ff33c1acc9c87d3a27e84a
Python
13,728
362
# Copyright (c) 2018, 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 ...
7e56a594260cfb7174dfa280e6a261232ae38ed09f115bdbb8fa26448279c48f
Python
13,734
427
import numpy as np from scipy import signal as sig # Filtering functions def butter_lowpass(lowcut, fs, order=8, sos=False): ''' Create a lowpass butterworth filter ''' nyq = 0.5 * fs low = lowcut / nyq if sos: sos_out = sig.butter(order, low, analog=False, btype='low', output='sos') r...
b9934c06ff5688a12901bd57cccdd67970ec9de0a13c6ed3606983aaf22c9626
Python
13,734
413
#cript containing the modular version of the code # so far we have only implemented the non_linear_embedding layer # for simplicity we can just use dense layers for the merge operations import numpy as np # import matplotlib.pyplot as plt import torch import h5py import torch.nn as nn from torch.utils import data im...
5f65a40bb6b3d8c3f36ef44d4dbc5a7b94db08ebef5408d54c64c9e431a820f6
Python
13,736
245
import pandas as pd import numpy as np import subprocess 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','N','Q','K','H','R','D','E'] for i in peptide_seq: if i in standard_aa : cnt = cnt+1 ...
b225a1d76ac0ec4c007d5a09be008c553f0042b8b4097bbdde12a34345d51827
Python
13,746
363
# Copyright 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import logging import time import math from tests.end_to_end.utils.tr_common_fixtures import ( fx_federation_tr, fx_federation_tr_dws, ) from tests.end_to_end.utils import db_helper as db_helper from tests.end_to_end.u...
9428f4a78d2d67eed6d523fb7051919a29ef7bd07c1bc25e0dd9a218d3614d31
Python
13,752
387
import os from collections import OrderedDict from pprint import pprint from typing import Union, Dict, List, Tuple, Optional import numpy as np import pandas as pd import sanpy from sanpy.bAnalysisResults import get_analysis_result_definitions from sanpy.sanpyLogger import get_logger logger = get_logger(__name__) ...
fbdba4d93405c06f8c98de956bcc673a69eb060437cc9177779c01a234d8da9e
Python
13,756
405
# 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 ...
7f7674d01825b30cfefe16e1ce73c1b1c1c46abbeba28b25f5dc0c398516bfad
Python
13,772
360
import numpy as np import scipy as sp import pandas import brian2 import copy import seaborn as sns from adjustText import adjust_text import matplotlib.pyplot as plt import statsmodels.api as sm from sklearn.metrics import roc_auc_score from sklearn.model_selection import train_test_split from sklearn.linear_model im...
41bd48495d89931e09185d7b0a8329f40d605b0a30167f156109702f469e2135
Python
13,777
300
"""Inference baselines recorded while legacy is still the live stack. "The rewrite is not slower" is only falsifiable against an *old* number, so these cases exist to be measured now and frozen, not to gate anything. They publish through the nightly ``benchmarks`` job's ``--benchmark-json`` artifact; the downstream co...
dd55ff15f7d623865c99db9b102522152624c26bdda2dc14da863768bec5a63e
Python
13,780
347
################################################################################ # Import, Set up MPI Variables, Load Necessary Files ################################################################################ import os from os.path import join import sys import matplotlib import matplotlib.pyplot as plt from matp...
839e0fbe871ac36e94f6d5b9d0ce9dca1d9c96d04fd96e885b21e0942e415d33
Python
13,794
383
# 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...
d85c7c542b1729b513e379a4021cea8198a7d7cfabd9fd324310a1e92fcc2888
Python
13,795
399
""" source: https://github.com/open-neuromorphic/open-neuromorphic.github.io/tree/main/content/english/blog/spiking-neural-network-framework-benchmarking """ from typing import Callable, Optional, List, Tuple import warnings from time import time def timeit( callable: Callable, min_runs: int = ...
7e53747701057ec94b8a122997dfc11379e4a683c6a2275c70bca5324257df88
Python
13,814
357
"""HDF5 I/O utilities for nltools data types. Shared serialization logic for BrainData and Adjacency objects. """ import io from pathlib import Path, PureWindowsPath import nibabel as nib import numpy as np import polars as pl try: import h5py from h5py import File as h5File except ImportError as _h5_import...
dd164cf1f535c90889d049b9b912abfacce7915b78d35cb3b113a496939dddb6
Python
13,819
401
import os import numpy as np import pandas as pd from nltools.data import Adjacency, Design_Matrix import networkx as nx from scipy.stats import pearsonr from scipy.linalg import block_diag from pathlib import Path def test_type_single(sim_adjacency_single): assert sim_adjacency_single.matrix_type == "distance" ...
e2687ed51fd8b9fe39051f8c0704204a0c208ebe080ab7b076d0d9cca5c8005b
Python
13,819
345
"""Computes crossval performance while also fits detection threshold of model. Always run this script after training a model, otherwise you will not have the best performing output threshold for the model. In the "Experiment settings" block of this script, set the location of the training run. In the "Data settings"...
f72308f7164203bfea7a45fe516980b7b17d4db3ebe67041db8c80ff025744e4
Python
13,827
362
# 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 app...
d2971ce56ff08d907b2f9f24765cc9e352d9f2241f455ad9922e095dee97533e
Python
13,841
404
# 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 # # Unle...
ada23ea1a4afda3b88ebf2aef574a74a2c6d3772cdf63e63789bbce3100d1747
Python
13,851
394
# 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...
88024557711973ef4227648749f9598f4272b2e5aeab08b9e496e1ab93518773
Python
13,858
352
""" Utilities for real-time multi-thread data generator """ import scipy import numpy as np from tensorflow.keras.utils import Sequence, to_categorical class CustomDataGenerator(Sequence): def __init__(self, hdf5_file, brain_idx, batch_size=16, view="axial", mode='train', horizontal_flip=False,...
2d362b6d072be32a251cab219da5c435c23e7e1786b333eba0085a4dc1e879a5
Python
13,871
309
#!/usr/bin/python3 ### # Master controller for the TreeMaze. It communicates with the arduino through serial port. # Receives data through GPIO inputs and serial. ### import threading from MazeHeader2 import * PythonControlSet = ['T2','T3a','T3b','T3c','T3d','T3e','T3f','T3g','T3h','T3i','T3j', ...
36d7cb983970884d4e6d414b6f4273ffd21a7f8058f5bd9ef62a1fe57aba951a
Python
13,872
398
# 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...
3bee881392b56e7ec2dea1e9ddf1eb86a7cae2d56ab7131be1b3744108481d5e
Python
13,873
364
import hashlib import importlib import logging import os import tarfile import sys from functools import cached_property from pathlib import Path from typing import List, Dict, Any, Optional, cast import numpy as np import numpy.typing as npt import httpx from tenacity import retry, retry_if_exception, stop_after_atte...
d1036e07fe02771439b895af4ff0d41a78e16e40840d2ca6a99e85b6730a0843
Python
13,876
341
# 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 # # Unle...
6a2a04b205d57bd62a5c13d8719bee90611b911c757d797d46edff5432e074f6
Python
13,894
321
import argparse import json import os import sys import numpy as np from pydfc.ml_utils import ( PLSEmbedder, dFC_feature_extraction, find_available_subjects, process_SB_features, select_num_components_binary_groupcv, subject_center, ) sys.path.append(os.path.dirname(os.path.abspath(__file__)...
02a9312fb730ff647ce258d4081b5f4124899b11af7e79515c760b2c7321cb70
Python
13,902
372
from __future__ import annotations import argparse import copy import functools as ft import itertools as it import re from pathlib import Path from typing import Any, ClassVar import pytest from hypothesis import given from hypothesis import strategies as st import snakebids.tests.strategies as sb_st from snakebids...
3d0d3d32921b7a0cb66863940987ed2787335aad065ec9594b6c1351712e5302
Python
13,903
440
"""Diffeomorpism implementation.""" import abc import math import geomstats.backend as gs from geomstats.vectorization import get_batch_shape, repeat_out_multiple_ndim class Diffeo: r"""Diffeormorphism. Let :math:`f` be the diffeomorphism :math:`f: M \rightarrow N` of the manifold :math:`M` into th...
9f8f95425bf3db5ffb6df1a5ea2c67d79030135c90a91c468dc7668528082de9
Python
13,908
521
"""Benchmarking parameters generation file.""" import argparse from itertools import chain, product import pandas as pd parser = argparse.ArgumentParser( description="Generate parameters for which benchmark is run" ) parser.add_argument( "-m", "--manifold", type=str, default="all", help="Man...
d72fce86ea17af8a7c8415ff85facc2adbb5085c821741d8eff48ce0de165de3
Python
13,910
350
import sklearn import numpy as np from scipy.special import expit from sklearn.metrics import roc_curve, precision_recall_curve def get_multitask_classification_measures(true, pred, are_logits): multitask_measures = dict() per_task_measures = dict() y_measures_list = list() y_weight_list = list() ...
c0b105430b63c91205af7b13adac89151afae063654a1a3291cf99c29d497d69
Python
13,920
310
#!/usr/bin/python3 ### # Master controller for the TreeMaze. It communicates with the arduino through serial port. # Receives data through GPIO inputs and serial. ### import threading from MazeHeader_PyCMDv2 import * PythonControlSet = ['T2','T3a','T3b','T3c','T3d','T3e','T3f','T3g','T3h','T3i','T3j', ...
b2b3be14902a5506164a0698f2288043be5f2465431d8b85a5d04cdaa917758b
Python
13,928
343
# -*- coding: utf-8 -*- import os import numpy as np import tensorflow as tf from tensorflow.keras import layers import skimage.measure as skm from scipy.interpolate import griddata #Build CNN with desired architecture def BuildCNN(conv_layers,features,win_size,dense_layers,dense_size,dropout,initializer,regu...
89884789a87808589df0e1d8a60d223afb90367a0bb1094af933288375b2b984
Python
13,939
343
# -*- coding: utf-8 -*- import os import numpy as np import tensorflow as tf from tensorflow.keras import layers import skimage.measure as skm from scipy.interpolate import griddata #Build CNN with desired architecture def BuildCNN(conv_layers,features,win_size,dense_layers,dense_size,dropout,initializer,regu...
4bd2da9b842a1fed6e0f0796f072546907546f16ab066530fb61c4eb5f722e6f
Python
13,948
316
import json import logging as log import os import pickle import coloredlogs import hydra import numpy as np import pandas as pd import torch from common.itemloader import ItemLoader from omegaconf import OmegaConf import random from omegaconf.listconfig import ListConfig from sklearn.metrics import roc_auc_score, bal...
54caded6d8c50636444f0ea80bfc55951023d3d0af878e958c9681c885151147
Python
13,949
304
import io import json import numpy as np import pandas as pd from django.contrib.auth.models import User from django.db import transaction from rest_framework_simplejwt.tokens import AccessToken from uniprotparser.betaparser import UniprotParser from celsus.models import Project, GeneNameMap, UniprotRecord, Compariso...
0279e2bdc8c74162ee22a11ba3abe9e384e10d810b359f69f77b163c17e5976d
Python
13,951
322
import random import Augmentor import cv2 import glob import os import numpy as np from PIL import Image from skimage import util from skimage import io,transform as t,img_as_ubyte from skimage.filters import threshold_otsu from skimage.morphology import opening,closing,disk from skimage.metrics import peak_...
775f928c3c54e8da1eb18e4cf7b387c37cbf90c7174f79bbb470311a6d8aaa07
Python
13,956
375
import importlib.util import os import resource import shutil import sys import tempfile from pathlib import Path import numpy as np import pytest from ase.atoms import Atoms # --------------------------------------------------------------------------- # Capability model # # Each optional requirement of a test (a GPU...
c208c824932cd4b28a6a686aa3e6be9cf4be27b17b2f38c295674437813f322c
Python
13,956
400
"""Class for the Sasaki metric. A class implementing the Sasaki metric: The natural metric on the tangent bundle TM of a Riemannian manifold M. Lead authors: E. Nava-Yazdani, F. Ambellan, M. Hanik and C. von Tycowicz. """ from joblib import Parallel, delayed import geomstats.backend as gs from geomstats.geometry.ba...
1b4ea76e58c2c0432d6d7437eab82702506ab7cdef1e2f774af2e8d70b7eaafa
Python
13,983
299
"""The spellings the evaluation command line writes onto its structures. The third door, and the one that had none of this. ``mace_eval_configs`` (``mace/cli/eval_configs.py``) does not return a dict: it writes its results back onto the ``ase.Atoms`` it was given, into ``info`` for graph-level quantities and ``arrays`...
f33a1a2d090a2b153d0be4e37cfff1be0198606eac5137011827b988b82a3685
Python
13,986
397
from __future__ import annotations import math from typing import Callable, List, Tuple import numpy as np import pytest import torch from e3nn import o3 from mace import data, modules, tools from mace.data import Configuration from mace.modules.lora import inject_lora, merge_lora_weights from mace.tools import torc...
d189c1233132c8cff66e4512a9e95228ec8579e3e4534c1eb351bcbcb41a1409
Python
13,987
333
import pytest import pickle import numpy as np import matplotlib from hnn_core import pyramidal from hnn_core.cell import _ArtificialCell, Cell, Section from hnn_core.network_builder import load_custom_mechanisms matplotlib.use("agg") def test_cell(): """Test cells object.""" load_custom_mechanisms() ...
7fa95698467f433b9cbc8ba4e815aab61564f2750a6483f8bf1616ac89b086d7
Python
13,990
305
from typing import Any, Callable, List, Tuple, Union, Dict import captum.attr as ca import torch import torch.nn as nn import torch.nn.functional as F from captum.attr._utils.common import ( _format_additional_forward_args, _format_attributions, _format_input, ) from captum.attr._utils.gradient import ( ...
1d4717ac082e39b458719b1c5641666d77b62b30cf9efc79b7ed0f2834492811
Python
14,003
283
#!/usr/bin/env python3 """ CLI to process a single molecule. """ import copy import os import sys import numpy as np from jax.config import config as jax_config from typing import Any, Tuple, Dict from deeperwin.configuration import Configuration import haiku as hk def _setup_environment(raw_config: Dict, config: Conf...
7be4cb042cfa76eca051fad338a427836c69891ada811949034f6d7c0e85b046
Python
14,015
310
import pandas as pd import numpy as np import scipy.io as sio import os import multiprocessing import time import random from tqdm import tqdm from scipy import stats from sklearn.linear_model import Ridge from sklearn.svm import SVC from sklearn.metrics import make_scorer from sklearn.model_selection import GridSearch...
9ffada173d6cdd675451ce29763a69d0b16a4af5b2a61ecb627be2daeb597b5b
Python
14,018
265
from typing import Tuple, List import numpy as np import jax import jax.numpy as jnp import e3nn_jax as e3nn import haiku as hk import functools from deeperwin.utils.utils import tp_out_irreps_with_instructions, multi_vmap from deeperwin.model.definitions import Edge, Embeddings, InputFeatures, DiffAndDistances from de...
7b82cc5cb03c2fc9e0b70c07687adf65484b4c1394d5c1f24ee3da65e6553514
Python
14,021
313
import os import numpy as np import bisect import sys #import matplotlib.pyplot as plt # import our MS libraries from pyMSpec.mass_spectrum import mass_spectrum from pyImagingMSpec.ion_datacube import ion_datacube class inMemoryIMS(): def __init__(self, filename, min_mz=0., max_mz=np.inf, min_int=0., index_range=...
4c6bfba471eab95d4ad98f6116dce22c10fdbf138457ede4d28aa9e87c336529
Python
14,023
204
import torch import torch.nn as nn import torch.nn.functional as F from .spherenet import SphereNet from .net_utils import * from .geometric_computing import * from .att import MH_ATT class SphGen(nn.Module): def __init__(self, cutoff, num_node_types, num_layers, hidden_channels, int_emb_size, basis_emb_...
2f5a6f6b9f5c160d45b1fb70d46b767c4277a655c35a50afae39580168d5d525
Python
14,033
374
"""Public writer for self-contained SanPy Zarr collections.""" from __future__ import annotations import json import os import re import shutil import tempfile import uuid from datetime import UTC, datetime from pathlib import Path from typing import Any, Iterable, Sequence import numpy as np import zarr from .cont...
f931991cdd7afd849889666cf6bd7339c74a0f9c5f82be8f014c228a3b696802
Python
14,035
328
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. import torch from e3nn.o3._irreps import Irreps from e3nn.util.jit import compile_mode from nequip.data import AtomicDataDict from ._graph_mixin import GraphModuleMixin from .model_modifier_utils imp...
32a9d1bbbfa312c3dfc686cabc6d5f31f335a9d75e2f0c13c2d71433d65b2ff7
Python
14,036
348
import random from typing import List, Literal, Optional, Tuple import numpy as np import scipy.ndimage as nimg from PIL import Image def add_norm(Xs: list[np.ndarray], per_layer: bool = True): """ Normalize arrays by subracting the mean and dividing by standard deviation. In-place operation. Arguments:...
d1f6e58132b54ec86cab64148fdbb0a44dcde99e642701e1269cf0c72ff4615e
Python
14,041
397
import torch from torch.autograd import Variable import torch.nn.functional as F from torch.utils import data from torch.utils.data import SequentialSampler from torch import nn from tqdm import tqdm import matplotlib.pyplot as plt import numpy as np import pandas as pd from time import time from sklearn.metrics impo...
ba96264de4a4dc0f31139dc8aaeb96e8d504bf86886e56f1dac16adec1ea0374
Python
14,058
381
"""Permutation test for the correlation between two variables. `correlation_permutation_test` asks whether the Pearson, Spearman, or Kendall correlation between two arrays differs from zero, building the null distribution by shuffling one array's observations. It assumes observations are independent; for autocorrelate...
53027f45593b589426fbd4eb6187c975162ddd1c0b7a5113535cc0a5ca28973a
Python
14,061
308
# 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 import NequIPLightningModule from .ema import EMALightningModule from nequip.data import AtomicDataDict from nequip.utils.versions import _TORCH_GE_2_6 from itertools impor...
613453c56484448ba11ac38046c5c0ade75811247bcb07b542f2372ffc303b94
Python
14,075
380
# 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 # # Un...
32fb669f1d6ef212bf068e14c66a08458717adc84b9b82163959b5f310134a3a
Python
14,081
347
""" Provides utilities related to PyTorch. The classes and functions :class:`TorchRayTrafoParallel2DModule` :class:`TorchRayTrafoParallel2DAdjointModule` :func:`get_torch_ray_trafo_parallel_2d` :func:`get_torch_ray_trafo_parallel_2d_adjoint`. in this module rely on the `tomosipo <https://github.com/a...
360b92071da533173ecfd66bede4411cfca25a0ef39069f7466e3ca69595d078
Python
14,095
275
from __future__ import absolute_import from .layer_utils import * from .activations import GELU, Snake from .unet_2d import UNET_left, UNET_right from .backbone_zoo import backbone_zoo, bach_norm_checker from tensorflow.keras.layers import Input from tensorflow.keras.models import Model def UNET_att_ri...
7c906ccc2f044d4722cad3eb116e985ac2904ef0cac947298138117ba1a66d0a
Python
14,128
355
import torch.optim as optim import torch import torch.nn as nn import torch.nn.functional as f import torchvision.transforms as transforms import torchvision as tv import torch.utils.data as data import os import matplotlib.pyplot as plt import random from torch.utils.data import Dataset, DataLoader import time import ...
aa92ed45b5ea9325a8876a5e65cc29412cbbf0e2f3803c14f9d1a790dea33e76
Python
14,128
335
# -*- coding: utf-8 -*- # # Класс для работы с файлами TMLDA # 28/01/2018 import ctypes from ctypes.wintypes import BOOL, DWORD import struct import multiprocessing import tmlda import win32api, win32con, win32gui from threading import Thread import numpy as np import csv import similarwords2 import os ...
a5eab5ecc2314dc3bc33acf612fb16eb08045070b7ccfe975a844a0e3d05066f
Python
14,140
371
# -*- coding: utf-8 -*- # # # PyRates software framework for flexible implementation of neural # network models and simulations. See also: # https://github.com/pyrates-neuroscience/PyRates # # Copyright (C) 2017-2018 the original authors (Richard Gast and # Daniel Rose), the Max-Planck-Institute for Human Cognitive...
f065667f508056d0b36f76a8736899470c7cf2cf403b28199a3bbb67377e7b2c
Python
14,141
434
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 import json import sys from os import path from modules import _ResidueModule from modules import _ResidueModuleDense nameScript = sys.argv[0].split('/')[-1] # we are goi...
767a099c55ba02476d0daaee09c3eae6b3c03ca4d3db4d5c96e898afdf7f1c44
Python
14,158
412
# /// script # requires-python = ">=3.11" # dependencies = [ # "marimo", # "nltools>=0.6.0", # ] # /// # Working with Adjacency — marimo notebook. Source of truth for the docs page; rendered to the docs page by scripts/marimo_to_zensical.py. import marimo __generated_with = "0.24.0" app = marimo.App(width="me...
c8568a8522238dfcc9bb5449d463c5909861b4be79a7b4a324a58b97e865c2c3
Python
14,159
365
"""Tests for GatedEquivariantBlock vs e3nn nn.Gate. Parametrized over irreps configs, dtypes, batch sizes, and layouts. Compares forward values, backward gradients, second derivatives, and verifies zero graph breaks under torch.compile for both mul_ir and ir_mul. """ import pytest import torch import torch.serializat...
32bc6eba8e8de9a988f28ccb6ac2d14e92b9a1e209f97dfaa2b0457ca134bac9
Python
14,161
353
#!/usr/bin/env python3 # # Sniffles2 # A fast structural variant caller for long-read sequencing data # # Created: 29.08.2021 # Author: Moritz Smolka # Contact: moritz.g.smolka@gmail.com # from dataclasses import dataclass import statistics import math from sniffles import sv from sniffles import leadprov @dataclas...
ca2581ca2c491e07bf96f5c93e404a37e764630b8b02f8c93e820962b8fde1d5
Python
14,161
435
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 import json import sys from os import path from modules import _ResidueModule from modules import _ResidueModuleDense nameScript = sys.argv[0].split('/')[-1] # we are goi...
ffc98536643dca9a5c13d93c4e903665d4b6d42f54531266677cc56e7296abe5
Python
14,163
305
import eelbrain as eel import numpy as np import scipy, pathlib, importlib, mne, time, os import matplotlib.pyplot as plt from matplotlib.ticker import MultipleLocator, AutoMinorLocator import scipy.stats from tqdm import tqdm from matplotlib.lines import Line2D def plot_fig_AVG(resdict, corrdict, savepath, sigbars=N...
c3f1eabc288c618d4e95e7a807ad36b8ef7ae0e41dde58a592321f6ec22ec6dc
Python
14,191
450
import nrrd import matplotlib.pyplot as plt import numpy as np import os def visualize_image( img_path, img_idx=200, axis=2, show_axis=True, show=True, output_path=None, flip=False, default_spacing=False, ): """ Visualize a slice of a 3D imag...
e5f1107c50175ffc5af4b402bccaee419df61b4aba557ceb8b4cedefed43ece2
Python
14,192
381
# -*- coding: utf-8 -*- from typing import Type, Any, Callable, Union, List, Optional import torch import torch.nn as nn from torch import Tensor def conv3x3(in_planes: int, out_planes: int, stride: int = 1, groups: int = 1, dilation: int = 1) -> nn.Conv2d: """3x3 convolution with padding""" return nn.Conv2d...
9330c25c4f126918f80d2407f161dcb7a5cd87590e2e7543b181681c62a4b083
Python
14,199
402
""" Serial-MQTT Bridge author: Tal Eisenberg <eisental@gmail.com> """ import time import paho.mqtt.client as mqtt import logging import queue from serial.tools import list_ports from serial import Serial, SerialException import threading import json def serial_port_by_id(serial_number): """ Return a port inf...
f99bc464938a910051569d1b2531c52811ac5971088dda98d177ff88d85dd429
Python
14,205
320
import torch from torch import nn from torch.nn import Linear, Embedding from torch_geometric.nn.inits import glorot_orthogonal from torch_geometric.nn import radius_graph from torch_scatter import scatter from math import sqrt from ...utils import xyz_to_dat from .features import dist_emb, angle_emb, torsion_emb dev...