sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
76003ad4ea3b850d8e4a8ee2b988cc6282ab549efdf055609494a75cedd8da87
Python
29,886
912
from __future__ import annotations from typing import TYPE_CHECKING import numpy as np import pytest import tifffile from cali.analysis._fov_metrics import ( create_stimulation_mask, get_overlap_roi_with_stimulated_area, ) if TYPE_CHECKING: from pathlib import Path def test_create_stimulation_mask_bin...
c0bdcc16caeef272f1698d8a2e60857d9bdda6fb486072627b8e057fa57b7921
Python
29,886
843
import calendar from datetime import ( date, datetime, time, ) import locale import unicodedata import numpy as np import pytest import pytz from pandas._libs.tslibs.timezones import maybe_get_tz from pandas.errors import SettingWithCopyError from pandas.core.dtypes.common import ( is_integer_dtype, ...
9a7c4f5f5c942d40b99761aae61b31297eea7e1f25359d4dfdcdc586cc1fdd2e
Python
29,887
781
"""Interactive GUI to view the HRF in probe space after data has been processed. Based on Homer3 v1.80.2 "PlotProbe2.m" (:cite:t:`Huppert2009`) Boston University Neurophotonics Center https://github.com/BUNPC/Homer3 Initial Contributors: - Sung Ahn | ahnsm@bu.edu | 2024 """ from __future__ import annotat...
620d64872900a44ebb21052afae1247fd2b7b3ac1d5208e0cea9600eed2499e7
Python
29,952
819
# flake8: noqa: G004 """ This runner determinator is used to determine which set of runners to run a GitHub job on. It uses the first comment of a GitHub issue (by default https://github.com/pytorch/test-infra/issues/5132) to define the configuration of which runners should be used to run which job. The configuration...
9fc68be92df174ec3b25e3068d30951e46abcc9027a712ad0c9d70d0570b8fd0
Python
29,982
676
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...
a2beb884fcd94765eae1b9ebc7b349e6ee033421c47f668a2934904b5add0d42
Python
30,035
642
import torch from torch import nn import torch.nn.functional as F from torch_scatter import scatter from torch_geometric.utils import degree from e3nn.o3 import Irrep, Irreps, wigner_3j, matrix_to_angles, Linear, FullyConnectedTensorProduct, TensorProduct, SphericalHarmonics from e3nn.nn import Extract from .utils imp...
ca218e7a9a5062f7cbbc6fc0953b34b44568fb060fa0ec00854a654755dd5199
Python
30,080
907
"""Utility functions for multi-well bar plots. Common functions used across multiple plot types. """ from __future__ import annotations import colorsys from typing import TYPE_CHECKING, Callable, TypedDict import numpy as np import pyqtgraph as pg from pyqtgraph import BarGraphItem from sqlmodel import Session, col...
15d77b5e2d5343f7ac657ab7d86bbe64f8928481c4d9544e49246dcdeb79d3db
Python
30,103
952
from __future__ import annotations _shared_docs: dict[str, str] = {} _shared_docs[ "aggregate" ] = """ Aggregate using one or more operations over the specified axis. Parameters ---------- func : function, str, list or dict Function to use for aggregating the data. If a function, must either work when pa...
0ccf984e2ea691be9dba9ef6b2b740e064c8c7a9f30e206842a2067f06b50508
Python
30,107
1,044
""" Tests the 'read_fwf' function in parsers.py. This test suite is independent of the others because the engine is set to 'python-fwf' internally. """ from datetime import datetime from io import ( BytesIO, StringIO, ) from pathlib import Path import numpy as np import pytest from pandas.errors import Empty...
589a3285c609260695a5817b1e7a6e03bbcdd20734d205a7ebd8ab72dafbbcab
Python
30,155
663
import numpy as np import random import time import math import os from copy import deepcopy from scipy.spatial.distance import cdist from torchvision.utils import save_image import torch # import pdb from torch.nn import DataParallel from torch.nn import functional as F from torch import nn from inclearn.convnet i...
62e49700f52b5de91f401afc4c46f31ba6e0e404044c2eed6d8d44159559b846
Python
30,188
808
import streamlit as st import logging from kani import ChatRole, ChatMessage import asyncio from upstash_redis import Redis import base64 import dill import hashlib import urllib.parse from kani_utils.utils import _seconds_to_days_hours, _sync_generator_from_kani_streammanager import json import datetime class UIOnlyM...
c163df883a5e8cb3815526c4d3cac69836a562e7158eb9559b8a6ef13b142441
Python
30,228
750
import scipy.io as scio import math import random as rand import copy import os import pandas as pd import matplotlib.pyplot as plt import numpy as np from braincog.base.learningrule.STP import short_time class six_layer_pfc(): """ Define global parameters :param SizeHistOutput: Set the peak value of the...
21dc1e9e6231302a7871fa2bd3f72881514f898efb0ed751aa2d3b25d36a1817
Python
30,238
609
# Copyright 2024 RADar-AZDelta # SPDX-License-Identifier: gpl3+ import logging from abc import ABC, abstractmethod from pathlib import Path from typing import Any import dash_bootstrap_components as dbc import polars as pl from dash import Dash, Input, Output, dash_table, dcc, html from .etl_base import EtlBase cl...
ee5d5b26b9b1ec6410b9c2e6c32193690caa68cbf4e6418443628e977401474e
Python
30,246
847
# -*- coding: utf-8 -*- from __future__ import division from string import ascii_letters import torch import math import cv2 import numpy as np import random import numbers import collections Sequence = collections.abc.Sequence Iterable = collections.abc.Iterable INTER_MODE = {'NEAREST': cv2.INTER_NEAREST, 'BILINEAR'...
579cd67bed982b0254f7183fa83a19ac64898b02fad891c0e2a72c8658bd296b
Python
30,277
891
""" Backend magic inherited from tensornetwork: pytorch backend """ # pylint: disable=invalid-name import logging from typing import Any, Callable, Optional, Sequence, Tuple, Union from operator import mul from functools import reduce, partial from scipy.sparse import coo_matrix import tensornetwork from tensornetwo...
abac0ce18e1a60c18637f2e2b6c8f73d82a9052dd9beeb74c610e6a4110715da
Python
30,387
792
from __future__ import annotations import importlib.util import os import pathlib import sys import typing as t from collections import defaultdict from functools import update_wrapper from jinja2 import BaseLoader from jinja2 import FileSystemLoader from werkzeug.exceptions import default_exceptions from werkzeug.ex...
a5dc60d75cf872c03258352d2c04ca3536770835b38def56c577ee2334bb8af9
Python
30,421
600
# ------------------------------------------------------------------------------ # functions.py # Author: Dr. Timo Hofsähs # # Description: # This Python script is part of the code accompanying the scientific publication: # The Virtual Brain links transcranial magnetic stimulation evoked potentials and # neurotransmi...
a149524fb630a1eb8013a2335a8924664f0871c4a3dfd1d3d32a5004e3e3d9f3
Python
30,472
803
from __future__ import annotations import errno import json import operator import os import shutil import site from optparse import SUPPRESS_HELP, Values from pathlib import Path from pip._vendor.packaging.utils import canonicalize_name from pip._vendor.requests.exceptions import InvalidProxyURL from pip._vendor.ric...
0a5d5da449ce7f0af3ccf6e4bbe7a67a935e37846dff4ff9f08cb6c7e2464e6f
Python
30,503
831
""" requests.sessions ~~~~~~~~~~~~~~~~~ This module provides a Session object to manage and persist settings across requests (cookies, auth, proxies). """ import os import sys import time from collections import OrderedDict from datetime import timedelta from ._internal_utils import to_native_string from .adapters im...
2e57133f2946fe74ca075d07480088ef1d44cd28476ee1674b1f60e6550af80c
Python
30,560
712
import logging import os import unicodedata from typing import Any, Dict, List, Optional import requests from dotenv import load_dotenv from kani import AIParam, ai_function from kani_utils.base_kanis import StreamlitKani from requests.exceptions import HTTPError, RequestException from typing_extensions import Annotat...
18664c0180b7031b68f01f9610f64dbd3ba7d7d01d1138ea95a15561927cff88
Python
30,571
882
# -*- coding: utf-8 -*- # # sampler.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.or...
fcf56a76e9a1917d8743d01d93f7b5f420611464c37ecc61f15f0a619bdcd3c6
Python
30,582
786
"""Multiple functions to import the behavioral data. Some other functions to transform the data are included. """ import os import glob import re import ipdb import pandas as pd import numpy as np import utils DIR = os.path.dirname(os.path.abspath(__file__)) DATA_FOLDER = os.path.abspath('../source_data/') SPEED_T...
b4bae74b8a04543c236f1ef87c7ca2f6be37c8013427b9896557dd787be54898
Python
30,601
822
import pytest import numpy as np from numpy._core.multiarray import _vec_string from numpy.testing import ( assert_, assert_equal, assert_array_equal, assert_raises, assert_raises_regex ) kw_unicode_true = {'unicode': True} # make 2to3 work properly kw_unicode_false = {'unicode': False} class TestBasic:...
3131e359449306781566dc942dd05ed50c401aaf48af1355f0eb61ba328aaf4c
Python
30,607
821
""" 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 . import __version__ f2py_version = __ve...
47af567f5db4a146cc691c94cb62de94a1c87af55d63060b34e764b326d563f5
Python
30,623
876
"""Tests for database to CSV export functionality.""" from __future__ import annotations from typing import TYPE_CHECKING import pytest from sqlmodel import Session, create_engine from cali._constants import ( CALCIUM_DEN_DFF_CORRELATION, CALCIUM_DFF_CORRELATION, DFF_TRACES, NEUROPIL_CORRECTED_TRACE...
7e60c9005906ef5b854e7fac5524e1d88c345a6717418aa46d18e286fc018d4f
Python
30,641
879
from __future__ import absolute_import import io import logging import sys import warnings import zlib from contextlib import contextmanager from socket import error as SocketError from socket import timeout as SocketTimeout brotli = None from . import util from ._collections import HTTPHeaderDict from .connection i...
956092aba1d936a3e98df7de8df92a73d24a8e144f51456e2cf5b2593c970c6e
Python
30,676
873
"""Tests for Table Schema integration.""" from collections import OrderedDict from io import StringIO import json import numpy as np import pytest from pandas.core.dtypes.dtypes import ( CategoricalDtype, DatetimeTZDtype, PeriodDtype, ) import pandas as pd from pandas import DataFrame import pandas._test...
3459a6318281b411f1accddde270711b465c935fa7fae110b1b00378fb806e5d
Python
30,705
783
from datetime import ( date, datetime, ) import numpy as np import pytest from pandas._config import using_pyarrow_string_dtype from pandas.core.dtypes.common import ( is_float_dtype, is_integer_dtype, ) from pandas.core.dtypes.dtypes import CategoricalDtype import pandas as pd from pandas import ( ...
fc53ea200339c996d84a5727756b9a22d355920b37ca52843dbfa8eb7411cc41
Python
30,750
923
from contextlib import nullcontext from datetime import datetime from decimal import Decimal import numpy as np import pytest from pandas._config import config as cf from pandas._libs import missing as libmissing from pandas._libs.tslibs import iNaT from pandas.compat.numpy import np_version_gte1p25 from pandas.cor...
f41f272b23bd452b8333e05b1304397a0172a7a106fda5d00a7be307f37b54d4
Python
30,751
809
"""Tests for save and load settings functionality in CaliGui.""" from __future__ import annotations import json from typing import TYPE_CHECKING, Any import pytest if TYPE_CHECKING: from collections.abc import Generator from pathlib import Path from pytestqt.qtbot import QtBot @pytest.fixture def set...
046577a15710f7cfa0cea32cdd6342d3ec7be9f99f6864bfd9b0e72c11cf87dd
Python
30,800
1,118
__all__ = ['matrix', 'bmat', 'asmatrix'] import sys import warnings import ast from .._utils import set_module import numpy._core.numeric as N from numpy._core.numeric import concatenate, isscalar # While not in __all__, matrix_power used to be defined here, so we import # it for backward compatibility. from numpy.li...
78e4282500468c0a8572cc1d3418a91e818c18180b8b02c5348cd3b99e574a42
Python
30,816
907
import json import numpy as np import pytest from pandas import ( DataFrame, Index, Series, json_normalize, ) import pandas._testing as tm from pandas.io.json._normalize import nested_to_record @pytest.fixture def deep_nested(): # deeply nested data return [ { "country":...
ed174cf4187bd509a97f66e450fbb63221c3c1d51bd8d248c26c4ade0d501017
Python
30,872
979
""" Tests that work on both the Python and C engines but do not have a specific classification into the other test modules. """ from datetime import datetime from inspect import signature from io import StringIO import os from pathlib import Path import sys import numpy as np import pytest from pandas.errors import (...
8d905d06fc25840b54d820fc63603d9713b8047d7271f7e8894d609d7ead1bdc
Python
30,933
753
"""Adaptation / eccentricity analysis utilities.""" import os import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib.colors import LinearSegmentedColormap import seaborn as sns from sklearn.cluster import KMeans, DBSCAN, SpectralClustering, AgglomerativeClustering from sklearn.metrics i...
98c87178606df93f29ae35a93619ffc6f6428fabba3965a69acbca3fabdb339c
Python
30,941
899
"""A collection of functions designed to help I/O with ascii files. """ __docformat__ = "restructuredtext en" import numpy as np import numpy._core.numeric as nx from numpy._utils import asbytes, asunicode def _decode_line(line, encoding=None): """Decode bytes from binary input streams. Defaults to decodin...
bbda33621cccf95d0620d622d388d878db23883ed7b6cb2b0f6f7384555a380d
Python
30,982
860
import pytest import numpy as np from numpy._core import ( array, arange, atleast_1d, atleast_2d, atleast_3d, block, vstack, hstack, newaxis, concatenate, stack ) from numpy.exceptions import AxisError from numpy._core.shape_base import (_block_dispatcher, _block_setup, _b...
daf39dc884ba363cf27064f989dc4ac713ac7f0e93811e370917b6952b5860bd
Python
31,025
1,110
""" shared options and groups The principle here is to define options once, but *not* instantiate them globally. One reason being that options with action='append' can carry state between parses. pip parses general options twice internally, and shouldn't pass on state. To be consistent, all options will follow this de...
734661220911abd25fa688678b1b4cfa7d9faedc85d9f476a675058c5111f1f6
Python
31,042
928
""" test the scalar Timestamp """ import calendar from datetime import ( datetime, timedelta, timezone, ) import locale import time import unicodedata from dateutil.tz import ( tzlocal, tzutc, ) from hypothesis import ( given, strategies as st, ) import numpy as np import pytest import pyt...
0fa2135f3ca367e4f16f93b13e2d800b1a9abe86cad04ad84e1a080ba9cc85f1
Python
31,114
852
import threading from collections.abc import Mapping from pathlib import Path import numpy as np import tifffile from sqlalchemy.engine import Engine from sqlmodel import Session, create_engine, select from tqdm import tqdm from cali._constants import OZ, TS from cali.logger import cali_logger from cali.readers impor...
915e6d50234096327bf083cdae169e0d7f40c8ab4dd8a745f19a4d313783cb36
Python
31,130
934
import numpy as np import pytest import pandas.util._test_decorators as td import pandas as pd from pandas import ( DataFrame, Index, MultiIndex, RangeIndex, Series, Timestamp, option_context, ) import pandas._testing as tm from pandas.core.reshape.concat import concat from pandas.core.res...
288ad31e83dca9353721f0f65b28163195b0e013c51876a618410d19fcbe8025
Python
31,146
661
import numpy as np import librosa from pathlib import Path import os import re import soundfile as sf import pandas as pd import scipy.signal as sig import matplotlib.pyplot as plt from collections.abc import Iterable from plot_stimulus_correlations import stimuli_correlation from butterworth_filter import butter_filte...
b31b277dcf0a06c9ec4af23ef2c28828da36280daebebaef5b4598642ab28f29
Python
31,178
773
""" Build swig and f2py sources. """ import os import re import sys import shlex import copy from distutils.command import build_ext from distutils.dep_util import newer_group, newer from distutils.util import get_platform from distutils.errors import DistutilsError, DistutilsSetupError # this import can't be done h...
c0842ebc2a41cb850cb496a483b8042befc614e331fac9e9b25ee9016e633d00
Python
31,207
779
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 import os from e3nn import o3 from e3nn.math import soft_one_hot_linspace from e3nn.nn import Gate, Dropout, BatchNorm, FullyConnectedNe...
2168df2c9227d8ef2bba8faafc2914b7197de2676202f5ce9d59d4db0de75ecf
Python
31,230
802
""" Functional dense MPS state data and contractions. """ from dataclasses import dataclass from typing import Any, Iterable, Iterator, Sequence, Tuple import jax import jax.numpy as jnp import numpy as np from ..backends.jax_ops import adaware_qr, adaware_svd from .layout import MPSSpec, block_bucket_plan Array = ...
befe5c6ecdcfe607f8ddeff5bfbda0c1243637f0ffaa9b1fb973b27ab3210ee2
Python
31,273
828
from __future__ import annotations import functools import logging import os import shutil import sys import uuid import zipfile from collections.abc import Collection, Iterable from optparse import Values from pathlib import Path from typing import Any from pip._vendor.packaging.markers import Marker from pip._vendo...
bf9a234d95934a6f05a484f2fe2039f393aacedff883242695cd3b349b682737
Python
31,354
849
""" Created on Jun 24, 2024 @author: mning """ """ Created on May 22, 2023 @author: mning """ """ Created on May 10, 2023 @author: mning Note: all must accept same input arguments and yield same output types """ import logging import numpy as np from sklearn.covariance import LedoitWolf from sklearn.covariance imp...
128685f2beb822bec8e27a4af3c67dadfca2b8e05d3d216f999b387c2f93de18
Python
31,371
815
"""Behaviour analyses for the motor adaptation task.""" from __future__ import annotations import os from typing import Optional, Tuple import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from scipy.stats import pearsonr import pingouin as pg from matplotlib.colors import Lis...
257e0d7d5bcbd518573e89aaafe3e4e34191b784994c3a493ee37925b90ee226
Python
31,381
1,005
"""Tests for connectivity plot functionality.""" from __future__ import annotations from typing import TYPE_CHECKING from unittest.mock import MagicMock, Mock import numpy as np import pyqtgraph as pg import pytest from PyQt6.QtWidgets import QWidget from cali.sqlmodel import FOVAnalysis if TYPE_CHECKING: from...
3bccdda0a33bb6d9c286703414a0a543ce989a9f9797b2571aec992d1236d7a6
Python
31,524
863
#!/usr/bin/env python3 """Source space construction for combined cerebral and cerebellar MEG/EEG analysis. Provides functions to set up cerebellar surface source spaces, register them to individual subject anatomy via ANTs diffeomorphic registration, and merge them with MNE-Python cortical source spaces. """ # -------...
8ae44d9efca2561b411e99c4ac4cc23b9a95639bf04dc26c5f66790c12fddb45
Python
31,534
810
#!/usr/bin/env python3.7 """Defines Trace 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 random from cop...
db7228296e49f58f88651446e31fce7d879d24ee1b5d40be4623084203a13872
Python
31,551
652
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license """ Export a YOLOv5 PyTorch model to other formats. TensorFlow exports authored by https://github.com/zldrobit Format | `export.py --include` | Model --- | --- | --- PyTorch | ...
2a0c69a29b83eaca9ea742ecba6307d798e85a287455d6e75e9626f844cd8e81
Python
31,612
755
"""distutils.command.build_ext Implements the Distutils 'build_ext' command, for building extension modules (currently limited to C extensions, should accommodate C++ extensions ASAP).""" import contextlib import os import re import sys from distutils.core import Command from distutils.errors import * from distutils....
857e24b185d10be4377c4bcbac03481bdee6ab7b703ba67090c85f00d34add88
Python
31,683
757
"""distutils.command.build_ext Implements the Distutils 'build_ext' command, for building extension modules (currently limited to C extensions, should accommodate C++ extensions ASAP).""" import contextlib import os import re import sys from distutils.core import Command from distutils.errors import * from distutils....
f3b0b87dc22eda08710b11e1b4ad003ca4c9827c20b230a4d4390dd7df65075f
Python
31,751
650
""" Some utils too deal with peculiar protocols or peculiar ways of handling them Author: Bertrand Thirion, Ana Luisa Grilo Pinho, 2015 """ import numpy as np from pandas import read_csv, concat rsvp_language = ['consonant_strings', 'word_list', 'pseudoword_list', 'jabberwocky', 'simple_sentence', '...
322d786538048794a08525f8961611071fd1290b42b302081ff1cc063d790651
Python
31,775
586
# standard from pathlib import Path import numpy as np import torch import time import matplotlib.pyplot as plt from tqdm import tqdm import argparse # lRomul import argus from src.data import get_mouse_data from src.predictors import Predictor from src import constants # mine import utils_reconstruction.image_simil...
e33befdfedc15f241ad70a99910f37447859d3c5814aeb36424fe37795dbcdcf
Python
31,810
946
import numpy as np import logging import os from tqdm import tqdm import parmap import torch import torch.multiprocessing as mp from sklearn.decomposition import PCA from scipy.signal import argrelmin #from numba import jit from yass.util import absolute_path_to_asset from yass.empty import empty from yass.geometry i...
e4f1797877e1f265c02315c71d1076c576d7a218bca44de71d23b16baeae4bb1
Python
31,875
870
"""Extension API for adding custom tags and behavior.""" import pprint import re import typing as t from markupsafe import Markup from . import defaults from . import nodes from .environment import Environment from .exceptions import TemplateAssertionError from .exceptions import TemplateSyntaxError from .runtime im...
21e698de2542a0e5035e41cdce07a1887cd7e800ff1b8ee88ce4529103549308
Python
31,997
817
import logging import math from typing import Dict, List, Optional import pytorch_lightning as pl import torch import torch.nn as nn from torch.optim import Optimizer from torch.optim.lr_scheduler import LRScheduler from torch_geometric.data import Data from torch_geometric.nn import radius_graph from nablaDFT.gemnet...
1b5b752483c078d9063cb0d61025b5d7550ef3295ad0d2d748d4829498dd7397
Python
32,037
928
"""Tests for PCA and UMAP scatter plot functions. Covers: - plot_pca_scatter renders ScatterPlotItem objects per condition - plot_umap_scatter works when umap-learn is installed, gracefully fails otherwise - Empty database → no crash - Feature matrix building returns expected columns """ from __future__ import annota...
948163d16a90bc4655112a9839f3fc7e556ab8ca15118a75b9b24661a0992604
Python
32,102
911
import re import numpy as np import pytest import pandas.util._test_decorators as td import pandas as pd from pandas import ( Categorical, CategoricalDtype, DataFrame, DatetimeTZDtype, Index, Interval, IntervalDtype, NaT, Series, Timedelta, Timestamp, concat, date_...
9e9b6efb1ff8b0a0b6954cc1d16f1b193e8983dcf7ae00400bb7d7da8fbdb020
Python
32,179
845
## ........................................................................... ## ## PIMMS (Polymer Interactions in Multicomponent Mixtures) ## Alex Holehouse, Pappu Lab, Holehouse Lab ## Copyright 2015 - 2026 ## ........................................................................... import random import numpy a...
d768868e36a4de188c7f09e1e7347626a03bf3ea2bfaef4fd604c609c8c90f41
Python
32,179
1,069
import functools import sys import math import warnings import numpy as np from .._utils import set_module import numpy._core.numeric as _nx from numpy._core.numeric import ScalarType, array from numpy._core.numerictypes import issubdtype import numpy.matrixlib as matrixlib from numpy._core.multiarray import ravel_mu...
4a430fc8f21886c199371392bcc37115420eb74ecb4f8cda73655e920af7014d
Python
32,212
829
import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import pytorch_lightning as pl from torch.optim import AdamW,SGD from collections import OrderedDict, defaultdict from torch.optim.lr_scheduler import ReduceLROnPlateau,StepLR from pytorch_lightning.utilities import CombinedL...
b6a70accaff043bb63a111a0cbfb75866b597793a24e9751c10aa848e0fb03f6
Python
32,226
758
#!/usr/bin/env python3 from __future__ import annotations from datetime import datetime, timedelta, timezone from typing import Any from unittest import main, mock, TestCase import greenlight_guard from greenlight_guard import ( DEAD_REVIEW_AGE, evaluate_greenlight_guard, GREENLIGHT_LOGIN, Greenlight...
c66f0f92e9edec300a016be7c9212ca166e332f72664bf8e0bba9ef8b41aaee4
Python
32,326
891
""" The arraypad module contains a group of functions to pad values onto the edges of an n-dimensional array. """ import numpy as np from numpy._core.overrides import array_function_dispatch from numpy.lib._index_tricks_impl import ndindex __all__ = ['pad'] #########################################################...
152d85f0cd0f48fd248ac3076340959525e271935fe56996b8ce8ef369962774
Python
32,327
910
"""Test FOV-level analysis measurements for correlation and synchrony. This module tests the 6 different metrics computed in compute_fov_analysis: - Calcium: zero-lag correlation, jitter synchrony, max lag correlation - Spikes: zero-lag correlation, max lag correlation, jitter synchrony """ from __future__ import ann...
0f418be0f71bc52f7390d1b68c19108bd2756c401ed249aaef83c0e5c40bfda4
Python
32,344
770
# -*- coding: utf-8 -*- import gc import warnings import numpy as np from sklearn.utils.validation import check_random_state from . import compute, structures, utils def gen_permsamp(groups, n_cond, n_perm, seed=None, verbose=True): """ Generates permutation arrays for PLS permutation testing Parameters...
d2056505616a591679da39a2e662510b7877550851a2d1a19f0b34cb473207da
Python
32,367
823
#!/public/EM/anaconda3/envs/relion-5.0/bin/python import argparse import math import sys, os from pathlib import Path import numpy as np import pandas as pd import starfile import torch import torch.nn as nn import torch.nn.functional as F import mrcfile import matplotlib matplotlib.use("Agg") # non-GUI backend, no...
d20d4fce9d2fb66044989e70f45decffe24c55444ff114b81b571ce5345a02c2
Python
32,390
929
"""Fallback pure Python implementation of msgpack""" import struct import sys from datetime import datetime as _DateTime if hasattr(sys, "pypy_version_info"): from __pypy__ import newlist_hint from __pypy__.builders import BytesBuilder _USING_STRINGBUILDER = True class BytesIO: def __init__(...
2223c3f2d3d6f5c5653733bebae90d5f87c6a68355d2a12960841e5dd576c957
Python
32,407
915
import os import numpy as np import tqdm import parmap import scipy import logging from diptest import diptest as dp from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA from sklearn.metrics import pairwise_distances import networkx as nx from scipy.spatial.distance import pdist, squareform from...
bb28bb8ecca2f22db67286a3d3e43360140104ead2bd66f9c98460241dcf90be
Python
32,420
1,077
""" Some common noise quantum channels. """ import sys from typing import Any, Sequence, Union, Optional, Dict from functools import partial import numpy as np from . import cons from . import interfaces from .cons import backend, dtypestr from . import gates from .gates import array_to_tensor thismodule = sys.modu...
b466c6827a2d604e5724bb74706f43fc57f38927e56fda0dce57eac9e65b34be
Python
32,440
912
from collections import ( abc, deque, ) from collections.abc import Iterator from datetime import datetime from decimal import Decimal import numpy as np import pytest from pandas.errors import InvalidIndexError import pandas.util._test_decorators as td import pandas as pd from pandas import ( DataFrame,...
e6965035f16a34a893b21098c19dc04f1fbb1d35ebf9f03580b1f7ba60cf7555
Python
32,511
557
from __future__ import annotations from abc import ABC, abstractmethod from typing import Dict, List import re import logging class ESCARGOTPrompter: """ ALZKBPrompter provides the generation of prompts specific to the ALZKB example for the language models. Inherits from the Prompter class and implem...
7c94eaae3560e39614a7c68f09ca60473acd1285e26d9200cfc4e6cf671333b9
Python
32,578
886
import numpy as np import pytest import pandas as pd from pandas import ( CategoricalDtype, CategoricalIndex, DataFrame, Index, MultiIndex, Series, crosstab, ) import pandas._testing as tm @pytest.fixture def df(): df = DataFrame( { "A": [ "foo", ...
37e7092ad4dfa0e7b9af36cf41b20a1cd0a0073b624a10e3a04e1e39d673380d
Python
32,599
855
""" readout error mitigation functionalities """ # Part of the code in this file is from mthree: https://github.com/Qiskit-Partners/mthree (Apache2) # https://journals.aps.org/prxquantum/pdf/10.1103/PRXQuantum.2.040326 from typing import Any, Callable, List, Sequence, Optional, Union, Dict import warnings from time i...
85e0a6e1f9503ef34c356eb379ccff5d4adf5793beff359da5a9bf764dd5d937
Python
32,621
1,101
from __future__ import annotations from abc import ( ABC, abstractmethod, ) import sys from textwrap import dedent from typing import TYPE_CHECKING from pandas._config import get_option from pandas.io.formats import format as fmt from pandas.io.formats.printing import pprint_thing if TYPE_CHECKING: from...
47179e9c86855cb4fd6cf0c49d5ef37e970fbf9502e503158e9fa16f4220bfd8
Python
32,629
940
from __future__ import annotations from datetime import ( datetime, timedelta, ) import itertools import numpy as np import pytest from pandas._config import using_pyarrow_string_dtype from pandas.compat import ( IS64, is_platform_windows, ) from pandas.compat.numpy import np_version_gt2 import pan...
affe69ccddab1826e4ae821108b7bf061aead4d0cb08bce3f3934ef1c4d9750f
Python
32,683
902
import sys, boto3, os, io, pandas, datetime from itertools import chain from awsglue.transforms import * from awsglue.utils import getResolvedOptions from pyspark.context import SparkContext from awsglue.context import GlueContext from awsglue.job import Job from pyspark.sql import SQLContext from awsglue.dynamicframe...
16f5b4661e94f0290e2a8d0f96fcfc5beb9d3a0b1cce0f6a6b0c95abec732aa7
Python
32,702
1,009
from textwrap import ( dedent, indent, ) import numpy as np import pytest from pandas import ( DataFrame, MultiIndex, option_context, ) jinja2 = pytest.importorskip("jinja2") from pandas.io.formats.style import Styler @pytest.fixture def env(): loader = jinja2.PackageLoader("pandas", "io/fo...
f389720c3bed845a56a186e054444a90d1c2db08a6c4542721f45280cc746b77
Python
32,712
867
""" Analog time evolution engines """ from typing import Any, Tuple, Optional, Callable, Sequence, Dict from functools import partial import math import warnings import numpy as np from .cons import backend, dtypestr, rdtypestr, contractor from .gates import Gate from . import matrixfunc from .quantum import aslinea...
798b4c0dc6c8eeef0883e288475966e084ff38c02198d7c356e705e169d93c59
Python
32,727
635
#!/usr/bin/env python import sqlite3 import csv import numpy as np import pandas as pd import datetime import argparse import plotly.graph_objects as go import plotly.io as pio import plotly.express as px fig = go.Figure() pio.full_figure_for_development(fig,warn=False) import sys import timeit import subprocess impor...
056d35ff89bcc19707bc0919f052230e615fbac9e380598655b472a9b583d34d
Python
32,753
876
from functools import reduce import pickle import pytest import numpy as np import numpy._core.umath as umath import numpy._core.fromnumeric as fromnumeric from numpy.testing import ( assert_, assert_raises, assert_equal, ) from numpy.ma import ( MaskType, MaskedArray, absolute, add, all, allclose, allequ...
b7ad29e15d342e9e0b3d57eec074d7e0ed6c27cd5f40db61d22e954e3553e082
Python
32,775
720
# Copyright 2024 RADar-AZDelta # SPDX-License-Identifier: gpl3+ import logging from datetime import date from pathlib import Path from threading import Lock from typing import Any, Optional from polars import Config as pl_Config from polars import col, from_dicts from ..etl import Etl from .ctes import extract_ctes ...
7e95b4f48fe05afde72e027b7427bfdd7892f0dd54d9360b784576ba8aeb9e12
Python
32,792
849
import streamlit as st def show_about_page(): st.markdown(f""" <style> @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap'); :root {{ --primary:#0f4c81; --accent:#1f8ef1; --text:#1f2d3a; --muted:#6e7c95; --c...
695bc41c82ef252edc62134a1246bf42226511c3e29bbeacdbd15094d6c5611c
Python
32,795
992
import numpy as np import pytest from pandas.errors import ( IndexingError, PerformanceWarning, ) import pandas as pd from pandas import ( DataFrame, Index, MultiIndex, Series, ) import pandas._testing as tm @pytest.fixture def single_level_multiindex(): """single level MultiIndex""" ...
0542b553a2cd9a73358ea7c3bd1e789926706918d05be4c18be8c556fe33bf96
Python
32,881
860
"""Utilities for converting fNIRS datasets to the BIDS standard. Provides functions to organise raw SNIRF files into a BIDS directory tree, generate BIDS-compliant filenames, create required sidecar files (``dataset_description.json``, ``participants.tsv``/``.json``, ``_scans.tsv``, ``_sessions.tsv``), and read/write ...
08adcbadc7d62a70a1a24526d5e1d8b0be3743b0f9a8fabb4310cfb9860c9c05
Python
32,883
1,004
__all__ = ['atleast_1d', 'atleast_2d', 'atleast_3d', 'block', 'hstack', 'stack', 'unstack', 'vstack'] import functools import itertools import operator from . import numeric as _nx from . import overrides from .multiarray import array, asanyarray, normalize_axis_index from . import fromnumeric as _from_nx ...
d2aeec6be59f7ab264f6b8ccf4bcfe2786d64da7373bc58aff261df4e5763bf5
Python
32,938
959
""" The tests in this package are to ensure the proper resultant dtypes of set operations. """ from datetime import datetime import operator import numpy as np import pytest from pandas._libs import lib from pandas.core.dtypes.cast import find_common_type from pandas import ( CategoricalDtype, CategoricalIn...
35398686f9bf7e573a83376d39e00e5ec3b76a2e8ade97b21f8efa4a3faa7cb0
Python
32,982
940
import numpy as np import pytest import pandas as pd from pandas import ( Categorical, DataFrame, NaT, Timestamp, date_range, ) import pandas._testing as tm from pandas.util.version import Version class TestDataFrameSortValues: @pytest.mark.parametrize("dtype", [np.uint8, bool]) def test_...
51cc86f0a2b2adde6fd6ceaa0dd284933c0bc26a0c95f1c0f3ddcb8fe38e825d
Python
32,983
752
""" Modified version of build_ext that handles fortran source files. """ import os import subprocess from glob import glob from distutils.dep_util import newer_group from distutils.command.build_ext import build_ext as old_build_ext from distutils.errors import DistutilsFileError, DistutilsSetupError,\ DistutilsE...
bd6e7f3e28b88bfc2ffd5355474c27fbb205c1d81fdadcd13a8af87938553baf
Python
32,994
962
""" Utilities for conversion to writer-agnostic Excel representation. """ from __future__ import annotations from collections.abc import ( Hashable, Iterable, Mapping, Sequence, ) import functools import itertools import re from typing import ( TYPE_CHECKING, Any, Callable, cast, ) impo...
11bb010a5b89fb67952d2c571e02e8e94bace95b27adbcea3bdb18691b9ec20b
Python
33,008
1,090
from textwrap import dedent import numpy as np import pytest from pandas import ( DataFrame, MultiIndex, Series, option_context, ) pytest.importorskip("jinja2") from pandas.io.formats.style import Styler from pandas.io.formats.style_render import ( _parse_latex_cell_styles, _parse_latex_css_c...
77b5c3560b985744636e244655cf4719a95a895b8080aa2ac4060adab5a58246
Python
33,027
926
"""Gaussian-copula mutual information estimation. The estimators in this module follow the historical MATLAB implementation in this repository, but are packaged for modern Python use. """ from __future__ import annotations import math import os import warnings from numbers import Integral import numpy as np from sc...
00ffd7ece91df261193f1f8724621f96dd7a10cdb87ea5285088a94c0fa7c5d4
Python
33,085
830
# 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. """ Shared functions across variants of clusterblast """ from collections import defaultdict, OrderedDict import logging import os import struct from tempfile import Name...
c5c50041343816e93f36c562c3eb0bef92dfe4b96b5179fe081a2999bbacb71a
Python
33,102
988
""" Backend magic inherited from tensornetwork: jax backend """ # pylint: disable=invalid-name import logging from functools import partial from typing import Any, Callable, Optional, Sequence, Tuple, Union import numpy as np import tensornetwork from scipy.sparse import coo_matrix from tensornetwork.backends.jax i...
95b385220d9a5c50db67a216a6e6d14d99b599bf92582273c07206c78eb7fb41
Python
33,104
941
"""Provides pipeline for segmenting the cerebellum.""" # --------------------------------------------------------------------------- # Authors: John G Samuelson <johnsam@mit.edu> # Christoph Dinh <christoph.dinh@brain-link.de> # Teemu Taivainen # Created: September, 2021 (Modified: July, 2026) # Licen...
3fa66e6d7f70ff21cffac5bf6f97da65d070ce72633f59c80307a4cb88942da7
Python
33,154
983
## ........................................................................... ## ## PIMMS (Polymer Interactions in Multicomponent Mixtures) ## Alex Holehouse, Pappu Lab, Holehouse Lab ## Copyright 2015 - 2026 ## ........................................................................... # ## ## analysis_general ##...
83d0569a48bcae1a12823ea9104abf6ae772396805bdc689d949b699abcec17f
Python
33,156
855
#!/usr/bin/env python3.7 """Submits NEURON fiber simulations. 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 arg...
fa3fefea531a1b4fc2730fdc81f07640cc2d25ec14a5123c56d482cf98dbdbd7
Python
33,202
767
# 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 defaultdict import...
b002d2822437dedb774d3ea790bd3379da2d607b62570b4daf9ebeb6a9caafa2
Python
33,216
1,025
# -*- coding: utf-8 -*- """ ########################################################################################## This module is used for computing the Autocorrelation descriptors based different properties of AADs.You can also input your properties of AADs, then it can help you to compute Autocorrelat...