sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
41fcecb95d34374e659af8c2d8ea249bf5b5a69dc9c328fb968618c540dbc584
Python
6,326
156
from rl_games.algos_torch import torch_ext import torch import numpy as np class AlgoObserver: def __init__(self): pass def before_init(self, base_name, config, experiment_name): pass def after_init(self, algo): pass def process_infos(self, infos, done_indices): pass...
8b93ecbeb0822694c613cc9b4078ff8df8ceebf8dc654e7caac9d8fe1311ef37
Python
6,329
168
from datetime import datetime import numpy as np from pandas.errors import Pandas4Warning import pandas as pd import pandas._testing as tm class TestCombineFirst: def test_combine_first_period_datetime(self): # GH#3367 didx = pd.date_range(start="1950-01-31", end="1950-07-31", freq="ME") ...
d9daa4488f53593b16080ec871b7b5f776f7309bd6380768313d5cc7feb0651d
Python
6,329
201
"""Tests for thriveline utilities in velocity.py.""" from __future__ import annotations import math import warnings import numpy as np import pytest import xarray as xr from scipy.stats import norm from pcntoolkit.math_functions.velocity import ( _resolve_reference_batch_effects, compute_thriveline_z, t...
7bf4ea779acc8895fca85562e872972607e3795ddcdcd5aa6978f33182acdbfc
Python
6,334
167
import numpy as np, matplotlib.pyplot as plt, sys import pumpprobe as pp, wormdatamodel as wormdm from scipy.optimize import curve_fit import matplotlib.ticker as ticker plt.rc('axes',labelsize=12) plt.rc('xtick',labelsize=14) plt.rc('ytick',labelsize=14) ds_list = "/projects/LEIFER/francesco/funatlas_list.txt" ds_ta...
d8b63cb01ea552eb21b4a38146dfd74c0b860ae05c8fccac78342b4b364733d9
Python
6,335
161
import datetime import glob import os import re import numpy as np from tqdm.auto import tqdm from .session import Session, SessionCollection _rx_dict = { "StartDate": re.compile(r"^Start Date: (?P<StartDate>.*)\r\n"), "EndDate": re.compile(r"^End Date: (?P<EndDate>.*)\r\n"), "StartTime": re.compile(r"^...
4693a0143356e2073e8c4016cf7f19207d6abbddf4dd95284e0ba88ecb7fc5b5
Python
6,337
231
import numpy as np import matplotlib.pyplot as plt # 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"] = False # change the linewidth of the axes and spines ...
af0e2433a247b8f4f5fceba856e19d823ce62c32daa7951c09400ab5a9a6b9cf
Python
6,338
189
# # hologram.py -- Michael Pun -- 28 January 2021 # # This module contains the functions used to project point clouds # characterized by arrays of spherical coordinates into spherical # coefficients. The functions also allow for a channel dimensions # to encode any information that is not spatial in the data. # # imp...
ae47b01e473331c38d4130cf347a1dc42f9ea78c8c18fef72c621347973523f5
Python
6,339
159
# 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...
f62afee30d4fb923bbfb5e26e56f1343ed06b94709a3afb1acd730fcac46b145
Python
6,339
182
""" Pretrained models in test/resources/pretrained_* were produced by an actual training run under PCNtoolkit 1.1.2 with a single response variable. They test pcntoolkit/util/migration.py which was introduced in v1.1.2. """ from pathlib import Path import pytest from pcntoolkit.normative_model import NormativeModel ...
9512d7ef50e4196622ba7b345f8b0d5c60a0313fbab88e496f5ef0420deefad9
Python
6,344
162
# 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...
c4a51b1e127d8d14bb691f4e78e3d1f36d77ecc3191a499676976e93de4361b8
Python
6,347
170
import logging import os import pickle from pathlib import Path import click import shutil import matplotlib.pyplot as plt import mlflow import numpy as np import pandas as pd from dotenv import find_dotenv, load_dotenv from sklearn.utils.class_weight import compute_sample_weight from sklearn.metrics import (accuracy...
17cfd9eae75fa404fb3ed80ffbdda6a2e1b279dfa5b60eaee7da67e659cf677a
Python
6,356
193
""" command-line app to update the necessary databases Authors: Benjamin Schubert """ import ftplib import datetime import os import errno import zlib from functools import partial from pathlib import Path import click from evcouplings.compare import SIFTS from evcouplings.utils import Progressbar UNIPROT_URL =...
afa3b388a3213e0e4c2136c5e95db96476f863b37eeb121b4d27fb925996d354
Python
6,356
171
"""Tests for the v4 self-supervised pretraining feature. The pretrainer was non-functional dead code in scsims 3.x; v4 rewrites it as a real LightningModule wrapping pytorch_tabnet's TabNetPretraining plus a `transfer_pretrained_weights` helper. These tests pin the behavior we promised in the v4 release notes. """ fr...
130a0ea8ac0d0516aac7d89c79e89152cb69c95e9b41b3a837fe18d5c256bb5f
Python
6,360
165
#%% # -*- coding: utf-8 -*- import numpy as np from pydrake.all import MathematicalProgram, Solve import matplotlib.pyplot as plt from matplotlib.patches import Polygon as matplotlib_polygon import matplotlib import math from pydrake.math import sin, cos, sqrt import pickle as pkl from scipy.interpo...
eb4396a1b8cb8581276d9e669024793587af1acc7ef277ea57c095cad6ec36fc
Python
6,366
200
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Shape-Out 2 documentation build configuration file, created by # sphinx-quickstart on Tue Sep 26 17:55:31 2017. # # 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 ...
53e0f291f2f474727f2d0ad737c3bd15abe1d891a09758e7deb66c208c709406
Python
6,368
231
from __future__ import annotations import numpy as np import pytest from pandas._libs import lib from pandas.compat import ( pa_version_under19p0, ) from pandas.core.dtypes.dtypes import ( ArrowDtype, CategoricalDtypeType, ) import pandas as pd import pandas._testing as tm from pandas.api.types import (...
16230e7d2067573ea5f3db2dc34d93a33dc3f9aeb2c55cd62de8676ea6dd5b26
Python
6,372
157
#!/usr/bin/env python3 """ Description: This module performs the SPIT-Test. The test randomly splits the control group in half, and identifies the most significant difference in isoform fractions between the two halves. The observations from this process can then be used to compare candidate DTU events in terms of...
d6b0549e0f177c6735ba56d43eb0bb2c9ea0b89151595b25e1ab1cf94da6ed1f
Python
6,372
192
""" Benchmarks in this file depend mostly on code in _libs/ We have to created masked arrays to test the masked engine though. The array is unpacked on the Cython level. If a PR does not edit anything in _libs, it is very unlikely that benchmarks in this file will be affected. """ import numpy as np from pandas._li...
6177ee4a781ff9e69b4c10b8a1de1e07bc3cbc13ab93637eb18d6b74dfbb99b9
Python
6,374
166
from keras.models import Sequential, Model from keras.layers import LSTM, Dense, Dropout, TimeDistributed, Conv2D, MaxPooling2D, Flatten, concatenate from keras.optimizers import Adam from sklearn.model_selection import StratifiedKFold import numpy as np from keras import backend as K from keras.utils import Sequence i...
9ca8041e592d6487d39620a00d44368f03b3186f9e72fedc1c6fda964188f5f0
Python
6,376
157
# emacs: -*- mode: python-mode; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*- # ex: set sts=4 ts=4 sw=4 et: """ .. _metas_subtraction: ================================= Subtraction and conjunction CBMAs ================================= The (coordinate-based) ALE subtraction method tests at which voxe...
9fc9eff6f5671f1e653eba2b2c93d502f63e197b31ba69f522aea8aeb75fa410
Python
6,376
135
# 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...
64b164c721223674e55fcc897e7d562265b9bb72c7b48a99c38c3f15c94493a0
Python
6,380
201
# 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...
6f8060e27b1d0c37a5234de159da7ad9e6d649520e8298817294b22aa66a04fa
Python
6,380
193
import numpy as np import pytest from pandas.core.dtypes.cast import can_hold_element import pandas as pd def test_can_hold_element_range(any_int_numpy_dtype): # GH#44261 dtype = np.dtype(any_int_numpy_dtype) arr = np.array([], dtype=dtype) rng = range(2, 127) assert can_hold_element(arr, rng) ...
126512d6b666d7f7195d092d0c846e7e990ea91ccf2d623e6e2b144c9c7f5ad9
Python
6,381
189
#!/usr/bin/env python3 import fire, json, os import tensorflow as tf import encoder, surprisal, model BATCH_SIZE = 1 DELIMITER = '!ARTICLE' def get_delimited_texts(lineitems_fn): '''Returns the texts in the delim.linetimes file. Each text is preceded by a line with a special delimiter token. Output is a ...
cccb6eb6372b465641bfb23565ce483da8349d538c2c4ad589dc1b8a35534645
Python
6,381
177
"""In-process deployment registry. A thin LRU-style cache that loads a fitted pipeline from disk on first prediction and keeps it in memory until the deployment is deleted or the process recycles. No out-of-process worker, no remote protocol — the whole point of 4.0's serving story is "the same FastAPI process answers...
0367012be384be50ea183864626d15a746eb82ed65f0ed5f2856173a66480cec
Python
6,386
204
from datetime import ( UTC, datetime, ) import numpy as np import pytest from pandas._libs.tslibs import ( OutOfBoundsDatetime, OutOfBoundsTimedelta, astype_overflowsafe, conversion, iNaT, timezones, tz_convert_from_utc, tzconversion, ) import pandas as pd import pandas._testi...
075eb1662aab302e02136646b857887f01aca93dfcbd15a79d5fccf467495862
Python
6,386
162
# 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...
217ff010763d3e184ec35b80388eba7b27c235dcb49121e08aebdfe7f22ef90f
Python
6,386
188
# # -*- coding: utf-8 -*- # # gvar documentation build configuration file, created by # sphinx-quickstart on Sat Dec 26 13:11:17 2009. # # 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 ...
b0adba8683636710cc031b9938f68800c405cb8aee1950e8328fa3030fc8bc13
Python
6,386
145
import torch from torch.nn import Sequential, Linear, ELU, Tanh, Module from pathlib import Path from typing import Iterable, Tuple import numpy as np class APEmulator(Module): nr_conds : int #No. max. conductances max_conds_names : Iterable[str] max_conds_ranges : Tuple[np.ndarray, np.ndarray] vm_ampl...
8732772e10b42b2f160d7670670d075bc6c5ac77277dc6c82fe34d6ab111f439
Python
6,387
194
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 = ...
8e1878a9982c4b6436c077e9ee8fe1d0af77bc72b4f9b12d892dd676bf3f1d1c
Python
6,387
170
import dclab class FilterRay(object): def __init__(self, slot): """Manages filter-based dataset hierarchies Filter rays are used to cache RTDCBase filter-hierarchy children. """ #: identifier of the ray (matches the slot) self.identifier = slot.identifier #...
bc00abc17adf68ca0e50ec951fbaee4516c99ccf8027c3bcf50a9ec40bc627f6
Python
6,387
170
import numpy as np import matplotlib.pyplot as plt, matplotlib.gridspec as gridspec import matplotlib.ticker c_in_wt = "C0" c_not_in_wt = "C1" c_wt = "C2" c_unc31 = "C9" def make_alphacolorbar(cax,vmin,vmax,tickstep, alphamin,alphamax,nalphaticks, cmap="viridis",bg_gray=0...
d2eeb129a44ea5066293933595dafc31bdff9f23606c4bd7f1477b86e9038c78
Python
6,387
188
''' Create and display commands needed to populate DynamoDB ''' import argparse from glob import glob import json import os from os.path import exists import re import sys import colorlog import requests from simple_term_menu import TerminalMenu from tqdm import tqdm # pylint: disable=no-member # Configuration CONFIG...
d5899c9fe96a571db24ddb03dba5b1641d28e968a15b55cbff80ff8bf1ffb223
Python
6,389
157
#!/usr/bin/env python3 """ The purpose of this script is to update the the 'scpca-meta.json' checkpoint files of already processed libraries to be up to date with changes in `scpca-nf`. This includes addition of the following missing fields in the mapping checkpoints: - 'ref_mito' - 'ref_fasta_index' - 'assay_ontolog...
cdb01f7138a755b96a9330227d968b58ca35ca745554f369b55391a562ee4a6b
Python
6,390
169
# Module: containers.metrics.anomaly # Author: Antoni Baum (Yard1) <antoni.baum@protonmail.com> # License: MIT # The purpose of this module is to serve as a central repository of anomaly metrics. The `anomaly` module will # call `get_all_metrics_containers()`, which will return instances of all classes in this module ...
32c9f101c62ec3c49dbb96cca0f6123e3cb98067cb05a62df36f617cea2c5a55
Python
6,391
145
import os import pickle import numpy as np from sklearn.model_selection import KFold from datetime import datetime import Load as Load import Models import Processing import Statistics startTime = datetime.now() # Define Parameters tmin, tmax = -0.3, 0.3 sr = 128 n_folds = 5 delays = - np.arange(n...
af88143bebaacf5e7ba487c48f4cfcab44a33340a34296bdaff5a0f01ad32933
Python
6,392
171
#!/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...
1e8ebc8c28f60cc58d912718e6fead3d6fd284517525c7b872bb1eaa8f12cb80
Python
6,394
192
#!/usr/bin/env python # -*- coding: UTF-8 -*- # Created by Roberto Preste from concurrent.futures import ThreadPoolExecutor import apybiomart as apy from mtoolnote.classes import Field, Variant, Parser, Annotator from mtoolnote.constants import NONHUMAN_HEADERS, SPECIES # TODO: these two can be deleted, only keepin...
68d096fe6985bec0d103c55f04477ebd0e4d69e284ff047218c5ad228a50efc4
Python
6,395
168
""" .. _metas_subtraction: ============================ Two-sample ALE meta-analysis ============================ Meta-analytic projects often involve a number of common steps comparing two or more samples. In this example, we replicate the ALE-based analyses from :footcite:t:`enge2021meta`. A common project workf...
5ae73fc460191934fa3e3e975592d8bd4a40315876c6230d8ce3acd13f55c893
Python
6,400
228
import json import tempfile from pathlib import Path import numpy as np from kilosort import io def test_probe_io(): # Create one-column probe with 5 contacts, spaced 1um apart. json_probe = { 'chanMap': np.arange(5), 'xc': np.ones(5), 'yc': np.arange(5), 'kcoords': np.zeros(...
99919cdef3cc02c96e082fe72aac14df8df1c0028174ebca397f9a02d97f75a7
Python
6,406
234
import numpy as np import pytest import pandas as pd import pandas._testing as tm def test_data_frame_value_counts_unsorted(): df = pd.DataFrame( {"num_legs": [2, 4, 4, 6], "num_wings": [2, 0, 0, 0]}, index=["falcon", "dog", "cat", "ant"], ) result = df.value_counts(sort=False) expec...
e36acff5fb9bfa3003d811de426aa7ad33f390282d8a8c3ab96c6dfe8a0edcd9
Python
6,407
145
# # Pythonla module to implement equivariant neural network # based on Clebsch-Gordan networks. This module uses linearity.py # and nonlinearity.py to implement the linear and nonlinear operations # of CG networks. Then it implements a dense layer at the end to # classify the scalar output of every layer in the CG net...
18937abda81b10ac27f60ca4ace22ba508570cc7d796e3d984baacffe1d1278b
Python
6,408
191
import os from sklearn.model_selection import KFold import os import numpy as np from PIL import Image from torch.utils import data from utils import image_helpers class_colors = { "BG": [255, 255, 255], "REF": [66, 146, 197], "INS": [251, 246, 180], "DEL": [253, 229, 217], "INV": [127, 106, 187],...
65637ff5ad5677d20ffc749d650505421c7b648ee9ed405e6028d9eda882885f
Python
6,410
179
import torch import wandb import numpy as np from tqdm import tqdm from matplotlib import pyplot as plt from typing import Optional from opacus.utils.batch_memory_manager import BatchMemoryManager from twoandahalfdimensions.utils.config import DataViewAxis, Config def train_step(data, label, model, opt, loss_fn, set...
f41115cfe2459296bb037355dde0720aa4eedfbb6a430d47c8947cf5e461788d
Python
6,411
199
#!/usr/bin/env python3 # JN 2015-05-05 # put out clustering data in old spikes/times format for response plots """ convert groups to old style spikes/times files for response plotting """ from __future__ import division, print_function, absolute_import import os import csv # pylint: disable=E1101 import numpy as np ...
bfbd7c30ba919a1e2878840bf457c76e7b62ce67198d2b79db6d37bb0aef3749
Python
6,413
204
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # EVcouplings documentation build configuration file, created by # sphinx-quickstart on Thu Aug 17 09:30:42 2017. # # 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 ...
de6a9d60560013d26463a10e8a2de0024d96e81bcbd86440e6b60950a7eb56a6
Python
6,413
176
import tensorflow as tf import subprocess import sys import numpy as np from halo import Halo from const import SIZE from dataset import load_all_datasets def model(img, mask, dims): init = tf.contrib.layers.xavier_initializer() training = tf.placeholder_with_default(True, shape=[], name="training") i...
cc79aa06399122d168a33c30d8035c62581c8b520f434453e98a1b947e827002
Python
6,414
153
# -*- coding: utf-8 -*- """ Unit tests for the kCSD methods This was written by : Chaitanya Chintaluri, Laboratory of Neuroinformatics, Nencki Institute of Exprimental Biology, Warsaw. :license: Modified BSD, see LICENSE.txt for details. """ import unittest import numpy as np from kcsd import ValidateKCSD1D, ValidateK...
146138bc1cbe2eb0002a39671ca7c1c7c0b41a81fd6ca4788cfa0c1d90de0a5b
Python
6,416
133
from Environment import * from Parameter import * def volume_ratio(region_path, label_path, region_name, min_volume=Stats['min_volume'], max_volume=Stats['max_volume']): '''volume ratio (computed as (total plaque volume in the region)/(region volume))''' region = tifffile.imread(os.path.join(region_path, 'Reg...
16676b648efae67949d2371d3c13f896020b3988b7554b755d4366d1fc69e908
Python
6,419
200
from abc import ABC from torch import Tensor, nn, stack, concatenate from twoandahalfdimensions.utils.config import DataViewAxis class Lambda(nn.Module): def __init__(self, lambda_expr) -> None: super().__init__() self.lambda_expr = lambda_expr def forward(self, x): return self.lamb...
6d177c429512092fdc241da0e59e74876075ce9395dccbd4e6a40221542d7855
Python
6,420
293
""" Validate that the titles in the rst files follow the proper capitalization convention. Print the titles that do not follow the convention. Usage:: As pre-commit hook (recommended): pre-commit run title-capitalization --all-files From the command-line: python scripts/validate_rst_title_capitalization.py ...
3adff1a9a7ca3563dcfe9682b268f69e5907af9a9387e7eccbb83f934083a60e
Python
6,421
130
#!/usr/bin/python from __future__ import print_function import os import sys import numpy as np import argparse from stl import mesh from string import Template from scipy.optimize import newton def grading_function(k, n, L, ds): return L/ds - (np.power(k, n)-1)/(k-1) def dgrading_function_dk(k, n, *args, **kwa...
ab6974e6fddae0c5c2f6fcf8a70899e2f5ca0531014a624e429c542cc6029f19
Python
6,423
187
import numpy as np import pytest import pandas as pd import pandas._testing as tm class TestTranspose: def test_transpose_td64_intervals(self): # GH#44917 tdi = pd.timedelta_range("0 Days", "3 Days") ii = pd.IntervalIndex.from_breaks(tdi) ii = ii.insert(-1, np.nan) df = pd...
4b2676db7909bd1ebbe5ca488b7ca3320ded57f68d178f1d1e4b7d61c74b1fdd
Python
6,424
162
"""MD-CNN radial cardiac cine dataset.""" import concurrent.futures import io import re import urllib.request from collections.abc import Sequence from os import PathLike from pathlib import Path import numpy as np import platformdirs import scipy.io import torch from einops import rearrange from torch.utils.data imp...
921b7e1f507a131e6d5221d38975b0bc8f6d673527914335f4c256934891c9de
Python
6,426
171
"""Test metrics module.""" import numpy as np import pandas as pd from omegaconf import OmegaConf from lightning_pose.metrics import ( compute_metrics_single, pca_multiview_reprojection_error, pca_singleview_reprojection_error, pixel_error, temporal_norm, ) from lightning_pose.utils.pca import Key...
eda2fa1f16497639b94028086989b8f7e9d55e71a6a2c1c21274d672dbf71136
Python
6,427
164
# 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...
49aea107560e106c242bd72fabe90611333c20b50d21b080aa12e6dcf76da9c4
Python
6,431
151
# 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...
3ad1df06340ef757a1790d66e796ca57abcfbbbc540672fda5ec65ce4e05e2b2
Python
6,433
176
# 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...
6a463b3c65de82f8c8b5964e93791311d8c79b11d1cf1d5be25c394550ff4c9e
Python
6,434
149
"""PAOPAC parity against the original compiled Windows prediction interface.""" import gzip import hashlib import importlib.util import json from pathlib import Path import anndata import numpy as np import pandas as pd import pytest import torch from pyaging.models._paopac import PAOPAC FIXTURES = Path(__file__).r...
cc4255fffe4776daf8438a0466fb935e91dca1e869d857020a0cc5e61000a405
Python
6,434
164
from game_functions import Game import matplotlib import numpy as np import matplotlib.pyplot as plt from matplotlib import cm, use from matplotlib import rc from pylab import rcParams import sys from helper_compute_performance import compute_performance from helper_history import history from scipy.optimize import cur...
c1d33d756d36e77d247af87d7a7eb327b1d1fbb553e60c575b5c29529bd5c0cf
Python
6,435
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 torch from torch_scatter import scatter from ocpmodels.modules.scaling import ScaleFactor from ..initializers import he_orthogonal_i...
0ff5b724b180f22203b8436c3acb5ef3ae2c6063cc25dc2463fe23521c61bad1
Python
6,437
178
from datetime import timedelta import numpy as np import pytest import pandas as pd import pandas._testing as tm from pandas.core.arrays import TimedeltaArray class TestTimedeltaIndex: def test_astype_object(self): idx = pd.timedelta_range(start="1 days", periods=4, freq="D", name="idx") expecte...
ce9429c6251d883ec264286e89524b3cb3eb75684495364f6bdbffd69bf93061
Python
6,437
216
""" Tests for the following offsets: - BYearBegin - BYearEnd """ from __future__ import annotations from datetime import datetime import pytest from pandas.tests.tseries.offsets.common import ( assert_is_on_offset, assert_offset_equal, ) from pandas.tseries.offsets import ( BYearBegin, BYearEnd, ) ...
4971c010f732e16198995735776213ec30f1e230c5b608d9519e66ca31073343
Python
6,438
207
__all__ = [ "PeptideRTData", "PeptideRTDataBatch", "PeptideRTDataConverter", "PeptideRTDataset", ] import os from logging import Logger from typing import ( Any, Generic, List, Mapping, NamedTuple, Optional, Protocol, TypeVar, Union, overload, ) import numpy as ...
a015d325345a52f36551aa681ab602c51687df30ba05f9340fab5bd592b84a23
Python
6,444
141
from rl_games.algos_torch import torch_ext import torch import torch.nn as nn import numpy as np from typing import Dict, Optional, Tuple def _running_stats_dtype(): # MPS doesn't support float64. On a CUDA-less Mac the only accelerator # is MPS, so default the running-stat buffers to float32 there. JIT #...
b137c24f135fb335c8ce4d0575f6bd3e67d5320320cb5780f2ab4674d09cab95
Python
6,445
180
import medmnist import torchio as tio from numpy import float32 from typing import Any from torch.utils.data import DataLoader from monai.data.dataloader import DataLoader as MDTL from monai import transforms as mtf from twoandahalfdimensions.utils.config import Config, LoaderType, TransformLibrary from twoandahalfdim...
ff99a2ed71b7fe1c784feea36677a9b5949691160fdcb90257762358aa64593c
Python
6,445
189
""" A verbatim copy (vendored) of the spec tests. Taken from https://github.com/data-apis/dataframe-api """ import ctypes import math import pytest from pandas.errors import Pandas4Warning import pandas as pd import pandas._testing as tm @pytest.fixture def df_from_dict(): def maker(dct, is_categorical=False)...
e73903ebea079bcd5af7985a61ece02d087059ede92cd9360a19a7646c0c4a3c
Python
6,446
167
# 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...
0fc268b4ea80b8ae92ce708b2a9f3685a7db3e5423b2a52235a3814872b61f40
Python
6,448
206
import random import time from typing import Any, Mapping import torch from deepglyco.chem.common.elements import ElementCollection from deepglyco.chem.gpep.glycans import MonosaccharideCollection from deepglyco.chem.pep.aminoacids import AminoAcidCollection from deepglyco.chem.pep.mods import ModificationCollection,...
ac81b59d4ab706df9779524638915149d4d87776a0d9ab15f3fb4d8aff3d3175
Python
6,450
192
# # This file computes the atomic spherical coordinates in a given set of # neighborhoods and outputs a file with these coordinates. # # It takes as arguments: # - The name of the ouput file # - Name of central residue dataset # - Number of threads # - The neighborhood radius # - "easy" flag to include central res...
0aee5fc6d7d780c3626fb15eea7c6d22e8f09d8ec93829b686fca4414f4de6d1
Python
6,451
95
#! /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...
f2b4c1adb26ec8edc087cdc0c415aa3fd84a74eaa4415edbacdcd81c820a1f9c
Python
6,456
206
import re import numpy as np import pytest import pandas as pd import pandas._testing as tm class TestDatetimeIndex: def test_get_loc_naive_dti_aware_str_deprecated(self): # GH#46903 ts = pd.Timestamp("20130101")._value dti = pd.DatetimeIndex([ts + 50 + i for i in range(100)]) se...
3ae3f3544fa65fc69cd56b64920062efe88e50b283bba45674f02f8610d76f7d
Python
6,459
192
import numpy as np import pytest import pandas as pd import pandas._testing as tm def test_get_values_for_csv(): index = pd.PeriodIndex(["2017-01-01", "2017-01-02", "2017-01-03"], freq="D") # First, with no arguments. expected = np.array(["2017-01-01", "2017-01-02", "2017-01-03"], dtype=object) res...
06a19d37d6f7e33fdd642735ed7a14b9a6faf3090a675de59775e867a7ac85d2
Python
6,461
208
import numpy as np import pytest import pandas as pd import pandas._testing as tm @pytest.fixture def df(): """ base dataframe for testing """ return pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]}) def test_case_when_caselist_is_not_a_list(df): """ Raise ValueError if caselist is not a list....
f2209b0c453ef8fa78836f39282189081fef780345509b42ce33d2a0e6a00daf
Python
6,461
168
import numpy as np import task_train_test as tk import nn_analyses as nna ###### Fixed-point finding ################# def run_FPF_search(p, F, earliest_only = False): # 1. Set Parms # add_rand_seeds = True #True # (optional) get random trials for seeds rand_numbatch = 5 # " " no. o...
60723efb92a7abdadfb70ffe30bbbd3193d4177e5fee9ba68418d869cf553e02
Python
6,463
189
from __future__ import absolute_import from .tuplecloudsqlitedict import SqliteDict import os, time from ..utils import DelayedKeyboardInterrupt from threading import ThreadError import warnings ################################################### # additional locking ##################################################...
941ccd7a05d957837b8d2de12b904472d8a39bb4cc7b4dd57b57bba33a44d98d
Python
6,463
167
import os import numpy as np import pandas as pd from deepglyco.specio.mzml import MzmlReader from deepglyco.speclib.gpep.hdf import GlycoPeptideSpectralLibraryHdf from deepglyco.util.log import get_logger from deepglyco.util.progress import TqdmProgressFactory def stat_speclib(speclib_file, logger, progres_factory...
9a328a826600322176a4daa9f0b581fa494d48972a6f59abdd3a9e006d1e4c4d
Python
6,465
170
""" Implementation of DataFrame.select. """ from __future__ import annotations from typing import ( TYPE_CHECKING, Any, ) import numpy as np from pandas.core.dtypes.common import is_list_like from pandas.core.dtypes.generic import ( ABCDataFrame, ABCSeries, ) from pandas.core import common as com f...
4fa630c6af19fdf1e6598f08d56cac5bde791c4ca099225f26df0d9309d7b921
Python
6,470
192
# 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...
7f16a4341e2fde969fc17a4bb069538b9a192071c1b5620d93cab77d5ac61c1d
Python
6,474
181
import torch.nn as nn import torch def derive(input_tensor, deriv_axis, ds=1, terrain=None, no_nans=True): ''' Computing the derivative of a scalar field in the specified axis direction. Parameters ---------- input_tensor : torch.Tensor Input tensor [samples, Z, Y, X] deriv_axis : int...
626d5d881529d4d5384d2cd8154e1f00233bceaf656736b513d335403e4fb91f
Python
6,475
171
# 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...
ee5e1189cf6005f162163492e7dcab7829e8bb6c5b5a67c2f1759b31a84c123a
Python
6,475
178
__all__ = ["PeptideData", "PeptideDataConverter", "PeptideDataBatch"] from typing import List, NamedTuple, Optional, Union import torch import torch.nn.functional as F from torch.nn.utils.rnn import pad_sequence from ....chem.pep.mods import ModifiedSequence, ModifiedSequenceParser from ....util.config import Config...
9df176026c64f8790e5e8a648a1f76614932b3cacb650ab71609d114e226d575
Python
6,476
159
""" .. _metas_estimators: =================== The Estimator class =================== An introduction to the Estimator class. The Estimator class is the base for all meta-analyses in NiMARE. A general rule of thumb for Estimators is that they ingest Datasets and output MetaResult objects. """ ######################...
2852bca7adb14b7bfc72abdba0259e45274f0518622248093f809f4559f684aa
Python
6,477
175
import re import argparse import numpy import random import math import statistics import multiprocessing as mp import gzip import os from collections import Counter def get_args(): parser = argparse.ArgumentParser(description="Find copy number of a feature in WGS data with pre-counted kmer multiplicitie...
2da51dcb6b38b6baa554f91bb863d6f9028e517daca04c5f65479251909b3a5c
Python
6,478
168
#%% from compute_sup_jux_segment import compute_segment from driver import compute from values import * from defs import * import os import argparse import multiprocessing import output import re import pdb import matplotlib.pyplot as plt #%% solute = ['Na','K','Cl','HCO3','H2CO3','CO2','HPO4','H2PO4','urea','NH3','...
174ad7ab96b1e477608722ea72101e792a853edf443281799441d46ff069936f
Python
6,479
182
# Calculate structure searching performance # Unpack training_coords first with `tar -xvf training_coords.tgz` import progres as pg import torch from torch.utils.data import Dataset from torch_geometric.loader import DataLoader import numpy as np from collections import defaultdict dataset_dir = "dataset" coord_dir =...
896c609e85a01352ee4d9231501cc397dd305d45363dcc43bfc9f75461d87e06
Python
6,480
176
"""Prediction boundaries retain sample/feature identity and bounded batches.""" from unittest.mock import Mock import anndata import numpy as np import pandas as pd import pytest import torch from scipy import sparse import pyaging as pya from pyaging.predict._pred_utils import check_features_in_adata, predict_ages_...
df46ae89d24e883e1320c4d5b3b3a597753fefe3b03ee999bde6124feaf09c4c
Python
6,480
154
# -*- coding: utf-8 -*- """ classifiers """ from app.inout.inout import write_hist, write_map from app.utils import end_execution from pandas import read_csv import numpy as np import os import logging logger = logging.getLogger(__name__) def call_model(data, p_model, p_scaling): from sklearn.preprocessing impor...
66ce2a91b9a508649e510b4613a215383d3cb94888bd807667d0a530c876798b
Python
6,482
139
# 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...
6f5d0e390c239f5833674af54ac6dc916dad388d862582ac11bb78e004f54266
Python
6,484
114
import sys sys.path.append('prepare_data') import random from create_cell_feat import * from create_drug_feat import * from create_drp_dict import * from binarization_drp import * from torch_geometric.data import Batch from torch.utils.data import Dataset, DataLoader GE_data = load_raw_GE() drug_response_dict, drug_nam...
75b8916226898ff2e3b5de0e98c7738bc56729df47c18c3101c5f19982cf607a
Python
6,484
175
""" Tests shared for DatetimeIndex/TimedeltaIndex/PeriodIndex """ from datetime import ( datetime, timedelta, ) import numpy as np import pytest import pandas as pd import pandas._testing as tm class EqualsTests: def test_not_equals_numeric(self, index): assert not index.equals(pd.Index(index.a...
2c6079483658314249eaebfd02cc174f5bdd620107778a76d548d6182760fad8
Python
6,487
157
#!/usr/bin/env python3 """ The purpose of this script is to update the the 'scpca-meta.json' checkpoint files for cell typing of already processed libraries to contain reference file names with the following format: <ref_name>_<source>_<version><ext>. Specifically, we want to check that the version is present in the ...
1781839a6b5e5ddc8e17dd1321088b68ba1e780205a5b3ded96463a01e2fac87
Python
6,490
227
# coding: utf-8 # JN 2014-12-18 """ This script plots extracted spikes so one can decide if clustering is worth it or not """ from __future__ import division, print_function, absolute_import import logging logger = logging.getLogger(__name__) import os import numpy as np import tables import matplotlib.pyplot as mp...
ce3d0356ca32d175bbe3fe00babf24e905d78842167690ebec16e4adbf223830
Python
6,499
164
import json import numpy as np import scipy.io as scio import scipy.sparse from scipy import sparse # 该函数用于打标矩阵 # 先构造矩阵,行×列,其中行就是app应用程序的个数,列就是统计出的实体的个数 # 构造的矩阵应该是全0矩阵。 # 一个app一个app进行打标,读取一个app的实体信息后,若这个实体信息在总的矩阵里,就把第几个位置打标为1, # 先把权限的做出来 # 提取信息,然后打标 def read_info(apkname,data2): allindex = [] value...
a4a70415cbf7fe4a5cf3c367b0d5cb56b428c4d3736523e2d1b2c86e00657358
Python
6,500
184
""" Models for inducing predicate vectors and cued association transition model Some code is adapted from the DGL implementation of RGCN link prediction: https://github.com/dmlc/dgl/tree/master/examples/pytorch/rgcn """ import torch, dgl import torch.nn as nn import torch.nn.functional as F import dgl.function as fn ...
843ab0b5c559d47ab637bc083bd1545a0f084bc74e7040a07c24d7b8d64255fa
Python
6,502
129
import argparse from base import loggingUtils from base.surfaces import * from base.kernelFunctions import * from base.surfaceMultiPhase import * def compute(args=None, noArgs=True): if noArgs: outputDir = '/Users/younes/Development/Results/multiShapes' #outputDir = '/cis/home/younes/MorphingData/t...
ecad2a23a72cad25e671b47e8ac09e3ace518911c8012003f6333d29c2786229
Python
6,502
202
import requests from PIL import Image from neuronbridge.model import * import logging class Client: def __init__(self, data_bucket="janelia-neuronbridge-data-prod", version="current"): """ Client constructor. When the client is created, it retrieves the configuration for the speci...
2ff5065f5cac3dc93065f8a3f36eb013e407972a80abcd4ee6b89a7138a0d5a6
Python
6,503
174
import numpy as np import tensorflow as tf from tensorflow.contrib.training import HParams def default_hparams(): return HParams( n_vocab=0, n_ctx=1024, n_embd=768, n_head=12, n_layer=12, ) def shape_list(x): """Deal with dynamic shape in tensorflow cleanly.""" ...
9f9f10bb08215f8d81b6119fe2aa1c079ee9a7e7b5391e48972c76fb834601ab
Python
6,505
167
# 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...
d2dc6733d51893277db6f7e25efccf37084742f5eccba0e63bb6c835fd1f027a
Python
6,505
209
## Works the best so far! Curve fits nicely and ymin/ymax don't have to be 0 and 1! import matplotlib.pyplot as plt import numpy as np import pandas as pd from scipy.optimize import curve_fit import sys import matplotlib.ticker as ticker import matplotlib.transforms as transforms from pathlib import Path from statisti...