sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
d66e7a5a5e895bf3f27af59e48e150baecce13e72d81dfcd175abdb6fcd028d4 | Python | 25,893 | 701 | import zoneinfo
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
@pytest.fixture(
params=list(
{
"bool": [True, False, True],
"int64": [1, 2, 3],
"float64": [1.1, np.nan, 3.3],
"category": pd.Categorical(["X", "Y", "Z"]),
... |
76b3242880537ccd9c1e6b86ba86c40d241e9196e71587ff1d270ab3688e7532 | Python | 25,894 | 730 | import re
import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
def assert_equal(a, b):
assert a == b
class TestMultiIndexSetItem:
def check(self, target, indexers, value, compare_fn=assert_equal, expected=None):
target.loc[inde... |
f6d43ce6958fc1d40a063bbe93afcc361d0f6c964a9e02b1b8a0dbca6fb714df | Python | 25,903 | 692 | from types import MappingProxyType
import numpy as np
import pytest
import pandas as pd
pytest.importorskip("jinja2")
from pandas.io.formats.style import Styler
from pandas.io.formats.style_render import _str_escape
@pytest.fixture
def df():
return pd.DataFrame(
data=[[0, -0.609], [1, -1.228]],
... |
599a59fd4fe43295479e9088ff07bed8de901c2f39096568f9e3b7c7a074f4cc | Python | 25,906 | 771 | import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
def _assert_series_equal_both(a, b, **kwargs):
"""
Check that two Series equal.
This check is performed commutatively.
Parameters
----------
a : Series
The fir... |
e57b49c221fddd8012855bcf93f4e0b04394303a972ad8d370e9a1381664513a | Python | 25,925 | 684 | #%%
from values import *
import numpy as np
from defs import *
def female_conc(cell, i):
# Concentrations of K, Cl are lower in female rat.
cell.conc[1,5]=cell.conc[1,5]-1
cell.conc[2,5]=cell.conc[2,5]-1
if cell.segment == 'PT':
if cell.preg == 'mid':
# conc of Na, K, Cl, HCO3 diffe... |
eca685969d92ec2a12d15442fa3725b323794cfcb768d5a0a6a627209ebaec53 | Python | 25,955 | 592 | # Copyright 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 agre... |
1aa9914a1b9972c56a36552da319a2b3ed14586bc3a5ed7efac074139b4b1408 | Python | 26,014 | 566 | # 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 ... |
6228346db8dddc59e120926cca52c92f39ca9d663b442ebed9ca5c2a3c1c9426 | Python | 26,025 | 680 | # 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... |
0c85f3a37cb3759c0ec0fbd8ab94570fb61b7c0543ff2efb81be6c8ae48f5f44 | Python | 26,037 | 796 | """Miscellaneous spatial and statistical transforms."""
import copy
import logging
import os.path as op
import nibabel as nib
import numpy as np
import pandas as pd
from nilearn.reporting import get_clusters_table
from scipy import stats
from nimare import references
from nimare.base import NiMAREBase
from nimare.du... |
56c34311fc61dc1228e0c70a70976c2594b9d6210c1b33193e46d4eba5175ffc | Python | 26,052 | 641 | """
Tests for Fiscal Year and Fiscal Quarter offset classes
"""
from datetime import datetime
from dateutil.relativedelta import relativedelta
import pytest
import pandas as pd
from pandas.tests.tseries.offsets.common import (
WeekDay,
assert_is_on_offset,
assert_offset_equal,
)
from pandas.tseries.offs... |
e5641e0c3c94aebabd01f1b45f7eb4763dc2191c13877329e47040dbd1fddb37 | Python | 26,109 | 701 | # 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... |
c00099efb2f61717b1139c6cac400b0eaea5b37711225dd0ff2342a2b4028cd6 | Python | 26,115 | 602 | import numpy.linalg as la
import logging
from . import surfaces, surface_distances as sd
#import pointEvolution_fort as evol_omp
from . import conjugateGradient as cg, pointEvolution as evol
from . import surfaceTimeSeries
from .affineBasis import *
## Main class for surface matching
# Template: sequence of s... |
24af705d6ef647312f3abaaac32238730863503b4f84363a92d6508a053027c2 | Python | 26,116 | 713 | import datetime as dt
from datetime import datetime
import dateutil
import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
class TestDatetimeConcat:
def test_concat_datetime64_block(self):
rng = pd.date_range("1/1/2000", periods=10)
... |
94e5c3125fc5aa07051b3d73d961c83c189b20951d6a13e7b4e1536baecd7256 | Python | 26,120 | 586 | # 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... |
33d962dab438ab3a506428064e9595804a009eb843cc317ab526c60b4139ae76 | Python | 26,184 | 801 | """Miscellaneous spatial and statistical transforms."""
import copy
import logging
import os.path as op
import nibabel as nib
import numpy as np
import pandas as pd
from nilearn.reporting import get_clusters_table
from scipy import stats
from . import references
from .base import Transformer
from .due import due
fro... |
b70aeaa4d3ce03cc159ac6022af27abbda8cb700aff787933f565e7e427eeb33 | Python | 26,193 | 713 | # -*- coding: utf-8 -*-
import warnings
from itertools import count
from typing import Dict, List, Optional, Union
import numpy as np
from .backends import Backend
from .model import Model
from .moves import StretchMove
from .pbar import get_progress_bar
from .state import State
from .utils import deprecated, deprec... |
982903354a49d51a5f551934c3b73bf1585309842c90024ffe2144cbd6f7b9e9 | Python | 26,196 | 599 | #! /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... |
7cd4d15f4707bf9174114a6a560b8eb6b9f95f2dcd2462f8ccda2a1de979c419 | Python | 26,202 | 691 | # -*- coding: utf-8 -*-
import json
import time
import os
import sys
import copy
import glob
import numpy as np
sys.path.insert(0,'/project/dunlop/shared_python_packages/')
import qsub
# TODO: use different deepcellcontrol folder:
username='hklumpe'
dcc_data_path = f"/projectnb/dunlop/{username}/deepcellcontrol/"
dc... |
39f393ebd564954d8e06f973fc344a17466a02c1997d375a2f8efa803b296873 | Python | 26,204 | 714 | # 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... |
867ba0861b9964c18f6755857ac1865e3279481ff1e3e382ad0627d100ab9f8b | Python | 26,231 | 736 | from __future__ import annotations
import operator
import re
import numpy as np
import pytest
from pandas.errors import (
Pandas4Warning,
)
from pandas.core.dtypes.dtypes import (
ArrowDtype,
)
import pandas as pd
import pandas._testing as tm
pa = pytest.importorskip("pyarrow")
# GH#62423; matched inste... |
333665d7dd33570c4a8a108bd6ba2542587e60e7d855e44d27bf7ea213eea83e | Python | 26,251 | 723 | import pygraphviz as pgv
import networkx as nx
import numpy as np
import re
import sys
import os
from scipy import stats
import warnings
import pandas as pd
import glob
from tqdm import tqdm
warnings.filterwarnings('ignore')
class Hypothesis(object):
"""Generate and analyze hypotheses from models inferred. Assume... |
c164cb48e7665abfba836cdd960a6dbccaeedfe797739b380d7c100962115f0d | Python | 26,295 | 709 | """
test setting *parts* of objects both positionally and label based
TODO: these should be split among the indexer tests
"""
import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
class TestEmptyFrameSetitemExpansion:
def test_empty_frame_se... |
34d2df3f49041c05cef10cb0fb81dae2095daaf34bb5608c5895271ddaa2fefb | Python | 26,296 | 738 | from datetime import (
UTC,
datetime,
)
from typing import Any
import numpy as np
import pytest
from pandas._libs.tslibs import iNaT
from pandas.compat import is_platform_windows
from pandas.compat.pyarrow import pa_version_under22p0
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas.... |
f4d85fd6e5186a17f9baf98cd6473c6af21eb4841cf2551abee9d2e5f11790da | Python | 26,316 | 758 | """
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.
"""
from typing import Optional
import numpy as np
import torch
from torch_geometric.nn import radius_graph
from torch_geometric.nn.models.schne... |
599227f421a092819accabfc1e7ece2f61eb005697c47e40ec28c56ace33838d | Python | 26,317 | 728 | """The v1 library of statistical procedures.
Each ``run_*`` function takes ``(df, params)`` and returns an
``AnalysisResult``. Heavy deps (``statsmodels``, ``lifelines``,
``prophet``) import lazily so the base install stays light.
Conventions:
- All p-values use the two-sided test unless otherwise documented.
- Effe... |
4119aafd0de3780f2819f37f11562626a572415b8eb116efbb72372f8fdcf4d1 | Python | 26,331 | 648 | # -*- coding: utf-8 -*-
"""
Analysis script for Long et al paper:
"Striatal Neuron Phase-Locking to the Gait Cycle during Locomotion"
Code by Long Yang
Updated August 2023
"""
#%% preset
from tkinter import Tk
import tkinter.filedialog as fd
from tkinter import messagebox
import os
import matplotlib.pypl... |
67813f0ebe1cc4d55668298535149bb2992f1891eed09846914b812fb7a3ef23 | Python | 26,423 | 883 | """
datetimelike delegation
"""
from __future__ import annotations
from typing import (
TYPE_CHECKING,
NoReturn,
cast,
)
import warnings
import numpy as np
from pandas._libs import lib
from pandas.errors import Pandas4Warning
from pandas.util._exceptions import find_stack_level
from pandas.core.dtypes.... |
97093b96b40797456b25dd5ec95e1363faedb500fc9472ce620645f1a2a54cab | Python | 26,433 | 579 | ######################
### Import Library ###
######################
# my library
from molgraph.graphmodel import *
# from molgraph.graphmodel_star import *
# from molgraph.graphmodel_signed import *
from molgraph.dataset import *
from molgraph.experiment import *
from molgraph.training import *
from molgraph.visualiz... |
35bcd3c3af2a8873b7f5b9089515e7808581a28b470b9e02e277b59ad4c88ef1 | Python | 26,442 | 806 | from __future__ import annotations
import math
import warnings
from enum import Enum
from shapely.geometry import Polygon
import numpy as np
from functools import lru_cache
from SCTrack.utils import convert_dtype
from SCTrack import config
def NoneTypeFilter(func):
def _filter(self, *args, **kwargs):
ret... |
4724c12320cf3d52e25b44aa98c7662b0c3c8d815ff866696cc45bd5d9ad53e9 | Python | 26,457 | 592 | # -*- coding: utf-8 -*-
'''DenseNet and DenseNet-FCN models for Keras.
DenseNet is a network architecture where each layer is directly connected
to every other layer in a feed-forward fashion (within each dense block).
For each layer, the feature maps of all preceding layers are treated as
separate inputs whereas its ... |
de37b34c761938cbee36ab39e1d5f6c66067c471d04523203367eb4f92653d80 | Python | 26,457 | 416 | """Rebuild OrganAge artifacts from pinned original-author coefficient files.
Usage (repository root):
uv run python clocks/build_organage.py
uv run python clocks/build_organage.py --source-dir /tmp/organage-sources
No Biolearn coefficients or implementation are used. Downloads are checked by
SHA-256 and cache... |
7b9651b30b0c02839918f620c6ec18debec6ca2edc692e06d9fb8f899e6492d9 | Python | 26,469 | 856 | import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
def test_first_last_nth(df):
# tests for first / last / nth
grouped = df.groupby("A")
first = grouped.first()
expected = df.loc[[1, 0], ["B", "C", "D"]]
expected.index = pd.... |
eb77e48ca3d0a3df82cb9bc24a34fa6a0d13656ede387868c16b340a26b0d7e9 | Python | 26,482 | 714 | #
# Copyright (c) 2020 Gabriel Nogueira (Talendar)
# Copyright (c) 2023 Martin Kubovcik
#
# 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... |
0233333c5f2cef952bb43da1d85c53db33378e9d1f9d203794147011c15726aa | Python | 26,520 | 714 | __all__ = [
"GlycoPeptideMassCalculatorBase",
"GlycoPeptideMassCalculator",
"GlycanMassAnnotationProto",
"GlycoPeptideMassAnnotationProto",
"GlycoPeptideMzAnnotationProto",
"GlycoPeptideMassAnnotation",
"GlycoPeptideMzAnnotation",
]
import abc
from typing import (
Generic,
Iterable,... |
aa827225a04f26ed5f47e3a154923a3f4a70cd108a79127e282842d818c30a69 | Python | 26,537 | 769 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import cv2 as cv
from scipy.ndimage.morphology import distance_transform_edt as edt
from scipy.ndimage import convolve
from scipy.ndimage import distance_transform_edt
from ND_Crossentropy import CrossentropyND, TopKLoss
cl... |
9c6283af5d22dc30a9417b41366ec6eff32c4dd75ffbb332666ea80e28f0f1ca | Python | 26,545 | 698 | from collections import defaultdict
from datetime import datetime
from itertools import product
import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
from pandas.core import algorithms
from pandas.core.algorithms import safe_sort
import pandas.core... |
55dd06ba28b43fbb854726ef0b5b54db247905349a8e43ad0f0ec9b3dd378bfd | Python | 26,568 | 737 | import numpy as np
from numpy.random import randint
import os
os.environ.setdefault('PATH', '')
from collections import deque
import gymnasium as gym
from gymnasium import spaces
from copy import copy
def _parse_reset_result(result):
"""Extract obs from gymnasium reset() return of (obs, info)."""
return res... |
6c012ae0c341785525266ab59935a20871c73aa3162603426bbb828dc6304660 | Python | 26,621 | 778 | from typing import List, Tuple
import numpy as np
import xarray as xr
from scipy import stats # type: ignore
from sklearn.metrics import (
explained_variance_score,
mean_absolute_percentage_error,
r2_score,
)
from pcntoolkit.dataio.norm_data import NormData
from pcntoolkit.util.data_utils import iter_bat... |
57e63f637d45921db88b54a4da4a13cb4e4857362788373fa55be886ce926c0f | Python | 26,637 | 820 | from __future__ import annotations
from contextlib import contextmanager
from typing import (
TYPE_CHECKING,
Any,
)
from pandas.util._decorators import set_module
from pandas.plotting._core import _get_plot_backend
if TYPE_CHECKING:
from collections.abc import (
Generator,
Mapping,
)... |
d5999065a0de888074f7f71b1cbb94e105d6e6a86a793f0c7d3dfe14fd312faa | Python | 26,647 | 646 | # 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... |
4ad60af37aa196eaf947b1aa8b7919ca7b8837bd7cd724206ac58e4ed730bd20 | Python | 26,656 | 599 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for GCPNet (https://github.com/BioinfoMachineLearning/GCPNet):
# ----------------------------------------------------------------------------------------------... |
3621c7efb00ba72b00cfba0af50e64486bcee7e9b3f2fd00db80d8018219ba44 | Python | 26,679 | 610 | # Copyright (c) 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 conditions ... |
17aed17dd362310235116e993a96fe7d0f51c1b14419034bbf8e96b36e8a78a0 | Python | 26,680 | 654 | # 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... |
0afe64a976125a6619bb443cc349af33cf851f2a7dc47a5b5b44dc5637a749df | Python | 26,703 | 612 | import numpy as np
from skimage.transform import rescale
from pystackreg import StackReg
import glob
import gc
import os
import sys
import tifffile
from sys import getsizeof
from datetime import datetime
import pandas as pd
def get_filename():
#Get the filename from the CSV file.
data_strct = pd.read_csv("channel... |
7ad9e31f88360792b41609200d798050008251f2e0e1b28dc0836f2b34955e1e | Python | 26,736 | 694 | # 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... |
d3414728fa4ad9ca8fc771d9e63fc32ab823507d401648a24ab5d08714ce1c4f | Python | 26,762 | 893 | """
datetimelike delegation
"""
from __future__ import annotations
from typing import (
TYPE_CHECKING,
NoReturn,
cast,
)
import warnings
import numpy as np
from pandas._libs import lib
from pandas.errors import Pandas4Warning
from pandas.util._exceptions import find_stack_level
from pandas.core.dtypes.... |
d2877e00089886b9bf4b14a611de6343a919cab6e7cb417cb813343ebdd139a9 | Python | 26,776 | 489 | """
Functions to run hierarchical clustering (via Ward's linkage)
of the cosine similarity matrix of significant time bins
a la Perez-Ortega et al. 2021 (see also Carillo-Reid et al. 2015)
Then "core-cells" and cell assemblies are detected with correlation
based methods from (Montijn et al. 2016 and) Herzog et al. 2021... |
99763bf47fc5f68b86bd196cab89d616ce9bf1ff4daf498a9a718afd48e90268 | Python | 26,783 | 615 | # IMPORTS
import h5py
import numpy as np
import torch
from torch.utils.data import Dataset
import torchio as tio
import time
import VINNA.data_processing.utils.data_utils as du
import VINNA.utils.logging as logging_u
import VINNA.data_processing.augmentation.augmentation as aug
logger = logging_u.getLogger(__name__)
... |
3b15d76502710860f22eee76438defe533b77a6c0bcc6f18db56a3b03be4ff82 | Python | 26,815 | 705 | # 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... |
3aaf2acd2d494e98cbf0e2fb15846c4c3f81cf276b87a0b53410f1e07fa52b26 | Python | 26,866 | 732 | import pygraphviz as pgv
import networkx as nx
import numpy as np
import re
import sys
import os
from scipy import stats
import warnings
import pandas as pd
import glob
from tqdm import tqdm
warnings.filterwarnings('ignore')
class Hypothesis(object):
"""Generate and analyze hypotheses from models inferred. Assume... |
032fe0210f50b8f6a581d0f96be36e176e41bba3b1f688d821984eb5f3b93cae | Python | 26,872 | 702 | from datetime import (
datetime,
time,
)
import operator
import numpy as np
import pytest
from pandas.compat import HAS_PYARROW
import pandas as pd
import pandas._testing as tm
from pandas.core import ops
class TestSeriesLogicalOps:
@pytest.mark.parametrize("bool_op", [operator.and_, operator.or_, oper... |
003777533bcc550bb4acaea551b481ae883b46c59c556cf9a562f274b22cc1fe | Python | 26,882 | 860 | """Extended phase graph (EPG) signal models."""
# Based on https://github.com/fzimmermann89/epgtorch/
# Copyright (c) 2022 Felix Zimmermann, MIT License
from abc import ABC, abstractmethod
from collections.abc import Sequence
import torch
from mrpro.data.Dataclass import Dataclass
from mrpro.utils.reshape import un... |
19f8886ad4e13d8bc5a44f1a630c65800252ad3120efccf04bbcf14e0074125b | Python | 26,912 | 638 | from __future__ import annotations
from collections import defaultdict
from typing import (
TYPE_CHECKING,
cast,
)
import warnings
from pandas._config import using_string_dtype
from pandas._libs import lib
from pandas.compat._optional import import_optional_dependency
from pandas.compat.pyarrow import pa_ver... |
4527ae85c7a38943f46a1a4ea4736c3828887f2d352725763ebf6b981289c86f | Python | 26,925 | 700 | import sys
import numpy as np
import pandas as pd
from mpl_toolkits.mplot3d import Axes3D
import matplotlib
import matplotlib.colors
from matplotlib import cm
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib import markers
import os
if sys.version_info[0] == 2:
import ConfigParser as configpars... |
714c81ec73754c791498197d6a6ac31ccea97934510fe9f75fdaa2677ff6a6e2 | Python | 26,958 | 722 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 3 00:51:46 2023
@author: s205272
"""
import numpy as np
def normalize_mi_ma(x, mi, ma, clip=False, eps=1e-20, dtype=np.float32):
if dtype is not None:
x = x.astype(dtype,copy=False)
mi = dtype(mi) if np.isscalar(mi) else mi... |
3cebc940485d1ef80a6bf3da2999f2b7da699524f37ab126da021222e613b97e | Python | 26,960 | 661 | # 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... |
abb73ff719a8a95132bdbbe3f823509b6243e7469ba6d4bd890540626abeacf0 | Python | 26,972 | 814 | #!/usr/bin/env python3
"""
this file contains the code for the spike sorting GUI
"""
from __future__ import print_function, division, absolute_import
import sys
import os
from getpass import getuser
import time
import logging
logger = logging.getLogger(__name__)
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import... |
5380de634ac8a15ccba6c627b4f3a6cf46736c0a4c2e9c1319b1abc263fef511 | Python | 26,979 | 830 | from __future__ import annotations
from contextlib import contextmanager
from typing import (
TYPE_CHECKING,
Any,
)
from pandas.util._decorators import set_module
from pandas.plotting._core import _get_plot_backend
if TYPE_CHECKING:
from collections.abc import (
Generator,
Mapping,
)... |
e16e35cd1e94d7c11a7d9682a246966a783513445430234313e081d90045cb2b | Python | 26,980 | 788 | # 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... |
daa7542ca20a94097e8ea8f8dfa3359ca94bf85458db1a3b38e17b7d229a2aa8 | Python | 26,989 | 764 | """
manage legacy pickle tests
How to add pickle tests:
1. Install pandas version intended to output the pickle.
2. Execute "generate_legacy_storage_files.py" to create the pickle.
$ python generate_legacy_storage_files.py <output_dir> pickle
3. Move the created pickle to "data/legacy_pickle/<version>" directory.
"... |
ff5c5e687186de3765a07b380a2878769e87b7f9823623232f8f738ad9b14d2f | Python | 27,038 | 668 | import unittest
import pytest
from MACS3.Signal.HMMR_HMM import hmm_training, hmm_predict, GaussianHMM
import numpy as np
import numpy.testing as npt
import json
from hmmlearn.hmm import PoissonHMM
from scipy.stats import (multivariate_normal,
poisson)
from MACS3.Signal.HMMR_HMM import (hmm_mod... |
0731c37aa8352504dfa0ac2bf99228d94bf8ddf2a2deec06e43afeefb848e262 | Python | 27,103 | 650 | from __future__ import annotations
from datetime import (
date,
time,
)
from decimal import Decimal
import re
import numpy as np
import pytest
from pandas.core.dtypes.dtypes import (
ArrowDtype,
)
import pandas as pd
import pandas._testing as tm
pa = pytest.importorskip("pyarrow")
from pandas.core.arr... |
8114f1dcf553b8ce5237f3cebdfec5ba125913d855d0d82814cf21c818f3f971 | Python | 27,118 | 705 | # 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... |
087c28382058993bb3d8abc68c8d67cee0cf7e828917ee249f952a8a5d8a49ce | Python | 27,156 | 638 | import copy
import importlib.resources
import dclab
import dclab.kde.methods
import numpy as np
from PyQt6 import uic, QtCore, QtWidgets
from ...pipeline import Plot
from ...pipeline.plot import STATE_OPTIONS
from ..pipeline_plot import (
compute_contours, compute_contour_opening_angles, compute_contour_reliable... |
343c6a623286eea5703fa4e81ed4c4c0bde1f08671a996e9dfedff022adee182 | Python | 27,188 | 641 | # cython: language_level=3
"""Internal BAM/BGZF byte streaming and native-pool ownership.
Parser retains format decoding, FRAG interning and track assembly. This
module depends only on native IO declarations and Performance defaults;
it must not import Parser or tracks. Its Cython interface is internal.
This code is ... |
469da4e316017dda1b229c760968c24590322a2a419c33c8bb2209e691e9e37a | Python | 27,235 | 707 | # 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... |
764ce9fe08345895f6301b728618c6e9b0ede1d20e0290fcd530417592a38b5d | Python | 27,243 | 599 | import os
import cv2 as cv
import numpy as np
op_order = ["A", "T", "C", "G", "I", "D", "V"]
# OP_COLOR_DICT = {"M": [0, 0, 0],
# "A": [135, 206, 255],
# "T": [135, 238, 238],
# "C": [135, 186, 150],
# "G": [135, 155, 155],
# "N":... |
e3f5df9cbef93376b585586f43fadf42864689aa9e9e7594e537cd54d8e126dd | Python | 27,247 | 500 | #!/usr/bin/env python
import re, os, sys, subprocess
import argparse
from argparse import RawTextHelpFormatter
###################################################
### 0. script description and parsing arguments ###
###################################################
synopsis1 = "\
a wrapper script to run 'CL_finde... |
234dd2421b8092a76219cd1cc3c08b4e31e497b12efbf7659dd7b305efd9575f | Python | 27,258 | 844 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
def test_doc_string():
df = pd.DataFrame({"B": [0, 1, 2, np.nan, 4]})
df
df.expanding(2).sum()
def test_constructor(frame_or_series):
# GH 12669
c = frame_or_series(range(5)).expanding
# valid
c(min_peri... |
ff8578aace131c78b7eee8b25beea718157465a52c323fc605b1340056e599a0 | Python | 27,277 | 661 | #Basics
import matplotlib.pyplot as plt
import matplotlib
from mpl_toolkits.axes_grid1 import make_axes_locatable
import numpy as np
import sys
import os
import csv
import time
import random
import pandas as pd
import scipy
import scipy.signal as signal
import seaborn as sns
import soundfile as sf
import matplotlib.col... |
4b4a6146acea66990cdd6f5b2f33e0148796287b018e80109f5ebea563a42fd2 | Python | 27,278 | 778 | # 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... |
fbc71b7312da9ad022e367ac7dccc4105693a256352184c58b34a481a13c7627 | Python | 27,288 | 879 | """
:func:`~pandas.eval` parsers.
"""
from __future__ import annotations
import ast
from functools import (
partial,
reduce,
)
from keyword import iskeyword
import tokenize
from typing import (
TYPE_CHECKING,
ClassVar,
TypeVar,
)
import numpy as np
from pandas.errors import UndefinedVariableErro... |
11a0aecc7a34103ac242f71cbed35b0b5e21a27476fb6b1a94f1f8c23bc09051 | Python | 27,346 | 501 | import torch
import torch.nn as nn
import torch.nn.functional as F
#import albumentations as A
#from albumentations.pytorch import ToTensorV2
from torchvision import datasets, transforms
import torch.utils.data as data_utils
import os, fnmatch
import cv2
from PIL import Image
import numpy as np
from pathlib import Path... |
780c81e5ea9f08e02bbebe3d077470fb2e5933b43daafa7471d967375729dfd3 | Python | 27,359 | 621 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for GCPNet (https://github.com/BioinfoMachineLearning/GCPNet):
# ----------------------------------------------------------------------------------------------... |
60e130f421e9b608321c257d249fc7c0af1be74db0d3c5b2f466dbf485b3bf87 | Python | 27,375 | 638 | import os
import numpy as np
import torch
from torch.utils.data.dataset import TensorDataset
from torch.utils.data import DataLoader
import torch.nn.functional as F
from torch.autograd import Variable
import pickle as pkl
torch.set_default_dtype(torch.float64)
def my_softmax(input, axis=1):
trans_input = input.t... |
b7ba0d6e6aa3defa713b3a291db70d1de2209ec022f1989b9295172a13bf95a2 | Python | 27,406 | 724 | from types import MappingProxyType
import numpy as np
import pytest
import pandas as pd
pytest.importorskip("jinja2")
from pandas.io.formats.style import Styler
from pandas.io.formats.style_render import _str_escape
@pytest.fixture
def df():
return pd.DataFrame(
data=[[0, -0.609], [1, -1.228]],
... |
ee01a105c1b7cbf50e764190ba027b382b5badf7bf7942d7e9b464c16581a955 | Python | 27,407 | 881 | """
:func:`~pandas.eval` parsers.
"""
from __future__ import annotations
import ast
from functools import (
partial,
reduce,
)
from keyword import iskeyword
import tokenize
from typing import (
TYPE_CHECKING,
ClassVar,
TypeVar,
)
import numpy as np
from pandas.errors import UndefinedVariableErro... |
2caf54b23d45f366f2740fd8a119456cb0a9e4482a339177336fb7b58739ab39 | Python | 27,412 | 699 | """ Optimizers class """
import torch
import torch.optim as optim
from torch.nn.utils import clip_grad_norm_
import operator
import functools
from copy import copy
from math import sqrt
import types
import importlib
from onmt.utils.misc import fn_args
def build_torch_optimizer(model, opt):
"""Builds the PyTorch o... |
36b121700042319ae144ea3bacb7c28d540c158e4bf1df39a7bab00426322057 | Python | 27,422 | 570 | # 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... |
f7662bdc655ab88805397097782980fc0c4d0ff5df4ec0ed247104307701d0d3 | Python | 27,434 | 805 | from datetime import (
datetime,
timedelta,
)
import numpy as np
import pytest
from pandas.errors import UnsortedIndexError
import pandas as pd
import pandas._testing as tm
from pandas.tests.indexing.common import _mklbl
class TestMultiIndexSlicers:
def test_per_axis_per_level_getitem(self):
# ... |
d7a0ede9e3ed0ab28e4a68e3ef1cabe63847e23c90a99c5e4a8dd1bf15d5669a | Python | 27,470 | 760 | # 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... |
a141e4cb4361af9e7731b5014457d5dd15d42f5ff026f777fa9d670df8934249 | Python | 27,486 | 732 | #!/usr/bin/env python3
import argparse
import hashlib
import json
import os
import sys
import tempfile
from collections import namedtuple
from contextlib import suppress
from pathlib import Path
import torch
sys.path.insert(0, str(Path(__file__).resolve().parent))
from validate_metadata import ( # noqa: E402
RU... |
bcd927ebf32a32339b471b8ac6962ec4f2d284075274e899182273a72fd8fb03 | Python | 27,487 | 910 | """Random generator."""
from collections.abc import Sequence
from math import ceil, floor
import torch
def check_bounds(low: float | int | torch.Tensor, high: float | int | torch.Tensor, dtype: torch.dtype | None) -> None:
"""Clip the bounds to a range matching the dtype.
Parameters
----------
low
... |
2793ddf35f530dc73d4c6fc423be5da6b8ec2cbbea9a0b1ff8447dd63fc95c30 | Python | 27,523 | 544 | #! /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... |
5ce184abeb6ff1f7fee6c14d8c018fb405fd57963149d9f2a87d5a70a228f22c | Python | 27,526 | 719 | # 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... |
ed565f7912fa99aa75512ec4bcad1b0eecebbb8e95c8179c8513a9d722fb6cf5 | Python | 27,533 | 639 | import logging
import os
import numpy.linalg as la
from . import surfaces, surface_distances as sd
from . import pointSets
from . import conjugateGradient as cg, pointEvolution as evol
from .affineBasis import *
from .surfaceMatching import SurfaceMatching, Direction
## Main class for surface matching
# Templ... |
8a3f27dddaed7ace74a565df55d39f161cca2eb91ac8749c8a813cd22a2531e1 | Python | 27,542 | 764 | #!/usr/bin/env python3
"""Install BASALT with mainland-China-friendly, non-persistent mirrors.
The installer prefers micromamba, then mamba, then conda. Mirror settings
apply only to the child installation processes; the user's global Conda and
pip configuration files are never modified.
"""
from __future__ import ... |
b8c487ee37c7a980b0f56684286f2da4adacdd7d809cc79a1335d67b0849f005 | Python | 27,578 | 765 | from collections.abc import Iterator
import gzip
from io import (
BytesIO,
StringIO,
)
from pathlib import Path
import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
from pandas.io.json._json import JsonReader
@pytest.fixture
def lines_j... |
db23c25d92864a51895bf54e75689daaadbc0fed3c25906b5920e6e71fcb67f3 | Python | 27,589 | 546 | # 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... |
06031329881d597c9a9b3296a90906b56218cfa018387f205487a21011644b18 | Python | 27,623 | 754 | """
Tests for the pandas.io.common functionalities
"""
import codecs
import errno
from functools import partial
from io import (
BytesIO,
IOBase,
StringIO,
)
import mmap
import os
from pathlib import Path
import pickle
import re
import tempfile
import numpy as np
import pytest
from pandas.compat import (... |
b9ac338554894aa1bb0419528b071c16a9c5cf077dc7918145c05e79c6f72a82 | Python | 27,623 | 631 | # MOFTransformer version 2.0.0
import os
import numpy as np
from pathlib import Path
from collections.abc import Iterable, Sequence
from itertools import product
from functools import wraps, partial
from matplotlib import pyplot as plt
from matplotlib.colors import ListedColormap
from matplotlib import animati... |
80aa6a69b45422a98c4056baec3c06d8a2e06086737f7b67700d466016c5db1b | Python | 27,689 | 709 | from treeshrink._vendor.dendropy import Tree
import sys
import math
class Tree_extend(object):
def __init__(self, ddpTree = None, tree_file = None, schema = "newick"):
if ddpTree:
self.ddpTree = ddpTree
else:
self.ddpTree = Tree.get_from_p... |
ac8d95b95b1eb781218c992b9c7b490bc7b8dffbc2deed8acfa93b163d6357bb | Python | 27,768 | 663 | import numpy as np
import scipy.linalg as LA
from . import surfaces
import logging
from . import surfaceMatching as smatch, surface_distances as sd
import multiprocessing as mp
from multiprocessing import Lock
from . import conjugateGradient as cg, kernelFunctions as kfun
from .affineBasis import AffineBasis
from . imp... |
6ccb46aeaf82101f6f89f5c08f5b322f8115346455d0c2711b571415c133e2ec | Python | 27,774 | 498 | ##############################################################################
## ##
## This file is part of ModelBlocks. Copyright 2009, ModelBlocks developers. ##
## ##
#... |
79629b4e7f89d876b79ab8aa0eb38938c86904731702ce3b5be2a378eac9651b | Python | 27,795 | 707 | # 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... |
812e67ffb263e633a85fab24dfa30e12fbf5c389afcaf4cf4e41ca9cba24fa7f | Python | 27,818 | 731 | import time
import warnings
from collections import defaultdict
from functools import partial
from typing import Any, Dict, Generator, List, Optional, Tuple, Union
import numpy as np
import pandas as pd
from joblib import Parallel, delayed # type: ignore
from scipy.stats import rankdata
from sklearn.base import clone... |
b57c618bb37ed129085007d9b4947d87387cf893d220999e9dc8109ada99fb47 | Python | 27,863 | 778 | # 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... |
f5dbc8c16a2b3622bb7f49794258bb7fc503131333797f09b3c038ae7f48d787 | Python | 27,863 | 665 | import os
import pysam
import torch
from torch.utils.data import DataLoader
from src.network import op_dataset as dataset
from src.network.model_miniunet import MiniUnet
from src.network.model_liteunet import LiteUnet
from src.network.model_unet import Unet
from src.network.utils import image_helpers, image_transforms... |
4ab253b276e78e3c1d362a92db5c48b941e5ab6b693902abfc1dc35e8196deee | Python | 27,910 | 669 | # cython: language_level=3
# Time-stamp: <2024-10-22 16:59:53 Tao Liu>
"""Module for SAPPER PosReadsInfo class.
Copyright (c) 2017 Tao Liu <tliu4@buffalo.edu>
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD License (see the file COPYING included
with the distribution).... |
b1b291686a7afa926ac912e3272924986b260d01e00cbeafed539f095a508deb | Python | 27,922 | 701 | """Base class for backbone that acts as a feature extractor."""
from __future__ import annotations
import logging
from collections.abc import Iterator
from typing import TYPE_CHECKING, Any, Literal, cast
if TYPE_CHECKING:
from lightning_pose.losses.factory import LossFactory
from lightning_pose.losses.losses... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.