sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
5cc67605a2dcf728a3b79520f3424a72ac7f1f1b9e9d57f374b202d5c183ab8a | Python | 9,738 | 364 | import windseer.nn as nn_custom
import torch
import unittest
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
#------------------------------------------ ADD CONFIGS TO TEST HERE ---------------------------------------------------
configs = []
# single loss testing : LPLoss (only up to order... |
ae0dad09a935f5a6ebf07a0b23c6b1ec5ffd51bf6b982a8d90af95cadc9f1f7a | Python | 9,741 | 254 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for GCPNet (https://github.com/BioinfoMachineLearning/GCPNet):
# ----------------------------------------------------------------------------------------------... |
e203fe2b6d30d3061105855e4c5e602942ff41efb8c6176deedb995a8d1a4dab | Python | 9,741 | 265 | # 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... |
48ac7cd232f263d5ee4d6d245ffbf401423876c93a88cf1c8914640d060b674c | Python | 9,743 | 246 | import os
import anndata
import numpy as np
import pandas as pd
try:
from pyBigWig import open as open_bw
PYBIGWIG_AVAILABLE = True
except ImportError:
PYBIGWIG_AVAILABLE = False
from ..logger._live import live_step
from ._preprocess_utils import (
add_metadata_to_anndata,
add_unstructured_data,... |
622bf9cd04a3c52ac168fe033b728fca51685648d32dfaf0fd8d80081c82672b | Python | 9,743 | 285 | import argparse
import copy
import h5py
import matplotlib.pyplot as plt
from matplotlib import cm
import numpy as np
from osgeo import gdal
from scipy.interpolate import RegularGridInterpolator, interp1d
from scipy import ndimage
import windseer.measurement_campaigns as mc_utils
parser = argparse.ArgumentParser(
... |
ee777d5d2fef1d98425f9684bc5fdf33c1d6ffbd112c7d3a514ade2508525562 | Python | 9,743 | 261 | ##############################################################################
## ##
## This file is part of ModelBlocks. Copyright 2009, ModelBlocks developers. ##
## ##
#... |
0ec747adf7ffef23a61f9c45fde5192e6177f2f377b676f684b30e6fb76b5e64 | Python | 9,753 | 278 | """Integration tests for the LLM advisory surface.
Uses `FakeLLMProvider` registered under every provider name so the router's
full dispatch path is exercised without hitting real APIs.
"""
from __future__ import annotations
import io
from collections.abc import Generator
import pytest
from fastapi.testclient impor... |
1ecd3cd0ff8a0b87d9e91d840ba79793a293727a7f3c4c35249e39fb92fa9a59 | Python | 9,753 | 243 | ''' release_report.py
Compare the number of samples in SAGE to counts in MongoDB by release.
A file (releases_missing_samples.txt) is created with the list of missing samples.
'''
import argparse
from operator import attrgetter
import sys
from colorama import Fore, Style
import jrc_common.jrc_common as JRC
#p... |
904697c67a5cd744adf76750a96b48ceda74ee5a112532bbd654c3c2b37c1439 | Python | 9,753 | 203 | import argparse
import numpy as np
import math
import tqdm
import logging
import matplotlib.pyplot as plt
from pathlib import Path
from scipy.io import loadmat
from scipy.signal import spectrogram
from local.common import ExperimentMapping, SelectElectrodesFromBothGrids, EnergyBasedVad
from mpl_toolkits.axes_grid1.inse... |
5a0ec04a962b2072f26876c872c9be85602f1a0b093d7f0959ed3abfcd2390f0 | Python | 9,754 | 276 | from __future__ import annotations
from typing import (
TYPE_CHECKING,
Any,
cast,
)
import numpy as np
from pandas.compat._optional import import_optional_dependency
import pandas as pd
from pandas.io.excel._base import BaseExcelReader
if TYPE_CHECKING:
from odf.opendocument import OpenDocument
... |
b7462104dc1860d031dd917424e8ecc242280c9437e9558e3a12d39920857729 | Python | 9,754 | 223 | # -*- coding: utf-8 -*-
import os
import datetime
import uuid
import json
import torch
from sdna.sim import *
from sdna.net import *
from sdna.net.functional import *
from sdna.net.functional.bitIO import BitEncodeStream, BitDecodeStream
class SDNA(object):
def __init__(self, arguments):
"""
Cla... |
c4294485b7aea20253a4543629301dbb0f7b75fb773d7531d1d0923f0e68a769 | Python | 9,757 | 210 | import gc
from functools import partial
import anndata
import torch
from ..logger._live import ClockRunDisplay, DisplayLogger, display_enabled, quiet_hf_bars
from ._cache import ClockCache
from ._pred_utils import (
_validate_batch_size,
add_pred_ages_and_clock_metadata_adata,
apply_cohort_transform,
... |
86ee4eea724c014c3b4dede659be21e99e80da008851126b37d49bf77773dee1 | Python | 9,758 | 308 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
@pytest.mark.parametrize("align_axis", [0, 1, "index", "columns"])
def test_compare_axis(align_axis):
# GH#30429
df = pd.DataFrame(
{"col1": ["a", "b", "c"], "col2": [1.0, 2.0, np.nan], "col3": [1.0, 2.0, 3.0]},
... |
7ac03fdb85f99467c41bc46d7b4dc62885509cab26cc9fa3303deaa6d532fcb7 | Python | 9,768 | 159 | from botocore.client import Config
import ibm_boto3
from io import StringIO
import types
import os
import pandas as pd
import sys
import json
import numpy as np
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."... |
4b5b29dd06e078e372207d50d446487d79de4c276974832d20bf40c0c790e1d1 | Python | 9,773 | 236 | """Methods for diagnosing problems in meta-analytic datasets or analyses."""
import copy
import logging
from functools import partial
from multiprocessing import Pool
import nibabel as nib
import numpy as np
import pandas as pd
from nibabel.funcs import squeeze_image
from nilearn import image, input_data
from scipy im... |
5c8cadbca690447cbef83a221c0fa02d0c00eb2ed4ae698baa5c0d02cd8da3c1 | Python | 9,776 | 337 | import string
import sys
import warnings
import numpy as np
import pandas as pd
try:
from pandas.api.types import union_categoricals
except ImportError:
try:
from pandas.types.concat import union_categoricals
except ImportError:
pass
class Constructor:
def setup(self):
N = 1... |
0596a1614709c76e15c257a04977ac6d4e9f0b6b93c5fc6077409f58bb9b0a0f | Python | 9,778 | 306 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.tests.copy_view.util import get_array
@pytest.mark.parametrize("method", ["pad", "nearest", "linear"])
def test_interpolate_no_op(method):
df = pd.DataFrame({"a": [1, 2]})
df_orig = df.copy()
if method == "pad"... |
45100a0872c01a24db44f2a06f9a6089db477246be420f59f57a7ce309886794 | Python | 9,780 | 258 | from rl_games.common.ivecenv import IVecEnv
import gymnasium
from gymnasium.vector import SyncVectorEnv, AsyncVectorEnv
from gymnasium.wrappers import AtariPreprocessing, FrameStackObservation, FlattenObservation
import numpy as np
# Register ALE (Atari) environments if available
try:
import ale_py
gymnasium.r... |
130c47a2ad3cc0e0a7fe955af4ffa60ed7c4dca737cb7fcdd4ebd6cc29167126 | Python | 9,783 | 186 | from src.cigar_op import collect_cigars_from_bam
from src.cigar_map import generate_cigar_map_for_partition
from src.hash_realign.run_hash_realign import hash_realign_unmapped
from src.partition_op import generate_partitions_in_interval
from src.variant_op import detect_target_pseudo_variant_for_partition, detect_base_... |
4f60e55f2e4ff3a69eb6bd7b1d5b6546e834473e8ce649c0b20a45644b7c1945 | Python | 9,788 | 295 | """Unit tests for the PyCaret 4.0 new architecture primitives.
Covers:
- `pycaret.core` types: `TaskType`, result dataclasses, error hierarchy
- `pycaret.logging`: event stream, `BaseLogger`, `MemoryLogger`
- `pycaret.api`: static introspection (`list_models`, `describe_model`, ...)
- `pycaret.tasks.ClassificationExpe... |
7e8214fe25a5f8a62c61931e6b00c6fee39419def8d9632b0cb9bcc889ee5ee8 | Python | 9,797 | 256 | import numpy as np
import unittest
from nose2.tools import params
import scipy.sparse as sp
import chromosight
import chromosight.utils
import chromosight.utils.preprocessing as preproc
import chromosight.utils.io as cio
mat, chroms, bins, res = cio.load_cool("data_test/example.cool")
mat = mat.tocsr()
# Get all intra... |
e306845e048bec5f072df114dadec7cfd4a3f2ceff8b938f78ed7822fee4fe82 | Python | 9,799 | 267 | """Session 43 — phase 5c (cont.): drain ``TimeSeriesExperiment.tune_model``.
Phases 5b/5c (s40-s42) drained ``create_model``, ``predict_model``, and
``compare_models``. This session drains the fourth TS verb. Native
``tune_model`` wraps sktime's ``ForecastingGridSearchCV`` /
``ForecastingRandomizedSearchCV`` around th... |
5c3336f5805118c5e497422c9960b28e5e6501082a49623c75af7817433d1b85 | Python | 9,802 | 309 | """test scalar indexing, including at and iat"""
from datetime import (
datetime,
timedelta,
)
import itertools
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
def generate_indices(f, values=False):
"""
generate the indices
if values is True , use the axis valu... |
b9b4e90e4e3346148e482c872552f55288a1631177c535cdfa2b36ec26bbaaa3 | Python | 9,807 | 257 | """Classes to streamline data typechecking."""
from __future__ import annotations
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, TypedDict
import numpy as np
import pandas as pd
import torch
from jaxtyping import Float, Int
if TYPE_CHECKING:
from nvidia.dali.plugin.pytorch import DALIGe... |
6c5c8fea1e0498a1e8e7f82f7bb419d7e9c831c646468d27a798ebfba5aa63c8 | Python | 9,810 | 279 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestDataFrameValues:
def test_values(self, float_frame):
with pytest.raises(ValueError, match="read-only"):
float_frame.values[:, 0] = 5.0
assert (float_frame.values[:, 0] != 5).all()
def test... |
aaa189c83a1aa1b1d3021a7365aa36ad261f74fb8f41b8afae85c5125d3550cc | Python | 9,810 | 250 | import os
import sys
import numpy as np
import pandas as pd
from anndata import AnnData
import scanpy as sc
import shutil
import json
def dataset(config):
"""
Prepares datasets for training dissect. Uses parameters from config.py.
"""
savedir = config["experiment_folder"]
dataset_path = os.path.joi... |
9f43c0916d6b017c446b234b0f7395ce1be2058aa7efca77e57223e818c742cf | Python | 9,813 | 237 | """Test the create_bbox CLI command argument parsing."""
import argparse
from unittest.mock import MagicMock, patch
import pytest
from lightning_pose.cli.commands.create_bbox import get_parser, handle
class TestGetParser:
"""Test the get_parser function."""
def test_returns_argument_parser(self):
... |
216caeac0230d766ab486281de85eb660fa321b04eda42c318e6d195936a4309 | Python | 9,815 | 241 |
from ..utils import chrom_order, get_phenolist, PheWebError
from .. import conf
from ..file_utils import VariantFileReader, VariantFileWriter, get_filepath, get_pheno_filepath, make_basedir, get_dated_tmp_path, get_tmp_path
from .load_utils import get_maf, mtime, indent, ProgressBar
import contextlib
import os
import... |
04007b4ba33145a4199915f530f2aaca074539c2155b9bf9f66bd64a2bc92195 | Python | 9,816 | 226 | """Workflow for running an ALE meta-analysis from a Sleuth text file."""
import logging
import os
import pathlib
from shutil import copyfile
import numpy as np
from ..correct import FWECorrector
from ..io import convert_sleuth_to_dataset
from ..meta import ALE, ALESubtraction
LGR = logging.getLogger(__name__)
def ... |
4ec2ecaf83278069b07812d82aa72cc5c10a358de351524b5661dc6356505509 | Python | 9,816 | 213 | import argparse
import numpy as np
import os
import torch
from sklearn import metrics
from utils.load_fastmri_data_convnext_t2 import load_data
from model.model import ConvNext_model
from utils.pytorchtools import EarlyStopping
from model.extra_model_utils import get_optim_sched, get_lr
from shutil import copyfile
from... |
a7bdaf6f6917846aafb3b64daa22b5b6cd022b52b0762caaca5408e19ed1432b | Python | 9,820 | 271 | """Test data utils functionality."""
import pytest
import torch
def test_split_sizes_from_probabilities():
from lightning_pose.data.utils import split_sizes_from_probabilities
# make sure we count examples properly
total_number = 100
train_prob = 0.8
val_prob = 0.1
test_prob = 0.1
out ... |
2443a5a7335548c8b004cf16c1f5952142a492cdb6439520dd8ce7ed812bd886 | Python | 9,831 | 277 | 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, ADDataset
from model import ADModel
from trainer import train, evaluate
from utils import (
read_yaml,... |
8c64ae79a14b2367b18c3428ccdc0a3f2a3c149d40f2f357b43f175ef0dde6e6 | Python | 9,833 | 280 | # 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... |
f2b14bdf90e3c18179c5701c522e04352abe77ae5a7d39f2677bea4feb55972b | Python | 9,835 | 212 | import argparse
import numpy as np
import os
import torch
from sklearn import metrics
from utils.load_fastmri_data_convnext_diff import load_data
from model.model import ConvNext_model
from utils.pytorchtools import EarlyStopping
from model.extra_model_utils import get_optim_sched, get_lr
from shutil import copyfile
fr... |
0862dc83f0a22305f1c1de4fd90ca540e8b108923719f7021a03c218894e625a | Python | 9,836 | 293 | #
# File to train networks built from the hnn.py class.
#
# This file establishes the clebsch gordan coefficients, sets up an hnn with given parameters,
# loads holograms from .npy files, and then tests the network via a function call.
#
from argparse import ArgumentParser
import logging
import os
import sys
import ... |
c2fbecfce005775e6ae4c9ce0bf9b504b103c101ec10115f36d15cb7142d2da6 | Python | 9,841 | 216 | import torch
import torch.utils.data as data_utils
from torchvision import datasets, transforms
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torchvision.models.squeezenet import SqueezeNet, Fire
from torchvision.models.resnet import ResNet, Bottleneck
from PIL import Im... |
461df33223e6c27aed904ecc1063dc1f5182b7ae3100ef151814e0fac4fda08a | Python | 9,847 | 217 | import numpy as np
from defs import *
from values import *
from set_params import set_torq_params
import electrochemical
import water
import glucose
import cotransport
import NHE3
import ATPase
import NKCC
import KCC
import NCC
import ENaC
import Pendrin
import AE1
import NHE1
import math
import TRPV5
import NCX1
im... |
cda37605e16d784ea1fc2c537eec08869135ad2b65bf39766269b3ae1265dacb | Python | 9,854 | 274 | from datetime import timedelta
import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays.timedeltas import TimedeltaArray
class TestTimedeltaIndex:
def test_0d_raises(self):
# GH#69411 used to segfault
arr ... |
11aa48f9a2bc22f2dbd9ad971b55d210d67d371495539bb661853b47cfe4a061 | Python | 9,855 | 308 | import importlib.resources
import numpy as np
from PyQt6 import uic, QtCore, QtWidgets
#: Precision for these features (``data``) should not go below this value.
#: (Precision is set automatically based on data range)
SPIN_CONTROL_PRECISION = {
"area_ratio": 3,
"aspect": 3,
"bright_avg": 1,
"bright_s... |
36875b936a9cc1c249f95db2ad724887d21a97d4d698309f052c9a4e7ee987dc | Python | 9,856 | 276 | #avafunc.py
# import stuff
from placerg.funcs import *
from placerg.funcsrg import *
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from placerg.funcsall import *
from scipy.optimize import least_squares
from scipy.sparse import csr_matrix
from scipy.io import savemat
... |
0f643425c710ba365337a301dd928fa1911c2743055269a1ad7907b9e353f141 | Python | 9,858 | 241 | import sys, configparser, torch, re, os
from collections import Counter
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def prepare_data():
data = [line.strip() for line in sys.stdin]
... |
56429fb0cb75455cd4a18bb2344684b29e2600116493bc049f87e5f80d89532e | Python | 9,859 | 271 | #!/usr/bin/env python
"""Module Description: Test functions that write wiggle, bedGraph, R model
and diagnosis outputs (MACS3.IO.OutputWriter).
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD License (see the file LICENSE included with
the distribution).
"""
import gzi... |
902ffc1e27300b7bc57906153772c65eb3caa4a2652cfb7bc772b67715e36f90 | Python | 9,861 | 209 | __author__ = 'etseng@pacb.com'
"""
Replicate of key methods from ICE related to alignment evaluation and ECE
"""
import pdb
import numpy as np
from cupcake.ice.find_ECE import findECE
def get_ece_arr_from_alignment(record):
"""
A simplified version of eval_sam_alignment that does NOT look at QV
Simply tr... |
e4333299dcba906a255fe29e66f12621932bec58b06a77730f9616aca5b5167d | Python | 9,863 | 381 | from numba.typed import Dict
from numba import types
import Wavenet.files as files, numpy as np
"""
Parameters
----------
dtype : str
Defines the desidered precision float64 or float32.
float64 : int
One bytes number.
float32 : int
One bytes number.
regularizer_multiplier : float
Multiplier $\mu$ from ... |
5f70492c2fda8ba3892351cd3656894c0a19be93ea9b322bb5d18fe776bfe3d1 | Python | 9,864 | 231 | #!/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
from scipy.ndimage import convolve
import scipy.io as sio
import matplotlib.pyplot as plt
from scipy.stats import multivariate_normal
# 1. downsample: To downsampl... |
ef4adfc83b493d1583ed39304242596b438ed34db0b5d81ab3f59e63282a8c67 | Python | 9,865 | 253 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 6 21:22:47 2022
Script to retrieve metadata from PREDICT-HD. Three pieces of information are
extracted: baseline information, longitudinal information (demographics +
clinical assessments) and imaging metadata.
@author: Eduardo Castro
"""
import ... |
041ac64360432a84266873b37c16c4989fe19d34da8aed148da81c6821326d98 | Python | 9,868 | 253 | import numpy as np
from src.cigar_op import collect_cigars_from_bam, collect_cigar_from_ref
class CigarMap:
"""
cigar map for a ref position.
self.map includes the detail cigars that contribute to this map
self.cnt_map includes the number (support) of detail cigars in this map
self.freq_map inclu... |
db4cdd9a3fbf73b4ea19ded9d3c007b6d21e203ee09525543c4ed95b6a03cfe3 | Python | 9,869 | 253 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestSeriesValueCounts:
def test_value_counts_datetime(self, unit):
# most dtypes are tested in tests/base
values = [
pd.Timestamp("2011-01-01 09:00"),
pd.Timestamp("2011-01-01 10:00"),
... |
6384308cb7b34cef7bbcf48f13e9ac012bfebbdbe21758a75806d2ee5aad8bba | Python | 9,870 | 258 | from rl_games.common.player import BasePlayer
from rl_games.algos_torch import torch_ext
from rl_games.algos_torch.running_mean_std import RunningMeanStd
from rl_games.common.tr_helpers import unsqueeze_obs
import torch
from torch import nn
import numpy as np
def rescale_actions(low, high, action):
d = (high - lo... |
912d8dc714dd71cf0cc45426cfb58813e5706c8b55faa92c5d87d338ef473ef3 | Python | 9,881 | 201 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 21 23:31:01 2020
@author: Mehmood Ali Khan
"""
import numpy as np
import numpy.lib.recfunctions as recfunctions
def dateTimeFunction(datetime, hour_offset):
year=''
month=''
date=''
hour=''
year=datetime[0:4]
... |
18a6f237ccf914b95b1702ea7a407aa2f6b3279f9fd20d6b431fa6bfff9319d8 | Python | 9,884 | 198 | # IMPORTS
import torch
import pandas as pd
from torchvision import transforms
from torch.utils.data import DataLoader
import torchio as tio
import VINNA.data_processing.data_loader.dataset as dset
from VINNA.data_processing.augmentation.augmentation import ToTensor, ZeroPad, \
AddGaussianNoise, RandomAffine, Random... |
0fe9dd9c8d8b8ff19e5644fa5396b2a1f3955c9d132091a698512b3a23e222bc | Python | 9,889 | 320 | import re
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
@pytest.mark.parametrize(
"dtype, fill_value",
[
("int", 0),
("float", np.nan),
("bool", False),
("object", np.nan),
("datetime64[ns]", np.datetime64("NaT", "ns")),
("t... |
fd9b1cf1580211905219e960d1b7b4ceac10cae4c123f2ddbed657d9db497427 | Python | 9,898 | 235 |
import numpy as np
from copy import deepcopy as dcopy
from joblib import Parallel, delayed
import multiprocessing
num_cores = multiprocessing.cpu_count()
from scipy.stats import sem
from skimage import measure
from mne.decoding import GeneralizingEstimator
from sklearn.metrics import make_scorer
class DecodeModel_te... |
5c0cfddbeb4dea944b3b737a161626d1191fc2aa619a6cc5ecead116cafc10f1 | Python | 9,903 | 232 | """Helper class to extract labeled data from a data module."""
from typing import Literal
import imgaug.augmenters as iaa
import torch
from jaxtyping import Float
from lightning.pytorch.utilities import CombinedLoader
from lightning_pose.data.datamodules import BaseDataModule, UnlabeledDataModule
from lightning_pose... |
6ef70e6bc152a3cef93ff9ac90d332a1905421fa5fdd8a4a5b7469391add5d02 | Python | 9,905 | 275 | # -*- coding: utf-8 -*-
import numpy as np
import sys
import os
import pickle
import argparse
import math
import time
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
import torchvision.transforms as trn
import torchvision.datasets as dset
import torch.nn.functional as F
from torch.autograd impor... |
7d28fe02610132a528ee6b63f58d9c45f3f92ba53072d1ee16611cacc296b293 | Python | 9,909 | 245 | """
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 ase.db.sqlite
import ase.io.trajectory
import numpy as np
import torch
from torch_geometric.data import Data
from ocpmodels.common.ut... |
c45c1904f0783ef5b8872cbf0cab8b51c3b2233b85b02561b8f490e6787b5fb7 | Python | 9,910 | 254 | """
Implementation of the Adaptive U-Net using Adaptive Convolution to include acquisition parameters
(Voxel-Size, FoV-Orientation) in the deep learning model. The Filter Manifold Network (FMN) computes the convolution
filter kernel values based on the presented additional information.
Created by Simon Graf
The usag... |
8b125e240e7d77ec5f50c83ab58730db52b613b6c85d7b2ad4f39ee6669169a0 | Python | 9,911 | 276 | import sys
import os
from numpy import nan
import pandas as pd
import argparse
import csv
if __name__ == '__main__':
argparser = argparse.ArgumentParser('''
Extract eye-tracking time series from MECO eye-tracking corpus source.
''')
argparser.add_argument('sentitems_path', help='Path to file with space... |
e36a6604302439107dbbacbab08510c97d3c25b0479177149a3bd4c87b1f1d76 | Python | 9,913 | 265 | import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
class TestDataFrameClip:
def test_clip(self, float_frame):
median = float_frame.median().median()
original = float_frame.copy()
double = float_frame.clip(upper=medi... |
89f3ff173edb077f1b0f64f31ce396b3c304a2074a714ef6e62a6b8d4eb5c2d0 | Python | 9,918 | 260 | # 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... |
82947ad7d9cad092ea6f8c6b92a33424e4e5a8e1835eb197328bc2248718393a | Python | 9,927 | 261 | """B0-informed Fourier operators."""
from abc import ABC, abstractmethod
import einops
import torch
from mrpro.operators.LinearOperator import LinearOperator
class B0InformedFourierOp(LinearOperator, ABC):
"""Abstract base class for B0-informed Fourier operators.
Accounts for off-resonance effects via a s... |
037f8a3f835eb94663744d207aedd63a1166be3ff4926c8ac788ab66d852e38c | Python | 9,928 | 236 | """Primal-Dual Hybrid Gradient Algorithm (PDHG)."""
from __future__ import annotations
import warnings
from collections.abc import Callable, Sequence
from dataclasses import dataclass
import torch
from mrpro.algorithms.optimizers.OptimizerStatus import OptimizerStatus
from mrpro.operators import (
IdentityOp,
... |
5eb05aea7d5a2bd9eafbb0ce8e5b50f360e9c903763a40a81bf2713868d1e05a | Python | 9,929 | 254 | # Copyright 2018-2023 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... |
7004c989c7383ab054595aa1879b764ead9fe3f9594a301a8a80dfd6ee5094f0 | Python | 9,929 | 253 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# NiMARE documentation build configuration file, created by
# sphinx-quickstart
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All conf... |
4684f823b6668901c4ea287ed6d45de92a0a927ff64cb9ddfaa0e342b90b0cb9 | Python | 9,931 | 215 | """FastMRI dataset."""
from collections.abc import Callable, Sequence
from os import PathLike
from pathlib import Path
from warnings import warn
import h5py
import ismrmrd.xsd
import numpy as np
import torch
from einops import rearrange
from mrpro.algorithms.csm.inati import inati
from mrpro.data.AcqInfo import AcqI... |
443588c9c5e0ab6819d478eaaee298d9fc5fd8568a4847f4dc7fe5f58d0046fa | Python | 9,934 | 284 | import pysam
import os
def add_af_to_somatic_benmark_vcf(benchmark_vcf, out_vcf, somatic_log):
out_vcf = open(out_vcf, "w")
benchmark_vcf = pysam.VariantFile(benchmark_vcf)
out_vcf.write(str(benchmark_vcf.header))
for record in benchmark_vcf:
record_chrom = record.contig
record_star... |
bef47fb845c6e8073c2d3ab2a0774ebba43f407e71c4137fb81d1c8004b7a253 | Python | 9,935 | 334 | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
pal = sns.color_palette("deep")
# increase the figure size
plt.rcParams["figure.figsize"] = [12, 10]
# remove the top and right spines from plot in the global plt setting
plt.rcParams["axes.spines.top"] = False
plt.rcParams["axes.spines.right"]... |
e7b5c0be4d9b18a6b21aa2c4ef8b3384a6f45fac270faf352fd6035eb1d357e3 | Python | 9,935 | 242 | """Signal Extraction from videos and tracks"""
from typing import Collection, Sequence, Tuple
import cv2 # type: ignore
import numpy as np
import tqdm # type: ignore
import byotrack
def extract_intensities_from_roi(
video: Sequence[np.ndarray],
tracks: Collection[byotrack.Track],
roi_size: int,
a... |
f00139243bced66486b1214739b8323b81618dd909acd725bce6622fa7fd8971 | Python | 9,937 | 265 | from __future__ import print_function
import random
import copy
import numpy as np
try: # SciPy >= 0.19
from scipy.special import comb
except ImportError:
from scipy.misc import comb
def bernstein_poly(i, n, t):
"""
The Bernstein polynomial of n, i as a function of t
"""
return comb(n, i) *... |
c7a50842e0a29d831af01980dda65d899e792b736a560deb6672609542dc0a07 | Python | 9,938 | 237 | from __future__ import annotations
from os import PathLike
from typing import TYPE_CHECKING
import numpy as np
import xarray as xr
# Import BLR because z-diff is defined only for BLR models.
from pcntoolkit.regression_model.blr import BLR
from .longitudinal_score import LongitudinalScore
# Import the heavy classes... |
0f670b936526bd1a00e3b4050b3aacab323cab3c633ce03d5bce5dd0d2a9027a | Python | 9,942 | 256 | # 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... |
a4c6de0a04818b5184d799bc0ed8c75a9e8c3df63da8bede197f12f66a96bb90 | Python | 9,946 | 244 | #!/usr/bin/env python3
"""Calibrate the 3V "in-context difference" method for measuring a bound ligand's volume.
THE PROBLEM
`somo.residue`'s anhydrous molar volume field defines the bead volume. For a novel ligand we
must measure it. Measuring the ligand in isolation is wrong: the tabulated residue volumes are
a Voro... |
2af2d7fc34d6284bbdc20f112ea4cc94becccae118d979a2a869099aad6bd92e | Python | 9,947 | 331 | # 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... |
e1b08f04da49b357268ef83f8f4cc8ab8af19338fadee003045fa2ac8fef86a5 | Python | 9,949 | 278 | import numpy as np
from scipy.sparse import coo_matrix
class AffineBasis:
def __init__(self, dim=3, affine='affine'):
u = 1.0/np.sqrt(2.0)
dimSym = (dim * (dim+1))// 2
dimSkew = (dim * (dim-1))// 2
translation = False
sym = False
skew_sym = False
scale = Fals... |
2b2a82376f5f9f953f813fd2f6cf970c52c98644fd09601239fb5e8802611864 | Python | 9,952 | 284 | # 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... |
8c091baab23bf481ded905f4e2351e09043c63d36c5773cc53b3abd858ee5aac | Python | 9,958 | 292 | """Base Class Functional."""
from __future__ import annotations
import math
from abc import ABC, abstractmethod
from collections.abc import Sequence
from typing import TYPE_CHECKING, TypeAlias
import torch
from typing_extensions import TypeVarTuple, Unpack
import mrpro.operators
from mrpro.operators.Operator import... |
bd32405d58c56b5aa5ae0aded1131bdbf6dc80ad8a90cdbe70095b85ae7a86fb | Python | 9,964 | 282 | # Copyright 2021 DeepMind Technologies Limited
#
# 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 agr... |
e12405f4dca712291cc64e59855ad64cd4b45a61e6b81039aa1b1345048edac8 | Python | 9,965 | 248 | import matplotlib.pyplot as plt
import matplotlib.patches as patch
import numpy as np
import pandas as pd
import seaborn as sns
import scipy.special as sc
from ._preference import (
kwarg_savefig, artist_pipeline_adgile,
venn3_palette_alias
)
def base_scheme(
ax: plt.Axes,
scatterplot: bool = True
) -... |
17bc33c514e262076d6c396725d96c9854040bc34c94382b0665e18d82ee7762 | Python | 9,967 | 308 | import torch
import torch.nn as nn
from torch.utils.data import DataLoader
import pytorch_lightning as pl
class ResBlockTranspose(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=5, stride=1):
super().__init__()
padding = kernel_size//2
output_padding = stride-1
... |
20af14362056add684a93ec1a568171616223b4c17cae0c0e169365b56f0f940 | Python | 9,975 | 301 | import numpy as np
import pytest
from pandas.compat import HAS_PYARROW
import pandas as pd
import pandas._testing as tm
@pytest.mark.parametrize("operation, expected", [("min", "a"), ("max", "b")])
def test_reductions_series_strings(operation, expected):
# GH#31746
ser = pd.Series(["a", "b"], dtype="string"... |
bd4601fc03e1945e8a70cb59359542cdc38adfb1479088654658fb1507109191 | Python | 9,977 | 210 | from botocore.client import Config
import ibm_boto3
import os
import sys
import pdb
from pathlib import Path
from shutil import copyfile
from tqdm import tqdm
import gc
from sqlalchemy import update
import ants as an
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(os.path.ab... |
1778657e5c6249fcd158e9ef57ffc0ca8aebc97bd9dbca9b1ed3bf7082978ae7 | Python | 9,978 | 295 | import functools
import os
import numpy as np
import pandas as pd
import torch
from pymatgen.core.composition import Composition
from torch.utils.data import Dataset
from matminer.featurizers.base import MultipleFeaturizer
from matminer.featurizers import composition as cf
from matminer.featurizers.conversions import... |
6f0171f44274a4db40e7274b4c6f4f8ea33c0e192618fbb611760516987cb40f | Python | 9,980 | 278 | #-----------------------------------------------------------------------------
# Pharmacophore type assignment for protein and ligand
#-----------------------------------------------------------------------------
import os, sys
import pybel
import openbabel as ob
class pharma:
"""Pharmacophore Type Assignment for ... |
21480e3b57f594afa03f623f4724cd165519c9e0050a67486a1fdd640f50dbe5 | Python | 9,988 | 252 | import os, sys, copy, subprocess
from csv import DictReader, DictWriter
from Bio import SeqIO
from Bio.Seq import Seq
import parasail
import pysam
from multiprocessing import Process
import pdb
SCOREMAT = parasail.matrix_create("ACGT", 2, -5)
MIN_SCORE = 60
MIN_LEN = 50 # minimum length post deconcatenation
MIN_PRE_L... |
ba20b1929b685d867367d8d9266368832bdda69b4f69a854f097f4833556c148 | Python | 9,990 | 262 | import anndata
import numpy as np
import pandas as pd
import pytest
from pyaging.predict._pred_utils import _SCAN_BLOCK_COLUMNS, check_feature_ranges, check_features_in_adata
from tests.helpers import RecordingLogger
def _adata_for(clock_name, values):
matrix = np.asarray(values, dtype=float)
adata = anndata... |
5dd39025edb327c80e805814a49cb8f1c1706bb079c171554dee1d1b9a94c4cf | Python | 9,996 | 262 | # 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... |
f923f9aa02979f7ea996817a2b8aaefbdb15c08f284a95de921a2f4969ed66de | Python | 9,996 | 243 | # 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... |
9411c717f8ab089253ca017892340949868b98433c3cb3b9a4e6760fd573f1eb | Python | 10,000 | 284 | """
Helper functions to generate range-like data for DatetimeArray
(and possibly TimedeltaArray/PeriodArray)
"""
from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as np
from pandas._libs.lib import i8max
from pandas._libs.tslibs import (
BaseOffset,
Day,
OutOfBoundsDatetim... |
b014b1e7aa246a3eb34760f3ed42f240839496958988e81d2c706c4ddec30909 | Python | 10,004 | 269 | import operator
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.arrays import BooleanArray
from pandas.core.ops.mask_ops import (
kleene_and,
kleene_or,
kleene_xor,
)
from pandas.tests.extension.base import BaseOpsUtil
class TestLogicalOps(BaseOpsUtil):
... |
d8c826df26313e2d901647bdc82a818978e08802ae99a6e92b2bea87aa621c86 | Python | 10,005 | 270 | import copy
import functools
import dclab
from dclab.features.emodulus.viscosity import KNOWN_MEDIA
import numpy as np
from ..idiom import SLOPING_FEATURES
from .. import meta_tool
from ..util import hashobj
class Dataslot(object):
"""Handles datasets in a pipeline"""
_instance_counter = 0
_instances = ... |
38b7305012f73aed5955aef5a0206abe5c2dda0f43f618e7b9eb30062ee5bc2f | Python | 10,007 | 275 | # 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... |
b35d11eafeb8712b7a3ea80cf61d66b28f487944ee0e21a09b0e730d4e58d34d | Python | 10,010 | 236 | import sys
from tqdm import tqdm
import torch
import time
import pandas as pd
from utils import print_from_history
from evaluators.calculate_metrics import add_epoch_perf
import os
from copy import deepcopy
class NeuralTrainer(object):
METRICS = ['acc', 'bal_acc', 'auc', 'prec', 'rec', 'f1', 'loss'] # Performan... |
e407aac42e4fa9a04fca8e11e0c37c8c02568559aa71074a8fe54ae13e0f60a7 | Python | 10,011 | 257 | # 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... |
58d9cca77b313f04b054ff9d51d32fe30e06e03f61fe403a587348c0046e7955 | Python | 10,013 | 305 | #!/usr/bin/env python
# coding: utf-8
import pandas as pd
import numpy as np
import sklearn.decomposition
from scipy.ndimage import binary_dilation
import os
import argparse
from sklearn.neighbors import LocalOutlierFactor
from scipy.signal import savgol_filter
import custom_utils as utils
from pathlib import Path
h... |
30ad2f25ae9e95992155b2e56f370be52c14fdb67d908ee56eeefa33a2f7cb0a | Python | 10,016 | 187 | # MIT License
#
# Copyright 2026 Broad Institute
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, ... |
59d3759faf45f1da79c67b4024a3e3afd2c5c31c3464a7db0242284267ceb518 | Python | 10,019 | 353 | """
Module for scope operations
"""
from __future__ import annotations
from collections import ChainMap
import datetime
import inspect
from io import StringIO
import itertools
import pprint
import struct
import sys
from typing import (
Any,
TypeVar,
)
import numpy as np
from pandas._libs.tslibs import Times... |
64216c53725d1d51252a3f2e631497ec4d61d54c8cc1021c9176b48032d3ee83 | Python | 10,024 | 281 | # 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... |
f119b0c62087682e20f5dbdcf2ff498b1ecda8c70bfdce602bdf5ba45b9c6b56 | Python | 10,026 | 253 | """Seeded predictions pinned to the current local release artifacts.
The catalogue replacements are not required to exist on the live Hub while a
release candidate is being prepared, so this suite loads ``clocks/weights``
directly and runs the same feature-check and model-prediction boundary used by
the public predict... |
bf666c0da8ebf675f85b6becc3d6a77162b6402b61c75ca4407abe50f0ed2492 | Python | 10,030 | 296 | # 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... |
e3259e1aa30ae269489da39a2aabe52ed4add8b80afac4d80066e3c5edd30feb | Python | 10,030 | 317 | from __future__ import annotations
import decimal
import numbers
import sys
from typing import TYPE_CHECKING
import numpy as np
from pandas.core.dtypes.base import ExtensionDtype
from pandas.core.dtypes.common import (
is_dtype_equal,
is_float,
is_integer,
pandas_dtype,
)
import pandas as pd
from pa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.