sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
1a744b13b3333e5c1856025c7f447dc0440a4395eae0c264fd1cb3515368715f
Python
3,160
81
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Sep 16 12:41:34 2019 @author: mmolina """ import os import numpy as np from config import cfg, cfg_from_file, cfg_from_list, get_output_dir import scipy.io as sio import matplotlib.pyplot as plt from sklearn.metrics import roc_auc_score, roc_curve # ...
da8e82ca9f452cd418c2199d2f817bd280e9ca80b039b0e040378c347284a4e7
Python
3,160
89
# lexical_selection_generate.py # Reads manually revieved dix elements # Creates lexical selection rules for them in a new file. from argparse import ArgumentParser from collections import defaultdict # importing element tree # under the alias of ET import xml.etree.ElementTree as ET def write_variants(file_name,si...
5ac3a0c20948f0dedf6122e94cb1162ce5d0870a49b118110f5f6e9cee3ec8de
Python
3,162
88
import multiprocessing import re from typing import Any, Callable, Dict, Union from chromadb.types import Metadata Validator = Callable[[Union[str, int, float]], bool] param_validators: Dict[str, Validator] = { "hnsw:space": lambda p: bool(re.match(r"^(l2|cosine|ip)$", str(p))), "hnsw:construction_ef": lamb...
ea36af833ce44188f497f943c038a221eafcd84e48d2e842512d3868ef94423d
Python
3,162
83
# 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...
0de8ecceeaa06efb880b457805830739680eb3a41534cf297ef685aa54a8f34c
Python
3,166
108
# test.py #test_path ='/n/groups/marks/users/david/res/model_save/model2/RES_1639761348.356219_25.pt' test_path = '/n/groups/marks/users/david/res/model_save/model2/RES_1646945484.3030427_8.pt' model_id = test_path.split('/')[-1][:-3] f_path_out = '/n/groups/marks/users/david/res/out/{}.txt'.format(model_id) import...
83b04f104b3c67f9c8932207b5f57440df00058c1edf85e3a3f7d0c13ce4e12f
Python
3,167
88
# SPDX-License-Identifier: BSD-3-Clause # Copyright (c) 2020-2026, Christian Gaser. See LICENSE. """ Drop-in replacement for nilearn's TFCE. nilearn computes TFCE by stepping the height over a grid and summing (``nilearn.mass_univariate._utils.calculate_tfce``, 100 steps by default, following fslmaths). That costs a s...
6ff737be1c3240c57bb2b0f599b6ea80ab584800e70e274efc8d30e0e385b2da
Python
3,168
100
import math import pytest import geomstats.backend as gs from .base import VectorSpaceOpenSetTestData from .riemannian_metric import RiemannianMetricTestData LN_2 = math.log(2.0) EXP_1 = math.exp(1.0) EXP_2 = math.exp(2.0) class PositiveRealsTestData(VectorSpaceOpenSetTestData): def belongs_test_data(self): ...
47526cdf4a44a00a79f043d7b0f1eaf7ed90e426ab8284e4f5ee122a275a1b9a
Python
3,169
86
""" Is it really a drop-in for nilearn? nilearn computes TFCE by stepping the height (``calculate_tfce`` in ``nilearn.mass_univariate._utils``). The function here has the same signature and returns the same thing, computed exactly. The checks are therefore about the *contract*, not about agreeing numerically with nile...
75ec8a03022a03f430e5264d90835d5a25a953a84722532eaffee5c9b0f6393c
Python
3,171
92
# -*- coding: utf-8 -*- """ Created on Wed Aug 24 14:00:53 2022 @author: Tom """ import tensorflow as tf from tensorflow import keras as k tf.config.list_physical_devices() import os os.environ['CONDA_DLL_SEARCH_MODIFICATION_ENABLE'] = '1' import shutil import numpy as np from scipy.stats import mode import config f...
486aa724fa9ea3cfeb569aa882bfce2a1b63275232f2cd7ba7035d6462a5b9b9
Python
3,172
85
""" Offsets the signal in all channels by a fixed value. """ import argparse from pathlib import Path import matplotlib.pyplot as plt from utils.io_utils import load_neo, write_neo, save_plot from utils.parse import none_or_int, none_or_float, none_or_str from utils.neo_utils import time_slice CLI = argparse.Argument...
8c4c7199f8beaad73180e6436bcbcdbf1e1e8137c168c74cb72aea0bc0961460
Python
3,172
89
#!/usr/bin/env python import sys, gzip msFile = sys.argv[1] def isSnp(samples, i): alleleH = {} for j in range(len(samples)): if samples[j][i] != "N": alleleH[samples[j][i]] = 1 return len(alleleH.keys()) > 1 def processSimulation(samples, positions): newPositions = [] newSamp...
f1d0f197b6249097a164dde43589df74d817e0a0effbc85301c5c47a493f504b
Python
3,172
73
from typing import Tuple import torch from torch import nn class GraphLoss(nn.Module): """ Loss that compares two graphs. Arguments: node_factor: Weight for node classification loss. edge_factor: Weight for edge classification loss. """ def __init__(self, node_factor: float = 1.0...
4cd4cd909059e6dfb812bb18acf0b59349ff700bce38abeb225bf7b8ddb4f992
Python
3,176
84
"""Structural result records returned by the nltools estimators.""" from __future__ import annotations from dataclasses import dataclass from typing import TYPE_CHECKING, Generic, TypeVar import numpy as np if TYPE_CHECKING: from pathlib import Path Payload = TypeVar("Payload") @dataclass(frozen=True) class...
0780ca54961e2028de91d0dccf45f6b4a8425f9462850588272770e5473afcc0
Python
3,178
90
# Step 1: Imports and configuaration import SimpleITK as sitk # staple import matplotlib.pyplot as plt import numpy as np import os, sys import glob import shutil from tqdm import tqdm import nibabel as nib # Step 2: confgurations and setup config = dict() config["post_enhancing"] = True # BraTS paths config["br...
e495cc8c6b550072c9d5d7fee9aa315feff913541b3865043b55c91eabd3e226
Python
3,179
86
"""The stress mask is shared, and this is what keeps it shared. ``cell_volume_and_mask`` decides per graph whether a virial has a volume to be normalized by. That decision is only worth anything if every model reaches it, and a model reaches it by passing ``pbc`` alongside ``cell``. Miss one call site and that model r...
0ab087a216e77003bf2dc227b3f79b044a6652da562077908b01582476c83110
Python
3,181
83
# Author: Youzhi Luo (yzluo@tamu.edu) # Updated by: Anmol Anand (aanand@tamu.edu) import torch import torch.nn.functional as F from torch.distributions.bernoulli import Bernoulli from torch_geometric.data import Data from torch_geometric.utils import subgraph from torch_geometric.utils.num_nodes import maybe_num_nodes...
6e21490f5f74e5b825956dafa98425849ca4efa23ac1c89fb61c03e90a79e5bf
Python
3,181
95
import glob import os import esm import numpy as np import tqdm from model_angelo.utils.apply_sequence_transformer import run_transformer_on_fasta from model_angelo.utils.fasta_utils import FASTASequence from model_angelo.utils.protein import ( add_lm_embeddings_to_protein, dump_protein_to_prot, get_prote...
f13d43c6a2eb9deec28c83ecbdd9281c0f42f01f652f780c95efeddf13931415
Python
3,181
96
import numpy as np import copy def subhist(image_pdf, minimum, maximum, normalize): """ Compute the subhistogram between [minimum, maximum] of a given histogram image_pdf :param image_pdf: numpy.array :param minimum: int :param maximum: int :param normalize: boolean :return: numpy.array ...
fa264d3e9c6c449c9d05bac6214d56ddfbd70990bd52a3165853115a5ec4cbf1
Python
3,181
65
from sklearn import svm, metrics from sklearn.datasets import load_svmlight_file import sys import numpy as np #embedding_pt = 'D:/UB/research/dataset/20newsgroups/CoEmbedding/results/Embeddings_K50_iter19.npz' #embedding_pt = 'D:/UB/research/dataset/20newsgroups/CoEmbedding/topicmodeling/LDA/model-final.theta' ...
8f484a1a7da3680a1325334210a329b49ee924836811610c4006ed5bc50d417b
Python
3,182
96
import json import sys import os import numpy as np import csv from scipy.stats import poisson from math import ceil def import_postsyanptic_network(networkPath): file = networkPath + '/mTypes.txt' mFiles = list() with open(file, newline='') as csvfile: syns = csv.reader(csvfile, delimiter='\n') ...
b3987091e1c479c0785e5fa47b530c2cd03b554a5a757878814041726c44b00b
Python
3,183
98
""" tests for model subparts """ import unittest import torch from foldingdiff import modelling class TestPositionalEmbedding(unittest.TestCase): def setUp(self) -> None: self.bs = 32 # Batch size self.d_model = 4 self.seq_len = 512 self.input_shape = (self.bs, self.seq_len, se...
f368d625b7ccdf2715c8e85bd274159e3aaf2d5903422a80e32b3e3425e4426f
Python
3,183
112
#################################### ################## DRUGS import os import pandas as pd from tqdm import tqdm import logging import json #import logging from requests.adapters import HTTPAdapter from requests.packages.urllib3.util.retry import Retry import requests from tqdm import tqdm import time def get_drug...
cdce70a4b73ccba5a7fdbedd53e3f212d27913a058e4ef9f7b98b407b2de04a0
Python
3,184
91
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # from torch import nn, Tensor, Size from typing import Optional, Union, List import torch from . import register_norm_fn @register_norm_fn(name="layer_norm") class LayerNorm(nn.LayerNorm): """ Applies `Lay...
f3d6ab979480cf4b0f56ea5619879385707ace2331e75f0e758768eb4509234c
Python
3,186
87
from kernels import Kernel from utils import save_model, load_model import logging import numpy as np from sklearn import svm def train_eval(config, args, X_train, Y_train, X_test=None, Y_test=None): seed = str(args['seed']) if not args['split_ready'] else '' model_path = "%s%s_%s.pkl"%(args['model_path']...
d85f7282ffcf74f719db010ff0e06616960358c8539a3d842df80431cb79d30d
Python
3,188
65
import os import tables import numpy as np from config_trans import cfg from model_trans import transxai_model from data_generator import CustomDataGenerator from tensorflow.keras.callbacks import CSVLogger, ModelCheckpoint, TensorBoard def train_model(hdf5_dir, brains_idx_dir, view, batch_size=16, val_batch_size=32,...
2bda118f9a116797ea64192bb43db0c5759213e48fa270fb77ce8b22e375bbde
Python
3,189
99
# 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...
fd29d7ebc4f9a367e4e7c2ec7daa575410a10b7ace0f81f665e560989210f07e
Python
3,189
86
import numpy as np import scipy.stats ''' vocab_pt = 'D:/UB/research/dataset/20newsgroups/CoEmbedding/vocab.txt' embedding_pt = 'D:/UB/research/dataset/20newsgroups/CoEmbedding/results/Embeddings_K50_iter19.npz' #embedding_pt = 'D:/UB/research/dataset/20newsgroups/CoEmbedding/word2vec/svd_gradient.npz' ''' '''...
79b7774969ef04e2661ed799e8ba49bbc5b227414f233808e7ab71bb2a0ba23e
Python
3,190
102
import os import argparse import warnings warnings.simplefilter(action="ignore", category=FutureWarning) import xarray as xr 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.projection_distance...
fbe2fe435661a19176d264feec41ff4ea1175cf464bbfdcbcb5924359b851dd5
Python
3,190
95
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. import lightning from lightning.pytorch.callbacks import Callback from nequip.train import NequIPLightningModule from nequip.utils.global_state import set_global_state from typing import Dict, Optional...
11a05042aff5e0434046b36d7a99c060affeae7dc9b82f46ebf198c860598b8a
Python
3,191
81
from sleepy.processing.processor import Algorithm from sleepy.processing.parameter import Parameter import numpy as np class RandomForest(Algorithm): def __init__(self): self.name = "RandomForest" def calc_fs(self,X): features=np.zeros((X.shape[0],17),dtype='float32') # Feat...
3d2f55e7ab26a2d27e429ca9ea063b04816194a95614a4148af48879a4d151d3
Python
3,191
84
# -*- coding: utf-8 -*- import unittest from unittest.mock import patch, mock_open, Mock, MagicMock import json from copy import deepcopy from io import StringIO from dival.config import CONFIG_FILENAME, get_config, set_config, CONFIG class TestConfig(unittest.TestCase): def test_get_config(self): c = { ...
a5444d9b79ff7af18de4cf9e60e55ec83be7b1d3bc48fb1cc3fe8e582a1f6424
Python
3,191
96
"""Static registry of atlases hosted at `nltools/niftis/atlases`. Each entry describes an atlas's kind (deterministic vs probabilistic) and the citation users should cite when they use it. The actual NIfTI + label files are fetched lazily by `load_atlas` via `fetch_resource`. Atlases were sourced from atlasreader (BS...
e738097062368bf60bd982b759cdacd42567d58fb421e5fb5e17dc48c55b270e
Python
3,196
75
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...
3734fd5e4ddd4881ee9f5eaac3f0060f19e9d0721b012a7820af96593f0c289d
Python
3,197
141
from Purkinje_morpho_1 import Purkinje_Morpho_1 from Purkinje_morpho_1_number import number_ind_1 from neuron import h,gui import numpy as np import multiprocessing import matplotlib.pyplot as plt import random as rnd #per disabilitare tutti i generatori random seed = 123456 rnd.seed(seed) h.use_mcell_ran4(1) h.mcell...
409c948094129e8f53d4a0262c045ea271a71bb574992485e40e02f4e23ede65
Python
3,197
98
"""Plot a Kernel Density Estimation Classification on the sphere.""" import logging import os import matplotlib.pyplot as plt import numpy as np import geomstats.backend as gs import geomstats.visualization as visualization from geomstats.geometry.hypersphere import Hypersphere from geomstats.learning.kernel_density...
bc8121efd9a5e071e397440dc6cfd6abed268e7c0e9bc00ad31470c7b8609feb
Python
3,197
121
from PymoNNto import * import matplotlib.pyplot as plt #https://brian2.readthedocs.io/en/stable/examples/frompapers.Brunel_Hakim_1999.html tau = 20 #20 # ms dt=0.2 class Brunel_Hakim_main(Behavior): def initialize(self, n): self.Vr = 10 # mV self.theta = 20 # mV self.delta = 2 # ms ...
e1cfefd294cd44f10d7a7d229dd21c84c1016592fe05982e9db1640c2c198ab9
Python
3,198
90
# language=rst """ This code is directly pulled from the pytorch version found at: https://github.com/pytorch/pytorch/blob/master/torch/utils/data/_utils/collate.py Modifications exist to have [time, batch, n_0, ... n_k] instead of batch in dimension 0. """ import torch from torch._six import string_classes int_clas...
0fc91c4028865df25aff030e69ce642212c06262b52ff505ee00f0980c25e9fc
Python
3,200
100
# 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...
1e6b5b2940863dc97fc169f95d72e212ceefe7b2ae6444472259a2f73e2941ba
Python
3,200
107
import geomstats.backend as gs from geomstats.test.data import TestData from .base import LevelSetTestData, MatrixVectorSpaceTestData from .euclidean import EuclideanMetricTestData class SymmetricMatricesTestData(MatrixVectorSpaceTestData): pass class SymmetricMatrices1TestData(TestData): def basis_test_da...
36985cc0af8810f672ebb9da26362f16fcfb78fab5f7dfded51c868971a929cc
Python
3,201
96
""" Patch for Tensorboard add_histogram """ import numpy as np import torch from torch.utils.tensorboard import SummaryWriter from torch.utils.tensorboard._convert_np import make_np from tensorboard.compat.proto.summary_pb2 import Summary, HistogramProto def add_histogram( self, tag, values, global_s...
3f9ddf31b0e6c75e2c6e71f055e8f978b18fa70da60bff191a77c9e720842b9f
Python
3,202
90
import unittest import pytest import torch import torch.utils.data as tud from reinvent.models.transformer.core.dataset.dataset import Dataset from reinvent.models.transformer.core.enums.sampling_mode_enum import SamplingModesEnum from reinvent.models.transformer.core.vocabulary import SMILESTokenizer from reinvent.m...
bc84f46d873a7f041516f87ed4781c140ccb5cf3326b776f39508fa2bef472bd
Python
3,207
100
# Add up to 2M records until the log-is-full message is seen. import threading from concurrent.futures import ThreadPoolExecutor, as_completed import pytest from chromadb.api import ClientAPI from chromadb.errors import RateLimitError from chromadb.test.conftest import ( reset, skip_if_not_cluster, ) EXPECT...
1c525114ebc1244d61b8ee90c008c3ace18693266e852675b16dec8344af6828
Python
3,209
103
import asyncio import sys import uuid from pathlib import Path import chromadb import xai_sdk from pypdf import PdfReader from langchain_text_splitters import RecursiveCharacterTextSplitter, SentenceTransformersTokenTextSplitter from tqdm import tqdm from chromadb.utils.embedding_functions.sentence_transformer_embedd...
a987fa98968bdcfe1fbb2db8be894c2cdef5a00e9784bdcd9ca14726a5009dbb
Python
3,209
109
## IMPORT BASIC LIBS FOR SCRIPT import scipy as sc from scipy import io, stats import bstates as bs import sklearn as sk from sklearn import cluster, metrics import pickle import numpy as np import h5py import feather import pandas as pd import os from sys import argv ## TREATING ARGV VARS nPats = int(argv[1]) # NU...
8a9a3422c05722dc89b22d463a55c336e572775ef4962fcf22fbdf68cc596a5b
Python
3,210
99
#evaluation funcitons for multi-class, single-label problems from sklearn.metrics import multilabel_confusion_matrix import torch import matplotlib.pyplot as plt import numpy as np import pandas as pd from scipy import stats import compare_auc_delong_xu as DeLongAUC import os import sklearn def AddImplicitClass(out,th...
b41281e0d0abf15f2e41e5f3d88e4b6d70e448834dbf3e3315ff9fadc19406c1
Python
3,211
108
# ```python # #PymoNNto/Examples_Docs/speed #initialize # src = np.random.rand(5000) < 0.01 # 5k pre synaptic neurons (1% spikes) # dst = np.random.rand(10000) < 0.01 # 10k post synaptic neurons (1% spikes) # ``` #search all markdown files #select code sections #check and extract first code line (path to ...
6e2a24bc9535fc256a3cecdf72613e1a260a57906f3fbf4688e4b00ad0bf1273
Python
3,212
125
# -*- coding: utf-8 -*- """ Functions to facilitate reporting. Created on Feb 5 2025 @author: Mohammad Torabi """ import os import matplotlib.pyplot as plt import seaborn as sns ################################# Parameters #################################### fig_dpi = 120 fig_bbox_inches = "tight" fig_pad = 0.1 s...
4642865261b66979ca85e702e0b4f62c81284d04dc4482baf8bb6b275ae215d5
Python
3,214
67
""" MIT License Copyright (c) 2017 Sadeep Jayasumana , Miguel Monteiro Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, m...
0af2bc4f4ea69ead399518016964e51f86bd362852307c7cbd43a3bc0ed7ac3a
Python
3,216
80
import haiku as hk import jax from jax import numpy as jnp from typing import Optional class Attention(hk.Module): def __init__( self, attention_dim: int, n_heads: int, residual: bool, attention_value_dim: Optional[int] = None, output_dim: Optional[int] = None, ...
f22288900d732bf7f1a3f2b9346e016b5148c37f2f3187eaa1dee7836de45e87
Python
3,218
81
import pandas as pd import numpy as np import pandas as pd from tqdm import tqdm from common.adni.utils import INPUT_COLS, TARGET_COLS, NAME2DX, MRI_BIOMARKERS def standardize_metadata(df, out_filename, dt=6): n_max_fu = 10 targets = ["DXTARGET", "ADAS13", "Ventricles"] # avail_cols = df.columns.tolist()...
f43ce47fa4b5ffd8e56f86fc8e43d6be01116c969504c865aa6d9d72b7f7eca6
Python
3,218
93
# /usr/bin/env python3 # coding: utf-8 # # This software and supporting documentation are distributed by # Institut Federatif de Recherche 49 # CEA/NeuroSpin, Batiment 145, # 91191 Gif-sur-Yvette cedex # France # # This software is governed by the CeCILL license version 2 under # French law and abi...
f0acb03d4b263f52aa3724a8a637b532fd82b21b52c00882f1b907277d42c4ff
Python
3,219
105
import pytest from typing import List, cast, Dict, Any from chromadb.api.types import Documents, Image, Document, Embeddings from chromadb.utils.embedding_functions import ( EmbeddingFunction, register_embedding_function, ) import numpy as np def random_embeddings() -> Embeddings: return cast( Emb...
8471c7f17d1e0768aea33e4ec4a3a3a7c2bb877e4581d5a9fd22adaee041e7b2
Python
3,222
75
from PymoNNto.Exploration.Network_UI.TabBase import * class character_activation_tab(TabBase): def __init__(self, title='char'): super().__init__(title) self.title = title def add_recorder_variables(self, neuron_group, Network_UI): return def initialize(self, Network_UI): ...
55c9980e1dae77ff5d6699491b8582a24ef94c190c3d5beb5109e09470c364d7
Python
3,225
85
from typing import Tuple import torch from torch import Tensor import torch_geometric.transforms as T from torch_geometric.data import Data, Batch from torch_geometric.datasets import GNNBenchmarkDataset, Yelp, Flickr, Reddit2 from ogb.nodeproppred import PygNodePropPredDataset def index2mask(idx: Tensor, size: int)...
d982ec71390a6b03ade3c04b998c39969f496c489f97bcabf89ecf9b79eedcac
Python
3,227
90
import torch import torchfields import numpy as np import argparse import h5py from pathlib import Path from concurrent.futures import ProcessPoolExecutor, Executor if __name__ == "__main__": parser = argparse.ArgumentParser(description="Upsample H5 Field") parser.add_argument( "--src_path", type=str,...
d320debd19dc17034a9ff2212455141d5e4355e09f2dd5348aa424416b6eb22c
Python
3,228
78
import numpy def get_sided_masked_array(d, side=None, axis=None, mask_stat="median"): """mask array to include values greater than ("right") or less than ("left") a statistic of the set Parameters ---------- d : :class:`numpy.ndarray` input data array side : str or None "l", "r", ...
6d996bd87c36558ff24393056458c87189dcdcc1cdaa08c379e163e11c13c211
Python
3,229
92
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """FedProx Keras optimizer module.""" import tensorflow as tf import tensorflow.keras as keras @keras.utils.register_keras_serializable() class FedProxOptimizer(keras.optimizers.Optimizer): """FedProx optimizer (Keras3 based API). ...
805550d044b161224aadf516532a37e8b70abcd9dfa1c91e14beb5485f02e648
Python
3,229
93
"""Regenerate the committed goldens. Goldens are edit-locked. Every artifact under ``tests/golden/`` -- the fixtures, the anchor checkpoints, the reference JSONs -- is only rewritten by this script, and only in a change that does nothing else and explains the physics of what moved. That is why it refuses to run withou...
8a61c4200d6ee7c85d562a2b28973cb88ca2901778388cbbbad4f6e7fdc63146
Python
3,230
104
from collections import defaultdict from pathlib import Path import cv2 import numpy as np import paddle.vision.transforms as T from openvino.inference_engine import IECore from ppdet.modeling.mot.tracker import JDETracker from ppdet.modeling.mot.visualization import plot_tracking_dict root_path = Path(__file__).pare...
5d268c155b2bf0623c3ab2633d381f17e0f652721cfb9683d2edbbb82c386ada
Python
3,231
146
import collections import random import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import predictive_coding as pc import analysis_utils as au def plot_mean(df): df = au.nature_pre(df) g = au.nature_relplot( data=df, x='pc_learning_rate', y='Mean ...
89c22c607a6fd4574b93e9bbcbd592d6e953a294aeee92780bb7ccbaffc9f258
Python
3,231
83
""" Calculate the period between two consecutive waves for each wave and channel. """ import argparse import numpy as np import pandas as pd import matplotlib.pyplot as plt from utils.io_utils import load_neo, save_plot from utils.parse import none_or_str from utils.neo_utils import analogsignal_to_imagesequence CLI ...
500e92efad6bb8037e90b3c814a8f3727df8bf5f82b571b955e26b9509affa4e
Python
3,232
112
"""Command line setup FIXME: replace with dataclass and automatic conversion to argparse? """ from __future__ import annotations __all__ = ["parse_command_line"] import argparse import os from pathlib import Path import logging import torch from reinvent import version from reinvent.utils import config_parse from ...
d0a6d1e9bae3aab90941dd6a8ffb64a70514c3acf6c684b433f527baffd03ef9
Python
3,234
93
import logging import os from time import time import datetime import numpy as np import pandas as pd from sklearn.linear_model import LinearRegression import h5py from PIL import Image from model_tools.utils import fullname, s3 def properties_to_id(architecture, task, kind, source): identifier = f'architecture:{...
d6b691a476a6e0d735c7483c17cfef0418eeec392927898206b794e974cda5a0
Python
3,235
106
# 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 nequip.data import AtomicDataDict from typing import Dict, List, Callable, Union # === Inputs and Outputs for AOT Compile === # standard sets of input and output fields for specific i...
fab79f9053fc456ec24f86537d537f1803b77e515f34ea1c056b0981b7c58ee6
Python
3,235
84
""" Calculate the period between two consecutive waves for each wave and channel. """ import argparse from pathlib import Path import numpy as np import pandas as pd import matplotlib.pyplot as plt from utils.io_utils import load_neo, save_plot from utils.parse import none_or_path, none_or_str from utils.neo_utils imp...
849d99730e4a0db6e33a6e5385bf3675d6f1e624e44a61cc700b404c867c2ebd
Python
3,238
89
# from main import base_model, get_last_weights from tensorflow.keras.models import model_from_json, load_model from tensorflow.keras.preprocessing.image import load_img, img_to_array import numpy as np, glob, cv2.cv2 as cv2, matplotlib.pyplot as plt, copy from skimage.segmentation import mark_boundaries from visualiza...
8819d6a52ed263152a09c4fdac0934892ab8ac8154f16b36b1daa080bc2ae1b6
Python
3,238
99
# 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...
759b3907946f89387e9384b9bc34ed7c7ff7c2d8834b76720e89a9b7b7988e1f
Python
3,239
94
from PymoNNto import * import time from globparams import * import scipy as sp settings = {'dtype': float32, 'synapse_mode': SxD} class LeakyIntegrateAndFire(Behavior): def initialize(self, neurons): neurons.spikes = neurons.vector('bool') neurons.spikesOld = neurons.vector('bool') ...
79d1f4553258d9c1fefd80db2ff526f02f38f421000837a5f0e0c55ef8d2a5d4
Python
3,240
88
import torch from torch import nn as tnn from torch.nn.utils import rnn as tnnur from reinvent.models.model_parameter_enum import ModelParametersEnum class Encoder(tnn.Module): """ Simple bidirectional RNN encoder implementation. """ def __init__(self, num_layers: int, num_dimensions: int, vocabular...
8259c4f4c1ccd98493b8848461018f9204585ae62d9c206569e0f6f1c9990d22
Python
3,242
90
"""`--log_level`, which decides what a run says and not what it records. `setup_logger` puts the root logger at DEBUG and then attaches three handlers: the console and `<tag>.log` at the requested level, and `<tag>_debug.log` at DEBUG unconditionally. So the flag quiets two of the three destinations, and the one it do...
fd8875f3d1e885d017c1bf7813f50f882db57cd3ad4ffe1f344bdb4d8d29051d
Python
3,242
111
from pickle import FALSE from datagenerator_pd import DataGenerator from sklearn.metrics import confusion_matrix, accuracy_score from tensorflow.keras.utils import to_categorical import matplotlib.pyplot as plt import seaborn as sns import SimpleITK as sitk import pandas as pd import numpy as np import random ...
b149c777d4b23b72c127e2781752678c9a30ed3ca3f0df2379f185a2dd513796
Python
3,245
109
from contextlib import contextmanager from functools import wraps from typing import Callable, Tuple try: import torch._dynamo as dynamo except ImportError: dynamo = None from e3nn import get_optimization_defaults, set_optimization_defaults from torch import autograd, nn from torch.fx import symbolic_trace Mo...
6303ec959f15e7487ab2ad9d109616b9967471f8a299a582bb129d1760538366
Python
3,246
83
""" Calculate the period between two consecutive waves for each wave and channel. """ import argparse import numpy as np import pandas as pd import matplotlib.pyplot as plt from utils.io_utils import load_neo, save_plot from utils.parse import none_or_str from utils.neo_utils import analogsignal_to_imagesequence CLI ...
4e04197d0ad37e73dea63276dc208670f71f8133cfe6d3303c8864ae03aa64b9
Python
3,250
87
""" Train FBPUNetReconstructor on ``'ellipses'``. """ from odl.operator import OperatorComp from torch.multiprocessing import set_start_method, get_start_method import torch import odl import numpy as np from dival import get_standard_dataset from dival.measure import PSNR from dival.reconstructors.fbpunet_reconstructo...
fedb39a4159945055449203d9d9be0ddfc343f704b50a6c15894221a441b78d8
Python
3,251
116
from pymonntorch import Network, SynapseGroup, NeuronGroup, Behavior, EventRecorder import torch import time from globparams import * import matplotlib.pyplot as plt settings = {"dtype": torch.float32, "synapse_mode": "SxD", "device": "cuda"} class TimeResolution(Behavior): def initialize(self, n): n.dt ...
173b5044f4bebb7cd6fa0ffe37d4ca8ff3191fe59f68010c93a2b78add746e04
Python
3,252
73
import torch from torch_geometric.data import Data from .loading_utils import train_scaler, scale_dataset_aux TARGET_ID_TO_PROPERTY = { 0: 'First excitation energy (ZINDO)', 1: 'Electron affinity (ZINDO/s)', 2: 'Excitation energy at maximal absorption (ZINDO)', 3: 'Atomization energy (DFT/PBE0)', ...
40a4c4eb056ee62721adb9be18cdad2768413aba649b9d55fa4e00756f6e69aa
Python
3,253
96
import geomstats.backend as gs from geomstats.test.data import TestData from .base import VectorSpaceOpenSetTestData from .riemannian_metric import RiemannianMetricTestData class PoincareHalfSpaceTestData(VectorSpaceOpenSetTestData): pass class PoincareHalfSpace2TestData(TestData): def belongs_test_data(se...
384c74319ba7a40c71f91a3a66f21128faa018e8a36c74195968d9ebbb2dff10
Python
3,257
98
#!/usr/bin/env python3 from pathlib import Path import numpy as np import matplotlib.pyplot as plt import torch from mlspm.datasets import download_dataset from mlspm.models import ASDAFMNet from mlspm.visualization import make_input_plots, make_prediction_plots def plot_experiment_AFM(list_of_exp): cols = 10 ...
96eec90069d39a9c637c45f633103a904ef92ab8bb9cdae8ae224a9394f971fe
Python
3,257
104
"""RDKit 2D Pharmacophore Fingerprints""" from __future__ import annotations __all__ = ["Pharm2DFP"] import os from dataclasses import dataclass from typing import List import logging from rdkit import Chem, DataStructs from rdkit.Chem import ChemicalFeatures from rdkit.Chem.Pharm2D import Generate, Gobbi_Pharm2D f...
537b5aba31e4053feec7f49b777ac2c01d410e2973aca401b0dfb8aead4208d6
Python
3,259
133
"""Optimizers implementations.""" import logging from abc import ABC, abstractmethod from scipy.optimize import OptimizeResult import geomstats.backend as gs class Minimizer(ABC): """Minimizer. Parameters ---------- save_result : bool Whether to save result. """ def __init__(self,...
22f14fab84e42d52f065c5bb656b08fe63d44509bed908fbb7626e60ee063d25
Python
3,260
106
# -*- coding: utf-8 -*- """ Configuration of the library. The module variable :obj:`CONFIG` holds the current configuration. The library configuration is stored in the file ``~/.dival/config.json``. If the config file does not exist when the library is imported, it is created using default values. Changes made in ``c...
88220d48c9f6b59d80c98474960ec5dfc1eb96d229e352fb67cf6c201e45a12b
Python
3,263
106
import lmdb import torch import pickle import pytest import numpy as np from nequip.data.dataset import NequIPLMDBDataset def make_atomic_data(i: int) -> dict: # Minimal AtomicDataDict with only 'pos' field return {"pos": torch.tensor([[float(i), float(i), float(i)]], dtype=torch.float)} def test_save_load_...
b4a2306b1f9fb428413edc758bee5cdd722e999bf2e58c05bd1c2b08245e5eba
Python
3,263
116
from pymonntorch import Network, SynapseGroup, NeuronGroup, Behavior, EventRecorder import torch import time from globparams import * import matplotlib.pyplot as plt settings = {"dtype": torch.float32, "synapse_mode": "SxD", "device": "cpu"} class TimeResolution(Behavior): def initialize(self, n): n.dt =...
a089e2752dcb5bb9997f59f152c2d0b8ad158fa7c6cf6ff852b5cfe8b0356093
Python
3,264
86
import sys, os from sklearn.externals import joblib import numpy as np import random from sklearn.ensemble import ExtraTreesClassifier from time import time from operator import itemgetter from sklearn.model_selection import GridSearchCV trainingSetFileName, classifierPickleFileName = sys.argv[1:3] statsToUse = sys.ar...
636ad1c9a05dba2d1e02fbd0b93c3852c3a96d8e952454f279f3b3a6b15ac334
Python
3,271
89
from PymoNNto.Exploration.Network_UI.TabBase import * #from Testing.Common.Classifier_Helper import * class sidebar_music_module(TabBase): def add_recorder_variables(self, neuron_group, Network_UI): if hasattr(neuron_group, 'pattern_index'): Network_UI.add_recording_variable(neuron_group, 'n....
93660910a4ac866160db18b983335a6563c936468c3f35c560fdcec298267448
Python
3,272
114
#!/usr/bin/env python3 """Run a deterministic shard of a pytest selection.""" from __future__ import annotations import argparse import os import subprocess import sys import tempfile from typing import Sequence def parse_args() -> argparse.Namespace: parser = argparse.ArgumentParser(description=__doc__) pa...
fbee37896b605ed7a4564c4331c49617604577855ce3f3cbff7ba39ba36f93aa
Python
3,272
97
from pathlib import Path import mne from .. import io from ... import logger def resample(inst, sfreq, **kwargs): """ Resample the inst. Resample goal is to speed up computation. As it add a jitter to the trigger/events, it is recommanded to first create the epochs and then downsample the epochs...
c7135bfc253c32a3969e30b7ef67ff991ff77a544c89e548c6a80feb5e5c88f5
Python
3,273
84
""" Calculate the period between two consecutive waves for each wave and channel. """ import argparse from pathlib import Path import numpy as np import pandas as pd import matplotlib.pyplot as plt from utils.io_utils import load_neo, save_plot from utils.parse import none_or_path, none_or_str from utils.neo_utils imp...
c42264ed7865792f9926e6b488f6e5255988d3c802bd0d892a86bf2820faf5dc
Python
3,275
161
# Copyright 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Module consists of custom exceptions for end to end testing""" class PersistentStoreCreationException(Exception): """Exception for persistent store creation""" pass class DockerException(Exception): """Exception for docker"...
5d65076bc7365da6501250068681890c98ab72fc0161ad9c38b2d01a8aeb2457
Python
3,278
101
import numpy as np import pandas as pd import pyfizi class AnnotSeries(pd.Series): @property def _constructor(self): return pyfizi.AnnotSeries @property def _constructor_expanddim(self): return pyfizi.Annot class Annot(pd.DataFrame): """ Thin wrapper for a pandas DataFrame ...
04d7a44f5bcbc6c092a2cd5b5884b29ba1b431e7b7e8328d73defc751f240a30
Python
3,280
52
# -*- coding: utf-8 -*- import functions.rate_coding import numpy as np import functions.manifold import functions.Graphs import matplotlib.pyplot as plt import functions.statistics_test as st #%% Load data data = np.load('/datapath/dataset.npy', allow_pickle=True).item() #%% Manifold of all mice res, ...
b2344c92278931ef264d482753f7f9e834aae4945669983a23b2818ea6e9c67c
Python
3,281
76
from collections.abc import Sequence from qtpy.QtCore import Qt, Signal # type: ignore[reportPrivateImportUsage] from qtpy.QtWidgets import QCheckBox, QHBoxLayout, QLabel, QMessageBox, QWidget from idtrackerai.GUI_tools import InvertibleSlider, LabelRangeSlider class AreaThresholds(QWidget): valueChanged = Sig...
32f3c681519d8fd366def5d7188c9e661a3f176c6b5800c399533e395e5e87aa
Python
3,282
112
import argparse import os import pickle import random import numpy as np from src.ECGXMLReader import ECGXMLReader def parse_args(): parser = argparse.ArgumentParser("Building cross-validation folds") parser.add_argument( "--c_avrt_path", type=str, required=True, help="path f...
2668e43bab54d3daeb9265ab1f359c440ab77b067336d428389a465ed6f11f90
Python
3,283
128
#!/usr/bin/env python3 # # Sniffles2 # A fast structural variant caller for long-read sequencing data # # Created: 27.08.2021 # Author: Moritz Smolka # Contact: moritz.g.smolka@gmail.com # import statistics import math import sys import time class Sniffles2Exit(Exception): pass def stdev(nums): nums=list(nu...
dd6d6bce8f3970c58e9f275bff03772b21ac0c8a8fadce8d8ded11b96932e760
Python
3,285
92
import pytest from reinvent.chemistry.amino_acids.amino_acids import ( construct_amino_acids_fragments, add_O_to_endof_fragment_amino_acids, remove_cyclization, ) @pytest.mark.parametrize( "sequences, expected_output", [ ( [ "N[C@@H](C)C(=O)|N[C@@H](CC(=O)O)C(=O...
02992fff694e0c5c90bd1d915cebf77682489b3eb2211ae023c0fb1024992bf3
Python
3,288
92
"""The proprietary-data guard. TCRvdb must never reach the repository or a release.""" from __future__ import annotations import os from pathlib import Path import pytest from vdjdb.validate import scan_paths, tcrvdb_path from vdjdb.validate.guard import ENV_VAR def test_clean_tree_has_no_leaks(tmp_path): (tmp...
9dee7b4767ebd4f885a8751abb4e4fdd8a0fac55a3209e1026c31fb5a38c94d3
Python
3,292
95
# Copyright 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ This file contains utility functions for Secure Aggregation Shamir's secret sharing related operations. """ from Crypto.Protocol.SecretSharing import Shamir # nosec B413 # The length of each chunk of secret used for creation of share...
22efec0b67d8e7ba1accd76289d1575024c6f9cced1168970ac2436e0bfe17d3
Python
3,298
111
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Dec 12 15:25:17 2018 @author: ngritti """ from csbdeep.data import RawData, create_patches from csbdeep.utils import axes_dict from csbdeep.models import CARE, Config from csbdeep.io import load_training_data import time, os, glob import numpy as np #...
3111ad1a9faca2794cef5d692b79cdd41b304e63e9cb1471939cc864d9a026fe
Python
3,298
115
from errors import MutationError import pandas from rdkit import Chem from rdkit.Chem.EnumerateStereoisomers import EnumerateStereoisomers, StereoEnumerationOptions def _perform_mutation(mutations, seq): """ Main logic for performing mutations. """ for mutation in mutations: # print('->' +...
e1c9cfe7ea538847098252776b07254da4e1780d8b78bbe6abc6797c9ad20b30
Python
3,298
101
import csv import os import pytest from reinvent.runmodes.enumeration.run_enumeration import run_enumeration, PeptideEnumeration from reinvent.runmodes.enumeration.validation import AAEnumerationConfig TEST_DIR = os.path.dirname(os.path.abspath(__file__)) MOCK_LIBRARY_FILE = os.path.join(TEST_DIR, "mock_aa_library.csv...