sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
893ca8378bfa6e0df0d1daef17989f98fc1851c660f9565625d837e9aa84cfa1 | Python | 25,750 | 572 | from typing import List, Tuple, Optional
import numpy as np
from anndata import AnnData
import scanpy as sc
import pandas as pd
from tqdm import tqdm
#
from scipy.optimize import nnls
from sklearn.neighbors import NearestNeighbors
from sklearn.preprocessing import normalize
from scipy.stats import pearsonr
#from .helpe... |
9ee85a3d06daac84ae6c2a2eb316bd54bdf61931c394131fd8c44c2fb2f6fa18 | Python | 25,750 | 730 | import copy
import json
import logging
import os
import subprocess
import sys
import time
from threading import RLock
from types import ModuleType
from typing import Any, Dict, Optional
import yaml
import ray
import ray._private.ray_constants as ray_constants
from ray._common.network_utils import build_address
from r... |
3434ebd3913bfcec9530ae67fac3a2203c34513162d237077e751b1cb039708b | Python | 25,751 | 518 | # built-in libraries
import time
import os
import pickle
from copy import deepcopy
import json
import argparse
from functools import partialmethod
# third party libraries
from tqdm import tqdm
import torch
from torch.utils.data import DataLoader
import numpy as np
from torchvision import transforms
# from ml project ... |
d8dedef3f7d05a9dbf1e9e072a295bbab200a09452d17e609b3062c358e85b96 | Python | 25,797 | 650 | """Command-line interface for bioinformatics data collection."""
import click
import sys
from typing import Optional, List
from src.utils.logging import setup_logging, console, get_logger
from src.utils.database import initialize_database, check_database_connection, get_table_stats
from src.collectors.uniprot_collect... |
b3c4c9a46ac0a11d9af7b96e33f37df8bd491104300e2a641490b9b08e051b63 | Python | 25,800 | 759 | __doc__ = "Various classes and functions Vamb uses internally."
import gzip as _gzip
import bz2 as _bz2
import lzma as _lzma
import numpy as _np
import re as _re
from vamb._vambtools import _kmercounts, _overwrite_matrix
import collections as _collections
from itertools import zip_longest
from hashlib import md5 as _m... |
30685c55bc46591b984d2ca6713d14943e518610b8bee13a1a277dbce91e8b0f | Python | 25,814 | 829 | """High-level Python wrappers for BioContext MCP tools.
Each function is registered via ``@register_function`` so the
OmicVerse Agent can discover and call them automatically.
"""
from __future__ import annotations
import pandas as pd
from typing import Any, Dict, List, Optional, Union
from ..._registry import regi... |
57edcacf55be0bdb1d28ba733a05e3faeb1e9d331f9c10dcfc6f697dd3486dd6 | Python | 25,828 | 690 | # -*- 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-locals
"""Tests for the high level simulator devices functionality."""
from unittest import SkipTest
from torch import Tensor, zero... |
15dfb6485bc1376c2158b6a4bff1a34dca018432bf976258ae7979a7a2d94f10 | Python | 25,840 | 526 | # coding=utf-8
# Copyright 2023 The HuggingFace Inc. team.
#
# 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... |
fb047c1073ea2948309beb52f99c2e8ff458a26d717b6391d2192d83289e455d | Python | 25,861 | 598 | # 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... |
03f5e652c2bd2e1ea51ee2a022b4f236e63cb83e5a7d726897a99f11d2aab012 | Python | 25,862 | 613 | import numpy as np
from scipy import sparse
from sys import getsizeof
from tqdm import tqdm
#from ._unot import unot
from ._unot_torch import unot_torch as unot
def cot_dense(S, D, A, M, cutoff, eps_p=1e-1, eps_mu=None, eps_nu=None, rho=1e1, nitermax=1e4, stopthr=1e-8):
""" Solve the collective optimal transpor... |
0bd31c929afde87a9a626a9229d025982650328fcb8764c636a94741878579d4 | Python | 25,866 | 807 | import math
import numpy as np
import torch
from torch import nn
import pdb
import torch.nn.functional as F
import matplotlib.pyplot as plt
import torchvision
from latent_time_stepping.AE_models.ViT import ViTEncoderLayer
def get_activation_function(activation_function: str) -> nn.Module:
if activation_function... |
bc5781588b869e44b4721aec0cdbfeb36810be03fd33f92f52aa25a8b68a9810 | Python | 25,872 | 560 | # -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals, absolute_import, division
import warnings
from scipy import misc
from csbdeep.internals.probability import ProbabilisticPrediction
from .config import Config
from .base_model import BaseModel, suppress_without_basedir
from ..utils impor... |
c4bcd8a2972dca735ae360bb50befa3a2692cf51e8994a780741cf73e5d56657 | Python | 25,911 | 760 | # 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, ... |
953d3a2a1e69152f420148dbf9f76c16b0220b87b4e90bcc379be537157f684a | Python | 25,916 | 555 | # --- START OF FILE rag_system.py ---
import os
import time
import json
from datetime import datetime
from typing import List, Optional, Dict, Any, Union
import logging
from logging.handlers import RotatingFileHandler
import chromadb
from langchain.chains import RetrievalQA
from langchain.docstore.document import Docu... |
47caca5d28b03a5c73f5de786e79f416f5f3d9847511a97fd800539af017c371 | Python | 25,921 | 375 | # -*- coding: utf-8 -*-
"""
Module containing texture specific analysis.
"""
import mozaik
import numpy
import quantities as qt
from mozaik.analysis.analysis import Analysis
from mozaik.tools.mozaik_parametrized import colapse, colapse_to_dictionary, MozaikParametrized
from mozaik.analysis.data_structures import Single... |
c91a0fa3440dfaa8d8ed3419a048539d830d591598771bd1be2b7f6a45420aa4 | Python | 25,925 | 749 | import logging
from itertools import product
from numbers import Number
from typing import Iterable, Optional
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import torch
from datamate import Directory, Namespace, root
from matplotlib.colors import Colormap
from matplotlib.patches import Regular... |
0ddafd7ee063d23b87b84baea3b62b33f8864aeaca30e789bd5e50ee3a9efb1f | Python | 25,929 | 642 | from typing import Dict, List, Optional, Union
import json
import os
import pickle
import random
import torch
import numpy as np
import optuna
from sklearn.metrics import accuracy_score, f1_score
from sklearn.preprocessing import LabelEncoder
from transformers import AutoConfig, BertConfig, BertModel, get_linear_sched... |
bceac5ceea8e24d79dcdcbdc6bbd3b5f3e1286de680405cc514bbc6427adf923 | Python | 25,930 | 661 | import torch
import torch.nn as nn
import torch.optim as optim
from torchvision import datasets, transforms
from torch.utils.data import Dataset, DataLoader
from copy import deepcopy
import numpy as np
import matplotlib.pyplot as plt
import argparse
import pdb
import os
import sys
import scipy.io
from scipy.sparse impo... |
1a6907bce0aea520c01e555413d162b2e3e2140b8f193928162e626d8fa9a47e | Python | 25,936 | 747 | import sys
import subprocess
import pickle
from datetime import datetime
import os
import time
import re
import shlex
from mozaik.cli import parse_parameter_search_args
from mozaik.tools.misc import result_directory_name
import json
from mozaik.tools.json_export import save_json
def _shell_export_lines(env):
r"""... |
cdb6585397a31a98c759ba009964bb4fe4bd5755fbfdc9e78ca73aea1b23fe7d | Python | 25,936 | 662 | """
Model Configuration and Management for OmicVerse Smart Agent
Provider Registry pattern inspired by OpenAI Codex CLI ModelProviderInfo.
Each provider is registered once with all metadata (base_url, env_key,
wire_api, models). Legacy dicts (AVAILABLE_MODELS, PROVIDER_API_KEYS, etc.)
are computed from the registry f... |
10e5c87abff7673d586b1fa83ece05f7d95bbd2f1919adc01433dc6fa2b86ca8 | Python | 25,944 | 738 | """
Core functions for running Palantir
"""
from typing import Union, Optional, List, Dict, Tuple
import numpy as np
import pandas as pd
import networkx as nx
import time
import copy
from sklearn.metrics import pairwise_distances
from sklearn import preprocessing
from sklearn.neighbors import NearestNeighbors
from s... |
9d07f853c1012e435e621d1f71f24fc3eef6185bb9e01c4f1707c0353769f16b | Python | 25,992 | 673 | """
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: Correctness of the edgewise fusions used by the
UMA-S fast-GPU backend at lmax=mmax=2:
- producer: wigner_conv1_fused... |
6c2a33291f6676394640b55052b3493e689ddaf927f3bb9713d59a3343755d49 | Python | 25,994 | 585 | """Core SPLIT workflow functions for AnnData objects."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Iterable, Literal
import warnings
import numpy as np
import pandas as pd
from scipy import sparse
from scipy.spatial import cKDTree
from .._registry import register_functio... |
85f70528b98eb6d2d956fa8926d5484d514db7c59618128c2b7f81815cac157a | Python | 26,039 | 752 | # -*- 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.
#... |
190168fe1f2f42289466c306cf104bb920e26c27709204347aa4dc70ff462ea1 | Python | 26,043 | 759 | # 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, ... |
8e96ab108ac6ff6a903c94a62b8626fde78aa63ef7a7c2e8c6d6a7214734a7b4 | Python | 26,050 | 539 | #Ligthning data module
from . import __file__
from distributed import wait
import glob
import geopandas as gpd
import numpy as np
import os
import pandas as pd
from pytorch_lightning import LightningDataModule
from src import generate
from src import CHM
from src import augmentation
from src import megaplot
from src im... |
168257c35c8061111717482bcb41ec59cb563b2d05329b8f30bee84bc4a38f92 | Python | 26,067 | 687 | # -*- 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.
#... |
779c9ad487e2c577eff12a60c7a2f92267e2bb55c68f7bb32c8edad5ad5bd1e1 | Python | 26,070 | 614 | # --------------------------------------------------------
# Swin Transformer
# Copyright (c) 2021 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ze Liu
# --------------------------------------------------------
import torch
import torch.nn as nn
import torch.utils.checkpoint as chec... |
371faa33cad8bda2c1d3143b5285b9f33b85201d15358d7de1db7070bbec39df | Python | 26,083 | 453 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'form.ui'
#
# Created by: PyQt5 UI code generator 5.15.2
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, ... |
4313747914063f8182a5f6d10f23db5c5402e6419118033be4183cc508a2ff8c | Python | 26,085 | 659 | import datetime
import json
import logging
import os
from abc import ABC, abstractmethod
from collections import defaultdict
from typing import Any, Dict, List, Optional, Tuple, Union
import requests
from ray._common.network_utils import build_address
from ray.autoscaler._private.constants import WORKER_LIVENESS_CHEC... |
d6e6c4b447d178191e4f34e3a1e832cdedb18f648485c58a562e758737438bca | Python | 26,091 | 808 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for Bio-Diffusion (https://github.com/BioinfoMachineLearning/bio-diffusion):
# --------------------------------------------------------------------------------... |
5c7ba85999afc2623c8b9bd2ea3fd88cf2acdf0245668ec4f47a5760d0a3d102 | Python | 26,092 | 534 | # Copyright 2023 TSAIL Team and The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
d7a22bf8ed1d3e9f4a7fb756202759c47e05ab11060f6d694483a356a67ccb86 | Python | 26,105 | 431 | """
InsectBrain: micro-CT of ant heads with semi-manual brain masks (Toulkeridou et al. 2023), Dryad CC0.
Download (Dryad needs a browser or an API token; the API without token returns 401):
https://datadryad.org/dataset/doi:10.5061/dryad.qz612jmgv (version 5, published 2023-10-03)
README.md (sha-256 23ab03d43... |
5d06dc0cb9847429f474b33ac75f13cbca562e59680e8d030dba3e0058d3b206 | Python | 26,113 | 1,027 | import numpy as np
import settings
from joblib import Parallel, delayed
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import os
from utils.utils import (
get_hexsym,
get_pathsym,
get_glm_hex,
get_glmbinning_hex,
circlin_cl,
divide_dataset,
create_surrogate_distributio... |
1f3be1293196ac61dc7e15f62e5283872d40343e606de7e5088f68bb52508047 | Python | 26,117 | 645 | ## Modeified code from https://github.com/TencentAILabHealthcare/scBERT
import math
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
from torch.cuda.amp import autocast
from functools import partial
from contextlib import contextmanager
from local_attention import LocalAttention
f... |
15cd6e5d72095a0e99bff791e321be4cdf879fc2bff75ce019ca6769ff8758b6 | Python | 26,119 | 576 | import argparse
import itertools
import pickle
from collections import namedtuple
from typing import Dict, List, Tuple
import h5py
import numpy as np
import torch
import tqdm
import visionloader as vl
from torch import autocast
from whitenoise import RandomNoiseFrameGenerator
import lib.data_utils.data_util as du
imp... |
52b007dc1f33f0c9ee11a9e2b0abf51491ea6b05243c1fce0e0a69cdacb2b935 | Python | 26,131 | 755 | """
Avalanche criticality measures
"""
import numpy as np
import scipy
import matplotlib.pyplot as plt
import powerlaw
import edgeofpy as eop
def detect_avalanches(data, s_freq, time=None, max_iei=.004, threshold=3,
thresh_type='both'):
"""Detect avalanche in coarse-grained electrophsiologi... |
cfe5a6e3751bbd157d638e0e616aad1efd0ec120d9ab3563867bc6adc8fdce4a | Python | 26,141 | 716 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
from torch.utils.data import Dataset, DataLoader
from copy import deepcopy
import numpy as np
import matplotlib.pyplot as plt
import argparse
import pdb
import os
import sys
import... |
39c78c65550d2a85b65b543fd5c6f5272e2de33b0dd93484786183606ab65b87 | Python | 26,146 | 554 | ################################################################################
# -- Preprocessing and analysis of the simulation results
################################################################################
import numpy as np; import pylab as pl; import os, pickle
import matplotlib.pyplot as plt
from scip... |
597a3d169253497ea1fe322014dd853bac73a9ee254d7b0a728d156ea2e6028a | Python | 26,153 | 529 | """SecAct pipelines: activity inference and secreted-protein cell-cell communication.
Ports of R SecAct (Ru et al., Nat Methods 2026)::
SecAct.activity.inference -> activity_inference
SecAct.CCC.scRNAseq -> ccc_scrnaseq
SecAct.activity.inference.ST + SecAct.CCC.scST -> spot_activity + ccc_spatia... |
47ab7245faed3c3d4f24213e80edfc06c9550b76eeb2bc9f9065b6b33c0dd13c | Python | 26,183 | 572 | import os
import numpy as np
import scipy.sparse as sparse
import pandas as pd
from lib5c.util.statistics import adjust_pvalues
import hic3defdr.util.scaling as scaling
import hic3defdr.util.dispersion as dispersion
from hic3defdr.util.printing import eprint
from hic3defdr.util.matrices import sparse_union
from hic3... |
4a67a14c0a494d5059892e0328566f11db44c63cbb94c9ef27b5e646653f46aa | Python | 26,211 | 580 | ####################################################################################################
# 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... |
6db337c1b9bc9de15b1d5ed745a03d259d2c842a93246f40daab62c4aeb0d723 | Python | 26,230 | 580 | # 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... |
a18ffc63b74149e1641a7448c9842563ebc717ff9427b96582a3c355038b7e37 | Python | 26,247 | 611 | # Copyright 2023 TSAIL Team and The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
c204071663e23b01d1b68a900ad6b663441e89cb6fda97e024590462db4e5b74 | Python | 26,257 | 825 | """
This script compiles figures illustrating the effect of boundary size and
boundary rotation on the hexasymmetry for each hypothesis (supplementary
figures S5 and S6 in the manuscript) then saves the figures as .PNG files.
Sets of figures are made for different mean grid offsets (zero or random).
"""
import numpy as... |
bbce509b20c7b5fc72bf3c1d1d415a149fa4b34233620a60c3a7378ae9b21ebf | Python | 26,258 | 549 | # -*- coding: utf-8 -*-
"""Utility functions for 3D SIM reconstruction.
Some functions are heavily referenced from the `cuda-accelerated three-beam SIM reconstruction code`_.
.. _cuda-accelerated three-beam SIM reconstruction code: https://github.com/scopetools/cudasirecon
"""
from typing import Tuple, Union, List, ... |
fb4b464939d9b13d03b5b62577a4199d067c6bc2cb9a603439ddc71fe8872cc6 | Python | 26,269 | 632 | 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 torchvision.transforms as transforms
import scipy
import scipy.ndimage
import P... |
2f2a0fcc9230d3a3965c2025ca0b108a9b88178d1b4bace682f234774666c885 | Python | 26,276 | 632 | # built-in dependencies
import time
from typing import Any, Dict, Optional, Union, List, Tuple, IO, cast, Callable
import math
# 3rd party dependencies
import numpy as np
from numpy.typing import NDArray
# project dependencies
from deepface.modules import representation, detection, modeling
from deepface.models.Faci... |
9f0c3aea4e9786db67e5263c13719d7fa373103334bb4641f85e6f2e5b8e3cd9 | Python | 26,279 | 705 | """
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.
"""
# conftest.py
from __future__ import annotations
import random
from contextlib import suppress
import numpy as np
import pytest
import ra... |
ba068254a057919f0f6c9ca1d657b44057b5f9b1305d2b2f122470dc8d41c4be | Python | 26,284 | 631 | # Copyright (C) 2010-2018 by Haibao Tang et al. All rights reserved.
#
# This code is part of the goatools distribution and goverend by its
# license. Please see the LICENSE file included with goatools.
"""Read and store Gene Ontology's obo file."""
# -*- coding: UTF-8 -*-
from __future__ import print_function
impor... |
df457c38d5eaa7fcd79642b6ff2d0aa360f808ff3453d2d5835750dc3f52d163 | Python | 26,289 | 657 | """Marker colocalization on the same vesicle for single-EV proteomics.
The defining advantage of single-extracellular-vesicle (single-EV) proteomics
over bulk EV proteomics is **single-vesicle resolution**: it can tell which
protein markers physically co-occur on the *same* individual vesicle, rather
than only which m... |
53a663dafbdc054f9a583559a5fdd432834cdd6db2c70171b0c07fc78887a181 | Python | 26,290 | 636 | #TODO: Need a better way to import models
from os import W_OK
import sys
from collections import OrderedDict
import torch
import torch.nn.functional as F
from timm.models.layers import trunc_normal_, to_2tuple
from timm.models.registry import register_model
from timm.models.vision_transformer import _cfg
from .vision_... |
f0b621fa39dd05ae83a591f2c812694bd49a635df03574ceb4b11c9c1e18f92a | Python | 26,303 | 459 | import torch
from torch import nn
import numpy as np
import matplotlib.pyplot as plt
import math
class linear_slab_spike(nn.Module):
def __init__(self, p, n_total, p_confound = 0,init_pi_local_max = 0.1, init_pi_local_min = 0.0, init_pi_global = 0.5, init_beta_var = 1, init_noise_var = 1,
gumbel_... |
7c5ee27f018ff93a9962f52aff8f91b88945544f7b35357a09cd381ff6399437 | Python | 26,304 | 584 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# signed_motif_detection.py --- Python library for identifying signed network motifs based on various reference models.
# Author : Disheng Tang
# Date : 2024-05-10
# Homepage : https://dishengtang.github.io/
import os
import numpy as np
import networkx as nx
import pandas... |
a23c1414860f94cf3c2b9e437c318e5d05c61a0ec9ed5dae8842d7a710b69111 | Python | 26,304 | 610 | r"""System preparation for :mod:`omicverse.mol.md`.
Turns a static structure (a :class:`~omicverse.mol.MolStructure`, a PDB file,
a PDB/gene identifier, or a :class:`~omicverse.mol.DockingResult` pose) into a
solvated, parameterised, simulatable :class:`~omicverse.mol.md.MDSystem`.
"""
from __future__ import annotati... |
b5204a348b8147e573017c4d2fa61a697f4e577794c1a236e883c2c69404b4c2 | Python | 26,306 | 612 | import torch
import torch.optim as optim
from torch.utils.data import Dataset, DataLoader, SubsetRandomSampler, random_split
import pandas as pd
import numpy as np
import os
import random
from collections import defaultdict, Counter
from itertools import combinations
import json
import torch.nn as nn
import torch.nn.fu... |
63d9d98fd9a845461f4ee858bcf183c9eeebd59c256c8b45e1e75c5aebe876d0 | Python | 26,309 | 667 | from skimage import color
import numpy as np
from matplotlib import pyplot as plt
from luminance_analysis import Data
from luminance_analysis.utilities import find_transitions, nanzscore
from scipy.cluster.hierarchy import dendrogram, cut_tree, set_link_color_palette
from luminance_analysis.clustering import find_trunc... |
85b0b3c65002a6be2bb22becb718697d94964cab61ee8daafcd56834ec7c0a13 | Python | 26,338 | 440 | import matplotlib.pyplot as plt
import pickle
import numpy as np
import os
from util import *
from scipy.stats import gaussian_kde
from sklearn.metrics import accuracy_score, confusion_matrix, roc_auc_score, roc_curve, precision_recall_curve, PrecisionRecallDisplay
def plot_scatter_plot(d_score, a_score, indices_1, ... |
13c0ca16fda8e84aaa959db5ec33025621fb3d65f3445fd267c8a5c7f705ba26 | Python | 26,377 | 715 | '''!
@file device.py
Defines a Device class that opens a connection to an Azure Kinect device
and functions to communicate with the device.
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
Kinect For Azure SDK.
@mainpage Welcome
This documentation describes the Python API us... |
6473eab46697081a09581439e6aff26faad866ad21e31b3c53d931d4e2c4d079 | Python | 26,389 | 661 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import copy
from collections import OrderedDict
from torch.nn.modules.utils import _pair
# ======================================================
# Find layer dependency
# Update input indices (adapt to previous layers)
# Update out... |
b9f429ae5e6a912dad16b9eb067d06fcff64dcc3d694b221f3f5b55ed1764a1b | Python | 26,397 | 695 | import argparse
import logging
import math
import os
import random
from pathlib import Path
from typing import Optional
import jax
import jax.numpy as jnp
import numpy as np
import optax
import PIL
import torch
import torch.utils.checkpoint
import transformers
from flax import jax_utils
from flax.training import train... |
048e1abeb8fd529611fd223af8cef88d8b64deded66c55c98144db449161b5c0 | Python | 26,399 | 879 | """Utility function for operations on hexagonal lattices."""
from numbers import Number
from typing import Iterable, Literal, Tuple
import numpy as np
import torch
from matplotlib import colormaps as cm
from numpy.typing import NDArray
import flyvis
from flyvis.utils.tensor_utils import matrix_mask_by_sub
def get_... |
997b3d3876bda5bdec35d90d9eddad13532b03d8552ec12c091fcf7b744be3ce | Python | 26,414 | 757 | # Copyright 2024 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, ... |
f8ef99dd1188b0da134825a85dd1834e6951d96f15772e7686778908a7257288 | Python | 26,442 | 570 | # flake8: noqa E501
from ray.dashboard.modules.metrics.dashboards.common import (
K8S_DISK_USAGE_NOTE,
DashboardConfig,
Panel,
Row,
Target,
)
# Ray Train Metrics (Controller)
CONTROLLER_STATE_PANEL = Panel(
id=1,
title="Controller State",
description="Current state of the Ray Train cont... |
dcedd73bd9c9883c97adb9c73bc6fa7e803dd1864d859bd4a593e5b6df07704e | Python | 26,449 | 659 | """Engine selector for the ov.es scoring kernels.
Each method has a numba CPU kernel (`_func_<name>`) and optionally a
torch GPU kernel (`_func_<name>_torch`). The wrappers in
``ov.es.__init__`` expose an ``engine='auto'|'cpu'|'gpu'`` kwarg; this
module resolves the choice consistently across methods.
Resolution rule... |
000d7a9d031d376bec355068c5a9d4da65a2ce1c6e6fe1daa2d4d4d59df1830f | Python | 26,454 | 657 | r"""Molecular docking for :mod:`omicverse.mol`.
:func:`dock` runs an **AutoDock Vina** docking of a small molecule into a
target structure; :func:`redock_validate` performs the mandatory
docking-protocol validation — re-docking a co-crystallized ligand into its
own receptor and checking the best-pose RMSD against the ... |
bf8afb0dc07359a379bd6bab1729def4a0771ce19dddc1faa6176288cad6db46 | Python | 26,484 | 523 | '''!
@file k4a.py
Defines Python _ctypes equivalent functions to those defined in k4a.h.
Credit given to hexops's github contribution for the
_ctypes.Structure definitions and _ctypes function bindings.
https://github.com/hexops/Azure-Kinect-Python
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed ... |
2174dbbe88fa262b44739bc879a1a69d7e15bc80a2cb4abecd6b56245410097c | Python | 26,516 | 730 | # Vendored from `decoupler` (https://github.com/scverse/decoupler) by
# omicverse for in-tree GPU acceleration work. Original copyright by
# the decoupler authors, redistributed under decoupler's GPL-3.0
# license. Cross-module imports rewritten from `decoupler.*` to
# `omicverse.es.*` (see scripts/vendor_decoupler.py)... |
74ef438dcf8af1de2cb2c5e40005d8ce6ae604775cc29cb30bd45d81f09fb140 | Python | 26,521 | 657 | ####################################################################################################
# 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... |
4d98bf53ebec38122c6e71c94b971c04be829cb3057d04bc74f52e2271841cd2 | Python | 26,533 | 588 | import numpy as np
import os
import tifffile as tiff
import random
import math
import torch
from torch.utils.data import Dataset
###
# this file is for pre-processing images for training and test.
# currently we use splitted dataset
###############################
# dataset class
class trainset(Dataset):
def ... |
172364caf9de37d372832c3d25cab957be3d67f587b992aa410804b400d46a1f | Python | 26,562 | 766 | import pytest
import numpy as np
import mozaik
from mozaik.models import Model
from mozaik.space import VisualRegion
import mozaik.stimuli.vision.topographica_based as topo
from mozaik.tools.distribution_parametrization import load_parameters
from mozaik.space import VisualSpace
from mozaik.models.vision.spatiotempora... |
4db8e6681e52b2868a921733f973fd83c85246437d5ee9d87cab4a79a70912d4 | Python | 26,581 | 649 | """
OmicVerse internal LLM backend (Pantheon replacement)
This module provides a lightweight, provider-agnostic backend to call LLMs
directly, removing the dependency on the Pantheon framework. It is intentionally
minimal: it sends a system prompt plus the user prompt to the selected model
and returns the text content... |
300e29a2419812c6e56d4719c3faa1c5da3bcb6c3fdfc183eb3fcbb46d72a49c | Python | 26,593 | 524 | import inspect
import time
from pathlib import Path
from typing import Callable, List, Optional, Union
import numpy as np
import torch
from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer
from diffusers import DiffusionPipeline
from diffusers.configuration_utils import FrozenDict
from diffusers.m... |
73bf8db2401b0ee715720b2a5870361b8395d0d8b215e1b7a112a091ba5043ef | Python | 26,608 | 723 | import torch
import torch.nn as nn
import torch.optim as optim
from torchvision import datasets, transforms
from torch.utils.data import Dataset, DataLoader
from copy import deepcopy
import numpy as np
import matplotlib.pyplot as plt
import argparse
import pdb
import os
import sys
import scipy.io
from scipy.sparse impo... |
334d794f5d94ad9c22245953b287388d159aa7873ac01727686a77e7c917c98a | Python | 26,637 | 469 | import torch as th
from torch.nn import functional as F
import torch.nn as nn
import numpy as np
import anndata as ad
import scipy as scp
from torchdiffeq import odeint
from .velocity_field import ATACRegVelocityField
from .modules import MLP, GCN, GCNCombined, ATACGCN
from ..utils import normalize, sparse_mx_to_tor... |
07136ea030742310c46e315bc18b494b375fd7fced695d0f1bc1f1b601a70031 | Python | 26,646 | 773 | # 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, ... |
54209a13ea2b4d5c0b591d9f78492be1075a8f9edaee1821b2490e05a48e057e | Python | 26,649 | 814 | """Logger implementing the Command Line Interface.
A replacement for the standard Python `logging` API
designed for implementing a better CLI UX for the cluster launcher.
Supports color, bold text, italics, underlines, etc.
(depending on TTY features)
as well as indentation and other structured output.
"""
import ins... |
5a1d0ab4d57bd3950d16a5f8941fd4ac21b5cf8cfbd8aee1b9936a85a381058f | Python | 26,649 | 625 | from abc import abstractmethod
from typing import Union, Callable, Tuple
import numpy as np
import torch
from torch import nn as nn
from torch.distributions import Binomial, Poisson
from torch.nn import functional as F
class SeparableBernoulliSigmoidSimGLM(nn.Module):
def __init__(self,
stim_ti... |
96e8c6ea89f0a4efcb62a651269d27d5f84e41317fd49c6452d27f1a2f3cd419 | Python | 26,654 | 865 | import collections
import copy
import os
import tempfile
import unittest
import numpy as np
import pytest
import torch
from pfrl import replay_buffer, replay_buffers
@pytest.mark.parametrize("capacity", [100, None])
@pytest.mark.parametrize("num_steps", [1, 3])
class TestReplayBuffer:
@pytest.fixture(autouse=Tr... |
fbe116b2bcbcdb32d62506d3c7e4aaa37b1e0751ce3531be968d4d52c7ccc405 | Python | 26,670 | 697 | import gradio as gr
import numpy as np
import random
import imageio
from tifffile import imread, imsave
import os, cv2
from tqdm import tqdm
import torch
import utility
import model
from div2k import normalize, PercentileNormalizer
DEVICES = ['CPU','CUDA','Paralleled CUDA']
QUANT = ['float32','float16',]
TASKS = ['SR... |
88706fc9c6dbf8e24ed081d4e245a6ed4ee81c3f17bf117c68894566327b9adc | Python | 26,685 | 781 | """Test for helper.py"""
import pickle
import numpy as np
import pytest
from sklearn.datasets import make_classification
from sklearn.pipeline import Pipeline
import torch
from torch import nn
from skorch.tests.conftest import pandas_installed
def assert_dicts_equal(d0, d1):
assert d0.keys() == d1.keys()
fo... |
9cc546d5b5d340b27b6ce63f1c1f655f25aa56c48f805868d288445a475fae3f | Python | 26,741 | 697 | import torch
import torch.nn as nn
import torch.optim as optim
from torchvision import datasets, transforms
from torch.utils.data import Dataset, DataLoader
from copy import deepcopy
import numpy as np
import matplotlib.pyplot as plt
import argparse
import pdb
import os
import sys
import scipy.io
from scipy.sparse impo... |
9d8de3041b74abd08a33bba18091ba26a41547846485a18ee0fc3dc6858ea159 | Python | 26,743 | 749 | # Copyright 2024 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, ... |
9a75cdc89333d2d5b1891cffe1225ad310bf4e4d507162499a21a25290a51c22 | Python | 26,745 | 717 | from ngs_mapper.samtools import MPileupColumn, mpileup, parse_regionstring
from ngs_mapper.alphabet import iupac_amb
import sys
import argparse
import re
from StringIO import StringIO
from os.path import basename
import os
import multiprocessing
import time
import vcf
from Bio import SeqIO
# The header for the vcf
V... |
e06f4a2531c360a0c0a7f7ebe560726dd810975d60cc705f6d51ca5689d299d1 | Python | 26,748 | 732 | '''!
@file image.py
Defines an Image class that is a container for a single image
from an Azure Kinect device.
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
Kinect For Azure SDK.
'''
import ctypes as _ctypes
import numpy as _np
import copy as _copy
from .k4atypes import _... |
d49b96b400431fd234bb03e9eba7a30c95767740b5df2996add133321a5796c4 | Python | 26,749 | 622 | # coding: utf-8
import argparse
import time
import math
import os
import copy
import sys
import torch
import torch.onnx
import torch.nn as nn
import torch.optim as optim
import torchvision
import torchvision.transforms as transforms
import numpy as np
import logging
torch.multiprocessing.set_start_method('spawn')
torc... |
e0a88dcccdede59aeb3bd1dcfd9a32f7ae866f0b0a994f72e33bb5b5850c0efe | Python | 26,765 | 473 | r"""
Vision specific connectors.
"""
import numpy
import mozaik
from .modular_connector_functions import ModularConnectorFunction
from mozaik.tools.circ_stat import *
from mozaik.tools.misc import *
from parameters import ParameterSet
from scipy.interpolate import NearestNDInterpolator
from numpy import sin, cos, pi, e... |
85ed15fdeaac266b47f003354ddec0ea4bc9f8699eaf8010419efada52f24e4f | Python | 26,787 | 855 | """
CLI Tool for OmicVerse Skills Verifier - Phase 6
Command-line interface for running verification, validating descriptions,
and extracting tasks from notebooks.
"""
import sys
import argparse
import json
import time
from pathlib import Path
from typing import Optional
from .skill_description_loader import SkillDe... |
6ccd788de925c69dc99ec1a962246e939b0a49f52a734aa26bae10337fd3b182 | Python | 26,791 | 760 | import pdb
import math
import logging
from numba import jit, njit, vectorize, prange, cuda
import numba
import numpy as np
import scipy.sparse
from tqdm.auto import trange
from scipy.stats import lognorm, norm
from itertools import cycle
import importlib
cupy_loader = importlib.find_loader('cupy')
if cupy_loader is n... |
3b50fb38cf66c2a18741d9cb39bf5aa890385a6f46ea1307aa8de0a316baf264 | Python | 26,807 | 724 | ####################################################################################################
# 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... |
785c21000d566d9c10305c69694d455fcee41c3896ec868cf2cf38f370c79bee | Python | 26,829 | 757 | """
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 dataclasses import dataclass
from datetime import timedelta
from typing import Any, Dict, List, Op... |
ef3b71517aebcd4251b7ebda2982f55c0df21c262046d00dc1eb22599cf9de58 | Python | 26,836 | 687 | import argparse
import hashlib
import math
import os
from pathlib import Path
from typing import Optional
import colossalai
import torch
import torch.nn.functional as F
import torch.utils.checkpoint
from colossalai.context.parallel_mode import ParallelMode
from colossalai.core import global_context as gpc
from colossa... |
21b1fd07f922870e218773241ff184dc662d77e7921a9d875b9c785e4e695102 | Python | 26,864 | 780 | import asyncio
import copy
import json
import logging
import os
import random
import socket
import sys
import tempfile
import time
from concurrent.futures import ThreadPoolExecutor
from datetime import datetime
from pprint import pprint
from unittest.mock import MagicMock
import numpy as np
import pytest
import ray
f... |
faccc1ff0ad4760716de985084eafa3998ceb5005f8496f8ac2956dbf96cfe07 | Python | 26,870 | 633 | # --------------------------------------------------------
# Swin Transformer V2
# Copyright (c) 2022 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ze Liu
# --------------------------------------------------------
import torch
import torch.nn as nn
import torch.nn.functional as F
im... |
0c28745ee019f3ea944af83d3278d1798176755dfe3daba34811c35e2d1ccf96 | Python | 26,872 | 569 | import torch
from torch.utils.data import Dataset, DataLoader, SubsetRandomSampler, random_split
import pandas as pd
import numpy as np
import os
import random
from collections import defaultdict, Counter
from itertools import combinations
import json
import torch.nn as nn
import torch.nn.functional as F
from sklearn.m... |
0a0aaa8f47b59e5d4fe6d5123f7448c781212f57fae6a3529319d04be67d49ee | Python | 26,883 | 779 | """
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: FAIRChemCalculator end-to-end through ASE — construction from
registered name vs filesystem checkpoint, task-name dispatch,
... |
7a1a24e0607beb18cd32e8371a829cae1e9a8812a694846eefe7ee075316364c | Python | 26,884 | 824 | import numpy as np
import scipy.io as sio
import pandas as pd
import os
import re
import pickle
import arviz as az
import collections as c
import itertools as it
import general.utility as u
import general.neural_analysis as na
import general.data_io as gio
guess_model_names = (
"arviz_fit_null_guess_model.pkl",
... |
72eb58e5683e42093d40a17cc598ec9e541a34f4a905c68eee08235d1873c07c | Python | 26,898 | 497 | #!/usr/bin/env python3
import fire
import logging
import os, sys, traceback
from IsoNet.util.dict2attr import Arg,check_parse,idx2list
from fire import core
from IsoNet.util.metadata import MetaData,Label,Item
class ISONET:
"""
ISONET: Train on tomograms and restore missing-wedge\n
for detail description, ... |
e49f81ddddb76273acf80fbbffe76fd1f0c7f803329283cd0bb6bf274c0db80b | Python | 26,907 | 549 | '''
Main tools for MBEANN in Python.
pyMBEANN (Author: Motoaki Hiraga)
Details of MBEANN could be found in the following:
K. Ohkura, et al., "MBEANN: Mutation-Based Evolving Artificial Neural Networks",
ECAL 2007, pp. 936-945, 2007.
'''
import copy
import itertools
import math
import random
import numpy as n... |
25048e026b0b04503f65862b09a8260653be54fadca2b2cf7524c2bc50a3b733 | Python | 26,917 | 735 | import importlib
import random
import numpy as np
import torch
from scipy.ndimage import rotate, map_coordinates, gaussian_filter, convolve
from skimage import measure
from skimage.filters import gaussian
from skimage.segmentation import find_boundaries
# WARN: use fixed random state for reproducibility; if you want ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.