sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
f6d600cfdbd26a078b1b979ef6399e776d0e9a0a015446d8862869af9dffea66 | Python | 12,310 | 230 | from multiprocessing.pool import Pool
import matplotlib
from nnunet.training.data_augmentation.default_data_augmentation import get_default_augmentation
from nnunet.training.dataloading.dataset_loading import DataLoader3D, unpack_dataset
from nnunet.evaluation.evaluator import aggregate_scores
from nnunet.training.netw... |
518db9d91369bca190808bae701a6cac0cf59d2579a7e80bbfb8766d4a18e4af | Python | 12,312 | 335 | import os
from types import SimpleNamespace
from typing import Union, Optional, Dict, Any
import pandas as pd
import numpy as np
try:
from IPython.display import display, Image as IPImage
_HAS_IPYTHON = True
except Exception:
_HAS_IPYTHON = False
from spit.run_spit import handle_filter as _handle_filter
f... |
a236ea8fdd3d5217a264e53a9dac3b18209856d8dbbf5924f9d93c7520c3ba2e | Python | 12,314 | 260 | import argparse
import multiprocessing as mp
import numpy as np
import os
import sys
import yaml
paths = [os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'src')]
sys.path.extend(paths)
from src.draw import draw_stimulus_proximity,... |
0496239117e59c8cd0ae01cb94158bc934663dea1f62d1da386aefd198b2c491 | Python | 12,324 | 302 | # 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... |
6eb12de64d6fe7a417ed47d8b2e95da9cdc0d594f6ca1f3951ec859f3f7efd5a | Python | 12,330 | 338 | """Base classes for NiMARE."""
import gzip
import inspect
import logging
import pickle
from abc import ABCMeta, abstractmethod
from collections import defaultdict
from nimare.results import MetaResult
LGR = logging.getLogger(__name__)
class NiMAREBase(metaclass=ABCMeta):
"""Base class for NiMARE.
This clas... |
4a9f73c42e54816ad16335646679fe72cb4f3aa2504dddcd92434a80f44b5f9e | Python | 12,336 | 262 | from spycon.spycon_inference import SpikeConnectivityInference
import numpy
from scipy.stats import norm
from itertools import repeat
import multiprocessing
from tqdm import tqdm
class directed_STTC(SpikeConnectivityInference):
"""
Directed version of the spike time tiling coefficient (STTC), as originally pr... |
81a912c4c03a659f545407d2a341e4e2cf0ec3c4e06d0e0754f047c9d5faf8cb | Python | 12,339 | 270 | # -*- coding: utf-8 -*-
"""
Unit tests for the kCSD methods
This was written by :
Chaitanya Chintaluri,
Laboratory of Neuroinformatics,
Nencki Institute of Exprimental Biology, Warsaw.
:license: Modified BSD, see LICENSE.txt for details.
"""
import unittest
import numpy as np
from kcsd import ValidateKCSD1D, ValidateK... |
534b43a540c43c37471f91fd2cfba6caf20671992553fed6b2f709fac8fe1a15 | Python | 12,342 | 348 | from datetime import (
UTC,
datetime,
)
import dateutil.tz
import numpy as np
import pytest
from pandas.compat import (
PY314,
is_platform_windows,
)
import pandas as pd
import pandas._testing as tm
def test_get_values_for_csv_sub_minute_utc_offset():
# GH#66547 array formatting routes through ... |
3bb6c127d263e448ac9a9e6ff2e064557f05ff4c7103ff3ad73cb76dc06742cb | Python | 12,344 | 357 | #!/usr/bin/env python3
# Copyright 2015 Google, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... |
be09eb82bb7390708ecc2113c894f719d097955d05eb0cd99db0342bab237678 | Python | 12,345 | 245 | import pandas as pd
import pickle
import pathlib
import logging
logger = logging.getLogger(__name__)
from .data import RawData, DataReader, PymzmlDataReader
from .sample import Sample
from .feature import Feature, FeatureCollection, FeatureTable, MzmineFeatureTable, PeakonlyFeatureTable, XcmsFeatureTable
from .annota... |
86429a324cc37d6913b9f33416223b73f59ac815813310675a7da16095d89b09 | Python | 12,347 | 183 | from typing import List, Union, Optional, Any, Dict, Literal
from enum import Enum
from pydantic import BaseModel, Field, Extra
from typing_extensions import Annotated
class Gender(str, Enum):
male = 'm'
female = 'f'
class AnatomicalArea(BaseModel, extra=Extra.forbid):
"""
Defines an anatomical area... |
8f8c778353d94b8f97b0ada0f8f74c9d47ae6e6ddebc8d6d483d58ce7cb242a1 | Python | 12,349 | 353 | """
Tests for 2D compatibility.
"""
import numpy as np
import pytest
from pandas._libs.missing import is_matching_na
from pandas.core.dtypes.common import (
is_bool_dtype,
is_integer_dtype,
)
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays.integer import NUMPY_INT_TO_DTYPE
class D... |
520f82427ad6e98f47efd19cb91f0112793aff6468b63e250789aa1852a1e781 | Python | 12,351 | 310 | import argparse
import yaml
def main():
my_parser = argparse.ArgumentParser(
prog="python3 -m rl_toolkit",
description="The RL-Toolkit: A toolkit for developing and comparing your reinforcement learning agents in various environments.", # noqa
)
my_parser.add_argument(
"-e",
... |
9948a77b052b99a7a58059fa74ba118dce096b54236d22f32aa740669fe1411f | Python | 12,354 | 267 | #!/usr/bin/env python3
"""Evaluate one final ADNI round on the true test set without refitting.
The training validator must have completed before this script is launched.
It loads the validation-selected state, saved training dictionaries, input
transforms, coefficient normalization, and target normalization. Test out... |
c011058fa600ffd25954d9e1afd455e36581d33b029d00888f62e34e955cada7 | Python | 12,354 | 434 | import string
import numpy as np
from pandas import (
NA,
DataFrame,
Index,
MultiIndex,
RangeIndex,
Series,
array,
date_range,
)
class GetLoc:
def setup(self):
self.mi_large = MultiIndex.from_product(
[np.arange(1000), np.arange(20), list(string.ascii_letters)... |
eccd775b420e70c69e2bf76609ed3def13621be35469e271c6aed0d6514dac60 | Python | 12,358 | 370 | from itertools import product
import re
import numpy as np
import pytest
from pandas._libs import hashtable
import pandas as pd
import pandas._testing as tm
@pytest.fixture
def idx_dup():
# compare tests/indexes/multi/conftest.py
major_axis = pd.Index(["foo", "bar", "baz", "qux"])
minor_axis = pd.Index... |
ab11592b98f63478afd2b31a4fb377dd95fceb1318dc0f3884add3482fa00a27 | Python | 12,363 | 327 | """Utilities for generating data for testing."""
from itertools import zip_longest
import numpy as np
from .dataset import Dataset
from .io import convert_neurovault_to_dataset
from .meta.utils import compute_ale_ma, get_ale_kernel
from .transforms import ImageTransformer
from .utils import get_template, mm2vox, vox2... |
77af109704e120b5a7998c99ee580f90e9f014a444abd3d8fb5d3e7d093d78eb | Python | 12,364 | 312 | #!/usr/bin/env python
import re,sys,os, argparse
from argparse import RawTextHelpFormatter
###################################################
### 0. script description and parsing arguments ###
###################################################
synopsis1 = "\
find OrthNets that (1) meet a node copy number criteri... |
0db687a5d1f07a2954ec493d8268e2c599f7340a7b06c1b777884f050d46b33c | Python | 12,369 | 407 | """
Table Schema builders
https://specs.frictionlessdata.io/table-schema/
"""
from __future__ import annotations
from datetime import timezone
from typing import (
TYPE_CHECKING,
Any,
cast,
)
import warnings
from pandas._config import option_context
from pandas._libs import lib
from pandas._libs._ujson... |
08e64d6307d7f095377a9acc58e6db3d9cf722e2fc9bc93dd6c250ce7e938374 | Python | 12,370 | 284 | from datetime import datetime
import os
from distributed_computing.api import WorkerInterface
from tensorflow.keras import Model
from tensorflow.keras.callbacks import Callback
# Can't use tensorflow.keras because of this memory leak:
# https://github.com/tensorflow/tensorflow/issues/35030
from common.logic import bu... |
0a611b168953946806d7e52a53508e408ad4c6258de3edda54cfb930044e7eb2 | Python | 12,372 | 311 | # 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... |
347fd28b46e30f9e06d9563d93181b4a24c7fe58b87058d5b78881f586acd7f7 | Python | 12,373 | 338 | from datetime import UTC
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestDataFrameAlign:
def test_frame_align_aware(self):
idx1 = pd.date_range("2001", periods=5, freq="h", tz="US/Eastern")
idx2 = pd.date_range("2001", periods=5, freq="2h", tz="US/East... |
8992586cda606cc14a5b481ce134f3a09dc5921660ccdd6451d5716849ca5cb8 | Python | 12,379 | 213 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'viewer.ui'
#
# Created by: PyQt5 UI code generator 5.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindo... |
88a245fe8c47d74ba0d7ee4abe142f4d06176c6fc81861146571af60d3d4efb0 | Python | 12,385 | 388 | # 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... |
a2001db02b164867d0597372ecaa018b1c348811b4d2521fe23474faf5d4500c | Python | 12,385 | 253 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for GCPNet (https://github.com/BioinfoMachineLearning/GCPNet):
# ----------------------------------------------------------------------------------------------... |
89ac0a0b5c430b78ec1e2ada08bb9bed2f7118211f248f27ff4b34d33848fcab | Python | 12,386 | 437 | from __future__ import annotations
from io import StringIO
import pytest
from pandas.errors import ParserWarning
import pandas.util._test_decorators as td
import pandas as pd
import pandas._testing as tm
from pandas.io.xml import read_xml
@pytest.fixture(params=[pytest.param("lxml", marks=td.skip_if_no("lxml")),... |
f2fd3ef6628342263e789dc9877a7a6e6aec40017a9f4ca87b6fc30c17d13993 | Python | 12,386 | 332 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.tests.copy_view.util import get_array
def test_concat_frames():
df = pd.DataFrame({"b": ["a"] * 3}, dtype=object)
df2 = pd.DataFrame({"a": ["a"] * 3}, dtype=object)
df_orig = df.copy()
result = pd.concat([df... |
408927fd1d751756114cfc80157b2350716c527780652c0efc579f2b4e6144af | Python | 12,388 | 356 | # 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... |
148cac92404ac6a6ae045b28f2868fbe221a2b724b81bb500db8068a3fc4108f | Python | 12,390 | 371 | """Phase 7: Model registry routes.
Endpoints:
- ``GET /workspaces/{ws}/registered-models``
- ``POST /workspaces/{ws}/registered-models`` create
- ``GET /registered-models/{id}``
- ``GET /registered-models/{id}/versions``
- ``POST /registered-models/{id}/versions`` promote a Run → new ve... |
21a24c3b08c3f4c57960e8757918dc41ac4adcdca10cb89d76cd429721cd5d81 | Python | 12,393 | 327 | """Utilities for generating data for testing."""
from itertools import zip_longest
import numpy as np
from nimare.dataset import Dataset
from nimare.io import convert_neurovault_to_dataset
from nimare.meta.utils import compute_ale_ma, get_ale_kernel
from nimare.transforms import ImageTransformer
from nimare.utils imp... |
eeb0db49bb7c5ab7bb3a2868ed73e6135ddb21837ddcc7ff9c4d23b481b67714 | Python | 12,404 | 372 | #!/usr/bin/env python
"""
File: DataSet
Date: 5/1/18
Author: Jon Deaton (jdeaton@stanford.edu)
This file provides loading of the BraTS datasets
for ease of use in TensorFlow models.
"""
import os
import pandas as pd
import numpy as np
import nibabel as nib
from tqdm import tqdm
from BraTS.Patient import *
from Bra... |
851d8137d8eccbe4be864f2b5131bf31cda64e8fd0b9c5e7add7cf4103342d06 | Python | 12,408 | 228 | import numpy as np
import torch
import torch.utils.data as data_utils
from torchvision import transforms
import argparse
import torch.optim as optim
from torch.autograd import Variable
import os
import shutil
from pathlib import Path
from functions_OC import list_files_in_folder, create_save_dir, OC_Bags, AddGaussianNo... |
0800e24d84ace048a50c62e52b292ff8ff111bcee2b80b740b4e4d5b4f80b3c3 | Python | 12,411 | 309 | """Test nimare.meta.ale (ALE/SCALE meta-analytic algorithms)."""
import logging
import os
import pickle
import nibabel as nib
import numpy as np
import pytest
import nimare
from nimare.correct import FDRCorrector, FWECorrector
from nimare.meta import ale
from nimare.utils import vox2mm
def test_ALE_ma_map_reuse(tes... |
3e473a1b121140fd2216dbe521c9a2de9d0e7c72462a02dc2ea4b33e697ccff1 | Python | 12,412 | 317 | # 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... |
19dec674e11c30fc181856a5fb71b79e7577262e3b45e2b413d20bfa7ec96cd4 | Python | 12,413 | 303 | """Tests for the Cartesian sampling operator."""
from typing import TypeAlias
import pytest
import torch
from einops import rearrange
from mrpro.data import KTrajectory, SpatialDimension
from mrpro.operators import CartesianMaskingOp, CartesianSamplingOp
from mrpro.utils import RandomGenerator
from typing_extensions ... |
f8c32b11c8300fab1d810bc4e4a7d258a31c6126d3828df4dfa752fbff18e30f | Python | 12,414 | 409 | """
Table Schema builders
https://specs.frictionlessdata.io/table-schema/
"""
from __future__ import annotations
from datetime import timezone
from typing import (
TYPE_CHECKING,
Any,
cast,
)
import warnings
from pandas._config import option_context
from pandas._libs import lib
from pandas._libs._ujson... |
1b5407e495b9eeb10ac0f2606ea0191e1f269b87842f05217c9f9b3125b1a2cb | Python | 12,423 | 341 | # -*- coding: utf-8 -*-
import os
import numpy as np
import argparse
import math
import time
import torch
import torch.backends.cudnn as cudnn
import torchvision.transforms as trn
import torchvision.datasets as dset
import torch.nn.functional as F
from models.augment import RandomErasing
parser = argparse.ArgumentPars... |
48fedc96ea4623a276020010fb51128ec6968139c200c0f0b5a6610d8d146f1c | Python | 12,428 | 316 | # Configuration file for the Sphinx documentation builder.
import ast
import dataclasses
import inspect
import os
import re
import shutil
import sys
from pathlib import Path
from typing import get_overloads
import nbformat
import sphinx.util.inspect
from sphinx.ext.autodoc import AttributeDocumenter, ClassDocumenter, ... |
14770e4e1bc3a8d99b1d3ecd21c456e6864eed16780010c65a8f1f622346739d | Python | 12,431 | 353 | import numpy as np
import pytest
from pandas._libs import lib
from pandas._libs.tslibs import (
NaT,
iNaT,
)
from pandas.errors import OutOfBoundsTimedelta
import pandas as pd
class TestTimedeltaRound:
@pytest.mark.parametrize(
"freq,s1,s2",
[
# This first case has s1, s2 bei... |
29da9d9322ef0fc362e86f30bf73d76029963b4220314c9e980b1c5b50545ca1 | Python | 12,431 | 335 | # Copyright 2018-2022 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or... |
220b14354f293a864efcf05ce3176171efba854576b13ce21860e56b1dc72da0 | Python | 12,440 | 265 | # from Environment import *
# from Parameter import *
import numpy as np
import pandas as pd
import tifffile, os, csv
from scipy import ndimage as ndi
Stats = {}
Stats['min_volume'] = 2
Stats['max_volume'] = 64
def get_local_voxels(block, zc, yc, xc, rad ):
"""
"""
xst = xc-rad if xc-rad>=0 else 0
yst ... |
4b180bcb64e8c692c3738f8aeb611d8e8d21dde2ea68a1067df9ffa934bb3527 | Python | 12,440 | 331 | import numpy as np
import struct
import matplotlib.pyplot as plt
events_VA = {
"Patient Table": 0x00000001,
"ECG1": 0x00000002,
"ECG2": 0x00000002,
"ECG3": 0x00000002,
"ECG4": 0x00000002,
"PULS": 0x00000004,
"RESP": 0x00000008,
"EXT1": 0x00000010,
"EXT2": 0x00000020,
"CardPT": 0... |
e8b304de8c414875fbc8032240f3e3ffac068ae0ad89d401dfe1dcb4acf06321 | Python | 12,450 | 334 | # Copyright 2018-2022 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or... |
471a7674c134c522c224465e185e40bd400c28d4c4ec74200f70cf0ec8190e5e | Python | 12,453 | 374 | # -*- coding: utf-8 -*-
# @File name: generate_table_stats_model.py
# @Author: Alicia Garrido-Peña
# @Date: 2023-08-11 01:54:37
# @Contact: alicia.garrido@uam.es
# "Copyright (c) 2023 Alicia Garrido-Peña. All Rights Reserved."
# Use of this source code is govern by GPL-3.0 license that
# can be found in the LICENSE... |
82443d84f3b39986d8b702abc8fe0cab10b26da8886d882f3af2cacdd0be8547 | Python | 12,465 | 375 | __all__ = [
"PeptideMassCalculatorBase",
"PeptideMassCalculator",
"PeptideMassAnnotationProto",
"PeptideMzAnnotationProto",
"PeptideMassAnnotation",
"PeptideMzAnnotation",
"FragmentTypeArray",
"FragmentNumberArray",
"LossTypeArray",
]
import abc
from typing import (
Generic,
... |
2d9e61e4b8c02baadc073c7bd69905ebc3612969c458d672788b4ca35552146c | Python | 12,466 | 311 | # Copyright 2018-2022 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or... |
0d5dd4856de3a798c3e66b03db2f8c51c959bc5a1f7e360eb1836728e77e3538 | Python | 12,472 | 383 | import numpy as np
import time
try:
import control
control_package_available = True
except:
control_package_available = False
def karman_E(k, L, sigma):
k_norm = np.linalg.norm(k)
return karman_E_norm(k, L, sigma, k_norm)
def karman_E_norm(k, L, sigma, k_norm):
E = 1.4528 * L * sigma**2 * (... |
92a27455b4139c208040d2285f28a05703a17937259ee89ea0e19c5f5ec708b1 | Python | 12,475 | 287 | # 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... |
d86802d59bc941ab9858ac7bb1c1f4ccdf2d219c800429a0aa24b9c717bd9d54 | Python | 12,478 | 306 | # 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... |
694b0b0627413208edc4015a18ee14aac3e870aabee409044bc14be1ffe32ee1 | Python | 12,482 | 372 | # 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... |
d6631261955b7ad28bcadd4a4d23c4c1527998b2e1bf1bf43d0830db81d380c4 | Python | 12,484 | 357 | from string import ascii_letters
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestCaching:
@pytest.mark.parametrize("do_ref", [True, False])
def test_setitem_cache_updating(self, do_ref):
# GH 5424
cont = ["one", "two", "three", "four", "five", "six... |
014d856549dae0e1c238f858b2f89fd5fa47e3044e3de1fac02d5fd33adeead6 | Python | 12,485 | 456 | # -*- coding: utf-8 -*-
# @File name: superpos_from_model.py
# @Author: Alicia Garrido-Peña
# @Date: 2023-08-04 13:20:51
# @Contact: alicia.garrido@uam.es
# "Copyright (c) 2023 Alicia Garrido-Peña. All Rights Reserved."
# Use of this source code is govern by GPL-3.0 license that
# can be found in the LICENSE file
... |
c0bdbac39cd1db3ad9a670558524e32298b152fec506cbe7e5fde95c2fde7352 | Python | 12,487 | 393 | from __future__ import annotations
from typing import (
TYPE_CHECKING,
Literal,
cast,
)
import warnings
import numpy as np
from pandas.errors import Pandas4Warning
from pandas.util._decorators import cache_readonly
from pandas.util._exceptions import find_stack_level
from pandas.core.dtypes.common impor... |
f50675b432f03e49425545233ab0fb7911d8dc00328dc5ec24f698a496e2e62e | Python | 12,489 | 333 | import numpy as np
import pytest
from pandas.core.dtypes.common import is_integer_dtype
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays import (
BaseMaskedArray,
BooleanArray,
FloatingArray,
IntegerArray,
)
arrays = [pd.array([1, 2, 3, None], dtype=dtype) for dtype in tm.ALL_... |
1d61f977c6a4fa4908e3f929027266bb0f7dedd108d8a007fbba0a1c60de05e0 | Python | 12,495 | 321 | import torch, numpy as np
from torch import Tensor
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Sequential, Linear, BatchNorm1d, Dropout, Parameter
from torch_geometric.nn.conv import MessagePassing
from torch_geometric.utils import softmax as tg_softmax
from torch_geometric.nn.inits i... |
3a704d0cdf74c4637dc34e25660de122308a0443a0a91eff03b1bbcafe3fb8d7 | Python | 12,496 | 233 | # SPDX-FileCopyrightText: Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of sourc... |
ac01d9fa528a7e51c919c2337c886fd540a72c0bfaa59b3da790c34377b2b0b0 | Python | 12,498 | 479 | import operator
import warnings
import numpy as np
import pandas as pd
from pandas import (
DataFrame,
Index,
Series,
Timestamp,
date_range,
to_timedelta,
)
from .pandas_vb_common import numeric_dtypes
try:
import pandas.core.computation.expressions as expr
except ImportError:
import... |
a2213d620ce7b4edcac18a1baf5b60d22d198c574ae0613212875f5f6460ccd3 | Python | 12,500 | 325 | import numpy as np
import pytest
from pandas._libs.tslibs import iNaT
from pandas._libs.tslibs.offsets import MonthEnd
from pandas._libs.tslibs.period import IncompatibleFrequency
from pandas.errors import (
OutOfBoundsDatetime,
Pandas4Warning,
)
import pandas as pd
import pandas._testing as tm
from pandas.co... |
8fa6c37e871495f17091ee9cbab491e01941e1c714f81396f444ab453af4e1da | Python | 12,501 | 332 | """
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
import torch
from torch_geometric.nn import SchNet
from torch_geometric.nn.models.schnet import GaussianSmearing, InteractionBlo... |
d7bd4d25413385dd3dc95e9dcebcf3fef43286d7fd7df2dc9a72528b389504f8 | Python | 12,515 | 259 | import pandas as pd
import os
import numpy as np
import time
from scipy.signal import find_peaks
import eLife_Grid_anchoring_2024.analysis_settings as Settings
from astropy.timeseries import LombScargle
from astropy.convolution import convolve, Gaussian1DKernel
def fill_rate_map(firing_rate_map_by_trial, peaks, field... |
79e85dd6670bd9656d07dc44d67096dfbf609530be8b7ae9f480f06d72b9f9ad | Python | 12,518 | 326 | """Fourier Operator."""
import warnings
from collections.abc import Sequence
from functools import cached_property
import torch
from typing_extensions import Self
from mrpro.data.enums import TrajType
from mrpro.data.KData import KData
from mrpro.data.KTrajectory import KTrajectory
from mrpro.data.SpatialDimension i... |
216cb69ffd85dcca28a7601c1b1939cd6643ed74b7f703fe40b2802d2e2b374e | Python | 12,528 | 348 | from functools import partial
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.tseries import offsets
@pytest.mark.parametrize("sp_func, roll_func", [["kurtosis", "kurt"], ["skew", "skew"]])
def test_series(series, sp_func, roll_func):
sp_stats = pytest.importorskip... |
eb18cb7642642b01424bb63ba04eefa5abcc941cde607a56ee346ad96c199539 | Python | 12,545 | 338 | #! /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... |
bf433ecbc8c6fa5b650dbb3ccbf567cd1210218794379435a71f524f6ff00a44 | Python | 12,551 | 256 | import argparse
import numpy as np
import os
import logging
from typing import Optional, List, Dict
from pydub import AudioSegment, effects
from pathlib import Path
from tqdm import tqdm
from scipy.io.wavfile import read as wavread
from LPCNet import LPCFeatureEncoder
from local.common import BCI2000MatFile, save_data_... |
56945980d8597da311cdaead87acc0d42bd867a54f2afca0ae69ee925d60fb72 | Python | 12,554 | 365 | from __future__ import annotations
from datetime import (
datetime,
timedelta,
)
from typing import (
TYPE_CHECKING,
Literal,
)
import numpy as np
from pandas._libs import (
lib,
missing as libmissing,
)
from pandas.util._decorators import set_module
from pandas.util._validators import check_... |
17db6200bc8855f3a0bf3afaada66afbbb78bb88a32d15f404b85ae7ba23400b | Python | 12,565 | 314 | import numpy as np, matplotlib.pyplot as plt, sys
import pumpprobe as pp
shuffle_connectome = False
shuffle_connectome_n = 1
for s in sys.argv:
sa = s.split(":")
if sa[0] == "--shuffle-connectome":
shuffle_connectome = True
shuffle_connectome_n = 1+int(sa[1])
plot = not shuffle_connectome... |
e2751f499551f8db78b5383c6efb70d2b8fcac1cd4d2a0c365044b8319f15d2d | Python | 12,567 | 309 | """Test nimare.meta.ale (ALE/SCALE meta-analytic algorithms)."""
import logging
import os
import pickle
import nibabel as nib
import numpy as np
import pytest
import nimare
from nimare.correct import FDRCorrector, FWECorrector
from nimare.meta import ale
from nimare.utils import vox2mm
def test_ALE_ma_map_reuse(tes... |
069bd5fc2b0279140a54283f2482e874b9d110a6feae6008478f30c0863c478f | Python | 12,570 | 402 | """
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
import torch
from torch_geometric.nn.models.schnet import InteractionBlock
from ocpmodels.models.ewald_block import EwaldBlock
... |
922385db30c5a896b13c6bc1064cdf256f6885eb043b342caecb23344d9fab98 | Python | 12,571 | 371 | import torch
import torch.nn.functional as F
import numpy as np
import os
import tarfile
import string
from sequence_models.constants import WEIGHTS_DIR, trR_ALPHABET, DIST_BINS, PHI_BINS, OMEGA_BINS, THETA_BINS
def probs2value(array, property, mask2d):
# input shape: batch, n_bins, ell, ell
# output shape: ... |
213d6fa3f3476808c0d98a3b53ccc8d81b10bc647a61c665769c4fbf314576de | Python | 12,576 | 304 | import numpy as np, matplotlib.pyplot as plt, sys
import pumpprobe as pp, wormdatamodel as wormdm
from scipy.optimize import curve_fit
from multipy import fdr
#this script is to print all the relevant numbers for the paper and save them as latex macros
ds_list = "/projects/LEIFER/francesco/funatlas_list.txt"
ds_tags ... |
4eb765a371d073572d55c05fc971ae81c10e0142f5091da6696078ef8dbf722d | Python | 12,589 | 413 | import warnings
import numpy as np
import pandas as pd
class Methods:
params = (
["DataFrame", "Series"],
[("rolling", {"window": 10}), ("rolling", {"window": 1000}), ("expanding", {})],
["int", "float"],
[
"median",
"mean",
"max",
... |
c16ceca947ebb19533d3c89f3ec35500b9ace80bbff20bdf1941d7df14939c89 | Python | 12,590 | 356 | import numpy as np
import pandas as pd
import pandas._testing as tm
def _permute(obj):
return obj.take(np.random.default_rng(2).permutation(len(obj)))
class TestPeriodIndex:
def test_union(self, sort):
# union
other1 = pd.period_range("1/1/2000", freq="D", periods=5)
rng1 = pd.perio... |
839be4c028184f7c6f265fa48d58f0823ad6e71a3e0e6d80ca0977331cf9a573 | Python | 12,593 | 355 | """
Functions for generating distance restraints from
evolutionary couplings and secondary structure predictions
Authors:
Thomas A. Hopf
Anna G. Green (docking restraints)
"""
from pkg_resources import resource_filename
from evcouplings.utils.config import read_config_file
from evcouplings.utils.constants import ... |
e9de8d3fa3d5f63e54370a5957efa891f54a2e37b809cb60f4b8328f8f442e89 | Python | 12,599 | 367 | # 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 agree... |
fce35800840534a3bb56a33cf0c491ff309132b5879e305e4357f5693a25d45f | Python | 12,601 | 411 | import sys
import numpy as np
def ms_read(file):
# 输出单倍型矩阵shape:(hap,varience)
f = open(file,'r')
headerIn = []
segsiteIn = []
header = f.readline()
headerIn.append(header)
program, numSamples, numSims = header.strip().split()[:3]
numSamples, numSims = int(numSamples), int(... |
4bc024074df9692f3fd441ceef49ef135c2a98f140591abbf4840553fdf7bba9 | Python | 12,614 | 335 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.arrays import BooleanArray
from pandas.core.arrays.boolean import coerce_to_array
def test_boolean_array_constructor():
values = np.array([True, False, True, False], dtype="bool")
mask = np.array([False, False, Fals... |
a68737a575891fbb6fe08ebf4b0dba5e51e745a885cbb2f82322f023d11a5728 | Python | 12,619 | 305 | import matplotlib
# matplotlib.use('Agg')
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
import numpy as np
import os
import argparse
import matplotlib as mpl
label_size = 16
#mpl.rcParams['xtic... |
c4a0bf6420d1de857ba418ae8240665bcdcfbca749a6a519b64de086004c4f4f | Python | 12,624 | 325 | """Define GGNN-based encoders."""
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from onmt.encoders.encoder import EncoderBase
class GGNNAttrProxy(object):
"""
Translates index lookups into attribute lookups.
To implement some trick which able to use list of nn.Modu... |
2f92fa814cc214e08013fea4605d5379e9c4516fb8b822b95bdee9986da4df01 | Python | 12,629 | 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 or agre... |
22c2ad9063a6cdb67b287bde0b6150c2e354867ac44d968f93dfcd268db0a945 | Python | 12,637 | 289 | """Factory utilities for building and combining losses from a Hydra config.
Three components work together:
- :func:`get_loss_classes` — returns the registry mapping loss-name strings to classes.
- :func:`get_loss_factories` — reads ``cfg.losses`` and ``cfg.model.losses_to_use``,
assembles per-loss parameter dicts,... |
01527fb03f446febef0b27d853e9c82883e4d197cef933d4726a97a5ab4983ff | Python | 12,638 | 392 | import argparse
import gc
import gzip
import itertools
import os
import os.path as op
import pickle
import matplotlib.image as mpimg
import matplotlib.patches as mpatches
import numpy as np
import pandas as pd
from gradec.fetcher import _fetch_metamaps
from matplotlib import pyplot as plt
from matplotlib.gridspec impo... |
38868b94092f569149b07a46010bc1a5da31e0d49f61968870481f2d6d3ca8a2 | Python | 12,639 | 333 | from Environment_ui 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):
tenso... |
c57dd3bbe5871796fef1e2b76959b3e5ccae45f97e652d9fc9e9a0e7201a73f0 | Python | 12,639 | 337 | from datetime import datetime
import dateutil
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestDatetimeIndex:
@pytest.mark.parametrize("tzstr", ["US/Eastern", "dateutil/US/Eastern"])
def test_dti_astype_asobject_around_dst_transition(self, tzstr):
# GH#1345... |
d912084bdf6080d3af025b4950d45fa2cf7fcff2066be42709b0751e44cd6a5b | Python | 12,651 | 367 | from typing import List
import torch.nn as nn
import torch
import torch.optim as optim
from apex import amp
import mlflow
from torch import nn as nn
from sequence_models.losses import VAELoss
from sequence_models.layers import FCStack
from sequence_models.metrics import UngappedAccuracy
class VAETrainer(object):
... |
730482ce83d90513ce147d40572b2de5be1242113a35470e44eb679d41d73584 | Python | 12,657 | 301 | import numpy as np
import argparse
import torch
import torch.backends.cudnn as cudnn
import torch.nn.functional as F
import torchvision.datasets as dset
import torchvision.transforms as trn
import torchvision.transforms.functional as trn_F
import torchvision.models as models
import torch.utils.model_zoo as model_zoo
fr... |
2c0e79de904e2da1d8c4d05a507cc9a5c97d738dd0767d0ded2f3f1c1a35c0f9 | Python | 12,659 | 399 | """
Tests the TextReader class in parsers.pyx, which
is integral to the C engine in parsers.py
"""
from io import (
BytesIO,
StringIO,
)
import numpy as np
import pytest
import pandas._libs.parsers as parser
from pandas._libs.parsers import TextReader
from pandas.errors import ParserWarning
import pandas as... |
f140e581315a3446fc39f0566dc1937e46a245ca88ab4ab3112acbf6f71cfaf4 | Python | 12,659 | 393 | """
Functions for implementing 'astype' methods according to pandas conventions,
particularly ones that differ from numpy.
"""
from __future__ import annotations
import inspect
from typing import (
TYPE_CHECKING,
overload,
)
import warnings
import numpy as np
from pandas._libs import lib
from pandas._libs.t... |
199928ebf917967c49da7699a95a46f6ff3f24987eea00e8bc30c3ad74a36ba9 | Python | 12,661 | 343 | """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 tqdm.auto import tqdm
from nimare import references
from nimare.decode.base import Decoder
from nimare.d... |
428b64af2796aced7060b12ad10190bfec330bb5dc0f43fead24656893842c0b | Python | 12,661 | 325 | # 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... |
6ef2457c93c2d20e8869134d5ba4a177486e83f23ef5bbc1b3a211afdec4c8df | Python | 12,662 | 254 | # -*- 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 ... |
fb6ea73260e46af0c3ba7f7846bf43e9118c3e7230790786be593ae3d2375a31 | Python | 12,664 | 411 | """
data hash pandas / numpy objects
"""
from __future__ import annotations
import itertools
from typing import TYPE_CHECKING
import numpy as np
from pandas._libs.hashing import hash_object_array
from pandas.core.dtypes.common import is_list_like
from pandas.core.dtypes.dtypes import CategoricalDtype
from pandas.c... |
41bc97dffcb78dd036dbac6269932133103bed5110737a03f2c9a32c93accfed | Python | 12,666 | 348 | # 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... |
db5f17e39ddab57a490626bf89e36a268dc82dd8c1bb1d7aaf572507059caf5e | Python | 12,666 | 234 | import typer
import torch
import pkg_resources
from dotenv import load_dotenv, find_dotenv
load_dotenv(find_dotenv())
import pandas as pd
from typing import List, Tuple
from rxn_yields.core import SmilesClassificationModel
from rxn_yields.data import generate_buchwald_hartwig_rxns
from rxn_yields.augmentation import ... |
269f3364f91b67897f167b5301dfe88067490578cb4ef5a1c5d124d849bc71d7 | Python | 12,669 | 332 | from __future__ import annotations
from typing import final
import numpy as np
import pytest
from pandas.core.dtypes.common import is_string_dtype
import pandas as pd
import pandas._testing as tm
from pandas.core import ops
# The axis=0 frame dispatch is the same code path for every op, so checking all of
# them ... |
83ae4c61909d1bb70e348f958a5c6f5695087844cd73f2e62023252a2ba38e47 | Python | 12,672 | 354 | # 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... |
6f0c7ef8e963a7109509be1e91565d53a1a7ec94d33688097c81478039bf15ed | Python | 12,680 | 400 | # 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... |
204d60603ac74cea2d561b3d9f1427e0ce0f77fd4b8d5e8acecaac630dd9da65 | Python | 12,683 | 429 | """Sinh-Arcsinh (SHASH) Distribution Implementation Module.
This module implements the Sinh-Arcsinh (SHASH) distribution and its variants as described in
Jones and Pewsey (2009) [1]_. The SHASH distribution is a flexible distribution family that can
model skewness and kurtosis through separate parameters.
The module ... |
c94b017e24322eaedab15ed048a6802003b85782c7051d4776cd1a3594737652 | Python | 12,683 | 409 | # 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... |
5d68a36eba3cdf8a8cfae8c7513db1e42bbf6fc0af1447b5814907146646dcc8 | Python | 12,690 | 375 | """Decode module."""
import os.path as op
from abc import ABCMeta, abstractmethod
import numpy as np
import pandas as pd
from joblib import Parallel, delayed
from nilearn import masking
from nimare import decode
from nimare.annotate.gclda import GCLDAModel
from nimare.decode.utils import weight_priors
from nimare.ext... |
a0fc1036640ea307188d7ca3aa986f03aaffb6b57340fc8be6400f36c65a6d79 | Python | 12,690 | 340 | import numpy as np
import pytest
from pandas.core.dtypes.common import is_integer_dtype
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays import (
BaseMaskedArray,
BooleanArray,
FloatingArray,
IntegerArray,
)
arrays = [pd.array([1, 2, 3, None], dtype=dtype) for dtype in tm.ALL_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.