sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
230d976f1931333d4259b2fe9839681336fabfcb921d2d12e9704e30cb36613b
Python
12,694
383
"""Test estimator, kerneltransformer, and multiple comparisons corrector performance.""" import os from contextlib import ExitStack as does_not_raise import numpy as np import pytest from ..correct import FDRCorrector, FWECorrector from ..generate import create_coordinate_dataset from ..meta import ale, kernel, mkda ...
91e00e18a381aea97c0990b1252105d855a843c44fce349a123e0d05cf80bb87
Python
12,696
325
#! /usr/bin/env python3 # Usage: # techtree.py <depfile> # # Where input <depfile> is created in Easel directory by clang preprocessing: # for cfile in esl_*.c easel.c; do clang -MM -c -I. -DeslENABLE_AVX -DeslENABLE_AVX512 -DeslENABLE_VMX -DeslENABLE_NEON -DeslENABLE_SSE -DHAVE_MPI ${cfile} >> easel.dep; done ...
c148b6dc118df9c34460bb74a6f90c8da8b6e27b1a6394bc20fa585d73c4295b
Python
12,699
412
"""Performs power analysis on pre-processed data. METHODS ------- morlet_analysis - Takes a coh_signal.Signal object of pre-processed data and performs Morlet wavelet power analysis. fooof_analysis - Takes a coh_signal.PowerMorlet object of power data and performs FOOOF power analysis. """ import os impo...
a86bcccd3f041ac81a1d6f349d537ee1049c6afa4d799b9293b410da4409f038
Python
12,707
392
from collections.abc import Callable import copy from datetime import datetime import operator import re import numpy as np import pytest from pandas._libs.properties import cache_readonly import pandas as pd import pandas._testing as tm from pandas.api.typing import Expression from pandas.tests.test_register_access...
383b695d9745632e354dd03f99a3c11700098535cd7928116fd1cb68da5eb87c
Python
12,709
282
"""Tests for the hot-loop performance batch: replay/experience buffer pinning removal, disabled GradScaler under bf16 autocast, SAC submodule compilation, and batched score-observer updates.""" import numpy as np import pytest import torch from types import SimpleNamespace from rl_games.algos_torch import torch_ext f...
63f6ee8305a09ae26b46ac2433b8753a946bb9e21074f276df7da1eb6601e078
Python
12,712
263
""" Call variant based on a list of SAMMPileUpRecord where list[i] is the record of i-th position Most of the code follows Juliet's code at https://github.com/PacificBiosciences/minorseq/blob/develop/src/AminoAcidCaller.cpp """ import os, sys import scipy.stats as stats from collections import Counter, namedtuple B...
be39345db535f38acd711d596223b5af14478fc24aec316942b2a77783cf3258
Python
12,724
355
"""Color routines.""" # ------------------------------------------------------------------------------ # Imports # ------------------------------------------------------------------------------ import logging import colorcet as cc import numpy as np from matplotlib.colors import hsv_to_rgb, rgb_to_hsv from numpy.ran...
f17cc95126740216a2d978aa2c3f41aca3f548a5603cd4a2f592b222dcf78a86
Python
12,726
444
""" Additional tests for NumpyExtensionArray that aren't covered by the interface tests. """ import numpy as np import pytest from pandas.errors import Pandas4Warning from pandas.core.dtypes.dtypes import NumpyEADtype import pandas as pd import pandas._testing as tm from pandas.arrays import NumpyExtensionArray @...
2ca1097dda4103ea646f571f0fa222a50e6762955a2f0c59a1619d224c8df811
Python
12,731
383
"""Test estimator, kerneltransformer, and multiple comparisons corrector performance.""" import os from contextlib import ExitStack as does_not_raise import numpy as np import pytest from nimare.correct import FDRCorrector, FWECorrector from nimare.generate import create_coordinate_dataset from nimare.meta import ale...
8f47867f0a611ad277bd494cb46f7aea824f02b986e4716bc96d0088e22cc412
Python
12,738
324
# 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...
c4bebe124f70bf7d10409c8493bbad6bc6050d64b1b1b638a410ac4dde41fb83
Python
12,747
393
from collections.abc import Callable import copy from datetime import datetime import operator import re from typing import Any import numpy as np import pytest from pandas._libs.properties import cache_readonly import pandas as pd import pandas._testing as tm from pandas.api.typing import Expression from pandas.tes...
bd5d3de2ad008fa4451d09df577c50abbf5695770ddfda9722f6068c6d5386d4
Python
12,750
363
""" Tests for 2D compatibility. """ import numpy as np import pytest from pandas._libs.missing import is_matching_na from pandas.core.dtypes.common import ( is_bool_dtype, is_integer_dtype, ) import pandas as pd import pandas._testing as tm from pandas.core.arrays.integer import NUMPY_INT_TO_DTYPE class D...
4cbbc9f9e93417aa911c4cfdda257ebfc52e6f3f7c4d67c495f90dc7bb4e29c5
Python
12,765
376
''' load_codex_to_mongo.py This program update emBody and emDataSet in MongoDB from the classification.csv data from Codex (https://codex.flywire.ai/api/download) ''' __version__ = '0.0.1' import argparse import csv from datetime import datetime from operator import attrgetter import socket import sys import t...
51c303a0a4a7e72b22667ed0043d1454155e440d9a0b87cc98743190a5e57569
Python
12,770
380
import math import warnings import numpy as np import SimpleITK as sitk import torch from scipy import interpolate TABULAR_NAMES = [ "AVA", "Age", "Aortic_regurgitation", "BMI", "Creatinine", "Glomerular_filtration_rate", "Hemoglobin", "LVEF", "Mean_transaortic_pressure_gradient",...
bd702b59d679808bc5c8c0a3ce4f5f4fc67c70a420fcf6fcbb0587a19c1312b3
Python
12,770
183
from pathlib import Path from botocore.client import Config import ibm_boto3 import os import pandas as pd import sys 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__), "..", ".."))) from load_db.AIBL import extract_sympt...
36d7acba718e947edaa1befbd906395368c0feb83ac263f603005175b6321cd6
Python
12,772
402
# -*- encoding: utf-8 -*- # last change: 2015-07-27, dynamic ylim in plots # JN 2015-04-15 """ reads out all clusters from sessions and puts them into one file for final grouping """ from __future__ import print_function, division, absolute_import import os import logging import numpy as np # pylint: disable=E1101 im...
c15be04f5830b25e84be70110e957fee1a0a5e442b27d2057fee36cab4356d6c
Python
12,773
339
# 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...
84536ba89e41b37f0acbb827cde6dbf8c04734fe7d7bed342ceb9085aab309a9
Python
12,779
288
from spycon.spycon_inference import SpikeConnectivityInference # Import classes from idtxl.estimators_jidt import JidtDiscreteTE from itertools import repeat import multiprocessing import numpy from scipy.stats import norm from tqdm import tqdm class TE_IDTXL(SpikeConnectivityInference): """ Transfer entrop...
6991cf882d504e7dbb2bd7e5251c070421441ec34a689bf83934fbb5da3f9cf8
Python
12,792
258
from botocore.client import Config import ibm_boto3 import os import pandas as pd import numpy as np import sys import json import logging 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__), "..", ".."))) from config.global...
58c7edb2daccbb813c20ef95e5e9c10c4d7e9fe2d79d2dc8ca1ea04833010ba7
Python
12,793
377
import math import numpy as np import pytest import pandas as pd import pandas._testing as tm import pandas.core.common as com class TestCategoricalIndexingWithFactor: def test_getitem(self): factor = pd.Categorical(["a", "b", "b", "a", "a", "c", "c", "c"], ordered=True) assert factor[0] == "a" ...
cd68d34de73d0cd5f6babbe605d977f924ba94301bf75208c65192847039b918
Python
12,793
341
# 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...
7658938eec6538e4d8722677e5399f7dd1b35e0bb370299b842fb920576d7be9
Python
12,797
314
import re import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.checkpoint as cp from collections import OrderedDict from torchvision._internally_replaced_utils import load_state_dict_from_url from torch import Tensor from typing import Any, List, Tuple __all__ = ['DenseNet', 'densenet...
d71d19cd65f8a0f73d12ffd7e6b36a62e06d7bc88e3213d1e946e5435e1f4efb
Python
12,797
322
# 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...
d170dbae5c3a262e4ad6ad58537628789d7dee9273adbd5e57b6ef71eed03ec2
Python
12,798
359
# -*- coding: utf-8 -*- """ Created on Tue Feb 14 11:11:06 2023 Figure 3. Dorsal striatal neurons encoding single-limb phase angle, body speed, and start/stop of walking. @author: lonya """ #%% Load Data import tkinter as tk import tkinter.filedialog as fd import numpy as np import os import matplotlib...
f9b1db94cb2d6e18654ad7f960410b040c3dc197bb37ec1dec67ea0df7f5496a
Python
12,800
440
#!/usr/bin/env python # _*_ coding: utf-8 _*_ import socket import threading import math import numpy as np from collections import deque from scipy import signal from loguru import logger from sklearn.utils import resample from .NeuroScanMessage import NeuroScanMessage class NeuroScanEEGThread(threadi...
3ceb17cd0fe831a32e05088d9b061d821cf8a4478ae5af2bd167be5a7e8e8c04
Python
12,801
358
# 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...
bd534afb61bd032ecfd5b1d4d08fa0bafd3c257638364243409045e87d540950
Python
12,805
245
import sys sys.path.append('.') from sklearn.metrics import mean_squared_error, r2_score, mean_absolute_error from scipy.stats import pearsonr import torch import torch.nn as nn import torch.optim as opt import torch.cuda.amp as amp import datetime from torch.utils.tensorboard import SummaryWriter from model.drp_model....
0261c5b5d536c11f3747561b3359a5bb6742d966a349eabf5e28288494212634
Python
12,807
350
# 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...
6c3fcdb11e00c262e79477ccf68dfaf9f1417d2367c87afbae671742bf559ef9
Python
12,810
320
"""Compiled public API and CLI regressions for invocation CPU budgets.""" import json import os from pathlib import Path import signal import subprocess import sys from types import SimpleNamespace import pytest from conftest import macs3_env from test_Parser_bam_truncation import HEADER, record, write_bam from test...
c0eb6d8f1df58a9205df35a6ac064ff8804cb74190c58dbd8d8876dd75d234bb
Python
12,812
370
# MOFTransformer version 2.0.0 """ Vision Transformer (ViT) in PyTorch A PyTorch implement of Vision Transformers as described in 'An Image Is Worth 16 x 16 Words: Transformers for Image Recognition at Scale' - https://arxiv.org/abs/2010.11929 The official jax code is released and available at https://github.co...
72aeca9165713a0995103b68d428a0f480256960296e3c68941831e30842cdf4
Python
12,813
251
""" module containing functions for calculating the choice probability of recorded neurons 1/19/2018 Eric Finkel """ import time import math import scipy as sp import scipy.io import scipy.stats import os import numpy as np import pandas as pd import glob import csv import random as rand from sklearn.metrics import ro...
a36f2af5541950e71ec5b24c1a8004082dbf92b06b05b0e79f634a3281bace06
Python
12,813
326
import torch, numpy as np from torch import Tensor import torch.nn as nn import torch.nn.functional as F from torch.nn import Sequential, Linear, BatchNorm1d, Dropout, Parameter from torch_geometric.nn.conv import MessagePassing from torch_geometric.utils import softmax as tg_softmax from torch_geometric.nn.inits i...
500f75ebf3e5e4cc2ddbeae6346960d8ae70b3b93876eff291b04ed7f5fb711d
Python
12,816
415
""" Mapping indices for complexes / multi-domain sequences to internal model numbering. Authors: Thomas A. Hopf Anna G. Green (MultiSegmentCouplingsModel) """ from collections.abc import Iterable from copy import deepcopy from evcouplings.couplings.model import CouplingsModel import pandas as pd import numpy as n...
5f9145421d5e6498d61266aad4aa18cbceadc7fe8c60a05657e10a23d7e66355
Python
12,818
417
# Module: internal.distributions # Author: Antoni Baum (Yard1) <antoni.baum@protonmail.com> # License: MIT from typing import Dict, Optional from scipy.stats import loguniform, randint, uniform try: from collections.abc import Hashable except Exception: from collections import Hashable from copy import copy...
35390b4fc064c9d0c3f85f680d91dc22cf8c820a37f919d594fb18dd724dc361
Python
12,820
369
# ---------------------------------------------------------------------------- # Copyright (c) 2016-2026, 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. # ------------------------------------------------...
c7b62e6794cb011e054682dcbc8fcdb6f1bf7def57b0babcbf40721ff66041ee
Python
12,820
332
# 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...
7d334a11e8a41b518a889a3ffd3f340453a2f2c57b3831134a041f3366b61230
Python
12,822
378
# 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...
1514fb7e5cd69f5adff5abac249848ff6d0a02b4ee39741c5ec34f32d6ae71f5
Python
12,823
168
"""Final figure set: readable at journal width, with explicit sensitivity. Run after 05_make_figures.py and 15_strengthen_inference.py. Panel letters are the only titles; interpretation and study windows belong in DOCX captions. """ from figure_style import * from matplotlib.lines import Line2D import calendar C=pd.r...
0f1309eaf168ac344664c928277743ed83fd1c600875de6870c3b04655a42bb6
Python
12,835
274
from Environment_ui import * from PySide2.QtWidgets import QWidget, QFileDialog, QTextBrowser, QPushButton, QProgressBar, QMessageBox from PySide2.QtUiTools import QUiLoader from PySide2.QtCore import Signal, QObject from threading import Thread from pages.Analysis.seg3d_to_2d import seg3d_to_2d from math import ceil,f...
067762fdde446566ab32ab0392d0e51a2904d91546f5d72c6aa3f49ddf337553
Python
12,837
232
# 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...
a9667843ae4bf14c6c79b218d7f8a9ddc100200cbc4699b13211f6012ac92421
Python
12,839
380
"""Session 22 — control plane progress: secrets encryption + prediction logs + trials. Three concerns wired in this slice: 1. ``pycaret_server.crypto`` — Fernet round-trip + legacy plaintext fallback + encryption is applied when LLM provider settings are written. 2. ``PredictionLog`` — every ``/deployments/{slug}/...
d8631444bf84d562b407809413019cb4d06ae3754de64a45785b3523dca6e3f5
Python
12,843
324
import math from itertools import permutations import numpy as np from scipy import spatial, stats class MantelResult: """ Object representing the result of a Mantel test. Specific properties can be queried by dot notation (e.g. `result.correlations`, `result.r`, `result.p`, etc.) or the result object...
ef1b4ad8ac2b88f69d5105fa1ddbaa2c091c90c902e0d90a5da487b4a664f1ed
Python
12,845
406
# 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...
59a2aed4226113c4e401d22e9008ae78055bff3e799be882ce5a56c4cf1aa9e8
Python
12,850
360
from tensorflow.keras.layers import Input, Conv1D, MaxPooling1D, Dropout, BatchNormalization, Activation, Add, Flatten, Dense from tensorflow import keras from tensorflow.keras.initializers import lecun_normal import tensorflow as tf from tensorflow.keras.callbacks import ModelCheckpoint, CSVLogger import pandas as pd ...
d9d71088cd5bd2272d6f0242a09ede131086f672ebff46b8018cfc3b363ea1c2
Python
12,857
286
import argparse import numpy as np import os import sys import tqdm import torch import torchinfo import logging import torch.nn as nn from pathlib import Path from collections import defaultdict from torch.utils.data import DataLoader from torch.utils.tensorboard import SummaryWriter from local.training import Sequent...
008703de0a2e770bd6166d2774c743e6433cc4a9a642662fc84be736dc3a0173
Python
12,859
406
# 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...
b041d3873f15196e167f26e6214d3515934d386a6861b54cf610e2821207aace
Python
12,876
269
"""Bounded subprocess driver exercising compiled public execution paths.""" import ctypes import hashlib import io import json import os from pathlib import Path import sys import threading from types import SimpleNamespace from unittest.mock import patch import numpy as np from MACS3.IO.Parser import BAMParser, BAMP...
cf4a4eff56db8615deddd3c47125e4f719f65d8176a7560a64059f4f9f75ef31
Python
12,876
356
import os from typing import Dict,Tuple import io # import pandas as pd from pathlib import Path import uuid import subprocess import numpy as np import string import random import argparse import tempfile import os import sys from Bio import SearchIO class RawAndDefaultsFormatter(argparse.ArgumentDefaultsHelpFormatt...
76da522dc28e438b9c759df011936d99e9a187fabcc660357a7bdbe52f408cfa
Python
12,882
472
import argparse import os import sys import torch from sklearn.model_selection import train_test_split as split from roost.roost.data import CompositionData, collate_batch from roost.roost.model import Roost from roost.utils import results_multitask, train_ensemble def main( data_path, fea_path, targets...
8e3b279e4459adf17c58f2e674b96c883e1deca4b3354ffb02ad18f85ae74218
Python
12,884
341
# 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...
4fe011e92604a5b90823066b3c5bc4e73951ff9d534be7a25476d3f715c01548
Python
12,889
331
""" @author: mkowalska """ import os import numpy as np from figure_properties import * import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import targeted_basis as tb __abs_file__ = os.path.abspath(__file__) def set_axis(ax, letter=None): """ Formats the plot's caption. Parameters ...
0eacc0e43c9e47a8761482e9ce0e32137b344dae259882c0dd8efdf80ab0498a
Python
12,890
367
from datetime import ( UTC, datetime, ) from decimal import Decimal import numpy as np import pytest from pandas.errors import ( InvalidIndexError, Pandas4Warning, ) import pandas as pd import pandas._testing as tm def test_at_dateoffset_columns(): # GH#20948 - .at with DateOffset columns o...
e75990551d7c45a2c066fe10d69f8e093d2efd98527dacfeb2984fe82a065873
Python
12,890
391
import numpy as np import pytest from pandas.compat import HAS_PYARROW from pandas.errors import Pandas4Warning 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 s...
14c7bca709184c3884651e075e5b6e65d452b5648d68a2ea5b9a6ef2669c31b1
Python
12,897
316
""" Utility functions for link prediction Most code is adapted from authors' implementation of RGCN link prediction: https://github.com/MichSchli/RelationPrediction """ import numpy as np import torch import dgl ####################################################################### # # Utility function for building...
49548c3a2874c57f21c7a98558abd94624062f1439f19755ad62875d3c672e70
Python
12,901
251
#!/usr/bin/env python3 # MIT License # # Copyright 2024 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 u...
7891f3b0c9689df5eb05434b5d6b853ad4d3b519b1052fea1aa83b7883d53b37
Python
12,901
389
from datetime import ( date, datetime, ) import subprocess import sys import numpy as np import pytest import pandas._config.config as cf from pandas._libs.tslibs import to_offset import pandas as pd import pandas._testing as tm from pandas.plotting import ( deregister_matplotlib_converters, regist...
a271b9f5f792d984381b13caf94e8f7459e704fd662022d8e171b1f2d9578cae
Python
12,904
305
# Copyright 2018-2022 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...
228b167d398a9fabf760f9c61302fe3c4cc46d9c3cf7800b611225c18716dd88
Python
12,912
473
import argparse import os import sys import torch from sklearn.model_selection import train_test_split as split from roost.roost.data import CompositionData, collate_batch from roost.roost.model import Roost from roost.utils import results_multitask, train_ensemble def main( data_path, fea_path, targets...
8cd7945245c2e593dddf09a1e96f1d300805fd7ca6a01c343d6f419ea738d038
Python
12,915
520
"""basic inference routines""" from __future__ import annotations from collections import abc from numbers import Number import re from re import Pattern from typing import ( TYPE_CHECKING, Any, TypeGuard, ) import numpy as np from pandas._libs import lib from pandas.util._decorators import set_module ...
2306ad08b235e8f80650f9bcaacb9b76215e16b613a4c220b31e772824a1c01c
Python
12,923
216
#! /usr/bin/env python import argparse import os import pandas as pd import numpy as np from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import GridSearchCV, cross_val_score, StratifiedKFold from multiisotonic.multiisotonic import MultiIsotonicRegressor import sys from time import strft...
9dfd05cf6dbee7deebebb76b5c939107f7c8b73fadfdc4c2e6de80ec3e857b0f
Python
12,933
288
import numpy as np import pytest import pandas as pd import pandas._testing as tm from pandas.core.arrays.sparse import SparseArray @pytest.fixture(params=[0, np.nan]) def fill_value(request): return request.param @pytest.fixture def sparse_df(fill_value): """DataFrame with sparse int columns and a dense g...
b512bb2807be84b62626b8892e1a62585ed39eb3b8c3e7ec2e4f007fb49250c6
Python
12,933
378
import datetime import numpy as np import pytest from pandas.errors import Pandas4Warning import pandas as pd import pandas._testing as tm class TestMultiLevel: def test_reindex_level(self, multiindex_year_month_day_dataframe_random_data): # axis=0 ymd = multiindex_year_month_day_dataframe_rand...
eb5a37b061f1fa420dba54dbffaa16ba0ed8fc0899e5e42f0dc86292647a0fd9
Python
12,937
362
"""Shared fixtures for the MACS3 test suite. The existing test files open data with paths relative to the repository root (``test/tiny.bed.gz``), so ``pytest`` is expected to run from the repository root. New tests use the absolute paths given by the ``test_dir`` and ``data_dir`` fixtures and run from anywhere. Comma...
4cb4687c5ee766b1eb4ad7e5aee0d07696736b0a5f616ecfb028fe4c8afe0429
Python
12,939
414
""" Tests for the following offsets: - CustomBusinessMonthBase - CustomBusinessMonthBegin - CustomBusinessMonthEnd """ from __future__ import annotations from datetime import ( date, datetime, timedelta, ) import numpy as np import pytest from pandas._libs.tslibs.offsets import ( CBMonthBegin, C...
f722b75da214e9cf762ba1be203035cfd75d36b20c6a67176435ac2187ed8cbb
Python
12,940
338
import sys import os from numpy import nan import pandas as pd import argparse #sys.stdin.reconfigure(encoding='latin-1',errors='replace') #'utf-8',errors='replace') #'ignore') if __name__ == '__main__': argparser = argparse.ArgumentParser(''' Extract eye-tracking time series from Dundee eye-trackin...
8f06d7556497b2caf55396907147ee90102d40125261a291a5acaa6f3fd62986
Python
12,942
364
import numpy as np from numba import jit, prange @jit(nopython=True, parallel=True) def interpolate_3d(f, w, num_points1, num_points2, num_points3, indexx, indexy, indexz, dx1, dx2, dx3): dim1 = indexx.shape[0] dim2 = indexx.shape[1] dim3 = indexx.shape[2] f_out = np.zeros((dim1, dim2, dim3)...
b8b92b714d3b889a7bc284115d16419cd4b8b041b7af8b43058d4105b722df28
Python
12,947
360
from tensorflow.keras.layers import Input, Conv1D, MaxPooling1D, Dropout, BatchNormalization, Activation, Add, Flatten, Dense from tensorflow import keras from tensorflow.keras.initializers import lecun_normal import tensorflow as tf from tensorflow.keras.callbacks import ModelCheckpoint, CSVLogger import pandas as pd ...
765c2be9f54a3c619aa52e1aad48d8f1bcffe92fba43407859a589f9a2c2229b
Python
12,951
386
from itertools import product import re import numpy as np import pytest from pandas._libs import hashtable import pandas as pd import pandas._testing as tm @pytest.fixture def idx_dup(): # compare tests/indexes/multi/conftest.py major_axis = pd.Index(["foo", "bar", "baz", "qux"]) minor_axis = pd.Index...
4ef17c89fc47fabe181061850614259ea46b698f366834b3d4892e6e78bc81f2
Python
12,957
202
"""Publication cartography at 180 mm with native, unsmoothed raster support.""" from figure_style import * from matplotlib.ticker import LogFormatterMathtext import matplotlib.text from PIL import Image from pyproj import Transformer from shapely.ops import transform as reproject from matplotlib.patches import Polygon ...
1bc760f39b683c013a3f20ef74f156ec2ed5f3906d98f7d7f4490bfb4cbc44a3
Python
12,960
412
#%% #Imports import numpy as np import os from pathlib import Path import matplotlib.pyplot as plt import matplotlib.animation as animation from matplotlib.gridspec import GridSpec import matplotlib.backends.backend_pdf import matplotlib # plt.style.use('seaborn-talk') # style specs matplotlib.rcParams['lines.linewidth...
fac991728d5885a6da61042d9b1e2e7e93bb972a784977dbca84331770626341
Python
12,963
418
"""Functions for normalising data. METHODS ------- find_exclusion_indices - Finds the indices of the frequencies to exclude from the normalisation calculation. find_inclusion_indices - Finds the indices of the frequencies to include in the normalisation calculation. sort_data_dims - Sorts the dimension...
f3ed77400f6eaa14015dd5f93bab2fad88156517024f0e69796e49d0d4d7acd9
Python
12,964
270
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Aug 15 17:33:34 2022 @author: ecastrow """ from botocore.client import Config import ibm_boto3 import os import pandas as pd import numpy as np import sys import json import logging sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file_...
5d01f908b0d2ebc128170623d12dca9d8cc001830f6ae8c745208514a0dc2d70
Python
12,973
332
# basics import os import numpy as np import nibabel as nib from path import Path from tqdm import tqdm from skimage.util import view_as_windows import time import datetime # dl import torch import monai from monai.networks.nets import BasicUNet from .sliding_window_inferer import SlidingWindowInferer from monai.tra...
b4a4df2947f5baa6a3fe25f7c6d5007e0a2febdffa7e5dba7e0bb1441483054d
Python
12,979
389
""" file_tools.py - File handling utilities for cptools2 This module extends cptools2 with capabilities for post-processing analysis results generated by CellProfiler pipelines. The main functionality involves automatically joining CSV output files based on patterns specified in the configuration YAML file, with autom...
e77eead9ce365697eed0832338a1fc3f1c5ba898ed55d15adacbe05fb22de530
Python
12,979
405
# 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...
fa5d5367361ada51b2e3dee3c77029a1ed282ab559db4ac7827b31d13c00a589
Python
12,982
390
from datetime import ( date, datetime, ) import subprocess import sys import numpy as np import pytest import pandas._config.config as cf from pandas._libs.tslibs import to_offset import pandas as pd import pandas._testing as tm from pandas.plotting import ( deregister_matplotlib_converters, regist...
662ea66bc0f3d8df650fed2b1b922328369a163bf3f0a9d8d9cea8b20115569a
Python
12,989
351
#!/usr/bin/env python3 """Download and validate the trained BASALT model weights.""" from __future__ import annotations import argparse import hashlib import os import sys from pathlib import Path from typing import Optional from zipfile import BadZipFile, ZipFile HUGGING_FACE_REPO = "PKU-EMBL/BASALT_WEIGHT" HUGGI...
3d87f85a77b7ba9d2418902afe67ac442a6be0801bf26d6a21e7734ad808ea93
Python
12,997
283
import sys import os import re 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 statsmodels.stats.multitest import fdrcorrection import argparse delimiters = [ '_v_', '_vs_', ' vs '...
d8cf9c9da53071268cd03543c885e4bebd7d68135df6976416a28b22c9ebd93a
Python
13,001
347
# 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...
7c4758749b8bfd438879a57d7dd14014df8b417f23da81e2948cf363bff8b226
Python
13,007
334
import numpy as np from random import shuffle import pdb import random import copy codon_to_aa_dict = { 'ATA': 'I', 'ATC': 'I', 'ATT': 'I', 'ATG': 'M', 'ACA': 'T', 'ACC': 'T', 'ACG': 'T', 'ACT': 'T', # M = start codon 'AAC': 'N', 'AAT': 'N', 'AAA': 'K', 'AAG': 'K', # Z = stop codon 'AGC': 'S', 'AGT'...
ccc44f1635346360b5ebc72d7ff1c1f5f31a853a0437ac45bcf0a7019e438cd1
Python
13,007
340
"""Session 23 — god-class drain: ``predict_model``. ``Experiment.predict_model`` no longer delegates to ``self._legacy.predict_model``. It now calls ``estimator.predict`` and (for classifiers) ``estimator.predict_proba`` directly, on the assumption that the estimator is a fitted sklearn Pipeline with preprocessing bak...
cb7efac54663ac4c5df339cae76889025c77bab67522c59fd5fc46d9845e4c0b
Python
13,009
362
# 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...
89945973470501e24ee0e066b3bab783ea5b2f1314f3345e447f7b82ccc24645
Python
13,012
380
""" Utility functions and classes (including default parameters). Author: Sara Mathieson, Rebecca Riley Date: 9/27/22 """ # python imports import numpy as np import optparse import sys # our imports import generator import global_vars import param_set import real_data_random import simulation from slim_iterator impor...
a2e2d2a229768dea6fe6fa9b0cda6718a61102177f7e439b8031784572b38b40
Python
13,012
376
import io import numpy as np import pytest import pandas as pd pytest.importorskip("jinja2") def bar_grad(a=None, b=None, c=None, d=None): """Used in multiple tests to simplify formatting of expected result""" ret = [("width", "10em")] if all(x is None for x in [a, b, c, d]): return ret ret...
f72e593b921f34b8982542a35e0679349efe5c50f61587b50e244f9fd619a19f
Python
13,022
304
import os import sys import random import time import numpy import scipy.io import matplotlib.pyplot as plt import collections import kornia import torch import torch.nn as nn import torch.nn.parallel import torch.optim as optim import torch.utils.data import torch.utils.data.distributed import torchvision.transforms ...
b376c46e79a720f551d519b55755bbbf353cc013d279183028de30d2d3cd0a63
Python
13,024
399
#!/usr/bin/env python3 """ Python script for building documentation. To build the docs you must have all optional dependencies for pandas installed. See the installation instructions for a list of these. Usage ----- $ python make.py clean $ python make.py html $ python make.py latex """ import argparse i...
511d54cde5e7c3fc46a3c0de14c5f0eaa26989a81a7c653cdf498ad474e5ec06
Python
13,025
318
# 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...
576e710501250bd26ab9fddc64767c1b522c5986cb29986a4c04860d8f0338ea
Python
13,025
333
# 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...
7a93d12f23d9b2b39d6325025403611ecb187cadfe953e9b1acb36fbc2c11f4d
Python
13,031
406
# 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...
d028fd953dc5bc69f4363c0c934c1ee2498833e5a8fb2cf677d0ee97725e4592
Python
13,036
366
""" Tests for Series cumulative operations. See also -------- tests.frame.test_cumulative """ import re import numpy as np import pytest import pandas as pd import pandas._testing as tm methods = { "cumsum": np.cumsum, "cumprod": np.cumprod, "cummin": np.minimum.accumulate, "cummax": np.maximum.acc...
c38572ea33150c202126f5b422f4cb8f48038b15099ddba67ed1bbb5153da31c
Python
13,037
444
#!/usr/bin/env python # _*_ coding: utf-8 _*_ import socket import threading import math import numpy as np from collections import deque from scipy import signal from loguru import logger from sklearn.utils import resample from .NeuroScanMessage import NeuroScanMessage class NeuroScanEEGThread(threadi...
dfd83bc9c0e4d4e50ec5e4351ed62d716c92687c117dcffb47fe0bb4978675f5
Python
13,044
362
# 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...
060c5876d805b55bc924f0a4ff4ff022f97d79fb1443b3fd9029ffd1bb98a647
Python
13,047
386
"""Tests for thriveline utilities, VelocityModel.compute_thrivelines, and plot_thrivelines.""" from __future__ import annotations import math import warnings import matplotlib.pyplot as plt import numpy as np import pandas as pd import pytest from scipy.stats import norm from pcntoolkit.longitudinal.correlation_mat...
29208d8c1423630768cc7215b8feb57eb116b1e9a8a8a3353d3619ffb1776506
Python
13,053
351
# 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...
d3787cde0626ca256ba2dbbeab3d8d9e41d5eee6742f1cca4cb28e79282a6c8d
Python
13,053
441
# Module: containers.models.anomaly # Author: Moez Ali <moez.ali@queensu.ca> and Antoni Baum (Yard1) <antoni.baum@protonmail.com> # License: MIT # The purpose of this module is to serve as a central repository of anomaly models. The `anomaly` module will # call `get_all_model_containers()`, which will return instances...
daccda0851fc30b731270a8f83513bc9e28c25b104f43bc3ddd36033d6cf1a14
Python
13,061
340
from statistics import mean import pytest import torch from pgen import models, esm_sampler from pgen.esm_sampler import generate_step, ESM_ALLOWED_AMINO_ACIDS ####### Fixtures ####### @pytest.fixture def esm6(scope="session"): return models.ESM6() @pytest.fixture def esm_sampler_fixture(esm6, scope="session")...
8df96863cf5790052240119b2c935fd981c4e99db011313aefe1a8976ad2ad3b
Python
13,071
453
""" Additional tests for NumpyExtensionArray that aren't covered by the interface tests. """ import numpy as np import pytest from pandas.errors import Pandas4Warning from pandas.core.dtypes.dtypes import NumpyEADtype import pandas as pd import pandas._testing as tm from pandas.arrays import NumpyExtensionArray @...
04ac6a1a7fb85a032318e75770b11a3ae629b3cd4af6e44ad334cc1d54f75a1e
Python
13,100
377
# 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...
5dab128524582ed8e2a2af6ff8dad69fbab4a7bd29cdb55d8b0354f723523f05
Python
13,100
311
import matplotlib.pyplot as plt import numpy as np import os import pandas as pd import re import scipy as sp import scikit_posthocs as posthoc import seaborn as sns sns.set(font_scale=1.5) data_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'data') logs_dir = os.path.join(data_dir, '...
4d0f4f06d478076fc9830f1c837a478fab0d56babc691e42fd02c429875e935c
Python
13,104
390
import sys, os, time import warnings import six from six.moves.cPickle import PicklingError # this import format has potential issues (see six documentation) -rieke import cloudpickle import contextlib import io import dask.dataframe as dd import dask import pandas as pd import numpy as np import distributed import six...