sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
822f48962a575d5b957d2a1a24342bc277fa63f450d806e82bce8cc7e86a4092 | Python | 20,832 | 653 | from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as np
import pyqtgraph as pg
from sqlmodel import Session, col, select
from cali.logger import cali_logger
from cali.plot._util import disconnect_hover_handlers
from cali.sqlmodel._model import FOV, ROI, DataAnalysis, Traces
if TYPE_CH... |
9baa86a2c8c13de45956500852f21af3e7a1d426679b2faadafce479f37efd27 | Python | 20,855 | 612 | """Contains tests for the CDS class and functions"""
# from python
import logging
from pathlib import Path
from unittest import TestCase
# from dependencies
from Bio.SeqFeature import (
SeqFeature,
FeatureLocation,
Seq,
BeforePosition,
AfterPosition,
)
# from other modules
from big_scape.hmm impo... |
6857533adf6bc40c31eaf383e0b8941b7de5a984963613272d2f4a9cc305abcc | Python | 20,862 | 617 | r"""
Single-qudit and two-qudit gates and their matrix representations.
This module implements gates for **qudits** (d-level systems), providing d-dimensional
analogues of familiar qubit gates as well as qudit-specific primitives.
**Registry**
Single-qudit builders: ``I``, ``X``, ``Z``, ``H``, ``RX``, ``RY``, ``RZ``,... |
b1b39aaa413d940e476e293370505c5def6d76a1cc540c71307dd5f507d8afe7 | Python | 20,929 | 688 | from __future__ import annotations
from contextlib import contextmanager
from typing import (
TYPE_CHECKING,
Any,
)
from pandas.plotting._core import _get_plot_backend
if TYPE_CHECKING:
from collections.abc import (
Generator,
Mapping,
)
from matplotlib.axes import Axes
from ... |
76fe35634dbaec7968e44577403512f675ba596d14c31919c95e9cee20528e29 | Python | 20,931 | 490 | """Defines plotting functions used for analyzing data.
See ``examples/analysis`` for examples of how to use.
"""
import glob
import json
import os
import warnings
import matplotlib.colorbar as cbar
import matplotlib.colors as mplcolors
import matplotlib.pyplot as plt
import matplotlib.ticker as tick
import numpy as ... |
01aa0e43f3ee7e0ae09ce992ec045847275b754d63b1bebe0cabb6a17e762ee2 | Python | 20,937 | 622 | import numpy as np
import pytest
from pandas.core.dtypes.common import ensure_platform_int
import pandas as pd
from pandas import (
Index,
RangeIndex,
)
import pandas._testing as tm
class TestRangeIndex:
@pytest.fixture
def simple_index(self):
return RangeIndex(start=0, stop=20, step=2)
... |
d9ac7eec9e725c4dc04dec14673b5380d34ff748387968953af9b92a5edb58d3 | Python | 20,947 | 1,538 | """Nuclear charges and electron configurations (scaled between 0 and 1) for all elements up to Z=86
This encourages the NN to learn atom embeddings that generalize across the periodic table
"""
electron_configurations = [
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[
... |
05735bcc1c6f88841bed3921acaa188b296f3c39ee4fdbe6d25b0c6cdd381508 | Python | 20,948 | 539 | import torch, os
import pygame
from pygame.locals import *
from collections import deque
from random import randint
import numpy as np
import nsganet as engine
from pymop.problem import Problem
from pymoo.optimize import minimize
from pymoo.operators.sampling.random_sampling import RandomSampling
from pymoo.operators.m... |
8d2c040d606e899576d6211070e00e8696fdd187affce5a8c549f069cae9f5c9 | Python | 20,971 | 580 | import itertools
import numpy as np
import pandas as pd
from brainconn.distance import distance_wei_floyd, mean_first_passage_time, retrieve_shortest_path
from scipy.sparse.linalg import expm
from scipy.stats import ks_2samp
from joblib import Parallel, delayed
def morans_i(dist, y, normalize=False, local=Fals... |
8840fb967e29fa70293b51fdc096f2b4e1fc1eafc37dca6529ed359eb837870e | Python | 20,972 | 614 | """
PEPS Contraction using Boundary MPS with JAX.
This module implements a high-performance, JIT-compilable contractor for
Projected Entangled Pair States (PEPS) using the Boundary Matrix Product State
(MPS) method. It specializes in contracting large-scale 2D tensor networks
(e.g., partition functions of statistical ... |
085aab2730337365cd19ec5eac7fff4fe639230abb59bb185ec88b1112d6c58d | Python | 21,014 | 617 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import annotations
import logging
import platform
import re
import struct
import subprocess
import sys
import sysconfig
fr... |
a3db616b6bce757890944a9fee5c21f618a2d2bef06f4fba8226c16d500173ef | Python | 21,016 | 629 | """Tests for the enable_calcium / enable_spikes feature.
Covers:
- AnalysisSettings model: fields, __eq__, __hash__
- DB migration: migrate_analysis_settings
- GUI: _AnalysisGUI checkboxes, value/setValue/reset, _on_enable_changed
- FOV analysis gating: compute_fov_analysis with calcium/spikes disabled
- Settings save... |
3c2eabd2aff6b4e63956e0823f9a42b811a901bfea76b14503de3ddf66faa574 | Python | 21,021 | 595 | import copy
from enum import IntEnum
import numpy as np
import gymnasium as gym
import imageio
from window import Window
class HumanVatGoalEnv(gym.Env):
"""General HumanVatGoalEnv Class"""
class Actions(IntEnum):
noop = 0
left = 1
right = 2
up = 3
down = 4
sma... |
cef4aef92e75bc968818f39d660742d8878777663fd454c877e40625cffb0565 | Python | 21,029 | 733 | """
Tests that the file header is properly handled or inferred
during parsing for all of the parsers defined in parsers.py
"""
from collections import namedtuple
from io import StringIO
import numpy as np
import pytest
from pandas.errors import ParserError
from pandas import (
DataFrame,
Index,
MultiInd... |
b8032c6299c44ad04d25bc63690f18127555986b3060734167ee959ccf5dfb58 | Python | 21,070 | 470 | import math
import torch
import torch.nn as nn
from torch.optim import Adam
import torch.nn.functional as F
from einops import reduce
from tqdm.auto import tqdm
from functools import partial
from collections import namedtuple
from models.Lossfunction import DiceLoss
ModelPrediction = namedtuple('ModelPredic... |
f0e754841ae130f7b283f37fdb91cbdfc9c778e8b3b28537a23c3aa767df284d | Python | 21,077 | 491 | import sys
import os
import re
import time
import random
import math
import numpy as np
import copy
from boundslist import *
from network import *
from parseinputs import *
from deephuntermutators import *
def get_covprop_helper(grid):
#recursive: for each elem in grid, if it is a number then check 1 or 0, ot... |
2b6f104e1045f32263e9c1b3ff66ec9ed84b5157dcc9f6d071ba2fcab2e22185 | Python | 21,105 | 503 | """
MIT License
Copyright (c) 2024 Lucas Bickmann, Lucas Plagwitz
"""
import multiprocessing as mp
from typing import Callable, Optional, Union
import numpy as np
import warnings
from scipy.ndimage import uniform_filter1d
from sklearn.base import BaseEstimator, TransformerMixin
from rlign.utils import (Templ... |
6f6b295e81018d990f3f7a9abc101afc3ddf4832000b2ecabb9b066c302b0b3c | Python | 21,116 | 629 | """
Created on May 1, 2025
@author: mning
3 methods:
percentage -> 3 classes
absolute -> 2 classes
t-test (need to compute LMFP for each trial)
compute p-value
f"featureStore_Sbj_{op_str_delta}_10x_V1.csv" is for windows
starting at 20ms instead of 15ms
"""
import logging
import os
from typing im... |
0983a592c3bc526a64d4dcf32a16ee9a0f91867422f983654554b267c2a57c77 | Python | 21,152 | 651 | # pylint: disable=unused-variable
# pylint: disable=invalid-name
from typing import Tuple, Any
import sys
import os
import numpy as np
import pytest
from pytest_lazyfixture import lazy_fixture as lf
Tensor = Any
thisfile = os.path.abspath(__file__)
modulepath = os.path.dirname(os.path.dirname(thisfile))
sys.path.in... |
f6c89a5d21ef0ab03e604b91234fb3ba7d20c107f67d567048f308adbec22d31 | Python | 21,154 | 562 | import numpy as np
import pytest
from pandas import (
NA,
DataFrame,
IndexSlice,
MultiIndex,
NaT,
Timestamp,
option_context,
)
pytest.importorskip("jinja2")
from pandas.io.formats.style import Styler
from pandas.io.formats.style_render import _str_escape
@pytest.fixture
def df():
ret... |
df930202fa7a09ee321fdc68a3b0a7ad05c51ac0dcbdde650d7f53eed1b6e721 | Python | 21,180 | 522 | import json
import logging
from pathlib import Path
from typing import Dict, Optional, Union
import numpy as np
import torch
import torch.nn as nn
from torch_scatter import segment_coo, segment_csr
from .layers import ScaleFactor
ScaleDict = Union[Dict[str, float], Dict[str, torch.Tensor]]
def repeat_blocks(
s... |
4f6573f58a58c2d2092781c838388f90e39cef9a58423404dd1612cc7b3cecdb | Python | 21,200 | 518 | # model.py
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import numpy as np
from sklearn.metrics.pairwise import pairwise_distances # type: ignore
from .mixin import scviMixin, dipMixin, betatcMixin, infoMixin
from .module import iVAE
class iaodeModel(nn.Module, scv... |
d6647b241b092e5541189f20437630f07688ceb4bc11ba17cb1f4e351a01424d | Python | 21,214 | 431 | from torch import nn
import torch
import math
import subprocess
class GCL(nn.Module):
def __init__(self, input_nf, output_nf, hidden_nf, normalization_factor, aggregation_method,
edges_in_d=0, nodes_att_dim=0, act_fn=nn.SiLU(), attention=False):
super(GCL, self).__init__()
input_ed... |
882dd28daff4dec539a5a54e18b8718386a778e251d7d6aff35e053c7086d725 | Python | 21,227 | 426 | #!/usr/bin/env python3.7
"""Defines HOCWriter class.
The copyrights of this software are owned by Duke University. Please
refer to the LICENSE and README.md files for licensing instructions. The
source code can be found on the following GitHub repository:
https://github.com/wmglab-duke/ascent
"""
import itertools
i... |
4137db6d30db0b6c2f0f713a0308f862dc156d35c65480e78fcc7e39acf4ce93 | Python | 21,255 | 488 | import math
import numpy as np
hartree_to_cm = 219474.6435 # Hartree to cm^-1 conversion factor
L = 6 # number of modes
def get_prefact(ind):
ind.sort()
ord = [1]
for i in range(1,len(ind)):
if ind[i] == ind[i-1]:
ord[-1] = ord[-1] + 1
else:
ord.append(1)
fa... |
fb7b5b33c68b922d12b83a56fc6cd7ef1fe374a571e5573d3a029568b5ad97d2 | Python | 21,256 | 595 | import scipy
import numpy as np
from scipy.optimize import curve_fit
from numpy.polynomial import Polynomial
from typing import Optional, Union, Tuple, List, Dict
from scipy import stats
import pandas as pd
import seaborn as sns
import re
import scipy.stats as stats
from tqdm import tqdm
import warnings
from pingoui... |
5cfeccaa2460cc9128b45983558f8441f24159282fc471daf0728f46ff684bfc | Python | 21,258 | 485 | import torch
import torch.nn as nn
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import pearsonr
import h5py
import sys
import os
import shap
if len(sys.argv) > 9:
TFname = sys.argv[1]
ModelType = sys.argv[2]
SeqLen = int(sys.argv[3])
DateMark = sys.argv[4]
Nlayer = int(sys.a... |
5ed0dc3986b2136a9924bd10b8072af1078e06c98fd615d7cde156739d5c025c | Python | 21,272 | 554 | """Cedalion datasets and utility functions."""
import os.path
from pathlib import Path
from importlib.resources import files
from collections import namedtuple
from dataclasses import dataclass
import pandas as pd
import pooch
import xarray as xr
import json
import scipy
import gzip
import cedalion
import cedalion.d... |
f7d422e8df3cd00de2c91646e7f02c6640c02a414250a80e642a7d66134cace4 | Python | 21,302 | 552 | from math import nan, inf
import pytest
from numpy._core import array, arange, printoptions
import numpy.polynomial as poly
from numpy.testing import assert_equal, assert_
# For testing polynomial printing with object arrays
from fractions import Fraction
from decimal import Decimal
class TestStrUnicodeSuperSubscrip... |
b06a6aaf962264bcdbafb50679a0c072fce785640c4e6c76914a68e511654b7c | Python | 21,341 | 401 | # License: GNU Affero General Public License v3 or later
# A copy of GNU AGPL v3 should have been included in this software package in LICENSE.txt.
# for test files, silence irrelevant and noisy pylint warnings
# pylint: disable=no-self-use,protected-access,missing-docstring
import unittest
from Bio.Seq import Seq
f... |
a3b4cafc2095fba3a908f6eca9ac541b5088e43e07bb354f1a82c49512a300a7 | Python | 21,369 | 542 | """Statistical tests and other results used in the paper.
The name of the function corresponds to a comment placed in the tex file of the
article preceding the paragraph where the statistic is used.
"""
from itertools import product
import logging
import ipdb
import numpy as np
import scipy as sp
import pandas as pd... |
97da097df532fd4d18f6c89797c2f2bae259bcb80f9d03e5db2111c6f11e26e4 | Python | 21,378 | 531 | """Functions to plot image reconstruction results."""
import matplotlib.colors
import matplotlib.pyplot as p
import numpy as np
import pyvista as pv
from matplotlib.colors import ListedColormap
import cedalion.dataclasses as cdc
import cedalion.dot
import cedalion.typing as cdt
from ..blocks import plot_labeled_poin... |
98c9734a9481783cc578af875a9d7ca5edd12309e503ac1395cf947b0d102dc1 | Python | 21,401 | 647 | """
Model evaluation and benchmarking (scATAC-seq)
Compare iAODE with scVI-family models using latent space evaluation metrics.
Dataset: 10X Mouse Brain 5k scATAC-seq (HVP subset)
"""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent))
from _example_utils import (
check_iaode_inst... |
f243a2cddb4cba3c3161cb5869eda9ad97bb89c924cc936b8945db0b85a164be | Python | 21,427 | 551 | #!/usr/bin/env python
"""
bfactor_plot
---------
Pipeline setup script for automated processing with RELION 4.
Authors: Sjors H.W. Scheres, Takanori Nakane & Colin Palmer
Call this from the intended location of the RELION project directory, and provide
the name of a file containing options if needed. See the relion_... |
254fc60cd5ef70cf0afcc41e55699184a35cc05339524e77b6ab4d2ffecaf513 | Python | 21,440 | 659 | import pickle
import time
from math import sqrt
from os.path import isfile
from typing import Dict, List, Optional, Tuple
import numpy as np
from ase import Atoms
from ase.io import write
from ase.optimize.optimize import Dynamics
from ase.parallel import barrier, world
from .calculator import BatchwiseCalculator
fro... |
c5c1e9bfc6ecad8a48a6ef6aed82b8b9ed757fd926cfcd1dafb054c0a5f7a319 | Python | 21,470 | 671 | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import errno
import os
import random
import select
import signal
import sys
import time
import traceback
from gunicorn.errors import HaltServer, AppImportError
from gunicorn.pidfile import Pidfile
from gunicorn imp... |
aa904458054e2b573972dd628a706350f1834b167ef95763aa1b399a624e99ee | Python | 21,515 | 554 | # License: GNU Affero General Public License v3 or later
# A copy of GNU AGPL v3 should have been included in this software package in LICENSE.txt.
"""
Module to detect transcription factor binding sites (TFBSs)
using position weight matrices (PWMs) in BGCs.
"""
from dataclasses import dataclass
from enum import IntE... |
18ac68e87a8c9cf880bbb07a3e7872fbc1b8accf7968aa3143a72a34e2a522e4 | Python | 21,528 | 576 | ## ...........................................................................
##
## PIMMS (Polymer Interactions in Multicomponent Mixtures)
## Alex Holehouse, Pappu Lab, Holehouse Lab
## Copyright 2015 - 2026
## ...........................................................................
#
import numpy as np
impor... |
465bd70bd8c73a001d5fa92e060454ee9a176a5414860804f676a2a078cbf816 | Python | 21,557 | 391 | # -*- coding: utf-8 -*-
#
# train.py
#
# Copyright 2020 Amazon.com, Inc. or its affiliates. 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/... |
75973ae495e5475979ba505a42b57390bbf4cfc2e0c17065ac11713b14520599 | Python | 21,584 | 606 | import datetime as dt
from datetime import datetime
import dateutil
import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
DatetimeIndex,
Index,
MultiIndex,
Series,
Timestamp,
concat,
date_range,
to_timedelta,
)
import pandas._testing as tm
class Tes... |
745b25adc49998ba8dfdd0bc90a06816e1eaa18895db8d46e593e7f25faac926 | Python | 21,587 | 481 | import numpy as np
import pandas
import matplotlib.pyplot as pl
import math
import matplotlib as mpl
from matplotlib import cm
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
from sklearn.decomposition ... |
95e29544a6d02f2abb6961d43deff815c4f1411daa5d19e4a20f335d8a8e364b | Python | 21,593 | 599 | """Implements the mSPoC algorithm for multimodal data."""
import numpy as np
from scipy.linalg import eigh
from sklearn.cross_decomposition import CCA
import xarray as xr
from cedalion import cite
from cedalion.sigdecomp.multimodal.utils import (
validate_dimension_labels,
validate_time_shifts,
)
class mSP... |
eed0de0f92c8f14d5cd464a09954f223ce5ad3dd80b8035ca786a8561fca9857 | Python | 21,611 | 453 | from torch.utils.data import DataLoader
import numpy as np
import torch
from utils import InfoNCE
from tqdm import tqdm
from torch.optim import Adam
from utils import DualBranchContrast
from pl_bolts.optimizers import LinearWarmupCosineAnnealingLR
from model_scripts.VarCoNet import VarCoNet_noCNN, VarCoNet_noTransforme... |
f11232d69de2de2ed15edaaf5d079042f5c446df0adb7b5b39ced919f2fe3626 | Python | 21,613 | 544 | """Provides a set of standard plots for visualizing evaluations."""
import numpy as np
import matplotlib.pyplot as plt
from yass.evaluate.util import main_channels
class ChristmasPlot(object):
"""Standard figure for evaluation comparison vs. template properties."""
def __init__(self, data_set_title, n_data... |
5a5da57675f17561aa657cd7aa805a65d3ec64ab982ffaf3a5a89e2fa7e55e7c | Python | 21,619 | 573 | """
Classical shadows functions
"""
from typing import Any, Union, Optional, Sequence, Tuple, List
from string import ascii_letters as ABC
import numpy as np
from .cons import backend, dtypestr, rdtypestr
from .circuit import Circuit
from .quantum import _resolve_keep_or_subsystem
Tensor = Any
def shadow_bound(
... |
9abb5b01af505d85eb3447b61c6285c9eb36a094cda8899c8091968979f13ad4 | Python | 21,630 | 578 | """Provide access to Python's configuration information. The specific
configuration variables available depend heavily on the platform and
configuration. The values may be retrieved using
get_config_var(name), and the list of variables is available via
get_config_vars().keys(). Additional convenience functions are a... |
f9e81ae2ee7353acbf939235d6c183080f002007887c4e054abc7dcdb522ad9c | Python | 21,634 | 504 | import sys
import os
import re
import time
import random
import math
import numpy as np
import copy
from boundslist import *
from network import *
from parseinputs import *
from deephuntermutators import *
def get_covprop_helper(grid):
#recursive: for each elem in grid, if it is a number then check 1 or 0, ot... |
01b354dec2bc0517f7f7793c286191a660da49873253ece5b320c87a4a25880c | Python | 21,671 | 561 | #!/usr/bin/env python3
import logging
import math
import time
from datetime import datetime
import numpy as np
import torch
import torch.distributed as dist
from nn import NeuralNetwork
from tensorboardX import SummaryWriter
from torch.nn.functional import softplus
from torch.nn.parallel import DistributedDataParalle... |
78ce8380114c9f3601081d2510a45cf2c449605b1cd477e5d014369107ef476e | Python | 21,691 | 580 | #!/usr/bin/env python3
"""Generates a matrix to be utilized through github actions
Will output a condensed version of the matrix if on a pull request that only
includes the latest version of python we support built on three different
architectures:
* CPU
* Latest CUDA
* Latest ROCM
* Latest XPU
"""
f... |
1b15dcaf1566bc45aa14e122cc7b0583ef662e779812d5c1a4ecf04c496bae1e | Python | 21,725 | 653 | """
Functions for
- reporting information during running of a program, eg details about DFs
- reporting evaluation information for models
"""
import json
import logging
import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
# Importing packages related to model performance
# from sklearn.me... |
d5945a44586bd85bc098ebbe04ed31a8348b80f3f9fa23c5bc956e59149d297e | Python | 21,736 | 519 | import os
import shutil
import sys
import random
import numpy as np
import torch
from torch import nn
from torch.optim.lr_scheduler import ReduceLROnPlateau
from e3nn.o3 import Irreps, Irrep
from .from_nequip.tp_utils import tp_path_exists
def set_random_seed(seed):
np.random.seed(seed)
torch.manual_seed(s... |
2e4ab41cbe80b41b1f34106bafd1f65f8e65d4c6fd55efe0440217debf4adefb | Python | 21,750 | 478 | """Main Module of arcos4py.
This module contains the ARCOS class, which implements most functionallity of arcos4py
to prepare data and to detect and track collective events.
Example:
>>> from arcos4py import ARCOS
>>> ts = ARCOS(data,["x"], 'time', 'id', 'meas', 'clTrackID')
>>> ts.interpolate_measurement... |
7ea47a70b63b6260c420749c2cbf3989e481a1fb9d460bae01d0945f00fee940 | Python | 21,789 | 526 | """
Global statistical analysis of SPM maps produced by first-level analyis
of the dataset.
* tease out effect of subject, task and phase encoding direction
* Study global similarity effects
Authors: Bertrand Thirion, Ana Luisa Pinho 2020
Compatibility: Python 3.5
"""
import os
import json
import warnings
from job... |
73f16ab0a3c208e0ea5c2c18149f5f333ea88ef9bbc08ffa201ee2dfd8af6b83 | Python | 21,791 | 547 | import os, sys
import pyvista as pv
try:
from .io_utils import xdmf_to_unstructuredGrid
except:
from io_utils import xdmf_to_unstructuredGrid
import itertools
import numpy as np
import numpy_indexed as npi
import matplotlib as mpl
import matplotlib.pyplot as plt
import yaml
import k3d
hexcolor = lambda c: ... |
0d107304326b794cb595a7833ab1b6688c990d6fcb86bf33263bd84e2f261988 | Python | 21,793 | 613 | from __future__ import annotations
import functools
import itertools
import logging
import os
import posixpath
import re
import urllib.parse
from collections.abc import Mapping
from dataclasses import dataclass
from typing import (
TYPE_CHECKING,
Any,
NamedTuple,
)
from pip._internal.utils.deprecation imp... |
698ee7d449d07dcda7b9ffc734a79d7ee46ab65e6b481f93e73f86dfd9800761 | Python | 21,805 | 543 | import time
import struct
import numpy as np
from TBVClient import TBVClient
class TBVNetworkInterface:
def __init__(self, tbv_client):
self.tbv_client = tbv_client
def create_connection(self):
self.tbv_client.create_connection()
def close_connection(self):
self.tbv_client.close_c... |
2e14e2e8ed111be5deb08f950ae9d48ce9aef9606f15be8c68cbf8f495f6816f | Python | 21,814 | 657 | from __future__ import annotations
from typing import (
TYPE_CHECKING,
ClassVar,
Literal,
)
import numpy as np
from pandas._config import get_option
from pandas._libs import (
lib,
missing as libmissing,
)
from pandas._libs.arrays import NDArrayBacked
from pandas._libs.lib import ensure_string_a... |
38a236ef30fde01b90ed18bc5830a11d762e18c3df6419fe5e010f7be2fc70ff | Python | 21,844 | 548 | """
Analog-Digital Hybrid Circuit class wrapper
only support jax backend
"""
from typing import Any, List, Optional, Callable, Dict, Tuple, Union, Sequence
from dataclasses import dataclass
from functools import partial
import numpy as np
import tensornetwork as tn
from .cons import backend, rdtypestr
from .abstract... |
b85bd78d71767e94094b06548463947e0bb2264ef1a176322f44a137629f5f1f | Python | 21,870 | 636 | from string import ascii_lowercase
import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
Series,
Timestamp,
)
import pandas._testing as tm
def test_filter_series():
s = Series([1, 3, 20, 5, 22, 24, 7])
expected_odd = Series([1, 3, 5, 7], index=[0, 1, 3, 6])
exp... |
0f41c64155f2b620025e0000afebe9f20fc161eac2a8983082025f61c4902587 | Python | 21,880 | 558 | #!/usr/bin/env python3
"""Repair a PyTorch wheel: bundle libgomp + GPU libs, set RPATHs, retag platform.
Uses auditwheel for unpack/repack (not the `wheel` CLI). `wheel pack`/`wheel tags`
emit an invalid ZIP64 header for archives over 4GB (pypa/wheel#692), which makes
large ROCm wheels fail to install under strict zip... |
cd4b326423b516b855c45f92fdfb844ffc636d6a097374ab142358fdbb93ed65 | Python | 21,905 | 639 | import pytest
import textwrap
from numpy.testing import assert_array_equal, assert_equal, assert_raises
import numpy as np
from numpy.f2py.tests import util
@pytest.mark.slow
class TestCharacterString(util.F2PyTest):
# options = ['--debug-capi', '--build-dir', '/tmp/test-build-f2py']
suffix = '.f90'
fpref... |
05ac4d9ad50054bcc49a282a2fc9fe89e1e3154ac8509df86128604b0f5aeeb1 | Python | 21,909 | 544 | ## ...........................................................................
##
## PIMMS (Polymer Interactions in Multicomponent Mixtures)
## Alex Holehouse, Pappu Lab, Holehouse Lab
## Copyright 2015 - 2026
## ...........................................................................
import time
from .latticeEx... |
e019995f7476f27bc80cb5c50961e99ae8d3d6307c234cc8589c53794d631733 | Python | 21,935 | 671 | """module containing integration tests for the distance generatio/comparison workflows"""
# from python
from unittest import TestCase
from unittest.mock import MagicMock
from click.globals import push_context
from pathlib import Path
from itertools import combinations
from sqlalchemy import select
# from other modul... |
ee9802b07feb84bd70a59c79f17ac8985518371a80f2b97b1bf9a8d612144a1c | Python | 21,946 | 639 | from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as np
import pyqtgraph as pg
from sqlmodel import Session, col, select
from cali.logger import cali_logger
from cali.plot._util import disconnect_hover_handlers
from cali.sqlmodel._model import FOV, ROI, DataAnalysis, Traces
if TYPE_CH... |
6c3cd28e33f276188271ed0338969bd77dbb6bad779a1b3df0f8a6c1f21d7634 | Python | 21,947 | 638 | """
Quantilization functions and related stuff
"""
from __future__ import annotations
from typing import (
TYPE_CHECKING,
Any,
Callable,
Literal,
)
import numpy as np
from pandas._libs import (
Timedelta,
Timestamp,
lib,
)
from pandas.core.dtypes.common import (
ensure_platform_int,
... |
68b7c19639ebf5b00811069338cf13ae15bfa309d42d34a67e43ea9c4f597fc6 | Python | 21,948 | 500 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
"""
═══════════════════════════════════════════════════════════════════════════════
EvoAge KG — 1-to-MANY ortholog graph → mapped_triples tensor
═══════════════════════════════════════════════════════════════════════════════
Sources:
1. Human files : all relati... |
e097e7ee12ad36bdd0c231429e5c74f7acafb3813d7e42edda0c19398c7bbce9 | Python | 21,977 | 364 | import sys
import pandas as pd
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
import numpy as np
from time import perf_counter
from numpy import dot
from numpy.linalg import norm
from scipy import stats
from statistics import mean, median, mode
from numpy import std
from statisti... |
6e42294c51a1df2a4c0190ae956630e993c5a6aae56db480a22beb23005002dc | Python | 22,013 | 647 | """Tests for polynomial module.
"""
from functools import reduce
from fractions import Fraction
import numpy as np
import numpy.polynomial.polynomial as poly
import numpy.polynomial.polyutils as pu
import pickle
from copy import deepcopy
from numpy.testing import (
assert_almost_equal, assert_raises, assert_equal,... |
d8420fc27c482e910f0b244f26d2a847a2e93382ec224b20f1cfb1f8f7de9710 | Python | 22,016 | 574 | import cupyx.scipy.signal.windows
import numpy as np
import cupy as cp
import cupyx
import scipy.ndimage
import cupyx.scipy.ndimage
import cupyx.scipy.signal
def dogfilter(vol, sigma_low=1, sigma_high=4, mode="reflect"):
"""Diffference of Gaussians filter
Args:
vol (array_like): data to be filtered
... |
2abcfd27e163f7a346ecf52436c557c6d89fd8b0314140d45fde94d68818325c | Python | 22,048 | 592 |
"""
Modern scATAC-seq Peak Annotation Pipeline
Best practices from Signac, SnapATAC2, and scvi-tools (2024)
"""
import numpy as np
import pandas as pd # type: ignore
import scanpy as sc # type: ignore
import anndata as ad # type: ignore
from pathlib import Path
from typing import Literal, Optional, Dict
import re
... |
e8436f399f0f043ce1f24822c69aa5f6522b6f67711fe93b66605a9c9176360e | Python | 22,050 | 622 | from __future__ import absolute_import
import email
import logging
import re
import time
import warnings
from collections import namedtuple
from itertools import takewhile
from ..exceptions import (
ConnectTimeoutError,
InvalidHeader,
MaxRetryError,
ProtocolError,
ProxyError,
ReadTimeoutError,... |
3f899c995a69ad685dd13b0574004226734f42b92b2cb17022ba4a6877bc6c9a | Python | 22,138 | 771 | """
Tests that NA values are properly handled during
parsing for all of the parsers defined in parsers.py
"""
from io import StringIO
import numpy as np
import pytest
from pandas._libs.parsers import STR_NA_VALUES
from pandas import (
DataFrame,
Index,
MultiIndex,
)
import pandas._testing as tm
pytestma... |
c659eac11b891ca449e9f27ec41e37536b47c7fc18eeefac8b027a2a9800dcb6 | Python | 22,141 | 529 | # License: GNU Affero General Public License v3 or later
# A copy of GNU AGPL v3 should have been included in this software package in LICENSE.txt.
# for test files, silence irrelevant and noisy pylint warnings
# pylint: disable=no-self-use,protected-access,missing-docstring
import unittest
from unittest.mock import ... |
6ae17b070c0f70a8e3cad89a510a256942e5a1f37ea5feb120cec167ed2a6236 | Python | 22,147 | 547 | """
NumPy
=====
Provides
1. An array object of arbitrary homogeneous items
2. Fast mathematical operations over arrays
3. Linear Algebra, Fourier Transforms, Random Number Generation
How to use the documentation
----------------------------
Documentation is available in two forms: docstrings provided
with the c... |
4594768c48ecad5ab788b54a4a4427588748038728922514c25d093b64dd3d89 | Python | 22,151 | 597 | """
Support code for building Python extensions on Windows.
# NT stuff
# 1. Make sure libpython<version>.a exists for gcc. If not, build it.
# 2. Force windows to use gcc (we're struggling with MSVC and g77 support)
# 3. Force windows to use g77
"""
import os
import sys
import subprocess
import re
im... |
9377f320dc77faa8e07b4b9d23a7c2d544120cf629306af1792b95f5c638ae65 | Python | 22,151 | 601 | """Provide access to Python's configuration information. The specific
configuration variables available depend heavily on the platform and
configuration. The values may be retrieved using
get_config_var(name), and the list of variables is available via
get_config_vars().keys(). Additional convenience functions are a... |
781c3fb4f792252dd17572accaa2f734fa539b49ab8bceaaff64e4779ca6d27a | Python | 22,205 | 656 | """Pauli noise channels and error sampling infrastructure."""
from __future__ import annotations
import functools
from collections import defaultdict
from typing import Any
from dataclasses import dataclass
import jax
import jax.numpy as jnp
import numpy as np
@dataclass
class Channel:
"""A probability distrib... |
9733461f238186f58bef541aad5b5a8ecf3f6528c8bd2049230ae4e3e61b81d6 | Python | 22,214 | 716 | # Only tests that raise an error and have no better location should go here.
# Tests for specific groupby methods should go in their respective
# test file.
import datetime
import re
import numpy as np
import pytest
from pandas import (
Categorical,
DataFrame,
Grouper,
Series,
)
import pandas._testin... |
0940480456e52e20d41d19002e3ad2f335310b184f21c08dc1da203ee59f9908 | Python | 22,326 | 584 | # License: GNU Affero General Public License v3 or later
# A copy of GNU AGPL v3 should have been included in this software package in LICENSE.txt.
""" A collection of functions for reading, processing, and sanitising records.
"""
import functools
import logging
import re
from typing import Any, Callable, List, Set, ... |
b7f8d4a2f6f2a36685d6ecc95561a6b6d2d54f78d5de1e65d5e0d77e87ee8c71 | Python | 22,326 | 688 | """Comprehensive tests for plot widget GUI behavior.
This module tests:
- Combo box enabling/disabling based on pipeline stage availability
- Plot display and rendering with real data
- FOV switching behavior and plot reload logic
- Combo selection persistence across state changes
- Detection GUI model selection with ... |
51f7921d697c01e4ed6ce04ea070312b874e0ce5a466d7f2fa6fe2edc59d27c7 | Python | 22,344 | 631 | """
Utilities for determining application-specific dirs.
See <https://github.com/platformdirs/platformdirs> for details and usage.
"""
from __future__ import annotations
import os
import sys
from typing import TYPE_CHECKING
from .api import PlatformDirsABC
from .version import __version__
from .version import __ve... |
7bee61997cad6a45066fe8fc94067568852c7c9ff30477bb83a943538ca45fca | Python | 22,344 | 666 | """Contains methods to run the legacy comparison workflow on a bin of BGC pairs
This is a an alternate implementation that minimizes memory overhead and is generally
cleaner.
TODO: profile this and compare performance with other implementation. this may
actually be faster
TODO: this is relatively simple code and worth... |
278c7b6b9441edeec5261263c249ecb154ceba3368f2cff011530470778136fb | Python | 22,348 | 355 | import torch
import os
from network.spiking_net import Critic, VDNNet, Linear_weight, BiasNet
import copy
class SToMVDN:
def __init__(self, args):
self.n_actions = args.n_actions
self.n_agents = args.n_agents
self.obs_shape = args.obs_shape
input_shape = self.obs_shape
# 根据... |
788ae27a2c8ccb36de9f41707344818716280a27ddde4a607c98ee2a043d135b | Python | 22,427 | 512 | import json
import re
import os
import time
import h5py
import numpy as np
import csv
import copy
from .kernel import NetOutInfo, DeepHE3Kernel
class testResultAnalyzer:
def __init__(self, data_dir, output_dir):
self.data_dir = data_dir
self.output_dir = output_dir
s... |
42fa52f7a9f8dcbd6b4dd2cd2cd6b79af22e8773df0d09070fb2c52490236269 | Python | 22,432 | 489 | #!/usr/bin/env python3.7
"""Defines MockSample class.
The copyrights of this software are owned by Duke University. Please
refer to the LICENSE and README.md files for licensing instructions. The
source code can be found on the following GitHub repository:
https://github.com/wmglab-duke/ascent
"""
import json
impor... |
e3d7fc0118ae1006c89ae0dab16f7e368c2d8a35513f2a18e8046d5fa8ae3673 | Python | 22,433 | 698 | from datetime import timedelta
from itertools import product
import numpy as np
import pytest
from pandas._libs.tslibs import OutOfBoundsTimedelta
from pandas._libs.tslibs.dtypes import NpyDatetimeUnit
from pandas import (
Index,
NaT,
Timedelta,
TimedeltaIndex,
offsets,
to_timedelta,
)
import... |
5ae7269cc74c7f0f7c7c8fa1382f450132e7226ab9d5f20908053fa0bbdc685e | Python | 22,457 | 680 | import sys
import os
import numpy as np
import pytest
from pytest_lazyfixture import lazy_fixture as lf
import tensorflow as tf
thisfile = os.path.abspath(__file__)
modulepath = os.path.dirname(os.path.dirname(thisfile))
sys.path.insert(0, modulepath)
import tensorcircuit as tc
from tensorcircuit.channels import (
... |
916be36dbd55cf8684a6b5032bc1d28f97fbbcb9804c1f5c5192e573edca790e | Python | 22,466 | 781 | """Tests for utility functions in cali.util._util."""
from pathlib import Path
import numpy as np
import pytest
from cali.util._util import (
coordinates_to_mask,
mask_to_coordinates,
)
@pytest.mark.parametrize(
"mask,expected_coords,expected_shape",
[
# Test case 1: Simple 3x3 mask with si... |
31a935cc959d631ea65fed3e3b31c8993cd848697d5153d2b0f29550074c3682 | Python | 22,485 | 701 | import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
Index,
MultiIndex,
Series,
concat,
date_range,
timedelta_range,
)
import pandas._testing as tm
from pandas.tests.apply.common import series_transform_kernels
@pytest.fixture(params=[False, "compat"])
def ... |
e6897479ebf3d553fd4170686d5e386bcddae445c20280668f78b2e6c7cb3a44 | Python | 22,489 | 488 | #!/usr/bin/env python3.7
"""Defines MockSample class.
The copyrights of this software are owned by Duke University. Please
refer to the LICENSE and README.md files for licensing instructions. The
source code can be found on the following GitHub repository:
https://github.com/wmglab-duke/ascent
"""
import json
impor... |
77ebf599c2f1a1f83615a22a06b57e7be65c8ce810852d28c57a648b5bf5c97b | Python | 22,502 | 693 | """Handles all VCS (version control) support"""
from __future__ import annotations
import logging
import os
import shutil
import sys
import urllib.parse
from collections.abc import Iterable, Iterator, Mapping
from dataclasses import dataclass, field
from typing import (
Any,
Literal,
Optional,
)
from pip... |
a720997f3d1d3d55a56081350c0889c045476daf31ed1cffba391576a8822953 | Python | 22,529 | 714 | """Tests for the TianYan cloud provider.
Offline tests run by default. Set ``TC_CLOUD_TEST=1`` and ``TC_TOKEN_TIANYAN``
to run online simulator tests. Real-device tests additionally require
``TC_CLOUD_HARDWARE_TEST=1``.
"""
import os
import sys
from types import ModuleType, SimpleNamespace
from typing import Any, Dic... |
805e3f0622e463cc92165cdac0f571af665c9e8a2cdd23119f6769b01d323f87 | Python | 22,530 | 757 | """
Utility classes and functions for the polynomial modules.
This module provides: error and warning objects; a polynomial base class;
and some routines used in both the `polynomial` and `chebyshev` modules.
Functions
---------
.. autosummary::
:toctree: generated/
as_series convert list of array_likes in... |
7de546488042350fb3d08f7d189cf76b815e14fb27aee229598782a72037edf4 | Python | 22,559 | 598 | """Runs DP5 analysis for organic molecules."""
from pathlib import Path
import logging
import dill as pickle
from abc import abstractmethod
from tqdm import tqdm
from joblib import Parallel, delayed
from scipy.stats.kde import gaussian_kde
from scipy.stats import norm
from scipy.optimize import curve_fit
from sklearn... |
e65f6a9c8a33e66467541a8783f050a2dbfef018184c66432c45a9738a9c8784 | Python | 22,565 | 568 | from __future__ import annotations
from dataclasses import dataclass
from typing import cast
from qtpy.QtCore import Qt
from qtpy.QtGui import QIcon, QStandardItemModel
from qtpy.QtWidgets import (
QComboBox,
QHBoxLayout,
QLabel,
QLineEdit,
QProgressBar,
QPushButton,
QSizePolicy,
QVBox... |
c5b2d28ae4c8b386befe281fa5fbd3e8bb2620c629a7956c5afb622690c679e2 | Python | 22,581 | 515 | # encoding: utf-8
# Author : Floyed<Floyed_Shen@outlook.com>
# Datetime : 2022/4/28 14:56
# User : Floyed
# Product : PyCharm
# Project : braincog
# File : main_simplified.py
# explain : Simplified training script. Remove support for DDP, IMAGENET, Augment, etc.
import argparse
import time
import ... |
647edf64dddaa6ef0cf8e93a3bfabdbb374b76b8f69e3d7b542cc90b6836925e | Python | 22,604 | 622 | """
main entrypoints of cloud module
"""
from typing import Any, List, Optional, Dict, Union, Tuple
from base64 import b64decode, b64encode
from functools import partial
import json
import os
import sys
import tempfile
import logging
from .abstraction import Provider, Device, Task, sep, sep2
logger = logging.getLogg... |
2feabaa69d2430c9dceec38969d5db7f34b325e25d4d05b36e82bbad7a7ddab5 | Python | 22,608 | 468 | # License: GNU Affero General Public License v3 or later
# A copy of GNU AGPL v3 should have been included in this software package in LICENSE.txt.
""" Detects specific domains and defines clusters based on domains detected
"""
from collections import defaultdict
import logging
from typing import Any, Dict, List, Opt... |
58451d387a6ea87e35c4a90a2877f78903b8d05ab1f874e8e04fddfd9833dbc7 | Python | 22,612 | 519 | import torch
from torch_cluster import radius_graph
from torch_scatter import scatter
import e3nn
from e3nn import o3
from e3nn.util.jit import compile_mode
from e3nn.nn.models.v2106.gate_points_message_passing import tp_path_exists
import torch_geometric
import math
from .registry import register_model
from .instan... |
5ee361b31ffeb72aee8bf00e827d74c9f67da7860133af2f5b6fdb1a62a3d3b2 | Python | 22,639 | 683 | #!/usr/bin/env python3
"""
cpuinfo
Copyright 2002 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@cens.ioc.ee>
Permission to use, modify, and distribute this software is given under the
terms of the NumPy (BSD style) license. See LICENSE.txt that came with
this distribution for specifics.
NO WARRANTY IS EX... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.