sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
d578e69bd63d1e4a378b47d28168587dd848eadcea71d25a387e4aea6334a2e6 | Python | 11,045 | 343 | import re
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.tests.plotting.common import (
_check_axes_shape,
_check_plot_works,
get_x_axis,
get_y_axis,
)
pytest.importorskip("matplotlib")
@pytest.fixture
def hist_df():
df = pd.DataFrame(
np.r... |
d72eed93851e55b7410bbb96937de256220441920d2dd85e4767bc7d928731d9 | Python | 11,045 | 350 | #!/usr/bin/env python
"""Module Description: Test the memory-reporting logger in
MACS3/Utilities/Logger.py.
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).
"""
import importlib
import logging
import os
impo... |
0b1b9a585ee2ac6dd045578b22924200f4ccb855c051e289e2459a58d4fd2704 | Python | 11,047 | 295 | # basics
import os
import numpy as np
import nibabel as nib
from path import Path
from tqdm import tqdm
from skimage.util import view_as_windows
# import shutil
import time
#import psutil
# dl
import torch
import monai
from monai.networks.nets import BasicUNet
from .sliding_window_inferer import SlidingWindowInferer
... |
38c278ec6b4518f1d73e4d48b412c0c75fd0379956f881cc94ee9e7133c7f89e | Python | 11,048 | 275 | ''' This program will check neuronMetadata for a NeuronBridge release for
sample issues, optionally retagging documents. Documents will be tagged
with the word "unreleased" as well as the ALPS release.
'''
__version__ = '0.0.4'
import argparse
from operator import attrgetter
import sys
from time import strftim... |
850e37d755174804c83d0142e0e5014bca99c410ce2228563ef8563ec1aa0999 | Python | 11,048 | 337 | #!/usr/bin/env python3
"""Time a single (model, variant, decoder) inference configuration.
This script measures end-to-end video-prediction speed for exactly ONE
combination of model panel / precision-runtime "variant" / video-decoder
backend, and appends one CSV row per repeat to an output file.
It is intentionally ... |
032127633ad3cb281f05e1466e7c0436719491d9c4f0fa16826fdc7e443509a4 | Python | 11,063 | 316 | # 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... |
5c332b2b04883787efd3eef3f26c8f54f6c9fdf8af497178d375cfb0374b5f91 | Python | 11,078 | 352 | # 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... |
5a8d1deb88c414b22ab7d05026ff52004138129341c94702a6fdbc3c20b210ce | Python | 11,086 | 289 | # 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... |
fac6e55616b5f3032a877ac185e07ae4a5a32b19ec0bb179d1d8d63b7265ba24 | Python | 11,094 | 242 | import os
import re
import numpy as np
from quasinet import qnet
class QnetOrchestrator:
"""Manages utilities related to the Quasinet model, for example, training, saving, loading, and different methods of predicting
"""
def __init__(self, quantizer):
"""Initialization
Args:
q... |
a21171fffa196edd7d76da2adbe7033001c644c2bb0d82ff1942caa1be09fa40 | Python | 11,097 | 288 | # -*- coding: utf-8 -*-
import argparse
import os
import time
import torch
from torch.autograd import Variable as V
import torch.nn.functional as F
import torch.backends.cudnn as cudnn
import torchvision.datasets as dset
import torchvision.transforms as trn
import torchvision.models as models
import torch.utils.model_... |
0b3c121b8eaf7bbb89eff71607239ae0e5712a95c9ea733edb3c79e8e15231fe | Python | 11,103 | 298 | import operator
import numpy as np
import pytest
from pandas.core.dtypes.common import is_list_like
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays import (
BooleanArray,
IntervalArray,
)
from pandas.tests.arithmetic.common import get_upcast_box
@pytest.fixture(
params=[
... |
bca70f13077e77e42272618a2f9bd4eb7576903acf7aad8d8ba80e761012deb5 | Python | 11,110 | 276 | #statistics.py
from initialization.initialization import *
from initialization.config import *
import os
import numpy as np
import pandas as pd
import scipy.stats as st
import scipy.stats as stats
def average_per_condition(df, avg_per_rep=False):
'''
Function to calculate average value for each metric in... |
ab4a95575b8db7f957f5c76a9f6f79086cfa127f083279887ac29fbfb541bbfa | Python | 11,124 | 270 | import numpy as np
import numpy.linalg as la
from functools import partial
import logging
from .surfaces import Surface
from .curves import Curve
from .curves import measureNorm0, measureNormDef, measureNormGradient
from .curves import currentNorm0, currentNormDef, currentNormGradient
from .curves import varifoldNorm0,... |
65798d7d989671e8a42820b283690a405c6fe7502027613bc989e56f42548990 | Python | 11,125 | 225 | import pandas as pd
import numpy as np
class DataFormatter:
"""Parse raw data into usable format by the Quasinet
"""
def __init__(self):
pass
def load_data(self, fpath_data, fpath_meta, taxon_name='Phylum', tax_dict={'Class':'dummy'}, time_column_name='Age (days)', time_column_name_out='day',... |
c21aece51a3d297f57a00c71b7f8638f3f0577fc9ccc97205bfb17ee82a7b746 | Python | 11,126 | 355 | import operator
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.core import ops
from pandas.core.arrays import FloatingArray
# Basic test for the arithmetic array ops
# -----------------------------------------------------------------------------
@pytest.mark.parametri... |
59abec7f4e3e5aed50f0b60bbb04446c982039c76db740ee7a0bc7d54a98c898 | Python | 11,128 | 208 | from sklearn.metrics import accuracy_score
import pandas as pd
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_max_SNR, distance_from_integer, get_lomb_classifier
d... |
571c693930e8884b89855e97d5316a09811e1a2908e6b531d4f3e8bdce66570d | Python | 11,142 | 339 | """Phase 11: Analysis (statistical procedures) routes.
Endpoints:
- ``GET /analysis-kinds`` registered procedures
- ``GET /projects/{project_id}/analyses`` list
- ``POST /projects/{project_id}/analyses`` create (without running)
- ``GET /analyses/{id}`... |
0490453c9127a48a51504fb85c0c5a27ec0e4985d17ba6105a8ec1e575bc4091 | Python | 11,143 | 287 | """
Tests for the following offsets:
- QuarterBegin
- QuarterEnd
"""
from __future__ import annotations
from datetime import datetime
import pytest
from pandas.tests.tseries.offsets.common import (
assert_is_on_offset,
assert_offset_equal,
)
from pandas.tseries.offsets import (
QuarterBegin,
Quarte... |
2c315e36f8ce09ff017dc28c71c03f026c7b783b32f8c467b69efc267ec73b10 | Python | 11,144 | 247 | """Tests the IData class."""
from pathlib import Path
import pytest
import torch
from mrpro.data import IData
@pytest.mark.parametrize(
('dcm_data_fixture'),
[
'dcm_2d',
'dcm_2d_with_empty_field',
'dcm_3d',
'dcm_2d_rescale',
'dcm_3d_rescale',
'dcm_2d_multi_ech... |
36c0d36fe84be8016169a1193d8c1093bb6f17dd016bbe3f2b83d71aac081482 | Python | 11,147 | 290 | #!/usr/bin/env python
# To use the dashboard on a remote server:
# ssh -L 8265:0.0.0.0:8265 <server address>
# run validate.py
# open http://localhost:8265 in your browser
import os
import sys
import time
import argparse
import traceback
import rapidjson
import neuronbridge.model as model
import pydantic
import... |
04c3684f7b1589416605129fe00b36f1bbd3decff35319d9515c00d01f58fa8a | Python | 11,148 | 342 | import argparse
import traceback
import shutil
import logging
import yaml
import sys
import os
import time
import torch
import numpy as np
import random
torch.set_printoptions(sci_mode=False)
parser = argparse.ArgumentParser(description=globals()["__doc__"])
parser.add_argument(
"--config", type=str, required=Tr... |
e2b80b85d04aafdd912317524e83941d67d879eff0914fb99875638f98cf5a8a | Python | 11,152 | 318 | import torch
import torch.nn as nn
from torch.autograd import Variable
def weigths_init(m):
if isinstance(m, nn.Conv2d):
nn.init.normal_(m.weight.data)
nn.init.fill_(m.bias.data)
def Conv3dBlock(dim_in, dim_out,
kernel_size=3, stride=1, padding=1,
bias=True, use_bn=False):
if ... |
9263aa1a230ae8450f8a1f65d0e3cdc803e5c9f23c4fbe9fed7e08838adc0c51 | Python | 11,155 | 348 | import numpy as np
import pytest
from pandas._libs import groupby as libgroupby
from pandas._libs.groupby import (
group_cumprod,
group_cumsum,
group_mean,
group_sum,
group_var,
)
from pandas.core.dtypes.common import ensure_platform_int
import pandas as pd
import pandas._testing as tm
@pytest.... |
c4743c83ab14f8109410800c1a724547556515ae865bd8813aa2f358ea24300e | Python | 11,155 | 273 | """Tests for projection operator."""
import math
from typing import Literal
import numpy as np
import pytest
import torch
from mrpro.data import Rotation, SpatialDimension
from mrpro.operators import SliceProjectionOp
from mrpro.utils import RandomGenerator
from mrpro.utils.slice_profiles import SliceGaussian, SliceI... |
dc9c71a772077e4b9e353b88670369cb8b5558cdce43a4fc44ff0ef901a39af5 | Python | 11,155 | 288 | 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... |
4ebb4a4d9837e1364d8994a471bff465d12115aa2a364369cb56e13eba09c814 | Python | 11,157 | 332 | #
# File to train networks built from the hnn.py class.
#
# This file establishes the clebsch gordan coefficients, sets up an hnn with given parameters,
# loads holograms from .npy files, and then tests the network via a function call.
#
from argparse import ArgumentParser
import logging
import math
import os
import ... |
f0b19de2abcd36d5f2c0ec34a9251c92b96d23f19e6bdcdc014784fe5966f1ec | Python | 11,166 | 293 | # 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... |
2866add87541cb663b4a8e864dfaeab0b1a88424a7a157ed9c452cdb49005336 | Python | 11,169 | 263 | """
GPT-2 family:
"gpt2", "gpt2-medium", "gpt2-large", "gpt2-xl"
GPT-Neo family:
"EleutherAI/gpt-neo-125M", "EleutherAI/gpt-neo-1.3B", "EleutherAI/gpt-neo-2.7B",
"EleutherAI/gpt-j-6B", "EleutherAI/gpt-neox-20b"
OPT family:
"facebook/opt-125m", "facebook/opt-350m", "facebook/opt-1.3b", "facebook/opt-2.7b",
"facebook/o... |
79e4c212ac398a875bcb634d2f3a9a97402a281766ab1389f0ebe502e6ea3da2 | Python | 11,174 | 262 | # 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... |
965f339a14744820aef8d2c050901badda04528a16c1d67c051aeebde05b4c0e | Python | 11,174 | 365 | __version__ = "2.0"
__author__ = "Singh, Satnam"
__maintainer__ = "Singh, Satnam"
__contact__ = "satnam.singh@ivv.fraunhofer.de"
import torch
from torch.nn import Module
from torch.nn import Sequential
from torch.nn import (
Conv3d,
Dropout3d,
MaxPool3d,
ReLU,
BatchNorm3d,
ConvTranspose3d,
... |
ca00ac49beeb7cb919239bcea022fe17c6ae423e138c5385595e002e1ebb9d4e | Python | 11,174 | 384 | """
Module responsible for execution of NDFrame.describe() method.
Method NDFrame.describe() delegates actual execution to function describe_ndframe().
"""
from __future__ import annotations
from abc import (
ABC,
abstractmethod,
)
from typing import (
TYPE_CHECKING,
cast,
)
import warnings
import n... |
d5d308d6332cf6538d542cc34e1d2de661f6b90b238f94b2ba9252fc08615693 | Python | 11,177 | 284 | # 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... |
ef22061d406baea0d6f8e18199c3d4e3eb7d0ea028444982305461ece2d348c2 | Python | 11,178 | 263 | # 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... |
fbd5962ddacfb389da453564319a8445f615819429c133988b30ea87c5b0e569 | Python | 11,180 | 197 | # 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, ... |
622a588e15b96ca3431610ea18bbe5f41332b9d45fd2bb0cc6a712ee68a1d9a6 | Python | 11,191 | 358 | import numpy as np
import pytest
from pandas.errors import UnsortedIndexError
import pandas as pd
import pandas._testing as tm
from pandas.core.indexes.frozen import FrozenList
def test_sortlevel(idx):
tuples = list(idx)
np.random.default_rng(2).shuffle(tuples)
index = pd.MultiIndex.from_tuples(tuples)... |
a17ad2f351270b51662cab96adcccfa66a22162763f6fb96020ee20f11198655 | Python | 11,194 | 256 | import numpy as N
import os
def read_bundle( infile ):
points = []
bun_file = infile + 'data'
os.path.getsize( bun_file )
bytes = os.path.getsize( bun_file )
num = bytes / 4
num_count = 0
f = open( bun_file , 'rb')
while num_count < num:
p = N.frombuffer( f.read( 4 ), dtype=N.int32 )[ 0 ] # numero... |
8a7f569a10945491e110072c07d8c8613df626f3063699d9bc866c90148305e0 | Python | 11,199 | 401 | from __future__ import annotations
from typing import (
TYPE_CHECKING,
cast,
)
from pandas._libs import (
NaT,
lib,
)
from pandas.errors import InvalidIndexError
from pandas.core.dtypes.cast import find_common_type
from pandas.core.algorithms import safe_sort
from pandas.core.indexes.base import (
... |
33bec824bd5d677bbc9a14924eccb67cc94da4f25ed4ca21425a53d2ae297146 | Python | 11,203 | 369 | # %%
import functools
import itertools
import os
from typing import cast
import pandas as pd
from deepglyco.chem.common.elements import ElementCollection
from deepglyco.chem.gpep.fragments import GlycanFragmentTypeCollection
from deepglyco.chem.gpep.glycans import MonosaccharideCollection
from deepglyco.chem.gpep.gpm... |
1ab8acfe3452ef0475c912b32ecc29c9054b0356603f3ad9fe95f275ab45598a | Python | 11,213 | 312 | # 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... |
5f07f391ddc107b8deb84438f6b70256b4de5270cb96c6f2ae3a8fa4279cbb38 | Python | 11,217 | 316 | # Copyright 2018-2023 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or... |
7327ecfe4ae8c2db425a75ce27707ad360fe1931a96ad5ef712b486b5e541d98 | Python | 11,222 | 319 | # Module: containers.metrics.time_series
# Author: Antoni Baum (Yard1) <antoni.baum@protonmail.com> and Miguel Trejo <amtrema@hotmail.com>
# License: MIT
# The purpose of this module is to serve as a central repository of time series metrics. The `time_series` module will
# call `get_all_metrics_containers()`, which w... |
85d915ba763355ac84a915878c51ccf09ea275afb49f1ac908f2e884c9110999 | Python | 11,222 | 261 | '''This dumper is designed for dataframes with the following properties:
- index is str
- str columns have a lot of repetitive values.
How will it save the dataframe?
1. If the number of partitions is very big (>10000), it will repartition the
dataframe to 5000 partitions. Loading such a dataframe is no... |
52e7a32c8ac5d084fd78d05affb36e6cc479c0407f2d20875095aaa09e4d8493 | Python | 11,233 | 308 | from collections import Counter
from typing import Any, Callable, List, Literal, Union
import numpy as np
import pandas as pd
FieldList = Union[Literal["all"], list[str]]
class Session(object):
"""Holds data and metadata for a single session."""
def __init__(self) -> None:
self.metadata: dict[str,... |
6b67a7659984dd0a256a4e96798b674f1bb0a2cb40d4a48a8de19bda172e66bf | Python | 11,233 | 247 | import sys, re, argparse
argparser = argparse.ArgumentParser('''
Extracts recall values from a user-supplied list of lrtsignifs and outputs a space-delimited table of results.
''')
argparser.add_argument('lrtsignifs', type=str, nargs='+', help='One or more *.lrtsignif files from which to extract lme comparison results... |
e28d20e72900aba718059e7ebb2b421c3b1548de66e73e326e915154b8134d7e | Python | 11,234 | 295 | '''
'''
import argparse
import collections
from copy import deepcopy
import json
from operator import attrgetter
import sys
import boto3
from botocore.exceptions import ClientError
import inquirer
from tqdm import tqdm
import jrc_common.jrc_common as JRC
import neuronbridge_common.neuronbridge_common as NB
__version_... |
c60ff8e10371b2ad972ab00441dd0d8b68c54ed2d9581a5089f73f5a83492ecf | Python | 11,240 | 431 | """Test dock."""
# ------------------------------------------------------------------------------
# Imports
# ------------------------------------------------------------------------------
from functools import partial
from phylib.utils.testing import captured_logging, captured_output
from pytest import raises
from... |
2eb6d473f1499acd40c83993958776eb8e5fe28e6d216c5f2146e73db5f95a59 | Python | 11,245 | 283 | # 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... |
1885571516649e5348c6b393a5f88ddaafcddb319e3ba6f5023fcf68a2be98f2 | Python | 11,246 | 309 | import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
@pytest.mark.filterwarnings("ignore:The inplace keyword in Series.drop_duplicates")
@pytest.mark.parametrize(
"keep, expected",
[
("first", pd.Series([False, False, False, False... |
960b4eb12e0d5bb85ebaab46ab9a28f86d2bb45c94310afc8769e11d6aaa4f6e | Python | 11,255 | 389 | from typing import Callable, Dict, Optional, Tuple, Union, cast
import torch
import torch.nn as nn
import torch.nn.functional as F
from ..transform import mat_update_resolution
from ..slice_acquisition import slice_acquisition, slice_acquisition_adjoint
from ..image import Volume, Stack
from ..utils import get_PSF
de... |
0511254ac294eceb2d5ee96f821d5a21295e936fc385507ec040e13717106b00 | Python | 11,257 | 375 | """
Option to give an executable a yaml file and parse all the information rather
than a load of command line arguments. More readable and serves as a record.
General idea is to convert the configuration yaml file into a dictionary,
then these functions parse that dictionary into separate dictionaries
which can be us... |
e4abe4ffca1eb562963e92d9571ee1f3b6b15e57aa6b72cce80325e306417697 | Python | 11,259 | 251 | from spycon.spycon_inference import SpikeConnectivityInference
import pyinform
from itertools import repeat
import multiprocessing
import numpy
from scipy.stats import norm
class TE_PyInform(SpikeConnectivityInference):
def __init__(self, params: dict = {}):
"""Implements the transfer entropy method from
... |
b03d5f43a86e2b148e065a02c34a58bdd72c11cc5668e78258c12d9d37e9a2f7 | Python | 11,264 | 290 | """Template GUI."""
# ------------------------------------------------------------------------------
# Imports
# ------------------------------------------------------------------------------
import logging
from operator import itemgetter
from pathlib import Path
import numpy as np
from phylib import _add_log_file
... |
f522c5b06a171a499f8bbc4459a1788240da85ad359334ac0278aab952af3a58 | Python | 11,267 | 325 | """Tests for reshaping utilities."""
from collections.abc import Sequence
import numpy as np
import pytest
import torch
from mrpro.utils import (
RandomGenerator,
broadcast_right,
broadcasted_rearrange,
normalize_index,
normalize_indices,
ravel_multi_index,
reduce_view,
reshape_broadca... |
2524e3c3bf213754d326ce88234f0e5f59be513aa71c0efffe8fceab52cacf8d | Python | 11,269 | 243 | import matplotlib.pylab as mpl
import matplotlib.patches as patches
from matplotlib import gridspec
import numpy as np
import pandas as pd
from scipy import stats
def plot_rasters(T_rasters, V_rasters, window, bin_size, modality = 'touch', ylim_r = None, ylim_p = None, size_mult = 1):
fig = mpl.figure(figsize... |
0213a46c8e3af29a579386c052609bf6c0cf567a94596c806c5c17fc6112efb7 | Python | 11,271 | 271 | # %% [markdown]
# # $T_1$ mapping from a continuous golden radial acquisition
# %% [markdown]
# ### Overview
# In this acquisition, a single inversion pulse is played out, followed by a continuous data acquisition with a
# a constant flip angle $\alpha$. Data acquisition is carried out with a 2D Golden angle radial t... |
81a007cb32d4fad05c4ba5d4737b33b2342ea41eb33dc5a99508f8211dd45ff6 | Python | 11,273 | 326 | 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... |
ac2ec8d428f6bb0192e7a0dcec69cc0eae16a0638831299d87e488e926118c34 | Python | 11,279 | 242 | import matplotlib.pylab as mpl
import matplotlib.patches as patches
from matplotlib import gridspec
import numpy as np
import pandas as pd
from scipy import stats
def plot_rasters(T_rasters, V_rasters, window, bin_size, modality = 'touch', ylim_r = None, ylim_p = None, size_mult = 1):
fig = mpl.figure(figsize... |
116960853da5e8627c5fe258d5a5a8a81c4a8a7b6efdf20c235565c43c9e0708 | Python | 11,281 | 333 | import os
import numpy as np
import torch
import torchvision.transforms as trn
import torchvision.transforms.functional as trn_F
import cv2
from PIL import Image as PILImage
import skimage.color as skcolor
from skimage.util import random_noise
from wand.image import Image as WandImage
from wand.api import library as wa... |
771091d9e0e9c1e0502e8a444d56d432e5093c018e3352112344080166f9e03f | Python | 11,282 | 330 | import numpy as np
import logging
from .linesearch import line_search_wolfe
# added comment to test git, 4-26-19
# Class running BFGS
# opt is an optimizable class that must provide the following functions:
# getVariable(): current value of the optimzed variable
# objectiveFun(): value of the objective function
#... |
01f4224d6ceeea34dab292e35db98e0fe6ff0e2dbcc1f0981e1fece429a54e5a | Python | 11,285 | 340 | #!/usr/bin/env python3
# coding: utf-8
"""Chromosight's io submodule contains input/output related functions to load
contact matrices in cool format, and save output patterns coordinates and
windows."""
import pandas as pd
import numpy as np
import pathlib
import sys
import csv
import shutil
from urllib.request import... |
af5b5d3be6f5b61d8a1b1fef28507b7cbd0f0a325be0cd57dbd7eb46de5b4556 | Python | 11,285 | 301 | import logging
import os
import numpy as np
from torch_geometric.graphgym.config import cfg
from torch_geometric.graphgym.utils.io import (
dict_list_to_json,
dict_list_to_tb,
dict_to_json,
json_to_dict_list,
makedirs_rm_exist,
string_to_python,
)
try:
from tensorboardX import SummaryWrit... |
0df25fc23234655f9e2ff5c9febe0bdbdcdb73823e7e539e29670f31eb537bde | Python | 11,286 | 324 | from concurrent.futures import ProcessPoolExecutor
from typing import Dict, List, Optional, Tuple, Union
import numpy as np
import pandas as pd
import pystan
from scipy import sparse
from .. import config, utils
from ..logging import logger
def read_pi(
pi_path: str,
group_by: Optional[List[str]] = None
) -... |
6e501f1f02b774dad1a58e2fb448197f0c091d340451ccdd81b112756c33027c | Python | 11,287 | 342 | # 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... |
574e9f6a243ba5a72a848bf326c8de9fd7d6e77bf7532486bdbe893bb7e5daff | Python | 11,288 | 301 | import numpy as np
import sys
import os
import csv
import time
import pandas as pd
from abc import abstractmethod, ABC
from typing import Tuple
from copy import deepcopy
from sklearn.model_selection import KFold
import torch
import pytorch_lightning as pl
from pytorch_lightning.callbacks.model_checkpoint import ModelCh... |
c45b03ef90345f1cd5e284bf474a229b388371ea01fcf32c76ffdaa54baba2df | Python | 11,289 | 330 | from contextlib import closing
import re
import numpy as np
import pytest
from pandas.compat import is_platform_windows
import pandas as pd
import pandas._testing as tm
from pandas.io.pytables import TableIterator
tables = pytest.importorskip("tables")
pytestmark = [pytest.mark.single_cpu]
def test_read_missing... |
17ac0d5f4a62196df08b3b22183b91f1d749db69078e5fc2080f850d356c6c5e | Python | 11,291 | 343 | from __future__ import print_function
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
from torchvision import transforms
from torch.utils.data import Dataset
import os
import cv2
from tqdm import tqdm
import time
import matplotlib.pyplot as plt
train_tr... |
88fc857d4f139d8271bab988b11880abc67a2885a048e99b9d4c5b9e361db1ce | Python | 11,300 | 605 | #!/usr/bin/env python
# coding: utf-8
# <a href="https://colab.research.google.com/github/Cyberbullying-Detection/Cyberbullying-Detection-on-Social-Media-using-Deep-Learning-and-Conventional-Machine-learning/blob/main/BERT.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt=... |
56d4fef2e1d615850513f58410262c3e540a717cb250c622983988fda6dda501 | Python | 11,301 | 291 | import datetime
import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas.util._test_decorators as td
import pandas as pd
import pandas._testing as tm
class TestConvertDtypes:
@pytest.mark.parametrize(
"convert_integer, expected", [(False, np.dtype("int32")), (True, "Int32... |
41745bb4d59fb7864238e0908ca6d3923930ef58ca37d406fb711a30c35e681b | Python | 11,309 | 338 | import numpy as np
import ctypes
class MyStruct(ctypes.LittleEndianStructure):
def __eq__(self, other):
for field in self._fields_:
attr_name = field[0]
a, b = object.__getattribute__(
self, attr_name), object.__getattribute__(other, attr_name)
is_array... |
444bc3408a23cb9fd092cbffd8fc6087663b7a663bc29789645aea800a5dd9bd | Python | 11,314 | 353 | from datetime import (
date,
timedelta,
)
import re
import numpy as np
import pytest
from pandas._libs.tslibs.timezones import maybe_get_tz
import pandas.util._test_decorators as td
import pandas as pd
import pandas._testing as tm
def _compare_with_tz(a, b):
tm.assert_frame_equal(a, b)
# compare t... |
6da0289498f262dfe0ec9285457ec1edb526a2d352572a4216df85f6dbc680ea | Python | 11,314 | 276 | # Copyright 2018-2024 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or... |
d9250b9aa43576e30d4a2f39c09234973045ca92e172d037fd720c5c58027b42 | Python | 11,314 | 313 | import torch
import numpy
import matplotlib.pyplot as plt
import bionetwork
import plotting
import saveSimulations
import pandas
from scipy.stats import pearsonr
#import pandas as pd
batchSize = 1
#Load network
networkList, nodeNames, modeOfAction = bionetwork.loadNetwork("data/ToyNetRecurrent-Model.txt")
annotation ... |
c8ed839e5ed29d0a50ab66203b985b0f35d090bb84088cac5891ac7e7a38ac83 | Python | 11,325 | 316 | import logging
import numpy as np
from scipy import linalg as LA
from .curves import Curve
from .surfaces import Surface
from numba import jit, int64
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
@jit(nopython=True, debug=True)
def ComputeIntersection_(VS, SF, ES, FES, WS, u, offset):
#... |
3f57c5f0676d8d84a59639a0ba26134acab12ba62ed9f462cfa3213019560ecf | Python | 11,332 | 308 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
def check_freq_ascending(ordered, orig, ascending):
"""
Check the expected freq on a PeriodIndex/DatetimeIndex/TimedeltaIndex
when the original index is generated (or generate-able) with
period_range/date_range/timedelt... |
99bece8ddd8ec70b3dcf7cd0b030f0ed1a9c33cec7627ba67eb2d09045669a11 | Python | 11,332 | 175 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'guioverview.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):
Main... |
66cfdacecae94277ddd5298147c298369d29ffd11ce10de9e3810438aeb88625 | Python | 11,335 | 286 | # 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... |
5bca754763b94229491512a190a5be5b6f6646c24a668e4c290dab7a58fdbfd9 | Python | 11,337 | 313 | import torch
import numpy
import matplotlib.pyplot as plt
import bionetwork
import plotting
import saveSimulations
import pandas
from scipy.stats import pearsonr
#import pandas as pd
batchSize = 1
#Load network
networkList, nodeNames, modeOfAction = bionetwork.loadNetwork("data/ToyNetRecurrent-Model.txt")
annotation ... |
db1b721bf1d22a9f8658ce683c227282c534ad3995f47f28db415fa182df09ba | Python | 11,337 | 265 | # -*- coding: utf-8 -*-
"""
Created on Sun Dec 20 17:02:31 2020
@author: Wladek
"""
import numpy as np
import matplotlib.pyplot as py
import matplotlib as mpl
from matplotlib.colors import LogNorm
from figure_properties import *
import matplotlib.patches as mpatches
from scipy.signal import welch, argrelmin, butter,... |
d86fea60139d23af10f2bf98f294994f324b1f01ffaa70e8f2cb40013f99f798 | Python | 11,340 | 468 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
from matplotlib.lines import Line2D
# increase the figure size
plt.rcParams["figure.figsize"] = [12, 10]
# remove the top and right spines from plot in the global plt setting
plt.rcParams["axes.spines.top"] = False
plt.rcParams["ax... |
36b9de65dd2dddb0be941c376e1918e5d8adddc67f6c3c38f1e744701758ac28 | Python | 11,342 | 319 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import random
import sys
import math
import pandas as pd
import seaborn as sns
from torch.distributions.categorical import Categorical
from torch.distributions.beta import Beta
from collections import defaultdict
from torch.distribut... |
64f3c5697663bfcc450a2ee952b42451c8b43ad742fe39e609fcb24c74a55b92 | Python | 11,342 | 441 | import argparse
import os
import sys
import torch
from sklearn.model_selection import train_test_split as split
from roost.roost.data_pretrain import CompositionData, collate_batch
from roost.roost.model_pretrain import Roost
from roost.utils_pretrain import train_ensemble
def main(
data_path,
fea_path,
... |
4505793bfd58749103d8978f220c2bbb363ca1fc0fcd8e93f3a2d2346cb1f2ea | Python | 11,343 | 316 | import copy
from PyQt6 import QtCore, QtWidgets
from ... import pipeline
from .pm_element import MatrixElement
from .pm_plot import MatrixPlot
class PlotMatrix(QtWidgets.QWidget):
plot_modify_clicked = QtCore.pyqtSignal(str)
matrix_changed = QtCore.pyqtSignal()
def __init__(self, *args, **kwargs):
... |
fd69f5123e2e27939196b319c299b3a255dce0764b431d8d292f86eb6db5fb4f | Python | 11,348 | 410 | import importlib.metadata
import warnings
import numpy as np
import pytest
from pcntoolkit.math_functions.basis_function import (
BasisFunction,
BsplineBasisFunction,
CompositeBasisFunction,
LinearBasisFunction,
create_basis_function,
)
from test.fixtures.norm_data_fixtures import *
@pytest.mark... |
170bd3f3c71d21d3b5949684c1da5ac98180d209a36fda645b2c36f4b355e6fc | Python | 11,352 | 284 | # cython: language_level=3
# Time-stamp: <2025-07-24 15:46:59 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
# ---... |
700452a075ff7928651203c8e56253472081527be68a5e7e43cea0a25c6014c0 | Python | 11,354 | 294 | import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays.categorical import CategoricalAccessor
from pandas.core.indexes.accessors import Properties
class TestCatAccessor:
@pytest.mark.parametrize(
"method",
... |
4a90c47091f9ce1c38d3441f2628abf87978b07e37d94d73df56272d6c34b8dc | Python | 11,358 | 311 | import numpy as np
import pytest
import pandas as pd
mpl = pytest.importorskip("matplotlib")
pytest.importorskip("jinja2")
from pandas.io.formats.style import Styler
pytestmark = pytest.mark.usefixtures("mpl_cleanup")
@pytest.fixture
def df():
return pd.DataFrame([[1, 2], [2, 4]], columns=["A", "B"])
@pytes... |
6f4b0b24a84eb6a9decb22b6841bdb9f37a8cf18e19da2b3b3a4675d1c960a5a | Python | 11,362 | 342 | # 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... |
6aeb81acbc553ab840d97f2067a4b462fb507b8c889bf77c6ccfc1d1653c61f6 | Python | 11,364 | 325 | import numpy as np
import pytest
import torch
import torch.nn as nn
from lightning_pose.models.heads.heatmap import (
HeatmapHead,
make_upsampling_layers,
run_subpixelmaxima,
upsample,
)
class TestMakeUpsamplingLayers:
@pytest.mark.parametrize("n_layers", [1, 2, 3])
def test_basic_parameters... |
ce882218267f32f6d9f6c82c362ba07593892c35aff5de46cd9d43c3e1acc663 | Python | 11,376 | 342 | """Session 20: workspace members + X-PyCaret-Key middleware.
Tests cover:
- Member CRUD + the last-admin guard on both demote + remove
- API keys actually work as a bearer alternative end-to-end against
a normal protected route (workspaces list)
"""
from __future__ import annotations
from collections.abc imp... |
251f46ed73661de41c7c29c6033a5ccbd3da058734a93c1ae0cfc9385ca7756a | Python | 11,381 | 296 | '''
This script is used to test Current Source Density Estimates,
using the kCSD method Jan et.al (2012)
This script is in alpha phase.
This was written by :
Chaitanya Chintaluri,
Laboratory of Neuroinformatics,
Nencki Institute of Exprimental Biology, Warsaw.
'''
import os
import scipy.stats as st
import numpy as ... |
3494a1542fc1843c30457551e23bbd777596a571be9f7ccad3e52d33322400d8 | Python | 11,387 | 268 | #######
# This code was written by Nino Verwei, Niek van Hilten, and Andrius Bernatavicius at Leiden University, The Netherlands (29 March 2023)
#
# When using this code, please cite:
# Van Hilten, N.; Verwei, N.; Methorst, J.; Nase, C.; Bernatavicius, A.; Risselada, H.J., Bioinformatics, 2024, 40(2) DOI: 0.1093/bi... |
7c7010ab6114795844c931d395a067b11c67652a55381a1ecf406c10cf24e85f | Python | 11,390 | 328 | # 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... |
7188f404917288c2a9f8df4170c0f75315e566b36009deaba0b4eb140072e233 | Python | 11,392 | 287 | # 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... |
1dd92947a0663ea6285522bdede92d8b829cf20d9200d1171989e9627348a20d | Python | 11,410 | 312 | #%%
from src.experiment import ExperimentBuilder
from src.analyzier import StatsAnalyzer
from src.plotter import Plotter
from src import plotting
from pathlib import Path
from sklearn.linear_model import BayesianRidge
import argparse
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import stats... |
a5c243eac48799dfae8f79d941465b5e4bdd30aba0f4f34cc95d16a627227b7e | Python | 11,415 | 184 | import itertools
import os
from typing import Callable
import numpy as np
import scipy.io
# Note: All connectivity matrices are in [from,to] order, so should be transposed for plotting / other usage if required!
class ConnectivityMatrix():
def __init__(self, num_pen: int, num_peg: int, num_epg: int, num_d7: int, loa... |
0d16d9a30a158ff7e06f136bc4fe443ec713a7b096970ca524c5507b2a485fd4 | Python | 11,419 | 361 | import redis
import yaml
import argparse
# -----------------------------------------------------------
def get_parameter_value(yaml_path, field):
"""
Get the parameter specified by 'field' from a file
Parameters
----------
yaml_path : str
Path of the YAML file
field : str
Name ... |
a95dbfd855cb3f870133b1add77c9cf81dee2e183f7b0d9ac7fc3b581d6a0515 | Python | 11,421 | 279 | 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... |
9c3b357ec31c7dd953309e383bca5845f60f24832d652c2b5d5db2f3c1530434 | Python | 11,422 | 323 | """General Operators."""
from __future__ import annotations
from abc import ABC, abstractmethod
from functools import reduce
from typing import Generic, TypeAlias, cast
import torch
from typing_extensions import TypeVar, TypeVarTuple, Unpack, overload
import mrpro.operators
from mrpro.utils.TensorAttributeMixin imp... |
8037d029fb8503f195747198c39802a0be4b257bb2c0d096c6d03baa05942ea5 | Python | 11,435 | 289 | # 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... |
5f08abf135b1dd66fa115ce4e2ac9a893c28ae486185996d5e90937c1b06d9fe | Python | 11,438 | 337 | """Phase 10: monitoring + alerting routes.
Endpoints:
- ``GET /workspaces/{ws}/alert-rules`` list
- ``POST /workspaces/{ws}/alert-rules`` create
- ``PATCH /alert-rules/{id}`` toggle / edit
- ``DELETE /alert-rules/{id}``
- ``GET /deployments/{id}/metrics`` ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.