sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
9c131f82603b84b6b260352c377d2c5798cb6a267b523570700f370ec2c0446f
Python
3,433
114
# built-in dependencies from typing import Tuple, Any # 3rd party import numpy as np from numpy.typing import NDArray import cv2 def normalize_input(img: NDArray[Any], normalization: str = "base") -> NDArray[Any]: """Normalize input image. Args: img (numpy array): the input image. normalizat...
ec222381db9599af8235f4bb2b4bae14d3c8fd3b86231c0e549fdb5ae33bb06b
Python
3,433
90
#!/usr/bin/env python # coding: utf-8 # author: Maruthi Mutnuri (maruthi2008@gmail.com) # loading libraries import pandas as pd import numpy as np # loading database file INTERVENTIONS_s = pd.read_pickle('/project/M-ABeICU176709/ABeICU/data/INTERVENTIONS.pickle', compression = 'zip') # selecting columns INTERVENTION...
3d40bd3d5d2e0b34715f23e6dd7844ba7208adcbb5540dba0a054fc66f44b168
Python
3,434
92
import unittest from collections import namedtuple import torch try: import numpy as np except ImportError: np = None from rising.loading.collate import numpy_collate class TestCollate(unittest.TestCase): @unittest.skipIf(np is None, "numpy is not available") def test_numpy_collate_int(self): ...
5d3751a0675b149ce90f66e291da12bfe7d49d501e51124fb11b7f13b0ddd7a5
Python
3,435
97
import pytest import torch @pytest.mark.parametrize("first_batch_size,second_batch_size", [(2, 4), (4, 2), (2, 2)]) def test_batch_size_mismatch(first_batch_size, second_batch_size): from copy import copy import sinabs.layers as sl # Setting the spike_threshold larger than the number of timestamps, such...
80342be8ee56a26fe66bf4c2a6263b0f32eb476da08cbb688fd95521a2929d12
Python
3,435
76
# 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...
c5405d56e775a97f40cfa5ef92ec66e823ba2a4f710c1d5ccd0e4f5ba81b27e4
Python
3,436
104
from typing import Any, Optional import numpy as np import torch from torch.nn import functional as F class TransformerBase(torch.nn.Module): """Abstract class for transformers.""" @staticmethod def __top_k_logits(logits: torch.Tensor, k: int) -> torch.Tensor: """From https://github.com/karpathy...
d09a81a42ffef210045f44832281530ced0bc1c374eb91e9c605b63ab20e970e
Python
3,436
143
from . import np, ut, pd def save_samap(sm,fn): import dill if len(fn.split('.pkl')) == 1: fn = fn + '.pkl' sm.path_to_file = fn #TODO: Clean this up... try: del sm.sam1.SamGui except: pass try: del sm.sam2.SamGui except: pass try: ...
54361caf752d117f70d6d6f822a442d432774fcc52979f68b5d987aaaacf5de5
Python
3,437
97
#################################################################################################### # 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...
98f1aba15c161cc10dcf9becaef6ebfb6524a396b55378eeff96755d9d8df197
Python
3,437
90
import torch import torch.nn as nn class Reg(nn.Module): """ Regularization module for graph-based smoothness regularization. Args: net (nn.Module): The neural network model. group_size (int, optional): The number of inner parameters to group together. Defaults to 4. """ def __ini...
cd1158a1a3bb9d46d001da0298fe684eb65392560abe22198c6b240d81b9472b
Python
3,437
101
"""Compute statistical description of datasets.""" import multiprocessing from concurrent.futures import ThreadPoolExecutor from typing import Any, Tuple import numpy as np import pandas as pd from tqdm import tqdm from visions import VisionsTypeset from data_profiling.config import Settings from data_profiling.model...
ce3e80e46731d429e9c484d3248376291ff5fefe88bf317ee89044058f4ee76f
Python
3,437
128
""" Useful functions for preprocessing. """ __date__ = "August 2019 - October 2020" import numpy as np import warnings from scipy.signal import stft from scipy.interpolate import interp2d EPSILON = 1e-12 def get_spec(t1, t2, audio, p, fs=32000, target_freqs=None, target_times=None, \ fill_value=-1/EPSILON, max...
ed43e09ea5e060fcd45b3e3f6fe29ff2e91120c223dad8d688e6a8dae3d7eec6
Python
3,437
80
import os, logging, datetime from misc.abb_med_disease import gen_abb_med_disease from misc.save_files import read_DocTermDict, read_w2v_model def load_models(config: dict, year_list: list, med: bool, abb: bool, disease: bool): logger = logging.getLogger(config["System"]["logging"]["logger_name"]) target_d...
3fc7e9f764a73933351af02255a46efe886f804f2fe66cb706a6427527489eda
Python
3,439
155
# Ultralytics YOLO 🚀, GPL-3.0 license """ Base callbacks """ # Trainer callbacks ---------------------------------------------------------------------------------------------------- def on_pretrain_routine_start(trainer): pass def on_pretrain_routine_end(trainer): pass def on_train_start(trainer): pa...
e94ba2d2f1798d5bbc262960e13d33df11318ea05f1b8b4e6eb7ea109bff43d9
Python
3,442
92
import numpy as np # Just an iterator class class SpikingDatasetIterator: def __init__(self, dataset): self._dataset = dataset self._index = 0 def __next__(self): if self._index >= self._dataset.shape[0]: raise StopIteration else: sample = (self._datase...
8ffb1d7ae84e30ed820bb4b1a3603728954285166994affb0a8c927e19cc12e3
Python
3,443
84
#Patches import rasterio import numpy as np def crop(bounds, sensor_path=None, savedir = None, basename = None, rasterio_src=None, as_numpy=False): """Given a 4 pointed bounding box, crop sensor data""" left, bottom, right, top = bounds if rasterio_src is None: src = rasterio.open(sensor_path) ...
999deec05509d025d25f62347f91cc2c3426e910dc525f24e3bbb8cb8c4c0413
Python
3,443
105
""" 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. Modified from https://github.com/pytorch/vision/blob/main/torchvision/ops/stochastic_depth.py """ from __future__ import annotations import t...
f3bcac38309d4c446961f1fe10384494e532080bbccfafb12100aa2fbdf82b08
Python
3,443
95
# Copyright 2023 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 required by applicabl...
12dd66fb010d8cbedd4efd05ec197ac455d5654ad05d046bfb5bf6d9978896f7
Python
3,446
86
import os import subprocess from ci.ray_ci.container import ( # _AZURE_REGISTRY_NAME and _DOCKER_AZURE_REGISTRY imports temporarily # commented out: Azure image push is disabled due to CI issues. # _AZURE_REGISTRY_NAME, # _DOCKER_AZURE_REGISTRY, _DOCKER_ECR_REPO, _DOCKER_GCP_REGISTRY, ) from ci...
5df7df7826a98ba4685f0b75298e1b538e76bc234afc53d536068459b2085265
Python
3,446
106
import copy as cp import logging import multiprocessing as mp import functools from typing import Dict, Any, Tuple, List, Set, Optional, Type from argschema import ArgSchemaParser from neuron_morphology.feature_extractor._schemas import ( InputParameters, OutputParameters) from neuron_morphology.feature_extracto...
474c22439384cc9a9d0840dceca6d3b47baab403e7a828ea84d74a1b39b9783e
Python
3,447
92
import os import pandas as pd import numpy as np import pcntoolkit as ptk from pcntoolkit.util.utils import create_design_matrix from pcntoolkit.dataio.fileio import save as ptksave from pcntoolkit.dataio.fileio import load as ptkload # globals root_dir = '/project_cephfs/3022017.02/projects/hansav/Run8_f/' data_dir ...
686c065145f0ab5b979e56cc89e8344ecee227c21811cbdfcdbfbebbede57131
Python
3,447
129
import shutil import sys from pathlib import Path import pytest try: from pyspark import SparkConf, SparkContext from pyspark.sql import SparkSession has_spark = True except ImportError: has_spark = False from data_profiling.config import Settings from data_profiling.model.summarizer import Profilin...
dd4defc5fe0d98f2cc494660bdafb2d236f18c38f3ba874f2d8ff6a38cb11d4b
Python
3,448
117
import os import pytest import ray import ray.cluster_utils from ray.exceptions import CrossLanguageError, RayActorError # plus.so / counter.so are staged next to this file via the bazel # target's `data` attr; resolve them absolutely so the worker finds them # regardless of its cwd. _CODE_SEARCH_DIR = os.path.dirna...
99fa116d64c96e0d61d5c464d45009bcb094880a051a0a1a20e0ea0f8e1eb14c
Python
3,449
111
import unittest from spinnaker2 import mapper, snn, hardware class TestMapping(unittest.TestCase): def test_add(self): m = mapper.Mapping() p1 = snn.Population(20, "lif", params=None) pe_0_0_0 = hardware.PE(0,0,0) pe_0_0_1 = hardware.PE(0,0,1) p1_1 = mapper.PopulationSli...
a7c623d74cc995f55c93386f622a9650ca13721cfd83d3d3fad2004805b83e52
Python
3,450
82
import numpy as np from typing import List, Tuple, Dict, Optional, Union from whitenoise import RandomNoiseFrameGenerator from lib.data_utils.sta_metadata import RGB_CONVERSION class WhiteNoiseSynchroSection: def __init__(self, frame_gen: RandomNoiseFrameGenerator, trigger_times...
98b0370c6c615c07271b5674eb4f4e6c0bae93ad4677dfcaf68fc723e6734d48
Python
3,451
100
''' simple_viewer.py A simple viewer to demonstrate the image capture capabilities of an Azure Kinect device using the Python API. This is not the fastest way to display a sequence of images; this is only meant to show how to capture frames in a sequence. Requirements: Users should install the following python packa...
e8dd654c722a36c7683df7c187b2dc72e93cb4548876fd54c85d2698612d3e2c
Python
3,452
97
#! /usr/bin/env python import sys import re import numpy as np import os import iced from iced.io import loadtxt, load_counts, savetxt from scipy import sparse def load_bed(filename): ''' Load a BED file using numpy Parameters ---------- filename : str, path to the file to load. The file ...
0b362f9330e16e852cd1cd8838b4ec7c4eb9549ec544999e941abc29a0359115
Python
3,453
110
from typing import Annotated, Any, Callable, Iterable, Literal import numpy as np from numpy.typing import NDArray from sklearn.base import BaseEstimator from sklearn.metrics import get_scorer from sklearn.model_selection import ( BaseCrossValidator, cross_val_score, train_test_split, ) from siapy.core im...
26b95dc8e89e34bdbaa1884079f13a00cd2718941e1cd4573e07250a285afd53
Python
3,453
100
import numpy as np import wfdb from scipy import signal as sgn import torch from src.dataset.utils import compute_weights, remove_baseline_filter BASELINE_FILTER_400 = remove_baseline_filter(400) def map_ptb_to_swedish(traces, new_length=4096): # we have the leads in the following order: # DI, DII, DIII, AV...
68335c4e9bd105e4642a7e26ed5eed75c94638164285c28800f9d16efd532b17
Python
3,453
61
# -*- coding: utf-8 -*- import sys import numpy import mozaik from parameters import ParameterSet from mozaik.models import Model from mozaik.connectors.meta_connectors import GaborConnector from mozaik.connectors.modular import ModularSamplingProbabilisticConnector from mozaik import load_component from mozaik.space i...
07d322429b15583e1f4ee27ed46506e46b3ababd91214e74cf32bd41c36dd625
Python
3,454
98
import numpy as np import pyvista as pv from lib.surface import find_boundary_vertices, read_surface_from_gifti, write_label_gii from lib.utils import setup_logger # Setup logger log_file = snakemake.log[0] if snakemake.log else None logger = setup_logger(log_file) logger.info("Loading surface from GIFTI...") surface...
04732db3f894b1042d7f2f8498599ccddebdae511801179f496d5ae58997350d
Python
3,455
92
import os import pandas as pd import numpy as np import pcntoolkit as ptk from pcntoolkit.util.utils import create_design_matrix from pcntoolkit.dataio.fileio import save as ptksave from pcntoolkit.dataio.fileio import load as ptkload # globals root_dir = '/project_cephfs/3022017.02/projects/hansav/Run8_fs/' data_dir...
a0ff2e9f81b90f5617afede34f2c23d2cec3d910f15997984d8956c7dc642c80
Python
3,455
106
r"""``ov.epi.datasets`` — fetch-on-demand example epigenomics datasets. Convenience wrappers over epione's pooch registry (:func:`epione.utils.register_datasets`). Each fetcher downloads (once, then caches under epione's pooch cache) a small public dataset suitable for running an ``ov.epi`` tutorial end-to-end, mirror...
3408a3ad6af439cc5af7afb5d68835d25f66c5919e703237a216fdc1c27f47ea
Python
3,457
103
import os import glob import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns SUBS = ['sub-05', 'sub-06', 'sub-07', 'sub-08', 'sub-09'] ROOT = '/Users/sebastiandresbach/data/neurovascularCouplingVASO/Nifti' # ======================================================================...
515266b946ce415521c877163821c86618069667e2cfc44ea9618356481bed8e
Python
3,457
92
#################################################################################################### # 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...
5ae7e19d6f01e6a31393aa8836ced09c0be8871a96b9714f94bdff8df4dddecf
Python
3,457
90
import os import sys from typing import List from unittest import mock import pytest from ci.ray_ci.anyscale_docker_container import AnyscaleDockerContainer from ci.ray_ci.container import ( # _DOCKER_AZURE_REGISTRY import temporarily commented out: Azure image # push is disabled due to CI issues. # _DOCK...
821b83848e5ba90164042085900d09c7797f3df31746b0c9c12b30346d3c77ab
Python
3,458
100
import numpy as np from hic3defdr.util.progress import tqdm_maybe as tqdm try: from sklearn.metrics import roc_curve, confusion_matrix sklearn_avail = True except ImportError: sklearn_avail = False roc_curve = None confusion_matrix = None def make_y_true(row, col, clusters, labels): """ ...
445826a700ed12bbcde69bbf0dc42991944ef236e292aae4da7fa50a3d87bc83
Python
3,459
88
import sys import json import copy import argparse import subprocess from lop.utils.miscellaneous import * def main(arguments): parser = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('-c', help="Path of the file contai...
a919d1013cbb4cc0f9cb000e402089dc72b89b8030ebdd9e174b7f23bcdd611e
Python
3,459
95
import time from dataclasses import dataclass from typing import Callable, FrozenSet, List, Optional from .base_autoscaling_coordinator import ( AutoscalingCoordinator, LabelSelector, NodeResources, ResourceDict, ResourceRequestPriority, ResourceRequestStrategy, ResourceType, ) class Fake...
e4d2489f97630e3446734cb96ead56fa19c6491bbbc5ae210e05d57a1168f5c4
Python
3,459
90
import os import sys project_root = '/ccb/cybertron/khchao/splam-analysis-results/' input_file_dir = f'{project_root}train/results/RefSeq_ALTS/BAM_REF_Intersection/' output_dir = f'{project_root}train/results/RefSeq_ALTS/INPUTS/' def main(): SEQ_LEN = sys.argv[1] HALF_SEQ_LEN = int(SEQ_LEN) // 2 QUATER_S...
d1a4abd16726c962f9144a8bdbc144f93314f7a390ca377b9976cd3ca414178f
Python
3,460
98
""" 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. This submodule contains the scripts that the we used to run VASP. Note that some of these scripts were taken and modified from [GASpy](https:/...
46aae557c7d9d2ae5c53a9dbf07c9c9b900bf363311d489304dc642eb48ca4f4
Python
3,461
96
# built-in dependencies import os from typing import Any, List # 3rd party dependencies from numpy.typing import NDArray # project dependencies from deepface.models.Detector import Detector, FacialAreaRegion class MediaPipeClient(Detector): """ MediaPipe from google.github.io/mediapipe/solution...
a211106364e1e1167799065ec44715a9579a9c423cda784e2afb9acb4fdeb9dc
Python
3,461
107
import random from imports import * from fixtures import FIXDIR #from .. import bam_to_qualdepth as btqd from ngs_mapper import bam_to_qualdepth as btqd def rand_info( ): ''' Generates random parse_pileup() info ''' depth = random.randint(0,1000) quals = [random.randint(0,40) for i in range(depth)] r...
4a243be062923edad67a7942d65223b7728a97109893f6712240dca3b064bb7c
Python
3,462
121
#!/usr/bin/env python # -*- coding: utf-8 -*- # """ Clean records in VCF based on de novo filter results """ import argparse import sys from collections import defaultdict import pysam import svtk.utils as svu from svtk.famfile import parse_famfile def set_null(record, sample): dat = record.samples[sample].item...
3c7026c679ebbeb9e73a479ff5f5d811113bf2a47d9a9beddee8fea7c0bd627b
Python
3,463
93
#################################################################################################### # 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...
853c042636b44115223f2b57266f440310608ddcfdfb2bda70e839618ec8162a
Python
3,463
129
'''Some helper functions for PyTorch, including: - get_mean_and_std: calculate the mean and std value of dataset. - msr_init: net parameter initialization. - progress_bar: progress bar mimic xlua.progress. ''' import os import sys import time import math import torch import torch.nn as nn import torch.nn.i...
f9ec33844bd23397e4c702e2ea33b538238401569201cc0461b29608a6bc1fcf
Python
3,463
124
import json import logging logger = logging.getLogger(__name__) def _to_dict(value): if isinstance(value, str) or isinstance(value, int) or isinstance(value, float): return value else: return value.to_dict() class BaseVocab(object): def __init__( self, counter=None, ...
ca74684bb036ef7f742002cfd5e4e14d403f675fa93ed96d8305a7572572d2f9
Python
3,464
103
from abc import ABC, abstractmethod from collections.abc import Callable from functools import wraps from typing import Any from numpy.typing import NDArray import numpy as np import torch class Imputer(ABC): ''' ... ''' def __init__(self, modalities: dict[str, dict[str, Any]], is_embedding: di...
dc7f4f1ecd3582a6cfa02be23e7e2336c69f860a0cbb5f43033faf03660889fe
Python
3,464
114
""" 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 numpy as np from ase import Atoms from ase.build import bulk, fcc111, molecule from ase.build.su...
7133874ffc5b44c469723db92082031dea2f79f519676dea01ba1218f79a5b5c
Python
3,465
92
import tensorflow as tf from models.deep_learning.deep_learning_models import DLRegressor from utils.constants import is_spline class ConvLSTMRegressor(DLRegressor): """ This is a class implementing the ConvLSTM model for time series regression. """ def __init__( self, output_...
79380f2160304f13f4ee04e8425b727e647fccce1a4dc1d1d58aec5d70111443
Python
3,465
93
import os import re from os.path import join from typing import Dict, List import numpy as np import pandas as pd from numba import njit from sklearn.metrics import classification_report @njit def correct_labels(y_true: np.ndarray, y_pred: np.ndarray, child_matrix: np.ndarray): """ Update predictions. If...
9c9ce1d515d08ecf5216c6fd83f724f60b62ce3a8cead2c4f04cc2bca074e8f6
Python
3,465
97
import pandas as pd import os def get_hg38_chrom_size(): f_chrs = open("../hg38_chrom_size.tsv", "r") lines = f_chrs.read().splitlines() chrs = {} for line in lines: eles = line.split("\t") chrs[eles[0]] = int(eles[1]) return chrs def main(): THRESHOLD = "100" SEQ_LEN="800"...
3066212322d473dac00b447a952f567f077a2a32969aabd3a5727256b3d0baea
Python
3,467
80
# unet from mwr yuntao7.28 version import tensorflow from tensorflow.keras.layers import Dropout, Activation, BatchNormalization from tensorflow.keras.layers import Add, Input, Conv2D, MaxPooling2D, UpSampling2D, Conv3D, MaxPooling3D, UpSampling3D from tensorflow.keras.layers import Concatenate from tensorflow.keras.mo...
0f7747108d7b503a48f1187403ec466d9c55f76adb0aa85264b0dd9c644d52c7
Python
3,468
103
# Copyright (c) DP Technology. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np from functools import lru_cache from unicore.data import BaseWrapperDataset class TTADataset(BaseWrapperDataset): def __init__(self, datase...
5159d4a652d2c21ceef35132c3d2fe5b8fca8c719fbda0be021705244fe3f1ee
Python
3,468
103
import asyncio import logging from aiohttp.web import Request, Response import ray.dashboard.optional_utils as optional_utils import ray.dashboard.utils as dashboard_utils import ray.exceptions from ray._raylet import NodeID from ray.dashboard.modules.reporter.utils import HealthChecker routes = optional_utils.Dashb...
a0883987b7e908ff7824660471253df1ee84a32d45b45f4c4809b339da4d4622
Python
3,470
100
PARAMS = { "input_space_type": "mozaik.space.VisualSpace", "input_space": {"update_interval": 7.0, "background_luminance": 45.0}, "visual_field": { "centre": (0.0, 0.0), "size": (7.0, 7.0), }, "sheets": { "retina_lgn": { "component": "mozaik.models.vision.spatiote...
096c369578a7214f8fccf0df94b057e05ad1bb47445630f0622f7ed2cc922aae
Python
3,472
148
""" Created on Tue Mar 21 14:35:00 2025 @author: ju-bar Functions implementing interatomic potentials This code is part of the 'emilys' repository https://github.com/ju-bar/emilys published under the GNU General Publishing License, version 3 Remarks: The notation is in so-called "metal" units, where [charge...
89304306efd0ee4443155c57c11512720f9d6ac9061a0af1bfa1db958d3651d1
Python
3,473
142
"""Common util functions (e.g. missing in Python).""" import collections.abc import contextlib import os import platform import subprocess import zipfile from datetime import datetime, timedelta # Image type detection from pathlib import Path from typing import Mapping import pandas as pd import requests from data_...
95f20992ec2039bcf972f794906fe733208c619809361c4eac811c2fc58b5ddb
Python
3,474
181
r""" Set the color palette for plotting. Reference --------- https://github.com/scverse/scanpy/blob/master/scanpy/plotting/palettes.py """ from matplotlib import cm, colors # Colorblindness adjusted vega_10 # See https://github.com/scverse/scanpy/issues/387 vega_10 = list(map(colors.to_hex, cm.tab10.colors)) vega_10...
87fcf6fbd8fd9d1fd7c3d0113b97540e74545e7546130324c87f4bb776d11fbf
Python
3,475
109
from functools import partial from warnings import warn from typing import List, Optional, Set import pandas as pd import numpy as np def _check_features(df, features: List[str]) -> Set[str]: valid_features = set(df.index) & set(features) if len(features) != len(valid_features): w...
92e27efdcee178a8cc9893f7035ed4f963a370f636927f9fadca2062dfad20b0
Python
3,476
95
import torch import torch.nn as nn import numpy as np from torch.optim import AdamW import torch.optim as optim import itertools from model.warplayer import warp from torch.nn.parallel import DistributedDataParallel as DDP from model.IFNet import * from model.IFNet_m import * import torch.nn.functional as F from model....
94aa22659d0eb91a0ce69d33f50543ebdba7606c9e189fc33fafb4e84e73840c
Python
3,476
90
import sys, os import argparse import concurrent.futures as cf import numpy as np import pandas as pd import torch os.environ.setdefault('PROJECT_DIR', ".") sys.path.append(os.environ['PROJECT_DIR']) from src.models.model_whole import prepare_model, add_model_args from src.models.components import MeanPooler, StartPool...
78cd40d3ee2140ecb7de4fdc19a495a711ffa5be87655c14d54a95869920179b
Python
3,477
99
# # CEBRA: Consistent EmBeddings of high-dimensional Recordings using Auxiliary variables # © Mackenzie W. Mathis & Steffen Schneider (v0.4.0+) # Source code: # https://github.com/AdaptiveMotorControlLab/CEBRA # # Please see LICENSE.md for the full license document: # https://github.com/AdaptiveMotorControlLab/CEBRA/bl...
3e8fba4af3e50aee59c1a9574da7cabe8fba972bbb64aa7f44e8402476170e11
Python
3,478
105
#!/usr/bin/env python # -*- coding: utf-8 -*- # ------------------------------------------------------------------------- # Created By : Kangjoo Lee (kangjoo.lee@yale.edu) # Last Updated: 08/06/2024 # ------------------------------------------------------------------------- # =========================================...
4a0a42b17b5e2fb73425dbc322268e391b7392f3e86b1b82d4c15cf445415e00
Python
3,478
104
import os from importlib.util import find_spec from typing import List, Union import torch import ray import ray._private.ray_constants as ray_constants from ray._private.accelerators.npu import ASCEND_RT_VISIBLE_DEVICES_ENV_VAR from ray.air._internal.device_manager.torch_device_manager import TorchDeviceManager de...
88fdbc50c996a6cbdd2f8ef3f48715820e12a9ab90e2d44ab1b117f9200dc051
Python
3,478
92
#################################################################################################### # 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...
abd5ee2be17059b7c4e3425008fc2d0c75639381ff2a039ae7522a188128c12a
Python
3,478
113
import logging from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union from ray.data._internal.delegating_block_builder import DelegatingBlockBuilder from ray.data._internal.util import _check_import from ray.data.datasource.file_based_datasource import FileBasedDatasource if TYPE_CHECKING: impo...
4d2406e3ace5588ec00451b72b5df193c005cdd4aaf8f058eb2113a0409bc7fe
Python
3,479
89
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import matplotlib.pyplot as plt import pdb from numpy.fft import ifftshift from torchvision.transforms import Resize import fractions import math def fft_conv2d(img, psf): img_fft = torch.fft.fft2(torch.fft.fftshift(i...
d0c25bdbcf9fa86616a7d83946307bdc99a1c2f2c11de868acae4757b160a912
Python
3,481
104
import nibabel as nib import numpy as np from lib.qc_srcsink import compute_qc from lib.surface import ( assign_boundary_terminals, read_surface_from_gifti, write_label_gii, ) from lib.utils import setup_logger log_file = snakemake.log[0] if snakemake.log else None logger = setup_logger(log_file) nmin = ...
38292c40069e757d4296f4f2ee0c718a0d41a3bb5b343eb766f0e4349955f450
Python
3,482
108
import numpy as np from numpy.linalg import inv from sklearn.mixture import GaussianMixture def construct_landscape(sc_object,thresh_cal_cov = 0.3, scale_axis = 1.0, scale_land = 1.1, N_grid = 100, coord_key = 'X_umap'): """ Function to construct the landscape of the multi-stable attra...
50238415164c84a0cbdcf3a0a6d9d1b98e1e260b4cb87f5c5ec11dae043e9b92
Python
3,482
75
# location for defining the Pytorch model architecture that will be read in during model training import torch import torch.nn as nn import torch.nn.functional as F # a version of the model for hyperparameter optimisation, that has the opportunity to change the model hyperparameters on init class LSTM_Drop...
135d65571c9c58586fc80189820c5fce8db1905c6cac7f7b2cd2bcc989f3e8b1
Python
3,483
96
from typing import Dict import numpy as np import pandas as pd import tensorflow as tf from ml4ht.data.data_description import DataDescription from data_descriptions.echo import VIEW_OPTION_KEY class EcholabDataDescription(DataDescription): # DataDescription for a wide file def __init__( self,...
53128829de5c13ecc2644cafa95e897626845b62b9057bcf80fff024aab1f457
Python
3,485
118
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....
0b70f9e876dd085ec1da548941d21b37a743666ef3e48a8829fe3cc869defdd7
Python
3,486
89
""" Created on Sun May 30 19:40:39 2021 @author: trmabdelaal """ import scvelo as scv import scanpy as sc import numpy as np import pandas as pd import seaborn as sns from matplotlib import pyplot as plt from sklearn.metrics.cluster import contingency_matrix import sys sys.path.insert(1,'SIRV/') from m...
9b90e76beb4769c0a5d043fc3b3e8cb3a73d48888df996afe7561716ba367c23
Python
3,486
104
# built-in dependencies from typing import List, Union, cast # 3rd party dependencies import torch from torch import nn, Tensor # project dependencies from deepface.commons import weight_utils from deepface.models.facial_recognition.pytorch.TorchFacialRecognition import ( TorchFacialRecognition, load_model_we...
df3cc5f57f3c250750cb82bb9ad822f11bf7c3fbfce8a430574ebb28e5e32d22
Python
3,486
137
import numpy as np import argparse import pandas as pd import math import pdb import Bio.Seq as bioseq def oneHotFromSeq(inputStr, seqLength): #, seqOrient="+"): # See if this is empty # If so, return a zero'd vector # pdb.set_trace() if not ((isinstance(inputStr, str)) ): return (np.zeros((4, seqLength))) #...
e73c06abb02c43ebcb463f22dcf5207497345b80e27b1741d158079688c2e806
Python
3,486
86
import torch import logging from torch.utils.data import TensorDataset from sklearn.model_selection import train_test_split from sklearn.feature_extraction.text import TfidfVectorizer from agent.data.entities.config import FC_CLASS_VALUES from agent.classifiers.utils.class_mgmt import get_number_of_classes, get_numer...
bf5efcd44cf720b2579736854de7cfd370c8ae5602aa59e97cbf5b3fe05f17b7
Python
3,487
108
"""Predefined units and system names.""" from openmm import unit from openmmtools.constants import kB ### define units distance_unit = unit.angstrom time_unit = unit.femtoseconds speed_unit = distance_unit / time_unit # constants stepsize = 1 * time_unit collision_rate = 1 / unit.picosecond temperature = 300 * unit...
ea21ac08169f8e3850f5d405e988385c92525123be0383dfdb043f147e457cd5
Python
3,487
101
"""TLS utilities shared across Ray libraries (e.g. Serve).""" import datetime import os import socket from typing import Tuple from ray._common.network_utils import ( get_localhost_ip, node_ip_address_from_perspective, ) def generate_self_signed_tls_certs() -> Tuple[str, str]: """Create self-signed key/...
641b84a4e85009fb07297c757bcce0c8d97c962ab24f5b63f7e761b3643e4494
Python
3,488
85
from abc import ABC, abstractmethod from typing import Generic import pyarrow as pa from ray.data._internal.datasource_v2 import InputSplit from ray.data._internal.datasource_v2.interfaces.reader import Reader from ray.util.annotations import DeveloperAPI @DeveloperAPI class Scanner(ABC, Generic[InputSplit]): "...
a74253952ae63d5c6713bed3c0bca1842180aa670056f6393320b9ff1e3677ed
Python
3,490
144
import os import sys import time import errno import time import timeit import numpy as np from numba import jit import warnings warnings.simplefilter("ignore") @jit(nopython=False) def VEP2Dmodel_sensor(params, constants, init_conditions, SC, Gain, dt, ts): nt=ts.shape[0] nn=SC.shape[0] ns=Gain.sha...
f46625665e9b2d8faa2e447fa93669523fb8606c1f03bb5d3bb6ed957cc42547
Python
3,490
90
import torch.nn as nn import torch from torchvision import models def create_conv2d_block(in_channels, kernel_size, n_filter, dilated_rate=1, batch_norm=True): # padding formula https://discuss.pytorch.org/t/how-to-keep-the-shape-of-input-and-output-same-when-dilation-conv/14338 """ o = output p = pad...
77508f7dd91b30d9bbdbb55c533faa499c97f4b24743b3640d9ce0223423114e
Python
3,491
145
import numpy as np import sympy as sp from goodness_of_fit import goodness_of_fit def fitting_solving(data, tmp_min, tmp_max): # Two types sorts = ['concrete', 'football'] # The degree of polynomial fitting. fitting_num = 5 R_thres = 0.98 with open('results_all', 'a') as datatmp: ...
7cba2ac3676c788e0de9af4cdbf8763b6cde29d01fe8e7c0a15dc450f8a33d2d
Python
3,492
102
from __future__ import division import scipy as s import numpy as np from .. import gpu_utils from ..gp_utils import covar_to_corr from .variational_nodes import * from ..gp_utils import * # TODO: for large number of groups avoid constructing Kmat if spectral decomp and only save x at the end (getParameters in SigmaN...
345f8999a80e75fe850d62ee075b4ad3127ed72641ca7dcde4a425dca85d8fc3
Python
3,493
40
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: i_input_file.proto """Generated protocol buffer code.""" from google.protobuf.internal import builder as _builder from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_...
b191eacd742b0dd1366568f0af7387561a76408d717fe7bec78c796f3ccfea2d
Python
3,494
129
from abc import ABCMeta, abstractmethod import torch from pfrl.agents.dqn import DQN from pfrl.utils.recurrent import pack_and_forward class AbstractDPP(DQN, metaclass=ABCMeta): """Dynamic Policy Programming. See: https://arxiv.org/abs/1004.2027. """ @abstractmethod def _l_operator(self, qout)...
bb84a966f713006c0d1a678165db29cd275b6279b950c4b535340d28a178ab58
Python
3,496
105
#!/usr/bin/env python from __future__ import print_function import argparse import glob import gzip import math import numpy as np import sys def parse_args(): parser = argparse.ArgumentParser("Makes plots and reports details of vcfeval output") parser.add_argument('--input_bed', '-i', dest='input_bed', req...
759c7082ad205da3e220757a6cc26f5f4d33993ce887b535ae18d423b4fcc051
Python
3,497
114
# 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, ...
8c1d130a451e11526181524c46ef688dcb95b92bdf204ef57bf7bba8fa1e1044
Python
3,497
91
import os import sys project_root = '/ccb/cybertron/khchao/splam-analysis-results/' input_file_dir = f'{project_root}train/results/ALL_RefSeq/BAM_REF_Intersection/' output_dir = f'{project_root}train/results/ALL_RefSeq/INPUTS/' def main(): SEQ_LEN = sys.argv[1] HALF_SEQ_LEN = int(SEQ_LEN) // 2 QUATER_SEQ...
801998984dad46d5c08e07c4531b3016b60eda5f32a0d41c000145317b4a3932
Python
3,499
108
# # CEBRA: Consistent EmBeddings of high-dimensional Recordings using Auxiliary variables # © Mackenzie W. Mathis & Steffen Schneider (v0.4.0+) # Source code: # https://github.com/AdaptiveMotorControlLab/CEBRA # # Please see LICENSE.md for the full license document: # https://github.com/AdaptiveMotorControlLab/CEBRA/bl...
7b4c08404bb13443c8042c3fa1e8ef3050cc0ec08a0beb0e316c14d3863c5da7
Python
3,500
96
from typing import Any, List, Optional import numpy as np from pyspark.sql import DataFrame from data_profiling.config import Settings from data_profiling.visualisation.missing import ( plot_missing_bar, plot_missing_heatmap, plot_missing_matrix, ) class MissingnoBarSparkPatch: """ Technical Deb...
fbcd866830f0628e1351cf8408a4467c02922571d2b92474b462d7627663303f
Python
3,500
92
import os import re import json import torch project_root = '/ccb/cybertron/khchao/splam-analysis-results/' output_dir = f'{project_root}train/results/ALL_RefSeq/REF_junctions/' def chr_name_convert(): f_chrs = open(f'{project_root}/Dataset/Refseq_2_UCSU_chromosome_names.tsv', "r") lines = f_chrs.read().sp...
5b70896430a93a46af8fc87fe9adb8781f759b181a99f06e5b1b5ef40a1d88d9
Python
3,501
85
import os import json import torch import pandas as pd from .data import prepare_test_loader from .model import GeneformerMultiTask def evaluate_test_dataset(model, device, test_loader, cell_id_mapping, config): task_pred_labels = {task_name: [] for task_name in config["task_names"]} task_pred_probs = {task_n...
7b1c2b7f76b08c84fd42e673efeeaea2b13166a1731bc7886bd767b0bf5c462d
Python
3,501
84
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...
d529f9b51140e3cb192c22a584b56326888ed1d65f460863e40bfbc7b3c3967d
Python
3,502
129
from typing import Dict, Optional, List, Any import logging import copy as cp import numpy as np from scipy.interpolate import interp2d import xarray as xr from argschema.argschema_parser import ArgSchemaParser from neuron_morphology.transforms.upright_angle._schemas import ( InputParameters, OutputParameters) f...
a5261f8c44ea709840c64df873c3e8e5ef1b2708af8ab8b3d2d5d90f90c8f0d0
Python
3,503
99
# Ultralytics YOLO 🚀, GPL-3.0 license import torch import torch.nn as nn import torch.nn.functional as F from .metrics import bbox_iou from .tal import bbox2dist def wasserstein_loss(pred, target, eps=1e-7, mode='exp', gamma=1, constant=12.8): center1 = (pred[:, :2] + pred[:, 2:]) / 2 center2 = (target[:,...
190a604a1c9ff00766b3d8c1828521325400804fe21628bd2e25328ec012fd60
Python
3,505
113
from pathlib import Path from typing import Literal import math import pickle import json import matplotlib.pyplot as plt import argparse import logging import pandas as pd import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from timm.utils import ModelEma from timm.loss import Label...
4861612a4bdd35cc89ab78010bf16a387c897835d51f8d9f4bfe60a5143387c3
Python
3,505
112
import tensorflow as tf from tensorflow.keras import backend as K import os, sys import matplotlib.pyplot as plt from utils import * import gc sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import matplotlib.pyplot as plt; plt.rcdefaults() from keras.models import load_model from pkg_re...
7a360152f4e209b1dd60fa9295607a26a00e2ca9dedb730b0245d67adc74f0ae
Python
3,505
101
import numpy as np import scipy.sparse as sp import torch import torch.nn as nn import torch.nn.functional as F from ..utils import to_sparse_tensor __all__ = [ 'GCN', 'GraphConvolution', ] def sparse_or_dense_dropout(x, p=0.5, training=True): if isinstance(x, (torch.sparse.FloatTensor, torch.cuda.spars...
93fb1a7ea17dbb306f644c9da61f8dc29b131427dbbd6a990954bad6fbb1b2de
Python
3,507
97
def draw_colormap(position, length, radius, material, color_list, resolution, options): # Add the maximum value string maximum_value_string = create_text_object(text_string=bpy.context.scene.NMV_M...
0fd97459fbb4cfe83b6cf21b098ac05702d4660c8823b7c0a4db44cf1e95a828
Python
3,508
90
# -*- 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. #...