sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
79c35e4ab55dda648fb1d22a9b794cf75d5be263f02c8564a33dcc9c91591378 | Python | 15,320 | 429 | """Tests formatting as writer-agnostic ExcelCells
ExcelFormatter is tested implicitly in pandas/tests/io/excel
"""
import string
import pytest
from pandas.errors import CSSWarning
import pandas._testing as tm
from pandas.io.formats.excel import (
CssExcelCell,
CSSToExcelConverter,
)
@pytest.mark.parametr... |
e6b1bac83f5af740ded9de8ae241203b76e9a31cd473e9f8f2177c5dbbb4a931 | Python | 15,331 | 482 | # train_hybrid.py
# ------------------------------------------------------------
# Requirements:
# pip install ultralytics timm matplotlib
# ViT_YOLOv8_model.py, load_dataset.py, data.yaml
#
# Run:
# python train.py
# ------------------------------------------------------------
import os
os.environ["K... |
2ede93bf7445f65fa8dc6de933072d8edb1dd4e1b4332dca8e13b4ebbce0f7ab | Python | 15,333 | 482 | # train_hybrid.py
# ------------------------------------------------------------
# Requirements:
# pip install ultralytics timm matplotlib
# ViT_YOLOv8_model.py, load_dataset.py, data.yaml
#
# Run:
# python train.py
# ------------------------------------------------------------
import os
os.environ["K... |
67974b0f44bd95068c46f672b07cf72c9be738dae6903fb53523c78c63d5789b | Python | 15,339 | 331 | # License: GNU Affero General Public License v3 or later
# A copy of GNU AGPL v3 should have been included in this software package in LICENSE.txt.
""" A collection of functions for converting records, features, and domains into
JSON for use by the webpage javascript
"""
import os
from typing import Any, Dict, It... |
53d459bdb3c42cabc5d39f919d4f27d5b9e75f66db438df4a8bf58b407a9030e | Python | 15,342 | 374 | #!/usr/bin/env python
# coding: utf-8
# In[2]:
"""
═══════════════════════════════════════════════════════════════════════════════
Biomedical-Specific KG → mapped_triples tensor
═══════════════════════════════════════════════════════════════════════════════
Sources : All files under Biomedical/ (Human parquets + ... |
3af37b6d886ffadb2bf763ef21dffb4ad27e80a8c6db9e268e2877da0f2a87c6 | Python | 15,343 | 429 | import numpy as np
import pandas as pd # type: ignore
from sklearn.metrics import pairwise_distances # type: ignore
from scipy.stats import spearmanr # type: ignore
import warnings
from typing import Dict, Tuple
class DimensionalityReductionEvaluator:
"""
Dimensionality reduction quality evaluator.
... |
3fe488c1b87e9fa41d3ea167b3879b3ed185c1d5ddeef99e5ade7f770a342aae | Python | 15,354 | 415 | from collections import ChainMap
import inspect
import numpy as np
import pytest
from pandas import (
DataFrame,
Index,
MultiIndex,
merge,
)
import pandas._testing as tm
class TestRename:
def test_rename_signature(self):
sig = inspect.signature(DataFrame.rename)
parameters = set(... |
c817bf7b6216638ded3fbc4a3cd5a9e0deee9775c714f7fafd7f2a211336af58 | Python | 15,367 | 287 | # 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,invalid-name,too-few-public-methods
import... |
ed8ad5dc1f9b5d59ba008f907a4702e0248a44b07d64cedf6a410ece6e609b59 | Python | 15,389 | 492 | # being a bit too dynamic
from __future__ import annotations
from math import ceil
from typing import TYPE_CHECKING
import warnings
from matplotlib import ticker
import matplotlib.table
import numpy as np
from pandas.util._exceptions import find_stack_level
from pandas.core.dtypes.common import is_list_like
from pa... |
3f806b18dd0a6c32a7c7d61eaff5acb580376398456d15aa9c411faa65211e5a | Python | 15,408 | 212 | from typing import Dict, List
from textwrap import dedent
check_rev_rel: dict[str, str] = {
'biologicalprocess_anatomicalentity': 'anatomicalentity_biologicalprocess',
'cellularcomponent_anatomicalentity': 'anatomicalentity_cellularcomponent',
'chemicalentity_anatomicalentity': 'anatomicalentity_chemicalen... |
e2fc224cca620fb1a78e03867bfa9f8a306d6ebf717db01777af24aeecdefc6c | Python | 15,408 | 403 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import os
import glob
import warnings
import pandas as pd
import torch
from tqdm import tqdm
warnings.filterwarnings('ignore')
os.makedirs('Store_House', exist_ok=True)
# In[2]:
# '/storage/Arushi/090526_EvoAge/kg_formation/processed_data_relation_wise_merge/Biome... |
a4899215020308fb55f97488f2db40c934dbbed44c9210dea89f153d965469fd | Python | 15,430 | 398 | from __future__ import annotations
import collections.abc as c
import hashlib
import typing as t
from collections.abc import MutableMapping
from datetime import datetime
from datetime import timezone
from itsdangerous import BadSignature
from itsdangerous import URLSafeTimedSerializer
from werkzeug.datastructures imp... |
982028ea5c7a575fd46a8c5c1963a088057437edfcd6b29cc8092a50727d9227 | Python | 15,438 | 497 | from __future__ import annotations
import functools
import re
import textwrap
from typing import (
TYPE_CHECKING,
Callable,
Literal,
cast,
)
import unicodedata
import numpy as np
from pandas._libs import lib
import pandas._libs.missing as libmissing
import pandas._libs.ops as libops
from pandas.core... |
e84618bb331ab7b9a52a07deb03da71e470576a4aa3b3437485eba87c7b94966 | Python | 15,448 | 383 | import os
import shutil
from glob import glob
from nipype.interfaces import fsl
import nibabel as nib
import numpy as np
import json
from scipy import ndimage
import csv
from src.logger import LOGGER
from src.utilities import (
list_files,
get_subj_ID_and_session,
only_Ts_needed_for_bibsnet_model,
ru... |
8073f12ab3b9645040caf8de31f3189dc4cee0d9d541846deb690b9133a03f6c | Python | 15,449 | 369 | import torchaudio.transforms as T
n_fft = 1024
win_length = None
hop_length = 512
n_mels = 128
sample_rate = 16000
'''
mel_spectrogram = T.MelSpectrogram(
sample_rate=sample_rate,
n_fft=n_fft,
win_length=win_length,
hop_length=hop_length,
center=True,
pad_mode="reflect",
powe... |
54d7184cbe64f58ca209defa4d9d447832aa7384c3105bf830241690bb9538c3 | Python | 15,455 | 470 | """
Dimensionality reduction tools!
"""
from math import floor
import matplotlib.pyplot as plt
import numpy as np
from scipy.linalg import eigh
from scipy.spatial.distance import squareform, pdist
from sklearn.decomposition import PCA
from sklearn.linear_model import LinearRegression
from sklearn.model_selection impo... |
bca371d5ad4a752ba7f0e20f132eb6554937f7411ec3a5f25601d035b8cf4457 | Python | 15,475 | 460 | from datetime import datetime
import numpy as np
import pytest
from pandas.core.dtypes.common import is_extension_array_dtype
import pandas as pd
from pandas import (
DataFrame,
DatetimeIndex,
Index,
MultiIndex,
NaT,
PeriodIndex,
Series,
TimedeltaIndex,
)
import pandas._testing as tm
... |
1593fdd8648e114342568803c6781d192d9ea1d370870ef0ed7b3a8d08191b28 | Python | 15,505 | 396 | import numpy as np
import pytest
from pandas import (
DataFrame,
Index,
Series,
concat,
merge,
)
import pandas._testing as tm
from pandas.tests.copy_view.util import get_array
def test_concat_frames(using_copy_on_write):
df = DataFrame({"b": ["a"] * 3})
df2 = DataFrame({"a": ["a"] * 3})
... |
24c3a104e1f66476378825c0719d9c186386c81aa0179145a641180de35b3b3a | Python | 15,507 | 383 | # 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.
""" Analysis methods for a variety of active site types.
Each method should include a reference to its data, the source of the data,
and a reference to a paper fr... |
5ad772eb3dd48b72cd9cc1a2391cd233df336d04053bef1373b20417e77a9aaa | Python | 15,548 | 358 | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 9 10:19:35 2023
@author: lindseyb
"""
import numpy as np
from scipy.io import loadmat
from sklearn.linear_model import RidgeCV
from sklearn.impute import KNNImputer
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcP... |
511414731ab322d37506536cb888f994ca6a400e8b913c75ea132c8888c4173c | Python | 15,557 | 476 | """
Trajectory inference example – Neural ODE (scRNA-seq)
Trajectory inference using iAODE + Neural ODE on the paul15
hematopoietic differentiation dataset, with velocity field
visualization and summary statistics.
Dataset: paul15 (hematopoietic differentiation trajectory)
"""
import sys
from pathlib import Path
sy... |
78533a0f60a22e0aec9b03792909bf918af321d1bb96615752e52236816b7a51 | Python | 15,586 | 426 | """
This file contains a minimal set of tests for compliance with the extension
array interface test suite, and should contain no other tests.
The test suite for the full functionality of the array is located in
`pandas/tests/arrays/`.
The tests in this file are inherited from the BaseExtensionTests, and only
minimal ... |
63fa4247e1e7193ccd3ab9dc4b0b3638004a39a8d593c778818505f720a155a4 | Python | 15,600 | 428 | # Script to run germline:somatic experiment P-NET on pre-formatted prostate germline and/or somatic data
# Related to the `run_pnet.py` script, which was generated by copying over and then editing everything in the file: `pnet/notebooks/prostate_metastatic_prediction_example.ipynb`
import logging
import os
import re
i... |
3e67700032ea912c902d9d2338a0200ec016e24fc7d13940ef5122df3d02e5a2 | Python | 15,601 | 406 | from __future__ import annotations
import collections.abc as cabc
import json
import typing as t
from .encoding import want_bytes
from .exc import BadPayload
from .exc import BadSignature
from .signer import _make_keys_list
from .signer import Signer
if t.TYPE_CHECKING:
import typing_extensions as te
# This... |
98a750e237aeabdb7d83e6338ca91945faaf47abf7e8f815c0a98cd3b69d8c3a | Python | 15,609 | 454 | """
Reproduction of "Towards Practical Quantum Neural Network Diagnostics with Neural Tangent Kernels"
Link: https://arxiv.org/abs/2503.01966
Description:
This script reproduces Figure 2 from the paper using TensorCircuit-NG.
"""
from __future__ import annotations
import argparse
import contextlib
import time
from p... |
d5f1f4a07ea7c6cdd01bf33f77a2683a1f585af3b6fe6117158c9ef0638b11e6 | Python | 15,614 | 315 | import numpy as np
import torch.nn as nn
from pytorch3dunet.unet3d.buildingblocks import DoubleConv, ResNetBlock, ResNetBlockSE, \
create_decoders, create_encoders
from pytorch3dunet.unet3d.utils import get_class, number_of_features_per_level
import torch
class AbstractUNet(nn.Module):
"""
Base class for s... |
b055a546362f60c61aa3e373396ada467621ab40883045ce7c8b4f784791cef8 | Python | 15,625 | 461 | """Plot raw, neuropil, and corrected traces together using pyqtgraph."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any
import numpy as np
import pyqtgraph as pg
from qtpy.QtCore import Qt
from sqlalchemy.orm import selectinload
from sqlmodel import Session, col, select
from cali.logger im... |
c548129746b411847ef9f72826dd64cf7bcabb7cea9a8706d50ca4701f5cd4b9 | Python | 15,659 | 473 | #!/usr/bin/env python3
from __future__ import annotations
import contextlib
import json
import os
import re
from typing import Any, cast
from urllib.error import HTTPError
from github_utils import gh_fetch_url, gh_post_pr_comment, gh_query_issues_by_labels
from gitutils import get_git_remote_name, get_git_repo_dir, ... |
aaf4d1d0ba227c7a7d67f28d854a7d84751e1acaace9d4c55d1bf68af61fb22b | Python | 15,663 | 468 | import os
import sys
import pytest
import numpy as np
thisfile = os.path.abspath(__file__)
modulepath = os.path.dirname(os.path.dirname(thisfile))
sys.path.insert(0, modulepath)
import tensorcircuit as tc
def test_analog_circuit_init(jaxb):
# Test initialization of AnalogCircuit
nqubits = 4
ac = tc.Ana... |
c450d901de8b96cff023bf366a838e14918f03e5c48b213926f7ed534dd14648 | Python | 15,663 | 478 | import datetime
import decimal
import re
import numpy as np
import pytest
import pytz
import pandas as pd
import pandas._testing as tm
from pandas.api.extensions import register_extension_dtype
from pandas.arrays import (
BooleanArray,
DatetimeArray,
FloatingArray,
IntegerArray,
IntervalArray,
... |
95eabd771a7f29ec40bfb9a17b12c259770830a3413ce55f845bfa36e7393e44 | Python | 15,673 | 469 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class BaseGetitemTests:
"""Tests for ExtensionArray.__getitem__."""
def test_iloc_series(self, data):
ser = pd.Series(data)
result = ser.iloc[:4]
expected = pd.Series(data[:4])
tm.assert_series_... |
754c5bf570fe0093dba0afcb3b72c0d0a83290549410e1b90551ab8709b642aa | Python | 15,691 | 643 | """
Wrapper functions to more user-friendly calling of certain math functions
whose output data-type is different than the input data-type in certain
domains of the input.
For example, for functions like `log` with branch cuts, the versions in this
module provide the mathematically valid answers in the complex plane::... |
33230aa366dbbd173946104a90de76fe16adcf5e94b18712ee1ee861ac281dd1 | Python | 15,705 | 484 | """
One-site Time-Dependent Variational Principle (TDVP) implementation.
JAX-compatible, JIT-compilable, and GPU-accelerated.
"""
from functools import partial
import time
import numpy as np
import jax
import jax.numpy as jnp
import quimb.tensor as qtn
import tensorcircuit as tc
def apply_heff(L, W, R, M):
T1 = ... |
9e5813ba30409cc22f7284e45eeaf7cf6c936c09439df446eae86fcb798747bd | Python | 15,707 | 457 | import logging
import os
import pandas as pd
logger = logging.getLogger(__name__)
##################################
# Extracted from original `get_P1000_results.ipynb` for reuse
##################################
def load_feature_importances(importances_path):
"""
Load feature importance data from a CSV fi... |
bc6c9b01441894f28c72e9335ffd9eeb97e669f9c516e31b0f6e676984c4c2d7 | Python | 15,710 | 484 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
import logging
import platform
import sys
import sysconfig
from importlib.machinery import EXTENSION_SUFFIXES
from typing import (
Dict... |
142f4a86e49551dc833fe6105034172a1526ad3cc2f33b0e201adaacc212adce | Python | 15,711 | 442 | import functools
import timeit
import numpy as np
import numpy._core.fromnumeric as fromnumeric
from numpy.testing import build_err_msg
pi = np.pi
class ModuleTester:
def __init__(self, module):
self.module = module
self.allequal = module.allequal
self.arange = module.arange
sel... |
3fdcb32b70aec10a5f2bc89e9dffc4ea3be8f9bab4f1b3d796bd857203d780dc | Python | 15,714 | 451 | # Script to run germline:somatic experiment P-NET on pre-formatted prostate germline and/or somatic data
# Related to the `run_pnet.py` script, which was generated by copying over and then editing everything in the file: `pnet/notebooks/prostate_metastatic_prediction_example.ipynb`
import logging
import os
import warn... |
f2912b2d3127997eb8cf279f2ee32c7e67a81b1e2fc52e38507d4b741793ee6c | Python | 15,720 | 412 | r"""
This module is a collection of pooling layers for m6Anet
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
from .blocks import get_activation
from typing import Optional
class PoolingFilter(nn.Module):
r"""
The abstract class of m6Anet pooling filter layer
"""
def... |
3359824188055178582dfb9df9191f4a514df98024096ab68be668c87addefce | Python | 15,730 | 350 | # -*- coding: utf-8 -*-
#
# utils.py
#
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/... |
d0c71bad67ee7067da1704aabe5a0d2d37d6adff909395c6963f3469d5af2ac2 | Python | 15,756 | 510 | """Includes baseline correction and phasing"""
import copy
import numpy as np
import nmrglue as ng
from scipy.stats import norm
from scipy.ndimage.filters import gaussian_filter1d as g1d, convolve1d as c1d
from lmfit import Minimizer, Parameters, report_fit
import statsmodels.api as sm
from ..helper_functions import... |
c2b409a541126d6622368026623dd560d7559abc4d65d30abf74c2629dcc1b40 | Python | 15,764 | 421 | """A Python class containing an implimentation of MPPCA denoising.
Inputs are a 4D image with dimentions (X x Y x Z x N)
Usage:
import mpdenoise as mp
imgdn, sigma, nparameters = mp.denoise(img, kernel=[7,7,7], M=60, shrinkage='frobenius')
LICENCE
Authors: Benjamin Ades-Aron (... |
43f3be9d819123a04501b1aae916655d3e0f4d6365b1ab3bdd881a2a9b6578db | Python | 15,769 | 299 | import numpy as np
import torch
from torch import Tensor
from torch.autograd import Variable
class ReplayBuffer(object):
"""
Replay Buffer for multi-agent RL with parallel rollouts
"""
def __init__(self, max_steps, num_agents, obs_dims, ac_dims, device):
"""
Inputs:
max_step... |
283bfa2cf8b976c1468d5e204f1b51307e84efd2d903cde5d7dccd2777beded9 | Python | 15,806 | 470 | import numpy as np
from psychopy import core, visual, event
from utils import show_fixation_cross
def get_wedge(angular_position,
checker_phase=0.,
checker_cycles_radial=10,
checker_cycles_angular=2.5,
outer_radius=500,
inner_radius=80,
... |
565cdd63b92fdcb4d182e8deedaecbcc2a7a5ad69e595091145507cb0ef20e29 | Python | 15,811 | 356 | import h5py
import numpy as np
import os
import pandas as pd
import pathlib
import pickle
import scipy.stats as stats
import soxr
#! change below to spatial_attn_lighting if want to use with modular
import src.spatial_attn_lightning as attn_tracking_lightning
import src.audio_transforms as at
import torch
import yaml
... |
b6b736b62d832c557a5437f40e045c1b254575b6cf62c373c45813203d6577ba | Python | 15,845 | 466 | """A Python class containing an implementation of MPPCA denoising for magnitude and/or phase images.
Inputs are a 4D image with dimensions (X x Y x Z x N)
Usage:
import mpcomplex as mp
imgdn, sigma, nparameters = mp.denoise(img, kernel=[5, 5, 5], shrinkage='frob', algorithm=veraart)
... |
4f73ca57f9564e9ff8654e7ae9fa56b7f37dfedaf705fb311e527fbea9d08a24 | Python | 15,858 | 437 | import pytest
from pandas._config import config as cf
from pandas._config.config import OptionError
import pandas as pd
import pandas._testing as tm
class TestConfig:
@pytest.fixture(autouse=True)
def clean_config(self, monkeypatch):
with monkeypatch.context() as m:
m.setattr(cf, "_globa... |
697f4dbf7bb3da8b134bfd29088571ff9e0552e6ce45521f4ac865b6acaffe15 | Python | 15,859 | 398 | # 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.
""" Helper functions for location operations """
import logging
from typing import Iterable, List, Sequence, Tuple, Union
from typing import Optional # in comment hints,... |
dc7bee7f6336ec686aa6c3ee90261689ede63774eec09a7700e9071f971a4e24 | Python | 15,864 | 360 | """Judge BioChatter's hypothesis answers with the locally hosted MedGemma model.
Takes the hypothesis and the answer BioChatter produced, shows both to MedGemma,
and asks for a single verdict on the same ladder EvoAge's own judge uses:
strong_support | support | partial_support | weak_support | no_support
The ve... |
8834e90cad6f25162edc78097b5f499b957422029e1d70733baeff0c1e8ca618 | Python | 15,871 | 469 | """Test Export Only option in run widget and functionality."""
from pathlib import Path
from unittest.mock import MagicMock
import pandas as pd
from pytestqt.qtbot import QtBot
from sqlmodel import Session, create_engine
from cali._constants import (
CALCIUM_DEN_DFF_CORRELATION,
CALCIUM_DFF_CORRELATION,
... |
63d76ce47eb3695dc93232488b7e0929c236b2c318228c8fd9208c80453e6d9b | Python | 15,888 | 368 | # Load packages for data analysis
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from datetime import datetime, timedelta
# Load packages for Big Query
#from google.cloud import bigquery
import os
import nltk.data
import warnings
from tqdm import tqdm
from collections import Counter, OrderedD... |
adad099220a15d424148858853e8be70a6b75b05963780fcc82b9889e1e3250c | Python | 15,890 | 445 | from keras.layers import Layer
from keras import activations
from keras import initializers
from keras import regularizers
from keras import constraints
from keras.layers import Lambda
import tensorflow as tf
import keras.backend as K
class MessageLayer(Layer):
""" Implements the matrix multiplication message fu... |
c245d18ec00a23aa599ef85eb40c8b6a7be7ff4a6323140100b6031dacd7adff | Python | 15,897 | 564 | """
Tests that apply specifically to the Python parser. Unless specifically
stated as a Python-specific issue, the goal is to eventually move as many of
these tests out of this module as soon as the C parser can accept further
arguments when parsing.
"""
from __future__ import annotations
import csv
from io import (
... |
4d1f2f7c1a044f79a2703eb1c321862d91698e9ab7b42ed5f5e87c637f4f89ea | Python | 15,909 | 433 | """
Fixed-shape dense TEBD with tensor-only runtime inputs and outputs.
"""
from dataclasses import dataclass
from typing import Any, Callable, Optional, Tuple
import jax
import jax.numpy as jnp
import numpy as np
from ..layout import GateSpec, MPSSpec, block_mps_spec
from ..mps import (
BlockBuffers,
MPSSta... |
386e310cf934061466462bb7e0d61403d4c38bf58fa2604516422aef1fa7913a | Python | 15,933 | 443 | """Compare whole-step JIT and TeNPy using the same full-rank initial MPS.
Run with JAX and TeNPy installed. The TNALG side can run on CPU or GPU.
Lowering, XLA compilation, first execution, and repeated execution are
reported separately. TeNPy receives an explicit export of the same random
state; its initial bond dime... |
7cfcd9ff384797e8890440185f2d829bb408d24cec6f51690a1d53d225a80114 | Python | 15,935 | 372 | import zmq
import h5py
import numpy as np
import struct
import json
import time
from datetime import datetime
from Client_config import (
SPIKE_WAVELET_LEN,
ZMQ_SPIKE_SOCKET,
# ZMQ_META_SOCKET,
SPIKE_EVENT_SIZE,
connect_to_zmq,
FS,
ELECTRODE_MAPPING,
STIMULATION_DURATION,
STIM... |
5f953f7646e7a09c2d0200500c67eac1451441752fa74401ecab4c0ea08aecac | Python | 15,942 | 481 | """
Trajectory inference with Neural ODE (scATAC-seq)
Infer trajectories from chromatin accessibility using iAODE + Neural ODE
with velocity field visualization.
Dataset: 10X Mouse Brain 5k scATAC-seq (HVP subset)
"""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent))
from _example_u... |
e6de87828b882a31d0a25c462691c9b9cc0a94628e7001e2bd88bdcfa0fe3aad | Python | 15,946 | 303 | import numpy as np
import torch
from torch import Tensor
from torch.autograd import Variable
class ReplayBuffer(object):
"""
Replay Buffer for multi-agent RL with parallel rollouts
"""
def __init__(self, max_steps, num_agents, obs_dims, ac_dims, device):
"""
Inputs:
max_step... |
34373a14a0c63ab18876f483a49f4cabd3be684d31c3e2e823a2feadcad6d1c2 | Python | 15,968 | 414 | import numpy as np
import pytest
import pandas as pd
from pandas import (
Categorical,
DataFrame,
Series,
Timestamp,
date_range,
)
import pandas._testing as tm
class TestCategoricalOpsWithFactor:
def test_categories_none_comparisons(self):
factor = Categorical(["a", "b", "b", "a", "a"... |
f3ac3f03e81e3d95d9113aacf5460a7c466b34a5f2be67740f049c4db1c7f438 | Python | 15,980 | 444 | import re
import numpy as np
import pytest
from pandas.errors import SettingWithCopyError
from pandas import (
DataFrame,
Index,
IndexSlice,
MultiIndex,
Series,
concat,
)
import pandas._testing as tm
from pandas.tseries.offsets import BDay
@pytest.fixture
def four_level_index_dataframe():
... |
b431fcff8aec10e99ef36d9138ada274ba4064c893428b651c7fec1b11b795e8 | Python | 15,990 | 554 | # pylint: disable=invalid-name
import sys
import os
from functools import partial
import numpy as np
import tensorflow as tf
import pytest
from pytest_lazyfixture import lazy_fixture as lf
thisfile = os.path.abspath(__file__)
modulepath = os.path.dirname(os.path.dirname(thisfile))
sys.path.insert(0, modulepath)
impo... |
adc3d59de0d5aaa9f74d24b65f0942826701b35f0b2212e724904d4fb89cd3a9 | Python | 15,996 | 430 | import numpy as np
from scipy.sparse import issparse
from .model import TNODE
from torch.autograd.functional import jacobian
import torch
from sklearn.metrics.pairwise import cosine_similarity
import copy
import anndata as ad
import pandas as pd
#Class to perform gene ranking. Output can be used directly in gseapy ... |
65846466163aa62c6bdc072c93dd83b99fe9ed5153b8b443aa55adbcd49871ee | Python | 15,999 | 404 | # 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=use-implicit-booleaness-not-comparison,protected-access,missing-docstring
import unittest... |
54114b6789e83b946961e190e09b88e73ca5a73b5289e88048df14f4f2d376cf | Python | 16,014 | 496 | """
Reproduction of "Efficient classical simulation of random shallow 2D quantum circuits"
Link: https://arxiv.org/abs/2001.00021
Description:
This script implements the Spatial Evolution Block Decimation (SEBD) algorithm
described in the paper. It simulates random shallow 2D quantum circuits by mapping
the 2D circuit... |
610abdee598550557e8555b84da8bf55eba2964d5116459d24eb1e9209979988 | Python | 16,020 | 403 | # -*- coding: utf-8 -*-
#
# train_pytorch.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.apa... |
74b06954b1a5b554623b16022152dbe2890b5f084f9de469ef0862d956d5d609 | Python | 16,029 | 560 | """
:mod:`pandas.io.formats.xml` is a module for formatting data in XML.
"""
from __future__ import annotations
import codecs
import io
from typing import (
TYPE_CHECKING,
Any,
final,
)
import warnings
from pandas.errors import AbstractMethodError
from pandas.util._decorators import (
cache_readonly,
... |
e7b6300ebb759c0448002e40f7c5f095ef9813d148deb76caffac94f00b464cd | Python | 16,053 | 322 | """
Detailed-balance tests for the optimized moves.
A move that respects detailed balance samples the same Boltzmann equilibrium as
the trusted crankshaft reference (the fast serial crankshaft kernel is bit-exact
to the reference mega_crank kernel - see test_kernel_correctness). Each test
equilibrates a system with cr... |
bbe3cc32dfd4111feadb1757db7df7544ac434a59d4f85591e6dd9d1341458c3 | Python | 16,054 | 331 | # 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.
""" Classes and helpers for candidate cluster features
CandidateClusters contain one or more Protocluster features.
There are four kinds of candidate cluster:
- chem... |
4e0542017f6be0c670dd03c7e9a13e779e6045970a37d1fd5fe313678bbe2e26 | Python | 16,069 | 553 | """
Low-dependency indexing utilities.
"""
from __future__ import annotations
from typing import (
TYPE_CHECKING,
Any,
)
import numpy as np
from pandas._libs import lib
from pandas.core.dtypes.common import (
is_array_like,
is_bool_dtype,
is_integer,
is_integer_dtype,
is_list_like,
)
fro... |
ad78bab165f56b6696649f2188d86ca14793d54576740dabe10eaccfa462eaac | Python | 16,071 | 368 | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 9 10:19:35 2023
@author: lindseyb
"""
import numpy as np
from scipy.io import loadmat
from sklearn.linear_model import RidgeCV
from sklearn.impute import KNNImputer
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcP... |
be075c517d57a0b8589d2ec1c74bee4a8f0c2e3c096b635273d9cca58ae2739e | Python | 16,072 | 370 | import os
import sys
parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.append(parent_dir) # Add parent directory to sys.path
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parallel i... |
a0715e5d590a5255f951c6aeb46923550ddaaabe77ef103b029b083683b514e6 | Python | 16,073 | 489 | """
Shared spatial scans over equivalent local block layouts.
"""
from dataclasses import dataclass
from typing import Any, Callable, Optional, Tuple
import jax
import jax.numpy as jnp
import numpy as np
from .layout import MPOSpec, MPSSpec, block_bucket_plan
from .symmetric_environment import (
LegalEnvironment... |
6ee912fdaec2df9d54fe0491a8a138adb5f720853fe2b010fed93504c50d8af4 | Python | 16,086 | 460 | ##########################################################################
# NSAp - Copyright (C) CEA, 2013 - 2016
# 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
# for details.
###... |
54eddfef9ae3fe450161e572aa632f8578b11cc2ba8baae570b9b6890df47c93 | Python | 16,105 | 362 | #replace return statement with code to execute input on network and return classification number
import numpy as np
import tensorflow as tf
from keras import backend as K
from tensorflow.keras.applications.vgg16 import VGG16
from keras.preprocessing.image import img_to_array, array_to_img
from keras import layers
from ... |
e16ed6567d7d3056445c9537bed258c279077c3fd0b8b69f2557376b9d026c5d | Python | 16,113 | 283 | import pandas as pd
from scipy.stats import pearsonr
import matplotlib.pyplot as plt
import numpy as np
from IPython.display import display
def process_outliers(folders, list_of_folders, gene_list):
full_table = pd.DataFrame({"Gene List": gene_list}, index=gene_list)
for folder_type, folder_list in list_of_f... |
5be12efc0bf9ccd3411c364718b36598d6f652e301c8a45dc163d3b09c40e684 | Python | 16,125 | 629 | """
numerictypes: Define the numeric type objects
This module is designed so "from numerictypes import \\*" is safe.
Exported symbols include:
Dictionary with all registered number types (including aliases):
sctypeDict
Type objects (not all will be available, depends on platform):
see variable sctypes ... |
ffa2e942d04616c801e0a4998711104f8417e7b5b7d7bd8c6ef2c8033c5ba0f0 | Python | 16,128 | 513 | from __future__ import annotations
from typing import (
TYPE_CHECKING,
Any,
Literal,
cast,
)
import numpy as np
from pandas._libs import index as libindex
from pandas.util._decorators import (
cache_readonly,
doc,
)
from pandas.core.dtypes.common import is_scalar
from pandas.core.dtypes.conc... |
283700585fbd2cb333bf13b74d423e81d843155a38e449f76f53e6a5b28fa3e6 | Python | 16,177 | 448 | import pandas as pd
import numpy as np
from sklearn.model_selection import StratifiedKFold, GridSearchCV, RandomizedSearchCV
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import roc_curve, auc, make_scorer
import matplotlib.pyplot as plt
import warnings
warnings.filterwarnings('ignore')
impor... |
2fd5b2f2f079a13b2e60943d34163844810059705c9674ce1f723fb719086d99 | Python | 16,177 | 465 | """
A verbatim copy (vendored) of the spec from https://github.com/data-apis/dataframe-api
"""
from __future__ import annotations
from abc import (
ABC,
abstractmethod,
)
import enum
from typing import (
TYPE_CHECKING,
Any,
TypedDict,
)
if TYPE_CHECKING:
from collections.abc import (
... |
3c2077b61556462481a301ada6fd5e9483c573e1af12a85988d8190fb6f4bc17 | Python | 16,185 | 489 | """
The main purpose of this module is to expose LinkCollector.collect_sources().
"""
from __future__ import annotations
import collections
import email.message
import functools
import itertools
import json
import logging
import os
import urllib.parse
import urllib.request
from collections.abc import Iterable, Mutabl... |
c22a895fdd6edf9f820cb0fad271d626e1d911e71b5c727d243d06c27c00007a | Python | 16,190 | 414 | import importlib
import time
import pytest
import numpy as np
from numpy.f2py.crackfortran import markinnerspaces, nameargspattern
from . import util
from numpy.f2py import crackfortran
import textwrap
import contextlib
import io
class TestNoSpace(util.F2PyTest):
# issue gh-15035: add handling for endsubroutine, ... |
78ad0be1dc6121e9ea716c173209037e21ff79ee4db9a73a04b6057e83265715 | Python | 16,198 | 521 | import warnings
import numpy as np
import pandas as pd
from scipy.sparse import csr_matrix, issparse
import matplotlib.pyplot as pl
from scvelo.core import l2_norm, prod_sum, sum
warnings.simplefilter("ignore")
# TODO: Add docstrings
def round(k, dec=2, as_str=None):
"""TODO."""
if isinstance(k, (list, tu... |
27829c33e0df2c207896c1cf339c7290794dd40faa45be982f804ae7c3405244 | Python | 16,203 | 472 | import torch
import numpy as np
import os
import glob
import random
import matplotlib
import imageio
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from analysis.molecule_builder import get_bond_order
##############
### Files ####
###########-->
def save_xyz_file(path, one_hot, positions, atom_decoder, id_f... |
ec2d0d48a7ef339156a72bb1cf77446677ee6d505ec3286b48677b8f86476ce0 | Python | 16,205 | 335 | # -*- coding: utf-8 -*-
"""
Paradigm descriptors' estimation for HCP tasks
@author: Ana Luisa Pinho, ana.pinho@inria.fr
contributor: Andres Hoyos Idrobo
Last update: Jan 2017
Note: Run the script with the input csv files per subject and session under the
same directory
"""
import os
import sys
import csv
impo... |
c25781b6f6d367f5912b298045cc28e60ccee60d076b02b237dc6f6f53e869f6 | Python | 16,207 | 313 | import numpy as np
from itertools import islice
import pickle
import csv
import os
from datetime import datetime
from statsmodels.tsa.stattools import acf
from src.isttc.scripts.calculate_acf import acf_sttc, acf_pearsonr_trial_avg, acf_sttc_trial_avg, acf_sttc_trial_concat
from src.isttc.scripts.calculate_tau import ... |
c985686685c3152bd70d7d0e45663a2364db53c05690e62bb5920997f7498a8c | Python | 16,254 | 493 | from __future__ import annotations
import argparse
import csv
import datetime as dt
import json
import shlex
import shutil
import statistics
import subprocess
import sys
import time
from dataclasses import dataclass
from pathlib import Path
from typing import Iterable
@dataclass
class BenchmarkRun:
scenario: int... |
aa5ea0c4dd465819addf75bc1446c04092ab964a005c6e76f6d438d144ef0f97 | Python | 16,256 | 464 | """
Functions for running SVCA and predicting neural SVCs
from *instantaneous* behavior PCs.
"""
from joblib import Parallel, delayed
import numpy as np
import os
from scipy.stats import zscore
from sklearn.neural_network import MLPRegressor
import sys
from tqdm import tqdm
from scipy.signal import savgol_filter
from... |
db0d5481f0eebbba8792be0caebd0b12b9083979a3ca8e2f89f1b5bca88b7870 | Python | 16,262 | 559 | from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING, TypedDict
import numpy as np
import pandas as pd
from matplotlib.lines import Line2D
from matplotlib.patches import Rectangle
from cali._constants import (
EVK_NON_STIM,
EVK_STIM,
MEAN_SUFFIX,
N_SUFFIX,
... |
1c04b05dfd1443dedad8935d07f4132fec00b95e51e3667e7f66c68a6bdc5a39 | Python | 16,269 | 466 | """Utility functions for connectivity classification."""
import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from sklearn.metrics import (
accuracy_score,
roc_auc_score,
balanced_accuracy_score,
)
from sklearn.model_selection import GroupShuffleSplit, LeavePGroupsOut
from sklea... |
46b87a91de284b16ad53dab069d663abaac5b11ea426d9d2a01a1abd2ad88984 | Python | 16,273 | 386 | '''
This file modifies `graph_attention_transfomer.py` based on
some properties of data in OC20.
1. Handling periodic boundary conditions (PBC)
2. [TODO] Predicting forces
3. Using tag (0: sub-surface, 1: surface, 2: adsorbate)
for extra input information.
4. Using OC20 registry to... |
3189d07c89e9a93e99d62f38f8fc9488d0ff48264180c2e1debbd6ad77161b0e | Python | 16,279 | 453 | #!/usr/bin/env python3.11
"""Runs integration tests for ASCENT.
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 ar... |
dd103c6a709fed367cfb94401798add937be6965c100be552dab109cc882d994 | Python | 16,282 | 483 | import contextlib
import io
import os
import shlex
import shutil
import sys
import tempfile
import typing as t
from types import TracebackType
from . import _compat
from . import formatting
from . import termui
from . import utils
from ._compat import _find_binary_reader
if t.TYPE_CHECKING:
from .core import Base... |
e6aedb857b1f58a7abd6d200773e4d9d03e5a8128520a7c64e65175255a12487 | Python | 16,285 | 427 | """
Encoding of the IBC data from the Clips and Raiders tasks
using the fast-shared response model (FastSRM)
Authors: Ana Luisa Pinho, Hugo Richard, Bertrand Thirion
Created: October 2020
Last update: October 2022
Compatibility: Python 3.9.1
"""
import os
from time import time
from tqdm import tqdm
import numpy a... |
f2b6277428c235299c2c653f1cffd1e645084ca96ca6e98d80d0c0fcd92d5b87 | Python | 16,288 | 455 | import torch
import pytorch_lightning as pl
import torch.nn.functional as F
import numpy as np
from collections import OrderedDict
import pickle
import os
from protgps.utils.registry import get_object, register_object
from protgps.utils.classes import ProtGPS, set_protgps_type
@register_object("base", "lightning")
cl... |
80dd21b75a6bca6b183db15bba3da0f14c4a53d0fcc102d602d0068dc92c309c | Python | 16,302 | 472 | """Module for constructing the 10-10-system on the scalp surface."""
import warnings
import numpy as np
import vtk
import vtk.util.numpy_support as vnp
import xarray as xr
import pyvista as pv
import cedalion.vis.blocks as vbx
from cedalion import cite
from cedalion.dataclasses import (
Surface,
TrimeshSurf... |
8de5566a78eca65ef7c31fb7ada955a249cd44e6753c06ae4426d80a498b9ba7 | Python | 16,308 | 517 | # from python
from __future__ import annotations
import logging
from datetime import datetime
from pathlib import Path
from typing import Generator, Optional, Any
import sqlite3
# from dependencies
from sqlalchemy import (
Engine,
Connection,
MetaData,
Compiled,
Select,
Insert,
Delete,
... |
a71b87c40fb3db6a3133c3c086269b57b73d391150494d47e4fcc18b92135923 | Python | 16,309 | 415 | import pandas as pd
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline
from sklearn.model_selection import train_test_split
from sklearn.metrics import (roc_auc_score, accuracy_score,
... |
07ff48a5353ac5ddf6f4b9cb939b8c45854749e4ba7837eda35b63670738b906 | Python | 16,313 | 523 | # coding: utf-8
import argparse
import sys
import torch
def str2bool(s):
"""Helper function used in order to support boolean command line arguments"""
if s.lower() in ("true", "t", "1"):
return True
elif s.lower() in ("false", "f", "0"):
return False
else:
return s
def pars... |
0c7687a944831bb17be4fa2989611a1efe610978f399fb3500820b2587743da2 | Python | 16,317 | 407 | from __future__ import annotations
from typing import TYPE_CHECKING, TypedDict, cast
from fonticon_mdi6 import MDI6
from pyfirmata2 import Arduino
from qtpy.QtCore import QSize, Qt
from qtpy.QtGui import QPainter, QPaintEvent, QPen
from qtpy.QtWidgets import (
QDialog,
QGridLayout,
QGroupBox,
QHBoxLay... |
129eaed6d44f193b68d2fd49779a559a507c791bed45dec874a6cd4d326bbd7f | Python | 16,325 | 460 | """
Decomposition of ZX graphs into scalar graphs and JAX-compatible IR.
"""
from __future__ import annotations
from collections import defaultdict
from fractions import Fraction
from typing import Any, Dict, List, NamedTuple, Sequence, Tuple, cast
import jax.numpy as jnp
import numpy as np
from jax import Array
impo... |
db5d3cc49479f8d413cfcb48e73865492057b32916dbd7a027b1b10e9be2f5c7 | Python | 16,335 | 333 | # YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Train a YOLOv5 classifier model on a classification dataset
Usage - Single-GPU training:
$ python classify/train.py --model yolov5s-cls.pt --data imagenette160 --epochs 5 --img 224
Usage - Multi-GPU DDP training:
$ python -m torch.distributed.run --nproc_per_nod... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.