sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
bfd54fc68d3dde827615e9ea2ccbd0927fc52811fbdb34700acb34cbdcd5c70e
Python
19,611
570
import numpy as np import scipy import scipy.stats import scipy.sparse from sklearn.decomposition import PCA,TruncatedSVD from sklearn.neighbors import NearestNeighbors import time ########## PREPROCESSING PIPELINE def print_optional(string, verbose=True): if verbose: print(string) return def pipeli...
32a41183ee2bacadb014208ba53e80a858fa96e9f81826bc36ea66aa0c8b31b7
Python
19,634
531
#!/usr/bin/env python3 import argparse import gzip import logging import os import subprocess import sys import shims assert sys.version_info.major >= 3, 'Python 3 required' version = shims.get_module_or_shim('utillib.version') SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) DESCRIPTION = """Run the entire Du...
ab45bc07a9aff66d1eed12d57ed2297aeb7c2f317991a83bbc5d9e004cc8c05f
Python
19,641
432
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license """ PyTorch utils """ import math import os import platform import subprocess import time import warnings from contextlib import contextmanager from copy import deepcopy from pathlib import Path import torch import torch.distributed as dist import torch.nn as nn import torc...
abaad64dad3a1f3a5b1f0c4a136d6432a50ac6ed4c389bf0818aaaa811b56f9f
Python
19,645
558
# -*- coding: utf-8 -*- """ Created on Thu Mar 9 10:19:35 2023 @author: lindseyb """ import numpy as np from sklearn.linear_model import LinearRegression from sklearn.metrics import roc_auc_score import matplotlib.pyplot as plt import matplotlib matplotlib.rcParams['pdf.fonttype'] = 42 matplotlib.rcParams['ps.fontty...
77b13810494f800f296a07a7f7357f8da3c3c5ec6c40f50e8bb7b3ba7b3314dc
Python
19,666
544
import numpy as np import pytest from pytest_lazyfixture import lazy_fixture as lf import tensorflow as tf from scipy.linalg import expm import tensorcircuit as tc F = tc.fgs.FGSSimulator FT = tc.fgs.FGSTestSimulator @pytest.fixture def requires_openfermion(): pytest.importorskip("openfermion") @pytest.mark.p...
d76daed86be1d317305b96f1d71c9d694c9fdea92039aec798a212d351b8eb03
Python
19,672
551
"""Integration tests for multi-well bar plots - verify actual plot data.""" from __future__ import annotations from typing import TYPE_CHECKING import pytest from pyqtgraph import BarGraphItem from qtpy.QtWidgets import QWidget from sqlalchemy.exc import OperationalError from sqlmodel import Session, create_engine, ...
071621f5868b3e965caa5a93d1c4df73c5192f9625dba82f540a7e7a79645d17
Python
19,689
571
import sys import os import numpy as np import pytest from pytest_lazyfixture import lazy_fixture as lf from scipy.optimize import minimize thisfile = os.path.abspath(__file__) modulepath = os.path.dirname(os.path.dirname(thisfile)) sys.path.insert(0, modulepath) import tensorcircuit as tc from tensorcircuit.noisemod...
549ed8d4d2fe5da5f21cfcf8a137fc2311d557bd9eb5782bbda3651192df4cbb
Python
19,695
428
import logging import time from pathlib import Path import cv2 from PySide6.QtCore import QObject, QThread from app.config.camera import CameraConfig from app.config.grimace import GrimaceConfig from app.config.pose_top import PoseTopConfig from app.config.recording import RecordingConfig from app.config.video_files ...
24f9fc992a3b1524ee15a1f3a6210b8150704ecaa68c848b9c6a31968cba4a35
Python
19,699
573
import re import numpy as np import pytest import pandas.util._test_decorators as td import pandas as pd from pandas import ( Categorical, CategoricalDtype, CategoricalIndex, DataFrame, Index, Interval, Series, Timedelta, Timestamp, option_context, ) import pandas._testing as ...
2b4610006846c9a2bf8f9b663fd21b431f333b9e880fd1a16d3693f6ffb74f53
Python
19,726
556
from datetime import datetime import numpy as np import pytest from pandas.core.dtypes.cast import find_common_type from pandas.core.dtypes.common import is_dtype_equal import pandas as pd from pandas import ( DataFrame, Index, MultiIndex, Series, ) import pandas._testing as tm class TestDataFrameC...
85f71875abcd79e0db8988ef4c1a8303a3891f11f57ee34374cb536548b74598
Python
19,733
546
import functools import warnings import operator import types import numpy as np from . import numeric as _nx from .numeric import result_type, nan, asanyarray, ndim from numpy._core.multiarray import add_docstring from numpy._core._multiarray_umath import _array_converter from numpy._core import overrides __all__ = ...
5c32dc798ec16f158db1e1b46075fcbac87429cf5f8f7564ad579bf6c7b2bc25
Python
19,742
425
""" Author: Bertrand Thirion, 2015 Modified by: Swetha Shankar, 2021 """ import os import glob import numpy as np import nibabel as nib import matplotlib.pyplot as plt from ibc_public.utils_data import get_subject_session from joblib import Memory, Parallel, delayed source_dir = '/storage/store2/data/ibc/sourcedata' ...
a12060aa0df977c85033b850770ded55ae896299e1e567f627d098ab2e1cbbef
Python
19,765
487
#!/usr/bin/env python3 import argparse as arp def make_parser(): prs = arp.ArgumentParser() parser = arp.ArgumentParser() subparsers = parser.add_subparsers(dest = 'command') run_parser = subparsers.add_parser("run", formatter_class=arp\ ...
4671d2dc7cf42d228c9bb8f8ffa096d8f0013065177e7b1f89e0aa7e665a5044
Python
19,814
585
import torch import torch.nn as nn import copy from protgps.models.abstract import AbstractModel from protgps.utils.classes import set_protgps_type from protgps.utils.registry import register_object, get_object from torch.nn.utils.rnn import pad_sequence import functools @register_object("fair_esm", "model") class Fa...
75925861261e1a4b86adf74df54a09ee55927f7d375413324ec5c5deec9c5c46
Python
19,821
517
## ........................................................................... ## ## PIMMS (Polymer Interactions in Multicomponent Mixtures) ## Alex Holehouse, Pappu Lab, Holehouse Lab ## Copyright 2015 - 2026 ## ........................................................................... import numpy as np import c...
4570fae168a31f407b66086b39ad14f26a9d40c016626939277fe4ef44fe5796
Python
19,831
637
""" QAOA portfolio selection with fund NAV data fetched by xalpha. The example chooses one representative fund for each requested exposure: - 110020: 易方达沪深300ETF联接A - 090010: 大成中证红利指数A - 110026: 易方达创业板ETF联接A - 000307: 易方达黄金ETF联接A - 270042: 广发纳斯达克100ETF联接人民币(QDII)A """ from __future__ import annotations import argpa...
727d053de878a0a469234a34d6d171db854ea0d42bf7418288a20ca3c701684d
Python
19,840
589
import numpy as np import pytest from pandas.errors import SettingWithCopyError import pandas.util._test_decorators as td import pandas as pd from pandas import ( DataFrame, MultiIndex, Series, date_range, isna, notna, ) import pandas._testing as tm def assert_equal(a, b): assert a == b ...
8aadf82118fdc23877d65b90157ee8b66a99960b00f7ff3865416164f2f86a42
Python
19,852
469
"""Networks_ide.py - Model and module class for EfficientNet. They are built to mirror those in the official TensorFlow implementation. """ # Author: lukemelas (github username) # Github repo: https://github.com/lukemelas/EfficientNet-PyTorch # With adjustments and added comments by workingcoder (github username). ...
4c70970e5446ec09dc5f9c33465a7dc3544dad80346d3a569b312b3157d3d3ec
Python
19,853
535
from functools import partial import numpy as np import pytest import pandas.util._test_decorators as td from pandas.core.dtypes.common import is_unsigned_integer_dtype from pandas.core.dtypes.dtypes import IntervalDtype from pandas import ( Categorical, CategoricalDtype, CategoricalIndex, Index, ...
fa71632943581bffa027a46965b5a7c7f4c996691101a800ec09d569ff5825f2
Python
19,855
493
# pylint: disable-msg=W0611, W0612, W0511,R0201 """Tests suite for mrecords. :author: Pierre Gerard-Marchant :contact: pierregm_at_uga_dot_edu """ import pickle import numpy as np import numpy.ma as ma from numpy.ma import masked, nomask from numpy.testing import temppath from numpy._core.records import ( recarr...
0ac8444d589b674febc1b36ad32eec3e4cd28275e9c08ec552dbc08fc79f53a4
Python
19,861
639
from __future__ import annotations import mmap from typing import ( TYPE_CHECKING, Any, cast, ) import numpy as np from pandas.compat._optional import import_optional_dependency from pandas.util._decorators import doc from pandas.core.shared_docs import _shared_docs from pandas.io.excel._base import ( ...
13197cd48a321863d8b75373da2a4943bf5c0d7aa55599c9b85842b887cab794
Python
19,878
604
from datetime import ( datetime, timezone, ) import numpy as np import pytest from pandas._libs.tslibs import iNaT from pandas.compat import ( is_ci_environment, is_platform_windows, ) from pandas.compat.numpy import np_version_lt1p23 import pandas as pd import pandas._testing as tm from pandas.core....
22fcb71ba316e377cb318c169fd41d13dc174712eba45f0816852907e4e99427
Python
19,879
501
import re import numpy as np import pytest from pandas.compat import PY311 from pandas import ( Categorical, CategoricalIndex, DataFrame, Index, Series, StringDtype, ) import pandas._testing as tm from pandas.core.arrays.categorical import recode_for_categories class TestCategoricalAPI: ...
536af5fe0ff5cd28ec8e251d00449cda200c7378b8ae2fd2f0f60fea4439cf52
Python
19,919
482
""" Spinners are from: * cli-spinners: MIT License Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) 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 withou...
56116f76d7ed957ea0e9aa01e1bcbdf57aaf7ee1daa250f5fbc96153ae0db055
Python
19,938
597
import json from pathlib import Path from unittest.mock import patch import numpy as np import pytest import tensorstore as ts import tifffile import useq import zarr from useq import MDASequence, WellPlatePlan from cali.readers._ome_zarr_reader import OMEZarrReader from cali.readers._tensorstore_zarr_reader import T...
e27fbb04ade27371aa798da1a47ed4c4adc2bec629ef46dfa968c1e0734f8297
Python
19,944
450
import warnings import os import torch from torch import nn import torch.nn.functional as F from torch_scatter import scatter from e3nn.nn import Gate from e3nn.o3 import Irreps, Linear, SphericalHarmonics, FullyConnectedTensorProduct from .from_nequip.cutoffs import PolynomialCutoff from .from_nequip.radial_basis impo...
b2974fda4999155d1589305448802e844073320e58238f286a6dfe5fc4ac15c1
Python
19,945
589
import warnings from collections import Counter from typing import Dict, Literal, Optional import numpy as np import pandas as pd from scipy.sparse import coo_matrix, issparse from anndata import AnnData from scanpy import Neighbors from scanpy.preprocessing import pca from scvelo import logging as logg from scvelo ...
09edb040770d577dea9e47876ce4638be496e794671d0daf51d1972b56152419
Python
19,956
580
import os from os.path import join import sys import numpy as np from numpy.testing import (assert_equal, assert_allclose, assert_array_equal, assert_raises) import pytest from numpy.random import ( Generator, MT19937, PCG64, PCG64DXSM, Philox, RandomState, SeedSequence, SFC64, defa...
2cc0f488b13a9431029f7986d344208b9c399047cbddc039710bde2646630b21
Python
19,956
499
import datetime import logging import pathlib import base64 import time import streamlit as st from utils.auth_utils import login_user, register_user, get_user_details, logout, forgot_password from utils.account_utils import update_user_query_limits, update_user_openai_key_api import kani_utils.kani_streamlit...
a5484d354c4b06fe3f0fe976b6c1c8085893e6bb838ef963db8a0490d6727319
Python
19,972
709
from datetime import ( datetime, timedelta, ) import operator import numpy as np import pytest import pytz from pandas._libs.tslibs import iNaT from pandas.compat.numpy import np_version_gte1p24p3 from pandas import ( DatetimeIndex, DatetimeTZDtype, Index, NaT, Period, Series, Tim...
bed0e56dd1613b443fc52a3f090c09401713617593816594cdd8e1732094ab59
Python
19,976
533
import math import torch import torch.nn as nn from torch import einsum import torch.nn.functional as F import matplotlib.pyplot as plt from einops import rearrange, repeat, reduce from einops.layers.torch import Rearrange from dropout import * def init_weights(m): #print(m) if m is not None and isinstance(m,...
2e6d260aca47949f26230df3707ee976d7e4ade6ee98d782d3c138aa640abafe
Python
19,983
575
## ........................................................................... ## ## PIMMS (Polymer Interactions in Multicomponent Mixtures) ## Alex Holehouse, Pappu Lab, Holehouse Lab ## Copyright 2015 - 2026 ## ........................................................................... # Functions for creating and...
e5e1212f4109f143928203b9da8836bb4c0d8c9d4c0aa9c58ab6bb34bdc9bad7
Python
19,985
372
##Sulcal phenotype measurement functions that require brainvisa's python distribution ##Note that trimesh must be installed by entering into BrainVISA's bash distribution ##(e.g., `bv bash`) and using `pip install trimesh` #load in relevant modules from soma import aims, aimsalgo import numpy as np import pandas as pd...
696ca15d1b4d3b82549c249556a29329077c1174ef526d5537da60b366dc38da
Python
19,990
540
from __future__ import absolute_import import collections import functools import logging from ._collections import HTTPHeaderDict, RecentlyUsedContainer from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, port_by_scheme from .exceptions import ( LocationValueError, MaxRetryError, ProxySc...
0a7dfc37ee48c564b68deb2285581bfff3dab8a2d3ab6067bbd771ded70e3204
Python
20,040
394
import collections import itertools import os import json import warnings import torch from torch_geometric.data import Data, Batch import numpy as np import h5py from .from_pymatgen.lattice import find_neighbors, _one_to_three, _compute_cube_index, _three_to_one from .utils import flt2cplx class Collater: def ...
857dbc87718ab849bee6b6ff0f15ee7d9d9b94424c4192155070a778fadd56c5
Python
20,043
505
#!/usr/bin/env python3.7 """Defines Waveform 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 csv import ma...
24132b9928b6c968ce5f4c00ee88805d96ca2def54fc36225ff14e480452556c
Python
20,044
506
#!/usr/bin/env python3.7 """Defines Waveform 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 csv import ma...
84bd9f1de654a02afbfb6b5a114fc62102ca53254a080441b1aca0649d16b651
Python
20,045
377
import os from collections import namedtuple from typing import List, Tuple, Optional, Union import numpy as np import torch import torchmetrics from torchmetrics.classification import Accuracy from pytorch_lightning import LightningModule import src.audio_transforms as at import src.audio_attention_transforms as aat...
9d06c37021f5200b40e651c3e6b904c7eb71064165204d54f6002f1367effe09
Python
20,118
475
""" Script used to perform retinotopic analysis based on the IBC low-level visual protocol. Author: Bertrand Thirion, 2015--2017 """ import os import glob from os.path import join as pjoin import numpy as np from nilearn.image import mean_img, math_img from ibc_public.utils_retino import phase_maps import nibabel as n...
7a7944afc85a33f86abfe76cca6347a4872a8c6db052902d12dde31ec706e172
Python
20,120
573
"""Utility functions for xarray objects.""" import warnings import numpy as np import pint import xarray as xr import scipy.sparse def pinv(array: xr.DataArray) -> xr.DataArray: """Calculate the pseudoinverse of a 2D xr.DataArray. FIXME: handles unitless and quantified DataArrays but not DataArr...
f00eeac6c220560742f7e3ff582964bc859b44e6c17786b0d877fbf1e972c787
Python
20,120
548
import numpy as np import pytest from pandas._config import using_pyarrow_string_dtype from pandas.errors import ChainedAssignmentError import pandas.util._test_decorators as td from pandas import ( DataFrame, NaT, Series, date_range, ) import pandas._testing as tm class TestDataFrameInterpolate: ...
b3250d72c0be025385a1fa01c31508d557fa14245ec81bd9fc01f2be9b8659ab
Python
20,130
619
""" Requirements file parsing """ from __future__ import annotations import codecs import locale import logging import optparse import os import re import shlex import sys import urllib.parse from collections.abc import Generator, Iterable from dataclasses import dataclass from optparse import Values from typing impo...
4c2d807fa800e0e9112310d35b2ff98e61cd22b82ca961a639517bd3bc0e9fc3
Python
20,152
514
import operator import numpy as np import pytest import pandas as pd from pandas import SparseDtype import pandas._testing as tm from pandas.core.arrays.sparse import SparseArray @pytest.fixture(params=["integer", "block"]) def kind(request): """kind kwarg to pass to SparseArray""" return request.param @p...
9651c92a0565393b0e56f560e489dd73b7c8978922c8ab299e05376c9a1ce420
Python
20,167
658
import hashlib import importlib.util import re import shutil import subprocess import sys from pathlib import Path from tempfile import mktemp import click import spin # tomllib is built in on Python 3.11+, and spin depends on tomli for older versions. if sys.version_info >= (3, 11): import tomllib else: imp...
31c103683c69d04603fe24afa70ead481e84c2badc509c41f8b11e0c0d346a4b
Python
20,202
502
"""FOV-level analysis functions for computing correlation and synchrony matrices. This module provides functions to compute pairwise correlation and synchrony matrices across all active ROIs in a FOV, as well as population-level burst detection. These metrics are computed once during analysis and stored in the FOVAnal...
21811f4c6894784011b9c5f5ef49707d9f6c41e372e589f351b9067c55649594
Python
20,217
521
"""Unit tests for nb_glm_fast.py and the gcate_glm backend toggle.""" from __future__ import annotations import math import warnings from unittest.mock import patch, MagicMock import numpy as np import pytest import scipy.sparse as sp import causarray.gcate_glm as gcate_glm from causarray.nb_glm_fast import ( _m...
2a23fb9a52a9555ef5c31525aa376a4b259abf127cd1861fe929ffa28ebe027a
Python
20,237
465
import os import time import pickle import numpy as np import torch import nrrd import pandas as pd import wandb from tqdm import tqdm from scipy.spatial import cKDTree from monai.data import decollate_batch, MetaTensor from monai.metrics import DiceMetric, CumulativeAverage from monai.inferers import sliding_window...
99cdbcfc9f034064682cc965564b66971353d66795a0738865c9ef54bc2db37f
Python
20,240
492
"""Various plots, candidates and helpers for paper figures.""" from itertools import product import numpy as np from matplotlib import pyplot as plt from matplotlib import gridspec as gs import seaborn as sns import pandas as pd from src import simulations as sims from src import utils from src import analyses as ana...
20e924e4c8823976d05a7afaff12918a2634caeb7d328a14c916de667cfd0042
Python
20,277
536
from typing import Dict, List import numpy as np import pytorch_lightning as pl import torch from e3nn import o3 from e3nn.o3 import Linear from torch import nn from torch.optim import Optimizer from torch.optim.lr_scheduler import LRScheduler from torch_cluster import radius_graph from torch_geometric.data import Dat...
23ab71edf8e11d30b181d51e9e3a746d1a158da87813e7e206673117fba443b3
Python
20,282
406
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license """ Validate a trained YOLOv5 detection model on a detection dataset Usage: $ python val.py --weights yolov5s.pt --data coco128.yaml --img 640 Usage - formats: $ python val.py --weights yolov5s.pt # PyTorch yolov5s.torch...
0865a8396a154fa4d35c3e8c99152bfb38eacef5b0a6ae8709967adbdd0131cb
Python
20,295
641
try: import vtk VTK_INSTALLED = 1 except ImportError as e: VTK_INSTALLED = 0 import numpy as np from scipy.sparse.linalg import cg # ,spilu,LinearOperator from scipy.sparse import eye, spdiags, csc_matrix, vstack # , diags from mpl_toolkits.mplot3d import Axes3D import matplotlib.tri as mtri import matpl...
b6d200f74f41adb4d4cf092a11efd3cd9561e0938e8fb83ad58b1e8b69abc068
Python
20,314
572
from __future__ import absolute_import import datetime import logging import os import re import socket import warnings from socket import error as SocketError from socket import timeout as SocketTimeout from .packages import six from .packages.six.moves.http_client import HTTPConnection as _HTTPConnection from .pack...
49820b17ad502bd038e34c5d0fd710a1d8fb858bdf6450a78ea1fce03ae6f4c9
Python
20,326
548
import torch.nn as nn import torchvision.models as models import numpy as np import os from sklearn.utils import shuffle import torch import torch.nn.functional as F class Appr(object): """ Class implementing the TALL """ def __init__(self, pretrained_feat_extractor, num_task, torc,device='cuda', args=None): ...
a8d49417edad9ff283a224dc24cb80860e190739974363e50a72ec702f69e81e
Python
20,328
419
# -*- coding: utf-8 -*- import os import csv import numpy as np import dirfiles from confparser import load_config from score import calc_score import expyriment from expyriment import design, control, stimuli, io, misc def protocol(protocol_ini, exp, island): # %% # ======================== LOAD CONFIG.IN...
71ef88acef6294823be8b1a4537e78a4e7476dea4cf147ed7cd1fb49f314ff6f
Python
20,330
624
import os import re import sys import typing as t from functools import update_wrapper from types import ModuleType from types import TracebackType from ._compat import _default_text_stderr from ._compat import _default_text_stdout from ._compat import _find_binary_writer from ._compat import auto_wrap_for_ansi from ....
0ef923ffeece928002cf27047a199a6e0bdbaa9a7e82e0d6861163a2adc81b28
Python
20,353
548
import numpy as np import pytest from pimms import lattice_utils from pimms.latticeExceptions import ( ChainConnectivityError, ChainDeletionFailure, ChainInsertionFailure, ClusterSizeThresholdException, LatticeUtilsException, ResidueAugmentException, RotationException, ) class _DummyChain...
e35453983facb906c29d98e915c1b9e95948c7564ff91782fa3e58221a49dd60
Python
20,362
546
import re import numpy as np import pytest from pandas.errors import PerformanceWarning import pandas as pd from pandas import ( DataFrame, DatetimeIndex, Index, MultiIndex, Series, Timestamp, ) import pandas._testing as tm @pytest.mark.parametrize( "msg,labels,level", [ (r"...
6692acbdddcfde9da1c1f8fab0794bfe5cac269d487af02833a01da5e4c0c7c3
Python
20,368
553
import pytest import numpy as np from numpy.testing import ( assert_, assert_equal, assert_array_equal, assert_almost_equal, assert_array_almost_equal, assert_raises, assert_raises_regex, ) from numpy.lib._index_tricks_impl import ( mgrid, ogrid, ndenumerate, fill_diagonal, diag_indices, diag_indices_f...
b4ac44f4c84ce0a70eee8d69f02fd96cc21523cb623491c699ac0d8b1e1c0887
Python
20,368
450
parent_path = r'/.../baselines' import sys sys.path.append(parent_path) from torch.utils.data import DataLoader import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from tqdm import tqdm from torch.optim import SGD from torch.optim.lr_scheduler import MultiStepLR from utils import ABIDE...
8406ffc7dd6b1836d84906b28e6c29816e1c0187e8102cfce48ffb5befd06ca6
Python
20,399
468
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, otherw...
d02566f6f87488ba38d6289901e8a6922e7c0d7a99958655c22c391c850bc54f
Python
20,407
458
import time from .util import get_data, normalize_index from .psenacutil import extend_phyche_index, get_phyche_index, make_pseknc_vector, make_old_pseknc_vector def check_psenac(lamada, w, k): """Check the validation of parameter lamada, w and k. """ try: if not isinstance(lamada, int) o...
2c8f3a494f1853fa1c7a7ed87f063d72d3c29a133d8bd3d89782cf2118aa6917
Python
20,415
457
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 ...
768fe005319110076bb7415646ecfb8d46a6121c7b3f7660abbc69222b0cff70
Python
20,451
509
"""Tools for resampling data.""" from __future__ import annotations import warnings from itertools import zip_longest from typing import TYPE_CHECKING, Callable, Union import numpy as np import pandas as pd from tqdm import tqdm if TYPE_CHECKING: import numpy.typing as npt from ..tools._arcos4py_deprecation im...
d71e3c972f1d3fcf9b47fc4597aaa6b7c2c3fa91a5b7591382c66de30b795584
Python
20,453
513
#!/usr/bin/env python3.7 """Defines Waveform 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 csv import ma...
e7400dec17c1fa909f1266ca365159497b5d0b40bc9acd70689ac5d9aae49d01
Python
20,454
591
from __future__ import annotations import logging import sys from collections.abc import Iterable from typing import TYPE_CHECKING, Any, Union, cast from pip._vendor.packaging.requirements import InvalidRequirement from pip._vendor.packaging.utils import NormalizedName, canonicalize_name from pip._vendor.packaging.ve...
0de817ce0289244cd97dbb20dd9f92fab38be446e7f5cf3d4dd97b2de5ecc8c6
Python
20,477
542
import h5py import parmap import numpy as np import scipy.io as sio import os from tqdm import tqdm import scipy import scipy.io import scipy.optimize as opt from scipy.spatial.distance import cdist from scipy.ndimage import gaussian_filter import networkx as nx from pkg_resources import resource_filename from yass im...
45c62ddac23f2a9148d08849e2a5f9494a6ca7764ad0aa4c1a8e9ede53d4ac25
Python
20,485
616
""" Customized ops for ML framework """ # pylint: disable=invalid-name # pylint: disable=unused-variable from typing import Any, Tuple, Sequence, Callable, Optional, Union from functools import partial import jax import jax.numpy as jnp import jax.scipy as jsp Array = Any # jnp.array @jax.custom_vjp def adaware...
13fdc0d785ec835e8f63dbd4562312cf5aa6d69bb457b96c34a6c3943eb656e8
Python
20,487
550
import warnings import numpy as np from scvelo import logging as logg from scvelo import settings from scvelo.core import LinearRegression from scvelo.preprocessing.moments import moments, second_order_moments from .optimization import leastsq_generalized, maximum_likelihood from .utils import groups_to_bool, make_de...
6a0f2ffe9a7e7d8a433ca26c56635a17037adb56f5305400c5ec344f529d13f6
Python
20,502
555
import re import os import sys import warnings import platform import tempfile import hashlib import base64 import subprocess from subprocess import Popen, PIPE, STDOUT from numpy.distutils.exec_command import filepath_from_subprocess_output from numpy.distutils.fcompiler import FCompiler from distutils.version import ...
9d994b90e9accd413483aaf2470055198e423b33f2b9d72c889b4359aacce4b4
Python
20,503
571
import contextlib import ctypes import platform import ssl import typing from ctypes import ( CDLL, POINTER, c_bool, c_char_p, c_int32, c_long, c_uint32, c_ulong, c_void_p, ) from ctypes.util import find_library from ._ssl_constants import _set_ssl_context_verify_mode _mac_version ...
c69ddc7b6676d7d94aa78545708f8008b9cd0abffde7a4e768f5ad9f71f1523b
Python
20,505
658
""" Variational Quantum Eigensolver (VQE) for the Toric Code Model This module implements VQE optimization for finding ground states of the generalized 2D toric code Hamiltonian with open boundary conditions and provides comparison among different ansätze: FLDC, GLDC, and FDC. Reference: - [arXiv:2311.01393](https://...
3d75f302623b54a85466f4ee347939b391d4b83f4453f0a149db730fa7973a15
Python
20,513
536
import numpy as np import matplotlib.pyplot as plt import seaborn as sns import matplotlib.colors as mpc from matplotlib.transforms import ScaledTranslation from nilearn.plotting import plot_surf from neuromaps.datasets import fetch_atlas from neuromaps.parcellate import Parcellater from neuromaps.images import dlabel_...
44d3ecc3bef9146a6bf6f4f9e3d9e198c3f57b365b5dfdcd5b5a42454d280a6a
Python
20,517
656
"""Implements the graph convolutional neural network for shift simulation and DP5 probaility estimation""" from dp5.neural_net.nfp.preprocessing import GraphSequence from dp5.neural_net.nfp.models import GraphModel from dp5.neural_net.nfp.layers import ( Squeeze, ReduceBondToAtom, GatherAtomToBond, Red...
ead32c14fd61ecaf197fbda634eb5ae93bf9dbf7d54e55e49ec7ae7df8f4f347
Python
20,522
619
"""Tests for chebyshev module. """ from functools import reduce import numpy as np import numpy.polynomial.chebyshev as cheb from numpy.polynomial.polynomial import polyval from numpy.testing import ( assert_almost_equal, assert_raises, assert_equal, assert_, ) def trim(x): return cheb.chebtrim(x, tol=1...
7b20c96fea20968861816e1be2c6707beff53c006190cf7fedaf6a5379fba005
Python
20,534
540
import collections.abc import textwrap from io import BytesIO from os import path from pathlib import Path import pickle import pytest import numpy as np from numpy.testing import ( assert_, assert_equal, assert_array_equal, assert_array_almost_equal, assert_raises, temppath, ) class TestFromrecords: ...
a9235b3266989501b875d7b37b3f0791c16d484b47f010a72fb50cd45c0035b5
Python
20,534
643
""" Tests that apply specifically to the CParser. Unless specifically stated as a CParser-specific issue, the goal is to eventually move as many of these tests out of this module as soon as the Python parser can accept further arguments when parsing. """ from decimal import Decimal from io import ( BytesIO, Str...
df06720f9f64c7db0ad69900283e1ba4bd3de255336cc24fe27f1031e51fae44
Python
20,565
692
"""Tests for plot legend functionality in burst and evoked plots. This module tests that legends are properly displayed and contain the expected items for plots that use the widget's shared legend. """ from __future__ import annotations from typing import TYPE_CHECKING from unittest.mock import MagicMock import num...
19eadeaa8ab95297ecf8dd797b0f7f903b41c6035567ab1b68c7e472c05559bb
Python
20,567
493
'''大数据纤维工具脚本''' import os, json import shutil from os.path import join import numpy as np '''基础函数''' # '''Swc多树拆分''' def SplitSwcData(swcData): indLs = np.where(swcData[:, -1] == -1)[0].tolist() + [swcData.shape[0]] swcDataLs = [] for i in range(len(indLs) - 1): data = swcData[indLs[i]: indLs[i +...
286fd3fcf38811ce679d52fb662f334b06a685a85b7e3531058ac2de29519442
Python
20,603
689
import numpy as np import pytest from pandas import ( DataFrame, Index, RangeIndex, Series, date_range, period_range, timedelta_range, ) import pandas._testing as tm def gen_obj(klass, index): if klass is Series: obj = Series(np.arange(len(index)), index=index) else: ...
06f35a16d8023117f2f28beef0682ca056f1f66469696ca38cc53346fb686983
Python
20,633
571
import matplotlib.pyplot as plt plt.switch_backend('agg') from rdkit.Chem import MolFromSmiles from rdkit.Chem import Draw import numpy as np import rdkit from rdkit import Chem from rdkit.Chem import AllChem import os from AttentiveFP.Featurizer import * import pickle import time from rdkit.Chem import rdDepictor fr...
506c687d4605a37b6abbed9f81a360992f0afaec21c2fed7dedbbb3eeef27904
Python
20,635
423
""" Test printing of scalar types. """ import code import platform import pytest import sys from tempfile import TemporaryFile import numpy as np from numpy.testing import ( assert_, assert_equal, assert_raises, assert_raises_regex, IS_MUSL) class TestRealScalars: def test_str(self): svals = [0.0, -0...
31710ad092f03988b5c210e53e4eafa4fa5e00f48d160392ab58c54533a12be7
Python
20,644
567
import matplotlib.pyplot as plt plt.switch_backend('agg') from rdkit.Chem import MolFromSmiles from rdkit.Chem import Draw import numpy as np import rdkit from rdkit import Chem from rdkit.Chem import AllChem import os from AttentiveFP.Featurizer_aromaticity_rm import * import pickle import time from rdkit.Chem import...
b7aa7acf753b2a5987c11118ad47a93c5bbfe28f39eca9e797516b687f7d739e
Python
20,648
439
import os import numpy as np import torch import matplotlib matplotlib.use('Agg') # 设置后端为Agg,不需要图形界面 import matplotlib.pyplot as plt from torchvision.utils import save_image from tqdm import tqdm import argparse from skimage.metrics import peak_signal_noise_ratio, structural_similarity import json from date...
d2fec1ea722c0173f5d40ef1a92e850ba94501d688ab3c73fc2f9ab7868c720b
Python
20,655
548
"""distutils.util Miscellaneous utility functions -- anything that doesn't fit into one of the other *util.py modules. """ import os import re import importlib.util import string import sys from distutils.errors import DistutilsPlatformError from distutils.dep_util import newer from distutils.spawn import spawn from ...
2c0b929bfb631d0969ff4a1e90d735e0d09b8f681e8b8451f63a308dbfeeeb9a
Python
20,669
675
""" test all other .agg behavior """ import datetime as dt from functools import partial import numpy as np import pytest from pandas.errors import SpecificationError import pandas as pd from pandas import ( DataFrame, Index, MultiIndex, PeriodIndex, Series, date_range, period_range, ) i...
7ad242049bac5e9fb2ccfa1d6670815b43498313cd86ff85453a27eae57beb51
Python
20,670
516
# Added Fortran compiler support to config. Currently useful only for # try_compile call. try_run works but is untested for most of Fortran # compilers (they must define linker_exe first). # Pearu Peterson import os import signal import subprocess import sys import textwrap import warnings from distutils.command.confi...
b80c1118062756d80d4999b81cc0b704c00292003b92ee26f30ba9897e8ba4af
Python
20,681
564
"""Network Authentication Helpers Contains interface (MultiDomainBasicAuth) and associated glue code for providing credentials in the context of network requests. """ from __future__ import annotations import logging import os import shutil import subprocess import sysconfig import typing import urllib.parse from ab...
51b93159588e4716807079fafee45fb04df2e5f31e32847cf8e982d6fd23acd4
Python
20,688
401
from datasets import load_dataset import numpy as np import pandas as pd import re from PIL import Image import napari from time import time from scribbles_creator import create_even_scribbles from napari_convpaint.conv_paint_utils import compute_image_stats, normalize_image from scribbles_testing.image_analysis_helpe...
b4e7252fa6ec61b74ab67dcbf0d743391b3c850974c8bedc743e99f8d910dedb
Python
20,722
500
import logging import os import numpy as np import torch from tqdm import tqdm from sklearn.decomposition import PCA from sklearn.mixture import GaussianMixture from diptest import diptest as dp import yass from yass import read_config from yass.reader import READER from yass.residual.residual_gpu import RESIDUAL_GPU...
d7e8955da1402cfc4cd62a3e399cca2b651b2d6b5d0f3789f6d5b18fcd40ef7e
Python
20,728
607
from __future__ import annotations import contextlib from typing import TYPE_CHECKING import numpy as np import pyqtgraph as pg from sqlalchemy.exc import OperationalError from sqlmodel import Session, col, select from cali.logger import cali_logger from cali.plot._util import add_colorbar_to_widget, disconnect_hove...
50ca1f1893b57d09afbe9fe416def3930c37ce8c9db3e4ef2eef4662934e1f27
Python
20,734
545
#!/usr/bin/env python3 import logging import math import multiprocessing import time from datetime import datetime import numpy as np import torch from nn import NeuralNetwork from tensorboardX import SummaryWriter from torch.nn.functional import softplus from training import ( ExponentialMovingAverage, Looka...
41428fb84c680f7495d9243d18e30a3e6ea204480b90376f7015a92ef12161d7
Python
20,744
513
import os import captum import matplotlib.pyplot as plt import numpy as np import pandas as pd import pytorch_lightning as pl import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.optim.lr_scheduler import StepLR from pnet import ReactomeNetworkOG, pnet_loader, util...
efe2f6199e3769634a1ba873fa3f1184bf0120418012fa588baad7e99b2f9bfe
Python
20,745
666
""" manage PyTables query interface via Expressions """ from __future__ import annotations import ast from decimal import ( Decimal, InvalidOperation, ) from functools import partial from typing import ( TYPE_CHECKING, Any, ClassVar, ) import numpy as np from pandas._libs.tslibs import ( Time...
7bf7fc0af5ee20077d711dd4c9b3412efb16a403a7c460f36daa562788e8f535
Python
20,749
525
"""Tests for fit_gcate_batch and gcate_lfc_batch.""" import gc import numpy as np import pandas as pd import pytest from causarray.utils import subsample_ctrl_cells, subsample_pert_cells from causarray.gcate import fit_gcate_batch from causarray.DR_learner import gcate_lfc_batch, LFC_batch # ------------------------...
078760b37116226f2a2aea10327e8535a1867ffa809bf1009b89765f77070cc3
Python
20,755
530
""" These test the method maybe_promote from core/dtypes/cast.py """ import datetime from decimal import Decimal import numpy as np import pytest from pandas._libs.tslibs import NaT from pandas.core.dtypes.cast import maybe_promote from pandas.core.dtypes.common import is_scalar from pandas.core.dtypes.dtypes impor...
798ed3235a159515eef5f008269884d2283b1fa6d10be2f660438936a223875e
Python
20,755
652
""" 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. "...
0d1ecd43b1b7d2ca7b3ca892c73df4c1889b8d8c70a522ae285a50a8a42ecee3
Python
20,779
548
# -*- coding: utf-8 -*- """ Functions for statistical analysis. Functions are built on top of MNE Python, numpy, pinguoin, and scipy. Written by Joshua Kosnoff jkosnoff@andrew.cmu.edu """ import scipy import numpy as np import pingouin as pg import pandas as pd import warnings from statsmodels.tsa.api i...
2deee13d1e7eecd7e49e5b2f33b4dcac40ca1ff8c13ed6dcc89de47bf55601bb
Python
20,813
494
"""Defines Model 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 os from copy import deepcopy import numpy ...
043af9ab163f5545122cad7ca4fbe5b480be192290e50772f1926abebc51d7bb
Python
20,814
650
"""Connectivity graph plotting for calcium imaging analysis.""" from __future__ import annotations from typing import TYPE_CHECKING, Any import numpy as np import pyqtgraph as pg from sqlmodel import Session, col, select from cali.plot._util import disconnect_hover_handlers if TYPE_CHECKING: from collections.a...
9ffa639fd994ed0409efb4855e8804739a1fa0ca9180d6e48a6c1716e9f3efd3
Python
20,815
594
from __future__ import annotations import functools from typing import ( TYPE_CHECKING, cast, overload, ) import numpy as np from pandas._libs import ( algos as libalgos, lib, ) from pandas.core.dtypes.cast import maybe_promote from pandas.core.dtypes.common import ( ensure_platform_int, ...