sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
75e2bd48c09512bc1f4140c5fdb73d0d31f77e1c51071b82c42e0e1dcdc6eaad | Python | 16,354 | 496 | import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
Index,
)
import pandas._testing as tm
@pytest.mark.parametrize(
"interpolation", ["linear", "lower", "higher", "nearest", "midpoint"]
)
@pytest.mark.parametrize(
"a_vals,b_vals",
[
# Ints
([1, 2, ... |
68c7e10cae7ec82a96a587495d88203c90705ee548f22a710803415257bafaf0 | Python | 16,356 | 377 | """
Script used to perform retinotopic analysis based on the IBC low-level visual
protocol.
Author: Bertrand Thirion, 2015--2017
"""
import os
import glob
from os.path import join as pjoin
import numpy as np
from nilearn.image import mean_img, math_img
from ibc_public.utils_retino import phase_maps
import nibabel as n... |
c18175527b50a20fa1f4e2fe3ce5a49eb0d546458c575730e08ef988a53076e5 | Python | 16,389 | 436 | import torch
import numpy as np
import pandas as pd
from transformers import AutoTokenizer, AutoModelForCausalLM
import random
from sklearn.utils import resample
import torch.nn as nn
import torch.optim as optim
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_rep... |
070cc26d179083f2e92bf50baa5cbcc3e414494dadeba7a986eed4f3fa076f85 | Python | 16,424 | 416 | import os
import logging
import numpy as np
import parmap
import scipy
import datetime as dt
from tqdm import tqdm
from sklearn.metrics.pairwise import cosine_similarity
from yass import read_config
from yass.visual.util import binary_reader_waveforms
#from yass.deconvolve.soft_assignment import get_soft_assignment... |
786df6922fb3b1df2b32cee623a2dcee3ff680ce066b968daa1d8cd6b4c264d0 | Python | 16,432 | 457 | from datetime import (
datetime,
timedelta,
)
import itertools
import numpy as np
import pytest
from pandas.errors import PerformanceWarning
import pandas.util._test_decorators as td
import pandas as pd
from pandas import (
Categorical,
DataFrame,
Series,
Timestamp,
date_range,
option... |
bc6a16119a91d1a10db110da59a2c10fde1cf7463ae4637670cdd84e7ded8b93 | Python | 16,435 | 423 | import random
import cv2
import numpy as np
import os.path as osp
from copy import deepcopy
from PIL import Image
import multiprocessing as mp
from multiprocessing import Pool
import albumentations as A
from albumentations.pytorch import ToTensorV2
import warnings
warnings.filterwarnings("ignore", "Corrupt EXIF data",... |
eb872282526bec47c1e544306d5f3bb190e9f561c281cf1b543c490a54b45d63 | Python | 16,445 | 497 | """Reproduction of "A Qutrit Time Crystal Stabilized with Native Chiral Interactions"
Link: https://arxiv.org/abs/2605.14293
This work shares strong conceptual similarity with https://arxiv.org/abs/2512.04577.
Description:
This script reproduces Figure 2(b) from the paper using TensorCircuit-NG.
It performs a noiseless... |
0263ed15b2b9f7d74199274f874fa45d15fc154fc596fe40123483a0d2f16cf1 | Python | 16,466 | 421 | """
prepare_data.py
===============
Single-script data preparation pipeline. Given a dataset of nrrd files,
this script performs **all** of the following in one run:
1. 5-fold cross-validation split (same seed as nnUNet).
2. Copy nrrd files into per-fold train/test directory trees.
3. Save JSON route files (ids... |
288424bc19fe3f81a69cb77348c82bcc939b4f360acf5c82e24a715e96529c0f | Python | 16,485 | 530 | """
CuPy backend. Not in the tensornetwork package and highly experimental.
"""
# pylint: disable=invalid-name
import logging
from typing import Any, Callable, Optional, Sequence, Tuple, Union
import numpy as np
import scipy
try: # old version tn compatiblity
from tensornetwork.backends import base_backend
... |
3a50b52036c9db2fea8e9f8708511145e04e1dbd3b0e794f67794c961c0c48b0 | Python | 16,495 | 466 | """ test partial slicing on Series/Frame """
from datetime import datetime
import numpy as np
import pytest
from pandas import (
DataFrame,
DatetimeIndex,
Index,
MultiIndex,
Series,
Timedelta,
Timestamp,
date_range,
)
import pandas._testing as tm
class TestSlicing:
def test_stri... |
8577ac32b1ff7a9363e8af1252d25d8a98048acdc474808a799f1559efe775c9 | Python | 16,495 | 392 | """distutils.command.build_py
Implements the Distutils 'build_py' command."""
import os
import importlib.util
import sys
import glob
from distutils.core import Command
from distutils.errors import *
from distutils.util import convert_path
from distutils import log
class build_py (Command):
description = "\"bui... |
fc402d06e3ae62afb9352cc781ba45c5d802b89bc0196c471b28b1a39d7fafdb | Python | 16,523 | 416 | import os
import sys
# Get the absolute path of the parent directory
parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.append(parent_dir) # Add parent directory to sys.path
# model
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch_geometric as tg
impor... |
3235246682471644ac7a1918e1dbb952fd219dd66bc4ab27659d6e32fc1463f9 | Python | 16,525 | 409 | # -*- coding: utf-8 -*-
import os
import random
import copy
import numpy as np
import torch
import torch.nn as nn
from tqdm import tqdm
from torch_geometric.loader import DataLoader
from sklearn.model_selection import KFold, train_test_split
from model import DualGraphRNAModel
device = torch.device('cuda... |
ed21f1f5e41a95856fcff56de751fa7c9a1df647366a3079de440ae7a27285d8 | Python | 16,548 | 371 | import pandas as pd
import taxoniq
import sqlite3
import os
import numpy as np
import sys
import time
import argparse
parser = argparse.ArgumentParser(description='RFW argparse')
parser.add_argument('--processors', type=int, default=4)
parser.add_argument('--col_info_name', type=str, default='')
parser.add_argument('... |
1d77c2ad3b5d84cfda5ed499f0b18bbe1d12e7985e777b02fc26f7de1537833f | Python | 16,586 | 511 | """Module to handle automatically loading files (iterating directories, etc)"""
# from python
import logging
from pathlib import Path
from typing import List, Optional
import os
import re
import glob
import tarfile
import multiprocessing
# from dependencies
import requests
import tqdm # type: ignore
# from other mo... |
834d8946c510cb59143c161e03f89371c3de9f00a56de2b6c76ac5935e06dd3d | Python | 16,608 | 496 | ## ...........................................................................
##
## PIMMS (Polymer Interactions in Multicomponent Mixtures)
## Alex Holehouse, Pappu Lab, Holehouse Lab
## Copyright 2015 - 2026
## ...........................................................................
## analysis_structures
##
##... |
bcc7edda56f3ec75f63a7ff0d6f2517d2d718f4dd70df6f3bc1dbc4e757d9114 | Python | 16,619 | 448 | """Dialog for importing pre-existing label TIFFs and assigning them to FOVs."""
from __future__ import annotations
from pathlib import Path
from pymmcore_widgets.useq_widgets import WellPlateWidget
from pymmcore_widgets.useq_widgets._well_plate_widget import (
DATA_POSITION,
WellPlateView,
)
from qtpy.QtCore... |
4acbc4c268cd145c1f3aac4c940f99ef6a87243b7136dbc559bb55fac6c83838 | Python | 16,638 | 469 | import numpy as np
import pytest
from pandas.core.dtypes.dtypes import ExtensionDtype
import pandas as pd
from pandas import (
DataFrame,
Timestamp,
)
import pandas._testing as tm
from pandas.core.arrays import ExtensionArray
class DummyDtype(ExtensionDtype):
type = int
def __init__(self, numeric) ... |
e59b59b3f8c39ea8dd50ae5ff32ab3f42f38f5c7e799a450e7396c40d834af00 | Python | 16,652 | 557 | """
Model evaluation and benchmarking (scRNA-seq – paul15)
Comprehensive comparison of iAODE vs. scVI-family models using
Latent Space Evaluation (LSE) metrics on a trajectory dataset.
Dataset: paul15 (hematopoietic scRNA-seq trajectory)
"""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).... |
07d575e0945b5a7c04afb044d283f926576c53f9c3b7b9dd4c62b73bc34b33f3 | Python | 16,657 | 343 | from psychopy import visual, gui, data, core, event, logging, info
from psychopy.constants import *
import numpy as np # whole numpy lib is available, prepend 'np.'
import os
from scipy.io import savemat
from config import *
def runBandit(expInfo, dispInfo, taskInfo, taskObj, keyInfo):
# Assign the instruction co... |
245a2effcc53d3e73071c64441f6a29e06a4b58f911f786b50965adbf6fbb76a | Python | 16,660 | 449 | import asyncio
import gc
import os
import sys
import threading
import pytest
import numpy as np
from numpy.testing import extbuild, assert_warns, IS_WASM, IS_EDITABLE
from numpy._core.multiarray import get_handler_name
@pytest.fixture
def get_module(tmp_path):
""" Add a memory policy that returns a false pointe... |
68b29b8c865e53a5b48652a3d776fb73d45c19753ff950dd68ec0c6b44d0c543 | Python | 16,664 | 301 | """
Reproduction script for Figure 6 of:
"Neuronal tuning aligns dynamically with object and texture manifolds across the visual hierarchy"
Nature Neuroscience, 2026
Figure 6: Geometry of tuning landscapes in BigGAN latent space (Hessian analysis).
- Panel 6C: Example bell-shaped tuning curve along a sampled cla... |
a257f2ba4fc33db7e5364278c0159eb57435edcef8c770c1e74d5d7a052fec36 | Python | 16,676 | 582 | # 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.
"""
.. testsetup::
from packaging.version import parse, Version
"""
from __future__ import annotations
import itertools
import re
fro... |
509ae3ae30ffe7e9ea68f55c8d2cfdd1d41045db577820f94336434c25468d3c | Python | 16,679 | 518 | """ test get/set & misc """
from datetime import timedelta
import re
import numpy as np
import pytest
from pandas.errors import IndexingError
from pandas import (
NA,
DataFrame,
Index,
IndexSlice,
MultiIndex,
NaT,
Series,
Timedelta,
Timestamp,
concat,
date_range,
isna,... |
a221eacd352ffe9d768698e0b0b0d571a179853ee90da48e56250d303e064d6d | Python | 16,688 | 582 | # 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.
"""
.. testsetup::
from pip._vendor.packaging.version import parse, Version
"""
from __future__ import annotations
import itertools
i... |
2d06352d6293f05429bfe2abf4cf9523d210b14768a47a52822fe538da71505b | Python | 16,742 | 481 | from datetime import datetime
from types import SimpleNamespace
import pytest
from pimms import simulation
from pimms.latticeExceptions import SimulationException
class _DummyChain:
def __init__(self, chain_id=1):
self.chainID = chain_id
self.fixed = False
self._positions = [[0, 0], [1, ... |
fe7520f5314d5c060746eb6da5fdf4605c8d3f9cd96ec43668dfc31100688aad | Python | 16,744 | 661 | #!/usr/bin/env python3
import re
import sys
import logging
import datetime
import os.path as osp
from typing import NoReturn, List, Tuple, Union, Collection
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import torch as t
from torch.utils.data import DataLoader
import stsc.datasets as D
impo... |
74410015a177b2bc772520a7a31d866c0eb48bcd56cfe656562b817aa91ab6df | Python | 16,753 | 443 | """Comprehensive tests for _RunCaliWidget using real test database."""
from pathlib import Path
import pytest
from pytestqt.qtbot import QtBot
from sqlmodel import Session, create_engine, select
from cali.gui._run_widget import _RunCaliWidget
from cali.sqlmodel._model import CaliResult, DetectionSettings, Extraction... |
857b47402b65b15bc6eed107ce90b78b48d77c0c1816342fb44b852023202279 | Python | 16,759 | 531 | """Module containing code to load and store antiSMASH CDSs"""
# from python
from __future__ import annotations
import logging
from typing import Optional, TYPE_CHECKING
import warnings
# from dependencies
from Bio.SeqFeature import SeqFeature
from Bio.Seq import Seq
from Bio import BiopythonWarning
from sqlalchemy im... |
befcac9c06d35b16412062381e2e6d8c1b5b401d1ed7402c26c29f7f7a04f903 | Python | 16,770 | 412 | # sim_renewal_multicontext.py
# Compare single-context vs multi-context extinction on ABC renewal.
from __future__ import annotations
from typing import Dict, List, Tuple
from copy import deepcopy
import numpy as np
import matplotlib
# matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.patches impor... |
618b75dbbd08d56c6d9d0a86724ff8f44098b6ba70fff957f2ac7cb7e1ae2193 | Python | 16,775 | 486 | from datetime import timedelta
import numpy as np
import pytest
from pandas._libs.tslibs.period import IncompatibleFrequency
from pandas import (
NaT,
Period,
Timedelta,
Timestamp,
offsets,
)
class TestPeriodArithmetic:
def test_add_overflow_raises(self):
# GH#55503
per = Ti... |
5c1d6ee970e6184b87b8a7591d36e88000aeebdfac837c52e798e345702591a5 | Python | 16,784 | 395 | import pathlib
from argparse import ArgumentParser, BooleanOptionalAction
import yaml
import pickle
import csv
import torch
import os
import numpy as np
import pandas as pd
from tqdm.auto import tqdm
from pytorch_lightning import seed_everything
from src.spatial_attn_lightning import BinauralAttentionModule
from c... |
032d68e554280905d3c763a8560f1950901127a98003012fe408b0ea21e05bdc | Python | 16,792 | 380 | import os
import sys
import time
import numpy as np
import torch
import logging
import argparse
import torch.nn as nn
import torch.utils
import torch.nn.functional as F
import torchvision.datasets as dset
import torch.backends.cudnn as cudnn
from torch.autograd import Variable
from braincog.model_zoo.NeuEvo.model_sear... |
1db5b4cbb28b9563f3dd023a82d138e19459179bd2f19c233372233907cd3524 | Python | 16,794 | 480 | import re
import numpy as np
import pytest
from pandas._libs.sparse import IntIndex
import pandas as pd
from pandas import (
SparseDtype,
isna,
)
import pandas._testing as tm
from pandas.core.arrays.sparse import SparseArray
@pytest.fixture
def arr_data():
"""Fixture returning numpy array with valid an... |
81b56a4d60e71d01a16aaa429d39d768277dc466832ed0b8b6bcc71eede8aa4c | Python | 16,803 | 431 | """Module with interfaces for nablaDFT's Hamiltonian Databases.
Create torch HamiltonianDataset object and get a DataLoader:
"""
import math
import multiprocessing
import os
from typing import List, Sequence, Tuple, Union
import apsw # way faster than sqlite3
import numpy as np
import torch
from torch.utils.data im... |
ba58eec9c503d7a03abb719d92dbd9c17754dea30a3df14b14c8189815f8cd05 | Python | 16,816 | 581 | from __future__ import annotations
from typing import (
TYPE_CHECKING,
Any,
Literal,
final,
)
import numpy as np
from pandas.core.dtypes.common import (
is_integer,
is_list_like,
)
from pandas.core.dtypes.generic import (
ABCDataFrame,
ABCIndex,
)
from pandas.core.dtypes.missing impor... |
0d92983e24bdcad28a7ff055a725033fd99ea5be8baed15d244a4a22e5c0991d | Python | 16,819 | 465 | #!/usr/bin/env python3
from __future__ import annotations
import os
import re
import tempfile
from collections import defaultdict
from collections.abc import Callable, Iterator
from datetime import datetime
from functools import wraps
from typing import Any, cast, TypeVar
T = TypeVar("T")
RE_GITHUB_URL_MATCH = re.... |
076e815b5e1499d02f4adae2c75e459b3fb001c23348e071c334390075d47743 | Python | 16,828 | 386 | import numpy as np
import tqdm
from standalone_utils import *
import math
import time
import ctypes as ct
class FireFlyV1ConvSchedule:
def __init__(
self,
ctrl_io,
allocate_method,
input_buffer_addr,
output_buffer_addr,
weight_data,
... |
29e3f3ef648f8a83a80fcd4a8c3e7b8979edc2880552ad583bf7040306b00db8 | Python | 16,830 | 342 | import argparse
import torch
import time
import os
import numpy as np
from gym.spaces import Box, Discrete, MultiDiscrete
from pathlib import Path
from torch.autograd import Variable
from tensorboardX import SummaryWriter
from utils.make_env import make_env
from utils.buffer import ReplayBuffer, ReplayBuffer_pre
from u... |
82f206326b5ed36f5d9eebc38c5c6e56cdb455b94406e4287f6fb18f349ee842 | Python | 16,867 | 565 | from io import StringIO
import re
from string import ascii_uppercase
import sys
import textwrap
import numpy as np
import pytest
from pandas.compat import (
IS64,
PYPY,
)
from pandas import (
CategoricalIndex,
DataFrame,
MultiIndex,
Series,
date_range,
option_context,
)
import pandas.... |
ea8003688db5bd62d23e01d5a9c9282e23c55acac65f0ef57de97b1c7c49c997 | Python | 16,871 | 563 | """
Module consolidating common testing functions for checking plotting.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as np
from pandas.core.dtypes.api import is_list_like
import pandas as pd
from pandas import Series
import pandas._testing as tm
if TYPE_CHECKING:
from ... |
8a15ae98007d6f9e481b0db792c17c83e3885203285c648993ba141d684e9642 | Python | 16,873 | 436 | import os
import sys
# Get the absolute path of the parent directory
parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.append(parent_dir) # Add parent directory to sys.path
# model
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch_geometric as tg
import... |
c8619b97c61c4a9b609b870d2fa28a2a3673660fdbe0d0d239b2577f85156340 | Python | 16,873 | 497 | from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as np
import pyqtgraph as pg
from matplotlib import colormaps
from matplotlib.colors import Normalize
from sqlmodel import Session, col, select
from cali.plot._util import disconnect_hover_handlers
from cali.sqlmodel._model import FOV, ... |
c472615844f273468a80dbf95f38b6b2df253c4344f747c4689fae420ed5586a | Python | 16,894 | 619 | import numpy as np
from scipy.stats import norm
from matplotlib import pyplot as plt
from scipy.optimize import linear_sum_assignment as optimise
from scipy.stats import linregress, gaussian_kde
import copy
from rdkit import Chem
def iterative_assignment(
picked_peaks, spectral_xdata_ppm, total_spectral_ydata, c... |
59c0d649262a49b455c8c0a75731c525854a509b9a6fc3e1d020a5bdad817689 | Python | 16,904 | 413 | import pandas as pd
from scipy.integrate import quad
from sklearn.neighbors import KernelDensity
from sklearn.model_selection import GridSearchCV
import numpy as np
from scipy.stats import ks_2samp
import datetime
import fdrcorrection
import load_save_project
import sys
import copy
np.seterr(divide='ignore',... |
dce133bf2a61e5433c08553ed09e9ade178589dafd823b1e0d47616be5a75739 | Python | 16,910 | 426 | import h5py
import numpy as np
import os
import pandas as pd
import pathlib
from pathlib import Path
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
... |
6fb0fa1100f9d9e5339f5afa1655ebe2d767b2bfc7862f0cf2423c981d570e8e | Python | 16,915 | 506 | #!/usr/bin/env python3
from __future__ import annotations
import concurrent.futures
import functools
import itertools
import os
import re
import sysconfig
from pathlib import Path
from typing import Any
# We also check that there are [not] cxx11 symbols in libtorch
#
# To check whether it is using cxx11 ABI, check n... |
bebe640b4231c9046402bb201f4fe2f952120299e48d060013fdf06bd61976e9 | Python | 16,916 | 462 | import numpy as np
np.random.seed(1)
import tkinter as tk
import time
from PIL import ImageGrab
UNIT = 40 # pixels
MAZE_H = 9 # grid height
MAZE_W = 4 # grid width
class Maze2(tk.Tk, object):
def __init__(self):
super(Maze2, self).__init__()
self.action_space = ['u', 'd', 'l', 'r']
se... |
a5f078f12088f8da0d909d1b4e7b1a07a0e2ea8dc76f19c954b4aa65e5ed0298 | Python | 16,923 | 422 | """Cache one Replogle batch for propensity-score sensitivity analyses.
The final ``gcate_lfc_batch`` cache intentionally contains only result tables.
This script regenerates one focal batch, caches its nuisance predictions, and
then reuses the cached outcome predictions across a small propensity grid.
"""
from __futu... |
5f8abd30f12cd38fc565495d3300d62418afd046b0815a873cc6d6d200aaf535 | Python | 16,929 | 476 | import numpy as np
np.random.seed(1)
import tkinter as tk
import time
from PIL import ImageGrab
UNIT = 40 # pixels
MAZE_H = 9 # grid height
MAZE_W = 4 # grid width
class Maze2(tk.Tk, object):
def __init__(self):
super(Maze2, self).__init__()
self.action_space = ['u', 'd', 'l', 'r']
se... |
c9c7341cdb01acac4f03cf05210b6eaee328b41b6a25ca3ea693b535913825a2 | Python | 16,942 | 521 | from datetime import (
datetime,
timedelta,
)
from io import StringIO
import numpy as np
import pytest
from pandas._config import using_pyarrow_string_dtype
from pandas import (
NA,
Categorical,
CategoricalIndex,
DataFrame,
IntervalIndex,
MultiIndex,
NaT,
PeriodIndex,
Seri... |
87353a120d682aa85854c4a33148beaedde51921ec0fbcfdb699fc6199dd53a5 | Python | 16,962 | 526 | """Contains a class for a BGC record, a common set of qualifiers/attributes amongst the
AntiSMASh genbank records
"""
# from python
from __future__ import annotations
from typing import Optional, Sequence, TYPE_CHECKING, Generator
import logging
# from dependencies
from Bio.SeqFeature import SeqFeature
# from other ... |
7ac8aac4fca3757020bd077705fa9cba13a3fc54032091fad343a4269baf5d37 | Python | 16,981 | 424 | # Copyright 2024 RADar-AZDelta
# SPDX-License-Identifier: gpl3+
"""Holds the ETL abstract base class"""
import json
import logging
import time
from abc import ABC, abstractmethod
from pathlib import Path
from polars import DataFrame, DataType, Datetime, Float64, Int64, Utf8, col, element, lit, read_csv, when
class... |
c8a458752068084eee8ad64d5c0b17cc891013ac3d3a03194647aa402cf935d3 | Python | 16,985 | 377 | # ------------------------------------------------------------------------------
# 3_analysis.py
# Author: Dr. Timo Hofsähs
#
# Copyright © 2024 Charité Universitätsmedizin Berlin.
# This software is licensed under the terms of the European Union Public License
# (EUPL) version 1.2 or later.
# https://joinup.ec.europ... |
d2d1671c867e3d8db46b6f835be15abc097f3d5e2678b634e15c118951d7b76f | Python | 16,999 | 453 | from causarray.utils import *
from causarray.utils import _filter_params
import contextlib
import numpy as np
import statsmodels as stats
import statsmodels.api as sm
from sklearn.linear_model import LinearRegression
from joblib import Parallel, delayed
from tqdm import tqdm
warnings.filterwarnings('ignore')
from cau... |
a7f21ac44d574c88cf1b22064de626de58ee633807fd21b7154ba8b75e263de0 | Python | 17,006 | 435 | import os
import sys
# Get the absolute path of the parent directory
parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.append(parent_dir) # Add parent directory to sys.path
# model
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch_geometric as tg
import... |
ebccc54e4b966b28c5cf8d0f75805e929c90b6dd31d67ce9fea9903c4161cdd0 | Python | 17,007 | 397 | # YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Image augmentation functions
"""
import math
import random
import cv2
import numpy as np
import torch
import torchvision.transforms as T
import torchvision.transforms.functional as TF
from utils.general import LOGGER, check_version, colorstr, resample_segments, segment... |
a793796f92d8d49d29c0309b8eed10b76f306750ddd8e7d9d5d478b698621456 | Python | 17,009 | 460 | # pylint: disable-msg=W0611, W0612, W0511,R0201
"""Tests suite for MaskedArray & subclassing.
:author: Pierre Gerard-Marchant
:contact: pierregm_at_uga_dot_edu
:version: $Id: test_subclassing.py 3473 2007-10-29 15:18:13Z jarrod.millman $
"""
import numpy as np
from numpy.lib.mixins import NDArrayOperatorsMixin
from n... |
66b3a3abf202f6936671a63166a998d4c22441c9211be2c3185a230aefda90cb | Python | 17,012 | 550 | import os
import sys
# 把当前文件所在文件夹的父文件夹路径加入到PYTHONPATH
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import imageio
from env_poly_SNN import Maze
from env_two_poly_SNN import Maze2
import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
from sklearn.pre... |
67b21e50abb7218c8381e007181f3ea477a37ad77c58facbe8a469e53c6e66fa | Python | 17,012 | 420 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# --------------------------------------------------------
# References:
# GLIDE: https://github.com/openai/glide-text2im
#... |
dcbf22fcedf934cb8da27c892a982a2c5aff75964f04bfd46d70a5b5a347cc74 | Python | 17,026 | 465 | """
Quantum circuit class but with density matrix simulator
"""
# pylint: disable=invalid-name
from functools import reduce
from operator import add
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple
import numpy as np
import tensornetwork as tn
from . import gates
from . import channels
from .... |
992f894c30becb6fcf0a72945ebdfee3770834ffc2d14920493d396b3e095874 | Python | 17,039 | 340 | """
Script loads monkey spiking data.
"""
import pickle
import csv
import numpy as np
import pandas as pd
import os
from src.isttc.scripts.cfg_global import project_folder_path
from src.isttc.scripts.spike_train_utils import bin_spike_train_fixed_len
def prep_data_for_csv(units_l, n_units):
unit_id_l, trial_id_l... |
11e2fcccd6ccb6bbce6dd109b6a8e41bfbc8b28404f330d9888476747cc728f2 | Python | 17,042 | 583 | """
Extend pandas with custom array types.
"""
from __future__ import annotations
from typing import (
TYPE_CHECKING,
Any,
TypeVar,
cast,
overload,
)
import numpy as np
from pandas._libs import missing as libmissing
from pandas._libs.hashtable import object_hash
from pandas._libs.properties impor... |
54e4cc665c9b2b8fa8998770faba2e7d162641df6a27eaf295d7229b47f2c3fc | Python | 17,043 | 526 | from __future__ import annotations
import ctypes
import re
from typing import Any
import numpy as np
from pandas.compat._optional import import_optional_dependency
from pandas.errors import SettingWithCopyError
import pandas as pd
from pandas.core.interchange.dataframe_protocol import (
Buffer,
Column,
... |
ea354ed14111622613577fe214115f9d1850fbe821cdf3a2d2869c2111d4251d | Python | 17,077 | 585 | #!/usr/bin/env python
# coding: utf-8
try:
get_ipython # type: ignore
except NameError:
def get_ipython():
class _DummyShell:
def run_line_magic(self, *args, **kwargs):
pass
def run_cell_magic(self, *args, **kwargs):
pass
def magic(s... |
659f4d8f534ed9902bd85dd0807a8166f046526fdab0d4f32577084d3d7671ae | Python | 17,079 | 400 | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 19 11:14:15 2024
@author: lindseyb
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['ps.fonttype'] = 42
matplotlib.rc('font',**{'family':'sans-serif','sans-serif':['Arial']})
import pats... |
843261e0c87263fa7ea0a9457187106954110efe86326046b96f728f1c9e7a33 | Python | 17,081 | 518 | """
TLS with SNI_-support for Python 2. Follow these instructions if you would
like to verify TLS certificates in Python 2. Note, the default libraries do
*not* do certificate checking; you need to do additional work to validate
certificates yourself.
This needs the following packages installed:
* `pyOpenSSL`_ (teste... |
97fd4655100a7bf1c5631b98f8f288dd2e6b9a4d0b254d05ef24f1c01aae685c | Python | 17,093 | 489 | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 13 19:21:32 2025
Modified on Mar 03 2026
- Add circular barplot
@author: Ruan
"""
import h5py
import numpy as np
import pandas as pd
from sklearn.cluster import AgglomerativeClustering
from sklearn.metrics.pairwise import cosine_distances
import matplotl... |
17f279fbb8fd76fb24204ef3d413077138947566ac3ccb8a5d1444176a98ffdf | Python | 17,095 | 482 | import sys
import pytest
import numpy as np
from numpy import (
logspace, linspace, geomspace, dtype, array, arange, isnan,
ndarray, sqrt, nextafter, stack, errstate
)
from numpy._core import sctypes
from numpy._core.function_base import add_newdoc
from numpy.testing import (
assert_, assert_equal, as... |
d877e34e0a4486b2545dabd8cf65e0bc501ee06c60783764cbea67cc196da9e6 | Python | 17,118 | 349 | import numpy as np
import random
import math
import matplotlib.pyplot as plt
import scipy.io as scio
import pandas as pd
import torch
import tqdm
device = 'cuda:3'
trail = 5
version = 4
scale = 0.1
class brain_model():
def __init__(self, W):
self.weight_matrix = W.to(device)
self.distance_matrix ... |
e4a541d57735a9304e0ab8532f49b2fb7e8da03503468cf36796d5d28c892d59 | Python | 17,120 | 481 | import numpy as np
import pytest
from pandas import (
Categorical,
DataFrame,
option_context,
)
import pandas._testing as tm
from pandas.tests.copy_view.util import get_array
@pytest.mark.parametrize(
"replace_kwargs",
[
{"to_replace": {"a": 1, "b": 4}, "value": -1},
# Test CoW sp... |
f10cc31d4b6512e99447020dde072ee3cd4aaaa29ae412605acd9b835e3f5b5b | Python | 17,120 | 404 | # YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Logging utils
"""
import os
import warnings
from pathlib import Path
import pkg_resources as pkg
import torch
from torch.utils.tensorboard import SummaryWriter
from utils.general import LOGGER, colorstr, cv2
from utils.loggers.clearml.clearml_utils import ClearmlLogger... |
8596a95bac673bb1117b8d26737b41f67b8579b1e6bd219901e37d1ac291a142 | Python | 17,163 | 522 | """module containing a test for loading files"""
# from python
from unittest import TestCase
from pathlib import Path
# from dependencies
from Bio.SeqFeature import SeqFeature, FeatureLocation
from Bio.SeqRecord import SeqRecord
# from other modules
from big_scape.enums import SOURCE_TYPE
import big_scape.enums as b... |
efe563721cd8bdee04b29833e0380bf3553a521f5f920fe80bf1bc1560787934 | Python | 17,201 | 483 | from typing import Any, Callable, Dict, Tuple, Union
import pytorch_lightning as pl
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from torch.optim import Optimizer
from torch.optim.lr_scheduler import LRScheduler
from torch_geometric.utils import to_dense_batch
@torch.ji... |
0daec92021778a2e4b9ff9c96836c3dc6842484cc4105cc4f1e32d678f6acc5f | Python | 17,205 | 625 | """
Utility functions
"""
try:
from pathlib2 import Path
except ImportError:
from pathlib import Path
try:
# py3
from inspect import signature
from inspect import _empty
except ImportError:
# py2
from funcsigs import signature
from funcsigs import _empty
import yass
import sys
import l... |
1f64baccc7fc0ebbe9ebc930465ec6917bb79ebbc947afa051c39ff2cc55a7e6 | Python | 17,208 | 559 | # pylint: disable=invalid-name
import os
import sys
from functools import partial
import pytest
from pytest_lazyfixture import lazy_fixture as lf
from scipy import optimize
import tensorflow as tf
import jax
from jax import numpy as jnp
thisfile = os.path.abspath(__file__)
modulepath = os.path.dirname(os.path.dirname... |
a89f1eccdd16e26e710a3558aaee77976156d779de5cec74cf2331bfce409be2 | Python | 17,211 | 416 | """Click parameter that are shared between multiple BiG-SCAPE modules"""
# from python
import click
from multiprocessing import cpu_count
from pathlib import Path
import big_scape.paths as bs_paths
# from this module
from .cli_validations import (
validate_profiling,
validate_not_empty_dir,
validate_inpu... |
adbcab10ac2ec68b6b0018afe8999bf4937a93aac25ddf7d38dac466fd886d72 | Python | 17,212 | 544 | # ---------------------------------------------------------------------
# JSON normalization routines
from __future__ import annotations
from collections import (
abc,
defaultdict,
)
import copy
from typing import (
TYPE_CHECKING,
Any,
DefaultDict,
)
import numpy as np
from pandas._libs.writers i... |
202135456f6781f8bc2d8110a9401c488bb8305758920767e9e3eb6eac16646f | Python | 17,215 | 431 | import random
import numbers
import math
import collections
import numpy as np
from PIL import ImageOps, Image
from joblib import Parallel, delayed
import torch
import torchvision
from torchvision import transforms
import torchvision.transforms.functional as F
class Cutout(object):
"""Randomly mask ou... |
791d22fd1fd83283e2961de9af4b9d082f2a0b22909c8598f46c7814b6b45dce | Python | 17,243 | 502 | """Functionality to work with segmented MRI scans."""
from typing import List
import os
import numpy as np
import nibabel as nib
import trimesh
import xarray as xr
import scipy.ndimage
import scipy.signal
from skimage.measure import marching_cubes, label, regionprops
from skimage.morphology import remove_small_object... |
e38b7d4141d3c2847b292b1f21741cfe7827dec832ae579fef04e368c51bd77c | Python | 17,247 | 413 | # 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.
"""Implementation of the CASSIS method for the motif-based prediction of SM cluster regions"""
from collections import defaultdict
from functools import reduce
import log... |
511efccd6fd79bc099faa05d07e73a45785aaf7ab7f1cbd11ef81ce876f73c96 | Python | 17,248 | 436 | import sys
import os
import yaml
import h5py
import torch
from pathlib import Path
import numpy as np
import argparse
from argparse import ArgumentParser
import itertools
import src.audio_transforms as at
from src.spatial_attn_lightning import BinauralAttentionModule
from src.spatial_attn_architecture import ECDFGa... |
6ca63314985f4a99275460fda7020c1708239750f794be290e1fd2b68c88ca7a | Python | 17,268 | 560 | from __future__ import annotations
import contextlib
import re
import sys
from typing import TYPE_CHECKING, Literal, cast
from qtpy.QtCore import QElapsedTimer, QObject, Qt, QTimer, Signal
from qtpy.QtWidgets import (
QCheckBox,
QDialog,
QDialogButtonBox,
QFileDialog,
QFrame,
QGridLayout,
... |
7819887145daab82a0522d4e44f15a18de47f882ca59851f2fe8939e55ca2c64 | Python | 17,299 | 324 | import numpy as np
from utils.util import get_dim_from_space
from utils.segment_tree import SumSegmentTree, MinSegmentTree
def _cast(x):
return x.transpose(2, 0, 1, 3)
class RecReplayBuffer(object):
def __init__(self, policy_info, policy_agents, buffer_size, episode_length, use_same_share_obs, use_avail_act... |
3214661771b4fb976807a5ea0ae342bc721772052f6be3ae943c094408d9cc76 | Python | 17,330 | 425 | """distutils.cygwinccompiler
Provides the CygwinCCompiler class, a subclass of UnixCCompiler that
handles the Cygwin port of the GNU C compiler to Windows. It also contains
the Mingw32CCompiler class which handles the mingw32 port of GCC (same as
cygwin in no-cygwin mode).
"""
# problems:
#
# * if you use a msvc com... |
ccf75135d29fa3b4d503bc5ec0f8371ac1ff39b48becf4de61eeb19277d36f99 | Python | 17,335 | 280 | import pickle
import time
import numpy as np
import torch
import matplotlib.pyplot as plt
import seaborn as sns
from matplotlib import gridspec
from AbstractLayerBMM import AbstractLayerBMM
from EvolvableNeuralUnitStacked import EvolvableNeuralUnitStacked
from Tools import get_data_path
sns.set_style("d... |
dd9138360b33dc0b52bd1d49b03960e86c30336034e35c423ecce1906e34902c | Python | 17,340 | 390 | from __future__ import annotations
import logging
from enum import Enum
from typing import List, Iterator, Dict, Callable, Union
from abc import ABC, abstractmethod
import itertools
import copy
import re
from .utils import remove_quotes, process_knowledge_ids, apply_function
from escargot.operations.thought import Tho... |
7ec19a3d04f0a608dd76896c5e71207be6be366dfc897381e7ad2ce85b9080f0 | Python | 17,349 | 355 | '''
Created on 2014.11.13
@author: Liang Qian
'''
import sys
from .dendrite import Dendrite
sys.path.append('../')
from data import globaldata as Global
from .thalamus import Thalamus
from .cortex import Cortex
from .layer import Layer
from .synapse import Synapse
from braincog.base.node.node import *
class Cortex_T... |
51c058e765aa4c4ced0466db8168d0f4dddef77ab11fea18601126ac210b5687 | Python | 17,361 | 433 | import os
import pandas as pd
import numpy as np
from pprint import pprint
# torch:
import torch
from torch.utils.data import Dataset, DataLoader, TensorDataset,random_split
from torch.optim.lr_scheduler import ExponentialLR, CosineAnnealingWarmRestarts
from transformers import AdamW #, #get_cosine_schedule_with_warmu... |
eec47575ad8a1600f7d67cef50c3b9768a7b0c99ccc2b9c182d091642f8364e1 | Python | 17,369 | 505 | import numpy as np
import torch,os,sys
from torch import nn
from torch.nn import Parameter
import abc
import math
from abc import ABC
import numpy as np
import torch
from torch import nn
from torch.nn import Parameter
import torch.nn.functional as F
import matplotlib.pyplot as plt
from braincog.base.strat... |
55cc5c4718e40b3a98b23da473db49a7b6fbfa50634f97e309f6d612133e41d0 | Python | 17,382 | 469 | # Robustness of enhanced fear learning following activation of the model's stress effects.
from __future__ import annotations
from typing import List, Tuple
from copy import deepcopy
import numpy as np
import gc
from model.model import AmygdalaEngrams, Phase
from utils.util import online_learning, gen_random_simple_pa... |
16197c6f5c2d4888893f023bcb1560343d7f093bf9e99191028d5f70a9830c46 | Python | 17,388 | 512 | # Script to run germline:somatic experiment P-NET on pre-formatted prostate germline and/or somatic data
# Author: Gwen Miller
# 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... |
96a1307c4e91bdbd1520143d545e64faa9cf2b0aae210789b36f538774cee904 | Python | 17,390 | 481 | # -*- 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 import decomposition
from sklearn.linear_model import LogisticRegression
from sklearn.linear_model import LinearRegression
from sklearn.metrics import roc_auc_score
import... |
32f0c979c37ea6c6655ba1deaa615a3385857306f1f1eb20d7ab3008bfe429f5 | Python | 17,395 | 267 | from __future__ import division
import viz
import vizact
import vizjoy
import datetime
import viztask
import vizinput
import math
import sys
import os
sys.path.insert(0,os.path.realpath('.\py'))
# ---------------------------------------------------------------------------------------------... |
37152a59a6cc57186ff39b4aa81bbc240029b40a44abf6af93ac1b9cde3ac6d2 | Python | 17,396 | 547 | from __future__ import annotations
from functools import wraps
from typing import (
TYPE_CHECKING,
Any,
Literal,
cast,
overload,
)
import numpy as np
from pandas._libs import lib
from pandas._libs.arrays import NDArrayBacked
from pandas._libs.tslibs import is_supported_dtype
from pandas._typing i... |
663e8f4b22370db8bf6903e1632153cff7168bd9bc908b9bc08b6ae7b24d0854 | Python | 17,400 | 512 | from __future__ import annotations
import re
from typing import TYPE_CHECKING
import numpy as np
from pandas.util._decorators import Appender
from pandas.core.dtypes.common import is_list_like
from pandas.core.dtypes.concat import concat_compat
from pandas.core.dtypes.missing import notna
import pandas.core.algori... |
12a2764890291994ef2f750cde8e500a1e629242769e6cf3ac41e27c91ba6a45 | Python | 17,432 | 470 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 25 20:29:36 2019
@author: wanxiang.shen@u.nus.edu
main aggmap code
"""
from molmap.utils.logtools import print_info, print_warn, print_error
from molmap.utils.matrixopt import Scatter2Grid, Scatter2Array, smartpadding
from molmap.utils import sum... |
225345bef76e1b303b2a10271c4dc12d136d00ec69f0dd0da0f8a440af61f739 | Python | 17,440 | 485 | from datetime import datetime
from typing import Callable, Union, Tuple, Dict
import os
import numpy as np
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
import torch.nn as nn
from torch.nn.parallel import DistributedDataParallel
from tqdm import tqdm
from random import randint
from ... |
c4d654d9ef88c609754efbe6e1ac57c22cb4ca0e6e4b5e9fb18885b544136fa0 | Python | 17,443 | 450 | from pathlib import Path
from time import time
import argparse
import shutil
import random
import matplotlib.pyplot as plt
import seaborn as sns
from tqdm import tqdm
import numpy as np
from Bio.PDB import PDBParser
from Bio.PDB.Polypeptide import three_to_one, is_aa
from rdkit import Chem
from scipy.ndimage import ... |
314871f445610aea3e7d3398447da7ce1407f22a7dfb941a34c8c43d6c7e348e | Python | 17,447 | 504 | from copy import (
copy,
deepcopy,
)
import numpy as np
import pytest
from pandas.core.dtypes.common import is_scalar
from pandas import (
DataFrame,
Index,
Series,
date_range,
)
import pandas._testing as tm
# ----------------------------------------------------------------------
# Generic t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.