sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
a64c8319996b7ababebb7e8cdc9771c8e91c491b260fd814a035349e9d8fe554
Python
10,034
200
# TODO: standardize on `def lookup_{key}(): return overrides[key]`? from .utils import PheWebError, load_module_from_filepath from . import parse_utils import os, boltons.fileutils from typing import Optional,Any,Dict,Tuple,List # All state lives in this dictionary. # PheWeb should run fine when this is empty. # M...
f158b274d37eaadcd3b0124c61d8a2211f504f785aacc57afdc17e892233a5b3
Python
10,037
320
# 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...
97bb39b29db08eeb6f7e0021e6502d00dc4f967fc8c8e029f853d06dbd4dd5b3
Python
10,039
269
"""Modules to extract stimulus features.""" import numpy as np import torch from typing import List from transformers import AutoConfig, AutoModel, AutoTokenizer from DataSequence import DataSequence from hard_coded_things import ( bad_words, bad_words_with_sentence_boundaries, sentence_end_word, sent...
193fdb1e57d7793678a2c2989cb442f985606ba11adb7f98aac30e10e798ce35
Python
10,040
255
# 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...
ee8475b2ee654458bbb3649b1e3bc214cb54878bd8b61b233ea8981815a89243
Python
10,042
218
''' Script to visualize the planning benchmark results stored in a hdf5 database. ''' #---------------------------------------------------------- # default values database_name_default = 'build/planning_results.hdf5' #---------------------------------------------------------- import argparse import h5py import matplo...
8b61ddcc85e41a6125bce25a1e2644e9101324fd20fefa230094ef3a9a720bf1
Python
10,058
184
import os import argparse import random import torch import numpy as np import logging from warnings import simplefilter from scipy.sparse import SparseEfficiencyWarning from manager.trainer import Trainer from manager.evaluator import Evaluator_multiclass, Evaluator_multilabel from model.Classifier_model import Classi...
f461bfe6788f63d6db1cbc821efb01f67b8c536fe208b6b1ee42f849e0509456
Python
10,067
369
from __future__ import annotations from typing import ( TYPE_CHECKING, cast, ) from pandas._libs import ( NaT, lib, ) from pandas.errors import InvalidIndexError from pandas.core.dtypes.cast import find_common_type from pandas.core.algorithms import safe_sort from pandas.core.indexes.base import ( ...
24cc0d9a94717e403720243a4f36a3f36e6a59f4f0ea3a4702f50ad76a5fdb81
Python
10,073
301
#! /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...
50b9e5a868f0dcf80e2022d6a6c524465c7db36bd83a2ddf5e660bb1405db72a
Python
10,088
286
# MOFTransformer version 2.0.0 import os import random import json import pickle import numpy as np import torch from torch.nn.functional import interpolate class Dataset(torch.utils.data.Dataset): def __init__( self, data_dir: str, split: str, nbr_fea_len: int, ...
25bab5d58442e9cd819b19162457762d12c1360eaace555925a494ae3f04578b
Python
10,089
279
"""Process TFC data.""" from pathlib import Path import numpy as np import pandas as pd from .fp_data import debleach_signals, fit_linear, save_data, trial_normalize def make_tfc_comp_times( n_trials: int, baseline: int, cs_dur: int, trace_dur: int, us_dur: int, iti_dur: int ) -> pd.DataFrame: """ Crea...
022db47835447a99c25f0530e2320a633de7db60383b60bb7a7aad7a65c0dbba
Python
10,092
332
# 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...
5fda30a8df1f39f52ea04a7a4352bc3bedd4683241f01922f3badcdaf4ec4d02
Python
10,094
278
# 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...
421c6a209ca1b90f418b8e1bb6666c32cdfd841671e7fea70510352afdcc83cc
Python
10,096
250
# 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...
c9f735f03d4c83dc75b6b86fab08518b4c2d0f67668c05dd14bd2a73bbacd57b
Python
10,097
246
#!/usr/bin/env python # # Script to package data for manual correction. # # For full help, please run: python package_for_correction.py -h` # # Example: # python package_for_correction.py # -path-in ~/<your_dataset>/data_processed # -config config.yml # # Authors: Jan Valosek, Sandrine Bédard, Julien ...
1384bd8cf420ab8b1f03e9b03175380d795d38bba9df9801c29f4df27391a964
Python
10,101
289
"""Tests for the two session-18 consultation types: experiment designer + run explainer. The router/provider/audit plumbing is already covered by `test_llm.py`; these tests focus on the consultation-specific validation + happy paths using the FakeLLMProvider. """ from __future__ import annotations import io from coll...
7b79bef819514a01d2706b7971052749213261e7d6fe208105f743ac0ae531b8
Python
10,104
264
"""Test nimare.transforms.""" import re import nibabel as nib import numpy as np import pytest from nimare import transforms def test_ImageTransformer(testdata_ibma): """Smoke test on transforms.ImageTransformer.""" dset = testdata_ibma z_files = dset.images["z"].tolist() z_transformer = transforms....
3960831670d107b01b633cc949cf8c00cb5c5439ecce9ff4e3def16de5401593
Python
10,105
271
# 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...
9df87a9fee96420adfe5cff2b1e0dd48e4929b3d43fb6ca171b48eb24e7b9696
Python
10,116
255
"""Operator enforcing constraints by variable transformations.""" from collections.abc import Sequence import torch from mrpro.operators.EndomorphOperator import EndomorphOperator, endomorph def sigmoid(x: torch.Tensor, beta: float = 1.0) -> torch.Tensor: """Beta scaled sigmoid function.""" return torch.nn...
4ccd4c89975d777122308baefa16cde27d673e89dbc61ab42156c6c9ddfecfe3
Python
10,122
329
import pytest from pandas.core.dtypes.missing import array_equivalent import pandas as pd # Fixtures # ======== @pytest.fixture def df(): """DataFrame with columns 'L1', 'L2', and 'L3'""" return pd.DataFrame({"L1": [1, 2, 3], "L2": [11, 12, 13], "L3": ["A", "B", "C"]}) @pytest.fixture(params=[[], ["L1"], ...
72e6e429a467996d910f8500459a4af639a87e2de0fab29d39a63249078a55de
Python
10,123
219
# sourcery skip: avoid-builtin-shadow import argparse import subprocess import sys import os DASDC_version = '1.0.1' description_text = "\n".join([ "==========================================================================", "DASDC: (D)omain (A)daptation (S)weep (D)etection and (C)lassification", "======...
49a23aa27ef2dd403089e61fc93fa1f72cd9670574e06fbaa6d894c66b99bc9d
Python
10,135
336
""" Summary stat helpers for computing and plotting summary statistics. Note: "real" should alwasy be first, followed by simulated. Author: Sara Mathieson, Rebecca Riley Date: 9/27/22 """ # TODO some of these could be replaced with tskit # https://tskit.readthedocs.io/en/stable/python-api.html#tskit.TreeSequence # py...
1fc6e2a86776ad4dab301e0ff7e96511769e7828f74f873476bc7343db000ddb
Python
10,136
245
# 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...
a6fff19d712eb162e020d06de20641cda7da44eea5f4328bb1fc1818befacfcb
Python
10,138
225
# coding=utf-8 # Code from: https://github.com/alafuzof/NeuralynxIO from __future__ import division import os import warnings import numpy as np import datetime HEADER_LENGTH = 16 * 1024 # 16 kilobytes of header NCS_SAMPLES_PER_RECORD = 512 NCS_RECORD = np.dtype([('TimeStamp', np.uint64), # Cheetah ti...
ea6e9a281804d637414e39d45c348cce20f59c6eca072c624bd05fdedf3d97f9
Python
10,138
277
""" add_supplementary_images.py Add supplementary images to publishedURL and create an order file ***************************************************************** WARNING This program was written for one specific use - to add skeletons for FlyWire. It is generalized to a...
4dac23a64518a09b719d7c48cf22f74409daee86151a017f5e7e4f8f8a2fb955
Python
10,140
313
from datetime import ( datetime, timedelta, ) import operator import numpy as np import pytest import pandas as pd import pandas._testing as tm class TestTimestampComparison: def test_compare_non_nano_dt64(self): # don't raise when converting dt64 to Timestamp in __richcmp__ dt = np.date...
9501da61e56c05f94eb01715da0b3202d60bd89c680b095fd53f14ff14a337dd
Python
10,140
332
""" Tests for the following offsets: - YearBegin - YearEnd """ from __future__ import annotations from datetime import datetime import numpy as np import pytest import pandas as pd from pandas.tests.tseries.offsets.common import ( assert_is_on_offset, assert_offset_equal, ) from pandas.tseries.offsets impo...
a3bd52ff97cf1952942067d550e5a6a1b6ad2693440aecde7e938e14111c8ed8
Python
10,140
252
#!/usr/bin/env python # coding: utf-8 ### Author: federica.magnabosco@mrc-cbu.cam.ac.uk ### Fit decoding model LDvsSD individual ROIs and save accuracy # Import some relevant packages. import numpy as np import pandas as pd import pickle from sklearn.pipeline import make_pipeline from sklearn.preprocessing import S...
edcd5d6c94bc0b62de94c3f4b30bdad366a3f31e031739b83360385125a37d4e
Python
10,141
324
""" Wrappers for tools for calculation of evolutionary couplings from sequence alignments. Authors: Thomas A. Hopf """ from collections import namedtuple import re import pandas as pd from evcouplings.utils.system import ( run, valid_file, create_prefix_folders, verify_resources, ResourceError ) def par...
bf6e2e33abf097180b0875c9a7502542a735b78d462a0d3610dcd58501c11ef9
Python
10,146
308
"""Miscellaneous functions used for plotting gradient data""" import gzip import math import os.path as op import pickle import nibabel as nib import numpy as np import seaborn as sns from matplotlib import pyplot as plt from neuromaps.datasets import fetch_fslr from nilearn import image, masking, plotting from nilear...
52e66c1f7495bb9da59d2f83a5ef69b1c7951b2b2f55f04fe825a9caa54188dd
Python
10,147
267
"""Module contains classes and functions for loading and storing moseq data.""" from collections import Counter from dataclasses import dataclass from typing import Dict, List, Optional, Union from typing_extensions import Literal import numpy as np from moseq2_viz.model.util import get_syllable_statistics, get_transi...
87507fa5280732531c4d2bd0823f9cb87bde1064252281b46b8f980192f6bc33
Python
10,154
301
import olefile as ofio import io from struct import unpack, calcsize # Assume the .JWS file is packed as little-endian (x86 processors) # For Jasco SpectraManager 1.5 files JWS_150_HEADER_FORMAT = "<L126sHLdddlll20xlll20x6i6i6i6i32s32s64s128s32s96s148s32s16s32s32s64sl148x80s596x" JWS_MAGIC_BYTES = 0x20537E4C ...
bff46424d6995b48eb787d5702561463ffcce74e42289e7d84b6c2f361e12d03
Python
10,161
248
import h5py import numpy as np import scipy from scipy import stats as scipy_stats import matplotlib import matplotlib.pyplot as plt class AnalyzePrf: """ Initializes an instance of the AnalyzePrf class. This class performs advanced analyses on Population Receptive Field (pRF) mapping data ac...
faf61a8fa0e857be24df83012634b80d85c4b126d3ca1931864907854663b3b8
Python
10,163
362
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Mar 14 20:43:48 2021 @author: reisertm """ import sys import os import matplotlib as mpl import matplotlib.pyplot as plt import numpy as npss import tensorflow as tf import math from tensorflow.keras import Model from tensorflow.keras import layers ...
274d0feff16353de225b93b2a910004c96c5cb67d1310161ea7878b939633543
Python
10,169
317
# 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...
b4b7f190f4aba18ca88dbfa88f792e2ae285bd47ab3ac1910d54239b35c5171b
Python
10,169
220
import torch import torch.nn as nn import torch.nn.functional as F import math import numpy as np torch.set_default_dtype(torch.float64) class SiLU(nn.Module): # from https://pytorch.org/docs/stable/_modules/torch/nn/modules/activation.html#SiLU, since it is missing in 1.6.0 def __init__(self, inplace = ...
593025c0c0f366869c6b791582897cec95b1710bbbc354f835d6426649f4814b
Python
10,170
257
from __future__ import absolute_import from __future__ import unicode_literals from __future__ import print_function from __future__ import division import torch import torch.nn as nn from torch.autograd import Variable import torch.nn.functional as F class LearnedGroupConv(nn.Module): global_progress = 0.0 ...
9a813b135db73dad5bd05e0feb1c84065e53909af319e0ae8c7d89be90f01b2b
Python
10,172
245
#!/usr/bin/env python # coding: utf-8 ### Author: federica.magnabosco@mrc-cbu.cam.ac.uk ### Fit decoding model LDvsSD individual ROIs and save accuracy # Import some relevant packages. import numpy as np import pandas as pd import pickle from sklearn.pipeline import make_pipeline from sklearn.preprocessing import S...
27d036c8bfdafe5a3d0d68408cba31d164a3e4f8783f2ccaf18ba2123b3f5d7f
Python
10,177
264
import numpy as np import torch from .interpolation import interpolate_sparse_data, get_smooth_data from .HDF5Dataset import HDF5Dataset import windseer.utils as utils def load_measurements(config, config_model): ''' Load the sparse data according to the input settings Parameters ---------- conf...
254440aee3f15b739333bc1569f487ca42bc3c57618c5ee4ac8004c569858ba5
Python
10,185
278
"""Integration tests for the SAM workflow.""" from __future__ import annotations import numpy as np import pytest import scipy.sparse as sp from anndata import AnnData from samalg import SAM from samalg.exceptions import DataNotLoadedError class TestSAMInitialization: """Tests for SAM object initialization."""...
8351d9dc4c9b52a0909f98c8b68f4f9023410847ec1035429fcec085a6cb5099
Python
10,187
258
import numpy import time import warnings from spycon.spycon_result import SpikeConnectivityResult from itertools import combinations class SpikeConnectivityInference(object): """ Base class for spike connectivity inference. It will infer a fully connected graph. Args: params (dict): Dictionary wi...
73c81eb1451264f53e0d794e2278923dc2ef801ab692e4201a3c972e1a45a9be
Python
10,188
284
import gzip import os.path as op import pickle from difflib import get_close_matches from glob import glob import numpy as np import pandas as pd from gradec.fetcher import _fetch_features from sklearn.feature_extraction.text import TfidfTransformer def _extract_semantic_similarity(max_feature, ic_df, tfidf_df, freq...
56fa196d5fca2c86ac62fc299ddf32a6f3af62aad66ce1b5332a685f4cb4dbd7
Python
10,190
278
import string import numpy as np import pytest import pandas as pd import pandas._testing as tm from pandas.core.arrays.sparse import SparseArray class TestSeriesAccessor: def test_to_dense(self): ser = pd.Series([0, 1, 0, 10], dtype="Sparse[int64]") result = ser.sparse.to_dense() expect...
54fb61f06eda08f95147019fc64738d4832d02339400803212e45e32314a03a7
Python
10,193
234
# 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...
caf0bb4e9ba5aa7909e9a6cd11e92b8a2de2b683d217356b45d044d7b66359c2
Python
10,195
251
import sys import numpy as np import wormdatamodel as wormdm import wormbrain as wormb import matplotlib.pyplot as plt import os import mistofrutta as mf import pumpprobe as pp plot = True folder = sys.argv[1] if folder[-1]!="/": folder += "/" save = "--no-save" not in sys.argv sig_green = "--signal:green" in sys.arg...
c48a24b968cf4eb92d2d9a9c4e00bce36dc84bcfffa711f3ae282df0333bd11d
Python
10,197
236
#!/usr/bin/env python3 # -*- coding: utf-8 -*- #importing required libraries import torch import torch.nn as nn from torch.utils.data import TensorDataset, DataLoader import numpy as np from esmologs.ESM2_to_3Di import ESM2_to_3Di, SeqsDataset import argparse import sys import re from pathlib import Path import loggin...
f8fe87014203fbe5b3c0bc1b8db24d2faa3e3d764dabca6b96492a44f3952a5d
Python
10,208
284
import numpy as np import pytest import pandas as pd import pandas._testing as tm from pandas.core.arrays import IntervalArray @pytest.fixture( params=[ (pd.Index([0, 2, 4]), pd.Index([1, 3, 5])), (pd.Index([0.0, 1.0, 2.0]), pd.Index([1.0, 2.0, 3.0])), ( pd.timedelta_range("0 ...
01c7aeccd823fa8b32430712736a73ff2fd22eda0baab519997746559a7723d6
Python
10,216
243
# 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...
6b25939e5ce3bacdf5ad5c3a3a1ea0c485219438cb8ebcdd168079e0e6f97eea
Python
10,221
267
import numpy as np import pytest import pandas.util._test_decorators as td import pandas as pd from pandas.tests.plotting.common import ( _check_legend_labels, _check_legend_marker, _check_text_labels, ) mpl = pytest.importorskip("matplotlib") class TestFrameLegend: @pytest.mark.xfail( reas...
6b2fcc06ff8959905cdcebe1a5f35d37ffb14ddfb993e420d937eace5b0064e6
Python
10,235
274
# Copyright 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 agre...
dc557e41a7bd1a2ba0d7ce85cdbbede09cb5f0187e7b94cfa58da13b74ff0799
Python
10,235
323
""" Copyright (c) 2019 Pedro F. Proenza """ import numpy as np import math as math def euler2SO3_unreal(pitch, yaw, roll): """Convert euler angles in degrees to a rotation matrix using unreal engine order (valid)""" cos_pitch = np.cos(pitch*np.pi/180) sin_pitch = np.sin(pitch*np.pi/180) cos_yaw = np.c...
21aee167560f6c3dd3312cd6e812b158d6d99eb0997ab6f3ba6cdde5de05b887
Python
10,250
299
""" Allows us to read in real data regions randomly, and also use a mask (bed format) file so we don't use regions that are uncallable. Author: Sara Mathieson, Rebecca Riley Date: 9/27/22 """ # python imports from collections import defaultdict import h5py import numpy as np from numpy.random import default_rng import...
95de5bfefaa6769d50e78f9ae36e93938151c72d23946c7b4801b9af6f600f6a
Python
10,252
256
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Import raw data. Do initial cleaning. Run ICA and remove components correlted with EOG and ECG. Save figures in subj folder for inspection. Vinding, M. C., Eriksson, A., Low, C. M. T., Waldthaler, J., Ferreira, D., Ingvar, M., Svenningsson, P., & Lundqvist, D. (2021)...
b2af31656b169289023b22dce2b2814fb2a43535d8837e1bb499f5efff289487
Python
10,255
301
import numpy as np import pytest import pandas as pd import pandas._testing as tm from pandas.api.types import is_integer from pandas.core.arrays import IntegerArray from pandas.core.arrays.integer import ( Int8Dtype, Int32Dtype, Int64Dtype, ) @pytest.fixture(params=[pd.array, IntegerArray._from_sequence...
9c93a094bc0c6470c5194dc98ccb6224f2cc618f776ce0ec294ed7086cd1ddf4
Python
10,259
358
""" 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...
d04f234b298d26994c93db6e4de8fa0fb2e7fb7d357c36105b7c4a3153374b55
Python
10,260
269
"""Configuration for Scanpy’s Sphinx documentation.""" from __future__ import annotations import os import shutil import sys from datetime import datetime from functools import partial from importlib.metadata import version as get_version from pathlib import Path from typing import TYPE_CHECKING import matplotlib #...
273d611676cff4f8d6d6e5b1eadcb2469c4e61dc6fdccfc1945fef3a22d3f0d9
Python
10,263
296
# 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...
29722ffa8442c65355601f8622438cd64ce762c576e10d70ac3616e3a4657897
Python
10,263
287
import torch import numpy import matplotlib.pyplot as plt from src import bionetwork from src import plotting import pandas from scipy.stats import pearsonr #import pandas as pd batchSize = 1 #Load network networkList, nodeNames, modeOfAction = bionetwork.loadNetwork("data/ToyNetRecurrent-Model.txt") annotation = pan...
2145b8f473cb3d62bfba115a4424971e4a3c259870e18919fc46caaa4d576b21
Python
10,266
328
import pytest from pandas.errors import CSSWarning import pandas._testing as tm from pandas.io.formats.css import CSSResolver def assert_resolves(css, props, inherited=None): resolve = CSSResolver() actual = resolve(css, inherited=inherited) assert props == actual def assert_same_resolution(css1, css...
9c9142428dd75b7a3ff6469ff84e97f328c654b3da941ab3dca9187e28694b9c
Python
10,270
188
# 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, ...
923717e90197ac58bbf736cb29a75c91cbbd82c9717cb2b5040281836c10d20c
Python
10,275
290
from datetime import datetime import numpy as np import pytest import pandas as pd import pandas._testing as tm from pandas.core.algorithms import safe_sort def equal_contents(arr1, arr2) -> bool: """ Checks if the set of unique elements of arr1 and arr2 are equivalent. """ return frozenset(arr1) ==...
75ec13da1ea368003ea1885273a132dd0716e0e4ccf7c00f77eed9e4f287e2de
Python
10,291
295
#!/usr/bin/env python3 # Copyright 2015 Google, Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
58f246e515251828a1b95449592341faabd23fedfc3acc319a10806f102e57b6
Python
10,292
229
import os import shutil def compare(vcf_file, tool_out_path, compare_type): print(vcf_file) gz_vcf = vcf_file + '.gz' cmd_str = 'bgzip -c {0} > {1}'.format(vcf_file, gz_vcf) os.system(cmd_str) cmd_str = 'tabix -p vcf {0}'.format(gz_vcf) os.system(cmd_str) if compare_type == 'region':...
92980d93e398047309d6f55ca2050f96700f10f952a9f5dc5d8199da554e94d8
Python
10,293
279
"""Audit-log middleware — records every mutating API call. Spec § 17.4. One append-only row per POST / PATCH / PUT / DELETE against ``/api/v1/*``. Read requests + heartbeats are skipped — they're noisy and rarely forensically interesting. Design: - Middleware runs *after* auth resolution so it can read ``request.sta...
d4b85c41d35184fa1009b0340d9985f1cec214588376f6c43ae0ff491fa5eeba
Python
10,301
288
""" 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 numpy as np import sympy as sym from scipy import special as sp from scipy.optimize import brentq def Jn(r, n): """ numerica...
5aebd53a210c94113a037fc90f55232800b09917fbaa88fc26e61554604884cf
Python
10,304
235
# -*- coding: utf-8 -*- import re import numpy as np import random from sdna.sim.core import * class ErrorSimulation(object): MUTATION_MODES = ["insertion", "deletion", "mismatch"] def __init__(self, sequence, seed=None): """ Class is used to apply modifications to a sequence. :pa...
dcccea30e3d96bbe830627ac98333b7fe6189d56fa33902ad4bf2fafd83e9363
Python
10,304
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...
c90b041e07e994d0c8b3f9336632f3ddefa0c9753d57eee8c2d9e86028ed03ac
Python
10,305
290
"""Session-19 tests: failure debugger + deployment reviewer + API keys. Same fake-LLM-provider test pattern as session 17/18. API-key tests don't need the LLM; they just exercise the CRUD + hash-on-create invariant. """ from __future__ import annotations from collections.abc import Generator import pytest from fast...
826e77e64d9d8110db6cadc89328be7f0fb0d1eb46d4599a0c8a1eabbbc79e70
Python
10,306
304
import numpy as np import pytest import pandas as pd import pandas._testing as tm class TestDataFrameDiff: def test_diff_requires_integer(self): df = pd.DataFrame(np.random.default_rng(2).standard_normal((2, 2))) with pytest.raises(ValueError, match="periods must be an integer"): df.d...
3be30dcf5623be8fa7728014c7adce2081e767603e7770c514f87cff2ef870cd
Python
10,308
242
"""Schema bootstrap — the bridge between SQLite dev and Alembic-managed prod. `ensure_schema(engine, dev_auto_migrate=True)`: - If ``alembic_version`` table already exists, assume the operator is running migrations themselves → no-op. - Else if ``dev_auto_migrate`` is True (defaults to SQLite dev), call ``alembic...
703b62010ae84ace0a4bd14a4afa12e5a5187666e62cdf4a78efb827717eab6a
Python
10,310
355
from __future__ import annotations from typing import Final magic: Final = ( b"\x00\x00\x00\x00\x00\x00\x00\x00" b"\x00\x00\x00\x00\xc2\xea\x81\x60" b"\xb3\x14\x11\xcf\xbd\x92\x08\x00" b"\x09\xc7\x31\x8c\x18\x1f\x10\x11" ) align_1_checker_value: Final = b"3" align_1_offset: Final = 32 align_1_length:...
110eb5fea52d2a4b1e91f18730b637cf627cfd0f7786f255ba324becc3388665
Python
10,311
225
# 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...
8b223c250b3992bd74a6d3beef675dcf639f7ed6e5558d62888380fc475ed075
Python
10,315
324
# 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...
726b2101174e004dceaae58144adc4c196105ade278a5fd63c87de03a3bf409c
Python
10,318
280
# -*- coding: utf-8 -*- # @File name: plot_general_shutter.py # @Author: Alicia Garrido-Peña # @Date: 2023-08-09 19:40:58 # @Contact: alicia.garrido@uam.es # "Copyright (c) 2023 Alicia Garrido-Peña. All Rights Reserved." # Use of this source code is govern by GPL-3.0 license that # can be found in the LICENSE file ...
3d6184a29fbbecf3f2d664a156a68e7b156a462d368586386b9d4b9f04e2a0ed
Python
10,327
282
#python calcngramprobtoks.py ngramFile textFile from __future__ import division import math, sys, os sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'resource-gcg', 'scripts')) from model import Model,CondModel ngramfileix = 1 textfileix = 2 endofsentpunc = ['.','!','?'] #######################...
21919d274dc0fe6f04d1cbcb177db742260d3fa4d004df396d132c9b0c4ca6b3
Python
10,328
283
# 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...
7146ff02a3747211270889dbfea8037a74666219d8c531e6100a8d4970a34a77
Python
10,339
324
# 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...
cdccd687a6271d3fcd31733af7418f2e129f4d304d53809daec61995b146fcae
Python
10,339
326
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]}, ...
92f92837928af8a99bae9d519eba200fa5515969a47948f394df5c1ae8d7f9bd
Python
10,343
260
__author__ = "etseng@pacb.com" import pdb """ For Iso-Phase, selecting loci that has sufficient FL coverage to phase. INPUT: -- FLNC (fastq) -- Unique isoforms and genes (GFF), using PB.X.Y to denote gene vs isoforms relationship -- FLNC association to isoforms, (.read_stat.txt) -- Reference genome (fasta...
ec04d9d91a4c646de54b7c19dbc8bd4580efc827a5daa81ca82703321a282f94
Python
10,343
104
#! /usr/bin/env python3 # iss #159 : nhmmer reports overlapping envelopes on reverse strand # # A bug in how nhmmer sorts hits on reverse strand led to it reporting # overlapping envelopes in some situations. # # [xref SRE:2019/0531-nhmmer-iss159] import sys import os import subprocess if len(sys.argv) != 4: sys...
139ee92f665f5858da79b9e8a7c4982241e6a637fe00a8acd6f8aae4885b5871
Python
10,345
312
from __future__ import annotations import numbers from typing import ( TYPE_CHECKING, Any, Self, ) import numpy as np from pandas._config import is_nan_na from pandas._libs import ( lib, missing as libmissing, ) from pandas.errors import AbstractMethodError from pandas.util._decorators import ca...
c4e61b5b4306a687f700629dca4f551802d675a05992daa10731bbf6758f57b8
Python
10,347
198
# 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, ...
f1e23ff3c455b02464c4c7c23b69efcace7dba8d3538c0da565c6fb19375c18d
Python
10,347
290
# 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...
11ecd7770e84499272e2ef4a3c7231f22723b8fccd691f789ac0983793687cf7
Python
10,349
343
from __future__ import annotations import enum import inspect import re from contextlib import contextmanager from dataclasses import dataclass from functools import cache, cached_property, partial, wraps from importlib.metadata import distributions, requires, version from typing import TYPE_CHECKING, Literal, NamedTu...
51f146e0929ddb46482f297264267e6fa4ff9784ad320237debd45249209036b
Python
10,350
293
import torch import numpy import pandas import seaborn as sns from scipy import interpolate import matplotlib.pyplot as plt import time import plotting from scipy.stats import pearsonr def plotACondition(X, Y, Yhat, YtestHat, Ytest): plt.figure() ax1=plt.subplot(2, 2, 1) df = pandas.DataFrame.from_dict(num...
9d5253857bdfa0d62c975fd20c415d518048b3af8e1750a9b203a9220fcc849a
Python
10,353
234
# %% [markdown] # # Regularized iterative SENSE reconstruction of 2D golden angle radial data # Here we use the `~mrpro.algorithms.reconstruction.RegularizedIterativeSENSEReconstruction` class to reconstruct # undersampled images from 2D radial data. # %% tags=["hide-cell"] mystnb={"code_prompt_show": "Show download d...
4553db1b5fad1c8a2df8b79972d352fb7eb0ed5f4b296016ab1ff138bb825d5c
Python
10,358
255
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Tue Apr 21 23:45:29 2020 @author: Mehmood Ali Khan """ from sklearn import preprocessing import pandas as pd import numpy as np from keras.layers import LSTM from keras.layers import Bidirectional from keras.models import Sequential from keras....
ca4c541b805d247bb8fd0956908f1d4938dfc28da23a78bf6bc92e0cab113fd6
Python
10,360
283
from nibabel.affines import apply_affine import numpy as np from sklearn.linear_model import LinearRegression from sklearn.preprocessing import RobustScaler, StandardScaler import torch import torch.nn.functional as F from skimage.measure import label as label_connector import nibabel as nib def remove_zero(f_data, v...
c2dc2bd0cdbcc7d792e277adccb3d7a7c8a1719dd3dae968b6837c6b4035906c
Python
10,361
269
"""Session 40 — phase 5b: drain ``TimeSeriesExperiment.create_model``. Phase 5a (s39) brought TS into the native dispatcher and gave us ``_fit_state`` parity with the other tasks, but ``create_model`` still delegated to ``self._legacy.create_model`` for TS. Phase 5b drains it. What this session ships: - ``TimeSeries...
960ec3a3813d99b30b3afcdffa1dbbe9da53e3664a1f3efd871d96305844c121
Python
10,372
274
# 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...
853061a01608dd28190728f11468258f349e019a4d2f822a48fd496d7cc05fad
Python
10,373
260
import os import numpy as np import logging import glob from .gridscalars import GridScalars, saveImage from .diffeo import DiffeoParam, Diffeomorphism, Kernel from skimage.transform import resize as imresize, AffineTransform, EuclideanTransform, warp from .affineBasis import AffineBasis from scipy.ndimage.interpolatio...
c5cdacfe56d7c169940ef57b7887aead89158c5f5445df8d6b14ebbeab41e4af
Python
10,373
271
""" Tests that work on both the Python and C engines but do not have a specific classification into the other test modules. """ from io import StringIO import numpy as np import pytest from pandas.errors import Pandas4Warning import pandas as pd import pandas._testing as tm skip_pyarrow = pytest.mark.usefixtures("...
4b90afc94d28de04645d148630b8395fb5ed0d87b3978a9e4a6d270bd755c2c7
Python
10,377
297
#!/usr/bin/env python3 import json import errno import shutil import pathlib import os import sys import re import nibabel as nib import os.path as op ANAT_T1W = "58c33bcee13a50849b25879a" ANAT_T2W = "594c0325fa1d2e5a1f0beda5" DWI = "58c33c5fe13a50849b25879b" FUNC_TASK = "59b685a08e5d38b0b331ddc5" FUNC_REGRESSORS = "...
dc4fa660a570302a164f04f60d633b2a31770ee6c052abf0ae2608994560af39
Python
10,377
363
import numpy as np from pandas import ( Categorical, Index, NaT, Series, date_range, ) class IsIn: params = [ "int64", "uint64", "object", "Int64", "boolean", "bool", "datetime64[ns]", "category[object]", "category[int]",...
32e55b54b7aed990ba9a86644befb94a8e73c4bd8b322ecd4e36efe6f2b57fca
Python
10,378
239
# 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...
2d6bf23cbf42ea4bd0fb57db9f0a02568d07004fde93580931ea7170faed51ab
Python
10,384
231
import re from collections import Counter from rdkit import Chem from rdkit.Chem import AllChem from rdkit.Chem.Descriptors import HeavyAtomCount from rdkit.Chem.Scaffolds import MurckoScaffold from rdkit.Chem import rdRGroupDecomposition as rdRGD from rdkit.Chem.BRICS import FindBRICSBonds,BreakBRICSBonds import ast i...
c21523c68eb0c3a59c5e7c652403dbab59cbaacc00a13b7d64edbbcea1d2f4e7
Python
10,391
224
import io import nibabel.freesurfer.io as fs from PyQt5 import QtWidgets, QtCore import vtk from vtkmodules.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor import numpy as np class Hemisphere(QtWidgets.QWidget): sgn = QtCore.pyqtSignal(dict) camera_updated = QtCore.pyqtSignal(vtk.vtkCamera) ...
30356387c60c1e4fac022598db86fccbc7da7cd0961dc00c065970235bdcfbdd
Python
10,395
230
import argparse import os import ete3 import pandas as pd from ete3 import NCBITaxa def get_args(): """ Get arguments from command line with argparse. """ parser = argparse.ArgumentParser( prog='Convert_metaphlan3_mpa_to_kreport.py', description="""Convert a MetaPhlAn3 mpa file into kre...
b09e219f9d3ea98db7262ed19ec7611fa132f4f577f6163d2f9f55c64dd88d2b
Python
10,400
414
#funcsboot.py from placerg.funcs import * from placerg.funcsrg import * from placerg.funcsall import * from placerg.objects import * from scipy.optimize import curve_fit def bootfunc(a, env): rate=[] coeff=[] eigspec=[] var=[] psil=[] actmom=[] autocorr=[] tau=[] ...
4fe91187367a8beee6e8426cd0d41377efb4c2e5efe4a057be477ac02b9b3fac
Python
10,401
287
"""Template view.""" # ----------------------------------------------------------------------------- # Imports # ----------------------------------------------------------------------------- import logging import numpy as np from phylib.io.array import _index_of from phylib.utils import Bunch, emit from phy.plot i...
4fad022a8ae977a1f0086d152fc16caf08522bf31e78a78b73693853c61c57a8
Python
10,402
320
import numpy as np import torchvision.utils as vutils import torch, random import torch.nn.functional as F # print arguments def print_args(args): print("################################ args ################################") for k, v in args.__dict__.items(): print("{0: <10}\t{1: <30}\t{2: <20}".f...