sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
67ddf6b1cc842f4e698204787cc0bede7929f99d075577c3e0038bd080e2d11c | Python | 5,491 | 160 | # 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... |
957d87ce04f8952b1b24322111a72ea2b5fafc922e1317968dc60467bddf75a6 | Python | 5,493 | 140 | import copy
from dataclasses import is_dataclass
from itertools import zip_longest
from typing import TypeVar, Type, Optional, get_type_hints, Mapping, Any
from .config import Config
from .data import Data
from .dataclasses import get_default_value_for_field, create_instance, DefaultValueNotFoundError, get_fields
from... |
74864f0e959b90ac0958d19c909d59a1dcd6fb69f317acb09d5b9f4b3b231162 | Python | 5,494 | 158 | # ---------------------------------------------------------------------------------------------
# MS lesion segmentation pipeline
# ---------------------------------
# - incorporates:
# - MRI identification
# - registration
# - skull stripping
# - MS lesion segmentation training and ... |
cad843afba096d113dd22ffdd27b90a9727d7d8a256fb3c600cc69410e838632 | Python | 5,494 | 155 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
e7a39467823b403ae2cc3be579573870fa0ac666d7f033fb474ef12cce1e20ce | Python | 5,494 | 164 | from __future__ import division
import numpy as np
import scipy.special as special
from ..utils import *
from .. import gpu_utils
# Import manually defined functions
from .variational_nodes import Gamma_Unobserved_Variational_Node
from ..distributions import *
class TauD_Node(Gamma_Unobserved_Variational_Node):
... |
56083325d230f1d8921bb1a230a19ccb2c602764382267a33af96ee77fde6d2b | Python | 5,495 | 115 | """
Population PSTHs in active / passive and their difference
Create for one example site.
"""
# set up python path to access helper functions
import os
rdir = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
import sys
sys.path.append(rdir)
from settings import RESULTS_DIR
import pandas as pd
import helper... |
2b5036455404b28e3f501c04fac9c9307d37afe854076ef35eb9a02c35ecdf70 | Python | 5,498 | 188 | from pathlib import Path
import pandas as pd
import numpy as np
from collections import defaultdict
import random
from scipy.stats import multivariate_normal
from scipy.stats import wasserstein_distance
from scipy.stats import pearsonr
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.font_manager impo... |
50c3f9ebaea314aee8af7ed4d3f9429063c0c557c5e1df3cce9951fa717eae04 | Python | 5,498 | 187 |
import pdb
from matplotlib import pyplot as plt
import torch.nn as nn
import torch
from tqdm import tqdm
import yaml
from latent_time_stepping.AE_models.autoencoder import Autoencoder
from latent_time_stepping.AE_models.encoder_decoder import Decoder, Encoder
from latent_time_stepping.datasets.AE_dataset import AED... |
5659b427430d69d8a36ad49b67e74cefc1e25b4b7b3f9d378004939cf62b3995 | Python | 5,499 | 134 | import unittest
from diffusers.pipelines.pipeline_utils import is_safetensors_compatible
class IsSafetensorsCompatibleTests(unittest.TestCase):
def test_all_is_compatible(self):
filenames = [
"safety_checker/pytorch_model.bin",
"safety_checker/model.safetensors",
"vae/... |
cc2270066076b09d0605b47a87141c97d86fc58a964fcaa19db4a397f97de311 | Python | 5,501 | 130 | import math
import numpy as np
import scipy.special
import torch
from ..distances import CosineSimilarity
from ..utils import common_functions as c_f
from ..utils import loss_and_miner_utils as lmu
from ..losses.base_metric_loss_function import BaseMetricLossFunction
from ..losses.mixins import WeightRegularizerMixin... |
e0c903dc8e317bd60ff4672769c2f88890b8ad4b3ece2cc6f40f7887bf13af01 | Python | 5,501 | 163 |
import pickle
import dash
import os
import glob
import numpy
import dash_bootstrap_components as dbc
import dash_mantine_components as dmc
import plotly.graph_objects as go
from dash import Dash, dcc, html
from plotting import show_images, plot_objectives
PATH = "/Users/Anthony/Desktop/20251027_Multicolor-STED-RL"
... |
ff10ef5b06e76f552b07f50c5f93d117e1785b603d02a8283b410ca125a22a93 | Python | 5,501 | 120 | ####################################################################################################
# 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... |
6eb6fb65f42ba128e395f8ef8d257d3a8d10359b1962200a8d8779581d914e03 | Python | 5,504 | 167 | """
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 for UnifiedRadialMLP.
"""
from __future__ import annotations
import pytest
import torch
class TestUnifiedRadialMLP:
"""Tests for ... |
e2f5a12423505fda80f974e69bdabb43b69230362057c590f9e0a05eb6ceb377 | Python | 5,504 | 114 | import os
import re
import pandas as pd
from io import StringIO
def samplot(names, cram, fasta, chro, start, end, ty, outname, expand=False):
if expand: # whether to expand range
length = int(end) - int(start)
start = str(int(start) - length)
end = str(int(end) + length)
os.system("sa... |
79cd3caa4ec408bffcb6ace3b17bb2d185a79dad814314566e936b52c169e764 | Python | 5,505 | 167 | import numpy as np
import pytest
import torch
import torch.nn as nn
import sinabs.activation as sa
from sinabs.layers import IAF, IAFRecurrent, IAFSqueeze
def test_iaf_basic():
batch_size, time_steps = 10, 100
input_current = torch.rand(batch_size, time_steps, 2, 7, 7)
layer = IAF(min_v_mem=-2.0)
spi... |
4da1e2526e288f336755eba92dbe92b02e8035f0a41138f71bc12d07b9ca619d | Python | 5,507 | 185 | # -*- coding: utf-8 -*-
"""
CONSTANTS for use with SASSI-STAGG
Copyright (C) 2022 Christopher Scott Ward
created as a component of Breathe Easy
***
Breathe Easy - an automated waveform analysis pipeline
Copyright (C) 2022
Savannah Lusk, Andersen Chang,
Avery Twitchell-Heyne, Shaun Fattig,
Christopher Scott Ward,... |
32a2bfad11850d6a9c66d64e1f5ce1746de413fab6a6bc36c11ff3afa98158e8 | Python | 5,510 | 178 | """
Abstract SDE classes, Reverse SDE, and VE/VP SDEs.
Taken from https://github.com/yang-song/score_sde_pytorch
"""
import abc
import torch
import numpy as np
class SDE(abc.ABC):
"""
SDE abstract class. Functions are designed for a mini-batch of inputs."""
def __init__(self, N):
"""
Cons... |
b8e24d1cb0e60987f6d53f1c146bc7fc0ca7795072978efec7aa67cf60f874de | Python | 5,513 | 122 | import tensorflow as tf
import logging
tf.get_logger().setLevel(logging.ERROR)
from tensorflow.keras.models import load_model
import mrcfile
from IsoNet.preprocessing.img_processing import normalize
import numpy as np
import tensorflow.keras.backend as K
import os
from IsoNet.util.toTile import reform3D
from tqdm impor... |
ea4cce7775815e5d7f70f87a4ee2d167a47c9fe89abb9829eb1028d0bacd574d | Python | 5,513 | 148 | import numpy as np
import matplotlib.pyplot as plt
from typing import Callable, Union, List
from .mosaic import Mosaic
class Feature:
"""
spatial feature of a cell type
Attributes
----------
max_value/min_value: float
The maximum/minimum value for bins in histogram.
n_bin: i... |
425791622f724f0f574134e5e0315207c6295b81063fbc13fb5678d4cea538a8 | Python | 5,515 | 138 | import numpy as np
import argparse
import subprocess
import datetime
import time
import os
import pandas as pd
import glob as glob
def string(boolean):
if boolean == True:
return "true"
else:
return "false"
def loop(output_dir, params, param_names,
values = [], depth = 0, **kwargs):... |
924d101a9dad39f30d95bfd13dce9a3df04ea154b67815ef97e4ce51cbb5d48f | Python | 5,517 | 180 | #!/usr/bin/env python
# usage draw_motif.py <elem_out/pattern-*> <eps> <svg>
import numpy as np
from subprocess import Popen,PIPE
from sys import stderr,stdout,argv,platform
from re import compile
inf,nan=float("inf"),float("nan")
dname=argv[1]
eps=argv[2]
svg=argv[3]
def cry(*x):
stderr.write(' '.join(map(str,x))+... |
d804eb295a4cfb486b147b7713d1d87c7c63175d4817ecfc843a973055277d21 | Python | 5,517 | 79 | from django.urls import path
from . import views
app_name = 'annotate'
urlpatterns = [
path('', views.index, name='index'),
# sidenav zone
path('items/', views.ItemIndexView.as_view(), name='item_index'),
path('items_topics/', views.ItemIndexTopicsView.as_view(), name='item_topics_index'),
path(... |
23f221658690a3769fe59170baa0974fc1b66f2a270e241db300d3a30ca5e893 | Python | 5,519 | 119 | #! /usr/bin/env python
import argparse
import math
import os
import gzip
# Created by Arya Kaul - 1/12/2017
# Modified by Ferhat Ay - 1/13/2017
# Modified by Nicolas Servant - 1/23/2017
# Modified by Ferhat Ay - 6/5/2017 - added resolution (-r <res>) argument to avoid some problems with inferring it from the first en... |
a3574ce951dbd98493f35ac3d1c94043f2bf5ee8d5db3e57282b41eb3a9d9cb4 | Python | 5,519 | 148 | r"""Tile-level pathology foundation-model embedding.
Thin convenience wrapper around :func:`lazyslide.tl.feature_extraction`.
LazySlide already registers UNI/UNI2/CONCH/Virchow/Virchow2/GigaPath/
H-Optimus/Phikon/CTransPath/Hibou/Midnight; this layer adds:
* an ``available_backbones`` helper that filters the LazySlid... |
78f5a6b1b0b482150129e7a01f31fdc4bfddb3ee6157efabe236f8b3f380c70a | Python | 5,520 | 147 | from dataclasses import dataclass
from typing import Dict, List, Optional
import ray
from ray import SCRIPT_MODE
from ray.air.execution.resources.request import (
AcquiredResources,
RemoteRayEntity,
ResourceRequest,
)
from ray.air.execution.resources.resource_manager import ResourceManager
from ray.util.an... |
106f479f3e32a6ee32eb53a2ba1084c16c03ec5878609e46a144e0cf6d8f0a67 | Python | 5,521 | 107 | import argparse
from warnings import warn
import json
import os
import numpy as np
from src.utils.random import merge_configs
def positive_int(value):
value = int(value)
if value < 0:
raise argparse.ArgumentTypeError("%s is an invalid, requires positive int value" % value)
return value
def p... |
5170e0b7510ebcb5ac673c3de10a9be038d4343340876db2492439a3c9fb903b | Python | 5,521 | 155 | """Report synthesis utilities.
This module provides a small abstraction for turning a brief and findings
into a comprehensive report body. Two implementations are provided:
- SimpleSynthesizer: deterministic, offline synthesis using headings and
concatenated summaries.
- PromptSynthesizer: optional HTTP-based synth... |
f85625f48a314ce02ffaf1b4bef2039ebe73e4e6365b4dd54747f2db220506a7 | Python | 5,521 | 146 | import tensorflow as tf
# from tensorflow.keras import backend as K
import os, sys
import h5py
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 tqdm import tqdm
import warni... |
faac339d32dcd170b45bd205eeb8e4edb95916ce5e672a8cfc1188099fdc90f7 | Python | 5,521 | 159 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import annotations
import argparse
import multiprocessing as mp
import pickle
import numpy as np
from ase.io import Traje... |
10085dc4843f4e28e68dde1e49883f1c5390733578636a49c23bc4455a27558a | Python | 5,522 | 140 | import yaml
import scipy
import pickle
import argparse
import numpy as np
from tqdm import tqdm
import matplotlib.pyplot as plt
def bootstrapped_val(x, stride, total_steps, confidence_level=0.95, to_bootstrap=True):
num_runs = len(x)
avg_ret = np.zeros(total_steps // stride)
steps = np.arange(stride, tota... |
a9210defcf7f878d05fce493c180a1fea0efc7665d31e94e77538115aa9d7ebd | Python | 5,524 | 110 | import os
import glob
import pytest
import numpy
from typing import List, Set
from sv_utils import make_cross_validation_vcfs, genomics_io, pedigree_tools
class Default:
resources_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "resources")
small_vcfs_dir = os.path.join(resources_dir, "small_v... |
cd6609964bbfc9321053b7cbf0c00eeaa301ccdd6108bf25131e8bf5dc1189fd | Python | 5,524 | 151 |
import numpy as np
import torch
from torch.utils.data import Dataset
from tqdm import trange
import os
from PIL import Image, ImageFile
from torchvision import transforms as torch_transform
from torch.utils.data import DataLoader
from torchvision import transforms
import matplotlib.pyplot as plt
import argp... |
17a164a17c4ba53640548ae910c3f3e2c0e0b7527f0d4bbef9d2705f0612cae6 | Python | 5,525 | 169 | from typing import Dict
import cv2
import h5py
import logging
import numpy as np
from scipy import ndimage
from ml4h.TensorMap import TensorMap
from ml4h.normalizer import ZeroMeanStd1
from ml4h.tensormap.general import get_tensor_at_last_date, pad_or_crop_array_to_shape
def find_border_components(labeled_image):
... |
d5c598f65245f6abf03e327896e6a99e401b85e42c18a4a2d3e2677742008fed | Python | 5,525 | 160 | import os
import json
from typing import List
from deprecated import deprecated
from utils import detokenize_old
@deprecated(version='', reason="This method is deprecated, use preprocess_results()")
def read_token(pred_labels, valid_labels, tokens, offsets):
if valid_labels != None:
d = {'token': [],... |
f21d71a8d6883740af1c027733ad6a339eab5d85dfb6d43a5d155b09e2e826de | Python | 5,525 | 165 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
"""
Convert an RdTest-formatted bed to the standard VCF format.
Each record corresponds to a single CNV interval and will have the following
INFO fields, with specified constraints:
SVTYPE: SV type [DEL,DUP]
CHR2: Secondary chromosome; set to same as CHROM
EN... |
01a446f527a1a92d7d13b7ffcf6f719e85d64786a42ddabdbae1b772efd130e8 | Python | 5,526 | 148 | #
# 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... |
e9435d98b8b70cfa9047816b57d733d71de177b3043ceea4c05f95e8c8985d4a | Python | 5,526 | 144 | """
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 pickle
import numpy as np
import pandas as pd
from ase import neighborlist
from ase.neighborlis... |
c2f96abd87961b2b0ec835135aea3aaac98f84bb695428db20de49e40138a01d | Python | 5,527 | 174 | #!/usr/bin/env python
# HiC-Pro
# Copyleft 2016 Institut Curie
# Author(s): Nicolas Servant, Eric Viara
# Contact: nicolas.servant@curie.fr
# This software is distributed without any guarantee under the terms of the BSD License
"""
Script to keep valid 3C products overlapping with Target
The list of valid pairs on ta... |
b2e95ad181efb0c5d8ca5bac033452c39bcc35a1dde30c065b329c403001bab4 | Python | 5,528 | 178 | import argparse
import pandas as pd
from sklearn.model_selection import train_test_split
import pandas as pd
from sklearn.preprocessing import StandardScaler
import numpy as np
from proposed_model import ProposedModelFrameWork
from sklearn.metrics import precision_recall_fscore_support, accuracy_score
import matplotlib... |
8bc0f0ba0dd32c57f26035c52746f2529932b291126dc2a377ac9685c21bad74 | Python | 5,529 | 161 | #!/bin/python
#------------------- Description & Notes --------------------#
#------------------- Dependencies ---------------------------#
# Standard imports
# Third-party imports
import numpy as np
import pandas as pd
import dask.bag as db
from scipy import sparse
from sklearn import preprocessing
from sklearn im... |
c1dc83ece0d5b8e2b6a26ee1f8869f4ca7ab861162cdfc8fae6586b7b491a06c | Python | 5,529 | 145 | import warnings
from typing import TYPE_CHECKING, Any, Tuple
if TYPE_CHECKING:
import numpy as np
import torch
class ZeroCopyTensorsWarning(UserWarning):
"""
Warning for unsafe or failed zero-copy tensor serialization/deserialization.
"""
pass
warnings.filterwarnings("once", category=ZeroC... |
38a5d88c10c454b0b34877bf471e74d4e569e272b37b0a5e0f617c4176e773e7 | Python | 5,530 | 135 | #!/bin/python
import argparse
import json
import logging
import subprocess
from os import listdir
import os.path
"""
Summary: Cursory validation of Terra input JSONs for pipeline workflows.
Checks if JSONs contain all required inputs and that
they do not contain extraneous inputs. Does not perform type-checki... |
7b83610bee5aae3a8d01c590c9cc760eca7ffc36ea4ef28da7586367c785faa5 | Python | 5,530 | 177 | ####################################################################################################
# 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... |
7e864593a1c2e18fbc79e6b6ba8fc6d7d250c2e27e8cfa87f6b9a782e783e8e8 | Python | 5,530 | 168 | # -*- 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.
#... |
47684f0807b360698b948dbc4783216100fc02264a376adc5f65b608eb8de107 | Python | 5,531 | 167 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 13 17:56:31 2023
@author: hansav
"""
import os
import numpy as np
from pcntoolkit.util.utils import calibration_descriptives
from pcntoolkit.dataio.fileio import load_nifti, save_nifti
from pcntoolkit.dataio.fileio import load as ptkload
from pcnto... |
91877cc4cd965c7ea85900247e67c92b02c2e0743c9a42a3558d3a14b41399e6 | Python | 5,532 | 166 | import unittest
import numpy as np
import torch
import torch.nn as nn
from pfrl.testing import torch_assert_allclose
from pfrl.utils import copy_param
class TestCopyParam(unittest.TestCase):
def test_copy_param(self):
a = nn.Linear(1, 5)
b = nn.Linear(1, 5)
s = torch.from_numpy(np.rando... |
6a89a5ed9133ae20df866ea82dcb719efcdc9673ba57eea2fe1d40470b716d3d | Python | 5,533 | 148 | import numpy as np
import nir
def test_generate_time_gridded_data():
spikes = np.random.randint(0, 2, size=(10, 10, 10)).astype(bool)
dt = 0.1
gridded = nir.TimeGriddedData(spikes, dt)
node = nir.NIRNodeData({"spikes": gridded})
graph = nir.NIRGraphData({"node": node})
assert np.allclose(grap... |
c925b40994b5560f3c8f673230f203776ac8d5145385f4ff29ad7bfd4190edc1 | Python | 5,534 | 157 | """
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 logging
import os
from pathlib import Path
import yaml
from fairchem.core.scri... |
59bf72fa11b9544f929562c6e6e6edd9bec2011d4c8e304a5fcdf8c343943f6b | Python | 5,535 | 188 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
ecdd04f8a11baed80f768485ae9310528a9f7d84de04304068e87f54fde7b578 | Python | 5,536 | 167 | import numpy as np
import os
import argparse
import json
import pickle as pk
import csv
from math import ceil
from sklearn.metrics import r2_score
from src.data.load_data import load_params, load_data, make_input_labels
from src.models.make_model import make_model
from src.tools import check_path
def train(params, d... |
3cf96e8d756902dd97925bbc72a0234521f7f7c23b5dd63de2e91d509dadd020 | Python | 5,537 | 163 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 13 17:56:31 2023
@author: hansav
"""
import os
import numpy as np
from pcntoolkit.util.utils import calibration_descriptives
from pcntoolkit.dataio.fileio import load_nifti, save_nifti
from pcntoolkit.dataio.fileio import load as ptkload
from pcnto... |
d9fb672e32b9e3decfdcfc53a56eb53682cd3a7845741a752d463593383436ab | Python | 5,537 | 164 | import gmsh
import ufl
import numpy as np
import dolfinx.fem as fem
from dolfinx.fem.petsc import LinearProblem
from dolfinx.io import gmshio
from typing import List, Tuple
from mpi4py import MPI
from petsc4py.PETSc import ScalarType
from shapely import geometry as geo
from neuron_morphology.transforms.geometry import ... |
751ef3dba35652fcacdc1aef3b7c17f3dbb29c4b71b10d309fe0e7811f5412bf | Python | 5,540 | 125 | """
-> Because all images were available in 8bit format (which got checked with this script too),
we simply combine the three individual gray-scale images to RGB8 images.
(c) 2023, Maximilian Otto, Berlin.
"""
# ----------------------------------------------------------------------------------------------- #
# Gl... |
d8ce007b9c212786ae9a265bbe9f36073b5beba3187e5b64b722919f60fc258a | Python | 5,541 | 155 | """
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 csv
import gzip
import io
import json
import logging
import os
from typing import TYPE_CHECKING,... |
1e24a4009d16f3d5a8ac5473dba9b3a03e26fe3ffe2bba0858984be07ce4be73 | Python | 5,542 | 131 | import os
import pandas as pd
import numpy as np
from tqdm import trange
import scanpy as sc
import scipy.sparse as sp
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.pyplot import MultipleLocator
from .utils import var_stabilize
import math
def plot_gene(adata, platform="visium", sorted_by=... |
688e536e61f7faea5ae72edb3e7d0cea6c3b27679929e3f576ec3c8c3894f71c | Python | 5,543 | 118 | # Ultralytics YOLO 🚀, GPL-3.0 license
import torch
from ultralytics.yolo.engine.results import Results
from ultralytics.yolo.utils import DEFAULT_CFG, ROOT, ops
from ultralytics.yolo.utils.plotting import colors, save_one_box
from ultralytics.yolo.v8.detect.predict import DetectionPredictor
class SegmentationPredi... |
705aa1bf984a70d58837dae695c496c9c88335ceae74734e7d7fd5d72aacd950 | Python | 5,543 | 160 | """Animations of the Sintel data."""
from typing import Optional, Tuple
import numpy as np
from matplotlib import colormaps
from flyvis import utils
from ..visualization import figsize_utils
from .animations import AnimationCollector
from .hexflow import HexFlow
from .hexscatter import HexScatter
class SintelSamp... |
38a2c35114b13d4d2db59d936d652661b7bb7855d48f3351cb1c86414baccc02 | Python | 5,544 | 152 |
import imageio
import glob
from skimage import io
from skimage import color
import numpy as np
for modality in ['bold']:
for stimDur in [1, 2, 4, 12, 24]:
# for stimDur in [12,24]:
# Cropping images
files = sorted(glob.glob(f'/Users/sebastiandresbach/Desktop/{modality}_{stimDur}/Scree*.png'))
... |
c4a633439c77860e49225b984353bce314b0bbc720f77b1080ed2d3327980814 | Python | 5,544 | 161 | #
# calculation of synthetic accessibility score as described in:
#
# Estimation of Synthetic Accessibility Score of Drug-like Molecules based on Molecular Complexity and Fragment Contributions
# Peter Ertl and Ansgar Schuffenhauer
# Journal of Cheminformatics 1:8 (2009)
# http://www.jcheminf.com/content/1/1/8
#
# seve... |
0b0aec4c48e3f1699af665c31eab9c042d9b1fb34f611d0d46237edd5bbb627c | Python | 5,545 | 158 | import logging
from concurrent.futures import ThreadPoolExecutor
from dataclasses import dataclass
from queue import Queue
from typing import List
from ray._common.utils import hex_to_binary
from ray._raylet import GcsClient
from ray.autoscaler.v2.instance_manager.instance_manager import (
InstanceUpdatedSubscribe... |
1192c3fbeead49d13c5ed56e7f0b48e9daae915fd0c2f2341906a891bfadc9af | Python | 5,545 | 212 | # -*- coding: utf-8 -*-
##### ----------------------------- IMPORTS ----------------------------- #####
import os
import numpy as np
import pyedflib
##### ------------------------------------------------------------------- #####
class EdfMaker:
"""
Create EDFs to test seizure detection.
"""
def __... |
8e9bc647c6499b2b2ea509a58997f1962080934554309db953e99f8b828b0124 | Python | 5,546 | 181 | """
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 for the ASE DFT-D3(BJ) calculator wrapper.
"""
from __future__ import annotations
from typing import TYPE_CHECKING, ClassVar
import nu... |
9986c0118ae2957acfcd8dd2ce0be4fdcc4904ef23bf64aeb886c2ae90f89da2 | Python | 5,546 | 165 | import tensorflow as tf
from utils.nn import linearND, linear
from mol_graph import atom_fdim as adim, bond_fdim as bdim, max_nb, smiles2graph, smiles2graph_test, bond_types
from models import *
import math, sys, random
from optparse import OptionParser
import threading
from multiprocessing import Queue
import rdkit
fr... |
2a115cb6fd3508c22d86f605d7375fb4880b4c9120c7fb86ebc72229463ad584 | Python | 5,549 | 154 | import scipy.spatial as SS
import numpy as np
# import gpytorch
def SE(X, l, zeta=1e-3):
"""
squared exponential covariance function on input X with lengthscale l
"""
tmp = SS.distance.pdist(X, "euclidean") ** 2.0
tmp = SS.distance.squareform(tmp)
if l == 0:
cov = (1 - zeta) * (tmp ==... |
f3c9ae38a68d2328794c88ded70a6c5cd10ea4950672513b4078799e36ebab99 | Python | 5,552 | 143 |
import sys
import numpy
import random
import yaml
import os
import torch
import argparse
import time
import json
from tqdm.auto import tqdm, trange
from collections import defaultdict
from torch import nn, optim
from stedopt.tools import ParameterSpaceGenerator, create_savename
from stedopt.algorithms import Algorit... |
0d3ae427dbf9cd970a21e17efe45ffa6e05a23363e0589b654bddec047e61812 | Python | 5,553 | 124 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
"""
Standardize a VCF of SV calls.
Each record corresponds to a single SV breakpoint and will have the following
INFO fields, with specified constraints:
SVTYPE: SV type [DEL,DUP,INV,BND]
CHR2: Secondary chromosome [Must be lexicographically greater than CHROM]... |
655793db444e200effd7ffb36b89a79ba82488d2f0b72587cbe5203c1da4545c | Python | 5,553 | 200 | """ENCODE cCRE (candidate cis-Regulatory Elements) API client.
Updated to use the ENCODE Portal search API which returns JSON when
`Accept: application/json` and `format=json` are provided.
"""
from typing import Dict, List, Optional, Any
from ..base import BaseAPIClient
class CCREClient(BaseAPIClient):
"""Clie... |
94fb68f1f90b19919388e5d4526a4ca8327f05632d18fbc4ea08a99ac264f22d | Python | 5,555 | 122 | # 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... |
59f90e10d6278731d9023c4c0ec7c49c80d7cf7091cee8b0ecdf7511043ad19a | Python | 5,558 | 123 | # 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... |
d2a34de245aef217ed975357b060e7e9c381278bd8554fe8869cf3c8f9aefe58 | Python | 5,559 | 184 | from argschema.schemas import ArgSchema, DefaultSchema
from argschema.fields import (
InputFile, OutputFile, String, Nested, Dict, List, Int, Field, Float)
from marshmallow import ValidationError
from neuron_morphology.features.layer.layered_point_depths import \
LayeredPointDepths
def validate_point_depths_... |
e5491810f5090a70822835ed6675d5abe3334cc50665b0fbe5f40d62629cc3f1 | Python | 5,561 | 202 | from typing import TypeVar, Type, Dict
import inspect
import warnings
from neuron_morphology.feature_extractor.data import Data
from neuron_morphology.constants import (
SOMA, AXON, BASAL_DENDRITE, APICAL_DENDRITE)
Mr = TypeVar("Mr", bound="Mark")
class Mark:
""" A tag, intended for use in feature selectio... |
00bf996f6a067a270b197dec8cb75706165b02bf7c65be6f83a04c300ff2dbf7 | Python | 5,562 | 134 | import warnings
import numpy as np
import torch,os,pickle,time
from os.path import join
from tqdm import tqdm
from torch.nn import DataParallel as DP
from tools import *
np.set_printoptions(suppress=True)
import warnings
warnings.filterwarnings("ignore")
import multiprocessing
multiprocessing.set_start_me... |
5ddcb3501d831e1b3c527392a776cd7f712a239051244ac077324f02e413356d | Python | 5,563 | 135 | import os
import sys
import io
import numpy as np
import torch
import cv2
from skimage import io
########################################################################################################################
def create_feature_maps(init_channel_number, number_of_fmaps):
return [init_channel_number * 2 *... |
534cf23187472b1af243eef9239508136d9b8b59cc0fa73e8763db515cefa3c1 | Python | 5,564 | 134 | import requests
from .__config import base_url
from .__aux_funcs import process_response
def get_all_clinical_attributes(direction="ASC", pageNumber=0, pageSize=10000000, projection="SUMMARY", sortBy=None):
"""
Get all clinical attributes from cBioPortal. \n
:param direction: Direction of the sort. \n
... |
eff076ce260a536a804c97f18ad934d1fdd5fe5602f15d3e957c53bd02abf88c | Python | 5,565 | 152 | import tensorflow as tf
from utils.nn import linearND, linear
from mol_graph import atom_fdim as adim, bond_fdim as bdim, max_nb, smiles2graph
from models import *
import math, sys, random
from optparse import OptionParser
import threading
parser = OptionParser()
parser.add_option("-t", "--train", dest="train_path")
p... |
16fa3167b66726cbd4d3e143501f84af35957128e7ac5505895444fadb896d37 | Python | 5,567 | 189 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
"""
import argparse
import itertools
from collections import defaultdict
import pysam
import svtk.utils as svu
from svtk.famfile import parse_famfile
def get_inh(called, fam):
"""
Get list of children per inheritance status
Returns
-------
in... |
8ed8b4de8e2e39f4166136afeebb8e2b7e81c9a3550213792128fa8e2e9a20b4 | Python | 5,567 | 146 | r"""
This module contains special analysis functions that relate to some tehnical mozaik architecture aspects and thus
do not represent a standard analysis
"""
from mozaik.analysis.data_structures import PerNeuronValue
from mozaik.analysis.analysis import Analysis
from mozaik.storage import queries
from parameters imp... |
ed4e022964211c7ecd9d78464989f2c2e741a8d30921692a4d2944c19c4691a8 | Python | 5,570 | 150 | """
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 traceback
from typing import TYPE_CHECKING, Any, ClassVar
import numpy as np
import p... |
2d61fd5f759c8c4d0482db9f6a3de4c66fe4604f528f0531014f1fed1bc56dfc | Python | 5,573 | 123 | r"""Vendored access to `CLEAN <https://github.com/tttianhao/CLEAN>`_ for real
enzyme EC-number prediction (Yu *et al.* 2023, Science).
CLEAN is a contrastive-learning model over ESM-1b embeddings that assigns EC
numbers by max-separation from ~5,200 EC cluster centres of reviewed SwissProt.
It has no PyPI package and ... |
c5e3e09d83223672f9f10cfba809fccf7139fa8bf0d8322b83861f9dc1f01427 | Python | 5,573 | 175 | # Demonstration of RLlib's ReplayBuffer workflow
from typing import Optional
import random
import numpy as np
from ray import tune
from ray.rllib.utils.replay_buffers import ReplayBuffer, StorageUnit
from ray.rllib.utils.annotations import override
from ray.rllib.utils.typing import SampleBatchType
from ray.rllib.uti... |
11b6262644b807a9a86349bb4a669c1488d2a8cd14534cb26a6fd038a4e8d436 | Python | 5,575 | 110 | import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
# Load the data into a DataFrame
from io import StringIO
# Assuming the data is loaded into a DataFrame named `df`
# Initialize lists to hold aggregated data
thresholds_list = list(range(2, 101))
mean_scores_a = []
std_devs_a ... |
40be2a5ca7b9593145ad3e759a678cdaa16a2c3bd27ec79374d320ff8a91b539 | Python | 5,576 | 184 | import tempfile
import pytest
import yaml
from flyvis.utils.config_utils import HybridArgumentParser
def test_basic_hybrid_args():
"""Test basic hybrid argument parsing with required args from CLI."""
parser = HybridArgumentParser(
hybrid_args={
'task_name': {'required': True},
... |
70917a21c66823bbaeea18d51fb430d13c67f176f7d498df5da08ea335945fa7 | Python | 5,577 | 123 | import os
import numpy as np
import matplotlib.pyplot as plt
project_root = "/ccb/cybertron/khchao/splam-analysis-results/"
# albation_study_root=f'{project_root}results/albation_study/MODEL/subset_10000/'
albation_study_root=f'{project_root}train/src/MODEL_TEST/'
output_dir = f'{albation_study_root}img/'
os.makedirs(... |
12204ca30371df50be9aabaf28b50d8b2883a941bec5bec913b6b28fe467e921 | Python | 5,580 | 171 | """
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
import numpy.testing as npt
import pytest
import torch
from fairchem.core.datasets ... |
342484de62f4cadd90aa4e781d98e8228423c4e637ef110435db1ac2025eb064 | Python | 5,582 | 181 | from functools import reduce
import numpy as np
import scipy.sparse as sparse
from scipy.ndimage import zoom
def deconvolute(matrix, bias, invert=False):
"""
Applies bias factors to a sparse matrix.
Parameters
----------
matrix : scipy.sparse.spmatrix
The matrix to bias. Will be converte... |
61d2ea64c03cc786b9f367c711eb6258ab7480a83fba169468087cfe7c12f8a7 | Python | 5,582 | 156 | """Scope guard for the "docstring-only" pull-request label.
The label skips a library's test suites on a pull request that changes only
docstrings, and keeps the library's docstring doctests. Skipping is safe only
when no code changed, so this guard runs whenever the label is present and
fails unless every changed fil... |
63cdb740a6a4a3c900d3a76205ba8ec4ffd7dca5cb031dd741880958f74a0633 | Python | 5,582 | 186 | import bisect
import json
from typing import Dict, List, Tuple
from ray.data._internal.util import GiB, KiB, MiB
from ray.util.metrics import Histogram
# Node id string returned by `ray.get_runtime_context().get_node_id()`.
NodeIdStr = str
# Used for time-based histograms (e.g. task completion time, block completion... |
c9580ac77d8916eaf3ca573fb952d05ab30824cb33a8ffef9712e82584dcbb78 | Python | 5,582 | 156 | from typing import Union, List, Dict
import numpy as np
import pandas as pd
import scanpy as sc
from anndata import AnnData
def _validate_obsm_key(ad, key, as_df=True):
"""
Validates and retrieves the data associated with a specified key from the provided AnnData object.
Parameters
----------
ad ... |
291fa517e5656968df2ceb555396624b7f1b1f625bb4e99ff19b9a98c2625dbf | Python | 5,583 | 161 | """Sklearn-backed CPU t-SNE for ``ov.pp.tsne``.
A direct ``sklearn.manifold.TSNE`` wrapper that bypasses
``scanpy.tools._tsne``. Two reasons we don't just call scanpy:
1. ``scanpy.tl.tsne`` does not expose ``n_components`` (issue #683) —
we need it to be honoured end-to-end so ``ov.pp.tsne`` can produce
3-D / k... |
cfc80bd4a3541e3af852d89a38ef9c1270ed80bea3d128e7868ea902986647ec | Python | 5,584 | 162 | import numpy as np
from gym import spaces
from pfrl import env
class ABC(env.Env):
"""Toy problem only for testing RL agents.
# State space
The state space consists of N discrete states plus the terminal state.
# Observation space
Observations are one-hot vectors that represents which state i... |
a14549f80039ec791d2968e9a1dbe9112361d1ba18b9ff61426ba935bee7eea4 | Python | 5,587 | 163 | import unittest
import io
import random
import numpy as np
import torch
from hashlib import sha256
import vamb
import testtools
# PyTorch cannot be made stable, so we cannot run CI on the result
# of pytorch training.
# Nonetheless, you can enable it locally with this switch here,
# which can be useful sometimes.
TES... |
fc42b10583bbc5180a0bd1cc60d2fdece73a29002612d61e1ba86ebed4b5bc97 | Python | 5,587 | 169 | """Pure-Python SuperCell implementation.
The original R SuperCell (Bilous et al. 2022) reduces a single-cell dataset
to ``N / gamma`` "metacells" by:
1. Building a ``k_knn``-nearest-neighbour graph on a low-dimensional
embedding (default ``X_pca``).
2. Running **walktrap** community detection with walk length 1 — ... |
b50b20d8a38e5ee134ccf6f95156ffee5f6203e273c9ede2394bea2e292373ca | Python | 5,589 | 144 | import torch
from networks.attention_gan import Generator, Discriminator
from modules.module_unet_dpm import GAN as UnetGan
from utils.reggan.transformer import Transformer_2D
from utils.reggan.reg import Reg
# Define the custom GAN class inheriting from UnetGan
class GAN(UnetGan):
def __init__(self, config):
... |
fa595beba22f8981148a24b051b793e8c48b0ebc5a9ac901a18d200925dd4f5d | Python | 5,589 | 127 | from .._registry import register_function
@register_function(
aliases=["本地GPT注释", "gptcelltype_local", "local_ai_celltype", "本地AI注释", "离线细胞注释"],
category="single",
description="Local LLM-powered cell type annotation using Hugging Face models without API requirements",
examples=[
"# Basic local ... |
b18499db3af8dfae4e0f3ad937967fdc8dedaaa2060cf54084842d961360a07b | Python | 5,592 | 153 | import base64
import json
import sys
import pytest
import ray
from ray._private.test_utils import (
format_web_url,
wait_for_condition,
wait_for_dashboard_agent_available,
wait_until_server_available,
)
from ray.dashboard.tests.conftest import * # noqa
from ray.job_submission import JobSubmissionClie... |
f6e67fba3f0d5bce42bf75f937768ad742322b588069b93f2c6a2df2454bd102 | Python | 5,592 | 181 | import torch.nn as nn
import torch.utils.model_zoo as model_zoo
import torch.nn.functional as F
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resnet152']
# Based on torchvision implementation
# https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py
def conv3x... |
b6da05bfd23361b5c972fc86581cdab523c956f24aa0675865cdc8e4154445f0 | Python | 5,594 | 138 | import os
import argparse
import scipy.io as sio
import numpy as np
import tensorflow as tf
from tensorflow.keras.layers import *
from tensorflow.keras import backend as K
import matplotlib.cm as cm
from tensorflow import keras
from skimage.transform import resize
import matplotlib.pyplot as plt
def gradcam(model, l... |
367f67b6c0693c7b74448ffd258e2e566bba4158c5d2e8000d93b003bc9cc5d5 | Python | 5,595 | 134 | from typing import Callable
import torch
import torch.nn as nn
import math
from spikingjelly.clock_driven.neuron import LIFNode as LIFNode_sj
class BPTTNeuron(LIFNode_sj):
def __init__(self, tau: float = 2., decay_input: bool = False, v_threshold: float = 1.,
v_reset: float = None, surrogate_function: ... |
a3f23547d2523ec10124afe57bdc56a2117e2502df0571ab32cca0e7313fe4fd | Python | 5,596 | 124 | r"""
This module defines the API for:
- implementation of stimuli as input to models (see class BaseStimulus)
- identification of stimulus identity
- function helpers for common manipulation with collections of stimuli
Each stimulus is expected to have a list of parameters which have to uniquely identify the stimulus... |
4312a0bfadb35acaa69af83150e6d71f058ce611a1dde7e3fcd9b2f10e5caa62 | Python | 5,597 | 202 | from __future__ import annotations
import logging
from pathlib import Path
import scanpy as sc
import scvi
from rich.console import Console
from rich.logging import RichHandler
popv_logger = logging.getLogger("popv")
class Config:
"""
Config manager for PopV.
Examples
--------
To set the seed
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.