sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
c781c2270f4ff7ec94aed77b16e4a0a29e73b11ee15f10ad4cf8ceeebdbe570a
Python
9,466
223
#!/usr/bin/env python3 import os import pickle import time import sys import numpy as np import matplotlib.pyplot as plt from scipy import interpolate import scipy.stats import tensorflow as tf import LNODEs from utilities import * # Set double precision in TensorFlow. tf.keras.backend.set_floatx('float64') # Set...
da89b8a479da3114385e895fb5e3b8d20a4754c9a125f879462c71597d4e1c84
Python
9,467
254
import numpy as np import pandas as pd from scipy import signal import copy def matriz_shifteada(features, delays): features = np.array(features).reshape(len(features), 1) nt, ndim = features.shape dstims = [] for di, d in enumerate(delays): dstim = np.zeros((nt, ndim)) if d ...
66758dc24cdd6d457f4459e32a319e07f23a025950560dbbca4da72b3e701492
Python
9,471
231
''' Contains input/output functions for clutter stimuli ''' import os import csv import time from shutil import rmtree import numpy as np from PIL import Image from scipy.io import savemat from character_mod import Character from Clutter_mod import Clutter from utils_mod import shlex_cmd, DIGITS import warnings warni...
09a8af3c3ca6899893556ded1c55a84dce6a129b66e0e127352f8bce1f95be07
Python
9,474
274
"""Testing the Template GUI.""" # ------------------------------------------------------------------------------ # Imports # ------------------------------------------------------------------------------ import logging import re import unittest from pathlib import Path import numpy as np from phylib.io.model import ...
f7a6f892a5d8a00b252d53081f17c74d49b2f939f9cc41c587537def02e867b8
Python
9,474
283
import contextlib from io import ( BytesIO, StringIO, ) import sqlite3 import sys import types import numpy as np import pytest from pandas.compat._optional import ( VERSIONS, import_optional_dependency, ) import pandas as pd import pandas._testing as tm def test_import_optional(): match = "Imp...
2aad4b0400531bc823bb88b2fded7abad0f0dfd2de91170a89d61c50f2d0eb0d
Python
9,479
270
import inspect import pydoc import numpy as np import pytest import pandas as pd import pandas._testing as tm class TestSeriesMisc: def test_tab_completion(self): # GH 9910 s = pd.Series(list("abcd")) # Series of str values should have .str but not .dt/.cat in __dir__ assert "str...
33415c9eb9fe61a644dc255dad3940b5cffa4b7a3884ebd7a3641d75c2ac6f1c
Python
9,483
268
from typing import Iterable, List, Literal, Optional, Sequence, Tuple, Union import matplotlib as mpl import numpy as np import pandas as pd import pyBigWig import tqdm from matplotlib import pyplot as plt from matplotlib.axes import Axes _signaltype = Optional[Literal["mean", "median", "min", "max", "sum", "std"]] ...
757bba6f9b9b9c5cd647c48b1888b05fe8f53b4661f62f2cd1d8f995c3fd7895
Python
9,486
285
import logging from multiprocessing import Process import os from atropos.commands.trim import ( ResultHandler, WorkerResultHandler, WriterResultHandler, ) from atropos.commands.multicore import ( Control, PendingQueue, ParallelPipelineRunner, MulticoreError, wait_on_process, enqueue...
0e6e6e039743d13ec859d885393c73902e7734b207b9c86b077f3456aab52738
Python
9,488
230
import numpy as np import random import tensorflow as tf import keras from keras.models import Sequential from keras.layers import Dense, Dropout, SpatialDropout1D from keras.layers import Activation, Flatten, Input, Masking from keras.layers import Convolution1D, MaxPooling1D from keras.utils import np_utils from ker...
07644852a5d32f48894724325aa742de4900b97484f41738e4c34eebdfe5de83
Python
9,494
177
''' This script creates json files which can be used to render Manhattan plots. ''' # NOTE: `qval` means `-log10(pvalue)` # TODO: optimize binning for fold@20 view. # - if we knew the max_qval before we started (eg, by running qq first), it would be very easy. # - at present, we set qval bin size well fo...
98478367358d429ae4596e1482528f71a5964816c4a59feeb49d83aa8504540f
Python
9,494
285
""" 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 heapq import logging from itertools import chain from pathlib import Path from typing import List, Literal, Protocol, Union, runtime_c...
5d841778fd677c37b617f385f6ef007216f33e3156473191928ec3f6adf0a277
Python
9,496
308
# 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...
f62112e85f713f1c721120cfea41944d3123c0782a3159dfb91829ef244a808b
Python
9,501
192
import os from unittest import TestCase, mock import pandas as pd import dynast.preprocessing.conversion as conversion import dynast.utils as utils from .. import mixins class TestConversion(mixins.TestMixin, TestCase): def test_read_counts(self): conversion.read_counts(self.umi_counts_path) def ...
8e6e51b8addea21d339d3f12a2a355a10b9952dac848b5b9b81b6f6c47913492
Python
9,502
321
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Mar 16 09:37:52 2023 @author: kellnere """ import os os.environ['CUDA_VISIBLE_DEVICES'] = "3" import numpy as npss import tensorflow as tf import math from tensorflow.keras import Model from tensorflow.keras import layers import matplotlib.pyplot as pl...
1c7f585ae98da0f0315bf79e349494584a4d6b8c99d2a92c05678b47d2ed698c
Python
9,503
271
import inspect import pydoc import numpy as np import pytest import pandas as pd import pandas._testing as tm class TestSeriesMisc: def test_tab_completion(self): # GH 9910 s = pd.Series(list("abcd")) # Series of str values should have .str but not .dt/.cat in __dir__ assert "str...
2fa3656896325ea676ae33c9b689f85eabc523a0cf541b73e034570417c66400
Python
9,503
196
# -*- coding: utf-8 -*- from keras.layers import * from keras.regularizers import l2 from keras.models import Model from keras import backend as K # use computable function from sklearn.metrics import roc_auc_score, accuracy_score, f1_score, precision_recall_curve import sklearn.metrics as m from layers import Aggreg...
6be55b6d5bcac5ff9f63abf2e55997ab46b3c245b9b1d55e601806c7f8e5b1a6
Python
9,503
278
from __future__ import annotations import json import numpy as np import cv2 from typing import Tuple, List import matplotlib.pyplot as plt import openpyxl as px import tifffile from SCTrack.prepare import convert_dtype class Stack(object): def __init__(self): self.start_frame = None self.end_fr...
eeb3bf3462c1d7a4ac048e47484637458c4927bd3dbd6473d6c16e73cebf27ec
Python
9,504
243
""" Creates CA1 pyramidal cell model, sets parameters, runs simulation in NEURON and shows figures. Title: main.py Author: Matus Tomko Mail: matus.tomko __at__ savba.sk """ import time from neuron import h, gui import libcell as lb import saveClass as sc import numpy as np from CA1_plasticity.io.figures_shower impo...
21bfe24080a5320ee0cf64262c34a1be603f1e671a18835d3120b1757466113e
Python
9,505
293
"""Run lifecycle integration tests. Exercises: - POST /api/v1/experiments/{id}/runs (queue a run) - GET /api/v1/experiments/{id}/runs (list) - GET /api/v1/runs/{id} (status) - POST /api/v1/runs/{id}/wait (block) - GET /api/v1/runs/{id}/events (replay) - WS /ap...
9d3f338f8822f3bffeb6c6f7d257272c764dcff26ab81fee02e77e4c28dec590
Python
9,510
253
# Copyright 2019 Image Analysis Lab, German Center for Neurodegenerative Diseases (DZNE), Bonn # # 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-...
57c25038c1fd15b6ff96d7b03a5d741f357ff0182b964891dd4b1d13a1b913ae
Python
9,514
300
# 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...
1337e744e5726bbe2c3c13558512cc6ad54da889688c7f25b8cd78104d1782a5
Python
9,515
234
"""Session 24 — god-class drain: ``create_model`` (supervised path). Supervised ``Experiment.create_model`` no longer delegates to ``self._legacy.create_model``. It resolves the estimator from the engine's model registry, runs cross-validation, refits on the full training set, and returns a **real sklearn Pipeline** (...
071ede10ac07fda32fa21971b2ef6c8157d2967a38619f8019a59711910a1734
Python
9,516
309
from typing import Optional, cast, Sequence import logging import torch import torch.nn.functional as F from ..image import Volume, Slice from ..transform import mat_transform_points # _cache: Dict = dict() # _cache_id: Tuple = tuple() BATCH_SIZE = 64 # def clean_cache(*args) -> None: # global _cache, _cache_i...
e511feec1a11a8fe3992f4ab07f308514bb0a02af6f254fde00a761c0aff8e50
Python
9,516
258
__all__ = ["MaxQuantReportParser"] import os import re from typing import Iterable, Tuple, Union import numpy as np import pandas as pd from ....chem.pep.aminoacids import AminoAcidCollection from ....chem.pep.mods import ( ModificationCollection, ModifiedSequence, ModPosition, modified_sequence_to_s...
e2ba29ec84fc775d84f01fbd2456175dd6f9df19b389c483b729523efa747ce3
Python
9,520
193
"""Compressed framing/fallback matrix; each bounded child takes about 0.5 s.""" import gzip import hashlib import json import multiprocessing import os from pathlib import Path import random import signal import subprocess import sys import pytest from conftest import macs3_env from MACS3.Utilities.Constants import ...
53e20136a8415e520089494e0537cb9eff173751ca3e1022cf1854267bbe90f8
Python
9,524
295
from typing import Optional from deepglyco.chem.common.elements import ElementCollection from deepglyco.chem.gpep.fragments import GlycanFragmentTypeCollection from deepglyco.chem.gpep.glycans import MonosaccharideCollection from deepglyco.chem.pep.aminoacids import AminoAcidCollection from deepglyco.chem.pep.fragment...
437b0e2528db1c271f18b69cf04651b6e57bd3f7e2a110a33db1f9d91deed487
Python
9,525
287
"""`pycaret-server` CLI entry point. Usage: pycaret-server init [--data-dir ./data] pycaret-server serve [--host 0.0.0.0] [--port 8020] [--reload] pycaret-server migrate [--url sqlite:///...] [--revision head] [--reset-dev] pycaret-server worker [--queues default,gpu] [--worker-id pyc-1] pycaret-se...
0d6dd3d78e817eb2476f0404ff8bcf9284004e5ae292c90996799e63e0a7b420
Python
9,527
230
# -*- coding: utf-8 -*- """ Created on Fri Oct 2 11:52:36 2020 @author: Wladek """ import numpy as np import pylab as py from mayavi import mlab from scipy.integrate import simps from joblib.parallel import Parallel, delayed def remove_points(mtrx, xpos, ypos, zpos, tp, thr): idx_to_remove = np.where(abs(mtrx[:,...
8f296589f07a2b41f2a0dd1bddf3235c3efdc65b048771778e4cab0f2f5b7f88
Python
9,530
257
# 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...
a7427cc60ef713bda4cdf53c376c1d291599ac8915a3f1a06ef75d4af5ebf211
Python
9,530
244
""" Creates CA1 pyramidal cell model, sets parameters, runs simulation in NEURON and shows figures. Title: main.py Author: Matus Tomko Mail: matus.tomko __at__ savba.sk """ import time from neuron import h, gui import libcell as lb import saveClass as sc import numpy as np from CA1_plasticity.io.figures_shower impo...
cfb4aaedaeaaee1cf64ac74ba72ca9e785f871da3997880cc2069ff7b5932a91
Python
9,537
310
import numpy as np import pytest import pandas as pd import pandas._testing as tm from pandas.tseries import offsets # suppress warnings about empty slices, as we are deliberately testing # with a 0-length Series pytestmark = pytest.mark.filterwarnings( "ignore:.*(empty slice|0 for slice).*:RuntimeWarning" ) d...
442d1c395a3883b7fa769ef40276ec0ca542ed1777a0f34f19c477eecbe96e5a
Python
9,541
218
#!/usr/bin/env python import argparse import pandas as pd from common import * def main(): parser = argparse.ArgumentParser() parser.add_argument("-i", "--input", default="-") parser.add_argument("-o", "--output") parser.add_argument( "-f", "--formats", choices=('txt', 'svg', 'pickle'), nargs="...
b9a2ea2cf25260eacea0fd925d0b144b638e727b8a66d62d0446266da633a432
Python
9,542
303
# 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...
6888f265edff82f6d2e530b547a2f6f751bacc2084bcd2b6f5247689eab794b4
Python
9,544
223
"""Phase 0: pivot Trial/Run model — Trial owns Runs, not the other way around Revision ID: f0a1b2c3d4e5 Revises: e5f6a7b8c9d0 Create Date: 2026-05-12 20:00:00.000000+00:00 The platform's mental model flips here: - Pre-Phase 0: ``Run`` owned the compare invocation; ``Trial`` was a row inside a Run's leaderboard. - ...
3460aff68411ae08ec604769057cf0d5f148cbbc8a740db5356497bc87226355
Python
9,545
260
""" 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 pathlib from argparse import ArgumentParser from collections import defaultdict from DL_reconstruction import save_reconstructions im...
e31932d655d6b4bd5d132dda9ced0a02ad3832e303f00b5894ef56f5f23a179c
Python
9,547
240
#!/usr/bin/env python3 # -*- coding: utf-8 -*- #importing required libraries import torch import torch.nn as nn #from utils import get_data, SeqsDataset from torch.utils.data import Dataset import numpy as np from torch.nn.utils.rnn import pad_sequence from esm import pretrained import esm from typing import Union, Op...
6ca97014814baef163d61ce9a10c398f05c48df47975e395602caff80468fd24
Python
9,554
262
__all__ = [ "NonRedundantSpectraProto", "NonRedundantSpectraFirstOccurrence", "NonRedundantSpectraBestScore", "NonRedundantSpectraConsensus", ] import os from typing import ( Any, Generic, Iterable, List, Optional, Protocol, TypeVar, Union, cast, ) import numpy as n...
e6783f3fc552973fd1218d4f0ef13f8819fb4ed03a6096b1cb00508de00a455f
Python
9,558
249
import os import gc import sys import traceback from typing import Set, DefaultDict, List from collections import defaultdict import ray import pydantic import rapidjson import neuronbridge.model as model # Directory to store log files LOG_DIR = "logs2" # Print debug messages on the workers DEBUG = False # Maximum...
462af9ce40d88d386db22d8783d7c4e2eb0ceb0a46bc94aa56559798d3db1d01
Python
9,559
326
""" Sequence statistical energy and mutation effect computation protocols Authors: Thomas A. Hopf Anna G. Green (complex) """ import pandas as pd import matplotlib.pyplot as plt from bokeh.io import save, output_file from evcouplings.couplings.model import ( CouplingsModel ) from evcouplings.couplings.mappin...
4720305ed3e711ca7e685432c9db187138d19b82859b783282c652645ed60a12
Python
9,559
268
#%% #Imports import numpy as np import os import matplotlib.pyplot as plt import matplotlib.animation as animation from matplotlib.gridspec import GridSpec import matplotlib.backends.backend_pdf matplotlib.rcParams['lines.linewidth'] = 0.5 matplotlib.rcParams['lines.markersize'] = 1 matplotlib.rcParams['pdf.fonttype'] ...
a12f5b421a5831a1de8a6e2df381464120995420c641ba2a1c969e73892da189
Python
9,559
257
import numpy as np import os from kcsd import csd_profile as CSD from kcsd import KCSD2D from scipy.integrate import simps from scipy.interpolate import griddata from figure_properties import * import matplotlib.pyplot as plt import matplotlib.cm as cm def integrate_2d(csd_at, true_csd, ele_pos, h, csd_lims): csd_...
2a82632c056c87b592bef706507b1c35c7c4e6cbafaf13fb56f5136e52be8d4f
Python
9,560
286
# # File to train networks built from the hnn.py class. # # This file establishes the clebsch gordan coefficients, sets up an hnn with given parameters, # loads holograms from .npy files, and then tests the network via a function call. # from argparse import ArgumentParser import logging import os import sys import ...
dfd1693291e295f2b5a20db7941928e2eeb75f4591c99b397a77e8c50087b03c
Python
9,561
252
# MIT License # # Copyright (c) 2024 EPFL Biorobotics Laboratory (BioRob). # # 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 # ...
37e041f2d5ae7050b03d58faba6cb7706da231b5c3009fa6accad70a8bd76e24
Python
9,564
244
#!/usr/bin/env python """Summarizes trimming accuracy for simulated reads.""" from argparse import ArgumentParser import csv import os from common import * # Either of these will work from editdistance import eval as editdistance #from Levenshtein import distance as editdistance summary_fields = ( "program", "pr...
81d094c35c6865a7f0319059c3dbac805b2cd449bc7ae5e8e1094cf1dd4c313b
Python
9,568
228
# 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 ...
654db2f7f11345249800e53854c1cf922b6918485eac07bbee5eeeb2b9bc1b77
Python
9,569
354
"""Test gui.""" # ------------------------------------------------------------------------------ # Imports # ------------------------------------------------------------------------------ import logging from phylib.utils import connect, emit, unconnect from pytest import raises from phy.plot import BaseCanvas from...
7e732b81d3bbad725b24c973d0b06e24c94d5077319216b8128215fe8870a2a3
Python
9,571
229
import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import ArrowStyle from pathlib import Path from typing import Optional from scipy.io.wavfile import read as wavread def render_hga_feature_computation_plot(data_snippet: np.ndarray, out_filename: Optional[Path] = None, dpi=300): fig = plt....
ecd8ef16829ce6ffa97ba1c73e4601f481b5f5436220af5359dcc052afd0c026
Python
9,572
246
# -*- coding: utf-8 -*- """ Created on Tue Feb 14 11:11:06 2023 @author: lonya """ #%% Load Data import tkinter as tk import tkinter.filedialog as fd from tkinter import messagebox import numpy as np from scipy.stats import pearsonr import pandas as pd import scipy.io as sio import my_funcs as mf import...
a9445fa5a46a8b1c5b4dd19342d742ddc32e4bf42b70c4a66048e94a1fe3c7f3
Python
9,573
180
import argparse import os import pysam import pandas as pd import seaborn as sns import matplotlib.pyplot as plt def get_args(): """ Get arguments from command line with argparse. """ parser = argparse.ArgumentParser( prog='paf-mapping-summary.py', description="""Summarize mapped read c...
8b4fae12c1f2677fb46701198ef37e5e49bcad3594d550a99a044e21658ce03a
Python
9,578
298
from __future__ import annotations from typing import ( TYPE_CHECKING, Any, Literal, overload, ) import warnings import numpy as np from pandas._libs import ( lib, missing as libmissing, ) from pandas.util._exceptions import find_stack_level from pandas.core.dtypes.cast import maybe_box_nati...
6194aa5cc899436dd7f3aa8b6d4504e0652d880a42a92a50f23d47b3b7360d9f
Python
9,584
216
# 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...
7532a6a48f33c5f0d1691f10906021f3c06158a61f7aa0b79425cf359251b78c
Python
9,584
247
# 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...
20470f00b01501705200a6c9e363c6cb292fac0d066080801517e1f5342f8fb7
Python
9,589
231
import math from pathlib import Path import numpy as np import pytest import torch from pyaging.utils._feature_ranges import get_feature_ranges, load_feature_range_registry, resolve_feature_ranges WEIGHTS_DIR = Path(__file__).resolve().parents[2] / "clocks" / "weights" def test_registry_has_schema_version_and_sect...
390022887b250f27c3741045f26d58e9615a7cbb693e651803155c029a99bb35
Python
9,601
240
#!/usr/bin/env python3 """UltraScan III conventions that neither clang-format nor clang-tidy enforce. usage: check-conventions.py [--fix] (--staged | <base-ref>) --staged check the index (pre-commit hook) <base-ref> check the worktree against <base-ref> (CI: merge-base with origin/main) --fix append a...
22371f7f2c041140de219c798fd19e0a773ac02a7046218ef938136b2d2c143b
Python
9,602
257
import pytest from pandas._libs.tslibs import to_offset from pandas._libs.tslibs.offsets import INVALID_FREQ_ERR_MSG import pandas as pd import pandas._testing as tm class TestDatetimeIndexRound: def test_round_daily(self): dti = pd.date_range("20130101 09:10:11", periods=5) result = dti.round("...
56c07e119b351861f9a5217fcbf6222d0fab7415e6ef0b0946f84b42a5d34ba6
Python
9,603
238
"""MRI/PET volume loading, frame handling, brain cropping, and resizing. Ports `process_scan` / `find_brain_bounding_box` / `resize_to_input_shape` from `Dataset_MRI.ipynb` / `Dataset_PET.ipynb` (see `docs/legacy-notebooks-inventory.md`), preserving the modality-specific Otsu tuning as an explicit, named preset rather...
f643005fa79cbf2854fcbe96fbce164e288d3c605d8edf49f1e92186ac564253
Python
9,607
340
""" Expressions ----------- Offer fast expression evaluation through numexpr """ from __future__ import annotations import operator from typing import TYPE_CHECKING import warnings import numpy as np from pandas._config.config import _global_config as config from pandas.util._exceptions import find_stack_level ...
f7a0eb6a774c87ed2f2c6e67a9e4f97a51f4d7df124838d0093d00b00231aac2
Python
9,607
256
"""This script creates a summary of the residual autocorrelation.""" import os import h5py import matplotlib.pyplot as plt import mne import numpy as np import osl import sails import lemon_plotting from glm_config import cfg from lemon_support import (get_eeg_data, lemon_make_bads_regressor, ...
b0a8ddc7495656b6846390a4a211222d9e2d624cf86622b14c5d4b017f7ebbee
Python
9,608
263
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 3 00:51:46 2023 @author: s205272 """ import numpy as np def normalize_mi_ma(x, mi, ma, clip=False, eps=1e-20, dtype=np.float32): if dtype is not None: x = x.astype(dtype,copy=False) mi = dtype(mi) if np.isscalar(mi) else mi...
df2c25e1d9753a0e28684bbe3075f5fd94f2cc395f5077891020aba0b46cd1c5
Python
9,608
269
# 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...
d591a66c4dd5bec9788afcb8c00e771bc331e7c0b550afc92688516057a45a3f
Python
9,609
264
from sklearn.linear_model import BayesianRidge, ARDRegression from sklearn.gaussian_process import GaussianProcessRegressor from sklearn.gaussian_process.kernels import DotProduct, RBF from sklearn.compose import ColumnTransformer, make_column_selector, make_column_transformer from sklearn.svm import LinearSVR from skl...
fe152aa96b7fea3c285e709efa89ee1ae1ae52587006da28a2e633dc5f314272
Python
9,610
257
# 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...
8f6021565e44e3be80649c3efb93831a24c23c1edfdde8a587c1ef583ae78451
Python
9,613
266
# 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...
846b93a19a613f9c71b00a3cb4ae0ddd83d69695d38b80f7bf2e78d88a3d4dcc
Python
9,614
320
import numpy as np import pytest import pandas as pd import pandas._testing as tm from pandas.tests.copy_view.util import get_array def index_view(index_data): df = pd.DataFrame({"a": index_data, "b": 1.5}) view = df[:] df = df.set_index("a", drop=True) idx = df.index # df = None return idx, ...
303fd03120e43db878e03bf308c32bc60ff2c74cd4ffe24c1ab40e71927bd78e
Python
9,615
260
# -*- coding: utf-8 -*- """ Created on Thu Mar 10 16:05:07 2022 1:1 copied implementation from the MATLAB reference implementation found at https://github.com/YunzheLiu/TDLM results of both functions are bit wise equivalent @author: Simon """ import math import numpy as np def uperms_MATLAB(*args, **kwargs): ...
37c9ef189a2b0f7f12f98e584d3218a8433e3d00acc9327d79e04fb744d1c265
Python
9,615
270
import sys import io import numpy as np import pandas as pd def get_run(x): print(x) trial_start = x.TRIAL_START_TIME starts = sorted(list(trial_start.unique())) run = trial_start.apply(lambda x, starts=starts: starts.index(x)) out = pandas.DataFrame({'run': run}, index=x.index) return out de...
3636212be7246379cd13b9a0b5e24afd7a62a6d481bf8aec82969eda44a3073b
Python
9,618
254
"""pickle compat""" from __future__ import annotations import pickle from typing import ( TYPE_CHECKING, Any, ) import warnings from pandas.compat import pickle_compat from pandas.util._decorators import set_module from pandas.io.common import get_handle if TYPE_CHECKING: from pandas._typing import ( ...
37b95bb99c09f1ecf23bb21c0b7efef2061a8c90609918740ec589e43152ecaa
Python
9,624
310
"""Scheduled-job CRUD. Routes (under ``/api/v1``): GET /workspaces/{ws_id}/schedules POST /workspaces/{ws_id}/schedules GET /schedules/{id} PATCH /schedules/{id} (toggle enabled, update cron, update spec) DELETE /schedules/{id} POST /schedules/{id}/run-now (fire the handler immediately, o...
90e65307c9c5aad78646e40743c1b8da24637adca4ea5a34cfeb1318012ef1b1
Python
9,633
256
from collections import OrderedDict import numpy as np import pytest from pandas.errors import Pandas4Warning import pandas as pd import pandas._testing as tm class TestFromDict: # Note: these tests are specific to the from_dict method, not for # passing dictionaries to DataFrame.__init__ def test_co...
4945037d2bc2d1d047fbbf62b9662b41e02ad26fa93206baa4348a8a947b8e4b
Python
9,639
326
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu May 16 13:50:07 2019 @author: loading """ import numpy as np import os import shutil import math def getBundleNames( bundlefile ): #get center names from bundle file ns = dict() exec(open( bundlefile).read(),None, ns) bunlist = ns[ 'attribut...
8af42aaa068e373a5406fc6bee5cc1521670d54fea607b71c695e1dc87f47203
Python
9,643
288
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...
15a42a35a2ade28ec4afafae5ec2572058c71fef5780a8d58271087a784c44e4
Python
9,651
300
# 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...
44e3ca38b6430d29d6cbf0e14e703739e5dd653685c3cd9c824ffe1935b37a19
Python
9,657
277
__all__ = [ "PeptideMS2Data", "PeptideMS2DataBatch", "PeptideMS2DataConverter", "PeptideMS2Dataset", "unbatch_peptide_fragment_intensity", "PeptideMS2OutputConverter", ] import itertools from typing import Any, List, NamedTuple, Optional, Tuple, Union, overload import numpy as np import torch ...
638a68683b1e338aa0d2174e92d7a669a27a8df0a7853ff07ba524912b4b22df
Python
9,657
264
"""Session 42 — phase 5c (cont.): drain ``TimeSeriesExperiment.compare_models``. Phase 5b (s40) drained ``create_model``; phase 5c (s41) drained ``predict_model``. This session drains the third TS verb. ``exp.compare_models()`` no longer touches ``self._legacy.compare_models`` — it iterates the sktime registry, calls ...
251ee4a3ce4b780a8e38477aec9f8852a2d9227be6b6fdf14bbd893c535de27a
Python
9,658
276
# 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...
d4211423fda4db0d3352f24f72936d337418d4990c50e8c45b887b7e86c0bce2
Python
9,659
282
"""Test of filter functionalities""" import copy import pathlib import tempfile import dclab import numpy as np from PyQt6 import QtCore, QtWidgets from PyQt6.QtCore import QEventLoop from shapeout2.gui.main import ShapeOut2 from shapeout2 import session import pytest data_path = pathlib.Path(__file__).parent / "da...
28ab15e0643351796db4aec1af70741e89ffbb8fe127e3ad184bc0cb6351445c
Python
9,663
250
# 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...
fa76b09496cf374f65cb1b92a72ffd5b06324818f96e6b897db672f88938147b
Python
9,663
289
""" 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 math from math import pi as PI from typing import List import numpy as np import torch import torch.nn as nn from scipy.special impor...
b048d8e9a4ca63d6d23c12ed9a9f7567d8a86c168b0dd5215e8470ed9f0fab67
Python
9,677
242
"""Session 35 — drain ``self._legacy.setup()`` for the simple supervised case. The biggest remaining drain target. When the user passes a basic classification or regression experiment with no complex preprocessing flags (``normalize`` / ``transformation`` / ``remove_outliers`` / ``feature_selection``) and no extra ``s...
66d200b8f1ec1984ebd71f1c5ebada4d0e83d32b525026d99d7101498410aa7c
Python
9,678
214
from Environment_ui import * from PySide2.QtWidgets import QWidget, QFileDialog, QTextBrowser, QPushButton, QMessageBox from PySide2.QtUiTools import QUiLoader from PySide2.QtCore import Signal, QObject from threading import Thread from concurrent.futures import ThreadPoolExecutor from pages.Data_preprocessing.cutting ...
191b6a6015767277f78c15eb9b52ac025d6945889dc7e7951ecaad2391e9c0eb
Python
9,679
270
"""orc compat""" from __future__ import annotations import io from typing import ( TYPE_CHECKING, Any, Literal, ) from pandas._libs import lib from pandas.compat._optional import import_optional_dependency from pandas.util._decorators import set_module from pandas.util._validators import check_dtype_back...
98ddfd74990ff57379bc6f30a12436f79523c59f70d0bff7ef2b899edbb70797
Python
9,679
213
"""Regression tests for a batch of critical fixes: runner CLI on py3.12+, max_frames/max_steps handling, LR scheduling, and checkpoint save/restore round-trips.""" import os import subprocess import sys import tempfile import pytest import torch import yaml REPO = os.path.dirname(os.path.dirname(os.path.abspath(__fil...
6c34adeeb8e2bc650611de59a9aedc345739261900e4d4ecbbbffd98e4acb73a
Python
9,688
246
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- """Prepare an external binset so refinement and gap filling can resume. The historical ``-r`` route called outlier removal and ignored ``--module``. Later stages still expect the checkpoint and list files produced by a normal autobinning run. This module creates those fi...
df02a79c6b77090e05601c58c2bf5e5f439da0fca32db8481b4a767102a61787
Python
9,690
320
# 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...
1829c4ab788f3c8e7764415edb9f40f23b3dbc590fbeac33bdf495fa46d3edb4
Python
9,694
247
""" Creates CA1 pyramidal cell model, sets parameters, runs simulation in NEURON and shows figures. Title: main.py Author: Matus Tomko Mail: matus.tomko __at__ savba.sk """ import time from neuron import h, gui import libcell as lb import saveClass as sc import numpy as np from CA1_plasticity.io.figures_shower impo...
72bb17b054de13ef4e84591b056765de60e900ee63cb99fe5ec915239630c0a2
Python
9,695
291
from . import utils from .utils import PheWebError from . import conf #import sys import itertools from collections import OrderedDict,Counter import typing as ty from typing import Dict,Any def scientific_int(s:str) -> int: '''like int(s) but accepts "1.23e2" == 123''' try: return int(s) except ...
cb9dea4420ed01ef79bd703caea7be62e629e8e4a490f87f1e0182975d42b62f
Python
9,695
254
"""Bounded public FRAG EOF regressions for #765 / #757 item 7.""" import gzip import struct import subprocess import sys import zlib import pytest from conftest import macs3_env def write_frag(path, data, encoding): if encoding == "plain": path.write_bytes(data) elif encoding == "gzip": path...
055730808d1b747e983f2946901809d681fe8c6dadda52b0a36219d187cc1503
Python
9,697
183
import sys sys.path.insert(1, '/media/sda/Anna/brain_age') import os import pandas as pd from HDBET.HD_BET.run import run_hd_bet os.environ["CUDA_VISIBLE_DEVICES"] = "0" dataset_dict_metadata = { #'wu1200':"/media/sda/Anna/brain_age/pytorch/data/datasets/Dataset_WU1200.csv",} #'ABCD_2023': "/media/sda/Anna/b...
0dea473d59e1b68c57d0f6051a6648fc66cb5dbd8045972d7801bbe6a9411f0e
Python
9,701
233
"""Compose the Greedy logo from a real greedy registration (see make_logo.sh), in the same bookshelf layout as the Convert3D logo: the moving image, the moving image resampled through the warp at several points of the optimization (with the warped grid drawn on it), and the fixed image.""" import sys import numpy as np...
02bb4c2b2cc9808fa87178240bf9fc69cadb8037017379bcc0222ae36294068d
Python
9,705
273
from aigarmic.plate import Plate, PlateSet, plate_set_from_dir from tests.conftest import (DRUG_NAME, MIN_CONCENTRATION, MAX_CONCENTRATION, TARGET_MIC_CSV, MIC_PLATES_PATH, basic_p...
4e8e3f6bd784d207ed318fa7ea5e17d078beaeaca771cb6771f2feb18718cf72
Python
9,708
272
# 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...
c272a8cbd1fff0ec51b03717a78233b5b4f0c5cd889c5e41791e53544cd5949a
Python
9,708
289
import functools import os import numpy as np import pandas as pd import torch from pymatgen.core.composition import Composition from torch.utils.data import Dataset from roost.core_pretrain import Featurizer class CompositionData(Dataset): """ The CompositionData dataset is a wrapper for a dataset data poi...
00ace190f6ac48097055b71469ad25f035574f3b5dbaeff56c37da3a5732e279
Python
9,713
274
from datetime import datetime import zoneinfo import numpy as np import pytest import pandas as pd import pandas._testing as tm class TestInsert: @pytest.mark.parametrize( "null", [None, np.nan, np.datetime64("NaT", "ns"), pd.NaT, pd.NA] ) @pytest.mark.parametrize("tz", [None, "UTC", "US/Eastern...
ef2dcbae7cef7b64771484cfd00d92dd130400053c88478c35a0032ef6b91bb1
Python
9,715
267
# An example cifar-10/100-p evaluation script; some imports may not work out-of-the-box # -*- coding: utf-8 -*- import numpy as np import os import argparse import time import torch import torch.nn as nn import torch.backends.cudnn as cudnn import torchvision.transforms as trn import torchvision.datasets as dset import...
0b18b19931bab2f8118f87d56a0a52b6e30f75c4f78e7b1ba3e7eff677fe2b7c
Python
9,716
287
"""Miscellaneous functions used for analyses.""" import logging import multiprocessing as mp import os import nibabel as nib import numpy as np from neuromaps.datasets import fetch_atlas from nibabel.gifti import GiftiDataArray from scipy.cluster.hierarchy import leaves_list, linkage, optimal_leaf_ordering from sklea...
efe00ce50be9fa95e8684ec0cbde8780afa91c612d50741dc7c97565d859a68b
Python
9,725
239
"""Test nimare.meta.kernel (CBMA kernel estimators).""" import shutil import nibabel as nib import numpy as np import pytest from scipy.ndimage.measurements import center_of_mass import nimare from nimare import extract from nimare.dataset import Dataset from nimare.meta import MKDADensity, kernel from nimare.utils i...
b8ba53f8284ed4725269077be1e31afe1660cc90229a172ccbe6d559f636b791
Python
9,731
239
"""Test the predictions module.""" import copy from unittest.mock import MagicMock, patch import pandas as pd import pytest from omegaconf import OmegaConf from lightning_pose.losses import get_loss_factories from lightning_pose.models import get_model from lightning_pose.utils.predictions import make_dlc_pandas_ind...
28248922e0d5d1796fea2b31d3f6aac103d81f8346df4bc5ce70cc0ba4a5fc33
Python
9,734
268
"""TabNet self-supervised pretraining for SIMS. This module provides :class:`SIMSPretrainer`, a Lightning module that runs TabNet self-supervised pretraining (random feature obfuscation + reconstruction loss, as described in section 3.4 of the original TabNet paper). The encoder learned during pretraining can be trans...
7ef1a448a6801256ef35d0f68b957726eac40e64d365922dc68ed8995a70df48
Python
9,734
299
import numpy as np from scipy.ndimage.filters import gaussian_filter1d, gaussian_filter from scipy.ndimage import correlate from skimage import exposure import tensorflow as tf def threshold_detect(signal, threshold): thresh_signal = signal > threshold thresh_signal[1:][thresh_signal[:-1] & thresh_sign...
7d9ae476cd10eaaabff66510f8d130fbea59b5ac5fbd0da4128b18cd3e97e101
Python
9,737
170
import numpy as np import os import sklearn from sklearn import metrics import time from time import perf_counter import matplotlib.pyplot as plt import matplotlib matplotlib.use('Agg') from functions_OC import list_files_in_folder, create_save_dir # The code can require changes if not the same format of folder names i...