sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
109a733ee3454f49c931dbc259a63971a56fc3a3efbcbf0b5051813f41ff01e3 | Python | 13,105 | 382 | """Common classes/functions used in commands.
"""
from collections.abc import Sequence
import copy
import platform
import sys
from atropos import __version__, AtroposError
from atropos.adapters import AdapterCache
from atropos.io.seqio import open_reader, sra_reader
from atropos.util import MergingDict, Const, Summariz... |
fcd967363bf7b6bfed5e971b052d1f47e2e263f76b8a6940ca3c0d3296e54576 | Python | 13,120 | 431 | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 9 15:16:09 2023
Convolutional Spiking Neural Networks for Intent Detection Based on Anticipatory
Brain Potentials Using Electroencephalogram
Authors: Nathan Lutes, V. S. S. Nadendla, K. Krishnamurthy
"""
import glob
import numpy as np
from torch import from_numpy, is_te... |
7736019c1eaef43238ac87c2e132a04ba34cb646d57b831119fc4357cf7cf46d | Python | 13,122 | 410 | """
self-contained to write legacy storage pickle files
To use this script. Create an environment where you want
generate pickles, say its for 0.20.3, with your pandas clone
in ~/pandas
. activate pandas_0.20.3
cd ~/pandas/pandas
$ python -m tests.io.generate_legacy_storage_files \
tests/io/data/legacy_pickle/0.... |
bf5533858cf87816765a934a92dfd4facd44e68250e2b319e06b0474001a49fb | Python | 13,124 | 335 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 16 14:31:52 2022
Inferential statistic on behaviour in ephys group
@author: vman
"""
#%% Import modules
from matplotlib import pyplot as plt
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Arial']})
rc('text', usetex=F... |
b97d5369c2051c0cee38ab3047324af8d3420743a73a425d623d225176653ae6 | Python | 13,125 | 388 | # 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... |
1f12f3a6512f72905984fc968f3db9d65030adfe321c730c4d33a8826826c76c | Python | 13,130 | 305 | # 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... |
4caf50d8a0bcb31892aed624825c639976ee944e1b9bc6920eb673d53d4dca4b | Python | 13,131 | 350 | """Methods for decoding unthresholded brain maps into text."""
import inspect
import logging
import numpy as np
import pandas as pd
from nilearn._utils import load_niimg
from nilearn.masking import apply_mask
from .. import references
from ..base import Decoder
from ..due import due
from ..meta.cbma.base import CBMAE... |
e34276dcda9bc01384d2d65206e4d868cc4d2902f120a065c8584d8b34fdc984 | Python | 13,133 | 264 | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 15 22:22:41 2021
@author: Wladek
"""
import numpy as np
import pylab as py
from scipy.signal import filtfilt, butter, detrend, argrelmax, argrelmin
from scipy.stats import pearsonr
from kcsd import oKCSD3D
from mayavi import mlab
from basicfunc import model_data
import ... |
5b63f2384efd85f42f24fa61baedf0becaa9a1987564e1bbc2a1c3c799f77b79 | Python | 13,142 | 455 | # Vendored from https://github.com/pypa/packaging/blob/main/src/packaging/_structures.py
# and https://github.com/pypa/packaging/blob/main/src/packaging/version.py
# changeset 24e5350b2ff3c5c7a36676c2af5f2cb39fd1baf8
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License... |
ea43030f4236dba32bac11f1a5684f67ef1ed9631ec2c8c7fbbd7ccae9521492 | Python | 13,148 | 411 | import numpy as np
import pytest
from pandas.errors import (
Pandas4Warning,
UnsupportedFunctionCall,
)
import pandas.util._test_decorators as td
import pandas as pd
import pandas._testing as tm
@pytest.fixture(
params=[np.int32, np.int64, np.float32, np.float64, "Int64", "Float64"],
ids=["np.int32"... |
25f8795bdcd046e5f307ccddc94ae3532fec7a436b74caedb88ff08a3c2e807b | Python | 13,169 | 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 ... |
42f5d5988718aa71bafb61231f02432c7bf899dff3556e691fb064dcf2f28f81 | Python | 13,174 | 180 | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 8 10:46:34 2024
@author: nrq2
"""
import matplotlib
matplotlib.use("Agg")
from scenicplus.networks import *
import networkx as nx
### create function for plotting
import matplotlib.pyplot as plt
def plot_networkx_save(G, pos, saveName):
nx.draw_net... |
f2645e7c60582f197e898831e6bfbdff052b13034d2b6703570af7019bf95677 | Python | 13,176 | 393 | # 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... |
5edba994115f4967453c858eaca571b739a691f73d5b5ccdae98d98b5988f6f9 | Python | 13,180 | 410 | """
Tests the TextReader class in parsers.pyx, which
is integral to the C engine in parsers.py
"""
from io import (
BytesIO,
StringIO,
)
from typing import Any
import numpy as np
import pytest
import pandas._libs.parsers as parser
from pandas._libs.parsers import TextReader
from pandas.errors import ParserWa... |
b555dfbdb0b8fbc97fb654281e8cd2207e01eedb4c561245d93d1a67f7621253 | Python | 13,191 | 358 | import os
import numpy as np
import torch
class SyntheticDataset(torch.utils.data.Dataset):
def __init__(
self,
nr_image_features,
split="train",
missing_mode="debug",
infinite_flag=False,
model_random_state=0,
dataset_size=None,
missing_factor=Non... |
68513e4aa173c7e39f291506a713c036bb2369bd004b693db6df92ef5a8d2039 | Python | 13,195 | 325 | import importlib
from pathlib import Path
import numpy as np
from PyQt5 import QtCore, QtWidgets
from kilosort.io import (
RecordingExtractorAsArray, BinaryRWFile, spikeinterface_to_binary, load_probe
)
from kilosort.gui.logger import setup_logger
logger = setup_logger(__name__)
# TODO: Add others after test... |
3b3844873767dcadff0ba37a8a955cfa4f646ab5f81edd8d72908ba348419140 | Python | 13,209 | 377 | from functools import partial
import re
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.api.types import is_extension_array_dtype
dtypes = [
"int64",
"Int64",
{"A": "int64", "B": "Int64"},
]
@pytest.mark.parametrize("dtype", dtypes)
def test_unary_unary(dty... |
2fdb22c64bf434e931cb40862bd6e55e05d43e3d36ded836f3c8b5c0c4114160 | Python | 13,221 | 405 | from copy import deepcopy
import inspect
import pydoc
import numpy as np
import pytest
from pandas._config import using_string_dtype
from pandas._config.config import option_context
from pandas.compat import HAS_PYARROW
import pandas as pd
import pandas._testing as tm
class TestDataFrameMisc:
def test_getitem... |
2547a7864585423a9f6cd98457fe909b7ca030498eb1a2f9ade73cac01acb2bc | Python | 13,222 | 367 | # cython: language_level=3
# Time-stamp: <2024-10-15 11:25:35 Tao Liu>
"""Module Description: functions to find maxima minima or smooth the
signal tracks.
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD License (see the file LICENSE included with
the distribution).
"""
... |
f95af6bc2d531668a0e2ffc7cac89b834a30a600b001e693e75443bad9ecda55 | Python | 13,225 | 311 | #%%
import glob
import matplotlib.pyplot as plt
import os
from utils.dataset import gen_materials, get_sources, gen_settings, output_process
import openmc
digits = 10
def gen_materials_geometry_tallies(use_panels, panel_density):
panel, insulator, outer = gen_materials(panel_density)
min_x = openmc.XPlane(x0=... |
c4451c253d40823058eba55f89cec90839c2be3052036ccf622b6b3b2a46027a | Python | 13,229 | 424 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Functions related to training and evaluating time-series forecasting networks
@author: jeanbaptiste
"""
import os
import json
import pickle
import numpy as np
from tensorflow.keras.callbacks import Callback, ModelCheckpoint, EarlyStopping
import matplotlib.pyplot as ... |
cbf4f6cef849e5d78514a71b24366bed755027bb683d67e7a637d296ac21f2e0 | Python | 13,237 | 366 | """Correlogram view."""
# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
import logging
import numpy as np
from phylib.io.array import _clip
from phylib.utils import Bunch, connect, emit
from ph... |
da3cf127c8c9a1b4618108c50661fa66594e4e2661220c43834b9013609e7e78 | Python | 13,239 | 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... |
7ca210ed30afb05a0c6a7d4ef489fc6122f7210cf2b9d90a8094ab0ed8af5c63 | Python | 13,244 | 250 |
from ..utils import chrom_order, chrom_order_list, chrom_aliases, PheWebError
from .. import parse_utils
from .. import conf
from ..file_utils import read_maybe_gzip
from .load_utils import get_maf
import itertools
import re
import boltons.iterutils
class PhenoReader:
'''
Reads variants (in order) and other... |
d11f31f30009fd6fb8d533661adee31bbc2f57c1d6fe06ee64626a15cdc46cb8 | Python | 13,259 | 335 | import time
import os
import torch
import random
from torch.utils.data import DataLoader
from torch.optim import lr_scheduler
from tqdm import tqdm
import sys
import datetime
import numpy as np
import op_dataset as dataset
import utils.image_transforms as image_transforms
from utils.loss_function import Dice_Loss, CE_D... |
3314f46a882fc3fc199e6da2cf9a83cda35f6a40645882e71082ad1d957e5750 | Python | 13,262 | 369 | from pkg_resources import resource_filename
from functools import lru_cache
import langcodes
import msgpack
import gzip
import itertools
import pathlib
import random
import logging
import math
from .tokens import tokenize, simple_tokenize, lossy_tokenize
from .language_info import get_language_info
logger = logging.g... |
4280de392c93c8323c76f59baf7d5c14dd2ddc8a4c9b0201be1f730c52945d97 | Python | 13,272 | 378 | # 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... |
09aca5ae09f3da86a196d5458e780abdc4078ae7cda3566f425b66c3ded8b0fe | Python | 13,273 | 351 | # 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... |
a3d00acb2da546be878c8ec93258b078eed8e54eca2f35d5663c0b54fdc28f10 | Python | 13,274 | 351 | """Multi-GPU gradient sync: DDP-vs-flat-allreduce gradient parity on a real
2-process gloo group, the unused-value-head (0-coef term) config, and the
state_dict invariance of the lazily created DDP wrapper."""
import os
import pytest
import torch
import torch.nn as nn
from rl_games.algos_torch.torch_ext import wrap_... |
7dc35c4f5105c4484eb9bdc7c8f36a9b8c04474bec34a2aa21194726f5a17e1e | Python | 13,275 | 381 | """
Tests for the following offsets:
- Week
- WeekOfMonth
- LastWeekOfMonth
"""
from __future__ import annotations
from datetime import (
datetime,
timedelta,
)
import numpy as np
import pytest
from pandas._libs.tslibs import (
Timestamp,
iNaT,
)
from pandas._libs.tslibs.offsets import (
Day,
... |
d550a3cda9a5ae5d25c101cb7ecee5324f0e460c7dba465cfe55e38ab6e2db7d | Python | 13,291 | 374 | from vimba import *
import time
import cv2
import os
import ms5837 #trykksensor m integrert tempsensor
import tsys01 #temperatursensor
import numpy as np
from datetime import datetime
from seabreeze.spectrometers import Spectrometer, list_devices
import threading
import queue
import socket
import signal
im... |
034e5d7130d6a7b7df6bcb4d88b4d255db4cf625024ec980d4c4a6ea5af7a6ec | Python | 13,293 | 376 | #!/usr/bin/env python3
"""
Check pandas required and optional dependencies are synced across:
pixi.toml
pandas/compat/_optional.py
pyproject.toml
environment.yml
TODO: doc/source/getting_started/install.rst
This is meant to be run as a pre-commit hook - to run it manually, you can do:
pre-commit run validate-mi... |
49921fbf9fceae1dc8814ff440a046eac852e7d26e90a30f816d53f73121b302 | Python | 13,293 | 403 |
import os
import torch
import pickle
import matplotlib.pyplot as plt
import matplotlib as mpl
load_dir = '/Users/elizabethnewman/Desktop/tnn_results/mnist_full2/tensor/'
subdir_names = []
for subdir_name in os.listdir(load_dir):
if subdir_name == '.DS_Store':
continue
subdir_names.append(subdir_name)... |
8bf709f951a6df86361ab48ecf5b750b0876b1daaaef006dabbe01d31da51aa6 | Python | 13,297 | 480 | # -*- coding: utf-8 -*-
"""
Code to train an RNN on the supervised audiovisual correspondence (SAVC) task
with audiovisual CNN feature embeddings.
"""
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import datetime
import tensorflow as tf
from pathlib import Path
import pandas as pd
import yaml
from functools imp... |
82d97d0f308703dc891d3aaa80aed180087d815abefefb9a757130bb8ab2dea2 | Python | 13,307 | 487 | # -*- coding: utf-8 -*-
"""
This module contains the definition of the Platform object, which is the core
of the microscope package. It coordinates hardware to perform high-level
operations between the microscope, the DMD, and the Arduinos.
"""
import time
import cv2
import numpy as np
from pycromanager import Bridge... |
a1f02f31e19bdd6ba1b46ee2005d6d84d275521e8e1dd6829b26d3e8d54a7a59 | Python | 13,307 | 350 | """White Matter Tract Segmentation as Multiple Linear Assignment
Problems (LAPs).
"""
import numpy as np
from dissimilarity import compute_dissimilarity, dissimilarity
from dipy.tracking.distances import bundles_distances_mam
from sklearn.neighbors import KDTree
from nibabel import trackvis
from dipy.tracking.utils im... |
5040841b6a17fd005c0a0db5025f6d8ebeafd9a2239ed1788039ca0e3a66f294 | Python | 13,309 | 305 | """Tests for the PBT (Population-Based Training) module: mutation, checkpoint
save/load/cleanup, config, observer plumbing. All CPU, no training runs."""
import os
import random
import types
import pytest
import torch
import yaml
from rl_games.common.pbt import PbtAlgoObserver, PbtCfg, MultiObserver, mutate
from rl_... |
bbd51803645136e0d2bc5ac21af0c9744a5b449e362777a14ebf553b00a84d7b | Python | 13,309 | 249 | # -*- coding: utf-8 -*-
import torch
from ignite.handlers.param_scheduler import create_lr_scheduler_with_warmup
import sdna.net.functional as func
from sdna.net.core import *
class Net(object):
def __init__(self, arguments, load):
"""
Class is used to control the models.
:param load: Wh... |
8d93c501eae80b11f35797068e666451509e44ede763a9e238aa9375938d454b | Python | 13,317 | 397 | import ast
import os
from itertools import groupby
import numpy as np
import pandas as pd
import torch
from pymatgen.core.structure import Structure
from torch.utils.data import Dataset
from roost.core import Featurizer
class CrystalGraphData(Dataset):
def __init__(
self,
data_path,
fea_... |
552718fa1d83c4a844fd08602b709a5bd432aa54856cd658a424e59e00437d8b | Python | 13,328 | 363 | # -*- coding: utf-8 -*-
"""
Requires python 3
The main() function at the bottom of this file can run from an
interpreter, or, the helper functions can be imported into a
new module or Jupyter notebook (an example is included).
Simple helper functions and python dictionary demonstrating
how to read and manipu... |
5a9a62d284e35ec49acdcf5315d91ec46587a47e6e34f393a180da8c479cbb0f | Python | 13,329 | 364 | # 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... |
1648bc503dd3aa82f88a2238e4b2bab8a1aa70aaac70422caa6b3dffebdeeafc | Python | 13,333 | 303 | #!/usr/bin/env python
import argparse
import subprocess
import sys
import os
import gzip
import io
import itertools
import time
import json
import collections
import pickle
from Bio.SeqIO.QualityIO import FastqGeneralIterator
#import barcode_to_well
#import barcode_constants as bc
READ_BUFFER_SIZE = ... |
11da3392fe18d4538d761e8ef2c8ec8921b4941324ef3bf0e5d0485898626dba | Python | 13,337 | 374 | # 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... |
ce6c5c4529b51fa247107376765555acc69b798b794c5eb3cb6857f85a372d2d | Python | 13,339 | 284 | # Imports from brain2brain_sync module
from brain2brain_sync import EEG, bispec, timer, Graph
# Imports for multiprocessing and board shim connection
from multiprocessing import Process, Value, Manager, Array, Queue, Event, Lock
from brainflow.board_shim import BoardIds, BoardShim
# Imports for folders creation and d... |
51008f7ab002ad10044f04ba68cca32993d49c30581acb346110abe1923fdbb3 | Python | 13,341 | 343 | from Environment import *
from medpy import metric
from scipy.ndimage import zoom
from torch.autograd import Variable
class DiceLoss(nn.Module):
def __init__(self, n_classes):
super(DiceLoss, self).__init__()
self.n_classes = n_classes
def _one_hot_encoder(self, input_tensor):
tensor_l... |
8bf21d7081fe8de171dc9362d56c7604e387a6042719fbccafba33b853e9a076 | Python | 13,344 | 370 | import numpy as np
import pandas as pd
import random
import re
import pickle
from rdkit import Chem
import sys
import time
import torch
from torch.utils.data import Dataset
from .utils import Variable
class Vocabulary(object):
"""A class for handling encoding/decoding from SMILES to an array of indices"""
d... |
49d965599c9b14a9dacab86f299cf8b983bcfd541c5e83ea7b3233f6a9a59bec | Python | 13,352 | 337 | # 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... |
62fcf93deb31f5d12ab8ef7e64a846d4ebfb5364c44c5749eaf9696da8159045 | Python | 13,353 | 479 | from __future__ import annotations
import random
from typing import TYPE_CHECKING
import matplotlib as mpl
import numpy as np
from pandas.core.dtypes.missing import notna
from pandas.io.formats.printing import pprint_thing
from pandas.plotting._matplotlib.style import get_standard_colors
from pandas.plotting._matpl... |
7622de6ee22d0e62b27d3b429d58d59e49a6a1ec7463aae5b21127fbffacb590 | Python | 13,359 | 369 | """
@author: mbejtka
"""
import os
import numpy as np
from figure_properties import *
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import scipy
import targeted_basis as tb
__abs_file__ = os.path.abspath(__file__)
def set_axis(ax, letter=None):
"""
Formats the plot's caption.
... |
32cfd32c65fc2c0fbdc92376c44c4235770466ee22c7977e06de83d060aecd2b | Python | 13,366 | 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 ... |
06d927f396953a7d2a8212eb4a37872e0278bc2b5798fb4a9501229d4655432a | Python | 13,368 | 340 | from __future__ import absolute_import
from keras import backend as K
from keras.callbacks import Callback
from keras.models import Model
from keras.layers import Dense
from keras.utils import np_utils
import numpy as np
###################################################################
# For Abstention Model
... |
26adff82478a8b97a7114bfc3d9cfb0ef808e52b068ca079d55f287a65e05f5b | Python | 13,376 | 293 | """Adaptive scheduling can measure the Adam step separately from rollout drift."""
import pytest
import torch
from tests.test_ppo_masking import make_ppo_agent, _rollout_batch
from tests.test_sac_correctness import SameStepFakeVecEnv, StaggeredFakeNextStepVecEnv
@pytest.fixture
def prepared_agent():
created = [... |
d9253895c7b8e583be3c06a94dd849bc1ae5883e8d7382507adf176514cbf132 | Python | 13,378 | 362 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for GCPNet (https://github.com/BioinfoMachineLearning/GCPNet):
# ----------------------------------------------------------------------------------------------... |
8395c51c7c35f3bfda1ddaadc57a903afc7c7dea83d423c53e9e8ff5c6df4b16 | Python | 13,404 | 414 | # 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... |
ae56ee945db4469255ad427c50e6425b8f63478464deb4966ef44828cab63097 | Python | 13,406 | 420 | # 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... |
4ef8ec1e429aaa869be8e6fa86f661a1a9485fe2c9e77f8ec22c7398eef81bcd | Python | 13,409 | 398 | import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
def test_index_equal_levels_mismatch():
msg = """Index are different
Index levels are different
\\[left\\]: 1, Index\\(\\[1, 2, 3\\], dtype='int64'\\)
\\[right\\]: 2, MultiIndex\\(\\[\\('... |
37c0b117308b4b72fb8cdfc8d26cd7cfa0ac841668f380732c1f618838df829b | Python | 13,417 | 354 | # 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... |
06c09dd77a37df97edf87523e34700fbe944e4d7813112d63703ec921f1cca67 | Python | 13,423 | 343 | # 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... |
c6d22e3eb1c4bedd381ce749ca93dee9bf244d9d6a82125ff565623dc29b0a8c | Python | 13,429 | 411 | # coding: utf-8
from pytest import raises
from collections import defaultdict
import random
import sys
import os
from io import StringIO
from textwrap import dedent
from atropos.io import xopen, open_output
from atropos.io.seqio import (
Sequence,
ColorspaceSequence,
FormatError,
FastaReader,
FastqR... |
186893f0cfa08b94dd27bdcdc5f02148a4ad400b207fa1b160ee798990f2148d | Python | 13,444 | 345 | import re
import sys
import numpy as np
import pytest
from pandas.compat import PYPY
import pandas as pd
import pandas._testing as tm
from pandas.api.types import is_scalar
class TestCategoricalAnalytics:
@pytest.mark.parametrize("aggregation", ["min", "max"])
def test_min_max_not_ordered_raises(self, aggr... |
d424042c6d9fad69d35971e766e6646cb2285a8d8e63e67d3d0e4a5c798f3297 | Python | 13,445 | 440 | """``ControlPlane`` — typed-ish HTTP client for the PyCaret backend.
Hand-written for clarity. A future revision may regenerate from the
running OpenAPI spec; the namespacing here matches the eventual generator
output (``cp.workspaces.list()``, ``cp.runs.submit(...)``, etc.) so call
sites won't need to migrate.
Auth ... |
a8fe6b65ea2892f9f751e988ee47f111f7b6cfcd8bf65e8f04f2f93f2a65b4b6 | Python | 13,450 | 352 | # 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... |
f60c7019a2dcdba9de0ab4f66a32c28b3912fb923dc42e5cf5b893b155209675 | Python | 13,458 | 283 | #!/usr/bin/env python3
"""Independent audit of the ten final fixed-weight ADNI runs."""
from __future__ import annotations
import csv
import hashlib
import json
import math
from pathlib import Path
import sys
import nibabel as nib
import numpy as np
ROUNDS = list(range(1, 11))
SEEDS = [555, 666, 777, 888, 999, 1111... |
826e12c1728a9c121ba674fcca4cf435b621df7dd631afdcf717f064a2c3276d | Python | 13,460 | 369 | # 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... |
75939c434f5de8b477919c913956f48eecf60b7c4588533597f5648306759602 | Python | 13,462 | 398 | import ast
import os
from itertools import groupby
import numpy as np
import pandas as pd
import torch
from pymatgen.core.structure import Structure
from torch.utils.data import Dataset
from roost.core import Featurizer
class CrystalGraphData(Dataset):
def __init__(
self,
data_path,
fea_... |
b7a5e9c7ef969f3707f847f49adb8fe60fe97eebe610c8c1ea5a00e537cf063b | Python | 13,463 | 416 | import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
from pandas.core.indexing import IndexingError
# ----------------------------------------------------------------------------
# test indexing of Series with multi-level Index
# -----------------... |
0ff366b7c0e9da75726a43f9ec8fe226a7eac6f32804c07c1b7ba5b08ea375c4 | Python | 13,466 | 472 | # 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... |
068345bf2d95b17b6507f7c1d5b2dc51287ddd6c8858dcfbc3c016847a8d8e1c | Python | 13,471 | 337 | # 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... |
c39dca0a6737f1c2539164723000b564da2e8133bc3d9e910f7a8fd6803fa58c | Python | 13,472 | 401 | # cython: language_level=3
# Time-stamp: <2024-10-22 17:12:29 Tao Liu>
"""Module for SAPPER PeakVariants class.
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD License (see the file COPYING included
with the distribution).
"""
# ------------------------------------
# p... |
6791564ac56f590e6fa1093e7a7338f6606eb580049373cc10503e4f5466e9f3 | Python | 13,473 | 399 | # 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... |
900ab40a9604c2621a14fccddbe7c7140139110a7b35be36691a4d5667a31040 | Python | 13,476 | 386 | from __future__ import annotations
import contextlib
import datetime as dt
from typing import (
TYPE_CHECKING,
Any,
Literal,
cast,
)
import warnings
import zoneinfo
import numpy as np
from pandas._config import using_string_dtype
from pandas._libs import lib
from pandas._libs.tslibs import timezones... |
e603b3ebf197c23bc7fd90e289b05c8babaf1b7b4928648c7ad56031e48f1c7d | Python | 13,484 | 368 | # 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 agreed to in writing, software
# distributed under the ... |
c206c3a518c2fb5be0ab852a99752f540d91e288abc14f85a6635efc9c360f06 | Python | 13,488 | 379 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.tests.copy_view.util import get_array
# -----------------------------------------------------------------------------
# Copy/view behaviour for Series / DataFrame constructors
@pytest.mark.parametrize("dtype", [None, "int6... |
ee2a1c63e82988ac3c84cc0c76d669aaff2b81c131d70fd60515201dffa2cf3d | Python | 13,491 | 395 | """Cluster scatter view."""
# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
import logging
import numpy as np
from phylib.utils import connect, emit, unconnect
from phy.plot.transform import ND... |
4f5d68e19b843ed59871159677b5c45d5ad85d9a6465f1806132cdb6d222a680 | Python | 13,494 | 373 | # 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... |
211e149e1712809d7ef5a932f6202c786df05c7428815c5bc4948574a0803ec6 | Python | 13,501 | 462 | """
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 (
BytesIO,
StringIO,
)
import os
import platform
from urllib.error import URLError
import uuid
import numpy as np
import pytest
from pandas.compat import WASM
from pa... |
8bf03593d5cd666ff39c51daba89db4614af9ad1e117ce9c68b129a34ecbb95a | Python | 13,505 | 375 | import numpy as np
import altair as alt
import pandas as pd
import os.path as op
import sys
from tqdm import tqdm
from global_configs import *
dataset = sys.argv[1] # can be hcp_roi, hcp_reco, , ukbb_r, ukbb_lvr, hcp_roi_*, hcp_reco_*
# dataset 1: ukbb_l_filt_oab
if "lr_only" in dataset:
lr_only = True
else:
... |
f7a3a65d0fe6206da75009a0adf6b6d50acfd4c4fa2f2214159171531419f98d | Python | 13,511 | 368 | import os
import shutil
import csv
import random
class bms_config:
arch = 'Vnet'
# data
data = '/mnt/dataset/shared/zongwei/BraTS'
csv = "data/bms"
deltr = 30
input_rows = 64
input_cols = 64
input_deps = 32
crop_rows = 100
crop_cols = 100
crop_deps = 50
# mode... |
db2fc2a9eab0884567e51bda3d9fb64d5a3a9a9d061fea37952d576e5c75e0a0 | Python | 13,518 | 335 | # 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... |
8e4b62363abb29be8a80a2deb5954d820fbba1aa3c08fb7c71c2365d18e95bbb | Python | 13,528 | 328 | import numpy as np, matplotlib.pyplot as plt, sys
import pumpprobe as pp, wormdatamodel as wormdm
from scipy.optimize import curve_fit
sort = "--sort" in sys.argv
pop_nans = "--pop-nans" in sys.argv
stamp = "--no-stamp" not in sys.argv
SIM = "--sim" in sys.argv
ds_list = "/projects/LEIFER/francesco/funatlas_list.txt"... |
d783b11b29383ce9d1c3ba3bdd33b2ec3aba4c40aacaf8c7236f7431b31f0474 | Python | 13,531 | 495 | import argparse
import os
import sys
import torch
from sklearn.model_selection import train_test_split as split
from roost.utils import results_multitask, train_ensemble
from roost.wren.data import WyckoffData, collate_batch
from roost.wren.model import Wren
def main(
data_path,
fea_path,
sym_path,
... |
993757e5d500c0284c1a567d9da62ab96c18737b7ea8c70c58c6b829e1255f58 | Python | 13,533 | 315 | import numpy as np
from mne import SourceEstimate, VolSourceEstimate
from ..utils import _check_h5_installed, _check_pickle_installed
def _export_to_stc(inv_op, subject=None):
if not hasattr(inv_op, 'pmap'):
raise AttributeError('Run the inversion algorithm first!!')
pmaps = inv_op.pmap
fwd = inv... |
0a7b8a68bca9b5a1d75b08d1c6769d83dea056e26cf28f87adbd643d06e5e9f0 | Python | 13,546 | 354 | ''' backcheck_aws.py
This program will backcheck AWS S3 contents to neuronbridge.neuronMetadata
'''
import argparse
from operator import attrgetter
import sys
from types import SimpleNamespace
import boto3
import MySQLdb
from tqdm import tqdm
import jrc_common.jrc_common as JRC
import neuronbridge_common.neuronbri... |
badb8e59f8fa136d6ec774a2a680a65118a4a9122084b1f24a63089515eb341a | Python | 13,547 | 422 | #!/usr/bin/env python3
"""Adapters for optional BASALT candidate binners."""
from __future__ import annotations
import os
import re
import shutil
import subprocess
import sys
from pathlib import Path
from typing import Dict, Iterable, List, Mapping, Sequence
from Bio import SeqIO
def _run(command: Sequence[object... |
b61445434dfcf931bbc250f2f34b7055b3c614b35dd1569cb4d08fd6456e2b73 | Python | 13,552 | 383 | """Module contains functions for modelling moseq data with LDA."""
from typing import List, Optional, Sequence, Union
from dataclasses import dataclass
import joblib
import numpy as np
from sklearn.pipeline import Pipeline
from sklearn import model_selection
from sklearn.discriminant_analysis import LinearDiscriminantA... |
c23e7145c370859a2a8bd07cfae4042808b512a19301dbe8ebff19080fe6c2f8 | Python | 13,553 | 397 | """
The saved model JSON file can change structure across PCNtoolkit versions as
new features are added. This module is one central place to register
and apply migrations required to load these changed models files.
This module does two things:
1. It updates older saved models during loading.
2. It warns if a model w... |
d35fac9c47f43e6e56985d0be0aac730ea8fda8da0ea88efb355c0495baa5848 | Python | 13,558 | 376 | # MOFTransformer version 2.1.0
from typing import Any, List
import torch
import torch.nn as nn
import pytorch_lightning as pl
from pytorch_lightning import LightningModule
from moftransformer.modules import objectives, heads, module_utils
from moftransformer.modules.cgcnn import GraphEmbeddings
from moftransf... |
ecc7d525aea33a5c90a5986648d04a49908a9eb68436e1be94be63341146cfeb | Python | 13,560 | 435 | from datetime import datetime
from operator import methodcaller
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.core.groupby.grouper import Grouper
from pandas.core.indexes.datetimes import date_range
@pytest.fixture
def test_series():
return pd.Series(
np.r... |
405db80ecea1377d3c1bb7a7446a9db287d6841fdaeb40ab482812e59aa7cbef | Python | 13,562 | 347 | import argparse
import sys
import os
import shutil
import time
from random import sample
import numpy as np
from sklearn import metrics
import torch
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable
from torch.optim.lr_scheduler import MultiStepLR
from torch.utils.data import DataLo... |
e63808f05daee41199c1f28e1522c435888cb9c42b0ef50b988cc9d1dd89ba7b | Python | 13,591 | 330 | """Domain predictor classes.
"""
import os
import glob
import numpy as np
from pathlib import Path
import torch
from torch import nn
from progres.chainsaw.src.domain_assignment.util import make_pair_labels, make_domain_mapping_dict
import logging
LOG = logging.getLogger(__name__)
def get_checkpoint_epoch(checkpoint_... |
ff82c9c13998049c2f92925091014cafa147f479b8ab40bd0a3c014e39ba32fe | Python | 13,600 | 380 | """
Tests for statistical reductions of 2nd moment or higher: var, skew, kurt, ...
"""
from decimal import Decimal
import inspect
import warnings
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestDatetimeLikeStatReductions:
def test_dt64_mean(self, tz_naive_fixture, in... |
f58f35860712e8154029c8dccbf58fcf66d7172f05813f2a71610ae3cc1512fb | Python | 13,603 | 358 | # 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... |
e410e06f2e6e9045741e1982f4c7791c99e877539db94ad8b72879bf9f119137 | Python | 13,605 | 350 | import contextlib
import uuid
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.io.excel import ExcelWriter
from pandas.io.formats.excel import ExcelFormatter
pytest.importorskip("jinja2")
# jinja2 is currently required for Styler.__init__(). Technically Styler.to_excel
#... |
e6dd1232512cc0ee5d05fea21b27aae9d46f77479ebd2c9ee78bdf26e312200a | Python | 13,612 | 376 | from datetime import timedelta
import numpy as np
import pytest
from pandas.compat import IS64
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays import (
DatetimeArray,
TimedeltaArray,
)
class TestNonNano:
@pytest.fixture(params=["s", "ms", "us"])
def unit(self, request):
... |
d7fb5732f346b5d78266bf4e4c8cbbca33c63bc399f5e350369f199ad65b2ffd | Python | 13,628 | 561 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
from matplotlib.lines import Line2D
# increase the figure size
plt.rcParams["figure.figsize"] = [12, 10]
# remove the top and right spines from plot in the global plt setting
plt.rcParams["axes.spines.top"] = False
plt.rcParams["ax... |
757014cec1abdf4770b6d1f6c2509f76c575a3c89c8efdc6adbe998a5ad3ab89 | Python | 13,629 | 385 | from itertools import product
from string import ascii_lowercase
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestCounting:
def test_cumcount(self):
df = pd.DataFrame([["a"], ["a"], ["a"], ["b"], ["a"]], columns=["A"])
g = df.groupby("A")
sg = g... |
00fed360099e5cdf45601b4373df5ebb12820733a117ec6dd24a0a6236b03375 | Python | 13,642 | 414 | """
MongoDB-based result tracker
Stores outconfig in document and files referenced in outconfig in GridFS.
Using this tracker requires installing the pymongo package.
TODO: Note that this tracker doesn't handle job reruns gracefully yet, because the result field will be
progressively overwritten but not reset when th... |
67020a869bc21f4df8ee36e9b135291fcef6dd1e373fc8a4b4d5cbe6902b401c | Python | 13,645 | 381 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.tests.copy_view.util import get_array
# -----------------------------------------------------------------------------
# Copy/view behaviour for Series / DataFrame constructors
@pytest.mark.parametrize("dtype", [None, "int6... |
9bd92978015eaf0225163b308257491393d5ef66db5c917268f554411b405ab4 | Python | 13,649 | 280 | # %% [markdown]
# # Motion-corrected image reconstruction
# Physiological motion (e.g. due to breathing or the beating of the heart) is a common challenge for MRI. Motion during
# the data acquisition can lead to motion artifacts in the reconstructed image. Mathematically speaking, the motion
# occurring during data ac... |
63a683ec27b9922f42013071679ae79a2bc3b5e7f036472f36a4d145f8d69d45 | Python | 13,654 | 293 | import os
import multiprocessing
import numpy as np
import nibabel as nib
from nipype.pipeline import engine as pe
from nipype.interfaces import fsl, utility as niu
from nipype.utils.filemanip import fname_presuffix
from bids import BIDSLayout
from ...interfaces import mrtrix3
from ...interfaces import fsl as dmri_fs... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.