sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
80ba258912d40c56d1e4275b22eb0bd714b08a38247702de645e00ceb0b7d71f
Python
10,537
397
import os import sys import warnings import torch import pickle import numpy as np from itertools import product from scipy.stats import sem from torch.nn.functional import smooth_l1_loss from copy import deepcopy from scipy.linalg import qr eps = np.finfo(np.float32).eps.item() def is_even(number): if number %...
331d6b434b8ef370a603ad35893009afc84402417078c4f63b5707d4ae1dfd8e
Python
10,545
239
import os import numpy as np import pandas as pd import scipy.sparse as sparse from lib5c.util.system import check_outdir from lib5c.util.statistics import adjust_pvalues from hic3defdr.util.printing import eprint from hic3defdr.util.clusters import load_clusters from hic3defdr.util.simulation import simulate from h...
37d7a19c064b410cda63bad5a7cbce3c8d7f88c5d8d16bd889437087267f6f7f
Python
10,552
291
""" 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. Tests: Inference-performance regression check — measures throughput (atoms/sec) on a bulk-MgO supercell for each pretrained mo...
f8709b40d33fcd94638d894648c797933155eec46fa1319cce65c9bbbb8c1448
Python
10,558
293
""" Adapter for AnnData-stateful functions. Handles tools that require ``adata_id`` and typically mutate the dataset in place. Records state changes (produced keys) after execution. """ from __future__ import annotations import json import tempfile from typing import Any, Dict, List, Optional, Set from .base impor...
11f02913a901eebcd40cf4ced5b89b3e20cb0bb771c3f5839d72e65904b38a64
Python
10,565
213
#!/usr/bin/env python3 import argparse import os import jax as jnp import numpy as onp import torch import torch.nn as nn from music_spectrogram_diffusion import inference from t5x import checkpoints from diffusers import DDPMScheduler, OnnxRuntimeModel, SpectrogramDiffusionPipeline from diffusers.pipelines.spectrogr...
2d761b727874f5e42e7edcc688126c007dbb624de9a4f39b796e19fd8c1cb7fa
Python
10,570
244
from __future__ import annotations import warnings from typing import TYPE_CHECKING from datetime import datetime from packaging.version import Version from scanpy import settings from ._compat import old_positionals from ._scale import raise_not_implemented_error_if_backed_type from ._neighbors import _choose_repre...
5c520d66fa3230c70bd875e47c02a67f2a7b273c9d8b4f4a445c5ddf22dfe1e4
Python
10,573
274
import os import pickle import pandas as pd import numpy as np import nibabel as nib import pcntoolkit as ptk from pcntoolkit.dataio.fileio import load as ptkload from pcntoolkit.dataio.fileio import save as ptksave from pcntoolkit.dataio.fileio import save_nifti, load_nifti from pcntoolkit.normative import predict, e...
996449ee17f9b841a32b2ffdd8f17103892a663c521c0f22dc517d4a5a961a27
Python
10,575
245
# import sys # sys.path.append('..') import pandas as pd import torch import json import toml import argparse import sys import os import monai import nibabel as nib from data.dataset_csv import CSVDataset from adrd.model import ADRDModel from tqdm import tqdm from collections import defaultdict from icecream import i...
c2ad2d3bd6da9a26222a3404f8fd6e9570185f5218badbea1898191249b096c8
Python
10,587
266
""" 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 os import pickle import omegaconf import torch from fairchem.core.scripts.migr...
98d0dbd1cd7aa133b3a2d6ca9e2c8f7fd5859eea5a7ce2e6350c64db384f0640
Python
10,609
225
import os import pyvips import sklearn import torch import numpy as np import datetime import cv2 import sklearn.metrics from timeit import default_timer as timer import json import matplotlib matplotlib.use('Agg') from matplotlib import pyplot as plt import glob from torchsummary import summary impo...
175a45aaa4b71692fb4a27cd326eb1a0d2ab4c44f9584900dae4933f1516cf79
Python
10,610
230
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Dec 6 16:08:47 2021 @author: sam """ import math import numpy as np import h5py import matplotlib.pyplot as plt import scipy import tensorflow as tf from tensorflow.python.framework import ops import pickle import keras from keras import layers from ke...
c55f575b5dbf3b1efee0b2b8689cedeba10d2c72e987b3768d2d819bb9db502f
Python
10,619
316
# 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, sof...
0e01e9e7d2838b3f3365756b999dabe4565a8393385860a79213186389b59d24
Python
10,622
276
#!/usr/bin/env python # -*- coding: utf-8 -*- # ------------------------------------------------------------------------- # Created By : Kangjoo Lee (kangjoo.lee@yale.edu) # Last Updated: 08/06/2024 # ------------------------------------------------------------------------- # ========================================...
98cb995b38dec8661afba4e7df618befaa2ce884e8e5d9b30850887be5c2797d
Python
10,623
258
""" Implementation borrowed from transformers package and extended to support multiple prediction heads: https://github.com/huggingface/transformers/blob/master/src/transformers/models/bert/modeling_bert.py """ from typing import Optional, Tuple, Union import torch from torch import nn from torch.nn import BCEWithLog...
1f9172501185cd0ec32a52b5d5d1ab843289f4bc9c874499174741b38c0f0609
Python
10,625
278
# %% import ast import inspect import os from pathlib import Path from typing import Optional import pytorch_lightning as pl import typer import torch from typer_config import conf_callback_factory from typing import Union, List from typing_extensions import Annotated from .utils.dataloader import MultiEpochsDataLoad...
77a96af0949ecec479e61381b4d482b606eae50f1bb436c2a036c83ed4390c53
Python
10,627
292
# 3rd party dependencies import cv2 import numpy as np # project dependencies from deepface import DeepFace from deepface.commons.logger import Logger logger = Logger() detectors = ["opencv", "retinaface"] def test_standard_analyze(): img = "dataset/img4.jpg" demography_objs = DeepFace.analyze(img, silent...
9c93de4f90e586d66b70580ed4e1cf7f11428f19d8edfceeaefa4a59972e2e7a
Python
10,633
345
""" 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. """ """The script used to perform inference for HER""" from __future__ import annotations import argparse import os import warnings warnings...
72135dff344b630d20945209620bd29b15132dbf0bfe61d09a3d4d7518c91404
Python
10,634
270
#!/usr/bin/env python """ Complete demo pipeline for processing two photon calcium imaging data using the CaImAn batch algorithm. The processing pipeline included motion correction, source extraction and deconvolution. The demo shows how to construct the params, MotionCorrect and cnmf objects and call the relevant fun...
8d9a1a7a1ea5e1f3f5914e9a5bc498b2355dadd46a1eb4f1a37ba01422faf81d
Python
10,634
251
""" This script is used to run inference on a single subject using a nnUNetV2 model. Note: conda environment with nnUNetV2 is required to run this script. For details how to install nnUNetV2, see: https://github.com/ivadomed/utilities/blob/main/quick_start_guides/nnU-Net_quick_start_guide.md#installation Author: Jan ...
02e4e25e45354d27d2bff7b41244316fb0a6cc42bd7294f867f0b00bd3d4aea2
Python
10,635
278
# # 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...
bd468d90e3c81d3ac0eac94ee0736c8aad7ec4cf6964d62f31cb0ebec938eb08
Python
10,635
270
#################################################################################################### # 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...
afed04b1d702bcfa5a2b8ea8fe24aef45e360735a46408f17d95c4ac96011e05
Python
10,640
324
#from subprocess import Popen, PIPE from math import * #import random import numpy as np #from copy import deepcopy ##from types import IntType, ListType, TupleType, StringTypes #import itertools import time #import math #import argparse import subprocess #from load_model import loaded_model from keras.utils import pad...
3a9e4bbce6963e38a944bda3f8a87a172def6055c798b7f8a2c7b680a2f5870b
Python
10,641
236
import torch import torch.nn as nn import numpy as np import scanpy as sc import anndata as ad from torch.optim.lr_scheduler import _LRScheduler, ReduceLROnPlateau from tqdm import tqdm from copy import deepcopy from ..utils.eval import downstream_eval, aggregate_eval_results, imputation_eval from ..utils.data import X...
fa7e2f5d811eb2cb7980a813d09af89bc1aa586f3be75cf8d1f5332fc1c2e238
Python
10,643
283
#!/usr/bin/env python # -*- coding: utf-8 -*- # ------------------------------------------------------------------------- # Created By : Kangjoo Lee (kangjoo.lee@yale.edu) # Last Updated: 08/06/2024 # ------------------------------------------------------------------------- # ========================================...
eddfa9531435b4f5a784a04766980a9e4678cc48663040f348ce6b86534f498e
Python
10,645
281
# -*- coding: utf-8 -*- """ Created on Sun Jun 16 12:04:00 2019 @author: ju-bar Calculation of 2-dimensional apertures This code is part of the 'emilys' repository https://github.com/ju-bar/emilys published under the GNU General Publishing License, version 3 """ # %% from numba import njit, float64 # include compila...
6ee2b044ed1563843e1fe4efdc0c397be483e07454f9265ba9b50c02b4932cfa
Python
10,647
271
from matplotlib import pyplot as plt import numpy as np import matplotlib.gridspec as gridspec/home/otprat/Documents/Neuroscience/Master/2017/MasterLab/Repos/luminance_analysis from pylab import * from scipy import optimize from pyprind import prog_percent import numba from numba import jit import random from luminanc...
4f5c614e72c8b9677fffef6d2800ce1393d3f6883bb7ebd729481f426e4c7fc0
Python
10,650
298
r"""Metabolite-Set Enrichment Analysis (MSEA). Two enrichment flavours, both keyed off KEGG-compound pathway membership: 1. **ORA** (over-representation analysis) — classic Fisher's-exact on a pre-selected hit list vs the background universe. Fast, no ranking needed. 2. **GSEA-style** — full ranked-list enrichm...
e1c7980c5cdf62b21735244c5ebdc3dcf0c73bda9143dc05dac0e707ddf9cffd
Python
10,650
340
import yaml from pathlib import Path from nyumets.transforms.utils import patch_batch, spatial_augment_batch from monai.inferers import SimpleInferer, SlidingWindowInferer from nyumets.transforms.utils import ( post_processing_transforms, cc_processing_transforms, longitudinal_transforms, ) from nyumets.m...
5bf1fd8b6798a63e6845ed0018cb2d54a14bdcb4c1432c70b58c7645d67c6135
Python
10,652
214
import pathlib path = pathlib.Path.cwd() if path.stem == 'tmb_survival': cwd = path else: cwd = list(path.parents)[::-1][path.parts.index('tmb_survival')] import sys sys.path.append(str(cwd)) import pandas as pd import numpy as np import pyranges as pr from tqdm import tqdm import json import pickle import sub...
040079c9fe184188685c0688eb2833390e9b55d7744d5e37dba721091b036565
Python
10,654
299
""" The intention of this script is to easily sync a given MiSeq run path from the sequencer into the :doc:`NGSData <../ngsdata>` structure You need to ensure that the run directory for the run you want to sync is available and that you know the path to it. Accessing MiSeq Data ==================== The MiSeq stores ...
9b72a39087da37b59b3775f0b222d2f27ce6fcc119244600a00f4fb649c7c091
Python
10,654
274
"""Pure-torch GPU t-SNE — no ``torchdr`` dependency. Implements Van der Maaten & Hinton's t-SNE KL objective directly: Q_{ij} = (1 + ‖y_i − y_j‖²)^-1 / Z, Z = Σ_{k≠l} W_{kl} C = Σ_{ij} P_{ij} · log(P_{ij} / Q_{ij}) What makes this fit on a GPU in a few seconds at 94k cells is: * ``Z`` is estimat...
d45975158f205aecf648165aaf070fa700369df8b3fadfcf405e2ac1d4991cff
Python
10,670
365
# -*- coding: utf-8 -*- # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # # import os # import sys # sys.path.insert(0, os.path.a...
6d929a2cbc4d253d32ba007b5962b9f7f46aedde8cefc06942af6272dca20dde
Python
10,671
320
import asyncio import sys import time import pytest from ray._common.test_utils import async_wait_for_condition, wait_for_condition class TestWaitForCondition: """Tests for the synchronous wait_for_condition function.""" def test_immediate_true_condition(self): """Test that function returns immedia...
cffbc035379232238829afb301be408e14cb627cea5873eea5504ac3ef37dbd1
Python
10,673
293
# Modified from https://github.com/dbolya/tide # This work is licensed under MIT license. import os from collections import OrderedDict import cv2 import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from .datasets import get_tide_path from .errors impo...
d22a9349731403ffc61f25dfec2ad8ac183509b1673a245a6149ece965a3bab0
Python
10,678
344
import logging import zipfile from dataclasses import dataclass from pathlib import Path from typing import Callable, Dict, List, Optional, Tuple, Union import numpy as np import torch from PIL import Image import flyvis from flyvis.utils.dataset_utils import download_url_to_file from .rendering.utils import split ...
22bd9069f38066b58d12264b900d95d41f06b0768ba2c38a95fe60566a581d08
Python
10,679
293
import logging from abc import ABC, abstractmethod from typing import List, Optional, Tuple from ray.autoscaler.v2.instance_manager.common import InstanceUtil from ray.autoscaler.v2.instance_manager.instance_storage import InstanceStorage from ray.core.generated.instance_manager_pb2 import ( GetInstanceManagerStat...
f73ebb07d00188ca74c71f45bf181980e402d7fb05b1feb7315e86ee1ab930a0
Python
10,683
211
import glob import json import matplotlib.pyplot as plt import numpy as np from datetime import datetime from matplotlib.backends.backend_pdf import PdfPages def convert_to_timestamp(t): return datetime.strptime(t, '%Y-%m-%dT%H:%M:%SZ').timestamp() def plot_brainage_convergence(files, metric="mae", show_globa...
afe33ac2d8c661b019abd7746537fd4db4c04e10c44c10b93dacf26397322c85
Python
10,684
356
""" Data structure validators for AnnData objects. This module provides validators that check for the presence and validity of required data structures in AnnData objects. """ from typing import List, Optional import numpy as np from anndata import AnnData from .data_structures import ( ObsCheckResult, ObsmC...
c00bf388ab8f1dcdc1c783670f6abb305dd0e0f4864f12ea04cac04431a6663b
Python
10,684
306
CODE_DIR = '/home/kelarion/github/' SAVE_DIR = '/mnt/c/Users/mmall/Documents/uni/columbia/assignment_errors/' REMOTE_SYNC_SERVER = 'ma3811@motion.rcs.columbia.edu' #must have ssh keys set up REMOTE_CODE = '/burg/home/ma3811/assignment_errors/' REMOTE_RESULTS = '/burg/theory/users/ma3811/assignment_errors/' # REMOTE_SY...
87e7e9473d687566b59677d8188885f80178af1171135cd8ac1b490f3115fc2d
Python
10,690
275
import torch import torch.nn.functional as F import numpy as np from torch import Tensor from typing import Optional from torch import nn from ..utils import create_norm from .transformer import AbstractTrasnformerLayer class CosformerAttention(nn.Module): """ cosformer attention in "cosFormer: Rethinking Sof...
4e22155d55e26b52947cc096d24a01b5c6379bb9703e62c621c705b9a57b74f7
Python
10,699
227
######################################################## ######### Philipp R. Steen ######### ######### Jungmann Lab ######### ######### Max Planck Institute of Biochemistry ######### ######### Ludwig Maximilian University ######### ######### 2024 ...
53d8f1d0ff113a204c81197aa057c45e3ee0743111f1d59a695f9ecd1ff82819
Python
10,700
304
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created on Wed Feb 24 18:39:45 2016 @author: Andrea Giovannucci For explanation consult at https://github.com/agiovann/Constrained_NMF/releases/download/v0.4-alpha/Patch_demo.zip and https://github.com/agiovann/Constrained_NMF """ from __future__ import print_funct...
2adcb05b647fa55440dc89ea0144d87bc154bfcfcd1de0b54ed920113145fe8e
Python
10,702
278
"""Programmatic entry point for the vendored CAMEX pipeline. This reproduces the glue found in the upstream CAMEX analysis notebooks (``analysis/1liver/Integrate_liver_across_4_species.ipynb`` and ``analysis/4cortex_annotation/integration_annotation_in_relatives_distant_species.ipynb``):: from CAMEX.base import D...
c1dee058e483fc734a215f7674b680bdd0b5bcc528a2208478596243bf5128ba
Python
10,702
227
from agent.classifiers.tr_ffnn_ensemble_classifier import tr_ffnn from agent.classifiers.fd_naive_item_classifier import fd_naive_classifier from agent.classifiers.data.tr_ffnn_dataset_mgmt import get_datasets as get_fc_tr_ffnn_datasets from agent.classifiers.data.tr_ffnn_dataset_mgmt import annotate_dataset as annotat...
81f811a903a924a0b891f310ceaab8725facc9c77cbabbd2f906da729cd75761
Python
10,709
281
# ML4H is released under the following BSD 3-Clause License: # # Copyright (c) 2020, Broad Institute, Inc. and The General Hospital Corporation. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # #...
02e494129c1cf5e28faa3b78a114beb16d3c91e73bd1d5a5a55c53094ec9977e
Python
10,711
361
import os import sys import pytest import torch import ray import ray.cluster_utils import ray.experimental.collective as collective from ray.dag import InputNode from ray.dag.output_node import MultiOutputNode from ray.exceptions import RayChannelError, RayTaskError from ray.experimental.channel.cpu_communicator imp...
c00b0681cec52b2329b9192acd917533b951ec42707b0b4191ac401a1214dec1
Python
10,711
328
import os import random import torch import argparse import numpy as np import pandas as pd from tqdm import tqdm import torch.nn.functional as F from torch_geometric.data import Data from torch_geometric.nn import GCNConv, Linear parser = argparse.ArgumentParser() masks = ["true", 'false'] parser.add_argument('-k',...
2b9963d8d79c9485b937b4904c14c8e733b37b7fc1003620004418a75102ef7a
Python
10,713
281
# ML4H is released under the following BSD 3-Clause License: # # Copyright (c) 2020, Broad Institute, Inc. and The General Hospital Corporation. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # #...
ddb78d044b4eec7fac351b7bee754379e07d7d61c3e2763edd7afdc94d327f28
Python
10,714
287
import numpy as np from openmm import unit import endstate_correction import pathlib from openmm.app import ( CharmmParameterSet, CharmmPsfFile, PDBFile, CharmmCrdFile, NoCutoff, Simulation, PME, ) from openmm import LangevinIntegrator from openmmml import MLPotential import mdtraj as md fro...
d142fa9bde9a1451bd344beacba7f5e32e7137c039ec2b51f979f4071b481d7c
Python
10,717
299
# -*- 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. #...
e04b7b107f39189c9a24c6c90aab50191ba25bbb1fdf3b62f5404e1db4038c03
Python
10,719
289
#!/usr/bin/env python # -*- coding: utf-8 -*- # """ """ import argparse from collections import defaultdict import pysam from svtk.genomeslink import GenomeSLINK, GSNode import svtk.utils as svu from statistics import median import numpy as np import datetime class DiscPair(GSNode): def __init__(self, chrA, po...
98bb22dbc9ced736908590218b138f7c80b3c7c3681af96bd0dc55280f2d4151
Python
10,720
304
from RNN_helpers.io import load_outputs, load_network_all from RNN_helpers.analysis import binarize_inputs, binarize_outputs import numpy as np import math import os import json from types import SimpleNamespace import sys import h5py def loadNetwork(DIR, RUN, OutputOnly=True): print("loading "+RUN) # Loading ...
b598e16d3090f492a7bc03b29e24eea1b5886ea26cbbc88a2185732a19f2b271
Python
10,720
324
# built-in dependencies from typing import List, Tuple, 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_m...
46d9a69fe02b029eb48840f1cc35f6b0d398447e097cc1d39c2c9a837f5e1296
Python
10,721
327
import os import sys import random import torch import argparse import numpy as np import pandas as pd from tqdm import tqdm import torch.nn.functional as F from torch_geometric.data import Data from torch_geometric.nn import PNAConv, Linear parser = argparse.ArgumentParser() masks = ["true", 'false'] parser.add_argu...
fc7bbf47049fb0867aca34d3a53c450866e603322e08c9e55ea43ca7e9745e98
Python
10,721
176
""" QUADRA_HC: total-body [18F]FDG-PET/CT of 48 healthy controls (test/retest), Medical University of Vienna. Download the raw data (CC BY 4.0, no registration needed): Zenodo record 16686025, version 1.1.1: https://zenodo.org/records/16686025 Single file QUADRA_HC.zip (20,184,928,484 bytes, md5 5b37cd936988a0...
4e06f51a1f15b45d45aaaed3cbb62570690eac1782ff847ac950340e3e6c796e
Python
10,724
266
# creates a 2-channel map (.csv) with random spatial segments # e.g., python create_maps.py --help # help message # e.g., python create_maps.py --out temp1.csv --seed 123 --w 50 --min_c1 0.2 --max_c1 3 --min_c2 4 --max_c2 40 # e.g., python create_maps.py --out temp1.csv --seed 123 --w 500 --png # output optional PN...
cc68bc93d9e66c5e5b0500cd5ecae268dd4f720c3f3f9d5797c0dd0dd65aa78f
Python
10,729
236
from sklearn.model_selection import RepeatedKFold, RepeatedStratifiedKFold from reval.relative_validation import RelativeValidation from collections import namedtuple from scipy import stats import numpy as np import math import logging import multiprocessing as mp import itertools import pandas as pd logging.basicCon...
d45bb1a7f8f002c3e479db75dffb8941bed349bca3ad60a90e2a924aa6a9734c
Python
10,731
291
# -*- 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. #...
5263ada3bcfd4a780c64cc1b2e3f85f82ac9c0239aa71086f8aa6edb1e010881
Python
10,733
329
import gc import numpy as np import pandas as pd import os import seaborn as sns import matplotlib.pyplot as plt from collections import defaultdict from functools import partial import scipy as sp from scipy.stats import f_oneway, linregress, ttest_ind import warnings warnings.filterwarnings("ignore") # load in dire...
8ccf5af4bbf0728252aa7f8dc5da9332044fd17bd6ae757ae2b9dcb05e0d2d89
Python
10,739
374
import inspect import os import sys import tempfile import numpy as np import pytest import nir from tests import mock_affine, mock_conv, mock_linear ALL_NODES = [] for name, obj in inspect.getmembers(sys.modules["nir.ir"]): if inspect.isclass(obj) and obj.__module__ == "nir.ir": ALL_NODES.append(obj) ...
e7c71c81fbf0a691634a863994a69018aa57ced4154a307fd9ed73495051567c
Python
10,741
327
import numpy as np import scanpy as sc import pandas as pd import scipy import math from typing import List from anndata import AnnData from sklearn.neighbors import kneighbors_graph from scipy.sparse import csr_matrix from scipy.sparse.csgraph import dijkstra # Read in def load_data(path): """ Read from the...
5cf959192fbb562fe4e534797d167434363934a01187767e1fd7f607594a417d
Python
10,743
284
''' save_training_data('data/my_training_data.npz', X, Y, XY_axes) XY_axes="SCYX" ''' import numpy as np from tifffile import imsave,imread from .image import * from .filter import discard_slices import mrcfile class Tomogram: def __init__(self, volume): self.__volume = volume def rotate_aroundZ(s...
a8fd3af0d6411bd2afe0f339a341d75340331684e10518271f5156ad57e583ab
Python
10,744
280
# # 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...
9166bf2b28fdd0540b0eb2d98e358afea3356afcb24782c8dfa1f5f83fd24492
Python
10,751
286
from __future__ import annotations from typing import TYPE_CHECKING import torch import torch.nn as nn import torch.nn.functional as F if TYPE_CHECKING: from fairchem.core.models.allscaip.configs import ( GlobalConfigs, GraphNeuralNetworksConfigs, MolecularGraphConfigs, Regulariza...
3cf75644e9b9f39f2df169431d277f9f9a3e9d7257d49e4979fa281b7fe9ca20
Python
10,755
312
#!/usr/bin/env python # Written by Greg Ver Steeg # See readme.pdf for documentation # Or go to http://www.isi.edu/~gregv/npeet.html import warnings import numpy as np import numpy.linalg as la from numpy import log from scipy.special import digamma from sklearn.neighbors import BallTree, KDTree # CONTINUOUS ESTIMAT...
2363cf3055517877a30b2dc150965173784f9eae7eff448a93a82434827470e4
Python
10,757
301
""" Module matching %GC compo distribution b/w fg and bg. """ import sys import random from Bio import SeqIO from utils import GC def fg_GC_bins(fg_file): """ Compute G+C content for all sequences in the foreground. It computes the %GC content and store the information in a list. To each G+C percen...
df6e2d7538a7d79db253127b5ff7975e2647074ae0657b1a07917228cc588756
Python
10,760
305
#!/bin/env python import argparse import sys import pysam import math from numpy import median from typing import List, Text, Dict, Optional _gt_no_call_map = dict() _gt_hom_var_map = dict() _gt_ref_map = dict() _gt_to_filter_status_map = dict() _gt_to_filter_gt_map = dict() _cnv_types = ('DEL', 'DUP') _HIGH_NCR_FILT...
4973e8a5b832fc39523961fff49406a1f30874d2fa872171e193be6b7e866a10
Python
10,761
321
import os from itertools import repeat from tqdm import tqdm import numpy as np import torch from torch_geometric.data import Data, InMemoryDataset from torch_geometric.utils import subgraph, to_networkx from .molecule_datasets import MoleculeDataset from .molecule_motif_datasets import rdkit_functional_group_label_f...
b6b3361605cecd19922c471324ed5e7fdee0cad2f6fe8852c8c0d174d8fb86ab
Python
10,763
172
import torch import logging from torch.utils.data import TensorDataset from sklearn.model_selection import train_test_split from scipy.special import softmax from agent.data.sql.sql_mgmt import get_connection, select_fields_where, update_non_text_field, update_text_field from agent.classifiers.data.tfidf_dataset_mgmt...
a584ba91b5a17a35f6735b18b66577ae0fe9ac35e360252a2ffaeb0dd4243bc6
Python
10,765
224
import time from DataPrepare import DataCook import Net import matplotlib from sklearn.metrics import mean_absolute_percentage_error, r2_score matplotlib.use('TkAgg',force=True) import matplotlib.dates as dates import matplotlib.pyplot as plt import seaborn as sns import numpy as np import pandas as pd impor...
201449e779c714678051f207b1738f17ef1a15840ce7e58b940b06683f48b9db
Python
10,769
308
import json import logging import pickle from pathlib import Path from typing import Optional, Union import numpy as np import pandas as pd from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor from sklearn.metrics import ( log_loss, mean_absolute_error, ) from sklearn.model_selection impo...
9aae4ac45ee6ae097289ced9e9fe5c3b9aa8c64c2eba3681847ecbb1fe43640e
Python
10,769
277
# 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 logging import os import numpy as np from unicore.data import ( Dictionary, NestedDictionaryDataset, LMDBDataset, AppendTokenDataset, Pr...
9353a0e14e40cf9b2ba7e1421261b48df3ecbf87096c2b5c59bcb83841c8e171
Python
10,774
270
from PIL import Image import numpy as np from ctypes import * import ctypes import copy import torch import torch.nn as nn import torch.nn.functional as F import os import cv2 import time import pdb import torchvision import scipy import scipy.ndimage import PySpin import matplotlib.pyplot as plt from ...
52fe38ee48e8aacadac277d7dff959553de05c932e5ef2a26850bca9629b3aa7
Python
10,775
253
import logging import math import warnings from collections import defaultdict from typing import TYPE_CHECKING, Dict from .backpressure_policy import BackpressurePolicy from .downstream_capacity_backpressure_policy import ( get_available_object_store_budget_fraction, ) from ray._common.utils import env_float from...
53d92079820b24396cb7013afcb8260269c4dbf7bafbcba3502ab8996946b915
Python
10,775
234
# Copyright 2021 HIP Applied Computer Vision Lab, Division of Medical Image Computing, German Cancer Research Center # (DKFZ), Heidelberg, Germany # # 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...
5cc5b4d32b28e2dff3a2e8250c4152739b0397e9471422bee065af905ca73513
Python
10,777
307
# ML4H is released under the following BSD 3-Clause License: # # Copyright (c) 2020, Broad Institute, Inc. and The General Hospital Corporation. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # #...
07a48d7b737881adbe26df1e4471667b968b522dc3d7337f1a03582d5b10ad08
Python
10,780
363
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. # pylint: disable=too-many-instance-attributes """Utility enumerators for resistive processing units.""" from enum import Enum from torch import dtype, float32...
36505a32616fb155ab6ad7b5c06158099e0516e044fdf7915602ad028449c8d5
Python
10,780
268
""" Train ridge regressors on the augmented dataset train dataset: half (2 trials) from exp, half (2 trials) from synthetic test dataset: one trial from exp other than the trials in train dataset """ import argparse import os import pickle import numpy as np import pandas as pd from itertools import combinations f...
b57523ca6ca55926e75784c93f26d6bc00bc7b12f188040ccdf85b0478b57e8f
Python
10,780
183
#----------------------------------------------------------------------------------------------------------------------------------------------- # Author: Brandon S Coventry Purdue University, UW Madison Neurosurgery # Date: 01/2024 # Purpose: This program simply plots figures of the illustrative ...
3393a7e33f20a017843e9e2ebb9ae019beccb6e3d4f472f5ecaa5007590a28d3
Python
10,783
259
from torch.utils.data import Dataset, DataLoader import torchvision.transforms as transforms import random import numpy as np from PIL import Image import json import torch import os import matplotlib from autoaugment import CIFAR10Policy def unpickle(file): fo = open(file, 'rb').read() size = 64 ...
663efe7a2787e39724bba5cf7bcd9e56d0d40b88a55d0a4f2b1157a661db430e
Python
10,786
227
import asyncio import logging from typing import List, Optional, Set import ray from ray._private.gcs_pubsub import GcsAioJobSubscriber, GcsAioWorkerDeltaSubscriber from ray.core.generated import gcs_pb2, gcs_service_pb2, gcs_service_pb2_grpc from ray.dashboard.modules.task_events.task_event_storage import ( GC_JO...
bbe099880726a339b0febdbf3ef8752b0ef877b89f62aa4a5c8ba2cf21e4d4db
Python
10,789
295
import torch from torch import nn from torch import optim from torchvision import models from sklearn.metrics import roc_auc_score from torch.optim.lr_scheduler import MultiStepLR import numpy as np def get_model(model_name, device, pretrained=False, freeze = False): #if model_name.startswith('vgg11'): # m...
92f714d2075eae802b70cbe91022693e3dc72081374f5917eb7c3a1186f2c191
Python
10,790
222
#%% import torch import torch.nn.functional as F import numpy as np from sklearn import cluster import torch.nn as nn # THis file contains definitions of encoding and decoding functions. # %% # ############################################################################# # ENCODER DEFINITIONS # Convention: x is a vect...
d056e37ea5fdd337886d22a8f6118f2a03875b138d256b38c0cb4b3669087e99
Python
10,791
204
__author__ = "Simon Andermatt" __copyright__ = "Copyright (C) 2017 Simon Andermatt" import numpy as np import tensorflow as tf import logging from mdgru.helper import argget, collect_parameters, define_arguments, compile_arguments from mdgru.model import save_summary_for_nd_images from mdgru.model.mdrnn import MDGRUN...
670fc931debd3bf113ec6fd785bfc3cfbee31b08a60ace39aafcb03df55a1cc7
Python
10,792
278
# Caution: Due to the number of hyperparameter combinations this simulation takes between 4-6 days, on GPU. import torch import torchvision import torchvision.transforms as transforms import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import numpy as np if torch.cuda.is_available(): ...
c4a5e509c6aa313a3b81049afd592af3cc54468f63a93d38a919ba75c368b8c7
Python
10,792
375
""" Make and save syllable spectrograms. """ __date__ = "December 2018 - July 2020" import h5py import matplotlib.pyplot as plt plt.switch_backend('agg') import numpy as np import os from scipy.io import wavfile from scipy.io.wavfile import WavFileWarning import warnings from ava.preprocessing.utils import _mel, _i...
f3b3cc6561a175b0118f72c8acbcd5da0d0e659368c9adef5b6fc6f903d34ac5
Python
10,792
334
""" 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 json import os from unittest.mock import patch import numpy as np import pytest from fairchem....
bfe4a8f410b1c2d04513310598bb5af9eb5a61e7d2ed2a61ca3b99c598f3319d
Python
10,796
315
import numpy as np import torch import torch.nn as nn from einops import repeat from scipy.linalg import cholesky_banded, solve_banded ### Kernels class OUProcess(nn.Module): """ Ornstein-Uhlenbeck process. Provides a sample method and a Mahalabonis distance method. Supports linear time operations. ...
63198fe048eeccb2c014f8ef8a15a5c20f716aa2e09da2f17ec223f1eb3f8968
Python
10,798
110
#!/usr/bin/env python3 import argparse import os def str_to_bool(value): if value.lower() in ('true', '1', 'yes'): return True if value.lower() in ('false', '0', 'no'): return False raise argparse.ArgumentTypeError(f"expected True or False, got '{value}'") def build_parser(): # The CL...
dc13a930f6d682fff8c3e5bbc47346b0fcb9d49d901c8e8f295b195ec519d815
Python
10,799
345
from sklearn.neighbors import NearestNeighbors from scipy.spatial.distance import cdist import numpy as np import warnings def opt_scale(X, Y, k_num, use_gpu=True, verbose=False): """ This function computes the optimal scales of landmarks. Now supports GPU acceleration via MLX (Apple Silicon) or ...
0cdd59efecb7741eebbbc1010cc2b7bab536824881f0a94b8d58ee3d4c16e871
Python
10,800
308
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created on Wed Feb 24 18:39:45 2016 @author: Andrea Giovannucci For explanation consult at https://github.com/agiovann/Constrained_NMF/releases/download/v0.4-alpha/Patch_demo.zip and https://github.com/agiovann/Constrained_NMF """ from __future__ import print_funct...
8748f427cb29deb9cc54e9b1a9e5e6dbf9a383261fc94c7c0a49aeaed2cc826d
Python
10,800
277
#################################################################################################### # 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 library is fre...
0076abb2b89211e01ae23c0c0fd7bc818499d98a7225ace22bcff05b082d9e69
Python
10,803
268
#!/usr/bin/env python """ GPU-accelerated KNN search for OmicVerse. The previous implementation called ``torch_geometric.nn.knn(X, X, k)`` (which under the hood is ``torch_cluster.knn``) on the full N x D matrix at once, plus a ``torch.cdist(X, X)`` fallback. Both materialize an ``N x N`` distance tensor at some point...
e2575875b057fdafc2525774aa694f73d42dc302a3930cec68e0ad0db398499a
Python
10,803
238
#!/usr/bin/env python from __future__ import print_function import argparse import gzip import sys import os import numpy as np import random as rand import math def parse_args(): parser = argparse.ArgumentParser("Downsample FASTQ based on length and total coverage") parser.add_argument('--input', '-i', dest...
fd6814a2bd2cf4cf934e2ee29816cc117b2ab1e5a73f8dc6ce0834bf9e7e71f9
Python
10,807
340
# -*- coding: utf-8 -*- # # lavaburst documentation build configuration file, created by # sphinx-quickstart on Fri Dec 12 11:33:09 2014. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # #...
7da588669d571122bf1f6b760fac55e501782a1ae115dd9a407c5a237de7e782
Python
10,813
235
# This is the main code used for training and testing random survival forest models for the paper # "Machine learning predicts phenoconversion from poly-somnography in isolated REM sleep behavior disorder" #%% Necessary imports import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn ...
d1565b200e33c406febe9351695de9aa469a2d03f2dddc3905e73037802a288f
Python
10,817
382
""" 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 from functools import wraps from typing import TYPE_CHECKING, Callable, ClassVar import numpy as np im...
d746093b78b13a4951fde688b607492416af25a9fabae71926926151a0628ce8
Python
10,817
254
import os # os.environ["NCCL_DEBUG"] = "INFO" import warnings warnings.filterwarnings("ignore") import scanpy as sc from tqdm.auto import tqdm from torch import nn, Tensor from .model import TransformerModel from .eval_data import MultiDatasetSentences, MultiDatasetSentenceCollator from .utils import figshare_downl...
6b3ae09fe647bf20a860e287bfbdcdb921fc6e838b0c684ed17f8d3daecb8a21
Python
10,819
279
#!/usr/bin/env python """Train a CNN for Google speech commands.""" __author__ = 'Yuan Xu, Erdene-Ochir Tuguldur' """With modifications from Karan Goel.""" import argparse import time import torch import torchvision from torch.autograd import Variable from torch.utils.data import DataLoader from torch.utils.data.sa...
2fa7e67fd4290d5610370baa2f68e2ff53dc9b73677ae3f337435d95a04839e9
Python
10,820
247
#!/usr/bin/env python3 from __future__ import print_function import argparse import glob import sys import matplotlib.pyplot as plt import pysam import collections import numpy as np import os GENE_GTF_CHROM_IDX=0 GENE_GTF_TYPE_IDX=2 GENE_GTF_START_POS_IDX=3 GENE_GTF_END_POS_IDX=4 GENE_GTF_INFO_IDX=8 TYPE_GENE="gene"...