sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
dd970577888d98fa0ebf91db2e9f2e22932cc4b5ff9cd8af681fb247cadd32a0
Python
3,353
109
#!/usr/bin/env python3 # Copyright 2004-present Facebook. All Rights Reserved. import torch.nn as nn import torch import torch.nn.functional as F class Decoder(nn.Module): def __init__( self, latent_size, dims, dropout=None, dropout_prob=0.0, norm_layers=(), ...
753913dfbcd23bbf3e2849dfe5d98311451b46955a80037f5788086b435486f1
Python
3,354
88
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. #...
26f01a461ba708d954888a36b0ae135d6bc48c6e615f26e98a03553259631ec9
Python
3,355
95
# Copyright (c) 2017-present, Facebook, Inc. # # 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 applicable law or agreed...
61fa92c5141324ed9ec1d9a1484c683394405e37b0235cddcb9339f686c721ab
Python
3,358
97
# -*- coding: utf-8 -*- """ Created on Thu Dec 10 18:19:00 2020 @author: ju-bar Functions related to work with crystal structures This code is part of the 'emilys' repository https://github.com/ju-bar/emilys published under the GNU General Publishing License, version 3 """ import numpy as np from emilys.optics.econs...
9bc66ce763609ef1c54884d1f23c836d69e90f6461ba02a543ce31d87a917f7e
Python
3,358
92
# Ultralytics YOLO 🚀, GPL-3.0 license import contextlib import glob import os import urllib from datetime import datetime from pathlib import Path class WorkingDirectory(contextlib.ContextDecorator): # Usage: @WorkingDirectory(dir) decorator or 'with WorkingDirectory(dir):' context manager def __init__(self...
445b1b8013fd1fffc9b994cd88b01d41fed9634f9567a76cc7d9c2eaf7efd0e8
Python
3,360
115
# -*- coding: utf-8 -*- """ """ import numpy as np import os, sys import re import pytest import vtkplotlib as vpl from matplotlib import cm pytestmark = pytest.mark.order(0) # Target output. Everything below should normalise to this. RGB, A = (np.array([0.00392157, 1., 0.02745098]), .5) paramet...
b20a0b2116d8659e74b0cddeace44f290a49d17de953e74c11c55445afb59950
Python
3,360
100
from __future__ import annotations import asyncio import time from dataclasses import dataclass, field from typing import Dict, List, Optional from .models import ConversationRoute, MessageEnvelope, RuntimeTaskState @dataclass class _RegistryEntry: route: ConversationRoute task: Optional[asyncio.Task] = Non...
408d8eccfa2f974f6a8627d7133af0f8d801d17060aa589a3a2bf5eaba4bc036
Python
3,362
136
import pdb import numpy as np import matplotlib.pyplot as plt import pandas as pd import torch import yaml from scipy.interpolate import interp1d from data_assimilation.particle_filter.observation_operator import ObservationOperator from data_assimilation.true_solution import TrueSolution TEST_CASE = 'wave_submerged_...
dfb2c20fa85da9e8ff578e0f3140a91696c356a1cc87c067795269af6ae19a00
Python
3,362
66
__author__ = "Simon Andermatt" __copyright__ = "Copyright (C) 2017 Simon Andermatt" from tensorflow_extra_ops import caffebicgru import tensorflow as tf from helper import get_modified_xavier_method def CaffeBiCGRU3D(inp,dimension,outC,form,dropconnectx=None,dropconnecth=None,filterx=None,filterh=None,bias=None,fsy=...
9f4fadc7d4e21a30443da97e4285c0c4c56a7f54c55c2a682f92655717b9888b
Python
3,363
60
#-------------------------------------------------------------------- # Author: Brandon Coventry, PhD Wisconsin Institute for Translational Neuroengineering # Date: 12/23/23 # Purpose: This is to demonstrate Bayesian Estimation Supercedes the T-Test in PyMC # For group comparisons. See the original Kruscke paper: https...
8c0bcb423cffdf2cbe6299e65b613bad6edeb8f754d70d27cc27bbb799b9f44e
Python
3,365
134
import os import subprocess seed_list = [2222, 3333, 4444] snn_ratio = [0.05, 0.15, 0.25, 0.35, 0.45, 0.5, 0.55, 0.65, 0.75, 0.85, 0.95] log_folder_path = "./log/" dataset = "nmnist" rnn_type = "rnn" def extract_one_performance(model, seed, ratio=None): if model == "rnn" or model == "lstm" or model == "snn": ...
f2172e3bceefb72fa8f3c6e70ce46d09e5de6fea2589a47d886177545957d118
Python
3,365
111
import ipywidgets import exputils as eu class CodeProducerWidget(ipywidgets.Box): @staticmethod def default_config(): dc = eu.AttrDict() dc.code_templates = [] dc.main_box = eu.AttrDict() dc.title = 'Code Production' dc.accordion = eu.AttrDict( selected_...
220dbfec2eb122a4434c5fef4f837063b1cc900be2e1fe05541027f252016b46
Python
3,366
102
"""load annotations from the TUH Sz Corpus dataset https://isip.piconepress.com/projects/tuh_eeg/downloads/tuh_eeg_seizure/ to a Annotations object.""" import os from pathlib import Path import pandas as pd import pyedflib from ..annotations import Annotation, Annotations, EventType, SeizureType def _loadSeizures(...
2458602ac6c126f729953e48f4cfb8bbdec4b367eca6f259e2af77732400067c
Python
3,367
106
import matplotlib.pyplot as plt filenames = { "STYP.w_filter": "C:\\Users\\psinitcyn\\Desktop\\Experiments\\STYP.w_filter\\20230927_152846_STYP_HEK293_w\\STYP_HEK293_w_-PTMSiteReport.tsv", } aas = "YTSP" mod_title = "Phospho (STYP)" aas_colors = { "Y": "#A8A9AD", "T": "#6D6D70", "S": "#3F3F...
07168625633ff98118c6e15818499272604f29c6e10100cc623f7ee10d67194d
Python
3,368
78
import argparse import mrcfile import sys import torch import numpy as np from numpy.typing import NDArray from pathlib import Path from .ode_net import ODENet from .particles import particles from .gridding import Gridding def parse_args(): parser = argparse.ArgumentParser(description = 'CryoTRANS: Predicting hig...
5eb53a65589cbaec6fa5e9fae9433e9d05f6f7dc833440a5a9a3e0b22fffb2fd
Python
3,368
117
# Copyright (c) 2021 Qualcomm Technologies, Inc. # All Rights Reserved. # pylint: skip-file # type: ignore from torch import nn from aihwkit.simulator.digital_low_precision.base_quantized_classes import ( QuantizedModule, _set_layer_learn_ranges, _set_layer_fix_ranges, _set_layer_estimate_ranges, ...
9c10826f178c241aa09a60a89647061e52abe1d37dbe563a98d51d282b25d39c
Python
3,370
94
# -*- coding: utf-8 -*- import numpy as np from scipy.optimize import linear_sum_assignment import wandb def acc(y_true, y_pred): """ Calculate the accuracy of clustering results by finding the best match between the cluster labels and the true labels. Args: y_true (numpy.ndarray): The true l...
f3cdd585d4a893736bd0ca0f0045aac17dfa256ee0d3d1fa821c0c1579089a00
Python
3,370
61
import numpy as np, pandas as pd, json, itertools from scipy.optimize import minimize from scipy.special import gammaln, logsumexp import os R=os.environ.get("CAZALE_RAWDATA", os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "data", "Cazale-Debat-Scheunemann-et-al", "RAWDATA"))+os.sep STAGE={"orientated":...
26963ff3b5a57713f253d600e20c1dded493b564df0d62c45b196102e1d7292b
Python
3,371
84
""" Compare first FA loading to the delta mu axis for each target (vs. catch) """ import os rdir = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) import sys sys.path.append(rdir) from settings import RESULTS_DIR from helpers.path_helpers import local_results_file import scipy.stats as ss import pandas as...
3aabc1a81e8b55341be7a291faf9c0bfea2a872027d07e601957c4bed19cd260
Python
3,373
109
r""" PopV: Population-level Variation analysis for single-cell data. PopV is a framework for analyzing population-level variation in single-cell data, focusing on automated cell type annotation, batch integration, and algorithm benchmarking. It provides a unified interface for comparing and evaluating different singl...
c1cc150d249944d7c0e9ce01243cc94c9e26bb98dae61e9c754a747392f2a6b5
Python
3,373
123
import logging import re import shutil import subprocess import tempfile from pathlib import Path from pokeformer.utils.pdb_utils import (get_biopdb_struct, read_pqr, write_clean_pdb) logger = logging.getLogger(__name__) def run_fpocket( pdb_path, print_info=False, ...
f01fa1b893559ea73f3aeeaf0b803e1753923648d14bc4b317976a5b3952928f
Python
3,373
105
"""Single source of truth for modules mocked during API doc generation. Three consumers import from here so they agree on what "not installed in the docbuild image" means: - ``conf.py`` -- Sphinx ``autodoc_mock_imports`` for the full ``make html`` build. - ``api_autogen.py`` -- the standalone autosummary stub gener...
401bf828f3b448b16a816e79b0f637336f819ffef9db6fb77de49115a5805a07
Python
3,374
80
from dataclasses import dataclass, field from typing import Any, Dict, Optional, Tuple import pyarrow as pa from ray.data._internal.datasource_v2.common.arrow_file_scanner import ArrowFileScanner from ray.data._internal.datasource_v2.formats.parquet.parquet_file_reader import ( ParquetFileReader, ) from ray.data....
8957946a573ef90414f42f15f110e8b36fcfdaf176064a9f09517d82764e7c87
Python
3,376
125
# Import the task(s) you want to use. import torch from tqdm import tqdm import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from m2snn.multisensory import ( DetectionTask, ClassicalTask, ComodulationTask, BalancedComodulationTask, ) from m2snn.spikes import SpikingMultimodal from...
8d6be7b5a703211183ebe76ee88a590b96c526738b25af2944e5b0385034e4ee
Python
3,377
111
# -*- encoding: utf-8 -*- from __future__ import division, print_function from scipy.linalg import toeplitz import numpy as np from .core.scoring import aggregate_by_segment from .core import scoring as _scoring from .utils import where_diagonal sums_by_segment = aggregate_by_segment def _corner_matrices(A): Hup...
409e321416bbbccd4ebe718ac759327653c96b75210d85af92fec5250ad366a7
Python
3,378
105
# flake8: noqa # fmt: off # __task_exceptions_begin__ import ray @ray.remote def f(): raise Exception("the real error") @ray.remote def g(x): return try: ray.get(f.remote()) except ray.exceptions.RayTaskError as e: print(e) # ray::f() (pid=71867, ip=XXX.XX.XXX.XX) # File "errors.py", lin...
9c6b0edfc0876f2fa93fe5c812bcd924ecabf1fbcefb7a0ee2dab343cec63c70
Python
3,379
105
import os import json from io import BytesIO import boto3 from neuron_morphology.transforms.tilt_correction.compute_tilt_correction \ import (run_tilt_correction, read_soma_marker) from neuron_morphology.swc_io import (morphology_from_swc) from neuron_morphology.transforms.affine_transform \ import (AffineTra...
c20741b9c42d771089729a8d6c70e4463b6e5051c8476222f0fc19538f2558bf
Python
3,379
131
import pandas as pd import numpy as np import pickle import nltk.stem as ns import pdb from tqdm import trange ALPHA = 0.66 LAMBDA = 1 def tokenize(sent): sent = sent.lower() sent = sent.strip('.') lemmatizer = ns.WordNetLemmatizer() sent = sent.replace("'s", '') sent = sent.split(' ') for it...
12686c691d98fe8eb37c8a9b190f8e0d8cb8cd1b0e4c8603efb5f8a17d33b0c8
Python
3,382
92
# Copyright 2021 Division of Medical Image Computing, German Cancer Research Center (DKFZ) # and Applied Computer Vision Lab, Helmholtz Imaging Platform # # 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 L...
1d5536a2d01d2909cee38b085c7072391bfa6787b407c0884300c7ef26c61b8e
Python
3,383
75
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
7b24b1d38b14d9ff9e94e1f5a62755f78e8e2cc08139029202fd2b1fc44cd510
Python
3,383
113
#!/usr/bin/env python # -*- coding: utf-8 -*- # """ """ import argparse import sys import pandas as pd import pysam import svtk.utils as svu def final_filter(vcf, bed, chrom=None): bed = bed.set_index('name') new_variant = ((bed.operation == 'add-mosaic-variant') | (bed.operation == 'add...
b2c756852c81b750e7e55e66209bb804696efe808a13e9cdd06c4bb957c79947
Python
3,383
95
""" STEP ONE data_pth needs to be customised Export mov.csv from angle.mat files Save envelopes of EMG data and raw EMG data """ import os import pickle import sys import numpy as np import pandas as pd import scipy.io as sio from scipy import signal # subject and protocol info subject_id = sys.argv[1] protocols ...
b41d8b3d04bf847df2d659f9a90caf898a19483c31a19dce50fdb11b47983c5f
Python
3,385
90
# Copyright 2023 Google Brain and The HuggingFace Team. 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 requ...
20637048dd347c328b61e0173d38b69b7239b0e0c46090599d8b9f036b845090
Python
3,388
116
# flake8: noqa import os from filelock import FileLock import torch.nn as nn import torch.nn.functional as F from torchvision import datasets, transforms EPOCH_SIZE = 512 TEST_SIZE = 256 def train_epoch(model, optimizer, train_loader, device=None): device = device or torch.device("cpu") model.train() fo...
a680a3abf59775dd6644d10eee22e96786d2e9d0ba0a70be7076db4afdc262f5
Python
3,388
86
import numpy as np import pytest import xarray as xr from flyvis.analysis.moving_bar_responses import ( angular_distance_to_known, correlation_to_known_tuning_curves, peak_responses, preferred_direction, ) from flyvis.utils import groundtruth_utils CELL_TYPES = ["T4a", "T4b", "T4c", "T4d", "T5a", "T5b...
cb1ef5e53420c9204cbc899dab08e33629393729e8fa4eaad16c7b8e27148db0
Python
3,388
109
"""Dataset for cells""" from itertools import zip_longest, product, chain import random import numpy as np import torch from torch.utils.data import Dataset from torchvision.transforms.functional import (pad, to_tensor, normalize, hflip, vflip, crop) from PIL import Image...
1b8fb8012e02e8d86b449607fce44fdab1da24efe98dd75d7e11d44dc49bf19d
Python
3,390
116
#!/bin/env /usr/local/package/python/3.10.5/bin/python3 # usage: python _run-cmfinder-h0.py <cmsearch_output> <test.fa> import sys from util import * ifname = sys.argv[1] faname = sys.argv[2] def get_correct(): correct = {} with open(faname) as fi: for l in fi: if l.startswith(">"): ...
448093de386eee5593ded91a2ecb43010d6fdda1b6b9dad92545f7238704a223
Python
3,390
101
""" Create a cluster of GPU nodes to perform parallel prediction of tiles """ import argparse import sys import socket import subprocess from dask_jobqueue import SLURMCluster from dask.distributed import Client import gc def collect(): gc.collect() def args(): parser = argparse.ArgumentParser( descri...
be5df373dac80a3ea34375c6a46da7ef5bd1dca1a2099b2077837daef0cb66f6
Python
3,391
114
from collections.abc import Sequence import numpy as np from .typing import Types def parse_shape_argument(x: Types, key: str): """Parse the shape argument of a NIR node.""" if isinstance(x, np.ndarray): return {key: x} elif isinstance(x, Sequence): return {key: np.array(x)} elif isi...
74379bf15a6a75d8d695f9dc423f45bf3dd1ee8a651970bff7a8b2b593546d4b
Python
3,393
95
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. """Helper for retrieving Metrics of an Experiment.""" from datetime import datetime from typing import Dict, List class LocalMetric: """Metric for local e...
ee33053398601f3663ae002810440979500a37c44269d60bbde9d260a9b1ea96
Python
3,393
104
import matplotlib.pyplot as plt import pandas as pd import numpy as np def plot_dense_sensordata(dense_data, ax=None, show=True, show_missing=False, time=None, text=None, ylabels=True): """view single patient's worse of dense sensordata, a ndarray or df where the columns are: heart_rate, activity_rank, resp_pa...
1e72976600cc6654597d21ee75ef0d775a8b5f63ffc55d42eca665066c6f899a
Python
3,394
90
from typing import Optional, Union import torch from .lif import LIF from .reshape import SqueezeMixin class ExpLeak(LIF): """Leaky Integrator layer which is a special case of :class:`~sinabs.layers.LIF` without activation function. Neuron dynamics in discrete time: .. math :: V_{mem}(t+1)...
dbc874e683cb7941de777cabdca701b42e7100c10174cb2182d9b789e2719487
Python
3,394
124
from scipy.io import loadmat from scipy.special import erfcinv import numpy as np import pandas as pd from scipy.stats import kruskal from itertools import combinations def star(p_val): assert 0 <= p_val <= 1 if p_val >= 0.05: return 'ns' if p_val >= 0.01: return '*' if p_val >= 0....
e5e23c56ffcfed501e4b48c67c75f7f1c3d2cd0c97efff02bb7eef46d8bb7570
Python
3,394
109
# docs/source/conf.py from __future__ import annotations import os import sys # -- Path setup -------------------------------------------------------------- # If your package uses a src/ layout, add it so autodoc can import flowsig. sys.path.insert(0, os.path.abspath("../../src")) # -- Project information ----------...
293df0d681113458c4adf6b333a26036738c905df74c48f5b50f95eb1177045e
Python
3,396
134
import os import subprocess seed_list = [1111, 2222, 3333, 4444]#, 5555] snn_ratio = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9] log_folder_path = "./log/" dataset = "ptb" rnn_type = "rnn" def extract_one_performance(model, seed, ratio=None): if model == "rnn" or model == "lstm" or model == "snn": fi...
93ab3891fdcc6039e4594daa982cf70947f5d97ba1e39da2ec33b69b763dcd28
Python
3,396
138
#!/usr/bin/env python import subprocess import skimage.io import traceback import numpy import numpy as np import os import sys from os import system from platform import system as platform import skimage.io import wave import pyaudio import matplotlib.pyplot as plt plt.matshow([[1,0],[0,1]], fignum=1) plt.draw() if...
b2d5789cf42c9b1e3e6333f3e92eb2f147dde268ca784e0d084a595c044a26dc
Python
3,396
85
import pandas as pd import os import sys project_root = '/ccb/cybertron/khchao/splam-analysis-results/' output_dir = f'{project_root}train/results/RefSeq_ALTS/BAM_REF_Intersection/' def get_hg38_chrom_size(): f_chrs = open("../hg38_chrom_size.tsv", "r") lines = f_chrs.read().splitlines() chrs = {} fo...
de53a93ec1490183914b26206f52ec211826d6a8e3d5a42de62ccc4dd78db18a
Python
3,396
100
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. #...
7d7ea986f5258360198482f03dc5f9ababa4b2790c3b0b5b75b5d68b27c5c3f7
Python
3,397
79
import os import sys import argparse sys.path.insert(0, "/srv/home/zgaleday/torch_pgn") from torch_pgn.train.run_training import run_training from torch_pgn.train.hyperopt import hyperopt from torch_pgn.args import TrainArgs, HyperoptArgs DATASETS = ['pdbbind_general', 'pdbbind_refined', 'd4'] # SPLIT_TYPES = ['rando...
3dbff3d9e7e85dfb2b4c6806a0ee8de60b08283a92857dfe5d348296cf4c6185
Python
3,398
109
import numpy as np import scipy.stats as sts import scipy.special as spsp def fit_dprime_pts( col_rep_dists, col_diffs, bhv_errs, renorm_dists=True, n_bins=10, min_d=0, max_d=5, n_ds=1000, filt=True, n_samps=10000, ): """ Fit the dprime that best fits the behavioral re...
3ab0bf8ad4d3ae418d7a4883aa3fac946018a533fa45f8b68be395ee0bf50955
Python
3,399
95
import glob import pathlib import pickle import endstate_correction import mdtraj as md import numpy as np from endstate_correction.equ import calculate_u_kn from openmm import unit from openmm.app import CharmmParameterSet, CharmmPsfFile from pymbar import MBAR from openmm.app import Simulation from typing import Tup...
947aa0bb205f4e3af7b978c149310b9729e96b419bd4693f674b389823717c73
Python
3,400
92
#!/usr/bin/python """Functions for merging multiple graphs.""" # Updated: 12/04/21 import numpy as np import leidenalg as la def compute_graphs(mod, plist, keep_all_z=True): """Compute graphs along a list of eigenvalue-power values.""" for power in plist: graph_id = f'p{power}' if graph_id not...
ea15fdb1278cdd6c30a62f6f83ecc19664a7acd48f94b664476af90a4e682262
Python
3,401
84
#!/usr/bin/env python # Runs "mean absolute deviation" QC metrics on two long-RNA-seq gene quantifications import os, subprocess, json import dxpy def divide_on_common(str_a,str_b): '''Divides each string into [common_prefix,variable_middle,common_ending] and returns as set (parts_a,parts_b).''' parts_a = [''...
16f0bfdee4d853e0f761e2334367b50ef708ba474735031602e40e2284f693b0
Python
3,402
94
""" To plot distribution of visit interval. """ import pandas as pd import numpy as np import matplotlib.pyplot as plt version = "processed_data_2019-9-30" info_df = pd.read_csv("../"+version+"/patient_visit_info.csv") patient_df = pd.read_csv("../"+version+"/patient_info.csv") entire_cohort = list(patient_df.PAT...
3a33f02b871152e175dbd9f6ae0618d86ec55b96185fc732a8007cf7dd96c7ad
Python
3,402
95
# -*- coding: utf-8 -*- from mozaik.storage.datastore import PickledDataStore from mozaik.controller import Global from parameters import ParameterSet import mozaik from mozaik.controller import setup_logging import sys from msa_analysis_plotting import * from mozaik.storage.queries import * # Usage: python run_analys...
d11ea15ade40eddb79f6db367401622b764b36f90d526e143bed20c9855c488e
Python
3,402
108
import numpy as np import torch from scipy.sparse import csc_matrix, csr_matrix, issparse from sklearn.utils import sparsefuncs from torch.utils.data import Dataset, DataLoader, BatchSampler, SequentialSampler, RandomSampler """ Data streamlining. """ def streamline_count_matrix(x_raw, gene_names_raw, gene_names_mo...
e5293163de5cf06c5424e40275480af7a11a6e2dd4da68b4f00b143b5d9328e9
Python
3,402
48
import numpy from mozaik.analysis.data_structures import SingleValue from parameters import ParameterSet from mozaik.storage import queries import mozaik from mozaik.analysis.analysis import Analysis from mozaik.storage import queries import quantities as qt import logging logger = logging.getLogger("mozaik") class S...
f5507a40dbddfacad9c1cfd1bd33bf4735f3fc6c8adfa7935483846f22a323c9
Python
3,402
118
''' check if we can cluster the scene vectors in particular, can we derive good clustering parameters from the training set and generalize to the validation set this is essential for the clustering based shortcut model to work ''' import os import pickle import numpy as np import pandas as pd import seaborn as sns imp...
6fbdecd6560c3dc8a59a5154e369cf086e4a956f65f667e1ae46e9623979b8af
Python
3,403
91
import os import sys from rdkit import Chem from rdkit import DataStructs def compare_molecules_inchi_match( input_file_path: str, reference_directory: str ) -> None: """This function checks if the molecules in the DECIMER results to a set of reference mol-files using Standard InChI. Args: ...
702552ab3568634358f89a63adae8dd53c895a67f9c158e13853930027549745
Python
3,404
81
""" This script computes segmentation metrics (Dice, ...) using the MetricsReloaded package for nnUNetv2 results and saves them as CSV files. One CSV file is generated for each GT-prediction pair. It is necessary to download the MetricsReloader package from https://github.com/ivadomed/MetricsReloaded.git Usage: pytho...
819899d53adcb8d2f07914ea8fb83754f41cecb5deda7bfff4c3b5309b20f074
Python
3,404
123
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Retrieved from https://raw.githubusercontent.com/talkowski-lab/rCNV2/a8849b880e2c1e1d2c51f055d85fec07384886a2/data_curation/CNV/defragment_cnvs.py # on May 14, 2020 and adapted for gatksv pipeline """ Perform local defragmentation of a CNV BED file """ import pybedt...
9d5e2e8c7aae8989300389cb1957d415cf888bc166f10cb2df47cf08096f36f1
Python
3,404
105
from collections import deque import numpy as np from gym import spaces from pfrl.env import VectorEnv from pfrl.wrappers.atari_wrappers import LazyFrames class VectorEnvWrapper(VectorEnv): """VectorEnv analog to gym.Wrapper.""" def __init__(self, env): self.env = env self.action_space = se...
c80e69b4fd75bc6c367bad76db402d77996cd8b5bf2dd49347eb3245ba7dbb00
Python
3,405
86
# coding=utf-8 # Copyright 2023 HuggingFace Inc. # # 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 applicable law or ag...
f601c89594d0ee91ba601c3427ae1a0d0c8bfacff13753be61a7d8863a4fb549
Python
3,405
89
from Bio import SeqIO import random import os import sys from pathlib import Path import pandas as pd def get_hg38_chrom_size(): f_chrs = open("../src/hg38_chrom_size.tsv", "r") lines = f_chrs.read().splitlines() chrs = {} for line in lines: eles = line.split("\t") chrs[eles[0]] = int(e...
9ff7a4c02349eca773a8317f07b0bf726dafce84685a55d96883ef04875f417c
Python
3,406
94
"""The built-in synthesized columns: ``path`` and ``row_hash``. The interface they implement, :class:`SynthesizedColumn`, and its input :class:`ReadUnitPosition` live in :mod:`ray.data._internal.datasource_v2.interfaces.synthesized_columns`. """ import hashlib from dataclasses import dataclass import numpy as np imp...
ce30f7df03b9b879baa92e02cb12826d2c4a7b619873ee6180bc44afdf5a3fc7
Python
3,406
111
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from __future__ import annotations import argparse import multiprocessing as mp import os import pickle import ase import ase.io import n...
e56722bdb7ee447cd4c380663be35cc5a6fc1e7b093c14366cc409db8d131e7b
Python
3,408
136
import sys import pytest from ray._common.retry import ( call_with_retry, retry, ) def test_call_with_retry_immediate_success_with_args(): def func(a, b): return [a, b] assert call_with_retry(func, "func", [], 1, 0, "a", "b") == ["a", "b"] def test_retry_immediate_success_with_object_args...
2cb3b1825835c809f09107035f4c99aa7a6d851c47027cee91b937e8fddd0b31
Python
3,410
91
# Copyright (c) 2017-present, Facebook, Inc. # # 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 applicable law or agreed...
6a6ad3b4a6dffe0265d4e6629ae79498f80360d8c8ee32caf19332d744874a8c
Python
3,410
116
import sys import numpy as np from multiprocessing import Pool # Add package path packagepath = '../kcorePercolation' # Manually specify the path to your script sys.path.append(packagepath) from utils import kcorePercolation as kp # Import custom utility functions def setting_ps(): """ Define the ps (perco...
a997b8b1bc64b3c9b19f6500088d4098b2366215c8e96ecc55d36cfc5294e068
Python
3,410
76
import re import sys import os # polyA colname = ["", "base_s", "base_p", "exon_s", "exon_p", "intron_s", "intron_p", "intron_chain_s", "intron_chain_p", "transcript_s", "transcript_p", "locus_s", "locus_p", "matching_intron_chain", "matching_transcripts", "matching_loci", "missed_exons", "novel_exons", "missed_intron...
13c679fbc18873769dc75681973c355049d63f5da502b49ee3697d0b9a0644ff
Python
3,411
96
# built-in dependencies import os from typing import Any, cast # third-party dependencies import numpy as np from numpy.typing import NDArray # project dependencies from deepface.commons import folder_utils from deepface.commons.onnx_utils import build_session from deepface.commons.logger import Logger from deepface....
e0a9c57218bffd44b23e6a90d22d3f300ccc848fc3cbd2b9b2e4dd36a78303ee
Python
3,411
72
import numpy as np import tensorflow as tf class Dataset: def __init__( self, data_name, logging_dir, flatten, ttfs_convert, ttfs_noise=0, ): self.name = data_name self.flatten=flatten self.noise=ttfs_noise self.logging_dir=loggin...
0b26eb5cfbbd59b1fead21f6f87eca7fe0bbdb801d5346ca823fb5545d929d37
Python
3,413
96
import importlib import inspect from types import ModuleType from typing import List from ci.ray_ci.doc.api import API, AnnotationType, CodeType, _is_directly_annotated class Module: """ Module class represents the top level module to walk through and find annotated APIs. """ def __init__(self, ...
886eea52e7c57dcb7aad6ab291a01e658d0222d7304f7720a8927253c852f7c5
Python
3,413
106
# built-in dependencies from typing import List, Dict, Any # 3rd party dependencies from numpy.typing import NDArray # project dependencies from deepface.commons import weight_utils from deepface.models.Detector import Detector, FacialAreaRegion from deepface.commons.logger import Logger logger = Logger() WEIGHTS_U...
fccd68cecb91368aafa9f0b6e03c5596b844237a029325e22dee8462d703e4ce
Python
3,414
100
import os import pickle import sys # with open("./spliceai_result_"+SPLICEAI_VERSION+"/"+output_file+"/d_scores_"+TYPE+".pkl", 'rb') as fw: # pickle.dump(donor_scores, fw) # with open("./spliceai_result_"+SPLICEAI_VERSION+"/"+output_file+"/a_scores_"+TYPE+".pkl", 'rb') as fw: # pickle.dump(acceptor_scores, fw...
6a5a8d89b2225dfe4a49c6292bab2d48f8b34eeeeb0997f79fb3208d6e9bd843
Python
3,416
93
import time import torch import torch.nn as nn import pytorch_lightning as pl from pytorch3dunet.unet3d.model import UNet3D device = torch.device("cuda:0") class MyModelLightning(pl.LightningModule): def __init__(self, train_dataloader, val_dataloader, lr, weights, gamma1, gamma2): sup...
10907a76b7956d07062476069be812e244ac231d46aaec2b41f7a7549e05bdc5
Python
3,417
124
from ci.ray_ci.doc.api import _OVERRIDE_HOOK_MARKER, AnnotationType from ci.ray_ci.doc.mock._internal import ( # noqa: F401 MockInternalOnlyClass, MockReexportedClass, ) # Mirrors a library head module such as ray.data: the declared public surface # names a class whose implementation lives in a private module...
4461f4f8dfe230e6f8c5cdb0ac293d11769bb4cbb37a71e650bf5344f318b924
Python
3,418
68
import pytest from sklearn.pipeline import Pipeline from siapy.core.exceptions import InvalidInputError from siapy.features.helpers import ( FeatureSelectorConfig, feature_selector_factory, ) from tests.utils import assert_pipelines_parameters_equal def test_feature_selector_factory_regression_pipeline(): ...
607444377568d31c854b1979d9de8cddab07d4d0622b1be46aa968ef0e99724f
Python
3,418
98
#Plot abundance distribution import numpy as np import pandas as pd import glob import geopandas as gpd import traceback import math from distributed import wait def run(tile, confusion_path="data/processed/confusion_matrix.csv", overlay_bounds="/home/b.weinstein/DeepTreeAttention/data/raw/OSBSBoundary/OSBS_boundary....
1893b30191cfacb2955c8e3a246cf44dda18726bb3c1c2ed22f29d5e9dd9c1f5
Python
3,419
93
# Ultralytics YOLO 🚀, GPL-3.0 license import requests from ultralytics.hub.auth import Auth from ultralytics.hub.session import HUBTrainingSession from ultralytics.hub.utils import PREFIX, split_key from ultralytics.yolo.engine.exporter import EXPORT_FORMATS_LIST from ultralytics.yolo.engine.model import YOLO from u...
8f28b6ffccbc258b20b0ec873d2a82102e6f6ed034bd12dece35534921257cd1
Python
3,419
100
import numpy as np import os import json import math from scipy.stats import chi2_contingency, wilcoxon, mannwhitneyu, shapiro, linregress from ..io import SAVED_DIR, RESULTS_DIR, load_network, load_params, load_responsiveness from ..analysis import find_response_range, parse_activity, find_stimulus_range, find_respons...
2daf3066b334a64e3b1387e2d555b69928f77d174ef688eb475c8ecffc01966d
Python
3,420
136
from collections import namedtuple from dataclasses import dataclass from typing import Dict from unittest.mock import Mock from wandb.util import json_dumps_safer import ray from ray.air.integrations.wandb import WandbLoggerCallback, _WandbLoggingActor class Trial( namedtuple( "MockTrial", [ ...
0f235fab7d95cac2adf113e2769bf94b72a39415cff804c2bc07f83d67c25d9c
Python
3,421
89
import torch from typing import Union, Tuple from torch_geometric.typing import OptPairTensor, Adj, Size from torch import Tensor from torch.nn import Linear import torch.nn.functional as F from torch_sparse import SparseTensor, matmul from torch_geometric.nn.conv import MessagePassing class SAGEConvCat(M...
917e6bf7ff721bf83b553c8986649a80c1ff7a188ab97da4b3c7ba53a25c6f78
Python
3,422
72
#!/usr/bin/python import os def create_key(template, outtype=('nii.gz',), annotation_classes=None): if template is None or not template: raise ValueError('Template must be a valid format string') return template, outtype, annotation_classes def infotodict(seqinfo): """Heuristic evaluator for de...
a07cb15e6a2844c429af177ee49aa7516249c2e441820bd633789b91e64b9171
Python
3,422
94
import re import json import h5py import torch import argparse import numpy as np import os from tqdm import tqdm from src.data.load_data import load_params from src.tools import load_model from src.models.predict_model import predict_horizon SUBS = [f"sub-0{i}" for i in range(1, 7)] HORIZON = 6 def main(args): ...
0abf57bc5361b4af773075aa96285c80a86948542cfae8ce7137a16490c0e0b9
Python
3,423
102
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ # example how to use checkpoint fixtures from __future__ import annotations import os from functools import partial import torch from e3n...
226321ade7c1a9fd99cf53a6ba947aa7f5604cfe3656a9d57540d3665d444b35
Python
3,425
77
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
74d498d4c28e8b89cfc5584d6fc086e2a2b802101d5f3ac21ce7e0573c87a9ac
Python
3,425
66
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'thumbass.ui' # # Created by: PyQt5 UI code generator 5.15.2 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. from PyQt5 import QtCore, QtG...
9363bd9d763bb24a32fc42e09ed8d053ce13aa9c87c730d0d46945aa214a943b
Python
3,428
103
# Copyright 2023 Google LLC # # 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 agreed to in writing, ...
cf4eaef9790b9cda6c2f7317153f8619f86e3c1d1938080f5c140da38c0e3057
Python
3,428
112
# Source: # https://github.com/kubernetes-client/python/blob/master/kubernetes/utils/quantity.py from decimal import Decimal, InvalidOperation from typing import Optional, Union from ray._private.accelerators.tpu import ( get_num_chips_from_topology, get_tpu_cores_per_chip, ) # Mapping used to get generation ...
de404ac635bf2c0083d720a170c772e4d4e303b263a6dec8293f2c79cc43f47a
Python
3,428
91
import hashlib import logging import os import tarfile from pathlib import Path import requests # type: ignore[import] ################################################################# # TEST DATA CONFIGURATION # ################################################################# ...
509848994d058b0482bc7b55e8cf8fafa11d5c1c218338082d25c00b3073f97f
Python
3,430
114
from typing import Sequence, Union import numpy as np from .typing import Types def parse_shape_argument(x: Types, key: str): """Parse the shape argument of a NIR node.""" if isinstance(x, np.ndarray): return {key: x} elif isinstance(x, Sequence): return {key: np.array(x)} elif isins...
5f8d92ebcde73e845c138e69f1f7b4a2f6221117583655d829d3024eb09acd38
Python
3,430
64
import tensorflow as tf class Activations: class ASU(tf.keras.layers.Layer): def __init__(self, trainable=True, lower_asymptote=0., upper_asymptote=1., alpha_init=1., bias_init=None): super(Activations.ASU, self).__init__() self.trainable = trainable self.lower_asymptote...
a0b1eec72550a20721148f8f937d2a75ff241a6d6137d12052d6e757f82eec5a
Python
3,431
106
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. #...
c6aee64430fdef2f8405bd88db73e3fe733758803bdcbb0ee3af11ef59c38f36
Python
3,431
111
"""Find peak layer for each stim duration""" import numpy as np import nibabel as nb import glob import pandas as pd import seaborn as sns subs = ['sub-05', 'sub-06', 'sub-07', 'sub-09'] subList = [] peakList = [] durList = [] for sub in subs: print('') print(sub) folder = f'/Users/sebastiandresbach/da...
dc5c94f274a8aa20dd1bdc04793a056972943382cb18cdff0f8647c2ca9c72a8
Python
3,431
77
import unittest from neuron_morphology.morphology_builder import MorphologyBuilder from neuron_morphology.feature_extractor.feature_extractor import FeatureExtractor from neuron_morphology.feature_extractor.data import Data from neuron_morphology.feature_extractor.marked_feature import ( specialize ) from neuron_m...
b9ddf0bf4a22d8d3e3761da68b48aea4327fb33bd3a2b77f632793189ecc6345
Python
3,432
110
from __future__ import division from time import sleep from time import time import numpy as np import scipy as s import sys from ..core.nodes import * def mask_data(data, mask_fraction): """Method to mask data values, mainly used to evaluate imputation PARAMETERS ---------- data: ndarray mask_fr...
0b16ae231c61d53a0cb3d449d87564fef02098240febaa959c5b005ac310f4da
Python
3,433
78
import argparse import scipy.stats as sts import numpy as np import pickle import functools as ft from datetime import datetime import general.utility as u import swap_errors.auxiliary as swaux import swap_errors.analysis as swan def create_parser(): parser = argparse.ArgumentParser(description='naive forgetting ...
53ac6e695ed1c3e656d21a26bab7e3c5e432e7e2ebcdf7b75a7e819e1172e98e
Python
3,433
79
import torch import torch.nn.functional as F def precompute_feedback_exp_args(stacked_feedback_filters: torch.Tensor, all_observed_spikes: torch.Tensor) -> torch.Tensor: ''' :param stacked_feedback_filters: shaep (n_cells, n_bins_filter) :param all_observed_spikes: shape ...
7667964ff9b1c994091d6586ee4fb4ea580c19213de96c4e2095bc9d821ee393
Python
3,433
103
import numpy as np # from utils import random_ortho_mat class SimpleUniformContext(): def __init__(self, context_dim, pseudo_count=10, stickiness=10): self.context_dim = context_dim self.pseudo_count = pseudo_count self.stickiness = stickiness self.init_context() def init_co...