sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
c5d030b9ee22cfedb3e9d31300fd62f52eed04de608e34983ff0869daa2eee80 | Python | 9,170 | 286 | import os
import base64
import shlex
from cptools2 import utils
def make_cp_cmnd(name, pipeline, location, output_loc):
"""
create cellprofiler command
Parameters:
-----------
name: string
name of the individual job
pipeline: string
filepath to the cellprofiler pipeline
l... |
6f56483fb3b98990f2b4a43127803951a7e9c32b9d137fe9ef41cbc23ea426af | Python | 9,172 | 262 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestDataFrameUpdate:
def test_update_nan(self):
# #15593 #15617
# test 1
df1 = pd.DataFrame({"A": [1.0, 2, 3], "B": pd.date_range("2000", periods=3)})
df2 = pd.DataFrame({"A": [None, 2, 3]})
... |
bbc418d11363420c9e66286c19337bb3cce79ba7b7638b4271f18463aedf3162 | Python | 9,175 | 309 | """
The functions benchmarked in this file depend _almost_ exclusively on
_libs, but not in a way that is easy to formalize.
If a PR does not change anything in pandas/_libs/ or pandas/core/tools/, then
it is likely that these benchmarks will be unaffected.
"""
import numpy as np
from pandas import (
Index,
... |
457fcf3f26469e4b2f16aa9474a2ad2b2cec42a59c99a75a64281addf64db957 | Python | 9,182 | 245 | import json
import numpy as np
import pytest
from pcntoolkit.dataio.norm_data import NormData
from pcntoolkit.math_functions.basis_function import (
BsplineBasisFunction,
)
from pcntoolkit.normative_model import NormativeModel
from pcntoolkit.regression_model.blr import (
BLR,
create_design_matrix,
)
from... |
96a574b3f2683c8771b3acc669de22e519691d5b5c7daf8bbbef353f4c74be0d | Python | 9,183 | 226 | from rdkit import Chem
from rdkit.Chem import AllChem
from sklearn.metrics import roc_auc_score
import numpy as np
import pandas as pd
def map_attr_to_atoms(idx,df,col,attr_vector,radius,bits,ismol=False):
"""
idx (int): index of compound in respective dataset
df (pd.DataFrame): dataframe (train, ... |
ebe5f14add9b3a2d2d5e19fd10da9aed8c5831928c1c66435824c255bcc73969 | Python | 9,186 | 191 | ################################################################
import numpy as np
from scipy.stats import pearsonr
import matplotlib.pylab as plt
import matplotlib.gridspec as gridspec
import matplotlib
matplotlib.rcParams.update({'text.usetex': False, 'font.family': 'stixgeneral', 'mathtext.fontset': 'stix',})
matpl... |
c61e6e96b15f4673108bfadda8f37bc6fb6167d20f4ed76cdf5769359ef9431c | Python | 9,190 | 228 | # 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... |
091e842b4d602b912098ac00a3bd01cab6123506d5532c793a912d9161f20156 | Python | 9,191 | 292 | # -*- coding: utf-8 -*-
from __future__ import division, print_function
import os
from tempfile import NamedTemporaryFile
import numpy as np
from .. import __version__
from .backend import Backend
__all__ = ["HDFBackend", "TempHDFBackend", "does_hdf5_support_longdouble"]
try:
import h5py
except ImportError:
... |
53f9ab03feb7258f8ff8b54d8a183ac214e1f9cdb1faa62f2f145e1381dee50f | Python | 9,193 | 211 | # 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... |
f94e6b7364c011a295e3342c86180c54e5b8984cf1edc0d025645f7101ae9faa | Python | 9,196 | 259 | # Copyright 2018-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... |
4107a0cb085380579043d2fb73d0c24e7fc80690e71b95fa0e189e8e89fe33c6 | Python | 9,198 | 296 | import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
pal = sns.color_palette("deep")
# increase the figure size
plt.rcParams["figure.figsize"] = [12, 10]
# remove the top and right spines from plot in the global plt setting
plt.rcParams["axes.spines.top"] = False
plt.rcParams["axes.spines.right"]... |
e9920893a4802ccefee4a4291e59b4b28239c4fd70c99b39b8c50c49c0eaedf6 | Python | 9,199 | 236 | """Bounded subprocess checks of worker cleanup through public workflows."""
import os
from pathlib import Path
import subprocess
import sys
import pytest
SCRIPT = r'''
import sys
import threading
import time
from unittest.mock import patch
import numpy as np
from concurrent.futures import Future
import MACS3.Signal... |
f26cb3f4847015fb06289f27c99d9173a7f7d3edb21c56ac15e53b4b62c080c3 | Python | 9,201 | 261 | # MOFTransformer version 2.0.0
import copy
import math
import ase.io
from ase.build import make_supercell
from itertools import product
from functools import lru_cache
from pathlib import Path
from collections.abc import Iterable
import numpy as np
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
fr... |
a7c8d48bcd48b917e5c02d227d521f14d0bd36673d00170eb449d30041d0ea15 | Python | 9,207 | 294 | import numpy as np
import pytest
from pandas.core.dtypes.common import is_any_real_numeric_dtype
import pandas as pd
import pandas._testing as tm
from pandas.core.indexes.frozen import FrozenList
def test_equals(idx):
assert idx.equals(idx)
assert idx.equals(idx.copy())
assert idx.equals(idx.astype(obje... |
e69b8fe17abe440b1d7bc03ef711d9b1724dffcaf0e93f3f5f87209bc458a284 | Python | 9,213 | 243 | # 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... |
04e40767eb2f3096226a98c4f8cece739d2f409cd8f07cfb658a691f0d90be55 | Python | 9,222 | 224 | #!/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
import random
from itertools import combinations
from sklearn.pipeline import ... |
db73fd83d4ede2851b9b082da60071ab7b03837275289e5d00fe44e3bae1e7c7 | Python | 9,228 | 262 | import sys
import hydra
import torch
import wandb
import seaborn as sn
from pathlib import Path
from tqdm import trange
from omegaconf import OmegaConf
from numpy import mean
from opacus import PrivacyEngine, validators
from opacus.utils.batch_memory_manager import BatchMemoryManager
from copy import deepcopy
sys.path... |
7613edf8013871e275cba7c28827035b3e220ac034ed739a93f608b500c6814f | Python | 9,230 | 227 | import importlib.resources
import io
import numpy as np
import pyqtgraph as pg
from PyQt6 import uic, QtCore, QtGui, QtWidgets
#: Fallback graph colors
FALLBACK_COLORS = {
'brightness': '#d8d000',
'cpu_cs': '#b41010',
'cpu_sys': '#8e0505',
'disk': '#949494',
'flow_rate_sample': '#00049C',
'flo... |
353649e1de0179707799d8e95fea193507dd02bbf32385ebc1b4c0e3dae585b3 | Python | 9,234 | 258 | # Reads a depth-annotated linetree file and prints parser tokens flagged with
# various information about center-embedding. Includes "integration cost"
# as defined in Gibson (2000), which is sensitive to argument co-indexation
# and counts intervening referents, as well as a purely syntactic measure
# of center-em... |
cd4320b0ef0c68ec9c7f2aeb1907664a1400ca160aaab08466c572a193d0ebe9 | Python | 9,234 | 220 | from rl_games.common import a2c_common
from rl_games.algos_torch import torch_ext
from rl_games.algos_torch.running_mean_std import RunningMeanStd, RunningMeanStdObs
from rl_games.algos_torch import central_value
from rl_games.common import common_losses
from rl_games.common import datasets
from torch import optim
im... |
7103ce0fe92ae924b9f5f2ed96729de14a7699d4e8af6ea5f0763261a921014b | Python | 9,236 | 263 | # 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... |
3021ee4904f4f7b1d85c29078a626d791b0af4a986f69212de15a503c6fb210d | Python | 9,242 | 249 | #-----------------------------------------------------------------------------
# Ligand Stablity Features
#-----------------------------------------------------------------------------
import os
import sys
import rdkit
import random
from DXGB.get_inputtype import *
from rdkit import Chem
from rdkit.Chem import Panda... |
165a106db1c0be0d1acdc1b138923d431090538ae3e96b1996b560005c13137c | Python | 9,243 | 253 | import re
import numpy as np
import pytest
from pandas.errors import Pandas4Warning
from pandas.core.dtypes.dtypes import (
CategoricalDtype,
IntervalDtype,
)
import pandas as pd
import pandas._testing as tm
class AstypeTests:
"""Tests common to IntervalIndex with any subtype"""
def test_astype_i... |
2bc308c7923f3de58338f1c135bc65d77ddfb78f1c2ab6d44a2dad70efa486b4 | Python | 9,243 | 256 | #!/usr/bin/env python
"""
Dataset utilities for BASALT deep learning components.
This module defines dataset classes and helpers for reading feature
matrices and labels used by the contamination detection models.
"""
import os.path
import pickle
from collections import Counter
from glob import glob
from itertools im... |
386b46aecbce31cf0fc6fff7eb2502ac6df17614c5174f2ab25ffc7d2a5b0e9b | Python | 9,243 | 340 | """Plotly-native regression diagnostics.
Each function takes a fitted regressor (or ``Pipeline``) plus a holdout
set and returns a ``plotly.graph_objects.Figure``.
Usage::
from pycaret.plots import regression as plots
fig = plots.residuals(pipeline, X_test, y_test)
fig.to_dict() # API JSON payload
"""
... |
85d1200ea341db4582e3baa6c5535bbb659e1593b551f1884c4577b65e411652 | Python | 9,248 | 248 | """Session 53 — revive ``get_leaderboard`` / ``automl`` / ``interpret_model`` /
``check_stats``.
These four verbs shipped as ``NotImplementedError`` stubs in 4.0.0a2-a5 (per
session 46's phase-6 deletion). This session reimplements them on the new
native engine surface:
- ``get_leaderboard()`` — reads ``_fit_state["l... |
435788467a967b11749935bccd9a835fdf6f1b62b086423778b52c9021a4fae4 | Python | 9,250 | 289 | import os
from util import stas_compute
from util.stas_compute import *
from util.window_tools import *
from util.process_control import para_run
def write_stats(data_generator, fi,stats, gridNum, snpNum):
with open(fi,'w') as f:
for snpMatrix,position in data_generator:
stasSet, position =... |
5ae6e75343f3f5dd5d5c4cfcfe65a78d0ede8dc9343644c99a8cd5110735871a | Python | 9,251 | 237 | import os
import pysam
def determine_mendelian_error(child_gt, mother_gt, father_gt):
if father_gt == "1/1" and mother_gt == "1/1" and child_gt != "1/1":
return "bad"
if father_gt == "0/0" and mother_gt == "0/0" and child_gt != "0/0":
return "bad"
if ((father_gt == "1/1" and mother_gt ==... |
826d535637da8cf60587152a28b68a353ee9b2f1590d08983b5af074337a7eb8 | Python | 9,258 | 209 | # -*- coding: utf-8 -*-
"""
Created on Wed Apr 19 10:31:16 2023
@author: lonya
"""
#%% preset
import tkinter as tk
import tkinter.filedialog as fd
from tkinter import messagebox
import pickle
import os
import pandas as pd
import scipy.io as sio
import my_funcs as mf
import numpy as np
from scipy.stats ... |
38feeb3fbad7480327191a254ae3ce183700c08fd4b6230d35b9dc644fd4910d | Python | 9,260 | 165 | from Environment import *
from Parameter import *
from torch.utils.data import DataLoader
from tqdm import tqdm
from Network.dataset_VISoR import VISoR_dataset
from Network.utils import test_single_volume
from Network.model.hrnet3D import HRNet
from Network.model.ASPP_unet3d import UNet3D
from Network.model.FCN import ... |
9853b9e380276219f41a6ffa84a6e9913f40763b881fd9f31243a2e449de1b14 | Python | 9,263 | 281 | """Test the initialization, training, and inference of multiview heatmap models."""
import copy
import numpy as np
import pytest
import torch
from lightning_pose.data.datasets import MultiviewHeatmapDataset
from lightning_pose.data.datatypes import MultiviewHeatmapLabeledExampleDict
@pytest.mark.gpu
def test_multi... |
6009a3a0b23976639a0c03765cf2ce706072e09e6080cda43e750003c5c418be | Python | 9,265 | 221 | # Filename: train.py
# Author: Alessandro Gerada
# Date: 21/03/2024
# Copyright: Alessandro Gerada 2024
# Email: alessandro.gerada@liverpool.ac.uk
"""
Functions and classes that allow for training neural network models for colony image classification.
"""
from aigarmic.file_handlers i... |
231af625ea2a6d4a644525cbffefdd2148c53fdf0019191c4a4547e65ea9d6db | Python | 9,268 | 249 | # 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... |
d6a0227078f8d0d4687455861bc470d17c87567d440545dafb66cad17e5e608a | Python | 9,271 | 285 | import numpy as np
import pytest
from pandas.compat import IS64
import pandas as pd
import pandas._testing as tm
@pytest.mark.parametrize("ufunc", [np.abs, np.sign])
def test_ufuncs_single(ufunc, using_nan_is_na):
a = pd.array([1, 2, -3, pd.NA], dtype="Float64")
result = ufunc(a)
np_res = ufunc(a.astype... |
8e4cb4dcbff3e44e501f2393e4eb8e4a70138ba961851dc93fe1565d9d6451bc | Python | 9,281 | 225 | #!/usr/bin/python3
##
# Doxygen filter for Google Protocol Buffers .proto files.
# This script converts .proto files into C++ style ones
# and prints the output to standard output.
#
# version 0.6-beta-vg
#
# How to enable this filter in Doxygen:
# 1. Generate Doxygen configuration file with command 'doxygen -g <file... |
7b9f3280e9b0c13a5be9af8a09f74c8d8c8f0fac610b9cb0874b0b082a962608 | Python | 9,283 | 199 | # Copyright (c) 2021-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... |
959551e7000651aaea2eb0e5795134c9a6baa931ff344b9e19d4af8507596a52 | Python | 9,283 | 289 | #! /usr/bin/env python
# -*- coding: utf-8
#
# Copyright (c) 2023 Kenneth Atz, Clemens Isert & Gisbert Schneider (ETH Zurich)
from rdkit import Chem, RDLogger
from rdkit.Chem import Crippen, rdMolDescriptors
from rdkit.rdBase import DisableLog
for level in RDLogger._levels:
DisableLog(level)
import argparse
impor... |
314b2116630cfd331a7b205adb035e6110dd4ebe2c559f13cf7945973dacd2c0 | Python | 9,288 | 273 | ''' upload_ppp.py
Create upload orders for PPP matches.
'''
import argparse
import json
import os
import sys
from time import strftime
from types import SimpleNamespace
import colorlog
from pymongo import MongoClient
import requests
from tqdm import tqdm
import neuronbridge_lib as NB
# pylint: disable=W0703, E110... |
3fdafc56cd7cd6487e8d2a61ac163f7b1585578e6eec81c8a96c066c9573467c | Python | 9,289 | 231 | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 13 10:11:53 2021
@author: admin
"""
import numpy as np
import matplotlib.pyplot as plt
import scipy.ndimage.morphology as ni
from skimage.filters import gaussian
from skimage import io
import os
import nrrd
from scipy import ndimage
from allensdk.api.qu... |
9084a2d6deae51ac6070d9eda1bcf0d188f189483b8f3fd70882a5a324803e7e | Python | 9,289 | 231 | """Heads that produce heatmap predictions for heatmap regression."""
import math
import torch
from jaxtyping import Float
from kornia.filters import filter2d
from kornia.geometry.subpix import spatial_expectation2d, spatial_softmax2d
from kornia.geometry.transform.pyramid import _get_pyramid_gaussian_kernel
from tor... |
02ff434465657008a6f97ab14ed451e5481f514514ab43c28eef7c4f0d315acd | Python | 9,295 | 240 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# NiMARE documentation build configuration file, created by
# sphinx-quickstart
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All conf... |
ee824a44bae368c2a2e1aa1570e26f4558ef0481911305179cb22b6446b37280 | Python | 9,299 | 262 | import numpy as np
import matplotlib.pyplot as plt
import os
import json
import pumpprobe as pp
class Anatlas:
n = 302
xyz_ids = []
xyz = np.zeros((n,3))
conn_chem = np.zeros((n,n))
conn_gap = np.zeros((n,n))
ids = []
folder = os.path.dirname(pp.__file__)+"/"
xyz_fname = "anat... |
5d3258c0681e4dfe535cf5d5956ffa9f23fb91bf8a5235e392cdd5e1eb9f61c2 | Python | 9,309 | 254 | # 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... |
4cc919530b6a8ce7b7645fce687e2bc58b1ab91ba67d62a374c58cef3c755ae3 | Python | 9,311 | 230 | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 13 10:11:53 2021
@author: admin
"""
import numpy as np
import matplotlib.pyplot as plt
import scipy.ndimage.morphology as ni
from skimage.filters import gaussian
from skimage import io
import os
import nrrd
from scipy import ndimage
from allensdk.api.que... |
ac8554b0ce88f506026f4f02a0d9c33ab2f8e53c70ba063d38464f99010d7819 | Python | 9,311 | 273 | ''' upload_ppp.py
Create upload orders for PPP matches.
'''
import argparse
import json
import os
import sys
from time import strftime
from types import SimpleNamespace
import colorlog
from pymongo import MongoClient
import requests
from tqdm import tqdm
import neuronbridge_common.neuronbridge_common as NB
# pyli... |
45bb6af2cd3c3c991fea238c2d1b0a138b4442e0521c89268a2066f077e7702d | Python | 9,314 | 233 | import os
import random
import copy
import keras
import shutil
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tqdm import tqdm
from keras import backend as K
from sklearn import metrics
from keras.callbacks import LambdaCallback,TensorBoard,ReduceLROnPlateau
def augment_rician_noise(da... |
71252e2568f83bb25a7459e7e359d91b9493d010a6a2878338598631e951c84b | Python | 9,315 | 274 | import json
import requests
from tqdm import tqdm
import os
def get_file_from_modac(fname, origin):
""" Downloads a file from the "Model and Data Clearning House" (MoDAC)
repository. Users should already have a MoDAC account to download the data.
Accounts can be created on modac.cancer.gov
Parame... |
56229a5219dde6297ad019e90acedd84ba5251e3ea58111e3317dfde5d6479dc | Python | 9,316 | 272 | # 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... |
77606e9792be1741aa5add57426ac6d36cea775ab8c9b28065b0d2a8a052debb | Python | 9,317 | 252 | import datetime
import logging
import os
from typing import Tuple
import time
from pandas import read_parquet
import torch
import torch.nn as nn
import torch.optim as optim
import torch.optim.lr_scheduler as lr_scheduler
from torch.cuda.amp import GradScaler, autocast
from torch.nn import Module
from torch.utils.data ... |
4a121c68e915f3ebe8c1d1a3b234fff84aab55ba05f19409e9294b6386fc0982 | Python | 9,320 | 272 | import os
import tempfile
import pandas as pd
import polars as pl
from cptools2.file_tools import (
_discover_plates_from_raw_data,
_discover_chunks_for_plate,
merge_loaddata_metadata,
enrich_chunks_with_metadata
)
def test_discover_plates_preserves_underscores(tmp_path):
"""
Plate discovery... |
9de9649bfea837d8d2bf5badb32fa6a996b96393289360e61f0c1c1f91296cd7 | Python | 9,323 | 238 | # 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... |
170681b5aaf083affd9d22cb4400baef1a6feb599d3ec54a3ec8c275440ad270 | Python | 9,328 | 262 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import numpy as np
import matplotlib.pyplot as plt
import sys
from kcsd import sKCSD, sKCSDcell
import kcsd.sKCSD_utils as utils
import kcsd.validation.plotting_functions as pl
sys.path.insert(1, os.path.join(sys.path[0], '../sKCSD_paper'))
import sKCSD_utils
impo... |
d5d52c4f9757f31ee2d2cd0392296676a752d1c397a5159c05061f02fc602d3e | Python | 9,328 | 203 | """Data pipeline for video prediction based on OpenCV (``cv2.VideoCapture``).
Import discipline
------------------
Unlike ``dali.py``/``pynvvc.py``, ``cv2`` (``opencv-python-headless``) is an unconditional,
cross-platform dependency already declared in ``pyproject.toml`` and already imported at module
top level elsewh... |
2d9b28e00d6e9da608dd3998a3baedf544efc8a6f0506c51fb48d1489e6271fe | Python | 9,329 | 290 | """Tests for ExtensionDtype Table Schema integration."""
from collections import OrderedDict
import datetime as dt
import decimal
from io import StringIO
import json
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays.integer import Int64Dtype
from pandas.core.arrays.string_ import... |
2ead97ccaa94c9f9a994606a22febd7bab26472e1023eaad737dc33082e73eb8 | Python | 9,333 | 259 | """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... |
0d5039d3360cc562bab720a617ec6320619c4a92b3f6e37ff474f0ac044b6056 | Python | 9,335 | 240 | import networkx as nx
import numpy
import pickle
from matplotlib import pyplot
import matplotlib as mpl
class SpikeConnectivityResult(object):
"""
Class to store the results of a connectivity inference algorithm.
Args:
method (str): Name of the method that was used to obtain the result.
p... |
5b020071aad4f9321f3d377d744f3154edecb00315dcc2befbbdea38dec0deae | Python | 9,338 | 211 | # 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... |
c908176809902604af01b5f6c3b6b7d52794126237b08dfa2d4f18053a1c6efb | Python | 9,338 | 267 | # --------------------------------------------------------
# Based on BEiT, timm, DINO and DeiT code bases
# https://github.com/microsoft/unilm/tree/master/beit
# https://github.com/rwightman/pytorch-image-models/tree/master/timm
# https://github.com/facebookresearch/deit
# https://github.com/facebookresearch/dino
# --... |
dc4367bedf48e72b8144dcf677c45ac846e4a070af94cd59e2a9d2e2e40b6b2b | Python | 9,338 | 305 | import torch
import torch.nn as nn
import torch.nn.functional as F
from roost.core import BaseModelClass
from roost.segments import (
MeanPooling,
ResidualNetwork,
SimpleNetwork,
WeightedAttentionPooling,
)
class Wren(BaseModelClass):
"""
The Roost model is comprised of a fully connected netw... |
36dd735807cf9ab0c400dd9fa3ce3b83fb97b5881b3edfc4673c4dca65d31be5 | Python | 9,342 | 229 | # %% [markdown]
# # Cardiac MR Fingerprinting
#
# This notebook provides the image reconstruction and parameter estimation methods required to reconstruct cardiac MR
# Fingerprinting (cMRF) data.
# %% [markdown]
#
# ## Overview
# In this notebook, data from a cardiac MR Fingerprinting (cMRF) experiment is reconstructe... |
0cfc19f0fdc0025282a918605006265375fdea299dd316a02e605700147ddb29 | Python | 9,346 | 256 | import numpy as np
import matplotlib.pyplot as plt
#----------------------------------------------------------------------------
# Plotting functions
# plot the dendritic and somatic response
# - different trials on the same subplot
# - different compartments on different subplots
def plotTraces(data, xmax=1000, nde... |
8cafdf7b724d32ad4f7bb2e8a416ea8a790333d7177713738ef5285e4108f05c | Python | 9,346 | 199 | # 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... |
f110313cb809b1a331e09f062c6d5ee378e0d3652251077136abefc656d46f3c | Python | 9,347 | 296 | """Session 33 — GPU routing + distributed-worker validation.
Validates the Phase 14 hand-off points without standing up a real
multi-host worker pool:
- The dispatcher routes Trial-Jobs to the ``gpu`` queue when the
experiment opted into ``use_gpu`` (and stamps
``requested_resources={"gpu": 1}``).
- A CPU-only wo... |
3a39b4affdab447f158807fb7b91301805372cc5e1a3ea563871f76183e0a431 | Python | 9,351 | 216 | """
A 1D CNN for high accuracy classification in motor imagery EEG-based brain-computer interface
Journal of Neural Engineering (https://doi.org/10.1088/1741-2552/ac4430)
Copyright (C) 2022 Francesco Mattioli, Gianluca Baldassarre, Camillo Porcaro
This program is free software: you can redistribute it and/or modify
it... |
6fe7fff2e85beb6b1e5690b51ddcef4e3c2665e870e24f4d7cf6e4342bc341be | Python | 9,351 | 249 | # 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... |
d9781b69ae65ba70a514105330709b918a50cd84d1820017d134d8987f9d858a | Python | 9,355 | 239 | from unittest.mock import Mock
import httpx
import pytest
from huggingface_hub.errors import (
EntryNotFoundError,
GatedRepoError,
HfHubHTTPError,
LocalEntryNotFoundError,
RepositoryNotFoundError,
RevisionNotFoundError,
)
from pyaging.utils._hf import (
PyAgingAuthenticationError,
PyAg... |
1515cde849d54333908d24fcd8985b3974db83578c8af72cdde16a5b01054406 | Python | 9,366 | 324 | """
Useful Python helpers
Authors:
Thomas A. Hopf, Benjamin Schubert
"""
from collections import OrderedDict
from itertools import groupby
from operator import itemgetter
import pickle, json, csv, os, shutil
from os import path
import time
import sys
import jinja2
from evcouplings.utils import InvalidParameterErro... |
ceee7519a150872257326c8e88029e6c1923e43a6e90c1d5ea7f88014238ac8f | Python | 9,366 | 238 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestDataFrameConcat:
@pytest.mark.xfail(reason="GH#62888 the `mi[2][1] is 1` check fails")
def test_concat_multiindex_level_bool_and_numeric(self):
# GH#21108, GH#45101
left = pd.DataFrame([123, 456], colu... |
f87ef6fede06db3f52abd57f8d4840f4735df732294762cfd50de2236d26a46d | Python | 9,377 | 333 | """
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
... |
ba5bcfa8bae19802c649305d5248ff8e91a42bea67f93aa1b2f8939327319d66 | Python | 9,383 | 272 | import numpy as np
from os.path import splitext
from vtk import vtkOBJReader
from scipy.spatial.distance import squareform, pdist
from numpy.random import default_rng
class PointSet:
def __init__(self, data=None, weights = None, maxPoints=None):
if type(data) is str:
self.read(data, maxPoints=... |
016acdc5a3cf376c8a8757e71298d44aa50fddf0918d98143ea4896b7054e013 | Python | 9,393 | 241 | """
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... |
145a9e4085153323cec25c38a6a6d1018604f3da80e1d70e5cdca5f1bf5b4396 | Python | 9,396 | 315 | import numpy as np
import pytest
from pandas.core.dtypes.generic import ABCIndex
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays.integer import (
Int8Dtype,
UInt32Dtype,
)
def test_dtypes(dtype):
# smoke tests on auto dtype construction
if dtype.is_signed_integer:
a... |
46532ee5bdb49f8eb481f371e3de37e10af040736469e7feca722976253b113f | Python | 9,401 | 194 | #!/usr/bin/env python3
"""Build replication clocks from checksum-pinned original-author artifacts.
CellDRIFT: clone https://github.com/MorganLevineLab/CellDRIFT at the pinned
commit, then run ``uv run --with rdata python clocks/build_replication.py
--celldrift-source /tmp/CellDRIFT``. rdata is a build-only dependency.... |
bf1097eaa036b728fc8e31d874638ae2cfc01cb13a45352f38fe25cd35edb9cf | Python | 9,404 | 275 | # cython: language_level=3
# Time-stamp: <2024-10-14 17:04:27 Tao Liu>
"""Module description:
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).
"""
# ------------------------------------
# python modules
# ---... |
d5b876c5693ce3fed6cc6b90d2b0ab64b7f4d280beaba4a5cd964bc8fceb30f0 | Python | 9,405 | 275 | """
Tests for DateOffset additions over Daylight Savings Time
"""
from datetime import timedelta
import pytest
from pandas._libs.tslibs import Timestamp
from pandas._libs.tslibs.offsets import (
BMonthBegin,
BMonthEnd,
BQuarterBegin,
BQuarterEnd,
BYearBegin,
BYearEnd,
CBMonthBegin,
CB... |
ac7cdd812900debafc630fe4083ec9d17ca45606ce81b2441c11a9f6d444cb94 | Python | 9,406 | 255 | """Test bulk action for emodulus computation"""
import pathlib
import tempfile
import dclab
import h5py
import numpy as np
import pytest
from shapeout2.gui.main import ShapeOut2
from shapeout2.gui import bulk
from shapeout2 import session
datapath = pathlib.Path(__file__).parent / "data"
def make_dataset(medium="C... |
0153ee652c1b1515d7620028b50f255125ee9cf31e19ff47260babb830273b24 | Python | 9,407 | 255 | import matplotlib.pyplot as plt
from matplotlib_venn import venn2
import numpy as np
import pandas as pd
import seaborn as sns
from sklearn.decomposition import PCA
from ._cohens_d import cohens_d, gene_selection
from ._data_loader import SuematsuData
from ._preference import kwarg_savefig, eda_pipeline_adgile, is_skip... |
27710e2c51e0a452c8de1af6a034eedb78a8ef053e3569c5e7e393cccdcae79a | Python | 9,407 | 264 | """
Script for running Chainsaw
Created by: Jude Wells 2023-04-19
Modified for Progres
"""
import hashlib
import json
import logging
import os
import sys
import time
from typing import List
from progres.chainsaw.src import constants, featurisers
from progres.chainsaw.src.domain_assignment.util import convert_domain... |
af6313003a9aae3a988443acfe58db594977e7405f0a81e3febc9e388fef7303 | Python | 9,407 | 226 | # 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... |
4642aa413271f6255325f7373f3770344a59b3dca8a2e7d84e9d0db622022290 | Python | 9,410 | 300 | """
High-level mutation calculation functions for EVmutation
.. todo::
implement segment handling
Authors:
Thomas A. Hopf
Anna G. Green (generalization for multiple segments)
"""
import numpy as np
import pandas as pd
from evcouplings.utils.calculations import entropy_map
COMPONENT_TO_INDEX = {
"full"... |
fb30ec8619568ecb6fd3bc83c4d88d07a627cb953a6f17eb05c3d867f111e53d | Python | 9,410 | 285 | """
Test extension array for storing nested data in a pandas container.
The JSONArray stores lists of dictionaries. The storage mechanism is a list,
not an ndarray.
Note
----
We currently store lists of UserDicts. Pandas has a few places
internally that specifically check for dicts, and does non-scalar things
in that... |
24f9706b3534c5ccb1f4d5e98b8d54855bc1c07aa1451cbb5c1e50ae8da538ff | Python | 9,412 | 234 | # %% [markdown]
# # Iterative SENSE reconstruction of 2D golden angle radial data
# Here we use an iterative reconstruction method to reconstruct images from ISMRMRD 2D radial data.
# %% [markdown]
# We use the `~mrpro.algorithms.reconstruction.IterativeSENSEReconstruction` class to solve
# the following reconstructio... |
04d223c53942d294aa03feea28ff43530c984d9af6f69bb4efe5c2b5a52013cc | Python | 9,423 | 213 | # code from https://github.com/fregu856/deeplabv3/blob/master/model/deeplabv3.py
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.models as models
class DeepLabV3(nn.Module):
def __init__(self, num_classes):
super(DeepLabV3, self).__init__()
self.num_classes... |
20b279812c575674acc18471ced2223c5a563570f8e0875890f144b68f1123b8 | Python | 9,427 | 236 | import torch
import torch.nn.functional as F
from .render_utils import normal_vect, index_point_feature, build_color_volume
def depth2dist(z_vals, cos_angle):
# z_vals: [N_ray N_sample]
device = z_vals.device
dists = z_vals[..., 1:] - z_vals[..., :-1]
dists = torch.cat([dists, torch.Tensor([1e10]).to(d... |
4b312979d72c6be807cb6a908931dcda145c245b09dcd7ec7db18638ae5ed2af | Python | 9,429 | 338 | # JN 2015-07-05
# -*- encoding: utf-8 -*-
"""
create a unit overview plots for all units
"""
from __future__ import division, print_function, absolute_import
import logging
logger = logging.getLogger(__name__)
import os
import numpy as np
import matplotlib.pyplot as mpl
from matplotlib.gridspec import GridSpec
from ... |
7ecd768f69dd68befd73a87165545f619202cd3c3288345c1c06c930fe6273c8 | Python | 9,429 | 306 | """
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 typing import List, Tuple, Optional
from DL_reconstruction import (
save_reconstructions,
rss,
rss_complex,
... |
d977e83c1ff14b5325e347a07e19f97e3a1bb90596acd46388380dfeaed890b4 | Python | 9,430 | 238 | 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
folder = sys.argv[1]
if folder[-1]!="/": folder += "/"
tubatura = pp.Pipeline("responses_detect.py",folder=folder)
tubatura.open_logbook_f()
... |
35e0f20189bf786f68f9d4307b37c9cc80122b87f459bbbead15db5f2e4bebcf | Python | 9,432 | 287 | from __future__ import annotations
from typing import Any
import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
# integer dtypes
arrays = [pd.array([1, 2, 3, None], dtype=dtype) for dtype in tm.ALL_INT_EA_DTYPES]
scalars: list[Any] = [2] * len(ar... |
4730d9a86aa7dc97525997b18db2faa088d4255f0ad042df290695e149c00633 | Python | 9,433 | 245 | # 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... |
6fc035c4b766746d2fdced0b99e3e0a873283b8ca76f77b0f05030d65311d511 | Python | 9,434 | 252 | import glob
from matplotlib import pyplot as plt
from srd import header_modifier, extract_name_data
def read_stat_data(sim_file):
"""Read the summary of the statistical results of the comparisons,
and the similarity indices used.
Arguments
---------
sim_file : str
Name of the .sim file wi... |
d340d983ddb9392feb0a33d6a742c819f21b4f199cff0a8e258f956fbbb46998 | Python | 9,435 | 290 | # 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... |
e5160d0d46f2dfe7945210ff67432eae3af46bfc0baf5f85851bd6020d589b59 | Python | 9,440 | 222 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 2 09:24:13 2023
@author: wirrbel
"""
import numpy as np
import os
import tifffile
import pandas as pd
import matplotlib.pyplot as plt
from scipy.ndimage import distance_transform_edt
import glob
import shutil
import cc3d
import datetime
def cal... |
5570c0b63e64d34ebd1c5095ae323634e4fba1bf8bd1e2c7424cad8b60dbfe76 | Python | 9,445 | 264 | #!/usr/bin/env python
"""
This program validates a NeuronBridge metadata set.
The image metadata is validated first, and all the published names are kept
in a set in memory. Then the matches are validated, and each item in the
matches is checked to make sure its publishedName exists in the set.
The validation can ... |
6aa6a473807827a8faeac94513fd7575720c4bea49a4b955a7fcdcbd2bef7e6d | Python | 9,446 | 290 | from __future__ import annotations
import json
from typing import (
TYPE_CHECKING,
Any,
)
from pandas.io.excel._base import ExcelWriter
from pandas.io.excel._util import (
combine_kwargs,
validate_freeze_panes,
)
if TYPE_CHECKING:
from xlsxwriter import Workbook
from pandas._typing import (
... |
fc6c2bff6e1301f2bc2fba6136a0cc178a5e6cc0de3661bb038659f38c34ddec | Python | 9,446 | 230 | import numpy as np
import random
import os
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_util... |
72815191f6b3691a4300aa98634accbaaed530e425ad7ca5858f6004cbd225c4 | Python | 9,449 | 298 | import itertools
import pathlib
import shutil
import tempfile
import dclab
import h5py
import numpy as np
from shapeout2 import pipeline, session
data_path = pathlib.Path(__file__).parent / "data"
def equal_state(a, b):
"""Compares dictionaries recursively
- nan-values are allowed
"""
if isinstanc... |
37504f6b1ebd7885b9e8630a3fe7f9d7cd9d8fbda7bf5b11dd2ebf27fe59b3dd | Python | 9,453 | 268 | # Copyright 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 ag... |
d4b63b56050f0eeca0b7c2719bfbd3b95247299757b5af956a3f4a04a7666540 | Python | 9,455 | 242 | """
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
"""
from neuron import h, gui
import libcell as lb
import saveClass as sc
import numpy as np
from CA1_plasticity.io.figures_shower import FiguresSh... |
4ece4df2b239f78547daf6e8e1899003728bdb7fef9de1d6e63f594d21976fb5 | Python | 9,457 | 246 | import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
class TestPeriodRangeKeywords:
def test_required_arguments(self):
msg = (
"Of the three parameters: start, end, and periods, exactly two "
"must be specified... |
a7abd1edd0b9c3e48624fa7075ad5decde860618aec2b220f25b557cab8cc43a | Python | 9,466 | 318 | # -*- coding: utf-8 -*-
"""
Created on Thu Dec 9 14:18:03 2021
@author: jeanbaptiste
"""
# Not necessary once these are added to the python path permanently:
import os
import sys
# Append paths to delta-dev and deep cell control before import:
sys.path.append('C:/DeepLearning/DeLTA_dev')
sys.path.append('C:/Users/Sy... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.