sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
fc88e69941a3f44b7977f7749d046b308696fd12d947a87e18ab930dfec59eac | Python | 4,484 | 142 | # 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)... |
3573df2e8fccb96ee9b759a74e8d7b692ffb8a58e865f80224998cd8fc19da7d | Python | 4,486 | 137 | from multicamera_acquisition.interfaces.camera_base import BaseCamera, CameraError
from pypylon import pylon
import numpy as np
class BaslerCamera(BaseCamera):
def __init__(self, index=0, lock=True, **kwargs):
"""
Parameters
----------
index : int or str (default: 0)
If... |
e878b6e8757cd8aeec5c872dc7e6a89b6ce1aeb01f3e8d3e5a5cd2782f128849 | Python | 4,486 | 112 | # 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... |
46e4a34406685a19feab9ce3496489c49857eb00f2912e58a6725fa371d134f9 | Python | 4,487 | 109 | # The script requires the SCT conda environment to be activated:
# source ${SCT_DIR}/python/etc/profile.d/conda.sh
# conda activate venv_sct
# Inspired by https://github.com/sct-pipeline/pmj-based-csa/blob/419ece49c81782f23405d89c7b4b15d8e03ed4bd/get_distance_pmj_disc.py
import argparse
import numpy as np
impor... |
9a797884a4fa8e3a4b247b151e35330b8e4896b58116f37c46a63d992488a284 | Python | 4,487 | 151 | """
Implementing "a network with residual connections" example in https://github.com/synsense/sinabs/issues/181
"""
import torch
import torch.nn as nn
from sinabs.activation.surrogate_gradient_fn import PeriodicExponential
from sinabs.layers import IAFSqueeze, Merge
class SNN(nn.Module):
def __init__(self, batc... |
4389a3121935c0a3f4bd167951512072ffba88abba78920bc301197ce4540aa8 | Python | 4,489 | 126 | import yaml
import scipy
import pickle
import argparse
import numpy as np
from tqdm import tqdm
import matplotlib.pyplot as plt
def bootstrapped_return(x, y, stride, total_steps, confidence_level=0.95, to_bootstrap=True):
assert len(x) == len(y)
num_runs = len(x)
avg_ret = np.zeros(total_steps // stride)
... |
d482ca250365c1082ab03ee52bd3f3a1af00ce6163adb1313e8a43eefd05751a | Python | 4,490 | 162 | """UniProt API client."""
import logging
from typing import Any, Dict, List, Optional
from .base import BaseAPIClient
from ..config import settings
logger = logging.getLogger(__name__)
class UniProtClient(BaseAPIClient):
"""Client for UniProt REST API."""
def __init__(self, **kwargs):
rate_li... |
f3edb97e08900934aea562b3cdfc6bffbdf3e93716e30ec6e7855abcd3ffe9f8 | Python | 4,490 | 120 | # Copyright (c) 2021 Qualcomm Technologies, Inc.
# All Rights Reserved.
# pylint: skip-file
# type: ignore
from copy import deepcopy
import torch
from torch import nn
from aihwkit.simulator.digital_low_precision.base_quantized_classes import QuantizedModule
from aihwkit.simulator.digital_low_precision.quantization_... |
ae27113a3b6b24169f1ea059443814fb78cf9ab918c99f453a5116bfc44bcde3 | Python | 4,495 | 139 | """Global random-seed control for reproducible omicverse runs (issue #807).
One call seeds every RNG backend omicverse touches — Python ``random``,
NumPy, PyTorch (CPU + CUDA), and MLX (Apple) — and records the seed in
``ov.settings.seed`` so downstream steps can pick it up. Functions that
already expose a ``random_st... |
94cdcdc86042cd82318d057ff752ee0872ba47b4581c710452ff28383edc678f | Python | 4,496 | 182 | import pdb
from discontinuous_galerkin.base.base_model import BaseModel
import numpy as np
class AdvectionEquation(BaseModel):
"""Advection equation model class."""
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.model_params = {
'advection_velocity': 0.5*np.pi,
... |
b6015a90a1e18829f585b1f06769583ee429f672b087d24878b89056cb7bc39d | Python | 4,496 | 107 | """
Author: Arnault CAILLET
arnault.caillet17@imperial.ac.uk
August 2023
Imperial College London
Department of Civil Engineering
1. Relationships for the LIF model between MN properties
Derived from Table 4 in Caillet, A. H., Phillips, A. T., Farina, D., & Modenese, L. (2022). Mathematical relationships between spina... |
13295d4f44fadb462ac6032438ac5ed7cc365a4119a11cef33de36b6c05dc857 | Python | 4,497 | 133 | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import copy
import logging
import os
import sys
import time
from pathlib import Path
import submitit
from ocpmodels.common import distutils... |
42869163945fb3062073f095d7d98c94186a7eb246282914172ba10b76379cbe | Python | 4,497 | 121 | from __future__ import division
import scipy as s
import numpy as np
from .variational_nodes import *
from ..gp_utils import *
from .. import gpu_utils
class Kc_Node(Node):
"""
Sigma node to model the covariance structure K_c along the given covariate(s)
This node constructs the covariate kernel matrix o... |
2a4625cbfad8c0b3679015b264fd22d5d227e17b5efcb81388de0884fca08215 | Python | 4,498 | 130 | from __future__ import annotations
from typing import TYPE_CHECKING
import torch
import torch.nn as nn
if TYPE_CHECKING:
from fairchem.core.models.allscaip.configs import (
GlobalConfigs,
GraphNeuralNetworksConfigs,
MolecularGraphConfigs,
RegularizationConfigs,
)
from fair... |
b1489d6b99be263d4c45500fc3ac8666af0f9911f48fabe9f8c7804817beb7ff | Python | 4,498 | 162 | """UniProt API client."""
import logging
from typing import Any, Dict, List, Optional
from ..base import BaseAPIClient
from ...config.config import settings
logger = logging.getLogger(__name__)
class UniProtClient(BaseAPIClient):
"""Client for UniProt REST API."""
def __init__(self, **kwargs):
... |
4d0035de4c1a1ca7ecd5098733bd1be8a025c5646ca303f206e64a35d0a58e38 | Python | 4,499 | 129 | """
Recurring cleanup and drift-report helpers for the OVAgent harness.
"""
from __future__ import annotations
import time
from dataclasses import asdict, dataclass, field
from pathlib import Path
from typing import Any, Optional
from .trace_store import RunTraceStore
@dataclass
class CleanupFinding:
kind: str... |
bc7bb05c1034961e9e2786294e9935f2ad8275f4cf28decd922aadb85aec373f | Python | 4,499 | 143 | # -*- coding: utf-8 -*-
# # Copyright (c) 2021 Qualcomm Technologies, Inc.
# All Rights Reserved.
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
# pylint: skip-file
# type: ignore
from enum import Enum
from torch import nn
from... |
eb91d26a25173ea0e452b7f2520409bdf5ced312a266152c2dc8c2d3a3eb3e61 | Python | 4,499 | 108 | import torch
import torch.nn as nn
import torch.nn.functional as F
from model.warplayer import warp
from model.refine_2R import *
def deconv(in_planes, out_planes, kernel_size=4, stride=2, padding=1):
return nn.Sequential(
torch.nn.ConvTranspose2d(in_channels=in_planes, out_channels=out_planes, kernel_size... |
64cad3e0090d5784927a12ed22ecd626da23baa9ab84935a95c1b07f067eb8a0 | Python | 4,500 | 143 | import matplotlib.gridspec as gridspec
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
from scipy.stats import linregress
from sklearn.metrics import mean_absolute_error, mean_squared_error
class SeabornFig2Grid:
def __init__(self, seaborngrid, fig, subplot_spec):... |
8d975f6cd37008c617366b8b0da97e10b51e4c00a22e34e60914ac838353cca4 | Python | 4,500 | 80 | # Copyright 2026 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
d70f723c1fe3e5275a27faebca34aa9b586a3905a03cb313393b72f706867c55 | Python | 4,500 | 173 | import math
import random
import numpy as np
import torch
import torchvision.transforms as transforms
from PIL import Image
import time
def randomAffine(imgs):
rotation = random.uniform(-15., 15.)
shear = random.uniform(-15., 15.)
scale = 1
x = random.uniform(-50., 50.)
y = random.uniform(-50, 50.)
trans... |
677a97e89fbbf5170e3b8541d2b8b5e067412436c3510b25e39c38b1421308cf | Python | 4,501 | 137 | from multicamera_acquisition.interfaces.camera_base import BaseCamera, CameraError
from pypylon import pylon
import numpy as np
class BaslerCamera(BaseCamera):
def __init__(self, index=0, lock=True, **kwargs):
"""
Parameters
----------
index : int or str (default: 0)
If... |
772dd19e37e3e059de33f3a53f5b2d45197c87ad87da713f8d2a33ab81283eec | Python | 4,501 | 173 | import math
import random
import numpy as np
import torch
import torchvision.transforms as transforms
from PIL import Image
import time
def randomAffine(imgs):
rotation = random.uniform(-15., 15.)
shear = random.uniform(-15., 15.)
scale = 1
x = random.uniform(-50., 50.)
y = random.uniform(-50, 50.)
trans... |
01d45a80807d4b2bb5abfc09777e68f7188d4cd2a51eb511f053208f989d6def | Python | 4,503 | 149 | import os
import tempfile
import numpy as np
import pytest
import torch
from torch import nn
import pfrl
from pfrl.agents.a2c import A2C
from pfrl.envs.abc import ABC
from pfrl.experiments.evaluator import batch_run_evaluation_episodes
from pfrl.nn import Branched
from pfrl.policies import (
GaussianHeadWithState... |
2c471c1d69ad8725a5752400ad14d49157039b601cbb781692030a567cc92973 | Python | 4,504 | 108 | import torch
import torch.nn as nn
import torch.nn.functional as F
from model.warplayer import warp
from model.refine import *
def deconv(in_planes, out_planes, kernel_size=4, stride=2, padding=1):
return nn.Sequential(
torch.nn.ConvTranspose2d(in_channels=in_planes, out_channels=out_planes, kernel_size=4,... |
ee8a267ef5542e29f54aac6002be3d8dda4edadf29aae3b98385423d5be7fae7 | Python | 4,505 | 86 | import matplotlib.pyplot as plt
from tqdm import tqdm
import numpy as np
import pandas as pd
import scanpy as sc
def cell_type_smoothing(adata,use_rep='X_pca', N_neighbors=15,n_pcs=10,
weighted_smoothing=True, threshold=0.5,
col_name = 'cell_type_from_scMulan'):
# ... |
381435f75775f0f057e17876014bc733688e1477488c93393ee7c0833cd86518 | Python | 4,507 | 125 | # -*- 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.
#... |
abf1d53f6ad0b7733e090a0fee29fc075bf78e9bcfed49805c40fd5d4fcffe78 | Python | 4,508 | 133 | from scipy.io import loadmat
from scipy.special import erfcinv
import numpy as np
import pandas as pd
from scipy.stats import kruskal
from itertools import combinations
from matplotlib import pyplot as plt
import matplotlib.patches as mpatches
def star(p_val):
assert 0 <= p_val <= 1
if p_val >= 0.05:
... |
4cad92584bbd233f97708d9b3b79b472d77e90848cb74243d57e43ef60ee6507 | Python | 4,509 | 110 | """Generating event-files.tsv to be stored with data from log files"""
import numpy as np
import glob
import pandas as pd
import os
import re
# define ROOT dir
ROOT = '/Users/sebastiandresbach/data/neurovascularCouplingVASO/Nifti'
OUT = '/Users/sebastiandresbach/data/neurovascularCouplingVASO/openNeuro'
# define subj... |
5f8b613c0deddb9a3372b244a55ce4e1033eb0cb216d0e966b76097ab44cff65 | Python | 4,511 | 153 | import logging
import os
from typing import List, Optional, Tuple
from ray._private.accelerators.accelerator import AcceleratorManager
from ray._private.ray_constants import env_bool
logger = logging.getLogger(__name__)
HIP_VISIBLE_DEVICES_ENV_VAR = "HIP_VISIBLE_DEVICES"
NOSET_HIP_VISIBLE_DEVICES_ENV_VAR = "RAY_EXPE... |
b373928f60ac7a56c8f5c049496f218490286ad929da040483d348a220bf5782 | Python | 4,512 | 129 | 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 warnin... |
f6184b0beddde24152545826dc488277f68298bc25c1b5821cf659686e852d78 | Python | 4,512 | 110 | import os
import subprocess as sp
import unittest
import shutil
import tempfile
import numpy as np
import h5py
from neuron_morphology.morphology_builder import MorphologyBuilder
from neuron_morphology.swc_io import morphology_to_swc
from neuron_morphology.transforms.tilt_correction.compute_tilt_correction import (
... |
f686252016bee652d55c23fc12a5a066f7d908141ea4e61fb8533db882d44651 | Python | 4,512 | 119 | from __future__ import annotations
from multiprocessing import Pool
from typing import TYPE_CHECKING, Mapping
import numpy as np
import pandas as pd
from diptest import diptest as diptst
from scipy import stats
from scipy.optimize import minimize_scalar
from sklearn import mixture
if TYPE_CHECKING:
import numpy.... |
979319014de86fe77d7a7b4d5c970f8ce8588a09e5c7e7b78f499afc1230048d | Python | 4,513 | 130 | #encoding: utf-8
"""
VTK uses whatever encoding your machine's "current codepage". But you have
to explicitly string.encode(codepage) strings to bytes then hand those to VTK.
See this answer:
https://discourse.vtk.org/t/what-is-state-of-the-art-unicode-file-names-on-windows/1821/42
This module provides PathHandler - a... |
f3da7f2538062846d1a38879fc502c745ec994620aad5a3fe6ffad388c8b29ec | Python | 4,513 | 147 | # built-in dependencies
from typing import Any, Dict, List, Union, Optional
from abc import ABC, abstractmethod
# pylint: disable=unnecessary-pass, too-many-positional-arguments
class Database(ABC):
@abstractmethod
def __init__(
self,
connection_details: Optional[Union[str, Dict[str, Any]]] = ... |
c5c6d27f4623a7e3d0610e967a05cfbb6f1030ab846338697f99ff468738cff9 | Python | 4,514 | 133 | # built-in dependencies
import os
import io
import ftplib
# 3rd party dependencies
import pytest
import boto3
import pandas as pd
# project dependencies
from deepface import DeepFace
from deepface.commons.logger import Logger
logger = Logger()
# services in docker/docker-compose-filestore.yml
os.environ.setdefault(... |
de866921a1f2bbf6448ae6bfb6ac0d47e45e88c39e8921f0e4f093df2c6fc24c | Python | 4,517 | 143 | import os
import re
import shutil
import pystow
import zipfile
from pathlib import Path
pattern = "R([0-9]*)|X([0-9]*)|Y([0-9]*)|Z([0-9]*)"
add_space_re = r"^(\W+)|(\W+)$"
def split_and_modify_atoms(SMILES):
splitted_SMILES = list(SMILES)
modified_SMILES = re.sub(r"\s+(?=[a-z])", "", " ".join(map(str, split... |
8225d7b1e3201ddd66d8bfd460b9d23506e9e34ccb71629ac1427f9aa742418e | Python | 4,518 | 121 | from batch import (
BatchAE,
BatchMasking,
BatchSubstructContext,
BatchSubstructContext3D,
BatchHybrid,
)
from torch_geometric.data import Batch
from torch.utils.data import DataLoader
class DataLoaderSubstructContext(DataLoader):
"""Data loader which merges data objects from a
:class:`tor... |
666eaf416867943a15dbc2c4d5a0d79f78ec940d10d3ff91f3ede63b0cd24cd4 | Python | 4,525 | 139 | import unittest
import numpy as np
from neuron_morphology.morphology import Morphology
from neuron_morphology.constants import (
AXON, APICAL_DENDRITE, BASAL_DENDRITE, SOMA
)
from neuron_morphology.feature_extractor.data import Data
from neuron_morphology.features.statistics.coordinates import COORD_TYPE_SPECIALI... |
3d7574944e52291682493deafb1ef9b149d2a0d3d48746796db9d9e7fe9f62f7 | Python | 4,526 | 106 | import torch
import torch.nn as nn
import torch.optim as optim
from transformers import AutoModelForAudioClassification
from torch.utils.data import DataLoader, TensorDataset
from transformers import ASTFeatureExtractor
import numpy as np
class AudioModelTrainer:
def __init__(self, DATA, model_path, sub = '', num_... |
e59162bb1c47b2c45605af7da8bee8145e8df6740b0051de5a2559eaa2d67936 | Python | 4,527 | 141 | # Copyright 2023 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
7dfbe78fae44dc4ba4e633de6d7d9a887eb2fa2de956ace5fcb1e4bf2b301ee7 | Python | 4,528 | 103 | import os
import pandas as pd
import matplotlib.pyplot as plt
from adjustText import adjust_text
annotations = ["chess", "gencode", "refseq_ucsc"]
colors = ['blue', 'red', 'green', 'cyan', 'magenta', 'olive', 'black', 'gray', 'orange', 'purple']
os.makedirs("sensitivity_mathcing_transcript", exist_ok=True)
for level... |
22aa00119d92cff4d3f3f7e51c65b31603b258bcedc88e226381b16661e85aed | Python | 4,529 | 105 | import argparse
from random import uniform
from time import sleep
import torch
from lightning.pytorch.callbacks import ModelCheckpoint, LearningRateMonitor, TQDMProgressBar
from lightning.pytorch.loggers import TensorBoardLogger
from lightning.pytorch.utilities.model_summary import ModelSummary
from lightning.pytorch ... |
6da57a00729766f792a26ca2b1dc87dba16ece7d1c500f3a123415940c34397d | Python | 4,529 | 136 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""Decorators for aihwkit tests."""
from itertools import product
from functools import partial
from typing import List, Callable
from parameterized import par... |
61e30e2dc12fa38f454aefcd074dde7d77df3616cf15cf1e773a8a724750535c | Python | 4,530 | 117 | import warnings
import pytest
import torch.nn as nn
from sinabs.backend.dynapcnn import DynapcnnNetwork
from sinabs.backend.dynapcnn.chip_factory import ChipFactory
from sinabs.from_torch import from_model
def build_model():
ann = nn.Sequential(
nn.Conv2d(2, 16, kernel_size=(2, 2), stride=(2, 2), paddin... |
7e86a9a196d2d9a6b247b6a1870589ab8b094b41ecdf79a8697368554de1bede | Python | 4,530 | 124 | """
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 logging
import torch
from fairchem.core.models.uma.common.rotation import eulers_to_wigner
c... |
e157265fdd0a8e448a78d729358721750dde955a21875911df883f945b2cac74 | Python | 4,531 | 109 | import os
import threading
from dataclasses import dataclass
from typing import Optional
from ray._common.utils import env_bool
from ray.util.annotations import DeveloperAPI
# The context singleton on this process.
_default_context: "Optional[DAGContext]" = None
_context_lock = threading.Lock()
DEFAULT_SUBMIT_TIMEOU... |
8ea967e4281d0deac715cf48ade1d1e20cb260db13e29331f40ae14c93e5d41a | Python | 4,532 | 95 | import os, logging
import nltk
try:
from nltk.tokenize import TweetTokenizer
from nltk.stem import WordNetLemmatizer
from nltk.corpus import wordnet as wn
from nltk.util import ngrams
except:
nltk.download()
from gensim.models import TfidfModel
from gensim import corpora
import pandas as pd
from... |
98c2ece5f4e6a96ddc475b279cb6792065e656dc6607b8d7de975fe06de1d8c7 | Python | 4,532 | 141 | """
Example for spikes_from_array_latency_code, here for computing the
cell-averaging constant false alarm rate algorithm from radar processing with
spiking neurons, short: spiking CA-CFAR.
The spikes_from_array_latency_code model creates one spike per element of an
array using the following latency code:
t = t_ma... |
6c3ba3abfc36d9ca08ff21b333923a076a4ef7ab9baa4827dd5f551987ec0ad0 | Python | 4,533 | 133 | 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... |
b7e1ea224106eaa9a6aae6dde7d7d015fef2406354a27315eddc3948743982cf | Python | 4,534 | 137 | import json
import re
import sys
from pathlib import Path
def check_file(file_contents: str) -> bool:
"""Check file for the snippet"""
return bool(re.search(r"^if __name__ == \"__main__\":", file_contents, re.M))
def parse_json(data: str) -> dict:
return json.loads(data)
def as_list(value) -> list:
... |
fa62b4c4abbbaaea3bd006db7d2a18dd65a999ba8ef1881b1c39b2a41117c83b | Python | 4,534 | 110 | import unittest
import numpy as np
from reval.best_nclust_cv import FindBestClustCV, _confint
from sklearn.neighbors import KNeighborsClassifier
from sklearn.cluster import AgglomerativeClustering
import math
import hdbscan
from sklearn.datasets import make_blobs
# Modify to test other functions and parameters
RNDLABE... |
2e839e5e68b21e73d5b84f18c8b66eb0776862650675eed8956b67401d2d0af9 | Python | 4,535 | 141 | import multiprocessing
import types
from pathlib import Path
from tempfile import TemporaryDirectory
from unittest.mock import MagicMock
import pytest
from siapy.core.exceptions import InvalidInputError
from siapy.utils.general import (
dict_zip,
ensure_dir,
get_classmethods,
get_increasing_seq_indice... |
8d74308ac3866d5c087241c498d352b4bee1747cf84e23a636b67898b29f8edc | Python | 4,535 | 119 | import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import pandas as pd
import os
# plt.rcParams.update({
# "text.usetex": True,
# })
def handle_duplicate_names(path):
# pre: path has '/path/to/file(optversion).ext'
filename, extension = os.path.splitext(path)
count = 1
while ... |
b22391020e28d0ead18834c6f028b5ef8680e934e3b62cabc8d5d872ff682139 | Python | 4,535 | 117 | from typing import Any, Optional
import pandas as pd
from visions import VisionsTypeset
from data_profiling.config import Settings
from data_profiling.model import BaseDescription, expectation_algorithms
from data_profiling.model.handler import Handler
from data_profiling.utils.dataframe import slugify
class Expect... |
3506fcaa15bba385a3398e30d11f2da64be701492c19bffd8d03a1c880ce7cfe | Python | 4,536 | 141 | import io
import pathlib
import struct
import numpy as np
import pytest
from stl import Mode, mesh
TESTS_PATH = pathlib.Path(__file__).parent
@pytest.mark.parametrize('mode', [Mode.BINARY, Mode.AUTOMATIC])
def test_ascii_like_binary(tmpdir, speedups, mode):
_test(tmpdir, speedups, mode, False)
_test(tmpdir... |
8e19a6546736a161eef38a9fb7d65c936fad27666bb2db421a75c32702d196b9 | Python | 4,538 | 108 | ####################################################################################################
# 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... |
8ce082aaa5a9d4dbba379f9f401814c56185975e3c354639c1a4db591d37d34e | Python | 4,540 | 133 | import json
import logging
import os
import subprocess
import sys
from typing import List, Optional, Tuple
from ray._private.accelerators.accelerator import AcceleratorManager
from ray._private.ray_constants import env_bool
logger = logging.getLogger(__name__)
NEURON_RT_VISIBLE_CORES_ENV_VAR = "NEURON_RT_VISIBLE_COR... |
506e6097e83e59143d6a5beac52d53b93f455f2b29cd1fdd143f4cce7a9d73b8 | Python | 4,541 | 125 | from utils.misc import omegaconf2dotlist
import numpy as np
import pandas as pd
from utils.Typing import MultiTaskOpt, SingleTaskOpt
from itertools import product
from utils.TasksManager import Queue, Task
import sys
import os
from os.path import join as opj
from os.path import dirname as opd
from os.path import basena... |
d93963aeea41b2d040a1020fa49be27b8eeacfa6b67d2d3e0a977119cbe9b628 | Python | 4,541 | 138 | import hydra
import os
from argparse import Namespace
from omegaconf import OmegaConf
from pathlib import Path
import warnings
import torch
import pytorch_lightning as pl
import yaml
import numpy as np
from lightning_modules import LigandPocketDDPM
import utils
def merge_args_and_yaml(args, config_dict):
arg_d... |
9201acb7687bbdd64add143eedf4377b01266c2b6b97246263dcf1921834666c | Python | 4,543 | 94 | from sklearn.model_selection import GridSearchCV, StratifiedGroupKFold, LeaveOneGroupOut, cross_val_predict
from sklearn.svm import SVC
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
from email.message import EmailMessage
import smtplib, ssl
import numpy as np
import datetim... |
80fe947a4cb5d5632a8ab71708c13f410a865e7695a038bb666ca2f41dbe0047 | Python | 4,544 | 192 | from contextlib import contextmanager, redirect_stderr, redirect_stdout
from typing import Any
import yaml
import datetime
import logging
import pickle
import os
import pandas as pd
import duckdb
import psycopg2
from joblib import Parallel, delayed
def load_vitals_from_parquet(
train_val_test_eicu: str,
... |
ca7ed724ab8545b3d87bf677ec6187cd1d65c98c7c57fe8262a2f0d87e730820 | Python | 4,545 | 126 | import argparse
import numpy
import datetime
import functools
import uuid
import os
import bz2
import pickle
import gym
import gym.spaces
import torch
from torch import nn
import pfrl
from pfrl import experiments, utils
from pfrl.policies import GaussianHeadWithFixedCovariance, SoftmaxCategoricalHead
from gym_sted i... |
d82c5e0e44ec5f42ec887d2dd8ab6dc1bfb42719aad5e025550ffa9d50e9fc1e | Python | 4,547 | 147 | r"""H&E → spatial transcriptomics prediction — ``ov.space.histo``.
Predicts spatial gene expression directly from H&E histology images. Wraps
state-of-the-art generative foundation models (STPath, STFlow), pathology
foundation-model + linear-head pipelines (HEST-FM), and super-resolution
methods (iStar) behind one ``m... |
f48571c70b823f8523d92984a5c3b3af1a1b7b8a83a0d0266bfdca5f79ae6ca8 | Python | 4,547 | 133 | from logging import getLogger
import torch
from pfrl import agent
from pfrl.utils import evaluating
from pfrl.utils.batch_states import batch_states
from pfrl.utils.recurrent import (
get_recurrent_state_at,
one_step_forward,
recurrent_state_as_numpy,
)
class StateQFunctionActor(agent.AsyncAgent):
"... |
6452ac3f5533ee6314a9bf44b475e96315b54ccd388a54a09395fa2e8e93bc0b | Python | 4,548 | 172 | import pandas as pd
from joblib import Parallel, delayed
from python.utils import custom_logger
from python.data.generate_mlife import (
check_data,
remove_extreme_values,
truncate_ts,
report_nas,
one_case_per_patient,
sufficient_obs
)
from python.utils import (
read_format_query,
post... |
c7ddcf0bd7735362a2343de551d7ecc85006e701fe93a01d3c3bdc442b219242 | Python | 4,549 | 135 | 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... |
c92a9b02d1e1461d89480b8fea18e9ac0122119af7daae4445289c869ae28c81 | Python | 4,549 | 115 | from enum import Enum
from typing import Any, Dict, Optional
from ray._common.pydantic_compat import PYDANTIC_INSTALLED, BaseModel, Field
from ray.dashboard.modules.job.common import JobStatus
from ray.util.annotations import PublicAPI
# Pydantic is not part of the minimal Ray installation.
if PYDANTIC_INSTALLED:
... |
200d2ef75b03ba8c83e784c3a9292c08de644d4b665e2e46d4896a24de55edab | Python | 4,550 | 135 | import unittest
import tempfile
import shutil
import os
import subprocess as sp
import json
import os
import pandas as pd
import numpy as np
import h5py
import pytest
import neuron_morphology.feature_extractor.__main__ as main
from neuron_morphology.swc_io import write_swc
from neuron_morphology.constants import (
... |
212918f1d1c854653ae363410b24e7c7e6ab26ca23934c54245761c3806f7546 | Python | 4,551 | 140 | CODE_DIR = '/home/kelarion/github/'
SAVE_DIR = '/mnt/c/Users/mmall/Documents/uni/columbia/assignment_errors/'
REMOTE_SYNC_SERVER = 'ma3811@motion.rcs.columbia.edu' #must have ssh keys set up
REMOTE_CODE = '/burg/home/ma3811/assignment_errors/'
REMOTE_RESULTS = '/burg/theory/users/ma3811/assignment_errors/'
# REMOTE_SY... |
4f4d323a9e31d8017f927afd705a38954f36143a492d26ef4c6f673117dc9b4f | Python | 4,552 | 126 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 19 12:16:38 2022
@author: sam
"""
import pickle
import numpy as np
def prep_data(synapse_mask_fun,syn_fractions,ablate_fract=.0,light_sample=(-1,15),
jitter=int(3*120),max_pulse=30, set1=False, single_only=False):
UU = []
UU_... |
8f4e6643c50cd289136ddfa1bbc63a330b74bac1f2ed059db8c907e4c4fe7ade | Python | 4,552 | 130 |
import numpy
import time
import sys
import sklearn.neighbors
import scipy.optimize
from typing import Optional
def icp(a, b,
max_time:Optional[int] = 4
):
"""
Iterative Closest Point (ICP) algorithm
Parameters
----------
a
dataset a, whose shape is [n,2]
b
dat... |
d6ddb0b10c2c32aa28c00c3970b1c7793c3064f2b012c080b92cb80fee92fd79 | Python | 4,552 | 170 | # -*- 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.
#... |
1c13786292f03de46ff7fe7773cba6ec4ff75786fdaa16cade4e0f0823e66ee7 | Python | 4,554 | 130 | """
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
from typing import TYPE_CHECKING, Any, ClassVar
import numpy as np
import pandas as pd
from ... |
1d279ba1209b2eed848856bc0f47a97f76af2f548c712b9e515d8920f3bbe000 | Python | 4,554 | 103 | import os
import pandas as pd
import matplotlib.pyplot as plt
from adjustText import adjust_text
annotations = ["refseq_ucsc"]#["chess", "gencode", "refseq_ucsc"]
colors = ['blue', 'red', 'green', 'cyan', 'magenta', 'olive', 'black', 'gray', 'orange', 'purple']
os.makedirs("sensitivity_mathcing_transcript", exist_ok... |
d4cd0d5b78714eecfd1d3c4e36d433dcffd68507bcb1f725efd1bfba91ab1716 | Python | 4,555 | 133 | """
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.
run using,
pytest -s --inference-checkpoint inference_ckpt.pt tests/core/units/mlip_unit/test_inference_checkpoint.py
python -m pytest tests/co... |
2b093942dbafbe60b1abe9d59818a8495b62c4c62c8f1636b59b597ffa56d073 | Python | 4,558 | 155 | import numpy as np
import torch
from copy import deepcopy
class ModelSaver:
"""In-memory saver for model parameters.
Storing weights in memory is faster than saving to disk with torch.save.
"""
def __init__(self, model):
self.model = model
def save(self):
self.state_dict = deepc... |
413bed355ce3193ccac6507cfb027b5a27ab4ff946ac20553d46665d87475436 | Python | 4,558 | 133 | # LISI - The Local Inverse Simpson Index
# Copyright (C) 2018 Ilya Korsunsky
# 2019 Kamil Slowikowski <kslowikowski@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, e... |
0c0ad328491a6d9e5621235fe88bbcfcb3f14b2f580952b8ded5243be0fcd1ff | Python | 4,559 | 236 | import numpy as np
colors = {
"our": "#CC0000",
"our_single": "#CC0000",
"porstata": "#21618C",
"thermonet": "#7e252f", # "#CCCC00",
"prosgnn": "#00CCCC",
"ddgun": "#CC6600",
"premps": "#00CC00",
"rosetta": "#CCCC00",
"dynamut": "#2cb276",
"sdm": "#d5558e",
"foldx": "#0866... |
b53df8f19ce764aaf4aea5cf63bc1d5a697e928a97244a3be35ebf6a2a00b879 | Python | 4,560 | 137 | # -*- 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.
#... |
ab679f6007f65e9655f0d2633609067204f3fde998337bcc487fa1676e1f80bb | Python | 4,561 | 146 | import argparse
import os.path as op
from os import getcwd
from pathlib import Path
from fsub_extractor.functions.streamline_scalar import streamline_scalar
# Add input arguments
def get_parser():
parser = argparse.ArgumentParser(
description="Extracts tract-average and along-the-tract measures of input s... |
1da340c05c4107559a498213da12d80e4488e9f632322a405a6d904746c2b643 | Python | 4,563 | 119 | from typing import Callable, Optional, Tuple, Union
from sklearn.decomposition import PCA
from sklearn.manifold import TSNE, Isomap, MDS, SpectralEmbedding, LocallyLinearEmbedding
from sklearn.preprocessing import StandardScaler
import numpy as np
import pandas as pd
from enum import Enum
__all__ = ["prepare_PCA_dfs"... |
8dff0248777f397a1dbc6fe3e20726f94ac55c3ce9362bc66e52059975d5d764 | Python | 4,563 | 108 | from ngs_mapper.nfilter import make_filtered, write_filtered, fqs_excluding_indices, write_post_filter, mkdir_p, run_from_config
import os
import mock
import shutil
import warnings
try:
import unittest2 as unittest
except ImportError:
import unittest
from functools import partial
from imports import fi... |
ee99f88632ce2f53e007f3f49641f3f6e537ff37e24a5f7bb87bf7b070d1613f | Python | 4,563 | 127 | #!/usr/bin/env python
"""
快速编译工具,用于编译fa2util模块以获得10-100倍的性能提升
"""
import os
import sys
import subprocess
import shutil
def clean_build_files():
"""清理之前的编译文件和缓存"""
print("清理旧的编译文件...")
# 获取当前脚本所在的目录
script_dir = os.path.dirname(os.path.abspath(__file__))
# 删除编译产生的文件和目录
extensions = ['... |
fed11a7cd40f9406e241226ef0d36ebc32c5a638ff88a96073be157656c96ddf | Python | 4,564 | 109 | ####################################################################################################
# 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... |
2013c34c7edaba2b86397cca90eb738238ff0fe4ea69eaceea914e4e669e6b86 | Python | 4,565 | 183 | from ray import serve
# __basic_gang_start__
from ray import serve
from ray.serve.config import GangSchedulingConfig
@serve.deployment(
num_replicas=8,
ray_actor_options={"num_cpus": 0.25},
gang_scheduling_config=GangSchedulingConfig(gang_size=4),
)
class Gang:
def __call__(self, request):
re... |
d2545bb1da57877641b15f25f74d798a1f67569bb36d64fa26635fc5391d34f8 | Python | 4,565 | 170 | import numpy as np
class LinearOT:
"""Transformer class for linear OT problem."""
def __init__(self, rho: float = 1.0, reg: float = 1e-6):
self.rho = rho
self.reg = reg
def _fit(self, xs, xt, ws, wt):
return barycenter(xs, xt, self.rho, ws, wt, self.reg)
def fit(self, xs, xt... |
8104aaa7864a906d90f0c16032ae593a35614b9962c282cc844e7714a4966489 | Python | 4,566 | 126 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import json
import logging as log
import os
from attrs.converters import to_bool
from django.core.exceptions import ImproperlyConfigured
logger = log.getLogger("cvat")
MEDIA_CACHE_ALLOW_STATIC_CACHE = to_bool(os.getenv("CVAT_ALLOW_STATIC_CACHE", F... |
c54ce112ce5194d7efa0c17269eb98db88f63f847593946ee009ad446366e540 | Python | 4,566 | 119 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This library is fre... |
2a1f82add86e369ad7cc50b51e53970aede5628ae0b70a4632cd12228ad81858 | Python | 4,567 | 139 | import os
from importlib import import_module
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.nn as nn
class Loss(nn.modules.loss._Loss):
def __init__(self, args, ckp):
super(Loss, self).__init__()
print('Preparing loss functio... |
8da4301ab371d1d25a60c5e68c97bebef7e1ec3fe1552e4a6516122fe865d2f1 | Python | 4,567 | 124 | """Write EchoNext (PhysioNet) ECGs and labels to one hd5 per ECG for use with ml4h.tensormap.echonext
Example:
python ml4h/tensorize/tensorize_echonext.py \
--source /path/to/physionet.org/files/echonext/1.1.0 \
--output /path/to/echonext/tensors/
"""
import os
import json
import argparse
import h... |
01638c24028414392375a62c83862d354c17937d76aafb8047262da1a84f2c53 | Python | 4,568 | 128 | from django.core.management.base import BaseCommand, CommandError
from django_q.tasks import async_task
from infer.models import AlternateProteinName, AlternateGeneName, GO, Organism, Protein
from requests.adapters import HTTPAdapter, Retry
import requests
import re
def download_uniprot(taxon: int):
re_next_link ... |
5b7d557770cc96c795a6fc9a9cf95b468b0661b617185ec8cbd131e889e558da | Python | 4,569 | 121 | """Compare the superficial layer bias between signal change and zscore"""
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
# Load data
data = pd.read_csv(f'/Users/sebastiandresbach/github/neurovascularCouplingVASO/results/ERAs_rawPlusZscored_equalized.csv', sep=',')
layerNa... |
8ccb4b88eacc5f5ec6d6ad41a212ffdcea0daf07c3dee5d2bdf53d4175f2458f | Python | 4,571 | 115 | import math
from typing import TYPE_CHECKING, Dict
from ray.data._internal.execution.execution_callback import ExecutionCallback
from ray.data._internal.execution.interfaces import PhysicalOperator
from ray.data._internal.execution.resource_manager import ResourceManager
from ray.util.metrics import Gauge
if TYPE_CHE... |
f20f4484b8a438c00cbbb4bb9552180fd989e172c3a6571f46a5830e86b6e0ee | Python | 4,573 | 148 | # Copyright (c) DP Technology.
# Copyright (c) Facebook, Inc. and its affiliates.
#
# 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 numpy as np
logger = logging.getLogger(__name__) # pylint: disable=invalid-name
class ... |
cc29f4d2936928bd83896010a5e9c35e5ea34f35666b85b23f42446c94749fd8 | Python | 4,575 | 143 | # __model_def_start__
import asyncio
from functools import partial
from queue import Empty
from typing import Dict, Any
from starlette.requests import Request
from starlette.responses import StreamingResponse
import torch
from ray import serve
from ray.runtime_env import RuntimeEnv
# We need to set these variables ... |
0d72130bf38e87e5344825211e604b3521e27711085eede32b3d474c4d2c262b | Python | 4,576 | 127 | # -*- 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.
#... |
5d79be0d4473442cbb222d73b7932d2cad98a0fc9a77c39fe92094227abfe00c | Python | 4,576 | 131 | #
# 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... |
72c4cf25c798862bed5d50f2fe77f410712e9d18c08dc7a5dbd8fc4b95acb321 | Python | 4,576 | 151 | # __return_single_value_start__
import ray
import numpy as np
@ray.remote
def task_with_single_small_return_value_bad():
small_return_value = 1
# The value will be stored in the object store
# and the reference is returned to the caller.
small_return_value_ref = ray.put(small_return_value)
return ... |
c6fd7dc339f9cb6c29ca8d017af44bc2eaa4929dc7a95f9b8799a6b8b4d07110 | Python | 4,576 | 101 | import tensorflow as tf
from projectmetis.python.models.model_def import ModelDef
class AlzheimerDisease2DCNN(ModelDef):
# Model def
def __init__(self, learning_rate=5e-5, batch_size=1):
# TODO Ask learning rate
self.original_input = tf.keras.layers.Input(shape=(91, 109, 91), batch_size=batc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.