sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
856c1d16c0f87fac988e4606be7d4a15283cf5aea26961c8158799aac73ebe37 | Python | 7,273 | 251 | """
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.
"""
from typing import Dict, NamedTuple, Optional, Sequence, Tuple, Union
import numpy as np
import torch
def to_tensor(data: np.ndarray) -> t... |
17c7f6fd77292852a8e5f0dd15d34e576e98fd1ffb8f80c74ad7ae66782190dc | Python | 7,274 | 221 | # Copyright 2024 Xanadu Quantum Technologies 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 agre... |
d4f3acbc9edc03272b87b4e069427ebbc402b6c174f57ffbee5dc3300dcb7148 | Python | 7,276 | 214 | #! /usr/bin/python3
# -*- coding: utf-8 -*-
# @FileName: utils.py
# @Author: Li Chengxin
# @Time: 2023/6/30 22:15
from __future__ import annotations
import logging
import sys
import time
import os
from copy import deepcopy
from functools import wraps
import skimage.exposure as exposure
from skimage.util import img_a... |
d9ba277a95d975cce371f19063aa663a717aca15eca4e96a869d74b3a4f7eeb3 | Python | 7,276 | 230 | """
Tests that dialects are properly handled during parsing
for all of the parsers defined in parsers.py
"""
import csv
from io import StringIO
import pytest
from pandas.errors import ParserWarning
import pandas as pd
import pandas._testing as tm
@pytest.fixture
def custom_dialect():
dialect_name = "weird"
... |
cf2ef77bebde804a07cb61d24c2af29553b93600b2e67486f9aff5eacd2cc662 | Python | 7,278 | 216 | import numpy as np
import pandas as pd
import plotnine as p9
def gene_profile(genes: list,
weights: pd.DataFrame,
stddev: pd.DataFrame=None,
y_axis_label: str=None,
highlight_n: int=None,
highlight_anno: list=None,
... |
1f2a444e8c4b2876ed2f98b1c5812184e3b245396bbbd5c636910738b2e36d78 | Python | 7,279 | 210 | """Generate ``content/api-tree.json`` for the docs site.
Walks the public ``pycaret`` package using griffe (the same static
analyser mkdocstrings uses), filters out underscore-private names, and
emits a JSON tree the Next.js ``/reference/[...slug]`` route consumes
to render auto-generated API documentation.
Why griff... |
9cca772b2fc8162aff4c5719d844c64a20d4ca4e490358898928fbf3138f48a9 | Python | 7,280 | 243 | import os
import numpy as np
import pandas as pd
from torch.utils.data import Subset
from deepglyco.chem.common.elements import ElementCollection
from deepglyco.chem.gpep.fragments import GlycanFragmentTypeCollection
from deepglyco.chem.gpep.glycans import MonosaccharideCollection
from deepglyco.chem.pep.aminoacids i... |
0cbae1da213e491d6a47d645dba3a435cd342e34642d03ed995846a1ef805a75 | Python | 7,282 | 156 | #! /usr/bin/env python3
# autodoc.py
#
# Extract function documentation from a .c file and output it in a
# Markdown file. Assumes that the .c file uses function headers that
# conform to Easel code style.
#
# Usage: ./autodoc.py <.c file>
# Example: ./autodoc.py esl_module.c > esl_module_functions.md
#
#
# Repl... |
4a843f6e1b9fa348f81d396ad22520f973ae469558344c24da0a52a0e44206c2 | Python | 7,283 | 382 | # pyaging/models/__init__.py
from ._author_extensions import DNAmPhenoAgeNonPRC, DNAmPhenoAgePRC, IntrinClock370
from ._base_models import (
AltumAgeNeuralNetwork,
LinearModel,
PCLinearModel,
pyagingModel,
)
from ._models import (
ABEC,
EPICGA,
ADBahadoSingh,
AltumAge,
BiTAge,
B... |
f42c0c66aa921a8ee6257b8d2cc8a6233021c7615c749ab518961f864cdae0e6 | Python | 7,283 | 203 | # Copyright 2018-2024 Xanadu Quantum Technologies 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... |
abbfb324ec7aac38a333a8edc0448e998bacc0a3eb28f2c95c6ea056097d0bc0 | Python | 7,287 | 162 | #######################################################################
#
# Tests for update_json() function
#
# RUN BY:
# python -m pytest -v tests/test_create_json.py
#######################################################################
import time
import json
from manual_correction import update_json
def test... |
789529b22eec881eff5b03109b5cb1a3df1a13cf47a6c8b48c3e6a6cc021c05d | Python | 7,289 | 188 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 9 16:42:31 2022
@author: jinani
"""
# Import Required Libraries
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import multivariate_normal
from scipy.io import loadmat
# 1. Load stimuli data
def getNatStim():
'''Loads the... |
90511aba2f72f84c496a07a301d558f0f9b0d328bb85ef9a7ba22f1ec7c873dd | Python | 7,290 | 215 | # Note! This file is aimed specifically at pandas.io.formats.printing utility
# functions, not the general printing of pandas objects.
from collections.abc import Mapping
import string
import numpy as np
import pytest
import pandas._config.config as cf
import pandas as pd
from pandas.io.formats import printing
@p... |
c9787214054115625b55328ebffbc8ec6630b9613f7b6b05a49b111f797ddd57 | Python | 7,290 | 221 | import sys
import hydra
import torch
import wandb
import torchmetrics
import seaborn as sn
from pathlib import Path
from tqdm import trange
from omegaconf import OmegaConf
from numpy import mean
from numpy.random import seed as npseed
from random import seed as rseed
sys.path.insert(0, str(Path.cwd()))
from twoandaha... |
c1ed80fd35739603f4a2a89db0001e410468d81e6076c48b495599329c0b8829 | Python | 7,293 | 175 | import pandas as pd
import numpy
import networkx
def getConnectionToTF(model, allTFs, affectedNodes):
g = networkx.from_pandas_edgelist(model, 'source', 'target', create_using=networkx.DiGraph())
allNodes = numpy.array(list(g.nodes))
includedTFs = numpy.intersect1d(allTFs, allNodes)
connectedToTF = nu... |
6dc1b6158fe34dfafb08d302255fc9f51457f9f910eb9ad3a55cd1518edd323b | Python | 7,299 | 235 | from typing import Iterable, List, Literal, Mapping, Optional, Sequence, Tuple, Union
import anndata as ad
import numpy as np
import pandas as pd
import tqdm
from anndata import AnnData
from scipy.sparse import csr_matrix, lil_matrix
_reference = Optional[Literal["hg38", "mm10", "sacCer3"]]
def _myFuncsorting(e):
... |
e387a870e20913623af826a71249b0a9ad3c3869a8d7b0248a8fbadea52445fb | Python | 7,301 | 186 | # Copyright 2018-2020 Xanadu Quantum Technologies 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... |
d7b1196be1bae8890914804f7f02b773b98b9130e56e2f6f68025c308ff051df | Python | 7,305 | 202 | #!/usr/bin/env python3
# Copyright 2015 Google, Inc. 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 require... |
1f4391e8b6715fa6edabdc2df5e7ae94a404f3064a124c5c97620db8354850c2 | Python | 7,306 | 158 | # Copyright (c) 2018-2023, NVIDIA Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of condit... |
18876dc6fb7f630503fdc4ebe9660807b5b39c013fffbb6da5e9e212cc5990a1 | Python | 7,307 | 198 | """Miscellaneous functions used for analyses."""
import logging
import multiprocessing as mp
import os
import nibabel as nib
import numpy as np
from neuromaps.datasets import fetch_atlas
from nibabel.gifti import GiftiDataArray
from scipy.cluster.hierarchy import leaves_list, linkage, optimal_leaf_ordering
from sklear... |
ee8410395011ae0d125069302655878ee8a9072d50b4f2a030f80164707dfaaf | Python | 7,307 | 246 | """Tests for the nimare.generate module."""
from contextlib import ExitStack as does_not_raise
import pytest
from numpy.random import RandomState
from ..dataset import Dataset
from ..generate import (
_array_like,
_create_foci,
_create_source,
create_coordinate_dataset,
create_neurovault_dataset,
... |
44c7593877d61c65686d5883aa3ad1c90c7fecb39d4fc0cd4d73ef1c93b6a1e8 | Python | 7,309 | 187 | """Test the export CLI command argument parsing."""
import argparse
from unittest.mock import MagicMock, patch
import pytest
from lightning_pose.cli.commands.export import get_parser, handle
class TestGetParser:
"""Test the get_parser function."""
def test_returns_argument_parser(self):
"""Returns... |
4922391f80c10e8215b485f346ce85e710db3ebfcd4d776b2fc9ab448032a84a | Python | 7,311 | 160 | """session 24: scheduled jobs, webhooks, templates, pipeline versioning
Revision ID: b2c3d4e5f6a7
Revises: a1b2c3d4e5f6
Create Date: 2026-05-08 15:00:00.000000+00:00
Adds:
- ``scheduled_jobs`` table (drift monitor + retraining)
- ``webhook_subscriptions`` table (outgoing event hooks)
- ``experiment_templates`` ... |
3832f35b6b3d6ff3ce5cc887372374ab28604cc168499caa4f33bfd8e23be2fb | Python | 7,318 | 227 | import random
import time
from typing import Any, Mapping
import torch
from deepglyco.chem.common.elements import ElementCollection
from deepglyco.chem.gpep.fragments import GlycanFragmentTypeCollection
from deepglyco.chem.gpep.glycans import MonosaccharideCollection
from deepglyco.chem.pep.aminoacids import AminoAci... |
c700f684da3dffea602756546b35370519263789c70ea811cf7531b545b905f6 | Python | 7,318 | 215 | #! /usr/bin/python
import numpy
import logging
import scipy.integrate
#class Derivative_Evaluator(object):
#
# def __init__(self, rg, v):
# self.v = v
# self.rg = rg
#
# def evaluate(self, f_in, t0):
# rg = self.rg
# v = self.v
# f = f_in.reshape((rg.num_nodes, 3))
# ... |
46436212e5a4a2a8ace6c34d11f90125009cfdeab0c7e8423b0d769123bbcda5 | Python | 7,319 | 177 | # %% [markdown]
# # Direct reconstruction of 2D golden angle radial data
# Here we use the `~mrpro.algorithms.reconstruction.DirectReconstruction` class to perform a basic reconstruction of
# 2D radial data.
# A *direct* reconstruction uses the density compensated adjoint of the acquisition operator to obtain the image... |
a94595d3dda5b56c23d29ef3043010d8c57eed1cd659eb77bcf802158532d8d1 | Python | 7,319 | 161 | """Session 32 — revert Trial/Run hierarchy + per-Trial lifecycle
Revision ID: d4e5f6a8b9c0
Revises: c3d4e5f6a8b9
Create Date: 2026-05-16 12:00:00.000000+00:00
Phase 0 (revision ``f0a1b2c3d4e5``) flipped the model so that ``Trial``
owned ``Runs``. After hands-on use, we're flipping it back to the
PyCaret 3.x conventio... |
13cfb6da11a0b33eb1d3a67ee86c6c72f28d0365ac578cfdbc0e24311d9a6664 | Python | 7,321 | 176 | import numpy as np
import pytest
import pandas as pd
pytest.importorskip("jinja2")
from pandas.io.formats.style import Styler
@pytest.fixture
def df():
return pd.DataFrame(
data=[[0, 1, 2], [3, 4, 5], [6, 7, 8]],
columns=["A", "B", "C"],
index=["x", "y", "z"],
)
@pytest.fixture
def... |
881dea074090f13d3d3fdce15465527dfac61f5b18f7b1c36416b222e8a2f043 | Python | 7,326 | 146 | import numpy as np
import pandas as pd
import itertools
from itertools import groupby, combinations
def reproducibility(all_results, distance, comparison):
"""
Calculate reproducibility measures between multiple sessions or subjects.
Parameters:
all_results (numpy array): A 2D array containing res... |
a687c044488a24f2258a8460d9d34cee3317d8f7429e28bee7639c54c1206149 | Python | 7,328 | 246 | """
timedelta support tools
"""
from __future__ import annotations
from typing import (
TYPE_CHECKING,
Any,
overload,
)
import numpy as np
from pandas._libs import lib
from pandas._libs.tslibs import (
NaT,
NaTType,
)
from pandas._libs.tslibs.timedeltas import (
Timedelta,
disallow_ambig... |
b0b1e1d5926327c14ebf17dcbb45e99efa2cd87b969bfa7eb5e1c36ebbd108e7 | Python | 7,328 | 211 | """Test FastMRI dataset"""
import h5py
import pytest
import torch
from mrpro.data import KData
from mrpro.phantoms import FastMRIImageDataset, FastMRIKDataDataset
from mrpro.utils import RandomGenerator
N_COILS_BRAIN = 16
N_COILS_KNEE = 15
N_K0 = 640
N_K1_BRAIN = 322
N_K1_KNEE = 368
N_SLICES_BRAIN = 2
N_SLICES_KNEE =... |
596552a88ffcceeb5750abc483c42d397bdea657c3d35a31cc620312cbb266ce | Python | 7,329 | 185 | """Proximal Gradient Descent algorithm."""
import math
from collections.abc import Callable
from dataclasses import dataclass
import torch
from typing_extensions import Unpack
from mrpro.algorithms.optimizers.OptimizerStatus import OptimizerStatus
from mrpro.operators import ProximableFunctionalSeparableSum
from mrp... |
113aae8d68869f52f5b604492edd3190f4bede471fb8b5a7532fd81ab0953c5d | Python | 7,332 | 162 | """Regularized Iterative SENSE Reconstruction."""
from __future__ import annotations
from collections.abc import Callable
import torch
from mrpro.algorithms.optimizers.cg import cg
from mrpro.algorithms.prewhiten_kspace import prewhiten_kspace
from mrpro.algorithms.reconstruction.DirectReconstruction import DirectR... |
d18ac7c67b9838f558766704855e1ec22eb5c240aad74dcc7d35aca832b768b1 | Python | 7,333 | 213 | """
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.
Utilities to interface OCP models/trainers with the Atomic Simulation
Environment (ASE)
"""
import copy
import logging
import os
import torch
... |
f76f0e480571880c91b84f39fc458f599ecc7d19585b88571a204e81fd562f7e | Python | 7,338 | 201 | import sys
import os
import numpy as np
import torch
import torch.utils.data as du
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import util
from util import *
from drugcell_NN import *
import argparse
import numpy as np
import time
# build mask: matrix (nrows = number of r... |
9ce395243cf02523048d83ba9bc55d4baa572fdeb54370b461925da8eb0e7513 | Python | 7,339 | 188 | #!/usr/bin/env python
# coding: utf-8
import sys
import numpy as np
import pandas as pd
import pickle
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.feature_selection import SelectKBest, f_classif
from sklearn.linear_model import LogisticRegression
from skl... |
85a99b2d20717cd360ad4b5b32cc994398c39750dbe8cdc4398254d381ad7990 | Python | 7,340 | 160 | # import modules
import numpy as np
import os
import torch
import torch.nn.functional as F
import torch.utils.data as data
from torch.autograd import Variable
import random
import matplotlib.pyplot as plt
import pandas as pd
import shutil
from utils.augmentation_slice_level import augment_image_diffusion
from utils.ima... |
c40822b4d9347c5e7b5abd7544d0a63c2bae57a4bb8f85774199907414e13886 | Python | 7,342 | 202 | # Copyright 2025 Xanadu Quantum Technologies 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 agre... |
5c6f32021dc4b89b1d8dde59c4d5fb1aaa445c3c8706049e322bbd76b6d68150 | Python | 7,345 | 220 | ''' process_check.py
This program will check the NeuronBridge backend process.
'''
import argparse
from operator import attrgetter
import os
import re
import sys
from colorama import Fore, Style
import requests
import aws_s3_common.aws_s3_common as AW
import jrc_common.jrc_common as JRC
# pylint: disable=R1710, ... |
5a136b5fe47809df379899370f98ef828410be16b92b53c1707236b15a59d62a | Python | 7,351 | 251 | #!/usr/bin/python3
### BEGIN colorblind_friendly.py ###
# Based on
# Color Universal Design (CUD)
# - How to make figures and presentations that are friendly to Colorblind people
#
#
# Masataka Okabe
# Jikei Medial School (Japan)
#
# Kei Ito
# University of Tokyo, Institute for Molecular and Cellular Biosciences (Japan... |
2b9e660d64e4b07a6a0a5f7539d4e1c7394787c946f63338bba864dc9dfcb3de | Python | 7,353 | 188 | # Copyright 2019 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://w... |
b83058f62c1cd76da07c21db4379529546acdb8f2305194b6af1bf42f350d66f | Python | 7,354 | 206 | """
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 bisect
import logging
import math
import pickle
import random
import warnings
from pathlib import Path
import lmdb
import numpy as np... |
b5da50ac034a1d5faf6e5741be37cf0e9415752872c4912193d3c11cdea7f859 | Python | 7,356 | 195 | import os
from itertools import product
import torch
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
from torchvision import utils
from skimage import color
try:
import wandb
except Exception as e:
print(f"Wandb not installed: {e}")
from VINNA.utils im... |
58cfe225a484cb06ced59376477b50440365d278a3afbcfb484313dae65803c3 | Python | 7,359 | 230 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays import FloatingArray
@pytest.mark.parametrize("ufunc", [np.abs, np.sign])
def test_ufuncs_single_int(ufunc, using_nan_is_na):
a = pd.array([1, 2, -3, pd.NA], dtype="Int64")
result = ufunc(a)
np_res =... |
33309801e5b2a7e40ffdd61299835b14300aaf3adb455cfd680df9df9ad53475 | Python | 7,361 | 66 | """Record endpoint and window choices before the additional spatial calculations."""
from pathlib import Path
import json,csv,math
ROOT=Path(__file__).resolve().parents[1]
rows=[]
def add(ident,source,endpoint,window,increment,rr,lo,hi,pi_lo=None,pi_hi=None,population='',notes=''):
rows.append(dict(id=ident,source=... |
2b12a55a869feb4e9fe15dcfd0e44a2d1cc67cb3982f58e893a3c95d60f028c7 | Python | 7,367 | 182 | """Exercise compiled public calls with bounded host-context subprocesses."""
import multiprocessing
import os
from pathlib import Path
import signal
import subprocess
import sys
import pytest
SCRIPT = r'''
import numpy as np
import multiprocessing
import sys
import threading
from concurrent.futures import ThreadPool... |
18cae8502a04ba8f66e700fede8c998d731248b2381b194d234cbef0a0544a77 | Python | 7,368 | 233 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for GCPNet (https://github.com/BioinfoMachineLearning/GCPNet):
# ----------------------------------------------------------------------------------------------... |
74aa9f9818b545ef9d533c76e139344b26565ab9f6be73cb819c87fc75c78544 | Python | 7,368 | 200 | # Test suite for chromosight.utils.io
import os
import json
import tempfile
import numpy as np
import pandas as pd
from jsonschema import ValidationError
import scipy.sparse as sp
import cooler
import chromosight.utils.io as cio
BIN_COLS = ["chrom", "start", "end"]
CHR_COLS = ["name", "length", "start_bin", "end_bin"]... |
23463fa15b0e67acb90b988241e09d07a58a159f35cea69484593ada3c17a77e | Python | 7,370 | 196 | # Copyright 2024 Xanadu Quantum Technologies 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 agre... |
a14d16e3e46f5369b411a9506626885c19472c943d123235279bc768222bb513 | Python | 7,370 | 232 | import math
import numpy as np
import pandas as pd
import torch
from torch import nn
# http://d2l.ai/chapter_recurrent-modern/seq2seq.html
def sequence_mask(X, valid_len, value=0):
"""Mask irrelevant entries in sequences."""
maxlen = X.size(1)
mask = (
torch.arange((maxlen), dtype=torch.float32, ... |
bd6dfc354888de79267b7826f930b7927f9c362eec762e35a4e4c0fbad331103 | Python | 7,370 | 225 | import os
from typing import Any, cast
import numpy as np
import pandas as pd
np.seterr(all="raise")
from deepglyco.speclib.common.rtcalibrate import RetentionTimeCalibrator
from deepglyco.speclib.common.rtcombine import NonRedundantRetentionTimeConsensus
from deepglyco.speclib.gpep.hdf import GlycoPeptideSpectralL... |
950f830a4cc4057a325ca88376291e5ed45e8bf478dc53fa9a3510bfaba732fc | Python | 7,374 | 239 | # -*- coding: utf-8 -*-
# JN 2016-01-12
from __future__ import print_function, division, absolute_import
import os
import csv
import glob
import numpy as np
import tables
from .man_spikes import SpikeManager
from .tools import expandts, debug
from .. import make_attrs
FNAME_H5META = 'h5meta.txt'
class H5Manager(obj... |
c44092bd2609971226c0e15adfc8b129fd72cf59334db351af46ccfb50b8786e | Python | 7,374 | 177 | #!/usr/bin/env python
synopsis = "\n\
TD_finder.py <input.PG.txt> <species_code> <N> <output.txt>\n\n\
- to a tab-delimited <input.PG.txt>, add locusID, find Tandem Duplication (TD)\n\
events and assign TDid, and print to <output.txt>.\n\
- requires a sorted protein-coding (pc) gene coordinate file, parsed from... |
b166d9678afb404a9c2561763c70bb0359c234bf2f13b0e66112bc9566fe0832 | Python | 7,376 | 241 | from datetime import (
date,
datetime,
)
import zoneinfo
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
def test_insert(idx):
# key contained in all levels
new_index = idx.insert(0, ("bar", "two"))
assert new_index.equal_levels(idx)
assert new_index[0] == (... |
32ce8bc9fe5ebc3a9b4195e568434b89fdf50e260a7f701f580932a3b93f1554 | Python | 7,378 | 154 | import os
import shutil
import subprocess
import pytest
from pcntoolkit.normative_model import NormativeModel
from pcntoolkit.regression_model.blr import BLR
class TestBasicCLI:
"""Test basic CLI functionality."""
@pytest.fixture(autouse=True)
def setup(self, synthetic_data, temp_output_dir):
"... |
fd8c3a027477c78d23db516e6f950785e11356cab82b837553cb01ad2fb7fd8b | Python | 7,378 | 209 | """Test cases for GroupBy.plot"""
import numpy as np
import pytest
import pandas as pd
from pandas.tests.plotting.common import (
_check_axes_shape,
_check_legend_labels,
)
pytest.importorskip("matplotlib")
class TestDataFrameGroupByPlots:
def test_series_groupby_plotting_nominally_works(self):
... |
11f87fa500f5f9f2cb4ccec33489c5730dc535594d6119be5322fff52878e656 | Python | 7,381 | 255 | """Module for extracting structural info from pyrosetta pose"""
from functools import partial
import logging
from pathlib import Path
import sys
from typing import List,Tuple
import h5py
import numpy as np
import pyrosetta
from pyrosetta.toolbox.extract_coords_pose import pose_coords_as_rows
from pyrosetta.rosetta.co... |
2f93e52db77a2a4b6e75009b5e7a0fc9c9fd428c4d8343d500e5f15d27104d4c | Python | 7,381 | 217 | import numpy as np
import pytest
from pandas.errors import Pandas4Warning
from pandas.core.dtypes.common import (
is_complex_dtype,
is_extension_array_dtype,
)
import pandas as pd
import pandas._testing as tm
class TestSeriesDescribe:
def test_describe_ints(self):
ser = pd.Series([0, 1, 2, 3, 4... |
1039d971f0f4a951ba8c842aff74723260f3e2290b615866dd4b726ea983cf1f | Python | 7,384 | 190 | # Copyright 2018-2021 Xanadu Quantum Technologies 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... |
76337aae19e65b3eef3cfd114d316cb3e5ad11bb225bfb9aed6bd8b1b5ee6194 | Python | 7,384 | 221 | from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as np
import pandas as pd
if TYPE_CHECKING:
from collections.abc import Iterable
from matplotlib.axes import Axes
from matplotlib.figure import Figure
class TablePlotter:
"""
Layout some DataFrames in vertical/ho... |
94de6e3b194b413eedd08709ad6bcc6eeb02a1efd43c4f6a8adf9dbe01cae1b0 | Python | 7,390 | 145 | #! /usr/bin/env python
##############################################################################
## DendroPy Phylogenetic Computing Library.
##
## Copyright 2010-2015 Jeet Sukumaran and Mark T. Holder.
## All rights reserved.
##
## See "LICENSE.rst" for terms and conditions of usage.
##
## If you use this wo... |
3e4e8d9b18dd3ae88d6e3f71cbdb7d990c9ff21adc204d379344f75b95530447 | Python | 7,391 | 105 | # Copyright 2026 Xanadu Quantum Technologies 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 agre... |
48954be9582e9d42648cd3694702d9d8719b1eea9f31b4566e9975bbce39b785 | Python | 7,392 | 217 | """Tests for the proximal gradient descent."""
import pytest
import torch
from mrpro.algorithms.optimizers import pgd
from mrpro.data.SpatialDimension import SpatialDimension
from mrpro.operators import FastFourierOp, LinearOperatorMatrix, WaveletOp
from mrpro.operators.functionals import L1NormViewAsReal, L2NormSquar... |
79fa231079a5d00c9a47f6c1527e8f6c34a6453a37e00669dba11898c628da93 | Python | 7,392 | 233 | try:
import smbus
except:
print ('Try sudo apt-get install python-smbus')
from time import sleep
# Models
MODEL_02BA = 0
MODEL_30BA = 1
# Oversampling options
OSR_256 = 0
OSR_512 = 1
OSR_1024 = 2
OSR_2048 = 3
OSR_4096 = 4
OSR_8192 = 5
# kg/m^3 convenience
DENSITY_FRESHWATER = 997
DENSITY_SALTWATER = 1... |
e0957128da07f62dca33cf092567b26667f22793a1e3e20a033735426ef2e901 | Python | 7,395 | 232 | # coding: utf-8
"""Classes for writing and filtering of processed reads.
A Filter is a callable that has the read as its only argument. If it is called,
it returns True if the read should be filtered (discarded), and False if not.
To be used, a filter needs to be wrapped in one of the Wrapper classes. To determine
wh... |
0ddc76bc61e8e89be3b9bba9db48b01274f854029a03b0fc89ac38b671e0dcb5 | Python | 7,396 | 245 | import os
import numpy as np
import pandas as pd
from torch.utils.data import Subset
from deepglyco.chem.common.elements import ElementCollection
from deepglyco.chem.gpep.fragments import GlycanFragmentTypeCollection
from deepglyco.chem.gpep.glycans import MonosaccharideCollection
from deepglyco.chem.pep.aminoacids i... |
73471ccdd9d56e1e438eb29beb4443d62c9e3656ebb750f5f55d5b3fe97b84e0 | Python | 7,401 | 149 |
'''
This script annotates `sites/sites-unannotated.tsv` with rsids (comma-separated) from `resources/rsids-*.tsv.gz`. It prints output to `sites-rsids.tsv`.
It relies on both being ordered like [1-22,X,Y,MT] and having positions sorted.
Notes:
`sites/sites-unannotated.tsv` can have multi-allelic positions.
`resou... |
5a0934c253ddea26f0171db048b4e1e5089a73274b364d922ae1f030aa88b9f5 | Python | 7,403 | 201 | # ----------------------------------------------------------------------------
# Copyright (c) 2016-2025, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
d96c7755ce98ffe6c1b320d50508d7e943a3aa78dd00c16d881aedbdadc95831 | Python | 7,407 | 231 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays import FloatingArray
from pandas.core.arrays.floating import (
Float32Dtype,
Float64Dtype,
)
def test_uses_pandas_na():
a = pd.array([1, None], dtype=Float64Dtype())
assert a[1] is pd.NA
def te... |
d2ffa954d40b24c76b56fd91805e7fb7b970e66f8504e51a1881ade1ac974f7d | Python | 7,408 | 227 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# filter_variants_on_repeats.py: Drop low-frequency variants on repeats
"""
Low-frequency variants on repeats might be counterproductive in a graph.
They can be more likely to be matched spuriously due to an error than due to a
genuine instance of the variant.
This script r... |
9b95b9a61b307cb96ed1a5f205739b5fd2d48479838e96690a8849baf82a1a4c | Python | 7,411 | 177 | import sys
import pandas as pd
import numpy as np
import numpy.linalg as la
from astropy.stats import median_absolute_deviation
import matplotlib.pyplot as plt
def select_features_by_missing_values(data, threshold=0.1):
'''
This function returns the indices of the features whose missing rates are smaller than ... |
666a9b90c834aa18bf2e431fe92110bdc7380d78ea72d3bfa11e5b3000107455 | Python | 7,412 | 241 | """
Utilities for measuring discriminator prediction to specific
types of real and simulated genomic regions.
Author: Rebecca Riley
Date: 01/03/2023
"""
# python imports
import math
import numpy as np
import sys
sys.path.insert(1, "../")
# our imports
import global_vars
import discriminator
import real_data_random
i... |
9c06324f33eea9a028b7c61b0e056716909c43cdd4a65b9ee6cf7608e24f0365 | Python | 7,412 | 151 | def quantile_normalize(df):
rank_mean = df.stack().groupby(df.rank(method='first').stack().astype(int)).mean()
return df.rank(method='min').stack().astype(int).map(rank_mean).unstack()
def bulk_reg(Input_dir,GRNdir,genome,chrN):
from LL_net import load_region
from LL_net import load_TFbinding
fr... |
bbdd01a716ddf61512133c1d9e07b14b5e079c389fae357866c235e102dcca7d | Python | 7,412 | 171 | """Tests for algorithms to calculate the DCF with voronoi."""
import math
import pytest
import torch
from einops import repeat
from mrpro.algorithms.dcf import dcf_1d, dcf_2d3d_voronoi
from mrpro.data import KTrajectory
def example_traj_rad_2d(n_kr, n_ka, phi0=0.0, broadcast=True):
"""Create 2D radial trajector... |
8eb9846d1ec7a542ea8a93040236d200547405c1753d92b5999e25318def9bce | Python | 7,416 | 222 | import os
import math
import random
import pickle
import numpy as np
import pandas as pd
import torch
from torch import nn
from torch.utils.data import Dataset, DataLoader
from dataset import set_binary_labels, BaselineDataset
from model import BaselineModel
from trainer import train_baseline, evaluate_baseline
from... |
2072a1080ee42338400dfda1660a2a6e351762d2a35dca1ccc20156962e92cd1 | Python | 7,418 | 224 | #!/usr/bin/env python3
#
# Copyright 2017 Google Inc. 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... |
bd72eea8e2f5cc3d68f2a7e9d8d216aed290516e01e77f279d7eb7c611ff9676 | Python | 7,418 | 225 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 5 09:43:01 2023
@author: jinani
This code is a working example of estimating the receptive fields
of a simulated simple and complex cell.
First part of the code simulate the cell responses for natural images and
carryout different preprocessin... |
b2d144915d08eeeb73f0fc2e4907543230da889ae456cbee383aa64a770ec73b | Python | 7,419 | 229 | # Copyright 2018-2024 Xanadu Quantum Technologies 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... |
6c4f837ed2d7ca7f2f298bdf7e8f1e7b6c10bfe2a8f997e248c13fdad1e323dc | Python | 7,420 | 210 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class BaseMissingTests:
def _honors_copy_keyword(self, data) -> bool:
"""Whether the EA honors the copy keyword in methods like fillna.
EAs that always return new data regardless of copy=False should
overri... |
eea0da76d7dc84185f17523b5055c952ec3842020e58ad659eee1003a507ae91 | Python | 7,423 | 102 | """Prepare an independently sourced Midlands Province study geography.
The Shurugwi public-data study is retained as a separate preliminary analysis.
No survey or simulated dataset is accessed.
"""
from pathlib import Path
from datetime import datetime, timezone
import json, hashlib, shutil, os, re
os.environ.pop('PRO... |
ee9472a4e1068a4df5935f108343e630b8e1b5209edf73b8610e88be3b6aae23 | Python | 7,424 | 193 | # Copyright 2026 Xanadu Quantum Technologies 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 agre... |
4e5b6b364d7d2fe9d5abbee4dd68a4c3b28fe1e171464be7f9e2dcef05ece463 | Python | 7,428 | 196 | import natsort
import pandas as pd
import numpy as np
import torch
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, utils
import os, json
def load_data(data):
"""Loads the saved numpy data
Input Args:
data (str) : path for data which ... |
45a406cb5eca175a12dac5817001a4907c85acf6741d50db5166eb61229bedeb | Python | 7,429 | 217 | import torch
import torch.nn as nn
from torch.nn.utils.parametrizations import spectral_norm
from torch.utils.data import DataLoader
import pytorch_lightning as pl
class Generator(nn.Module):
def __init__(self, z_dim, x_dim, n_hidden_layers=8, n_hidden_nodes=100):
super().__init__()
self.z_dim = ... |
5a35e9ff30a018f45f96cb8dc24e24bc0e32ceb196b89b732e86de4499a239a8 | Python | 7,434 | 227 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
@pytest.fixture(params=[(1, 0), (5, 1)])
def rolling_consistency_cases(request):
"""window, min_periods"""
return request.param
@pytest.mark.parametrize("f", [lambda v: pd.Series(v).sum(), np.nansum])
def test_rolling_apply_c... |
6492785d76ab7d8293b73523aa35ef6179eede5014c0b84d5ed4b36fd0b918ec | Python | 7,437 | 215 | """
Unit tests for the MigrationRegistry and
check_forward_compatibility function in util/migration.py.
Tests use local registry instances so they are fully isolated
from the module-level singleton and from each other.
"""
import warnings
from unittest.mock import patch
from pcntoolkit.util.migration import (
Mi... |
31ffe2e1c1545881887aca1b3442a777da38d77fe98e10b193bfb4d88609e9e1 | Python | 7,438 | 201 | from datetime import datetime
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.core.indexes.base import maybe_sequence_to_range
class TestRangeIndexConstructors:
@pytest.mark.parametrize("name", [None, "foo"])
@pytest.mark.parametrize(
"args, kwargs, star... |
74fd35537f14108ea7773b7215ae3c9ce27434203d236fb678fed64649137e07 | Python | 7,438 | 197 | # Copyright 2024 Xanadu Quantum Technologies 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 agre... |
c607db62460ce752fb2990fea4a794e5356f6df1dc3e09a3ab2268eea2238aa1 | Python | 7,439 | 185 | import os
import re
from collections import OrderedDict
from os.path import join
import numpy as np
class ParamGenerator:
def __init__(self):
pass
def generate_params(self, randomize=True):
"""Supposed to be a generator (so should yield dicts of parameters)."""
pass
class ParamList... |
63dfc8ab5a0df611122b2567a26b6d129acbe4c9b92f2afe45f5bde5df306663 | Python | 7,442 | 167 | import pandas as pd
import numpy
import networkx
def getConnectionToTF(model, allTFs, affectedNodes):
g = networkx.from_pandas_edgelist(model, 'source', 'target', create_using=networkx.DiGraph())
allNodes = numpy.array(list(g.nodes))
includedTFs = numpy.intersect1d(allTFs, allNodes)
connectedToTF = nu... |
a336c030ebf50b2582483cece5afbcf6ea54bdc03ec0ee73f4eeecf874b5fcaf | Python | 7,445 | 195 | # Copyright 2026 Xanadu Quantum Technologies 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 agree... |
9c3a9f418fd46e33f730159ad74de86d2b83efb25484d6c85efcfbcff1b66dc5 | Python | 7,446 | 233 | """Workspace-scoped Model Library: editable view of the engine model registry.
Routes (all under ``/api/v1``):
GET /workspaces/{ws_id}/model-library?task=classification
Lazy-syncs from the engine on first read of a (workspace, task) pair,
then serves DB rows. Pass ``?task=`` to scope; omit to retur... |
fee84a639bce35ae9b48e8648ab08cf727ab96680e15ad9826939d73b18e58a8 | Python | 7,449 | 213 | import re
import sys
# a Tree consists of a category label 'c' and a list of child Trees 'ch'
class Tree:
def __init__(self,c='',ch=[], p=None, l=0, r=0):
self.c = c
self.ch = ch
self.p = p
self.l = l
self.r = r
# obtain string from tree
def __str__(self):
... |
684d338843eab63467ffd3d5758bd5e2f0464efa1df87f055a87752c86261db3 | Python | 7,451 | 192 | __version__ = "2.0"
__author__ = "Singh, Satnam"
__maintainer__ = "Singh, Satnam"
__contact__ = "satnam.singh@ivv.fraunhofer.de"
import natsort
import pandas as pd
import numpy as np
import torch
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, utils
... |
ecc39038f9378d94f9433f0a3cb280db10bafb39e1c601dbab1879f4c5571475 | Python | 7,451 | 161 | import pandas as pd
import numpy as np
import torch
from torch import nn
from torch.nn import functional as F
import sys
from GATmann import prepare_dataloaders, prepare_dataloaders_prism, prepare_dataloaders_allgenes
from utils import init_weights, KFoldGen, KFoldLenient
import pickle
from GATF import CancerDrugGraphF... |
9db8076abe06ff6325f9a89993d390c27a35b052efb49e6bd46eada00db6cf3e | Python | 7,454 | 170 | ##############################################################################
#This file makes the count for generating the PRISMA numbers automatically #
# #
#Created: 29.03.2023 #
#Aut... |
71976d98e08fcda3066ca6730f49acd6da098b8986a0770ac342444399748d35 | Python | 7,461 | 193 | # License: see [LICENSE, LICENSES/legged_gym/LICENSE]
import os
import copy
import torch
import numpy as np
import random
from isaacgym import gymapi
from isaacgym import gymutil
from legged_gym import LEGGED_GYM_ROOT_DIR, LEGGED_GYM_ENVS_DIR
def class_to_dict(obj) -> dict:
if not hasattr(obj,"__dict__"):
... |
ec82fec15ede2f1026e5ed1cdf3755268f47d6487e433a2a4aec154e3f0ceb0c | Python | 7,462 | 213 | # Copyright 2018-2025 Xanadu Quantum Technologies 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... |
42ed1d5e7be101802fb669b6f332a18178cb2b0557e7e04daf9616699f7f637b | Python | 7,465 | 218 | """`LLMRouter` — single entry point every consultation goes through.
Responsibilities:
1. Load the active `LLMProviderSetting` row for a workspace.
2. Build a provider instance via `get_provider(...)`.
3. Call `provider.complete(...)` with the consultation's system/user/schema.
4. Normalise the response into `... |
87c066aac00b9a836de4475180248d99f0fca288c223e144b25327de3e71ba3e | Python | 7,465 | 189 | #! /usr/bin/env python
##############################################################################
## DendroPy Phylogenetic Computing Library.
##
## Copyright 2010-2015 Jeet Sukumaran and Mark T. Holder.
## All rights reserved.
##
## See "LICENSE.rst" for terms and conditions of usage.
##
## If you use this wo... |
0ddfaf3089cf6333d118a065998d9f73cb5af2361288451fb1b6a16d46bf30d3 | Python | 7,471 | 187 | import argparse
import sys
import os
import string
import pickle
import numpy as np
import pandas as pd
import yaml
try:
from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:
from yaml import Loader, Dumper
from cdr.config import Config, PlotConfig
from cdr.kwargs import plot_kwarg_docstrin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.