sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
86483428af7e77e6c4f532b12f5615fb4ef2a04e9db6fadf9f3cd5eddced5b21
Python
11,634
332
"""Mendelian randomization for ``ov.genetics`` — TwoSampleMR backend. Wraps the standalone :mod:`pytwosamplemr` package. :func:`mendelian_randomization` is a single dispatcher over the full library of two-sample MR estimators (IVW, MR-Egger, weighted median, mode-based, maximum likelihood, dIVW, contamination mixture,...
a024854370945466376b4c5449ae7948d679bba813423b67dd58ded4a925b499
Python
11,635
320
import vamb import numpy as np import os import itertools from typing import NewType, Union, Optional from collections.abc import Sequence, Mapping, Iterable from pathlib import Path import argparse import json ContigId = NewType("ContigId", int) BinId = NewType("BinId", int) def main( # Path to output cluster...
a861802877dce4e391b9f9c1e8250e4f73bec3c2b138dda2c28d44f7a8165b32
Python
11,637
356
""" 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. Custom Wigner D computation kernels for l=1, 2, 3, 4. This module contains specialized, optimized kernels for computing Wigner D matrices for ...
520697d78722b6138a872e300b6716083efb832b71e5b2b11add9c9cd42a8cfd
Python
11,638
302
#!/usr/bin/env python # # This script is used to generate a figure showing the correspondence between spinal levels and vertebrae levels. # The script also computes a distance from the PMJ to the middle of each spinal level. Results are saved to # a CSV file. # # Usage: # python generate_figure_rootlets_vertebrae_s...
e3d6950450998369c85efbfcf582136aa189d9d1d4f7a1fd8aef1b50a2136089
Python
11,643
283
import pdb import torch import torch.nn as nn from STPN.Scripts.STPLayers import ( FastWeights, STPNr, STPNF, STPNBase, HebbFF ) from torch import Tensor, no_grad from STPN.Scripts import utils """ Networks for Maze are descirbed in Maze/Scripts/maze_nets.py , instead of here """ class SimpleNetSTP...
06714172db27a7b6fbc5eaa6475b9bebec7600a4227a722695ea2b08e98ea785
Python
11,659
381
# # \file generator.py # # \brief Generates the CUTLASS Library's instances # import enum import os.path import shutil from library import * from gemm_operation import * from conv2d_operation import * from conv3d_operation import * ##################################################################...
0d54df99ee4d41e3e40ac7d7cfcd39f641ab813c2b29bfa3c2d444f5dccd43d6
Python
11,659
313
""" 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 os import typing from pathlib import Path from typing import Any, Literal import torch from fa...
4dd60cd6ce75047a5c7fc8b06f644a2da5070bc5cbca3c95ef3f5e472473692d
Python
11,660
309
import numpy as np from numba import jit import pandas as pd from math import factorial from scipy import signal def nanzscore(array, axis=0): return (array - np.nanmean(array, axis=axis))/np.nanstd(array, axis=axis) @jit(nopython=True) def get_ROI_coords_3D_planewise(stack, rois: np.ndarray): """ A functio...
088a041c029d681891b2574cdfb223c4a4cc05196c0407504a114ee327ceb580
Python
11,661
377
"""Unit tests for the GPU profiler manager. All GPU and dynolog dependencies are mocked out. This test just verifies that commands are launched correctly and that validations are correctly performed. """ import asyncio import sys from pathlib import Path from unittest.mock import AsyncMock, MagicMock import pytest ...
4bea2da210cd9a2fc5527d8eb328804139eff3521657cbba17d909ea7641cdb5
Python
11,661
330
""" Custom Norm operators to enable sync BN, regular BN and for weight initialization """ import torch import torch.nn as nn import torch.nn.functional as F from network.nn.mynn import Upsample, Norm2d class ChannelReasonModule(nn.Module): """ Spatial CGNL block with dot production kernel for image classfica...
9cb95d7d9488caf56bca77618511acc174902e804bd10493f2568e54dd245cfb
Python
11,664
295
#################################################################################################### # Copyright (c) 2025, Open Brain Institute # Author(s): Marwan Abdellah <marwan.abdellah@openbraininstitute.org> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is ...
88d92528f779abd9e72af70e5666f8a87bbef6df1beaa7d0390e0f791b057fc2
Python
11,665
280
# 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...
6175bbc8aea9f14abda1986be4deefe22e4c8dfb61a23919ff5b147eb7c58347
Python
11,669
323
#!/usr/bin/python3 # System imports import os import re import numpy import seaborn import pandas import argparse import matplotlib import matplotlib.pyplot as pyplot import matplotlib.font_manager as font_manager import matplotlib.ticker import colorsys from matplotlib.ticker import PercentFormatter from PIL import I...
696191d58cc0f70428c0d64d4f87246f10d87fb79342292e06e681a9f71c28dd
Python
11,675
309
""" 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. Structure Conversion, Manipulation, and Validation Utilities for FastCSP """ from __future__ import annotations import hashlib from collectio...
4e48b30818a371e67fea8556ff72e0139feb9801fa4c66e522128440fd1a3a4e
Python
11,681
334
# 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 torch import torch.nn as nn import torch.nn.functional as F from unicore import utils from unicore.models import BaseUnicoreModel, register_mo...
9392be84df91aa822fd846ad70b5c9b387923c62ce80820df20544799d70ba47
Python
11,682
334
import argparse import logging import os import platform import signal import sys import traceback from typing import Optional, Set import ray import ray._private.ray_constants as ray_constants import ray.dashboard.consts as dashboard_consts import ray.dashboard.head as dashboard_head import ray.dashboard.utils as das...
20dcb5126335170b8e541e077af1492cc6a8ebb8d5098976bec51dfa4ad2384e
Python
11,687
271
"""Weighted Gene Co-expression Network Analysis registry shim. The full implementation lives in :mod:`omicverse.external.PyWGCNA` (vendored from the upstream PyWGCNA package). The registry scanner intentionally ignores everything under ``external/`` to keep third-party code out of the public API surface, so a class re...
155b2bd9cc1fedc84bebf4324c413c601442773e7d088d6d0f3d75013302d0ca
Python
11,689
362
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_core.ipynb. # %% auto 0 __all__ = ['logger', 'formatter', 'console_handler', 'scannot', 'preprocess_data', 'annotate_level1', 'annotate_level2', 'get_latent_representation', 'save_results', 'annotate_levels', 'annotate_deeper_levels', 'annotate_level', ...
c29ec01a111067a6b80098d84aa0942e03922ffa85a8088266a1393501cc61ce
Python
11,690
251
import torch from torch import nn eps = 1e-8 class IRCN(nn.Module): def __init__(self, channel): super().__init__() self.gammaRow = torch.nn.Parameter(torch.ones((1, channel, 1, 1))) self.betaRow = torch.nn.Parameter(torch.zeros((1, channel, 1, 1))) self.gammaCol = ...
3f9ec97e108e41a484d1e49a85a954b6a9efe67b7acc2ca11aaf5888f3fd35fb
Python
11,691
334
import json import random import math from random import sample import matplotlib.pyplot as plt import numpy as np from matplotlib import cm from matplotlib.colors import Normalize from typing import List, Dict, Set, Tuple from scipy.stats import gaussian_kde class Experiment: def __init__(self, ...
8805dae37d93b5423e0cd3f18ba67deb7bd68c9504cae3295add79df3d8fbb9a
Python
11,699
253
import argparse import pickle from typing import List, Iterator import numpy as np import torch import lib.data_utils.data_util as du import lib.data_utils.dynamic_data_util as ddu import lib.dataset_config_parser.dataset_config_parser as dcp from denoise_inverse_alg.hqs_alg import HQS_ParameterizedSolveFn, BatchPara...
d3b1c48e28351b4a48cb5eb0ca37c356f2b210c2d59f8c057bd979ee71142e00
Python
11,700
358
# Copyright 2021 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...
674fd7ae66c0b308cf6b3d1f06df4c6dc4c4338fcbd44d9d8cc62a2b29f8f747
Python
11,702
313
""" 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: CPU-only tests for the calculate runners (ElasticityRunner, SinglePointRunner, RelaxationRunner) and their checkpoint / ...
9f95b2851ea072234b5dbdc571c82097b5063b7b023d36e44b2365b96126b123
Python
11,707
310
""" This script makes a visual comparison of the validation pseudo dice across epochs for multiple nnUNet training logs. The script reads the log files, extracts the epoch number and validation pseudo dice, and plots them. NOTE: This script is a modified version of https://github.com/ivadomed/utilities/blob/main/train...
f992f6a6d368f5174474f40e0b73ec070a83d207c172b2bf680c483ab4bb84d1
Python
11,708
321
# -*- coding: utf-8 -*- """ Project: CrowdingNumerosityGit Creator: Miao Create time: 2021-04-05 23:17 IDE: PyCharm Introduction: """ from math import atan2, pi from matplotlib import pyplot as plt from matplotlib.patches import Ellipse from scipy.spatial import distance def drawEllipse_full(e_posi, extra_posi, ka,...
6ad6a9cf7ad37ea8283e9316be2b1cd1d03969c6d10c7d2cb6791ce43dcb5f1d
Python
11,713
330
"""Tests for the decision tree modularization""" import glob import json import os import os.path as op import pandas as pd import pytest from tedana.selection import component_selector THIS_DIR = os.path.dirname(os.path.abspath(__file__)) # ---------------------------------------------------------------------- # F...
a4a0d2dbe996fa4d7c2d3f9e4899dbc32794a030fc4b10423ea81c2f702de150
Python
11,717
297
import torch import random from sklearn.metrics import accuracy_score, roc_auc_score, confusion_matrix, auc, precision_recall_curve, precision_score import matplotlib.pyplot as plt from torch.utils.data import DataLoader, Dataset import calibration as cal import logging import yaml import os import pandas as pd import ...
58572d5d941796be501f7bf36365e6f8a7a49dea7f2800035b73a1431614c1fc
Python
11,718
249
"""Keep the ``doc_api`` conditional-testing rule in sync with the API-page set. The ``doc_api`` tag in ``.buildkite/test.rules.txt`` selects the API-consistency CI checks ("doc: check API annotations" and "doc: check API doc consistency" in ``.buildkite/doc.rayci.yml``). It covers two populations: the API reference pa...
4e2e7a7810f042708f3d4367cd1242d0d2414acdaca785e374c629bbd09a1c54
Python
11,724
226
from time import time from batchgenerators.augmentations.crop_and_pad_augmentations import crop from batchgenerators.dataloading.multi_threaded_augmenter import MultiThreadedAugmenter from batchgenerators.examples.brats2017.config import brats_preprocessed_folder, num_threads_for_brats_example from batchgenerators.tran...
57f6528942e4e3e13b6b52b9f379759859d6fd93010af7a250abe298d76a19ac
Python
11,728
314
import torch import torch.nn as nn import torch.nn.functional as F from torch.optim import Adam import math import numpy as np from utils import * from lookahead import Lookahead class SelfAttention(nn.Module): def __init__(self, hid_dim, n_heads, dropout, device): super().__init__() self.hid_d...
e54992e926b6f51ea2aaefda09aad00e2af758476ce782156957b2deb7273362
Python
11,728
345
import json from datetime import datetime from pathlib import Path from typing import Any, Dict, Iterable, Optional, Union import numpy as np import pandas as pd import torch from fastai.vision.learner import load_learner from sklearn.model_selection import StratifiedKFold, train_test_split from sklearn.preprocessing ...
0c2f571d431dd760f481e1744b5e21dc8bd45f6a68ec5f0f6a65c8bdb111d178
Python
11,731
304
from batchgenerators.utilities.file_and_folder_operations import join from typing import Any from pathlib import Path import shutil import os try: import wandb except ImportError: wandb = None def get_cluster_job_id(): job_id = None if "LSB_JOBID" in os.environ: job_id = os.environ["LSB_JOBID...
6e0e2029cb88b9a4caf9f4c052028bfb5ff05e31028ebd395f92b73e78f0324b
Python
11,731
283
import os import numpy as np import pandas as pd import pickle from tqdm import tqdm from .batch import make_batch_masks class Buckets: def __init__(self, buckets, masks=None, seed=0): """ A class containing multiple set of multiple features Parameters ---------- buckets: l...
06e2fb90212bcc960c4d61337c9cf8c8866e408560800301d36961437c7b53ca
Python
11,732
329
import torch import copy #from timm.scheduler.cosine_lr import CosineLRScheduler #from timm.scheduler.multistep_lr import MultiStepLRScheduler import inspect import math from bisect import bisect #import torch.optim.lr_scheduler as lr_scheduler def multiply(obj, num): if isinstance(obj, list): for i in ra...
1785062aca64ae37299262505814330e5f6e70fd637d8cfc4e43f87d8b712479
Python
11,733
293
import numpy as np import rlexp.utils as utils import exputils as eu import exputils.data.logging as log import torch from ..approximation import NEC, ExperienceReplay class NECAgent: @staticmethod def default_config(): return eu.AttrDict( initial_epsilon = 1, final_epsilon = ...
cd9737107715089edec5b960981ce2a8ca868467a5be8feb4cf78946c57c6123
Python
11,736
259
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! """Client and server classes corresponding to protobuf-defined services.""" import grpc import user_defined_protos_pb2 as user__defined__protos__pb2 class UserDefinedServiceStub(object): """Missing associated documentation comment in .proto fi...
21aa9fab89fef51f0944ed503ec37f35912a018ca1db7163c7f647cef70dff45
Python
11,737
284
# 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...
a413d8b35ede53f9e251f577da3aa932c3895803a553f5569414fddad933c2b5
Python
11,742
245
"""Real public immune-repertoire (AIRR) datasets for the ``ov.airr`` tutorials. Each loader downloads a dataset asset from the ``omicverse-data`` GitHub release (``airr-v1``) on first use, caches it under ``dir``, and returns it ready for the ``ov.airr`` adaptive-immune-receptor-repertoire workflow (clonotype calling,...
f0de4ed44238af736be4cc245075c36265f0d3e6d23c3b7f59bbdf6f57902f29
Python
11,742
276
import glob import os from itertools import chain import h5py import numpy as np import pytorch3dunet.augment.transforms as transforms from pytorch3dunet.datasets.utils import get_slice_builder, ConfigDataset, calculate_stats from pytorch3dunet.unet3d.utils import get_logger logger = get_logger('HDF5Dataset') clas...
0e507163fb3cf5e41b20f25a3ce7c21da6430b6a076a8cf9f8b6b5d712f50aef
Python
11,744
354
import argparse, os, sys, glob import cv2 import torch import numpy as np from omegaconf import OmegaConf from PIL import Image from tqdm import tqdm, trange from imwatermark import WatermarkEncoder from itertools import islice from einops import rearrange from torchvision.utils import make_grid import time from pytorc...
b04a6d214f50482a330206b443666ab7bdd9f9240ec62e1bcdbbaf3c1bae8dbb
Python
11,744
351
import itertools import numpy as np import torch from torch import nn def is_recurrent(layer): """Return True iff a given layer is recurrent and supported by PFRL. Args: layer (callable): Any callable object. Returns: bool: True iff a given layer is recurrent and supported by PFRL. ...
4e8f01393e7cf82e7e1d560c680c86c54995a2c5fa66fddadd4b19282240a9fb
Python
11,747
338
#!/usr/bin/env python # -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. """Run every example script in this folder and record what happened. Each ``NN_*.py`` file is executed, in numeric order, with the Python ...
3531023b435520c116189a83b855c41be2792b74ec65d0c4ac8e43f101034440
Python
11,748
365
import datetime import os import warnings from functools import partial, wraps from typing import Callable, Sequence, Set from urllib.parse import urlparse import filetype import pandas as pd import visions from multimethod import multimethod from pandas.api import types as pdt from visions.backends.pandas...
9933991f1efcbba109b26e8138fe2e3d1ce3f35a552da04d9cf677133d81ede2
Python
11,758
250
from argparse import ArgumentParser import os import os.path import skimage import pathlib import numpy as np import scipy as sp import scipy.signal import pandas as pd import tqdm import cv2 import src.data import src.metrics import sak if __name__ == '__main__': # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LOAD INPUTS ~...
4bba48e2d5767008e96b498df7250baa7b976a3f525481859cb3216d1f4161ad
Python
11,766
293
import os import torch import torch.nn as nn import torch.backends.cudnn as cudnn import torch.utils.data as Data import random import numpy as np import pandas as pd from collections import defaultdict import warnings warnings.filterwarnings('ignore') import numpy as np import random import torch from tqdm.auto impor...
56a880e6a190f7d5ece5aa1b876287e12e5c11b4eac251a8542a4dba47e8f4f9
Python
11,766
290
#!/usr/bin/env python # -*- coding: utf-8 -*- # ------------------------------------------------------------------------- # Created By : Kangjoo Lee (kangjoo.lee@yale.edu) # Last Updated: 08/06/2024 # ------------------------------------------------------------------------- # ========================================...
aa242d943cfef6a3f4b19065ffd860b86c17333101de4deef36e558fc405d325
Python
11,768
370
""" Utility functions for plotting in Palantir """ from typing import Optional, Union, Dict, List, Tuple, Any, Callable import numpy as np import pandas as pd import matplotlib import matplotlib.pyplot as plt from matplotlib.colors import Normalize from matplotlib.axes import Axes from mpl_toolkits.axes_grid1 import m...
9dae94b83ebbe3ffff6fe2daddaf480bff4d183ab6fcdc76c844d89c1de462cf
Python
11,773
343
import pdb,sys,os import anndata import scanpy as sc import argparse import copy import numpy as np import faiss import scipy from sklearn.decomposition import PCA ### evaluation functions def faiss_knn(query:np.array, x:np.array, n_neighbors:int=1) -> np.array: n_samples = x.shape[0] n_features = x...
3af6dc7f0154f843fdf3c23a869330bc4ac6316e6e13c7fbd6fd6d07939e3ae0
Python
11,775
273
import requests from .__config import base_url from .__aux_funcs import process_response def fetch_clinical_data(attribute_ids, entity_study_ids, clinical_data_type="SAMPLE", projection="SUMMARY", ret_format="WIDE"): """ Fetch clinical data by patient IDs or sample IDs (all studies) from cBioPortal. \n :pa...
061b50694e19622babe05c922475e5a0a87d43ca4a6ff4de24f11c3f033edb8e
Python
11,781
243
import sys import numpy as np from threshold_frame import threshold_frame from scipy.spatial.distance import pdist, squareform from scipy.cluster.hierarchy import fcluster, linkage from scipy import sparse import multiprocessing as mp sys.path.insert(1, '../SUNS2') # the path containing "suns" folder from suns.PostPro...
6eb3d03817f7eb337eeb16a0e9eb8986b977fd0423622f4256bd68a2a29fa918
Python
11,787
323
# Copyright 2021 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...
f44a2e92daedf28bc294c2d2328191df7793f12315a3d2c84c9390688aea57d8
Python
11,787
359
# -------------------------------------------------------- # Swin Transformer # Copyright (c) 2021 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Ze Liu # --------------------------------------------------------' import os import torch import yaml from yacs.config import CfgNode as C...
62da22c05f95ed5f678afa83fd0a78746f9b8e0df04ad466a9cdb994bd9e7895
Python
11,790
315
import collections import copy from logging import getLogger import numpy as np import torch from torch import nn from torch.nn import functional as F from pfrl.agent import AttributeSavingMixin, BatchAgent from pfrl.replay_buffer import ReplayUpdater, batch_experiences from pfrl.utils.batch_states import batch_state...
c3cc215d2e43dd4ccffd2211eb018004e4f14aaaf4c6a28cfd439b379a7ca521
Python
11,793
371
r""" Align metrics """ from typing import List, Optional, Union from collections import Counter import numpy as np import pandas as pd from scipy.spatial.distance import euclidean from scipy import sparse import torch import torch.nn.functional as F import torch_geometric as pyg from anndata import AnnData from .mode...
6875c24baa732a4de5bb18dcf6268049d53191e80f146e98c5b8ca71f9429802
Python
11,795
262
import os, sys sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import torch import torch.nn as nn # from TEST_dataset import * from splam_dataset_Chromsome import * from SPLAM import * # from splam_utils import * import matplotlib.pyplot as plt; plt.rcdefaults() import numpy as np from tqd...
9bbc95af49b0a1e4e29684292b87bf187980a705e67381c5ba2c8516c405bc61
Python
11,795
294
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Apr 19 11:52:05 2022 @author: sam """ import keras from keras import backend as K from dualChannelRNN import rnnCell_dualNet_ as rnnCell_ import tensorflow as tf import numpy as np class zeroConstraint(keras.constraints.Constraint): """Constrains w...
a880d8ca2f7c6fdd9b697c669db8682e93b5da889246b08b8935d83dfb485cdc
Python
11,806
267
# Definition of several convolutional modules # Normal convolution, Residual, ResNeXt, Inception, Amoeba... # From [this link](https://towardsdatascience.com/history-of-convolutional-blocks-in-simple-code-96a7ddceac0c). import numpy as np import keras import keras.layers import keras.backend import keras.backend as K ...
be58214b60c0f4f7a5eda45792ccdc235b9bf95263ad140ec7cf3837d86c4861
Python
11,807
325
# 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 to in writing, software # distributed under th...
19130d726a7e25e1fd7ff367c668c69faa7c05b1563290f7e40b0bed9a73a852
Python
11,809
392
"""Visualization functions for metabolism scores.""" import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.colors as mcolors from typing import Optional, Union, List import anndata import logging logger = logging.getLogger(__name__) def _zissou1_cmap(): colors = ["#3B9AB2", "#...
0be2e751e0bb69784fc12a2c9dcd0c157ab6ba10abb217e127953678c162e7ed
Python
11,810
337
# 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...
cae6d7f341fbfa3613a0876eead25fe20447cb5125dbf9540769859daedb65eb
Python
11,810
400
# coding: utf-8 # # Table of Contents # # 1. [Import & Set Up](#import_everything) # 2. [Load in data](#load_files) # 3. [Within Pair Correlation](#within_pair_correlation) # 3. [Center of Mass](#c_o_m) # 1. [distance apart](#distance_apart) # 2. [error by overlap](#error_by_overlap) # # Import Stuff # <a i...
480fcf58e22bed579de9b6c7c740f1a4d3070c4fc5d9348f175a97f30b3a08f6
Python
11,817
292
from typing import Optional class NullMetric: """Mock metric class to be used in case of prometheus_client import error.""" def set(self, *args, **kwargs): pass def observe(self, *args, **kwargs): pass def inc(self, *args, **kwargs): pass def labels(self, *args, **kwarg...
faa3d7ab669742a1405e21805f0176ee2b83b37a89d311c3b824872946268396
Python
11,818
302
""" 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 contextlib import uuid from concurrent.futures import ThreadPoolExecutor from functools import c...
134a661ca3657faa65b87a0677b0771c86870facc7b1443f66aa895df894404e
Python
11,824
321
# 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...
c37a01a8a1a6dfaa4f99d748ef6b46dce2d2ee656208dbd02a4a623da2394c2e
Python
11,828
342
from __future__ import annotations import contextlib import operator import warnings from functools import wraps from typing import Iterable, List import matplotlib.pyplot as plt import numpy as np import xarray as xr def where_xarray( dataset: xr.Dataset | xr.DataArray, rtol: float = 1.0e-5, atol: floa...
3dfee9b4ce19f1d22d2870a4b2988ac49271834e4ebf23ed9a03f3a9fee8819e
Python
11,830
376
# These classes are the tensorflow counterparts of Minivision's Silent-Face-Anti-Spoofing # Repo licensed under Apache License 2.0 # Ref: github.com/minivision-ai/Silent-Face-Anti-Spoofing/blob/master/src/model_lib/MiniFASNet.py # built-in dependencies from typing import Any, List, Tuple # project dependencies from d...
6236960ed83e59f77be2d8d7e28dccd3d548ccc30c3bc612d9fe1ddd213f8b20
Python
11,830
207
import nibabel as nb import numpy as np import pandas as pd from nilearn.plotting import plot_roi from nilearn.image import threshold_img, math_img, new_img_like from matplotlib import cm def interestingrois(model,pairoflabels,mistatlaslabel='../data_in/MIST_122.csv',doubledrois=['L_IPlob']): labelinf = pd.read_c...
b89bc4301087c35df454c00af5efd2fc77b7697cf32763ba03a0b10be3434551
Python
11,830
394
r""" Utility functions for data handling and analysis. This module provides essential utility functions for data I/O, manipulation, visualization, clustering, and various computational tasks across the omicverse ecosystem. It serves as the foundation for many higher-level analysis functions. Data I/O and manipulation...
b23da948100fe4c6161971deeab2e23e09052cc72d5844de766cc1b72284ee85
Python
11,833
234
# Ultralytics YOLO 🚀, GPL-3.0 license """ Common modules """ from copy import copy from pathlib import Path import cv2 import numpy as np import pandas as pd import requests import torch import torch.nn as nn from PIL import Image, ImageOps from torch.cuda import amp from ultralytics.nn.autobackend import AutoBacke...
a900f463fbeb874a39bc0e9c1a224e82d63be9419f8b464f04b5d647d3337dd1
Python
11,836
342
"""Contains custom skorch Dataset and ValidSplit.""" import warnings from collections.abc import Mapping from functools import partial from numbers import Number import numpy as np from scipy import sparse from sklearn.model_selection import ShuffleSplit from sklearn.model_selection import StratifiedKFold from sklearn...
8d7ace1e87c4ed87e247956017dcc87d1d7c39bdc0ec21cd1d0cca4ec64cd90d
Python
11,837
294
import argparse import pickle from collections import namedtuple from typing import List import numpy as np import torch import tqdm import lib.data_utils.data_util as du import lib.data_utils.dynamic_data_util as ddu import lib.dataset_config_parser.dataset_config_parser as dcp from convex_optim_base.unconstrained_o...
f8aedbce55818396edd82e0958ba9ada834314c38d65321f36b54acb0ab18b63
Python
11,841
324
from __future__ import annotations import warnings from typing import TypeVar import numpy as np from numpy.typing import NDArray from scipy import sparse from .._optional import normalize_torch_device SpBase = sparse.spmatrix | sparse.sparray # noqa: TID251 """Only use when you directly convert it to a known subcl...
6d2b542b0c4a0aa613f40315e2881a9b37c1d88a4bf0e83dd9a3b3893f6f1fd1
Python
11,843
278
import logging import pathlib import re import h5py import numpy as np import nir PATH_TYPE = str | pathlib.Path logger = logging.getLogger(__name__) def read_cuba_lif(layer: h5py.Group, shape: tuple[int] | None = None) -> nir.NIRNode: """Reads a CUBA LIF layer from a h5py.Group. TODOs: - what if the l...
923e5753697f7cd9f62c4bad54e032cdb302a30f566ce3713ed05b9cc3feeefd
Python
11,846
310
# # 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...
a16f49221b6db611ca4173c2edd85453bbda44b086e7e8a9ddc80188fd7c884c
Python
11,853
336
import math import numpy as np import pytest import torch from torch import nn import sinabs import sinabs.layers as sl from sinabs import SNNAnalyzer, SynOpCounter from sinabs.layers import IAFSqueeze, NeuromorphicReLU class Model(torch.nn.Sequential): def __init__(self): super().__init__( ...
95147c94a3f754db9ae4c37137e55e3d568dd025549ba28a00120156236d0954
Python
11,856
324
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 socket import pickle import scipy import scipy.ndimage import matplotlib.pyplot as plt from datas...
c3f38a6d8c043c01abbb262f3612fd293295c517a1e9c814de64ac677bde34ae
Python
11,861
284
# %% import math import os import random import shutil from pathlib import Path from typing import List, Optional import torch import typer from typer_config import conf_callback_factory from typing_extensions import Annotated from .utils.load_function_args_from_yaml_config import ( load_function_args_from_yaml_c...
c7c563336d5d2ca13b1fe82e45d860665699daf9ad7f6d838675673e2e866bf1
Python
11,873
342
from typing import Optional, List import numpy as np import torch import skimage from monai.config.type_definitions import NdarrayOrTensor, NdarrayTensor from monai.utils import optional_import from monai.utils.type_conversion import convert_data_type, convert_to_dst_type cp, has_cp = optional_import("cupy") cp_ndarra...
64783298231867d6901fc811166e02300f88aa638979609695e8e5cb9b321872
Python
11,877
307
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union if TYPE_CHECKING: import torch import ray from ray.dag import ( ClassMethodNode, DAGNode, ) from ray.dag.constants import COLLECTIVE_OPERATION_KEY, IS_CLASS_METHOD_OUTPUT_KEY from ray.experimental.channel import ChannelContext from ...
fd151a9121d78e31067af86d152695584f24958db91900e381a003c2437fcf26
Python
11,880
251
# Ultralytics YOLO 🚀, GPL-3.0 license import os from pathlib import Path import numpy as np import torch from ultralytics.yolo.data import build_dataloader from ultralytics.yolo.data.dataloaders.v5loader import create_dataloader from ultralytics.yolo.engine.validator import BaseValidator from ultralytics.yolo.utils...
f901e814e2f37659f67a0cbeae528948ee9f6a5378bfc7bd62472099fdac8fda
Python
11,884
301
# based on https://github.com/gzerveas/mvts_transformer # with minor adjustments to fit the forecast project from typing import Optional import math import torch from torch import nn, Tensor from torch.nn import functional as F # noqa from torch.nn.modules import ( MultiheadAttention, Linear, Dropout, ...
449f14050d33e5862edaa901b5b9ab2f26cd61141fe5c2b367348b68593dbc31
Python
11,888
335
# -*- 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. #...
929f878e8fe79f075483d6ba5d2c4733d066c4cd1c6392a5b32beb78e5d0df82
Python
11,888
330
from imports import * from .fixtures import THIS, ungiz class Base(BaseClass): modulepath = 'ngs_mapper.bam' @patch('ngs_mapper.bam.subprocess.Popen') class TestUnitMergeBam(Base): functionname = 'mergebams' samtools_cmd = ['samtools','merge','merged.bam'] def test_input_files(self, popen_mock): ...
bd5bd1c2892b727f3e54e71486518e3fb1c801127e710df4e7f1693ac28a70dc
Python
11,890
318
# Ultralytics YOLO 🚀, GPL-3.0 license import copy import cv2 import matplotlib.pyplot as plt import numpy as np from ultralytics.yolo.utils import LOGGER class GMC: def __init__(self, method='sparseOptFlow', downscale=2, verbose=None): super().__init__() self.method = method self.dow...
e5538498dd2ff0f7b93b421c0be320c27265fbd11c3d9ce78fea2dfdde17c8df
Python
11,890
304
import logging from types import ModuleType from typing import Any, Dict, List, Optional from ray.autoscaler._private.command_runner import DockerCommandRunner, SSHCommandRunner from ray.autoscaler.command_runner import CommandRunnerInterface from ray.util.annotations import DeveloperAPI logger = logging.getLogger(__...
b66a8172b7462d66a9963509fdeceb7b68ff3b2f56600fd95587484f2fbff1a1
Python
11,893
265
from django.db import models from django.urls import reverse CHECKWORTHY_CLASSIFICATION = [ ('NF', 'Not factual'), ('FR', 'Factual and relevant'), ('FNR', 'Factual and non-relevant'), ('NA', 'Not applicable'), ('FRC', 'Factual, relevant but complex'), ('OOI', 'Out of news item'), ] TRUTHFULNES...
d46aea15093d7fc9d6adab57c5b8f9c6eda9db2f513c25089e925a29f3b7733a
Python
11,895
243
#!/usr/bin/env python """ Complete pipeline for motion correction, source extraction, and deconvolution of one photon microendoscopic calcium imaging data using the CaImAn package. The demo demonstrates how to use the params, MotionCorrect and cnmf objects for processing 1p microendoscopic data. The analysis pipeline ...
6ef9dd12259852f5c627974593ee442e7cab5e7f047ac1529c69e3f12caaea38
Python
11,898
358
from os.path import join import argparse from subprocess import Popen, PIPE import pandas as pd import numpy as np import toml from eval_simulation import eval_simulation from util import EMB_DIR, OUT_DIR, \ PATH_TO_EXPORT, PATH_TO_GWAS, \ get_out, get_img_dir, get_emb, \ get_aggregate_fn ...
29d68716dd38e7f78dbdaaf67d6e580d774d044ca100f95dfcbf9ec00802e836
Python
11,908
296
#################################################################################################### # 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...
4c0d373d62f3a8104f54c1dec44d285bced8c0e2b5efec013c552995c9d4c4d1
Python
11,911
354
import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from anndata import AnnData from typing import Optional, List, Tuple, Dict from scipy import stats def shannon_diversity( adata: AnnData, groupby: str, cell_type_key: str, base: str = 'natural', calculate_...
d2d83c7592b623bb42af1935b0ddd2f8b0235750e7502beaf3294455bfeb779e
Python
11,914
297
#!/usr/bin/env python # ================================ # @auther: Rongbin Zheng # @email: Rongbin.Zheng@childrens.harvard.edu # @date: Oct 2024 # ================================ import os,sys import time import pickle as pk from datetime import datetime import numpy as np import pandas as pd import traceback from ...
294d933b7badac16819ca12285b833fc9abe6d4ef1b6df83d31306a9cafc3820
Python
11,918
343
""" 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 typing import Literal import torch from fairchem.core.common import gp_utils def get_l_compone...
a84fa3045af145f58107d60c059f3945cacc308192b691cbe4b4f1d690fd1a79
Python
11,921
261
import numpy as np import h5py import pandas as pd from src.dataset.batchdataloader import BatchDataloader, EvenSamplingBatchDataloader from src.dataset.utils import compute_weights_bucketized, check_mutual_exclusive, classes_to_levels def load_dset_electrolyte( path_to_csv:str, path_t...
7eff344a7a0bd2b7237f37f2df4756aeccad5b9b8a051da77e8857207983669a
Python
11,922
289
import numpy as np import os import glob import re import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec from scipy.stats import f_oneway, linregress, ttest_ind, ttest_rel import pingouin as pg # import statsmodels.api as sm # from statsmodels.formula.api import ols import warnings warnings.filterw...
ebd04895761c757782d2f14055de69bc7f2e960297dfee7ccd81a20675cf7412
Python
11,923
306
# 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...
18eab9d2358a7c7c70dbc40ecda4c15f332ca1b366b6fa77cdb7bfae700185a5
Python
11,925
385
import random from typing import Optional from unittest.mock import MagicMock import pytest import ray from ray import train from ray.data import DataIterator from ray.data._internal.execution.interfaces.execution_options import ( ExecutionOptions, ) from ray.tests.conftest import * # noqa from ray.train import ...
17ac1b3a2528bf6aea46d55222952a81f1290d6b1969f2d5c65f659fd5ddc210
Python
11,926
342
"""SubagentController — spawn and manage subagent conversations. Extracted from ``smart_agent.py``. A subagent gets its own system prompt, restricted tool set, independent message history, and — critically — an isolated ``SubagentRuntime`` that prevents mutable-state leakage between parent and child turns. Isolation...
1d6966053573c540612ee686b1f7094599bfafdbf85657a682d0568ea5bbb48a
Python
11,931
315
# VTK-specific tensormaps import os import h5py import numpy as np import vtk import vtk.util.numpy_support from ml4h.TensorMap import TensorMap, Interpretation from ml4h.defines import MRI_SEGMENTED, MRI_LAX_SEGMENTED, MRI_FRAMES, MRI_PIXEL_WIDTH, MRI_PIXEL_HEIGHT, MRI_SLICE_THICKNESS, MRI_PATIENT_ORIENTATION, MRI_PAT...
e4de6b5fd4038899a02b356ad59cf60a269ebc075e13d224885fa121ead62637
Python
11,933
260
import os, logging import pandas as pd from misc.save_files import read_pickle, write_pickle,read_pandas_from_csv from misc.abb_med_disease import gen_abb_med_disease def generate_keyword_plotting_files(config: dict, df_publications: pd.DataFrame): n_gram_list = [index for index in config["NLP"]["n_gram_list"] ...
5bcc67066802ce721a65f4304d51170810bae038eb1279d7e3a32662fa97d9fc
Python
11,936
361
import asyncio import dataclasses import logging import os import re import traceback from dataclasses import dataclass from typing import Any, AsyncIterator, Dict, List, Optional, Tuple, Union from ray._raylet import RAY_INTERNAL_NAMESPACE_PREFIX, GcsClient from ray.dashboard.modules.job.common import ( JOB_ID_ME...