sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
218fe6825323a196d87ebbe5a1363671ed366a25633c892265faa03536517ee0 | Python | 24,903 | 599 | # -*- coding: utf-8 -*-
import datetime
import calendar
import operator
from math import copysign
from six import integer_types
from warnings import warn
from ._common import weekday
MO, TU, WE, TH, FR, SA, SU = weekdays = tuple(weekday(x) for x in range(7))
__all__ = ["relativedelta", "MO", "TU", "WE", "TH", "FR"... |
ef02eba74c0e509b8f9b007dffd04b58e9b80406224076a14b2d2e9ad83b6086 | Python | 24,913 | 719 | from __future__ import annotations
from functools import partial
import operator
import re
from typing import (
TYPE_CHECKING,
Callable,
Union,
)
import warnings
import numpy as np
from pandas._libs import (
lib,
missing as libmissing,
)
from pandas.compat import (
pa_version_under10p1,
p... |
5b6e67f79b033bf3f3d4d88a9692b20dac434c898b7655555bd94dc46cf9e4a1 | Python | 24,914 | 545 | import numpy as np
import pandas as pd
import scanpy as sc
from anndata import AnnData
from . import sinkhorn_knopp as skp
#from . import utils
from scipy.sparse import issparse
from sklearn.neighbors import NearestNeighbors
import scipy.stats as ss
# In this newer version we use the Python implementation of xicor
# i... |
8dada742b0c4a568cfa5805a05e0433e603fdfce15b662196aa3c8ccfe6a9b15 | Python | 24,920 | 555 | # 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,too-many-public-methods
from collections i... |
87059422d0cc93fa01e76a1422de034d5b96c431ecc18fa012ae32d1370a72c0 | Python | 24,959 | 618 | """utils.py - Helper functions for building the model and for loading model parameters.
These helper functions 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 ... |
7d2c570318cd68f5ede7813de7bbf5f90de808cd3abdb493e6016ed43f7c89ce | Python | 25,004 | 644 | """
Build call-back mechanism for f2py2e.
Copyright 1999 -- 2011 Pearu Peterson all rights reserved.
Copyright 2011 -- present NumPy Developers.
Permission to use, modify, and distribute this software is given under the
terms of the NumPy License.
NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
"""
from .... |
8157f0ad63a189b9f38bfb944fb08dd26d1d5725b51ba7ca71c7570e00b1c8c4 | Python | 25,027 | 610 | from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
from typing import TYPE_CHECKING, Literal
from qtpy.QtCore import Qt, Signal
from qtpy.QtWidgets import (
QCheckBox,
QComboBox,
QDoubleSpinBox,
QFileDialog,
QGroupBox,
QHBoxLayout,
QLabel,
QPu... |
bc6c940f08adeab2f3658c2d0531d76ed05b39be7b0a461d1459ae66c47fd43d | Python | 25,058 | 647 | """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.
Todo:
1. Simplify the case when `num_resolutions` == 1.
2. Remove indexing when the shape is the same.
3. Move some functions outside... |
bad6524a9007cfaf7668dbdf52932caa05323847c2e7707a1aff326eda690e71 | Python | 25,064 | 836 | """
:func:`~pandas.eval` parsers.
"""
from __future__ import annotations
import ast
from functools import (
partial,
reduce,
)
from keyword import iskeyword
import tokenize
from typing import (
Callable,
ClassVar,
TypeVar,
)
import numpy as np
from pandas.errors import UndefinedVariableError
imp... |
5d45a734bc436deb78f8ccf162c402dc793a5f259585ea3617eeb653f64948a3 | Python | 25,094 | 641 | # -*- coding: utf-8 -*-
#
# score_fun.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.... |
350e7c8e5417fa2e86eaebc38971ed94ae4eefb89c4f727c721a5e5904ae90a9 | Python | 25,130 | 495 | """
Kernel correctness tests - bit-exactness and energy-consistency for the
optimized Cython kernels across the full matrix of:
dimensionality (2D/3D) x forcefield (SR / SR+LR / SR+LR+SLR) x HARDWALL (T/F)
Kernels covered: fast serial crankshaft (mega_crank / mega_crank_2D), the
parallel checkerboard kernel (mega... |
fc8a0744d4ff392193c857c8bb9822bf906769415610d407dfa54a37cab7dad2 | Python | 25,201 | 720 | """ Test cases for misc plot functions """
import os
import numpy as np
import pytest
import pandas.util._test_decorators as td
from pandas import (
DataFrame,
Index,
Series,
Timestamp,
date_range,
interval_range,
period_range,
plotting,
read_csv,
)
import pandas._testing as tm
fr... |
7a62595c7f5420610fd2ec786ebf04267ca76caef747c97bc83a9ffba50b7404 | Python | 25,227 | 759 | """Interactive GUI to plot fNIRS probe and channel time courses.
Initial Contributors:
- Sung Ahn | ahnsm@bu.edu | 2024
"""
import sys
import time
import warnings
import numpy as np
from matplotlib.backends.backend_qtagg import FigureCanvas
from matplotlib.backends.backend_qtagg import NavigationToolbar2QT as N... |
327712548fe5f75e2a116d82520fe58af42b27a01c3b1bf399a88d39dce53a80 | Python | 25,241 | 717 | from datetime import (
date,
datetime,
time,
timedelta,
)
import numpy as np
import pytest
from pandas._libs import index as libindex
from pandas.compat.numpy import np_long
import pandas as pd
from pandas import (
DatetimeIndex,
Index,
Timestamp,
bdate_range,
date_range,
notn... |
42a5e3a3aa0d63cd3086f37271cbe3dfdb8347fc97ef06bf551947a62c8a7882 | Python | 25,246 | 716 | """Tests for inferred spike burst bar plot functions.
Covers:
- _query_burst_metrics_by_condition returns correct structure from stored FOVAnalysis
- FOVs with zero / None spike_burst_count are excluded
- Burst rate is computed from spike_population_activity length and frame_rate
- Empty database → empty dict (no cras... |
9eab1c4c2d02f8942001d0e8e2cd599ebd6f9d255f34bf1783e5f1a09082ec09 | Python | 25,248 | 660 | # type: ignore # mypy doesn't like pyhmmer
"""Contains methods to press an input .hmm file into more optimal formats for hmmsearch
and hmmalign
"""
# from python
from __future__ import annotations
import logging
import string
from math import ceil
from typing import Callable, Iterator, Optional, cast, TYPE_CHECKING
fr... |
7f7db0a6d95f3ddbc07514a0b7637951265076d36df86337d50a10a494a95de0 | Python | 25,256 | 702 | """
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
import pandas as pd
from pandas import (
DataFrame,
Index,
Period,
Series,
Timestamp,
date_range,
period_range,
)
import pandas._t... |
87ed8b9538eea26cc794e2a849430fd27a41dff5a2bf6f4e90854d194e18b0c3 | Python | 25,278 | 575 | # YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Plotting utils
"""
import contextlib
import math
import os
from copy import copy
from pathlib import Path
from urllib.error import URLError
import cv2
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sn
import to... |
8a0ddfdfde9a0249772e1d555fe3163ab0c29f9b7c6cea29ef18ce5a3b8217b5 | Python | 25,320 | 671 | import re
import numpy as np
import pytest
from pandas.errors import InvalidIndexError
from pandas import (
NA,
CategoricalIndex,
DatetimeIndex,
Index,
Interval,
IntervalIndex,
MultiIndex,
NaT,
Timedelta,
Timestamp,
array,
date_range,
interval_range,
isna,
... |
d04f655aed1c7292faa9f1c7f7cb4dd7319757f8efb61f564012f7122aa1b2e3 | Python | 25,342 | 660 | # Copyright 2024 RADar-AZDelta
# SPDX-License-Identifier: gpl3+
import logging
from abc import ABC, abstractmethod
from concurrent.futures import ThreadPoolExecutor, as_completed
from pathlib import Path
from time import time
from typing import Any, Tuple, cast
import polars as pl
from humanfriendly import format_tim... |
046b8c7a795c413f22ee3f62725adf742def4b082f86bf208e7f79e5c0b2d7ab | Python | 25,420 | 685 | from __future__ import annotations
import csv
import email.message
import functools
import json
import logging
import pathlib
import re
import zipfile
from collections.abc import Collection, Container, Iterable, Iterator
from typing import (
IO,
Any,
NamedTuple,
Protocol,
Union,
)
from pip._vendor... |
87b753660ff4e7e838c1910e6b1f28e0be51f3d4523dca448baa6960f9e2a050 | Python | 25,437 | 628 | """Diagnostics for treatment overlap, propensity scores, and result masks."""
import math
from typing import Hashable, Optional, Sequence, Union
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy import stats
from sklearn.metrics import brier_score_loss, roc_auc_score
from statsmodels.s... |
63069d4e710df77385031cb35b6f3d77fbf876158bcf1a4c1c666b977c6dfd76 | Python | 25,454 | 948 | """
The config module holds package-wide configurables and provides
a uniform API for working with them.
Overview
========
This module supports the following requirements:
- options are referenced using keys in dot.notation, e.g. "x.y.option - z".
- keys are case-insensitive.
- functions should accept partial/regex k... |
ef839bd7d4c021f9428409be8df1a68b92930bc7e74241efa6b1c1c4b61210b3 | Python | 25,466 | 772 | import numpy as np
import pytest
import pandas as pd
from pandas import (
CategoricalIndex,
DataFrame,
Index,
IntervalIndex,
MultiIndex,
Series,
)
import pandas._testing as tm
from pandas.api.types import (
is_float_dtype,
is_unsigned_integer_dtype,
)
@pytest.mark.parametrize("case", ... |
7cf651077d306bb7c5bdc63aea87603df03b7f6fe5a23fa75ad84a2c690e1dec | Python | 25,472 | 683 | from datetime import (
datetime,
timedelta,
)
from importlib import reload
import string
import sys
import numpy as np
import pytest
from pandas._libs.tslibs import iNaT
import pandas.util._test_decorators as td
from pandas import (
NA,
Categorical,
CategoricalDtype,
DatetimeTZDtype,
Inde... |
6da0560537b1fb213a9861e86e5490442b03b8aac38a427bcf56aac857ca3cde | Python | 25,486 | 738 | """
Block-buffer environments and local effective operators for Abelian MPS.
"""
from dataclasses import dataclass
from functools import lru_cache
from typing import Any, Iterator, Tuple
import jax
import jax.numpy as jnp
from .layout import MPOSpec, MPSSpec
from .symmetry import SectorIndex
from .block_ops import M... |
c2065e0acac00c405da36c2cc3fd9fc9453b907d5f66987a9efdee906181b1dc | Python | 25,506 | 587 | from .helper_functions import *
from sklearn.decomposition import PCA, TruncatedSVD
import matplotlib.pyplot as plt
class Scrublet():
def __init__(self, counts_matrix, total_counts=None, sim_doublet_ratio=2.0, n_neighbors=None, expected_doublet_rate=0.1, stdev_doublet_rate=0.02, random_state=0):
''' Initia... |
87f556e0d624edcc28034442198859a3a0546148db9a3eec315fd98b5ac041fe | Python | 25,560 | 586 | ## ...........................................................................
##
## PIMMS (Polymer Interactions in Multicomponent Mixtures)
## Alex Holehouse, Pappu Lab, Holehouse Lab
## Copyright 2015 - 2026
## ...........................................................................
"""
Phase-separation and drop... |
e7f8bda21e13847200dd0c71957a9880dbf36d53081aae26d4b018a5d4ec088b | Python | 25,627 | 581 | """
15-to-1 magic state distillation via the [[15,1,3]] Reed-Muller code.
Reference: Bravyi & Kitaev, quant-ph/0403025.
────────────────────────────────────────────────────────────────────
WHY MAGIC STATE DISTILLATION?
────────────────────────────────────────────────────────────────────
Clifford gates (H, CNOT, S, …)... |
6a04f0bf1c27b46749d044fc0a639f4260a5bfbb637b301ea1e4436d8ddcf87a | Python | 25,650 | 793 | """Cluster analysis visualization plots.
Provides three cluster visualization types:
1. Cluster-sorted correlation heatmap
2. Cluster-colored calcium peaks raster
3. Cluster-colored denoised ΔF/F traces
"""
from __future__ import annotations
import colorsys
import contextlib
from typing import TYPE_CHECKING
import ... |
69659011ac1a2b4747b429fab3451ab707d187aa46db91d590595ffca1908f3d | Python | 25,674 | 634 | import numpy as np
import pandas as pd # type: ignore
from sklearn.decomposition import PCA # type: ignore
from scipy.linalg import svd # type: ignore
import warnings
class SingleCellLatentSpaceEvaluator:
"""
Latent space quality evaluator tailored to single-cell data.
Especially suitable for:
... |
5fd52d128299ab0c60f04270380f01497b348fee8cb658305804b1899dba6cef | Python | 25,700 | 693 | from functools import partial
from typing import List, Type
from operations import *
from motifs import *
from utils import drop_path
from timm.models import register_model
from braincog.base.node.node import *
from braincog.base.connection.layer import *
from braincog.model_zoo.base_module import BaseModule
from moti... |
87ee638ec6d14489c2d56115e58f912966c3909b3520b3db8bde5eb4872fe2f8 | Python | 25,739 | 683 | """Independent Component Analysis by Entropy Bound Rate Minimization (ICA-ERBM).
This code is based on :cite:t:`Li2010B` and :cite:t:`Fu2014`. It was converted from
matlab versions provided by the MLSP Lab at the University of Maryland, which is
available here: https://mlsp.umbc.edu/resources.html.
"""
import scipy a... |
8c9646fc84d5b36c89891e4ec4582243487880036ea38618626f795ede9f945c | Python | 25,769 | 601 | import torch
from torch.optim import Adam
import torch.nn.functional as F
from gym.spaces import Box, Discrete, MultiDiscrete
from multiagent.multi_discrete import MultiDiscrete
from utils.networks import MLPNetwork, SNNNetwork, LSTMClassifier
from utils.misc import soft_update, average_gradients, onehot_from_logits, g... |
b4f244008e6411da4766117e29b47b783134621af909910d050fe96897ab92aa | Python | 25,770 | 614 | """Paper figures.
For each figure in the paper, except figure 1 (which is a diagram made in
Inkscape), a corresponding function can be found here. The function
corresponding to each figure is the one with the same argument "fignum". For
example, figure 2 in the paper corresponds to show_data(), which has a default
fig... |
6cef2d5189a7c80d8aea6e139db41b7d4aa6205703bfb986d4ab82f60a915660 | Python | 25,778 | 777 | # SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2021 Taneli Hukkinen
# Licensed to PSF under a Contributor Agreement.
from __future__ import annotations
import sys
from types import MappingProxyType
from ._re import (
RE_DATETIME,
RE_LOCALTIME,
RE_NUMBER,
match_to_datetime,
match_to_loca... |
72cd5b076f3972bf4b43568498e294eea39b2a095fd24dc8ecfb1502ff08d7cc | Python | 25,809 | 734 | import logging, sys
import numpy as np
from tqdm import tqdm
from scipy.linalg import eigh
from rdkit import Chem
from rdkit.Chem import MolFromSmiles, MolToSmiles, AddHs
from . import features
from .features import Tokenizer
import time
class SmilesPreprocessor(object):
""" Given a list of SMILES strings, enc... |
a091e240c62892b82f2f76b566c76b70a017873da6cc2efe8833a06063d35bce | Python | 25,809 | 473 | # -*- coding: utf-8 -*-
"""
##############################################################################################
This module is used for computing the quasi sequence order descriptors based on the
given protein sequence. We can obtain two types of descriptors: Sequence-order-coupling
number and quas... |
099bb7910a2657e8c6ffa1aa6da8befb067783da7e1a55ddb02cd9059aa1ccdc | Python | 25,823 | 667 | #!/usr/bin/env python3.7
"""Defines Slide 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
import ... |
fe611f1cf8f6e3d21572aba096705af42934b9d39ccdb6ff7a984e8d28030bbc | Python | 25,854 | 720 | #!/usr/bin/env python3
# ruff: noqa: LOG015
from __future__ import annotations
import json
import logging
import os
import re
import subprocess
import sys
import warnings
from enum import Enum
from functools import cache
from logging import info, warning
from typing import Any, TYPE_CHECKING
from urllib.request import... |
8d58c22776154e4fc1698b7d203085462f2d45404ad2cdf0e794fc21ec9b789d | Python | 25,914 | 567 |
import argparse
import time
import timm.models
import yaml
import os
import logging
from collections import OrderedDict
from contextlib import suppress
from datetime import datetime
from braincog.base.node.node import *
from braincog.utils import *
from braincog.base.utils.criterions import *
from braincog.datasets... |
6c2ac1e01b6a83e5cc533df3d384459b121dd0bde9caa36f442f286924415608 | Python | 25,961 | 841 | """
##############################################################################
make_figures.py
by Yasuhiro Tsubo (tsubo@fc.ritsumei.ac.jp)
modified ver. 2023.11.6
##############################################################################
"""
## ==================================================================... |
6c42dc79c7742d40a6d78e2165b40987232df6b8515f837eeef5c44d7454dca4 | Python | 26,003 | 525 | from transformers import AutoModel, AutoTokenizer, LongformerModel, LongformerTokenizer, AdamW, get_cosine_schedule_with_warmup, get_polynomial_decay_schedule_with_warmup, get_linear_schedule_with_warmup
from sklearn.metrics import classification_report
from torch.optim.lr_scheduler import ReduceLROnPlateau, StepLR
#f... |
719dd4f58811ed3d3d0a5b2ca35ff21b315b46f4ebf064e720b6f26743148132 | Python | 26,021 | 729 | """Migration helper: Import existing JSON analysis data into SQLModel database.
This module provides functions to migrate calcium imaging analysis data
from JSON format to the new SQLModel database format.
"""
from __future__ import annotations
import json
from pathlib import Path
from typing import TYPE_CHECKING
f... |
fe6d9917daa3033748629884b775a8198761d716854997e541d50022a807a320 | Python | 26,032 | 705 | # Copyright (C) 2008-2013 Bernd Feige
# This file is part of avg_q and released under the GPL v3 (see avg_q/COPYING).
"""
Module to detect and subtract fMRI gradient artifacts
"""
import avg_q
from . import avg_q_file
from . import trgfile
from . import BrainVision
from . import Channeltypes
import os
import glob
fro... |
80796815e39aff7392e7919032ed93320c7c60212022f9716aeeacbf5054f60f | Python | 26,058 | 454 | import pandas as pd
import os
import json
import copy
from chrombpnet.data import DefaultDataFile, get_default_data_path
from chrombpnet.data import print_meme_motif_file
import numpy as np
def chrombpnet_train_pipeline(args):
if args.file_prefix:
fpx = args.file_prefix+"_"
else:
fpx = ""
# Shift bam and co... |
e2b5c5a6177a0bd6dfe40548a8ea214f0b09ee6035e12666ab785c5ad0bb9bec | Python | 26,091 | 748 | from collections.abc import Generator
from contextlib import contextmanager
import re
import struct
import tracemalloc
import numpy as np
import pytest
from pandas._libs import hashtable as ht
import pandas as pd
import pandas._testing as tm
from pandas.core.algorithms import isin
@contextmanager
def activated_tra... |
ffbc9f5e660f5ddc5a9bd46961f62e58495f9cfa4443e78ebff4f5958c9e1c63 | Python | 26,109 | 790 | import streamlit as st
import requests
import logging
import os
from dotenv import load_dotenv
# You can move this to a config file or st.secrets if you like
API_BASE_URL = os.getenv("API_BASE_URL", "http://localhost:8000")
def _api_get(endpoint: str, timeout: int = 600, **params):
url = f"{API_BASE_URL}/{endpoin... |
532dd6e9e270bb697b47aa2fa9d7de3b24326c5e638e53c447cf2948cdff24f8 | Python | 26,112 | 747 | """Machine limits for Float32 and Float64 and (long double) if available...
"""
__all__ = ['finfo', 'iinfo']
import types
import warnings
from .._utils import set_module
from ._machar import MachAr
from . import numeric
from . import numerictypes as ntypes
from .numeric import array, inf, nan
from .umath import log1... |
e157a5be0adeef89867db9262566e7516b773016942dc9e65127c72ea938afd0 | Python | 26,122 | 734 | import logging, sys
import numpy as np
from tqdm import tqdm
from scipy.linalg import eigh
from rdkit import Chem
from rdkit.Chem import MolFromSmiles, MolToSmiles, AddHs
from nfp.preprocessing import features
from nfp.preprocessing.features import Tokenizer
import time
class SmilesPreprocessor(object):
""" Gi... |
e6b57d3c7e847a272cf71929cf1fa7b1304be784b54be05fd2bd65882b583d52 | Python | 26,134 | 755 | """setuptools.command.egg_info
Create a distribution's .egg-info directory and contents"""
from distutils.filelist import FileList as _FileList
from distutils.errors import DistutilsInternalError
from distutils.util import convert_path
from distutils import log
import distutils.errors
import distutils.filelist
import... |
81732beefec61505856079da3e72275cc8a0d9a79480460e12fbee42230dbff0 | Python | 26,157 | 666 | from functools import partial
import time
import logging
import os.path
from copy import copy
import os
try:
from pathlib2 import Path
except ImportError:
from pathlib import Path
from multiprocess import Pool, Manager
import yaml
from tqdm import tqdm
from yass.util import function_path, human_readable_time... |
1ef6d0b3437bedbfeb921421410bfdba27ff3f49bcdff18da46f888a64288d8b | Python | 26,168 | 711 | from __future__ import annotations
import argparse
import importlib
import json
import os
import re
import subprocess
import sys
from pathlib import Path
from tempfile import NamedTemporaryFile
from check_wheel_tags import check_mac_wheel_minos, check_wheel_platform_tag
import torch
import torch._dynamo
import torch... |
3799e2508ebdcebf63a8ed5d49e7a4fa787160ba6ac8d5d23b49540db0b9b8d2 | Python | 26,272 | 776 | import logging
from typing import Dict, Optional, Tuple, Union
import pytorch_lightning as pl
import torch
from torch import nn
from torch.optim import Optimizer
from torch.optim.lr_scheduler import LRScheduler
from torch_geometric.nn import MessagePassing, radius_graph
from torch_scatter import scatter, segment_coo
... |
130d9ffb88d21d10c4c706a3d85925dee399f3e6e96ce04d963f92acf38ca0ee | Python | 26,306 | 450 | #!/usr/bin/env python3
from __future__ import print_function
from __future__ import unicode_literals
import json, itertools, os, sys
import numpy as np
import pkg_resources
from zipfile import ZipFile as zf
import urllib.request
import scipy.sparse as sparse
'''
Turning the convenience script into a library, for ac... |
41bb11b28c70061d04405a05f16af93e053deacecbb782d6d1fec116d130c909 | Python | 26,339 | 824 | """
Constructor functions intended to be shared by pd.array, Series.__init__,
and Index.__new__.
These should not depend on core.internals.
"""
from __future__ import annotations
from collections.abc import Sequence
from typing import (
TYPE_CHECKING,
Optional,
Union,
cast,
overload,
)
import warn... |
88c30c0c16e1ae7a85af2c9c9d36524bcb770c4f44e088eccb3e181c42c1a2b8 | Python | 26,376 | 653 | """
Stability evaluation
Original source:
https://github.com/hooshmandshr/yass_visualization/blob/master/src/stability/stability_evaluation.py
"""
import numpy as np
from scipy.optimize import linear_sum_assignment
from scipy.spatial.distance import pdist, squareform, cdist
from tqdm import tqdm
from yass.geometry ... |
f170923b3d49f72f4af43c5eddce7960ecbe38d465bd17370961741156b111af | Python | 26,390 | 801 | from __future__ import annotations
import numpy as np
import pytest
import pandas.util._test_decorators as td
from pandas.core.dtypes.astype import astype_array
import pandas.core.dtypes.common as com
from pandas.core.dtypes.dtypes import (
CategoricalDtype,
CategoricalDtypeType,
DatetimeTZDtype,
Ext... |
d8c2c538af46a5836189377accb0d4ac081290807eefa8baa664ae5098c70b6c | Python | 26,429 | 696 | """
requests.adapters
~~~~~~~~~~~~~~~~~
This module contains the transport adapters that Requests uses to define
and maintain connections.
"""
import os.path
import socket # noqa: F401
import typing
import warnings
from pip._vendor.urllib3.exceptions import ClosedPoolError, ConnectTimeoutError
from pip._vendor.urll... |
d5605a134bbff430eead4b4098b2fdbf2f6b752e212b94ae756f6f8660fcb5a0 | Python | 26,460 | 924 | """
This module is imported from the pandas package __init__.py file
in order to ensure that the core.config options registered here will
be available as soon as the user loads the package. if register_option
is invoked inside specific modules, they will not be registered until that
module is imported, which may or may... |
77bbfcb50eed7ff17ff02e2cd1fbe2e0d57edb1f6b7f629cc3b599578c5a8d12 | Python | 26,529 | 739 | """
Quantum circuit: state simulator for **qudits** (d-level systems).
This module provides a high-level `QuditCircuit` API that mirrors `tensorcircuit.circuit.Circuit`
but targets qudits with dimension `3 <= d <= 36`.
For string-encoded samples/counts, digits use `0-9A-Z` where `A=10, ..., Z=35`.
.. note::
For qu... |
f6d4d6a62bfd44f91e6feaa0520c14da630ae6f84fa85e4739e53617586c86ba | Python | 26,551 | 702 | from __future__ import annotations
import hashlib
from typing import TYPE_CHECKING
import cmap
import numpy as np
import tifffile
from qtpy.QtCore import Qt, Signal
from qtpy.QtWidgets import (
QFileDialog,
QGroupBox,
QHBoxLayout,
QLabel,
QLineEdit,
QPushButton,
QSizePolicy,
QVBoxLayou... |
19512ad408e4e98253c722327617ea8617437991c9e3abd4055b4ce2148912f9 | Python | 26,563 | 770 | """Dimensionality reduction utilities for multi-well per-condition analysis.
This module builds a per-FOV feature matrix from scalar calcium imaging metrics
and applies PCA for visualisation.
The feature matrix has one row per FOV and includes:
- Per-ROI scalars averaged to FOV level (amplitude, frequency, IEI, spik... |
ca6c38c1e0622e4e33e0215339a29d61b89875b4e90a919a1dd87b7da8e407a9 | Python | 26,565 | 687 | import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pytest
from sklearn.metrics import brier_score_loss
from scipy import stats
from statsmodels.stats.multitest import multipletests
from unittest.mock import patch
from causarray import (
LFC,
... |
15f2db4fd3e6b6edf6a73c10c199f293240ffe432de9a882e466d69b686d3d96 | Python | 26,594 | 648 | import numpy as np
from multiprocessing.managers import BaseManager
import time
import logging
import datetime
import os
class ControlPort:
"""Class to control the inkube device with environment parameters and fluidics"""
# delay table after which the pump commands are executed
delay_table = {
0: "... |
8766bbccbfd980deb3a1135c015dd0ae07ea239f4f4798ec88f3c60be57c17f5 | Python | 26,598 | 734 | """
See also: test_reindex.py:TestReindexSetIndex
"""
from datetime import (
datetime,
timedelta,
)
import numpy as np
import pytest
from pandas import (
Categorical,
CategoricalIndex,
DataFrame,
DatetimeIndex,
Index,
MultiIndex,
Series,
date_range,
period_range,
to_da... |
a40855621e895a7ded31acae67fa3a41e35bc2aceed3ddcd75958269b342f517 | Python | 26,622 | 669 | from typing import Dict, Union
import torch
from torch.nn.modules.loss import _Loss
from torch_geometric.data import Data
from torch_cluster import radius_graph
import torch.nn as nn
from e3nn import o3
from e3nn.math import soft_one_hot_linspace
from e3nn.nn import Gate, Dropout, BatchNorm, FullyConnectedNet
# from ... |
715385f3fab34e9eb7aa4e3ff98a910b6acad3b6612796a0cdc0f8f36cdf61ed | Python | 26,625 | 751 | """Functions to create the design matrix for the GLM."""
from __future__ import annotations
from collections import defaultdict
from dataclasses import dataclass, field
import numpy as np
import pandas as pd
import xarray as xr
from numpy.typing import ArrayLike
from numpy.polynomial.legendre import legval
import c... |
15403583890f2a9347af5ac5680d4b99b531af033cc5203cbb06977bc8bc22c2 | Python | 26,637 | 602 | #!/usr/bin/env python3.7
"""Defines the runner module.
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 base64
imp... |
7d9a3f1ca68917f8a1b86cd5e95c26040844a4883f6962d3c232666a021a77bc | Python | 26,664 | 796 | """Contains functions to mimic legacy output as seen in BiG-SCAPE 1.0"""
# from python
from itertools import repeat
import json
import logging
from multiprocessing import Pool
from distutils import dir_util
from pathlib import Path
import click
from sqlalchemy import select, alias
from typing import Optional
from iter... |
7e7b1980edadba7bc926a271c3d9f5566aff309113ba7b895960835965b2c7bc | Python | 26,685 | 767 | import collections
from math import sqrt, ceil, floor
from functools import partial
import logging
import numpy as np
from sklearn.decomposition import PCA
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
from yass import geometry as geom
try:
import matplotlib.pyplot as plt
from ma... |
c50bc65c2a31a3eff503e7e89c08036c1ec6c857a0db6440c5b8f14de2f69673 | Python | 26,723 | 720 | import inspect
import operator
import numpy as np
import pytest
from pandas._typing import Dtype
from pandas.core.dtypes.common import is_bool_dtype
from pandas.core.dtypes.dtypes import NumpyEADtype
from pandas.core.dtypes.missing import na_value_for_dtype
import pandas as pd
import pandas._testing as tm
from pand... |
2cfe759389547d08297eeeed8de22fbf168582ffb1ffa55aa430f1f48fb2d342 | Python | 26,775 | 860 | from datetime import (
date,
datetime,
)
import itertools
import numpy as np
import pytest
from pandas.core.dtypes.cast import construct_1d_object_array_from_listlike
import pandas as pd
from pandas import (
Index,
MultiIndex,
Series,
Timestamp,
date_range,
)
import pandas._testing as tm
... |
7ba33c20c4c3f36ced34de36f01d0a32de863bca8495ab02a80de1d7197f08e4 | Python | 26,795 | 655 | """Temporally embedded CCA-like models for multimodal data.
This module implements classes for performing source decomposition on multimodal data
using temporal embedding techniques. The latter is based on
:cite:t:`biesmann_temporal_2010`
Includes:
- ElasticNetTCCA: Class for performing Elastic Net regularized tempor... |
aca14c08e558e20f6ec98442e56eb1547ea083c9573079312e54086bed2d4a62 | Python | 26,850 | 628 | import random
import numpy as np
import pandas as pd
import torch
from torch.utils.data import DataLoader, Dataset
# DataLoader object for pytorch. Constructing single loader for all data input modalities.
class PnetDataset(Dataset):
def __init__(self, genetic_data, target, indicies, additional_data=None, gene_s... |
ffd3a30a70cf9035b613b1f0b0012e13fae331a07ecdce48717163ab4fb06578 | Python | 26,859 | 518 | # -*- coding: utf-8 -*-
"""
Paradigm descriptors' estimation for ARCHI protocols
@author: Ana Luisa Pinho, ana.pinho@inria.fr
contributor: Andres Hoyos Idrobo
Last update: August 2018
Note: Run the script with the input csv files per subject and session under the
same directory
Compatibility: Python 2.7
"""
... |
e96f34681b1e3519cb6df5611041c1170d87809615004a5181e2770fc5ca0fb3 | Python | 26,928 | 488 | r"""
This module is a collection of functions needed to run m6anet dataprep
"""
import os
import multiprocessing
from io import StringIO
from itertools import groupby
from collections import defaultdict
from operator import itemgetter
from math import floor, log10
import numpy as np
import pandas as pd
import ujson
fro... |
f6581cadf313f1bf455614fb4e26cb6d81ffb7c2ef9a1eb7deb43b76941d481a | Python | 26,932 | 717 | # 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.
""" The core setup functions wrapping all detection, analysis, and output
modules together.
The intended entry point of antismash is run_antismash() in this file.... |
3da06f02eb48560a84da4d924a951cf9ca310b2b05617f695921620d883aedda | Python | 26,952 | 800 | import os, torch
import random
import numpy as np
from torch import nn
from torch import functional as F
import tifffile
from tqdm import tqdm
class BCEFocalLoss(torch.nn.Module):
def __init__(self, gamma=2, alpha=0.25, reduction='elementwise_mean'):
super().__init__()
self.gamma = gamma
s... |
896f266668ea17361a8240b8bd2e3336965c4c9364c7d94e607fa3d07e612c98 | Python | 26,984 | 731 | # -*- coding: utf-8 -*-
##########################################################################
# NSAp - Copyright (C) CEA, 2019
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
#... |
5bd09ccbc3f2f253480ad95f729fabcb3313b90686c405376afefe8397c7bb4b | Python | 26,990 | 792 | import sys
from functools import lru_cache
from operator import attrgetter
from pickle import dumps, loads
from random import randint
from typing import Any, Dict, Iterable, List, Optional, Type, Union, cast
from . import errors
from .color import Color, ColorParseError, ColorSystem, blend_rgb
from .repr import Result... |
2f0f8a84da42a0dcd539c62a4d76f419fb0d5bcf9be985c1be79a430e328f4e9 | Python | 26,996 | 794 | """
Tests for ``_pure_tree_flatten``, ``_pure_tree_unflatten``, and ``_pure_tree_map``
in ``tensorcircuit.backends.abstract_backend``.
All tests compare our pure-Python pytree utilities against JAX ``tree_util``
semantics, covering:
- dict key ordering (sorted vs insertion order)
- ``None`` as empty pytree (0 leav... |
e34834353357ae7383abcd5d9f0525adbbea18b343dfc324cee0b3d0075c53ea | Python | 27,018 | 608 | # YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
TensorFlow, Keras and TFLite versions of YOLOv5
Authored by https://github.com/zldrobit in PR https://github.com/ultralytics/yolov5/pull/1127
Usage:
$ python models/tf.py --weights yolov5s.pt
Export:
$ python export.py --weights yolov5s.pt --include saved_model ... |
5595f834d83ead5abdf10dcb1d7a2f4733d29a8cb6ba3b5127108335e0a45705 | Python | 27,019 | 741 | import argparse
import logging
import os
import warnings
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from scipy.stats import norm
from sklearn.model_selection import train_test_split
import wandb
from pnet import Pnet, pnet_loader, report_and_eval, util
from pnet.utils... |
3d2a41874ebb48d1b55d424d1ea08ba718a8ad389e7ae5538f987cb4e4df5de1 | Python | 27,020 | 1,000 | """
Auxiliary functions for f2py2e.
Copyright 1999 -- 2011 Pearu Peterson all rights reserved.
Copyright 2011 -- present NumPy Developers.
Permission to use, modify, and distribute this software is given under the
terms of the NumPy (BSD style) LICENSE.
NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
"""
... |
4b444fac89507c329bc4aed3ec8158787f6d149d9c481b7da3123cae54a27db9 | Python | 27,022 | 698 | #!/usr/bin/env python3
import os
import sys
import gzip
import time
import logging
import argparse
import resource
import subprocess
import networkx
import parallel_tools
import shims
from bfx import swalign
from bfx import samreader
from bfx import getreads
# There can be problems with the submodules, but none are ess... |
df8ba7ce4574fbfd3a595753292cda03b61a09ac033881423dd706558a027903 | Python | 27,039 | 753 | # -*- coding: utf-8 -*-
'''
#####################################################################################
This module is used for computing the composition, transition and distribution
descriptors based on the different properties of AADs. The AADs with the same
properties is marked as the same num... |
fd9d345d0df9936c1625ecb8d2ef45c9632ee9cfe9f381a32bd021f25b816378 | Python | 27,050 | 630 | import copy
import math
from typing import List
import torch
import torch.nn as nn
import torch_geometric
from .activation import (
GateActivation,
S2Activation,
SeparableS2Activation,
SmoothLeakyReLU,
)
from .drop import EquivariantDropoutArraySphericalHarmonics, GraphDropPath
from .layer_norm import... |
0c2843abca25fbd0c54c11e17ecda6698edb59291b0cea2dc94fdf66f006acf8 | Python | 27,066 | 581 | # 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
from collections import OrderedDict
import... |
ec9732080abdd4ea6bb8fcb56b099d4266e5c4fcd017852b9d43765c7ada85b6 | Python | 27,104 | 796 | from datetime import (
datetime,
timedelta,
)
import numpy as np
import pytest
from pandas.errors import UnsortedIndexError
import pandas as pd
from pandas import (
DataFrame,
Index,
MultiIndex,
Series,
Timestamp,
)
import pandas._testing as tm
from pandas.tests.indexing.common import _mk... |
e1fb78382b7baf7a990c577908faecc984aaed956bc5cad1c29c50b3dd4c9be0 | Python | 27,107 | 550 | import numpy as np
import pytest
from pandas._config import using_pyarrow_string_dtype
from pandas import (
Categorical,
CategoricalDtype,
CategoricalIndex,
Index,
Series,
date_range,
option_context,
period_range,
timedelta_range,
)
class TestCategoricalReprWithFactor:
def te... |
ef112a7081fa898f004f40299c209fac9bebd7b6e826b825f65a2a81b46e86ca | Python | 27,114 | 774 | """:mod:`numpy.ma..mrecords`
Defines the equivalent of :class:`numpy.recarrays` for masked arrays,
where fields can be accessed as attributes.
Note that :class:`numpy.ma.MaskedArray` already supports structured datatypes
and the masking of individual fields.
.. moduleauthor:: Pierre Gerard-Marchant
"""
# We should ... |
7949c1aab8c58b5fb5c502cf5ac9bc247a72640c02f6007587543a829f555e80 | Python | 27,135 | 871 | # Copyright (c) 2001-2013 WorldViz LLC.
# All rights reserved.
# Changed function removeSensor() so it will correctly report no active sensor after one has been removed
import viz
import math
import vizact
import vizmat
import viztask
import vizshape
# Default color for debug shapes
DEFAULT_DEBUG_COLOR = [1,0,1]
# ... |
0e8b4925f77e6d2ec54906e72c2e9229609fcff1aa1984ba1b2e8573d009660d | Python | 27,164 | 850 | """
Expose public exceptions & warnings
"""
from __future__ import annotations
import ctypes
from pandas._config.config import OptionError
from pandas._libs.tslibs import (
OutOfBoundsDatetime,
OutOfBoundsTimedelta,
)
from pandas.util.version import InvalidVersion
class IntCastingNaNError(ValueError):
... |
2e444af8eeb955d857dc40d02470dd7865501df03a0501d3fcf0a2f7b338c48b | Python | 27,175 | 691 | import numpy as np
import pytest
from pandas._libs.tslibs.period import IncompatibleFrequency
from pandas.core.dtypes.dtypes import PeriodDtype
from pandas import (
Index,
NaT,
Period,
PeriodIndex,
Series,
date_range,
offsets,
period_range,
)
import pandas._testing as tm
from pandas.c... |
76419a58291952350cef73343754dbb2ef5180a224a52a9bfc001318f2a1d918 | Python | 27,176 | 665 | from torch.utils.data import Dataset
import os
import numpy as np
import threading
import zipfile
from torchvision.datasets import utils
import torch
class FunctionThread(threading.Thread):
def __init__(self, f, *args, **kwargs):
super().__init__()
self.f = f
self.args = args
... |
952c3707f09c79facb0a06c195fd74ed7ab756567f446ea2c2e179641920eb01 | Python | 27,196 | 823 | """
HS300 volatility-direction classification with TensorCircuit QNN.
This example predicts whether the next-horizon realized variance of HS300
will be larger than the immediately previous-horizon realized variance:
label = 1[next_horizon_var > prior_horizon_var].
It compares a validation-tuned classical baselin... |
4d1d63e0e06a9f22c6dc1db2a9ca719994a5ed65b6ed4aabc3747af777422949 | Python | 27,200 | 769 | """
Common utilities to all scripts
Author: Bertrand Thirion, Ana Luisa Pinho 2016-2020
Compatibility: Python 3.5
"""
import os
import glob
import warnings
from collections import defaultdict
import pandas as pd
import shutil
import numpy as np
# from ibc_public.utils_annotations import expand_table
from tqdm impor... |
08c39ff8599d300a8e02c965b3fc049b0cae6c7dca9848955cddd20ee5a117c6 | Python | 27,201 | 950 | from argparse import Namespace
from unittest import main, TestCase
from unittest.mock import Mock, patch
import runner_determinator as rd
USER_BRANCH = "somebranch"
EXCEPTION_BRANCH = "main"
class TestRunnerDeterminatorIssueParser(TestCase):
def test_parse_settings(self) -> None:
settings_text = """
... |
4a0d5d174a43102508f38ed24e28581f607250527f947e6e97aa62c3bd307eba | Python | 27,202 | 678 | """
This module contains dataset-independent utilities
to run fMRI data analyses.
Author: Bertrand Thirion, 2015
"""
import os
import time
import numpy as np
import nibabel as nib
import warnings
from pandas import read_csv
from nilearn.masking import compute_multi_epi_mask
from nilearn.image import high_variance_conf... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.