sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
df99eef95a88e720d63566127d2f19d96be839a31e4f9b6a15a1d3a7b820fc91 | Python | 14,791 | 308 | # Imports
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import MinMaxScaler
from sklearn.metrics import accuracy_score
from sklearn.decomposition import PCA
from keras import Sequential
from keras.layers import Dense
from src.vizualization import heatmap
import numpy as np
import ... |
90d9e121238bf8a8743b7709d218eda994277908027b29e7d2b31d44f626289e | Python | 14,809 | 422 | #%%
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
import json
import os
import openmc
from copy import copy
def gen_materials(panel_density):
panel = openmc.Material(name='CdZnTe')
panel.set_density('g/cm3', panel_density)
panel.add_nuclide('Cd114',... |
675cf306850e9184d9fa0a0f9016afe321c8e05242d0d0cfa2f80dd514721f55 | Python | 14,836 | 360 | import copy
import os
import sys
import torch
from captum.attr import LayerIntegratedGradients, TokenReferenceBase, visualization
from sklearn.feature_extraction.text import CountVectorizer
from torchtext.data.utils import get_tokenizer
from tqdm import tqdm
from multiligtopic.openai_api_key import OPENAI_API_KEY
from ... |
9f7e0bf3d45c85a1b8f528deaa3138395d0371c823c3592cc5fd52da3bdc70e6 | Python | 14,837 | 456 | from datetime import datetime
import re
import numpy as np
import pytest
import pandas.util._test_decorators as td
import pandas as pd
import pandas._testing as tm
@pytest.fixture
def index_or_series2(index_or_series):
return index_or_series
@pytest.mark.parametrize("other", [None, pd.Series, pd.Index])
def ... |
5ddf8a1c32ab15913f5bcaa67b52a6c1abbb09e124cca5d99b274c5a2f56f21e | Python | 14,843 | 394 | # 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... |
aa8c56d9f649a599938eae4126b9cd5bad7ce39cc0dfcb0f41707aa4c5438914 | Python | 14,844 | 384 | import sys, argparse, math, numpy as np
from nltk.corpus import stopwords
try:
stopwords.words('english')
except:
import nltk
nltk.download('stopwords')
from nltk.corpus import stopwords
class Embedding(object):
def __init__(self, word, sentid, embedding):
self.word = word
self.sent... |
458b5d99ebb54c2cd22d244a8848398c4f74090008556603319649520a6182bb | Python | 14,851 | 444 | """Session 26 — trial dashboard expansion.
Backs the redesigned ``/runs/:id/trials/:tid`` surface:
- ``PATCH /runs/:id/trials/:tid`` — free-form notes annotation
- ``POST /runs/:id/trials/:tid/predict`` — try inference without promoting
- ``GET /runs/:id/trials/:tid/cv`` — per-fold cross-validation
- ... |
fb962115845e0a7ceaf5a6e3cda17f4aab07c66e3c367c219cafc7032c4a43fb | Python | 14,857 | 427 | # -*- coding: utf-8 -*-
import numpy as np
from PIL import Image
# /////////////// Corruption Helpers ///////////////
import skimage as sk
from skimage.filters import gaussian
from io import BytesIO
from wand.image import Image as WandImage
from wand.api import library as wandlibrary
import wand.color as WandColor
i... |
bec098b6a89909251c9e6b5f95d82de6b3484b1d09097f58969a3d6257686646 | Python | 14,859 | 512 | #low_dimension_visualization.py
from initialization.config import *
from initialization.initialization import *
from data_processing.clustering import hdbscan_clustering
from data_processing.dimensionality_reduction import *
from data_processing.shape_calculations import *
import numpy as np
import pandas as pd
imp... |
7bb0ee7646c000ed84a9efa44af26926f6bbbee82972f692f415c8c73cb17fa0 | Python | 14,864 | 436 | # The code in this file is mostly taken from the dynamo-release package
import functools
import logging
import sys
import time
from collections.abc import Sized
from contextlib import contextmanager
def silence_logger(name):
"""Given a logger name, silence it completely.
:param name: name of the logger
... |
84061376a94a1dd23f710f0039a9191f6b4a1666ab4ed6730e849234573a65ed | Python | 14,870 | 378 | # 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... |
c9cb7ba51196b51802bb27a017f9c436986e89b3cfc00fe22fe0e4c515cb5339 | Python | 14,871 | 454 | """test orc compat"""
import datetime
from decimal import Decimal
from io import BytesIO
import os
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
pytest.importorskip("pyarrow.orc")
import pyarrow as pa
@pytest.fixture
def dirpath(datapath):
return datapath("io", "data", "or... |
1b41886712c9fe95518f1b2ece90d2fd59b031f995fd93f3df570f1554502bd4 | Python | 14,876 | 445 | import os
import torch
import torch.utils.data
import numpy as np
import pandas as pd
import scipy.stats
def mean_reciprocal_rank(rs):
"""Score is reciprocal of the rank of the first relevant item
First element is 'rank 1'. Relevance is binary (nonzero is relevant).
Example from http://en.wikipedia.org... |
d2c0dddaef2f751e82290f185520eaebbd5c730a3d2755a16724b97194a6bbfc | Python | 14,878 | 229 | from sklearn.metrics import accuracy_score
from eLife_Grid_anchoring_2024.ToyGridCells.generate_periodic_cells import *
from eLife_Grid_anchoring_2024.Helpers.array_manipulations import *
from eLife_Grid_anchoring_2024.vr_grid_cells import get_rolling_lomb_classifier_for_centre_trial, compress_rolling_stats
def run_a... |
4a064dd048061a5b8d4b679e837fae61a7cbf9c2de270634eee803f8ae499b06 | Python | 14,879 | 413 | from itertools import product
import numpy as np
import pytest
from pandas._libs import lib
from pandas.errors import Pandas4Warning
import pandas.util._test_decorators as td
import pandas as pd
import pandas._testing as tm
class TestSeriesConvertDtypes:
@pytest.mark.parametrize(
"data, maindtype, expe... |
b28cf6dbb272829b8f92207cbd1efe70ffe5cc2d92bdf52e2d0a9732811a1e6d | Python | 14,882 | 456 | # 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... |
e145881ac0ea63625b92f2cf067419325ca0175f540f2b680a082f0a429a172f | Python | 14,887 | 310 | import tensorflow as tf
if int(tf.__version__.split('.')[0]) == 1:
from tensorflow import check_numerics as tf_check_numerics
from tensorflow.contrib.distributions import softplus_inverse as tf_softplus_inverse
elif int(tf.__version__.split('.')[0]) == 2:
import tensorflow.compat.v1 as tf
tf.disable_v2_... |
aa65b124544c29c7d806b177cbfdd21c78c7029d9dfbbccc4e483e0d5a09fc6a | Python | 14,893 | 389 | # 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... |
81f785563b8f5cabb5a1dc04ab121b1b2d5b5ea6fda70bc6f2f2196d12950fe7 | Python | 14,900 | 359 | # 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... |
d14975ed7002abe98565ee2f30c5b972d2a17347c3344466221c0787efa46e26 | Python | 14,905 | 342 | import os
import sys
import torch
from torch.utils.data.distributed import DistributedSampler
from torch.utils.data import DataLoader
import torchvision
import torchvision.transforms as transforms
from .pathfinder import _pathfinder
from .digitclutter import Digitclutter
def sampler(train_data, train_eval_data, val_... |
06e43f9ed937165360c32c0d45cf122b4654282a29461bed7ddd16351b7f1787 | Python | 14,908 | 402 | from __future__ import annotations
import os
from functools import lru_cache
import math
from typing import Tuple, List
import cv2
import json
import matplotlib.pyplot as plt
import numpy as np
import shapely.errors
from tifffile import tifffile
from SCTrack import config
from SCTrack.base import Cell, Vector
clas... |
75628e15524e096369d47d3e299c84642d2ddcdcb68d2254ca0bb9afb65b97e3 | Python | 14,908 | 493 | """
Tests that skipped rows are properly handled during
parsing for all of the parsers defined in parsers.py
"""
from datetime import datetime
from io import StringIO
import numpy as np
import pytest
from pandas.errors import (
EmptyDataError,
ParserError,
)
import pandas as pd
import pandas._testing as tm
... |
7b4708059213a1688c7acf4086d99c9e26a84f060ceefa2a4c811596d168f988 | Python | 14,910 | 377 | # 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... |
5506be2086a02e4f8142ae0eaa150cf2092117813b7d10d2f16d85415958e846 | Python | 14,911 | 273 | # MIT License
#
# Copyright 2026 Broad Institute
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, ... |
25f72d790f941672cce751a4c47d81d20d94a98a9633464394702082b20ef516 | Python | 14,913 | 500 | """
Module that contains many useful utilities
for validating data or function arguments
"""
from __future__ import annotations
from collections.abc import (
Iterable,
Sequence,
)
from typing import (
TYPE_CHECKING,
Any,
TypeVar,
overload,
)
import warnings
import numpy as np
from pandas._li... |
4b302a5f8435245ae3083a4c9b9105c1d76568be13f2db219b666850492088dc | Python | 14,915 | 441 | import numpy as np
import pytest
from pandas.compat import is_platform_arm
from pandas.errors import NumbaUtilError
import pandas as pd
import pandas._testing as tm
from pandas.util.version import Version
pytestmark = [pytest.mark.single_cpu]
numba = pytest.importorskip("numba")
pytestmark.append(
pytest.mark.s... |
5b7e01bb6136e7dfa30c4a1afe4d37747f120f0afa7cdbb60dc6420c439558b6 | Python | 14,916 | 332 | from PyQt5 import QtWidgets, QtCore
import pyqtgraph as pg
from brainflow import BoardShim, DataFilter, DetrendOperations
from brainflow.board_shim import BrainFlowInputParams, BoardIds
import time
import numpy as np
# ------------------- Graph Class with QThread ------------------- #
#
# BUFFERED CHUNK-PLOTTING MECHA... |
8fe2a06c073609b3107b6fb7e5515b99d5de6c66d7c67d208d3fa15d8578aa86 | Python | 14,921 | 392 | from datetime import timedelta
import numpy as np
import pytest
from pandas.core.dtypes.common import is_integer
import pandas as pd
import pandas._testing as tm
from pandas.tseries.offsets import Day
@pytest.fixture(params=[None, "foo"])
def name(request):
return request.param
class TestIntervalRange:
... |
8e1e4ebc11fd7ad81aab89997f3d3950ce35d87f5d0195df95dd87d59aa623a3 | Python | 14,924 | 348 | #%%
import os
import time
import math
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
import numpy as np
import json
import sys
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
import tensorboardX as tbx
from torchvision import datasets, transforms
write... |
e87a1d193ebf4f93af760ec24d4b01688315b22e3e091491db0dbdf19eada714 | Python | 14,928 | 431 | import re
import pytest
from pandas._libs import lib
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
from pandas.tests.groupby import get_groupby_method_args
class TestNumericOnly:
# make sure that we are passing thru kwargs to our agg functions
@pytest.fixture
... |
5e7f398a70c4eb1b2ed69d5c089892435a41412b085b2f877d09a9e689ca8a48 | Python | 14,931 | 466 | # 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... |
05517b446b962e4900994c204c8d8633011ee11dd8439a2bb047c598feace4c9 | Python | 14,934 | 339 | """Logic shared by the prediction-only video readers (``opencv.py`` and ``pynvvc.py``).
``PreparePredictBase`` and ``LitPredictWrapperBase`` hold everything that does not depend on how
frames are decoded: input validation, windowing parameters, ``num_iters``, ImageNet
normalization, per-view bbox cropping and batch-di... |
ac33bbe19545866c2851578dded06f726ccdec1304dde3db9f3325f18905e1b0 | Python | 14,934 | 398 | import itertools
import numpy as np
import pytest
from pandas.core.dtypes.dtypes import NumpyEADtype
import pandas as pd
import pandas._testing as tm
from pandas.api.extensions import ExtensionArray
from pandas.core.internals.blocks import EABackedBlock
class BaseReshapingTests:
"""Tests for reshaping and conc... |
d523727a4d96a2a1159fbc5bbdb1c92b32c83b134d56db1a63622fa965054a93 | Python | 14,935 | 447 | # Arithmetic tests for DataFrame/Series/Index/Array classes that should
# behave identically.
# Specifically for object dtype
import datetime
from decimal import Decimal
import operator
import numpy as np
import pytest
import pandas.util._test_decorators as td
import pandas as pd
import pandas._testing as tm
from pa... |
0be939004b649d22f5645232b85956f89846e11d64b331d596cda815d07d52e5 | Python | 14,955 | 355 | import os
import time
import numpy as np
import random
from copy import deepcopy
import torch
import torch._dynamo
torch._dynamo.config.cache_size_limit = 64
from rl_games.common import object_factory
from rl_games.common import tr_helpers
from rl_games.algos_torch import a2c_continuous
from rl_games.algos_torch impo... |
96c7622c315ccba47c1efa132acd9e407aeadeed22847358fa0c9595dab5974d | Python | 14,969 | 322 | import pymzml
import numpy as np
from .peak import Chromatogram, Peak
class RawData():
"""
Representation of raw data file.
Links sample class to its reader backend.
"""
def __init__(self, sample, file_path, reader):
self.sample = sample
self.file = file_path
self.reader... |
c4b047fa3ec57831fd315e01b82458f4d8c58d576de3e18cf16e8d1d699f045f | Python | 14,972 | 436 | """Tests for the operators module."""
from typing import cast
import pytest
import torch
from mrpro.operators import LinearOperator, Operator
from mrpro.utils import RandomGenerator
from typing_extensions import Any, assert_type
from tests import dotproduct_adjointness_test
class DummyOperator(Operator[torch.Tenso... |
8c49cd60e079c90c694c062e38d6e6318b08dfa40657473916748b4c6b9dd5aa | Python | 14,982 | 368 | import numpy as np
import pytest
import pandas._testing as tm
from pandas.core.indexes.api import Index
class TestJoinInt64Index:
def test_join_non_unique(self):
left = Index([4, 4, 3, 3])
joined, lidx, ridx = left.join(left, return_indexers=True)
exp_joined = Index([4, 4, 4, 4, 3, 3, 3... |
ce23e79086c52b9f5502c1a4fbab22da5872ba37d4a4d1ee3c8c2bba0a081621 | Python | 14,984 | 333 | # 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... |
b5c202323ce6a7efd477756d6b32edf67e47e2b09a84438f13dd954bebc951e0 | Python | 14,992 | 387 | """ Embeddings module """
import math
import warnings
import torch
import torch.nn as nn
from onmt.modules.util_class import Elementwise
from onmt.utils.logging import logger
class SequenceTooLongError(Exception):
pass
class PositionalEncoding(nn.Module):
"""Sinusoidal positional encoding for non-recurren... |
7ae05b53295246cac21cd7b34973c23caaa7e02a3a72f300cdb958df498084e2 | Python | 15,007 | 380 | # This file is used to check individiual segment for the multiple nephron model
# runs the superficial and jux1 - jux5 nephrons
# type 'python3 computation_parallel.py' in the terminal to run
# requires outlet files from previous simulation
from driver import compute
from values import *
from defs import *
import os
i... |
b730e3ba310dc537555e229c24c31ac3b142330cd83aa737d6574c06e43ca8c2 | Python | 15,009 | 442 | import numpy as np
import pytest
from pandas.compat import is_platform_arm
from pandas.errors import NumbaUtilError
import pandas as pd
import pandas._testing as tm
from pandas.util.version import Version
pytestmark = [pytest.mark.single_cpu]
numba = pytest.importorskip("numba")
pytestmark.append(
pytest.mark.s... |
79b2bb6a6669ddfa874759bd8b0ec214ab628c4643965a735bd9ce41cf59ff0e | Python | 15,011 | 426 | from tensorflow.keras.layers import Input, Conv1D, MaxPooling1D, Dropout, BatchNormalization, Activation, Add, Flatten, Dense
from tensorflow import keras
from tensorflow.keras.initializers import lecun_normal
import tensorflow as tf
from tensorflow.keras.callbacks import ModelCheckpoint, CSVLogger
import pandas as pd
... |
8b8e404220273a0a663b9fd4327035c7652b897e4606b2df84b97593de35f768 | Python | 15,011 | 348 | """Factory and type constants for backbone networks.
This module is the single source of truth for backbone identifiers. It owns the
three ``ALLOWED_*`` Literal type aliases and the ``build_backbone`` public entry point.
**Type hierarchy**::
ALLOWED_BACKBONES = ALLOWED_CONVNET_BACKBONES | ALLOWED_TRANSFORMER_BAC... |
08149a0bb5d734c6c2cf855e5c42eada51bd344a54164247974e0416a26bcce2 | Python | 15,015 | 324 | # -*- coding: utf-8 -*-
"""
Window displaying motion-corrected movie (F-order memap file).
When called from the parent GUI, time series (motion shift and fluorescence of the selected component)
can be shown jointly with the vertical line indicating the current frame.
@author: Hung-Ling
"""
import os
import sys
import ... |
749ff6a2e18385fc5b886362b3e661d1c6397d8c33a9821a7f86ba87a70a325e | Python | 15,021 | 344 | #!/usr/bin/env python
"""Module Description: Test the bdgopt subcommand
(MACS3/Commands/bdgopt_cmd.py) and its option checks in
MACS3/Utilities/OptValidator.py (opt_validate_bdgopt): operations on
the score column of a bedGraph (multiply, add, max, min, p2q).
Output content is checked in-process (the real argparse pa... |
bacdd7bc7f5d581b5bfb28ad238392ff8cb5f2a4473dad1c2fcede8fca0505ef | Python | 15,030 | 372 | ''' denormalize_s3.py
Denormalize an S3 bucket (with a Template/Library prefix).
Two files are written to the Template/Library prefix:
keys_denormalized.json: list of image files in Template/Library
counts_denormalized.json: count of image files in Template/Library
Two files are created in each ... |
8c8bb18b05740534f9bca7afadb7f8cb4f2978dd330061e7f3f2904102f8e288 | Python | 15,031 | 469 | from datetime import datetime
import operator
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
def test_title(any_string_dtype):
s = pd.Series(["FOO", "BAR", np.nan, "Blah", "blurg"], dtype=any_string_dtype)
result = s.str.title()
expected = pd.Series(
["Foo", "B... |
eddf9070dbd873ec1459d8c3b1ad7f36c6050474672c9c4a61f49dd44b7442fc | Python | 15,041 | 394 | # 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... |
c1abe243330258ce1c9b6b8e0dc90eb6c1af921e2f655c567f713c84b532af21 | Python | 15,047 | 415 | import numpy as np
import pytest
from pandas.errors import InvalidIndexError
import pandas as pd
import pandas._testing as tm
class TestTake:
def test_take_fill_value(self):
# GH 12631
# numeric category
idx = pd.CategoricalIndex([1, 2, 3], name="xxx")
result = idx.take(np.array... |
9d7fda7abcb3096efa79dd8a33b574aee97666acc38138385c21dd0b1e53cd6b | Python | 15,048 | 344 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 1 11:19:45 2022
@author: wirrbel
"""
import numpy as np
import pandas as pd
import csv
import nibabel as nib
import pandas as pd
import datetime
from xml.etree import ElementTree as ET
import io
from scipy import stats
from scipy.ndimage import gau... |
2fc8485eeb2f63c8f3c5f69511dd313daf57545c69893b4bdc661ff5877d3aa5 | Python | 15,059 | 428 | # ===================================================
# UMAP Fit and Transform Operations Test cases
# (not really fitting anywhere else)
# ===================================================
from sklearn.datasets import make_blobs
from sklearn.cluster import KMeans
from sklearn.metrics import adjusted_rand_score, p... |
1d5749b4437f2069fbf6aac6801c551cfc828bda99fa889b22e13240427ce6be | Python | 15,078 | 286 | """Gold-standard predictions at the edges of every feature's plausibility range.
``test_gold_standard.py`` pins each clock's prediction on one seeded random row.
This suite pins two more rows per clock: every feature at its registered lower
bound, and every feature at its registered upper bound. Random inputs land in
... |
92888c3b0cd5cedc5dc865affa9e694422d428c78b691bd59da50e22b8b61561 | Python | 15,078 | 394 | import importlib.resources
import logging
import pathlib
import traceback
from PyQt6 import uic, QtCore, QtTest, QtWidgets
import dclab
from ..widgets import get_directory, show_wait_cursor
from ..widgets.feature_combobox import HIDDEN_FEATURES
from ...util import get_valid_filename
from ..._version import version
... |
d379e2f4cc44f413b01c540aa1a3bb19071bbbb73c1486ca3a58c3e7d51ae360 | Python | 15,088 | 474 | """
Tests that work on both the Python and C engines but do not have a
specific classification into the other test modules.
"""
from io import StringIO
import numpy as np
import pytest
from pandas._libs import parsers as libparsers
from pandas.errors import (
DtypeWarning,
ParserError,
)
import pandas as pd... |
674a50b5195df53642b65cabae96e4328ba4d5c14a2eeeb7693d0a43d14bf9f3 | Python | 15,094 | 469 | # 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... |
8c4b48ce2eb320acb3105efb418b5a37eb73bd97c0493a9378dcaccd1d36fbe0 | Python | 15,094 | 405 | import datetime
from io import BytesIO
import re
import uuid
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.io.pytables import Term
pytestmark = [pytest.mark.single_cpu]
def test_pass_spec_to_storer(temp_hdfstore):
df = pd.DataFrame(
1.1 * np.arange(120).... |
dfdc32e7b0a6e13a87c36a1a9b2419e7d394fad8ebd73c21faee87cb226b1d72 | Python | 15,100 | 402 | import numpy as np
import pytest
from pandas._libs import index as libindex
from pandas._libs.arrays import NDArrayBacked
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
from pandas.core.indexes.api import (
CategoricalIndex,
Index,
)
class TestCategoricalIndex:
... |
ec231a47fa993e9496472e31e46a6e6f077e61dccf8774bd8253b9bb8addd632 | Python | 15,105 | 400 | # 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... |
bdccbd874dc3bb78e1dfca2d4a6e9505b57d34825148d6809d4ef969fe1dcaa0 | Python | 15,108 | 293 | import torch
import torch.nn as nn
from torch_geometric.nn import global_add_pool, global_max_pool, global_mean_pool, JumpingKnowledge
from torch_geometric.nn.norm import GraphNorm
import torch_geometric.nn as pyg_nn
import sys
sys.path.append('..')
from model.drug_model.drug_gnn import *
class drug_conv_1d(torch.nn.... |
948696f26c23e4f9aba1957b86f8cb5528f5d6411787bba03899945cbdd51d4b | Python | 15,121 | 442 | #!/usr/bin/env python3
"""Extend a ttx file with additional data.
Takes a ttx file and one or more directories containing image files named
after sequences of codepoints, extends the cmap, hmtx, GSUB, and GlyphOrder
tables in the source ttx file based on these sequences, and writes out a new
ttx file.
This can also ... |
d8ddee79fa272c3bde38bc8cfe84b7972cd49bcfc9fad692667774ec6e8e1bb0 | Python | 15,126 | 287 | from .config import DIMENSIONS, XAI_MODES, MODALITIES, XAIs
from .process import get_last_layer, get_last_conv_layer
from .visualize import show_image, show_gray_image, show_heatmap, visualize_tensor
from .visualize import overlay_gradcam, overlay_grad, overlay_pred
from ..src.guided_backprop import get_guided_backprop... |
89578963d90483786630408843d1cf9e8d5e632ed8d4830aa3909e0fb0918d8c | Python | 15,144 | 530 | """Functions for dealing with files.
METHODS
-------
generate_raw_fpath
- Generates an mne_bids.BIDSPath object for loading an mne.io.Raw object.
generate_sessionwise_fpath
- Generates a filepath for an object that corresponds to an individual
recording session based on the MNE data-storage filepath structure... |
27f1f44f668712e4e6c39fab6634cfad619ee0546c8c474411d16dae59d59228 | Python | 15,165 | 399 | #!/usr/bin/env python
"""Module Description: Test functions in MACS3.Signal.VariantStat that
compute genotype log-likelihoods, BIC values and genotype qualities
for callvar.
The expected values come from direct numpy/scipy implementations of the
likelihood formulas: a base with Phred quality q is wrong with
probabili... |
0783f9a3b68cb8a9a34043e8ef7db9906a76a3c376ac7db5ca673535e5032a4c | Python | 15,169 | 468 | """Zenrikegram projection"""
from functools import partial
import os
import h5py
import numpy as np
import scipy as sp
from scipy import special
os.sys.path.append('/gscratch/spe/mpun/protein_holography/fourier')
def zernike_coeff_lm_new(
r: np.ndarray,
t: np.ndarray,
p: np.ndarray,
n... |
5aa6467ffb59288fe470d086b5691190458c3c05e6c33c44d5316dd2f535e9a1 | Python | 15,172 | 407 | #! /usr/bin/env python
##############################################################################
## DendroPy Phylogenetic Computing Library.
##
## Copyright 2010-2015 Jeet Sukumaran and Mark T. Holder.
## All rights reserved.
##
## See "LICENSE.rst" for terms and conditions of usage.
##
## If you use this wo... |
d14876a713945e8079687e05946c36121f00eb183c2b42b2679d8125e4141f21 | Python | 15,176 | 368 | # 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... |
0d53e68d5f410b010e7c8e5337e333fa56f295d3017018f84d5ff0f3c696c6fb | Python | 15,194 | 437 | import re
import pytest
from pandas._libs import lib
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
from pandas.tests.groupby import get_groupby_method_args
class TestNumericOnly:
# make sure that we are passing thru kwargs to our agg functions
@pytest.fixture
... |
5862761aa8446cae4a2ad97ea7a91f79c56254ad850130ade523402308cce3b3 | Python | 15,203 | 430 | import numpy as np
# import warnings
# This file enumerates algorithms for segmenting one-dimensional data.
# The bulk of the code is derived from the astropy project,
# in particular Jake VanderPlas's implementation of the
# Bayesian blocks algorithm in Python.
class Algorithm(object):
"""Base class for Bayesi... |
7e0a7a2aa5846ed55084377e3111a792da6c5b2ef1866e0f8b8d7de32666de49 | Python | 15,222 | 168 | """Province-wide exposure assessment; mortality functions are supplementary.
Memory is bounded by reading one calendar year at a time. Calendar gaps remain
missing. The source grids and population-count conserving overlays are retained.
"""
from pathlib import Path
import json,os,sys,hashlib,platform
os.environ.pop('P... |
6212a325b49c1a94d4f22973b53449679969cfaf266bc3766f3aaa0b6442d916 | Python | 15,231 | 488 | """Session-11 integration tests: data sources, run cancel, deployments, alembic.
Covers the 4 finish-out features that close Phase 9. Uses the same per-test
SQLite + orchestrator-reset fixture pattern as the other suites.
"""
from __future__ import annotations
import io
from collections.abc import Generator
import ... |
3f51715c99ca92b12f3214ac57fb939698dc268b48887cdbc31c0c0f89692423 | Python | 15,243 | 414 | # 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... |
a71d242f6aece9e635e4bd0fa7e0ca4700cb7f0b58948a0a5e6e730344da0a8c | Python | 15,248 | 453 | # 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... |
ed692bddf276e59238f8692b1a21a413f9928bc022c6309662bd595f526bf5d6 | Python | 15,260 | 444 | import equations
import math
import numpy as np
from Newton import Jac
def newton_preg_rat(func,x,k,cell):
if cell.species != 'rat':
print('species:' + cell.species)
raise Exception('newton_preg_rat only for rat model')
if cell.sex.lower() != 'female':
print('sex: ' + cell.sex)
... |
2c12da4fdfbc777aa4de451b07ad6a5ac229dd5cf068a8ad3491009891a08ac4 | Python | 15,262 | 432 | # 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... |
45eb7a205150556b7397e3b95a4da9532e1cc22d8f6c9248ae6c87fd0fa53182 | Python | 15,264 | 429 | import numpy as np
import pytest
import pandas.util._test_decorators as td
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays import IntervalArray
@pytest.fixture(
params=[
(pd.Index([0, 2, 4]), pd.Index([1, 3, 5])),
(pd.Index([0.0, 1.0, 2.0]), pd.Index([1.0, 2.0, 3.0])),
... |
4cf501395ebcd51e0a22e6b37c8e1466af395de77ec5a3ba4fda91912a4ee6d0 | Python | 15,290 | 402 |
import os
import osl
import numpy as np
import mne
import sails
from scipy import io, ndimage, stats
import matplotlib.pyplot as plt
from glm_config import cfg
import logging
logger = logging.getLogger('osl')
def lemon_set_standard_montage(glmsp):
from pathlib import Path
pth = Path(mne.channels.__file__).... |
b961977331f3ad306df59a80cb37c098bad127718793ec7d6af24161152c6b93 | Python | 15,292 | 343 | """
Created on Aug 6, 2022.
Prediction_DP.py
@author: Soroosh Tayebi Arasteh <soroosh.arasteh@rwth-aachen.de>
https://github.com/tayebiarasteh/
"""
import torch
import os.path
import torch.nn.functional as F
import numpy as np
from sklearn import metrics
from tqdm import tqdm
import matplotlib.pyplot as plt
import pa... |
9a134b0f10f7acd7a02e5ec8cdc8e72ae09af9a8b64b4b80a1f58b3053c6ab77 | Python | 15,295 | 374 | from Environment_ui import *
from scipy.ndimage import gaussian_filter
from typing import List
from scipy.stats import norm
from scipy import ndimage as ndi
from itertools import combinations_with_replacement
def intensity_normalization(struct_img: np.ndarray, scaling_param: List):
assert len(scaling_param) > 0
... |
6d45a94726594f5a7460061f0aa64321167d36ec71c6eaeade44ca300ae55db6 | Python | 15,298 | 470 | """
MUSE Reconstruction.
Author: Zhengguo Tan <zhengguo.tan@gmail.com>
"""
import numpy as np
import sigpy as sp
from sigpy import backend
from sigpy.mri import app, retro, sms
from sigpy.mri.dims import *
# %%
def _denoising(input, full_img_shape=None, use_iter=True, max_iter=5):
"""
Args:
input: ... |
c0994deb280690d0ef91105324edcb33ce5db39b0323b2717fbbead43b5a6b5f | Python | 15,303 | 464 | from Environment import *
from scipy import stats
from Parameter import *
### Calculate cell heatmap
def search_indices_sphere(radius):
"""Creates all relative indices within a sphere of specified radius.
Arguments
---------
radius : tuple or int
Radius of the sphere of the search index list.
Retu... |
dd20287a7ee3a0d472c46f0d163494d5f85b950c2622c959456de72a581b1b47 | Python | 15,336 | 359 | """Wrapper around an OmegaConf config with convenience methods for common config queries."""
from __future__ import annotations
import warnings
from pathlib import Path
from typing import get_args
from omegaconf import DictConfig, ListConfig, OmegaConf, open_dict
from lightning_pose.data.datasets import has_calibra... |
239b8f37ed06c50b471addee4051676dc153b1741e90f0377f33d77e30f4059d | Python | 15,339 | 462 | import io
import numpy as np
import pytest
from pandas._config import using_string_dtype
from pandas.compat import HAS_PYARROW
import pandas as pd
import pandas._testing as tm
from pandas.util import _test_decorators as td
from pandas.util.version import Version
@pytest.fixture
def fsspectest():
pytest.import... |
4d2e0bae26152fb6a17bcfcca565cff35b5fe14ceeed4a440cc0fc7ad94dc5cd | Python | 15,340 | 453 | from datetime import (
UTC,
datetime,
)
from dateutil.relativedelta import MO
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.tseries.holiday import (
SA,
AbstractHolidayCalendar,
EasterMonday,
GoodFriday,
Holiday,
HolidayCalendarFactory,
USColumbusDay,
... |
898473f714162ba8b0047a2e2adf224f23f429fa4b68a4b210e656f2fae3efa1 | Python | 15,353 | 463 | # 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... |
a306bf56c3fbb3638d4b62b9c901b42e47224ae31f5b4a671cb28e4ad5d1bfad | Python | 15,355 | 464 | import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
def test_reindex(datetime_series, string_series):
identity = string_series.reindex(string_series.index)
assert tm.shares_memory(string_series.index, identity.index)
assert identit... |
9a17b0fa1de13917adf84980f880929a57aa3bc44090a56ad2b06e2e2442775c | Python | 15,372 | 342 | """
Modeling Relational Data with Graph Convolutional Networks
Paper: https://arxiv.org/abs/1703.06103
Code: https://github.com/MichSchli/RelationPrediction
Difference compared to MichSchli/RelationPrediction
* report raw metrics instead of filtered metrics
"""
import sys
import argparse
import numpy as np... |
bf22ea0929cbbdfe09b0fe10330ff6a3d748e94aa5051e0b9671b037ac237db1 | Python | 15,376 | 378 | import pandas as pd
import os
import pysam
def convert_vcf2bed_by_tools_raw_svtype(vcf_file, bed_out, tool):
bed_writer = open(bed_out, "w")
svtypes = {}
vcf_base = pysam.VariantFile(vcf_file, 'r')
for record in vcf_base.fetch():
chrom = record.contig
start = record.pos + 1
... |
7a02b32bb04f3e5612937f077358c3c68594db8737b5a64a928c0a96146c4b71 | Python | 15,386 | 399 | # 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... |
1308fc8d26992c508fe86e3d19d7691a9f0a0b09f5ca84404fd9d0c6bcb3a335 | Python | 15,401 | 346 | import os
import time
import json
import argparse
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
# import opinionated
import matplotlib.pyplot as plt
plt.style.use('default')
from src.models import TemporalPC, MultilayertPC
from src.utils import *
from src.get_data import get_nat_... |
b2ce31099422cbdf19eb16b57fb6f8788528534923c7b6f00c44911f8954faef | Python | 15,406 | 344 |
from matplotlib import pyplot as plt
import math
import os
import numpy as np
import scipy as sc
import pylab as pl
import seaborn as sns
from scipy.stats import ranksums
import random
def autolabel(rects, ax):
for rect in rects:
height = rect.get_height()
ax.annotate('%.2f' % height,
... |
13e2c661d336ffc7426a1b43dd936366ef0a29e06a2e93dd7779fdcb23f2c9c2 | Python | 15,426 | 408 | import numpy as np
import os
import matplotlib.pyplot as plt
from sklearn.metrics import roc_curve, auc
dir = os.path.abspath(os.path.dirname(__file__))
import matplotlib.pyplot as plt
from sklearn.metrics import matthews_corrcoef,average_precision_score, accuracy_score
from sklearn.metrics import RocCurveDisplay
from ... |
fc340f599712501a9b4ebf29a5c7bd49ac62bdfcd6bcacaf1599c333c34f92ca | Python | 15,429 | 488 | # 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... |
bed9e373ce44e6a1f8a9b7d294773b29c7a6a73f1f8a8e3b373de8832976af3a | Python | 15,443 | 356 | #%%
import os
import time
import math
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
import numpy as np
import json
import sys
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
import tensorboardX as tbx
from torchvision import datasets, transforms
write... |
9415989c1f5b40b95c57079ba91eb18f449a8460b1d2f1b12996ef13b30a96bb | Python | 15,459 | 425 | from __future__ import absolute_import, division, print_function, unicode_literals
import os
import sys
import random
import numpy as np
import pandas as pd
import scanpy as sc
from anndata import AnnData
import anndata as ad
import decimal
from anndata import AnnData
import shutil
from tqdm import tqdm
import json
im... |
20366bc3bee4ad32adfc09d7818139e50cee9d88781553971dec674e0f7c1c0c | Python | 15,463 | 465 | """Save filtered stimulus features."""
import glob
import numpy as np
import os
import pickle
import sys
import time
from filtering import apply_filter, apply_filter_even_grid
from utils import (
get_mirrored_matrix,
get_unmirrored_matrix,
load_story_info,
)
from hard_coded_things import (
frequency_t... |
de414af95cd9166df459695607b5d83f67ea49f7493a5626b7bfb6acb9b705b6 | Python | 15,466 | 487 | import operator
import re
import numpy as np
import pytest
from pandas.compat._optional import import_optional_dependency
import pandas as pd
import pandas._testing as tm
from pandas.core.api import DataFrame
from pandas.core.computation import expressions as expr
from pandas.util.version import Version
@pytest.fi... |
c2d9f89fa706dde845717426075d7ebd1c6958d8cc50fcd1d0acf97c26ae0f60 | Python | 15,473 | 402 | """
Booter is a daemon that starts and stops nodes according to commands
sent by Supervisor
"""
import argparse
import json
import logging
import os
import sh
from sh import git
import signal
import subprocess
import sys
import traceback
import coloredlogs
import redis
from .exceptions import (GraphError, NodeError, ... |
bf8f878a1d55148f2f872508399355974a6f65754a665942208114f0fb0f6c73 | Python | 15,492 | 395 | # 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... |
3e898135fbc4db67cdda963a4df0c1cdeb6d42a89e27c5ed2428b097c4ad01f5 | Python | 15,496 | 409 | from datetime import datetime
import numpy as np
import pytest
from pandas._libs import iNaT
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
import pandas.core.algorithms as algos
from pandas.core.array_algos.take import _get_take_nd_function_cached
@pytest.fixture(
pa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.