sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
09394e54ecb3646795979086dc1e7c69c8becd316936791901954379fe1811a9
Python
2,271
67
import numpy as np from scipy import linalg def getUi(P, data, d, r, dr_type): # get Pi = UiUi' for each pi # each column of P is a point in X1, the epsilon-net(cf18) # data is the entire dataset # # xiayq @ 04/21/2022 # modify the comments # remove 'cf1', replace 'cf2...
963c42e611f38d0b12e4957cca634a87639ce86fbc55a940525b4fd25bac1dfc
Python
2,271
58
from __future__ import division import unittest import numpy as np from wyrm.types import Data from wyrm.processing import append_cnt from wyrm.processing import swapaxes class TestAppendCnt(unittest.TestCase): def setUp(self): ones = np.ones((10, 5)) # cnt with 1, 2, 3 cnt = np.append...
9ad6a95c90674a7a2af390d70f5656770c578942350912178659ccf6d4105c4a
Python
2,272
56
import unittest from CEST.src.matlab_style_functions import * class TestInterpolateFunctions(unittest.TestCase): def test_matlab_style_gauss2D(self): # Test with default sigma value kernel = matlab_style_gauss2D((5, 5)) expected_kernel = np.array( [ [0.00296902,...
ce3049200be7012b2988ec8801d4116cbc426a0fde6c63cc59d7092609d8e07a
Python
2,272
77
""" Task definitions for invoke command line utility for python bindings overview article. """ import invoke import pathlib import sys import os import shutil import re import glob def print_banner(msg): print("==================================================") print("= {} ".format(msg)) @invoke.task...
e3e0b06477fe05d60210aabf29361e81b9e336e533ec752767f9b59ac81a3e10
Python
2,272
73
import os import joblib import yaml from sklearn.feature_selection import SelectKBest from sklearn.pipeline import Pipeline from pmsurv.models.gaussian_process import GaussianProcessModel from skopt.space import Real, Categorical, Integer import utils import arviz as az def preprocess_data(dataset, config): X = d...
eb9e37af02f507c5c1c8a4a15d37ef3a36de3689086c428ae6406287c2d2a02f
Python
2,272
76
import glob import re import sys cdhitcluster = sys.argv[1] cluster_seqs_stats_path = "RESULTS/*.cluster.all" cluster_seqs_stats_files = glob.glob(cluster_seqs_stats_path) repSeqRedSeqdict = {} repLine = "" count = 0 first = False add_FullId = "" k = 0 with open(cdhitcluster, "r+") as f: content = f.read() ...
04bd03cfc3064ecebe77866fe72fefcec66569e506c34c7feeabb92b42b9db84
Python
2,273
52
# -*- coding: utf-8 -*- """ """ import os os.chdir('/Users/wang/Desktop/Research_projects/BBSC/Functional/Pre_processing/sub-1/ses_groupICA/ICA_15') path = os.getcwd() from nilearn import datasets, image, surface, plotting fsaverage = datasets.fetch_surf_fsaverage() ICA2plot = image.load_img('melodic_...
6e82c3caae031cc46966cf2cfa4d908f9be868893dfa63581f5d819d3d78b040
Python
2,274
55
""" Onmt NMT Model base class definition """ import torch import torch.nn as nn class NMTModel(nn.Module): """ Core trainable object in OpenNMT. Implements a trainable interface for a simple, generic encoder + decoder model. Args: encoder (onmt.encoders.EncoderBase): an encoder object deco...
a2589194a3521716855bacd7423e47cb8fe2f16a4f2c523a7b68181a8c7e7038
Python
2,274
71
import math from typing import Sequence, Union from pytorch_lightning import Callback, LightningModule, Trainer from torch import Tensor from torch.nn import Module class BYOLMAWeightUpdate(Callback): """Weight update rule from BYOL. Your model should have: - ``self.online_network`` - ``sel...
bb4671d5f72362431edfcfd784999407b87f7a64c723c2b3f449d25800e5ffa6
Python
2,274
93
from anndata import AnnData from typing import Optional, Union from .weight_optimization import weight_optimizing_global, weight_optimizing_local from .global_level import global_level from .local_level import local_level def pseudotimespace_global( adata: AnnData, use_label: str = "louvain", use_rep: str...
1c06370d113cae86dc06d16c4d82a3c62cad447f20e5c6048b5d2f9d69db173c
Python
2,275
59
from ptic import pmi_tfidf_classifier as ptah import numpy as np import pandas as pd from sklearn import metrics import torch from ptic import neuro_ptic np.random.seed(42) path = "doc/datasets/" # Data is taken from here # https://raw.githubusercontent.com/susanli2016/NLP-with-Python/master/data/title_conference.csv...
1d6b6a62ad7e72435838e83ffcf905697aa7a8d59b3937e864de563c884c329d
Python
2,275
74
# 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...
8e272e60129f528e409b066a04fa12db2c7edb27fc653c32901edecdace685cb
Python
2,275
63
"""3. Getting Started with Pre-trained Models on ImageNet =========================================================== `ImageNet <http://www.image-net.org/>`__ is a large labeled dataset of real-world images. It is one of the most widely used dataset in latest computer vision research. |imagenet| In this tutorial, we...
2c40e8e830a17a66e6df143ebe37aaa998b4ba05b1ee98ae711f7f2dd0de72b2
Python
2,276
61
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Tests for embeddings metrics.""" import unittest import numpy as np from sknetwork.data import house, star_wars from sknetwork.linalg.sparse_lowrank import SparseLR class TestSparseLowRank(unittest.TestCase): def setUp(self): """Simple regularized adja...
8209e5fb75521c7d7c95b5e2129c5d02de15d59b049d63f49cb7a2407a63b389
Python
2,276
82
from ...core.flowdataframe import FlowDataFrame from ...utils import constants, gislib import geopandas as gpd from ...models import Radiation import numpy as np import shapely import pytest distfunc = gislib.getDistance atol = 1e-12 # fix a random seed np.random.seed(2) def all_equal(a, b): return np.allclose...
e566a2565d07a09b748896139161b9a2e0af783f9ce1dc119020bfc16c3150a0
Python
2,276
70
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import torch import numpy as np import torch_geometric.datasets import pyximport from role_prediction.role_prediction_dataset import RolePredictionDataset pyximport.install(setup_args={'include_dirs': np.get_include()}) from role_prediction.gra...
8cad3a213ff26eac55e2be9b0e155cbd5abcc82d82e6fb898031a74b48ef792f
Python
2,277
75
import numpy as np from permacache import permacache from modular_splicing.legacy.hash_model import hash_model def calibrate_sparsities(binarized_to_calibrate_to, non_binarized): """ Returns a version of non_binarized with the same sparsity as binarized_to_calibrate_to, by magnitude. """ _, t...
d8ee0e8b3fb37722b2dfa7c1309fb7ff7a3640fe880bdb79fc0389d0e209bf3f
Python
2,277
58
from typing import ( TYPE_CHECKING, Union, ) from galaxy import exceptions from .adapters import PromoteCollectionElementToCollectionAdapter if TYPE_CHECKING: from galaxy.model import ( DatasetCollection, DatasetCollectionElement, HistoryDatasetCollectionAssociation, ) SplitR...
d94efbd16f0b0874322af2919b639eac933bd70e9236856cdc5fc8d43899548c
Python
2,277
66
"""Tests of utils for `pynapple` package.""" import numpy as np import pandas as pd import pytest import pynapple as nap def test_get_backend(): assert nap.core.utils.get_backend() in ["numba", "jax"] def test_is_array_like(): assert nap.core.utils.is_array_like(np.ones(3)) assert nap.core.utils.is_ar...
40496b4597b29e0903bd26f41dec2d0a6cc0d2050a4bb6bb6c3b8f5bdc3b44cf
Python
2,278
79
#define library !pip install tensorflow-addons==0.16.1 import tensorflow_addons as tfa import random import os import numpy as np import cv2 import glob from sklearn.metrics import accuracy_score, precision_score, recall_score, confusion_matrix,f1_score from keras.utils import np_utils from keras.datasets import ...
806740ab58a94d39003581633e4803f8b815148a37db3632a01908c721a7992c
Python
2,278
69
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
0733147a42c789710e08af81fd0527a2dbe7995412d5d6df95338d89c6464f55
Python
2,280
82
import numpy as np import torch def run_batched(m, x, bs, pbar=lambda x: x): """ Run m on x in batches of size bs, and concatenate the results. If x is a dict, treat it as a dict of arrays, each of which is batched together. This requires that the length of each array is the same. If m retur...
09092bce4f57df6bddb0bfb52da4b86f679280cb45fe035cd4949b390afae280
Python
2,280
71
import json class ConceptTokenizer(): def __init__( self, concept_set, bos_token = "[BOS]", eos_token = "[EOS]", sep_token = "[SEP]", pad_token = "[PAD]", unk_token = "[UNK]", ): self.concept_list = [bos_token, eos_token, sep_token, pad_token, un...
49f22279f021a700b32a1974d5b3e53ec5e86185cbe84257e1580fe4d7972cec
Python
2,280
66
import argparse import json import matplotlib.pyplot as plt import numpy as np import scipy.stats as st from dexterity.design.common import QUALITATIVE_COLOR_PALETTE from utilities.plotting import plot_with_confidence parser = argparse.ArgumentParser() parser.add_argument("exp", nargs="*", type=str, default=["defaul...
8871dc1c6a005432003bf404651add12180921f9af4763109f64fecb99c5eaf9
Python
2,280
77
""" df_loader.py Modules to import xlsx files from a directory. """ import glob import os import pandas as pd ################################################################################################### ################################################################################################### def ...
d35572eae1a157b8950085162b0c6bd7a723accda53eafa2276180fc567969ff
Python
2,281
50
# LICENSE # # _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._ # # BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License"); # # - you may not use this software except in compl...
e63c80c287414224e13f67484662468b78cea09fcbc6299027078394e5de0ec8
Python
2,281
48
""" This pipeline reads the data files, computes ER and alpha amplitude envelope for target and standard stimuli. """ import os import numpy as np from scipy.stats import pearsonr from tools_general import load_json, save_pickle, list_from_many from tools_signal import compute_envelope, from_epoch_to_cont, filter_in_lo...
f30f66a7d34896aeb67927748a5e7806ca47cbaf05df085bc70843a993f934db
Python
2,281
66
import larvaworld.lib.reg as reg import larvaworld.lib.sim as sim import larvaworld.lib.model.modules as mods from larvaworld.lib.model import BrainModuleDB from larvaworld.lib.model.modules.remote_brian_interface import ( RemoteBrianModelInterface, ) from sensors import LocalOlfactor, CustomBehaviorModule # over...
fb058aeeebac33ed50cdc3622b7fdc7490fb1ef7861ab6d0c6cf4b4fe7c7a7a6
Python
2,281
63
# coding: utf-8 #flip catching/correcting script that detects strand flips and corrects them back in RFmix output #this version fixes the RFmix output, .msp file with LAI calls for 2-way admixed individuals and outputs a file documenting the switch locations for the RFmix LAI call windows and whether that window was ...
40e686aaa37d12004395a5acf2b4c88c63a92bfa6235ac27d53348354532332f
Python
2,284
68
""" Implementation of "Convolutional Sequence to Sequence Learning" """ import torch import torch.nn as nn import torch.nn.init as init import bioseq2seq.modules from torch import linalg as LA SCALE_WEIGHT = 0.5 ** 0.5 def shape_transform(x): """ Tranform the size of the tensors to fit for conv input. """ ret...
47ea6241eea05185d3502cd8aac961962a3f63b347df7ec5e3d57dce4fefe45b
Python
2,284
74
# This example requires the following dependencies to be installed: # pip install lightly # Note: The model and training settings do not follow the reference settings # from the paper. The settings are chosen such that the example can easily be # run on a small dataset with a single GPU. import pytorch_lightning as p...
c0aec0f2838d0c8db35987f306556b5197c9449345056384950a8302d79bbde9
Python
2,284
49
# Calculate True label per frame and predicted label. At the very end, this is simply a multiclass classification problem, which can be solved with sklearn. # We want a score both per take, and for entire dataset. import json from pathlib import Path import numpy as np from sklearn.metrics import classification_report ...
478104baff9934d0f406c54927f00f448355532ff3281a3df0527620caf140e8
Python
2,285
80
from brian2 import ( NeuronGroup, SpikeMonitor, StateMonitor, PopulationRateMonitor, TimedArray, run, ) from brian2.units import * def osn_params(custom_params: dict = {}): """ factory method for model parameters :param custom_params: :return: """ params = { "C_...
d543eaf3af877d9328a3023374cad0a78611edf5bb5177bde67177980c8a5323
Python
2,285
89
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ #resolution of the data 2 #TR=2 import os import numpy as np from nilearn import datasets #read in text files with session os.chdir('/home/restate/Documents/BBSC/Functional/Pre_processing/sub-2/') path='/home/restate/...
ebb03ecef0ba74b0e7897deee3300c1602fd23f0ebd41d63474e4a1db22d89b7
Python
2,285
68
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> """ .. _exa-trf_intro: .. currentmodule:: eelbrain Introduction to Temporal Response Functions (TRFs) ================================================== A temporal response functions (TRFs) is a linear model of the stimulus-response depency. The response is pre...
f5ffb58cb9e46f7e89a90fbeae79e5540bdd31f19059490187dae6756bd19286
Python
2,285
82
# Copyright 2024 The Google Research Authors # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
c962dac38c29df8139cf32d9ae8ecdbb83c321380be4b0c77ed87031d1cefb8f
Python
2,286
49
import os import shutil import numpy as np from mako.template import Template from mako.lookup import TemplateLookup def make_simple_index(path, path_list): lookup = TemplateLookup(directories=['templates/', '.']) t = Template(filename=os.path.join('templates', 'simple.html'), lookup=lookup)...
dcd575c58b4a8457c05c46432ab85e861f763712bf0e16e70f6d6e241f1a112c
Python
2,286
60
from pyrosm.data_manager import get_osm_data from pyrosm.frames import prepare_geodataframe import warnings def get_user_defined_data(nodes, node_coordinates, way_records, relations, tags_as_columns, ...
61129938f704259be7e6a833b48004fa9d67ec43dd9b4c592786a6d5955b0f33
Python
2,287
68
def findNodePositions(section,numNewNodes,nodeSpacing): from neuron import h import math section_list = [None]*int(numNewNodes+1) sec = h.Section() parent_section_ref = h.SectionRef(sec = section) section_children = parent_section_ref.child sec.connect(parent_section_ref.parent(1)) h.disconnect(sec = section...
2ab236eae193dfc10f0a7586bc3aa9c358f7a1424c420fe889cd7c9de48cd3ea
Python
2,291
56
from typing import Dict from gensim.models import Word2Vec import numpy as np from tqdm import tqdm class Char2VecFeature(): def __init__(self, **kwargs): self.embedding_size = kwargs["embedding_size"] self.window = kwargs["window"] self.min_count = kwargs["min_count"] self.worke...
6f45f04c21ea6a8043a0642bc9bfebdddbcba90cf423f01e118d3ff9603393af
Python
2,293
69
""" Generate SV-supporting reads BAM file. @author: asmaa, cytham # Test wk_dir = '.' vcf_file = 'sample.nanovar.pass.vcf' sv_supp_tsv_file = 'sv_support_reads.tsv' in_bam_path = 'input.bam' input_type = 'bam' ref_path = 'ref.fa' vcf = os.path.join(wk_dir, vcf_file) sv_supp_tsv = os.path.join(wk_dir, sv_supp_tsv_fil...
297ac2775951e897cbf961b38f5488f646bb36a239a72b6ce2bd11fdf665675c
Python
2,294
56
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license """Depth estimation predictor for YOLO models.""" from __future__ import annotations from typing import Any import numpy as np import torch import torch.nn.functional as F from ultralytics.engine.predictor import BasePredictor from ultralytics.engi...
ada1927131c16cc4a715e335ee931cbe389c9c162e2ee3386e5cf935776a102b
Python
2,294
58
#!/usr/bin/env python # # Copyright 2019, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
ade937d3cb815a6809f0c428de58beece33a10d945025cc8ed947147cc50899b
Python
2,294
77
#!/usr/bin/env python """ Input: User-defined set of filters and the database authentifications. Output: set of compounds that pass all the selected filters. """ import argparse import json import sys import cheminfolib import psycopg2.extras cheminfolib.pybel_stop_logging() def parse_command_line(argv): parse...
bc8ab1db020781dcf4061151c06a9920f568897949f7cea33ace492b755d531f
Python
2,294
60
"""Basic class for TreeGrower Algorithms""" import logging import numpy as np from tns.generate.algorithms.abstractgrower import AbstractAlgo from tns.generate.algorithms.common import bif_methods from tns.generate.algorithms.common import section_data logger = logging.getLogger(__name__) class TrunkAlgo(AbstractAl...
fab749d61debdec4844edee016a58ef0cb04526f239700b1ef4de1c652292ab5
Python
2,295
78
# This example requires the following dependencies to be installed: # pip install lightly # Note: The model and training settings do not follow the reference settings # from the paper. The settings are chosen such that the example can easily be # run on a small dataset with a single GPU. import torch import torchvisi...
d7e83dfcfb8e78f5cf25ea7868bca0d23681927259b765961c2f23789fedbb88
Python
2,296
70
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: bream/hardware_check_result.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection...
ccb3f7174c79c3f871d84ca8998e38b27ac8bdbab37863a0ed77ca96718fe720
Python
2,297
83
""" Auto-generated download script for Thingi10K dataset. Assuming the following python packages and external commands are available. * argparse: for parse command line args. * requests: for http communication. * wget: for downloading files. Usage: python Thingi10K_download.py or python Thingi10K_download...
665cfd10af7f29bbc539f9af7e75e509891fe724fda83968dd928547ef990731
Python
2,299
68
import numpy as np """This implementation is courtesy of Aaron Kaplan, Lawrence Berkeley Lab.""" def cart_to_sph_d(): """ From Table I of H. Bernhard Schlegel and M.J. Frisch, Int. J. Quantum Chem. 54, 83-87 (1995), doi: 10.1002/qua.560540202 Expected order is d_20 0 ...
337c3a128eaade994e30ee1aeb1fd7660cce6e64ea9c7f4140a7715addfa8376
Python
2,300
54
import torch from models.basic import DeepLearningModel from strategies.basic import MultiSiteLearningStrategy class SI(MultiSiteLearningStrategy): name = 'si' def __init__(self, model: DeepLearningModel, config: dict, c=0.5, xi=1.0, **kwargs): super().__init__(model, config, **kwargs) self...
34f5a398b2c41a9ccf3c24272344e101b784d612cb6b77fa4548aa7f20227683
Python
2,300
73
import torch import torch.nn as nn import torch.nn.functional as F from torch_geometric.nn import GCNConv, global_max_pool as gmp # GCN based model class GCNNet(torch.nn.Module): def __init__(self, n_output=1, n_filters=32, embed_dim=128,num_features_xd=78, num_features_xt=25, output_dim=128, dropout=0.2): ...
7318023ce2c29c28cf8f8d4eaa52938a961f773e843d3660f4fbff67af102715
Python
2,300
78
#!/usr/bin/env python # encoding: utf-8 from __future__ import (absolute_import, division, print_function, unicode_literals) import os, sys, re import logging import argparse import collections import numpy import time import TNode from GraphCycleException import GraphCycleException logger ...
883ff35cade6fed3b68f0c789854e7dfbdb49159dc95fb4650c531c3c224775b
Python
2,300
67
import json import os from typing import List import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from matplotlib.axes import Axes from matplotlib.figure import Figure from scipy.signal import savgol_filter from agent.ppo_agent import PPOAgent from dexterity.design.common import QUALITATIVE_COLO...
d6671a3f5dbeb094b44362bef95707ed4467278d7080ae1b4909e25c2fddae4e
Python
2,300
78
#-- setup-begin import rpy2.robjects as robjects import rpy2.rinterface as rinterface from rpy2.robjects.packages import importr, data from rpy2.robjects.methods import getmethod lme4 = importr('lme4') utils = importr('utils') StrVector = robjects.StrVector #-- setup-end #-- LmList-begin class LmList(robjects.metho...
24408013905bc5fb2fadb9d3ab4ea55ba5af4f8dfd481166c861618e7adefc86
Python
2,301
74
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> from os.path import join from warnings import catch_warnings, filterwarnings import pytest from eelbrain import * from eelbrain.pipeline import * from eelbrain.testing import TempDir, path, requires_mne_sample_data class Experiment(MneExperiment): meg_sy...
4fe026afadf96003cb97c019da8fcd441541f21d1efac7cf1db4eb240baab88a
Python
2,301
75
import numpy as np def onehot(DNA_seq): """ :param DNA_seq: :return: a onehot matrix """ singleDNAFragement = np.zeros([len(DNA_seq),4]) for i in range(len(DNA_seq)): if DNA_seq[i]=='A': singleDNAFragement[i,0]=1 elif DNA_seq[i]=='T': single...
c1ba4c010c87789fa98f24849c48d7c8ac6e08a6f3865558c00da081f0946e5a
Python
2,301
67
"""Generate ``torchlens/ir/op_record_manifest.py`` from the source spec. The manifest is the FROZEN ``CellSourceManifest`` v1: one row per op store cell naming its step-0 ingest source class. Regenerate-and-diff is CI-gated (``tests/producer_parity/test_p1_record_types.py``); editing the generated file by hand is a bu...
3ae9a420732ea127a74525b5dfcda4296235540c31344f3a1395bc883777e056
Python
2,302
74
def __boot(): import sys import os PYTHONPATH = os.environ.get('PYTHONPATH') if PYTHONPATH is None or (sys.platform == 'win32' and not PYTHONPATH): PYTHONPATH = [] else: PYTHONPATH = PYTHONPATH.split(os.pathsep) pic = getattr(sys, 'path_importer_cache', {}) stdpath = sys.pat...
5f8cd13a252f28e7b807738f56035678e7b00fcf9474d49345b4872e74799ea8
Python
2,302
52
'''Package implementing a data model for the whole brain recordings (more broadly, of any multichannel volumetric recording - sequence of "hyperstacks"). While there are only a few options to efficiently store an uncompressed sequence of images, so that the issues with uncompatibility of that data with different sof...
694e3dc8cf8078135cac975a9973ca4ce64f41514fb0e754223bcd739a01e63d
Python
2,302
63
import sys import csv import utils def WriteCSVFromDict(filename, data, interval): fieldnames = ['old track ID', 'old time (s)', 'track ID', 'time (s)', 'x', 'y', 'z', 'TimeDiff'] with open(filename, 'w', newline='') as file: writer = csv.writer(file) csvwriter = ...
ca2d0994431dd712aa9ef382e240b850944d7affc39591eb02d8af6d8271c965
Python
2,302
60
import numpy as np import torch from torch_geometric.data import Data from data_loading.loading_utils import train_scaler, scale_dataset TARGET_ID_TO_PROPERTY = { 0: 'First excitation energy (ZINDO)', 1: 'Electron affinity (ZINDO/s)', 2: 'Excitation energy at maximal absorption (ZINDO)', 3: 'Atomizat...
ea1d72d3bfa056ef2da2be4f0777aa944838fb480e519fc2f64681fa0376f092
Python
2,302
68
""" Companion functions for cell-cell communication inference analyses """ try: from typing import Literal except ImportError: from typing_extensions import Literal import numpy as np import pandas as pd def fdr_correct( pvals: pd.DataFrame, corr_method: str, corr_axis: Literal["interactions", "c...
67ca195e8e3dc902c2962a13e5afd3e22d86e1a0e68bb5f82e74e20b725ee315
Python
2,303
73
""" networkevents.py Modules for processing network event vectors from multi-unit activity spikes. """ import numpy as np import warnings # DeprecationWarning: elementwise comparison failed; this will raise an error in the future warnings.filterwarnings("ignore", category=DeprecationWarning) ######################...
6b42fc583c31b12ff3fa5636a5ef4f3910fa79fd0776557e3a897094231975e5
Python
2,303
65
# -*- coding: utf-8 -*- #from galaxy.datatypes.json_datatyp import Json as JsonClass from galaxy.datatypes.data import Text from galaxy.datatypes.data import get_file_peek from galaxy import util import subprocess import tempfile import logging import json import os log = logging.getLogger(__name__) #c...
781b3ee6e004cf6b3c82e90cc9f850d3b192168cafc6db2c94bb9ce95814c415
Python
2,303
53
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Tests for classification metrics""" import unittest from sknetwork.classification.metrics import * class TestMetrics(unittest.TestCase): def setUp(self) -> None: self.labels_true = np.array([0, 1, 1, 2, 2, -1]) self.labels_pred1 = np.array([0, -...
833bd8a303c1c77869f0639374b396345c439147d4509e3a6fab7f8010b55a6c
Python
2,303
63
import drawsvg as draw import numpy as np def draw_line(d,x1,y1,x2,y2,color): d.append(draw.Lines(x1,y1, x2,y2, close=False, fill="none", stroke=color, stroke_width=2)) def draw_nucleotide(d,x, y, nt, color): """ Draw one nucleotide in a circle ...
ca77cc6ad3a5d15efa91a102c721fd7ada6073cb596cbf475bc5659aeef1b1d3
Python
2,303
62
# a simplified UI for testing/profiling of animal tracking from PyQt5 import QtCore from PyQt5 import QtWidgets import logging from score_behavior.cv_video_widget import CVVideoWidget from score_behavior.score_controller import VideoDeviceManager from score_behavior.ObjectSpace.analyzer import ObjectSpaceFrameAnalyze...
1f70f7d6eecdcef11b1fcd57d5758a1dc646bf2175debe7d4f0999c898e21618
Python
2,304
62
import pytest pytest.importorskip('curses') class MockWindow: def getmaxyx(self): return self.y, self.x class test_CursesDisplay: def setup_method(self): from celery.events import cursesmon self.monitor = cursesmon.CursesMonitor(object(), app=self.app) self.win = MockWindo...
3bf89bf7b32ddfcdf1ef9f7acfb3b7abdcc75cd0e9406e69fd1b32dd4743fc29
Python
2,304
76
import os import sys import logging from pathlib import Path from typing import Dict, List import numpy as np import pandas as pd import snapatac2 as sa2 import pyprojroot proj_dir = str(pyprojroot.here()) pack_dir = f"{proj_dir}/package/python" sys.path.insert(0, pack_dir) from mylog import StreamToLogger, set_file...
7f9e4d1a666a33868417590c161823cdc63c03165031bd99262891d0f56c8ffd
Python
2,304
80
"""Extraction data substrates: digest primitives + artifact v2 + model identity. The C04 substrate half of dataset extraction (extract memo items 1, 2, 6): :mod:`digests` builds the two pinned digest primitives once (threaded Merkle crypto fold, order-sensitive value reduction) for every consumer; :mod:`artifact` owns...
0e60f76b2ce9559aa77c3a960ab57365e907ce9fd2faa33d392917f31e9bc689
Python
2,305
75
"""migrate custos to psa tokens Revision ID: 724237cc4cf0 Revises: 1d1d7bf6ac02 Create Date: 2025-11-03 15:22:13.111461 """ import sqlalchemy as sa from alembic import op from galaxy.model.migrations.data_fixes.custos_to_psa import ( CUSTOS_TABLE, migrate_custos_tokens_to_psa, remove_migrated_psa_tokens...
12afbb119371f317d7cc325508ed625e67062baa18b32f846260c85ef0d0ad5c
Python
2,305
108
import collections import csv import time from datetime import datetime from pathlib import Path import yaml ISO_FORMAT = "%Y-%m-%dT%H:%M:%S.%f" def read_csv_to_dict(path): columns = collections.defaultdict(list) with open(path) as f: reader = csv.DictReader(f) for row in reader: ...
7d79d9b2012ed6a168652ce104a400e0bac5a21e8bbd45445db6d46e9ec2edb8
Python
2,305
78
import os from logging import getLogger from subprocess import ( PIPE, Popen, ) from tempfile import TemporaryFile from time import sleep from galaxy.util.bunch import Bunch from . import BaseShellExec from ....util.process_groups import ( check_pg, kill_pg, ) log = getLogger(__name__) TIMEOUT_ERROR_...
7f41950676ce2255dbdc29215382e499b05a5afc3d12b68212450e1f0a89cfcb
Python
2,305
74
# --- # jupyter: # jupytext: # formats: ipynb,py:light # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.11.3 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # # Original Alice word ...
dfcb4d79c5b580a30b61abb201d3d9c3456f382f59c989df73aec4e604fdfcf5
Python
2,305
79
# %% ''' Recoded to run on lucky2. Copies (not SYMLINK) data from BIDS and fix cleaned data ''' import subprocess import numpy as np import os from time import time from shutil import copyfile import sys sys.path.append("..") from functions.data_helpers import get_computer # tasks task_list = ['fearRev', 'rest'] # ...
3af41ff232902944aa9a504c48f8a7c6bb0fdedf61ce34aab0fc3f4b260b0095
Python
2,306
55
"""A passive environment checker wrapper for an environment's observation and action space along with the reset, step and render functions.""" import gym from gym.core import ActType from gym.utils.passive_env_checker import ( check_action_space, check_observation_space, env_render_passive_checker, env_...
482ee185c750754c975fb27311e6969119512723d46cb90e86457981c142fe88
Python
2,306
84
import os import yaml import torch import argparse from model.model_training import ModelTraining from training_strategy.query_false_positive import QueryFalsePositives from training_strategy.hard_nagative_mining import HardNegativeMining import warnings warnings.filterwarnings(action="ignore") def load_config(con...
bd2b0842a37c7e62e5dd6eafe9994f7741f2fa57eae6211ffe8110ef2318fb79
Python
2,307
90
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on April 2022 @author: Simon Delarue <sdelarue@enst.fr> """ import numpy as np class BaseActivation: """Base class for activation functions. Parameters ---------- name : str Name of the activation function. """ def __init__(se...
533a33eadec3762fff3709f5dea250dcad514c60a7ffd2bf6280988e6b4edb3e
Python
2,308
75
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F # %% class torch_grid_augmentation(nn.Module): def __init__(self, p_rot=0.2, p_zoom=0.2, p_transl=0, p_shear=0, mm_zoom=[0.7, 1.4], ...
827c3e34b1956928a3004e8c2bef023a9a0d98dd899f38a89fef40802426c5e4
Python
2,308
55
# -*- coding: utf-8 -*- import logging from controller_validation.data.preprocessing import build_FD_dataframe, get_confounds_list from controller_validation import DATA_PATH import os.path as op import mne import pickle import os from mne import compute_raw_covariance, pick_types, write_cov from scipy.stats import ks_...
18d700534377aafdb276eb50207b9a4a85b6bccdf3f5abde692bff10661bb7cd
Python
2,309
93
'''Tests for bdpy.util''' import unittest import numpy as np from bdpy.util import utils class TestCreateGroupVector(unittest.TestCase): '''Tests for 'utils.create_groupvector''' def test_create_groupvector_pass0001(self): '''Test for create_groupvector (list and scalar inputs).''' x = [...
262d7bc8ae40bd9c3521974c0ee5f3673f0f9e08b0275979fc4dcbabd8d62c1a
Python
2,309
60
#!/usr/bin/env python #========================================================================= # # Copyright NumFOCUS # # 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://...
3c399726cc0e3a6be905d5b77f04b62d4b16be33c84c33cf36a6a3beb2900249
Python
2,309
77
from typing import List from dependency_injector.wiring import Provide, inject from fastapi import APIRouter, Depends from starlette import status from carbonserver.api.schemas import ProjectToken, ProjectTokenCreate from carbonserver.api.services.auth_service import ( MandatoryUserWithAuthDependency, UserWit...
fb9d0f4d241a08a3042f70c67cf1b8cddad3ed8cf52dbed94a1f5b7d7a08cec2
Python
2,309
77
import pytest import operator from . import utils import rpy2.rinterface as ri ri.initr() def test_init_from_seq(): seq = (ri.FloatSexpVector([1.0]), ri.IntSexpVector([2, 3]), ri.StrSexpVector(['foo', 'bar'])) v = ri.ListSexpVector(seq) assert len(v) == 3 for x, y in zip(seq, v)...
779cfec7e5b2d6af2c83da9dd566fa1c5e8a6ed2991a74ec619ef4f971b80829
Python
2,310
54
"""YOLO Demo script.""" import os import argparse import mxnet as mx import gluoncv as gcv gcv.utils.check_version('0.6.0') from gluoncv.data.transforms import presets from matplotlib import pyplot as plt def parse_args(): parser = argparse.ArgumentParser(description='Test with YOLO networks.') parser.add_argu...
e97feccf1560638fb03e267eb31036f140ca2b46257c857d39a889680b61803c
Python
2,311
62
# fix problems with pythons terrible import system import os import sys file_dir = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.join(file_dir, '../bin/')) sys.path.append(os.path.join(file_dir, '../prob2020/python/')) sys.path.append(os.path.join(file_dir, '../prob2020/cython/')) # useful import...
c55b253b3bcf28e0a2ff1669ceaf398d4fc66b9f66df8b4b7fe195dc394a5744
Python
2,312
55
"""Barcode RNG must track ``set_random_seed`` yet stay off the global host stream. Regression guard for the facet-rerun ``[param_xrefs]`` breakage: internal tensor barcodes draw from a process-private ``random.Random`` (so they never masquerade as user Python/NumPy RNG consumption during a forward), but a fixed captur...
f7da6cf4ef3f8c2e8e38f1f53a8b5de5a67da5658b07f17b1e8c9ff2646cec07
Python
2,312
54
"""SSD Demo script.""" import os import argparse import mxnet as mx import gluoncv as gcv gcv.utils.check_version('0.6.0') from gluoncv.data.transforms import presets from matplotlib import pyplot as plt def parse_args(): parser = argparse.ArgumentParser(description='Test with SSD networks.') parser.add_argume...
39422b0febb7c98bb8694bce67539e638eac3dca249d616bab78926e77e41a76
Python
2,313
73
#!/usr/bin/env python # Dan Blankenberg import sys import bx.intervals.io def __main__(): output_name = sys.argv[1] input_name = sys.argv[2] try: chromCol = int(sys.argv[3]) - 1 except Exception: sys.exit( f"'{str(sys.argv[3])}' is an invalid chrom column, correct the col...
47d21326d5e3b3ef1549d366e4e8f618990649c5f87420cee787829aeba04963
Python
2,313
56
from setuptools import setup from setuptools import find_packages with open("docs/README.PyPI.md", "r") as fh: long_description = fh.read() setup( name='aucmedi', version='0.11.0', description='AUCMEDI - a framework for Automated Classification of Medical Images', author='Dominik Müller', aut...
8291bc652af0567086db4829a88c4ddefedb463d2c0f518bb3dc2f27ab8babea
Python
2,315
86
"""OpenAI Shap-E transmitter: asset encoder to implicit-function parameters. Paper: Jun and Nichol 2023, "Shap-E: Generating Conditional 3D Implicit Functions". Shap-E first trains an encoder that maps 3D assets to the parameters of an implicit function renderable as textured meshes and NeRFs. This compact transmitt...
be8db9d840224447ef760f61c1d655545c7c3d73362efa3ea4b860d95233b6e6
Python
2,315
84
from . import utils import numpy as np @utils.copy_td def backshift_idx_fields(trial_data): """ Adjust index fields from 1-based to 0-based indexing Parameters ---------- trial_data : pd.DataFrame data in trial_data format Returns ------- trial_data with the 'idx_' fields adj...
04f38291a9c9070087e7bf6829f472980c7a38cb6c56a7971a32220ec611d315
Python
2,316
68
"""MLflow tracker export against the real mlflow package (sqlite backend). ``tl.export.mlflow`` must work with both MLflow client shapes: the fluent ``mlflow`` module (active run) and an ``MlflowClient`` (``run_id=``), and log exactly what logging the same metrics with MLflow directly records. """ from __future__ imp...
858c227871e702e92a885b4545580cf42af195ceaf0000651fd14f0ff1297519
Python
2,316
80
# Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # Project information project = "larvaworld" author = "Panagiotis Sakagiannis" copyright = "2024, Panagiotis Sakagian...
3280aa0f42fcfc6fde5af2ce43c7a80b512e9331c33e1293bd41076784a2101f
Python
2,317
49
"""Out-of-core PBF reading engine (the ``engine="out_of_core"`` backend). The file is read in one pass: data blobs are decoded in parallel with the raw Cython ``primitive_block_decoder`` (protobuf is used only for the small ``BlobHeader`` / ``Blob`` framing), each decode task spills the node coordinates and the featur...
8f4b76d044103c2cb5f9220943a4f257fd8ebd957c68f63e2851896fe4221ab1
Python
2,317
66
"""Defines the :class:`ErrorCode` class and instantiates concrete objects from JSON. See the file error_codes.json for actual error code descriptions. """ from json import loads from galaxy.util.resources import resource_string # Error codes are provided as a convience to Galaxy API clients, but at this # time they...
336cf1d35d4bb5e4eac6e6df99f375a7c701cbd15643c204429d88c1ca4dd0be
Python
2,318
53
# Copyright (c) ByteDance, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import math from pprint import pformat def lr_wd_annealing(optimizer, peak_lr, wd, wd_end, cur_it, wp_it, max_it): w...
4bcc84f674ac6c9e876050c37472ae69139cfbfc974ae19b28f11fcbae2670d2
Python
2,318
63
#!/usr/bin/env python """ Does naive decoding of Hadamard time-encoded data Assumes that the Hadamard blocks are in adjacent volumes in the data and simply decodes each block, outputting the same order """ import sys import argparse from fsl.data.image import Image import numpy as np import scipy.linalg class Argum...
92342c3afcae79fbd4df0216c281c8b3fbc9b85bf869cd517a2db761dd568f65
Python
2,318
87
import pytest from pyrosm import get_data @pytest.fixture def test_pbf(): pbf_path = get_data("test_pbf") return pbf_path @pytest.fixture def helsinki_pbf(): pbf_path = get_data("helsinki_pbf") return pbf_path def test_parsing_natural_with_defaults(test_pbf): from pyrosm import OSM from ge...
8032171a85d2a7e787a36743d9a320126e422eb0c69cfe798e57637da3ffda4e
Python
2,319
60
from numpy.testing import assert_allclose from ..permutation import permutation_test import numpy as np N_PERM = 500 def _test_one_sample(sample_shape, n_obs = 50): ''' note that even when setting the seed, the permutation p-vals will never be exactly equal to their opposite tailed p-vals because of how they...