sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
5b092908e23c6fd8f9af19212ff0e1e65fbb11d90715f4a3208c7e401b1e7dad | Python | 17,449 | 657 | """
Misc tools for implementing data structures
Note: pandas.core.common is *not* part of the public API.
"""
from __future__ import annotations
import builtins
from collections import (
abc,
defaultdict,
)
from collections.abc import (
Collection,
Generator,
Hashable,
Iterable,
Sequence,
... |
71abae5290f25813809b09af6929de856baf7b95e916d1a8363db1b84170769e | Python | 17,453 | 472 | from copy import deepcopy
import numpy as np
import pytest
from pandas.errors import PerformanceWarning
import pandas as pd
from pandas import (
DataFrame,
Index,
MultiIndex,
Series,
concat,
)
import pandas._testing as tm
class TestIndexConcat:
def test_concat_ignore_index(self, sort):
... |
403bae4f13d20a3d6b62d678c690fb531fabdb44c3e74687caa2b2850ec1ab80 | Python | 17,460 | 504 | from __future__ import absolute_import
import hashlib
import hmac
import os
import sys
import warnings
from binascii import hexlify, unhexlify
from ..exceptions import (
InsecurePlatformWarning,
ProxySchemeUnsupported,
SNIMissingWarning,
SSLError,
)
from ..packages import six
from .url import BRACELES... |
67d098776251e8fd359b54bb8b852638a9860c8b0df038603ec0bbe9efacc7ef | Python | 17,472 | 390 | 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... |
e80e44accbdd368a1323dd4cd6a915e9158bd41f5b375249823b9eab6411bdd5 | Python | 17,493 | 563 | from __future__ import annotations
from typing import (
TYPE_CHECKING,
Literal,
)
import numpy as np
from pandas._libs import lib
from pandas._libs.tslibs import is_supported_dtype
from pandas.compat.numpy import function as nv
from pandas.core.dtypes.astype import astype_array
from pandas.core.dtypes.cast ... |
727b94795509ec246f16885a84c1d1acf745e62ce8d3eb76c3c3da7b9461a5fd | Python | 17,494 | 424 | from __future__ import division, print_function
import cairosvg
import torch
from profilehooks import profile
from sklearn.metrics import mean_squared_error
from math import sqrt
import torch.nn as nn
import torch.optim as optim
from torch.optim import lr_scheduler
import torchvision
from torchvision import datasets,... |
d09870043a738d74378b95c08865871f60bbd264b0c68749677f59fe438140c0 | Python | 17,497 | 390 | parent_path = r'/.../baselines'
import sys
sys.path.append(parent_path)
from torch_geometric.loader import DataLoader
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from tqdm import tqdm
from utils import BrainIBDataset
from BRAINIB.BrainIB_V2.SGSIB.GNN import GNN
from BRAINIB.Bra... |
c5392e58dbb9d4116270805ac5ab4c200b11c12d689ac6fa824abc5e394689d2 | Python | 17,501 | 497 | import datetime
import logging
from pathlib import Path
from fastapi.exceptions import HTTPException
from fastapi_mail import ConnectionConfig, FastMail, MessageSchema
from pydantic import EmailStr
from starlette import status
from app.models.user import (
UserPublic, # Assuming UserPublic contains non-sensitive... |
adfe38dc9d45c2cce22fc85b451caf55a2172116a05910c4b0b4dff47280463e | Python | 17,502 | 390 | from functools import partial
import unittest
import warnings
import torch
import torchdiffeq
from problems import (construct_problem, PROBLEMS, DTYPES, DEVICES, METHODS, ADAPTIVE_METHODS, FIXED_METHODS, SCIPY_METHODS, IMPLICIT_METHODS)
def rel_error(true, estimate):
return ((true - estimate) / true).abs().max(... |
a9e579b242696944d9271deb579df6732f05547bca5bf61f7743355aefee8b95 | Python | 17,503 | 436 | import numpy as np
import torch
import torch.nn as nn
from torch.nn import *
import torch.nn.functional as F
from torch import einsum
from einops import rearrange
# from braincog.model_zoo.base_module import DeformConvPack
from braincog.model_zoo.base_module import BaseLinearModule
# from mmcv.ops import ModulatedDef... |
e64bb7c5ee06bf9f9e006872ab02a3e3ad26aa81ef339affaac1aee8ff09d1eb | Python | 17,510 | 537 | """Tests for laguerre module.
"""
from functools import reduce
import numpy as np
import numpy.polynomial.laguerre as lag
from numpy.polynomial.polynomial import polyval
from numpy.testing import (
assert_almost_equal, assert_raises, assert_equal, assert_,
)
L0 = np.array([1])/1
L1 = np.array([1, -1])/1
L2 =... |
ee6b249a5af8d628b90c8f084244838c0bfa710395b749c99b1831767cafc7d6 | Python | 17,517 | 439 | import gym
from gym import spaces
from gym.envs.registration import EnvSpec
import numpy as np
from .multi_discrete import MultiDiscrete
# update bounds to center around agent
cam_range = 2
# environment for all agents in the multi agent world
# currently code assumes that no agents will be created/destroyed at runt... |
60a6711049d892b1110f9cba359c4be12c75977ca4777322c45883bd2b6a9a6c | Python | 17,521 | 474 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 1 13:49:20 2021
@author: AdminCOOP
"""
from molmap.utils.logtools import print_info, print_warn, print_error
from molmap.utils.matrixopt import Scatter2Grid, Scatter2Array, smartpadding
from molmap.utils import summary, calculator
from molmap.u... |
a061eb261f466fa93c0a0835887355a09b9a9a4207aa7cece44a14fd7758f613 | Python | 17,523 | 576 | from datetime import datetime
import numpy as np
import pytest
from pandas.errors import MergeError
import pandas as pd
from pandas import (
DataFrame,
Index,
MultiIndex,
date_range,
period_range,
)
import pandas._testing as tm
from pandas.core.reshape.concat import concat
@pytest.fixture
def f... |
cae89700a9592797372e48cfcc596d00a1509a156a68195e889ee7cd7b38fde0 | Python | 17,534 | 493 | from datetime import (
datetime,
timedelta,
)
from hypothesis import (
assume,
given,
strategies as st,
)
import numpy as np
import pytest
from pandas import (
Index,
RangeIndex,
)
import pandas._testing as tm
class TestRangeIndexSetOps:
@pytest.mark.parametrize("dtype", [None, "int6... |
d9068d60a1f6f5c543f92e1860121005dd7143d6dcd8ea877594fac92ed3c639 | Python | 17,544 | 376 | import numpy as np
from numpy.testing import assert_array_equal, assert_equal, assert_raises
import pytest
from itertools import chain
def test_packbits():
# Copied from the docstring.
a = [[[1, 0, 1], [0, 1, 0]],
[[1, 1, 0], [0, 0, 1]]]
for dt in '?bBhHiIlLqQ':
arr = np.array(a, dtype=dt)... |
e21daf2ee6065e3b1d7b8cc6043fe25381ffe96ba61ee33b3059a3931daf3bc9 | Python | 17,544 | 400 | import pandas as pd
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA
from sklearn.manifold import TSNE
import matplotlib.pyplot as plt
from datetime import datetime
import numpy as np
from tqdm import tqdm
from sklearn.metrics import silhouette_score
from matplotlib.lines import Li... |
58a5536e9aaaddc0cdb10e41ad02a0444841dcce9392a60be35d06fc77f6452e | Python | 17,546 | 285 | import numpy as np
HARTREE_TO_KCAL_MOL = 627.5094738898777
EV_TO_KCAL_MOL = 23.060548012069496
BOHR_TO_ANGSTROM = 0.5291772105638411
fragment_info = {
"ALA": ("AA", 0, 1),
"ARG": ("RR", 1, 1),
"ASP": ("DD", -1, 1),
"CYS": ("CC", 0, 1),
"CYX": ("CYX", 0, 1),
"GLN": ("QQ", 0, 1),
"GLY": ("GG... |
b651d8c94e913fd1120faf777785a90d434fd21abb31a4d99e6ead2c95d2abdf | Python | 17,547 | 461 | from __future__ import annotations
from typing import (
TYPE_CHECKING,
Any,
)
import numpy as np
from pandas._libs.lib import infer_dtype
from pandas._libs.tslibs import iNaT
from pandas.errors import NoBufferPresent
from pandas.util._decorators import cache_readonly
from pandas.core.dtypes.dtypes import Ba... |
f7e90ce1a82aa3fa8514f495002a65d73a0ce43d3a6e2540414a0350af766340 | Python | 17,554 | 639 | from __future__ import annotations
from decimal import Decimal
import operator
import os
from sys import byteorder
from typing import (
TYPE_CHECKING,
Callable,
ContextManager,
cast,
)
import warnings
import numpy as np
from pandas._config.localization import (
can_set_locale,
get_locales,
... |
84f9b11400b3f0a6d8847236c477e241d179e83c3ce276a66a572fe4217694ec | Python | 17,562 | 539 | #!/usr/bin/env python3
"""
validate.py — repo-local validation for dc_atlas (single default mode)
What it does (always):
- Validates JSON syntax + JSON Schema conformance (schemas/*.schema.json).
- Validates that file paths referenced by JSONs exist in the repo tree.
- Is git-annex / GIN compatible:
* Broken symli... |
4a7653a9281aacf8c70054a7c8b09265ebce04cc9735bd77400008faacf46757 | Python | 17,566 | 510 | from datetime import (
datetime,
timedelta,
)
import numpy as np
import pytest
from pandas._libs.algos import (
Infinity,
NegInfinity,
)
from pandas import (
DataFrame,
Index,
Series,
)
import pandas._testing as tm
class TestRank:
s = Series([1, 3, 4, 2, np.nan, 2, 1, 5, np.nan, 3])... |
db0144e3953d48ef5ee8c18574534e3ba17b95f361770dad816b644243a2001d | Python | 17,569 | 459 |
import torch
from torch import nn
from einops import rearrange, repeat
from timm.models.layers import trunc_normal_
from Models.BolT.util import windowBoldSignal
def max_neg_value(tensor):
return -torch.finfo(tensor.dtype).max
class PreNorm(nn.Module):
def __init__(self, dim, fn):
super().__init__... |
cd9a21ffeb680604b8aa3d2bcb3e3a579cb6f9fc5d3d62178400c48a2a55fba6 | Python | 17,605 | 597 | import argparse
import os
import pwd
from pytorch_lightning import Trainer
import itertools
from protgps.utils.registry import md5
import json
import copy
from protgps.utils.classes import set_protgps_type
EMPTY_NAME_ERR = 'Name of augmentation or one of its arguments cant be empty\n\
Use "name/arg1=... |
4d22cbc8294b306ab65df7e914b9ca411dfd46287b9a5e71724252b0047777e6 | Python | 17,627 | 528 | """Calcium peaks related bar plots for multi-well analysis.
This module provides bar plot visualizations for calcium peak metrics:
- Amplitude
- Frequency
- Inter-event interval (IEI)
- Calcium population burst count, average duration, and average interval
"""
from __future__ import annotations
import logging
import... |
a24e319ea5a19ed227db581c3dad4a6195916136f0b040a9a2df8469ce3ba85b | Python | 17,632 | 463 | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import io
import re
import socket
from gunicorn.http.body import ChunkedReader, LengthReader, EOFReader, Body
from gunicorn.http.errors import (
InvalidHeader, InvalidHeaderName, NoMoreData,
InvalidRequest... |
e1793ae2a2243c1b74f40e6af9120552e0e135cf665e29556a99bb5a7627cd1c | Python | 17,632 | 519 | """
This module uses ctypes to bind a whole bunch of functions and constants from
SecureTransport. The goal here is to provide the low-level API to
SecureTransport. These are essentially the C-level functions and constants, and
they're pretty gross to work with.
This code is a bastardised version of the code found in ... |
3ab0c06cf6a1cdba551684991dc1324da45c0f7600df06e62dcf7b638e8bc1ee | Python | 17,640 | 446 | # -*- coding: utf-8 -*-
#
# train.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/... |
04aaf4108bbc83568b885e9afe0eb5cc5d8d1cf558f0297a09170d9c72d0ff8a | Python | 17,646 | 563 | """
Tests the usecols functionality during parsing
for all of the parsers defined in parsers.py
"""
from io import StringIO
import numpy as np
import pytest
from pandas.errors import ParserError
from pandas import (
DataFrame,
Index,
array,
)
import pandas._testing as tm
pytestmark = pytest.mark.filterw... |
043d9940fe3318f778ac96acf654b90befeaa775d70cbdae754f2dcc3f5b4084 | Python | 17,655 | 530 | """
Methods that can be shared by many array-like classes or subclasses:
Series
Index
ExtensionArray
"""
from __future__ import annotations
import operator
from typing import Any
import numpy as np
from pandas._libs import lib
from pandas._libs.ops_dispatch import maybe_dispatch_ufunc_to_dunder_op
from ... |
81cf155d49947f44260744e427fc794234bac5db8c4475e1523fc8a6e5e6ec15 | Python | 17,677 | 361 | 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:1'
trail = 1
version = 1
scale = 1.2
class brain_model():
def __init__(self, W):
self.weight_matrix = W.to(device)
self.distance_matrix ... |
7e6e7c57b4c2a78e6e5e6240411c85ef2cf77bac9d1ba255090da86a735bef16 | Python | 17,685 | 562 | import numpy as np
import pytest
from pandas.core.dtypes.dtypes import DatetimeTZDtype
import pandas as pd
from pandas import (
CategoricalIndex,
Series,
Timedelta,
Timestamp,
date_range,
)
import pandas._testing as tm
from pandas.core.arrays import (
DatetimeArray,
IntervalArray,
Nump... |
a0f3546c49f3c97351f6fc41a63a2ef77271dff31245c33f11207bd52ae87b07 | Python | 17,749 | 482 | import os
import tkinter
import customtkinter
from tkinter import ttk
from tkinter import messagebox
import matplotlib.pyplot as plt
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from utils.file_utils import load_file
from utils.image_utils import load_svg_image
from ui.widgets import Tooltip, Segment... |
f980f2206e7225f2653d046ed888e230dd7cd8e51b5952b056e6823bea68f84f | Python | 17,766 | 391 | # YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
YOLO-specific modules
Usage:
$ python models/yolo.py --cfg yolov5s.yaml
"""
import argparse
import contextlib
import os
import platform
import sys
from copy import deepcopy
from pathlib import Path
FILE = Path(__file__).resolve()
ROOT = FILE.parents[1] # YOLOv5 ro... |
ead5b2a315a05169e80523fabc18443f9d57d98b470d40ae350783d79de51dc5 | Python | 17,798 | 471 | #!/usr/bin/env python3
"""GPU/toolchain environment setup for Windows manywheel/wheel CD builds.
Mirrors the Linux `.ci/wheel/linux/build_env_setup.py` pattern: install heavy
toolchain pieces (CUDA, MAGMA, MSVC env via vcvarsall, oneAPI for XPU),
then emit `export KEY=VALUE` lines to the file given by --env-out for th... |
87009a692ba9ffc5ea5bc3f74c396bb178c7534d255d62238ab53dea073860f6 | Python | 17,841 | 465 | """Utility script to visualize SQLModel experiment hierarchies.
Usage:
python visualize_experiment.py "Experiment Name"
python visualize_experiment.py --list # List all experiments
"""
from rich.console import Console
from rich.tree import Tree
from sqlalchemy.engine import Engine
from sqlmodel import Sessio... |
c9da4d31f59c8c37faccd56f2c615cf1e3875acfec714eabbcca1b9f710f9b65 | Python | 17,873 | 471 | import numpy as np
import pytest
import pandas.util._test_decorators as td
import pandas as pd
from pandas import (
DataFrame,
Index,
Series,
date_range,
isna,
)
import pandas._testing as tm
class TestDataFrameCov:
def test_cov(self, float_frame, float_string_frame):
# min_periods no... |
55a7c508673ac097fb3bed94a1976d3f84a4acc70daa33cf02e8d3875dff3ab5 | Python | 17,880 | 486 | import os
from dataclasses import asdict, dataclass, field, fields
from typing import List, Optional, Sequence, Union
import numpy as np
from anndata import AnnData
from scvelo import logging as logg
from scvelo import settings
from scvelo.core import get_n_jobs, parallelize
from scvelo.preprocessing.moments import ... |
8eae537f0f48fd69dd3262efb1c8f2b0fe79dd4a1e16eb0eab2acce5360b0754 | Python | 17,890 | 557 | """
wrapper for DFT methods.
Should implement setup, running, and reading the calculations
"""
import time
import subprocess
import sys
import shutil
from abc import abstractmethod, ABC
from math import isnan
import logging
from pathlib import Path
logger = logging.getLogger(__name__)
class BaseDFTMethod(ABC):
... |
b0533e4daad532f16c13c54660cc5c2958a49af88d34f2520f1c061a28c1bcf6 | Python | 17,899 | 512 | """
Collection of tests asserting things that should be true for
any index subclass except for MultiIndex. Makes use of the `index_flat`
fixture defined in pandas/conftest.py.
"""
from copy import (
copy,
deepcopy,
)
import re
import numpy as np
import pytest
from pandas.compat import IS64
from pandas.compat.... |
2114f546f88239b2d8c87f561fda9c49e848b96811459d75f62d370611273552 | Python | 17,902 | 288 | #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 ... |
fb01337b33efa797c1c264f60507f3913f31d410d14294a0cbf2d2dd44934d59 | Python | 17,917 | 288 | #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 ... |
16234e10a1377a75ff9aedabe745ce1935aca99d2cc5bb8f89270595b806a287 | Python | 17,931 | 391 | """
MEME suite + ELM-based short linear motif (SLiM) discovery and enrichment
analysis on excitatory vs inhibitory synapse motif sequences.
Pipeline:
1. Prepare FASTA files (excitatory / inhibitory / both)
2. Download ELM class regex patterns → elm2meme → MEME format DB
3. STREME : de novo SLiM discovery (excit... |
93f161307daae17aafdeb2410ec8ad71900c568b39fb6247db5b0fa142426bf2 | Python | 17,937 | 574 | '''||AUM||'''
import numpy as np
from scipy.sparse.linalg import cg # ,spilu,LinearOperator
from scipy.sparse import eye, spdiags, csc_matrix, vstack # , diags
from vtk import (vtkSphereSource, vtkPolyData, vtkDecimatePro, vtkPoints, vtkCleanPolyData, vtkCellArray,
vtkPolyDataConnectivityFilter, vtkS... |
1b15ae6255e839189b6464cc19812ac279fb35849d6cd95ea0d096832e20915f | Python | 17,940 | 420 | """
Shared helpers for the kernel correctness / detailed-balance test suite.
These tests exercise the optimized Cython kernels (fast serial crankshaft, the
parallel checkerboard kernel, the slither/reptation megamove and the TSMMC
moves) across the full matrix of:
* dimensionality : 2D and 3D
* interaction r... |
17042ba9d09eb176e0910f1b7d83e57f72df2be49dbee77da47102dad0a7c10d | Python | 17,941 | 484 | from datetime import timezone
import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
Index,
Series,
date_range,
)
import pandas._testing as tm
class TestDataFrameAlign:
def test_align_asfreq_method_raises(self):
df = DataFrame({"A": [1, np.nan, 2]})
... |
1ebb34bda69a72b7ecc07ec5b8f08cf459d583990a2f9bc6625f3e6710100b84 | Python | 17,950 | 572 | """
Printing tools.
"""
from __future__ import annotations
from collections.abc import (
Iterable,
Mapping,
Sequence,
)
import sys
from typing import (
Any,
Callable,
TypeVar,
Union,
)
from unicodedata import east_asian_width
from pandas._config import get_option
from pandas.core.dtypes.i... |
0d618f8418bbd8b6df12312d76f20d147045f89c9c2654dd8269fe0abe851a0b | Python | 17,951 | 288 | #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 ... |
bac639d9237d61df2552e8220b123507b0c1d3a9762dcf26afdb5bc6ef623a02 | Python | 17,951 | 490 | import collections
import operator
import sys
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.tests.extension import base
from pandas.tests.extension.json.array import (
JSONArray,
JSONDtype,
make_data,
)
# We intentionally don't run base.BaseSetitemTests bec... |
7570fd8f6eb763c4be71f61eab1f404d3ce622cdbc43068a324c7bec9e4fd402 | Python | 17,965 | 394 | """Module containing tools to calculate statistics of collective events.
Example:
>>> from arcos4py.tools import calculate_statistics
>>> out = calculate_statistics(data = data,frame_column = "frame", collid_column = "collid")
"""
import warnings
from typing import List, Union
import numpy as np
import panda... |
6fdb2974a243571265c39664138b892dd15017f31ebf4e5aa1827c8616848a00 | Python | 17,966 | 432 | import torch
from torch_cluster import radius_graph
from torch_scatter import scatter
import e3nn
from e3nn import o3
from e3nn.util.jit import compile_mode
from e3nn.nn.models.v2106.gate_points_message_passing import tp_path_exists
import torch_geometric
import math
from .registry import register_model
from .instan... |
5f81d4ddc767f40362ebc0ae99a24e1c985e19dff6e17773948e68ef89497ec2 | Python | 17,968 | 490 | import pathlib
import shutil
import subprocess
import pandas
import freesasa
import sbmlcore
# unsure whether to try and do a base class
# class ExternalCode(object):
#
# def __init__(self, PBBFile):
#
def wrap_angle(angle):
angle = angle % 360
if angle > 180:
angle -= 360
return angle
cl... |
638ccf379f76ac107da36df58d7141d0374dad36f9bdb0f697ce546efe6aa4e0 | Python | 17,988 | 455 | # Copyright 2024 RADar-AZDelta
# SPDX-License-Identifier: gpl3+
import json
import logging
import uuid
from abc import ABC, abstractmethod
from concurrent.futures import ThreadPoolExecutor, as_completed
from datetime import datetime
from pathlib import Path
from time import time
from typing import Any, Optional, cast
... |
ac01f22980fc33bb7e6d77c6f1580e55add3a5f85585bb78ad94253b8e58b8ff | Python | 17,993 | 567 | import contextlib
import ssl
import typing
from ctypes import WinDLL # type: ignore
from ctypes import WinError # type: ignore
from ctypes import (
POINTER,
Structure,
c_char_p,
c_ulong,
c_void_p,
c_wchar_p,
cast,
create_unicode_buffer,
pointer,
sizeof,
)
from ctypes.wintypes i... |
712f2c40f90ed1b2eaa53e1c32074253b4b725d52e7e0e2e9ae84ac45734f609 | Python | 17,998 | 599 | """Contains tests for the networking module, which contains functions to retrieve
nodes and edges from the database
"""
# from python
import pathlib
from unittest import TestCase
from unittest.mock import MagicMock
from click.globals import push_context
from itertools import combinations
# from dependencies
from sqla... |
cd9bbdf3b49f726385887d620ccb5eb6afdbd8efea2749eac8824560c4ca323d | Python | 18,003 | 412 | import json
import pandas as pd
import os
import matplotlib.pyplot as plt
import argparse
def read_args():
parser = argparse.ArgumentParser(description="Make summary reports")
parser.add_argument('-id', '--input-dir', required=True, type=str, help="directory name output by command chrombpnet bias pipeline")
parser... |
1c85047ed48b9adafe2d5ef1ae43fdf6f2b0363db3c97bf8cf5223fcb58977b4 | Python | 18,011 | 503 | """
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 ... |
cb7531a778c5cc3c26210d77ecddb36a9efebd6fe338d5109979db7eaaeceb40 | Python | 18,025 | 549 | """
Utilities that manipulate strides to achieve desirable effects.
An explanation of strides can be found in the :ref:`arrays.ndarray`.
"""
import numpy as np
from numpy._core.numeric import normalize_axis_tuple
from numpy._core.overrides import array_function_dispatch, set_module
__all__ = ['broadcast_to', 'broadc... |
931fc8c965d5094e0b49eeb403f4f46f5075b51cc61f5a49703b5d77edc12a1d | Python | 18,026 | 454 | import pathlib
import pandas
import numpy
import sbmlcore
def _load_mdanalysis():
try:
import MDAnalysis
from MDAnalysis.analysis.dihedrals import Dihedral
except Exception as exc: # pragma: no cover - environment dependent
raise ImportError(
"MDAnalysis is required for T... |
b12c5b8486f2e4adc8b50b4b17ac50fa0e2c3cfa863597466fdd65afcc5503bb | Python | 18,038 | 394 | # -*- coding: utf-8 -*-
import os
import numpy as np
import pandas as pd
import dirfiles
from confparser import load_config
from score import calc_score
# from order import trial_order
import expyriment
from expyriment import design, control, stimuli, io, misc
def launch_protocol(protocol_ini, exp):
# %%
#... |
349a934f529d2aa562bfe43f965b726576bcc9cb75d2522b305ef39cce70c0d4 | Python | 18,045 | 405 | ### This script is for loading VERY specific antibody data from the eLife manuscript ###
# To see how more general data is loaded in, look through "aims_loader.py"
# Let's start off by loading in Jeff's CDR3's
import numpy as np
import pandas
def getBunker():
total_Abs=pandas.read_csv('app_data/mouse_IgA.dat',sep=... |
58317aeb88b1811d25061c5a7b3a1bfc6c244f85da6c5d465d6c8d9f1dce9344 | Python | 18,080 | 505 | """
Protocol code for motion perception task
Himanshu Aggarwal
himanshu.aggarwal@inria.fr
January 2022
"""
from psychopy import core, visual, event, data
from sklearn.utils import check_random_state
import pandas as pd
from os.path import join, exists
from os import mkdir, sep, name, system
from math import tan, radi... |
729b1c38004786c58c185970784555cdde3c484b0122c7d81be6548cbbf3c657 | Python | 18,088 | 415 | 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
... |
5fb95ebf3c53a0ee7024b46f743d3062d9940ac11551faecc5a6330043407e6e | Python | 18,097 | 543 | '''
Deep Residual Learning for Image Recognition
https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py
'''
import os
import sys
from functools import partial
from timm.models import register_model
from timm.models.layers import trunc_normal_, DropPath
from braincog.model_zoo.base_module import *
fr... |
153cb23e280889c0d1b02221312fb769da506d6bc483474e9e7ffe7672df4947 | Python | 18,106 | 569 | """
spells.py
Python recipes to solve frequently requested tasks with Stimfit.
You can find a complete description of these functions in the
Stimfit online documentation (http://www.stimfit.org/doc/sphinx/index.html)
Check "The Stimfit Book of Spells" for details.
Authors: Jose Guzman, Alois Schloegl and Christoph S... |
7f589adf1cfae4c90da0d8c64c79b4af9cf03683ef27abe656a921e4bb93a9d8 | Python | 18,112 | 515 | """Blocks of plotting functionality to build visualizations."""
from __future__ import annotations
import itertools
import matplotlib.transforms as transforms
import numpy as np
import pandas as pd
import pyvista as pv
import vtk
import xarray as xr
from matplotlib.patches import Rectangle
from vtk.util.numpy_suppor... |
5cc9ea7c4293a740fc93ac974cb718b8c8a75f9a539bb038c8a6ccfd6433c184 | Python | 18,116 | 426 | import torch
from torch import nn
import numpy as np
import pathlib
from typing import List
import pyBigWig
from tqdm import tqdm
import json
from .dataloader import BaseDataset
from .trainer import Trainer, make_dataloader
from .utils.logger import TextLogger
from .models import VanillaCNN, CNN_LSTM, DilatedCNN, Conv... |
9a148c9df72a13d134df4f7cbd5836ac3737b1d9d742c81e67dbe74d3cd2b14e | Python | 18,149 | 397 | from torch.utils.data import DataLoader
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from tqdm import tqdm
from torch.optim import Adam
from utils import ABIDEDataset
from model_scripts.competing_models import DeepFMRI
import os
import pickle
from sklearn.metrics import roc_auc_... |
8bb0acaae42f840c5862284af710e076617fc0060f76b6eafe339c83705b0d72 | Python | 18,154 | 519 | """
Module for functions adding layers of circuits
"""
import itertools
import logging
import sys
from typing import Sequence, Union, Any, Optional, Tuple, List
import networkx as nx
import numpy as np
import tensorflow as tf
from ..circuit import Circuit
from ..densitymatrix import DMCircuit
from ..gates import num... |
1dc93d886c9b785f9b992d32d1c8b1711983c79c1f4068196f96b0949699bc18 | Python | 18,159 | 515 | import numpy as np
class LineSearch:
def __init__(self, xtol=1e-14):
self.xtol = xtol
self.task = "START"
self.fc = 0
self.gc = 0
self.case = 0
self.old_stp = 0
def _line_search(
self,
func,
myfprime,
xk,
pk,
gfk,... |
561fa311a4939e63a295e659f5560192af51e176595d5784f106756ed3ce5091 | Python | 18,160 | 452 | import matplotlib
matplotlib.use('Agg') # Use a non-GUI backend to avoid Tkinter errors
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# =============================================================================
# DATA PATHS - UPDATE THESE FOR YOUR SYSTEM
# =======================... |
2c9981a937bee853d86f1938cb5529994aa891fd0acc8e79413f249c00051858 | Python | 18,163 | 334 | import numpy as np
import torch
import math
from utils import *
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
class Mask:
def __init__(self, model,count_thre):
self.model_size = {}
self.model_length = {}
self.compress_rate = {}
self.mat = {}
... |
ed6d02d894672cf04585c074402978745b06488bae91fd5697924ac0163333fa | Python | 18,193 | 410 | # -*- 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... |
23f09459f648ca384cc2612801d07956c5c474412262fc741e6d16679f77266f | Python | 18,198 | 639 | #!/usr/bin/env python3
import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
plt.rcParams.update({
"figure.max_open_warning" : 200,
"font.size" : 15,
"font.family": "calibri", # use serif/main font for text elements
})
import sys
... |
68b21986529fdb3f0d97ba63a846a802b8b660f7dd2c4255cbe3058f38c00b4f | Python | 18,204 | 443 | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 9 10:19:35 2023
@author: lindseyb
"""
import numpy as np
from scipy.io import loadmat
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['ps.fonttype'] = 42
matplotlib.rc('font',**{'family':'sans-serif','sans-s... |
dc74942d50e3eea4245d47455afefc24e8926737f2e72d6791c6219dadbde95d | Python | 18,211 | 621 | import re
import sys
from colorsys import rgb_to_hls
from enum import IntEnum
from functools import lru_cache
from typing import TYPE_CHECKING, NamedTuple, Optional, Tuple
from ._palettes import EIGHT_BIT_PALETTE, STANDARD_PALETTE, WINDOWS_PALETTE
from .color_triplet import ColorTriplet
from .repr import Result, rich_... |
22cc5c1c589f28bc30e9a65ee51e16d0954b234f1a8fcbdeb20f0e39ab11411d | Python | 18,227 | 485 | """Vertex classifiers."""
import colorsys
from abc import ABC, abstractmethod
from dataclasses import dataclass
import logging
from cv2 import minEnclosingCircle
import matplotlib.pyplot as p
import numpy as np
import xarray as xr
from sklearn.cluster import DBSCAN
import cedalion.dataclasses as cdc
import cedalion.t... |
ed1a39a5bdac21bcad2a1e9b8166c8c46353cc031bbe26de097799b287193fc0 | Python | 18,251 | 480 | """Validation tests for cross-correlation and synchrony calculations.
This module creates synthetic calcium traces with known correlation and synchrony
properties to validate the correctness of both calculation methods.
"""
from __future__ import annotations
import numpy as np
import pytest
from scipy.signal import ... |
699b2b4becba39490667b56f276ee76132f63ef6d8e0f02ec8f0e5b3f0b1a158 | Python | 18,261 | 557 | """Numba-accelerated batch kernels for GCMI."""
from __future__ import annotations
import math
import numpy as np
from numba import njit, prange
_LN2 = math.log(2.0)
@njit(cache=True, nogil=True)
def _digamma_scalar(x: float) -> float:
if x <= 0.0:
if x == math.floor(x):
raise ValueError("... |
c735c11280660b553d5469580afa9711f8c069b005808ebd9d46cecc79bdce67 | Python | 18,261 | 572 | from __future__ import annotations
from typing import (
TYPE_CHECKING,
Literal,
NamedTuple,
)
import warnings
from matplotlib.artist import setp
import numpy as np
from pandas._libs import lib
from pandas.util._decorators import cache_readonly
from pandas.util._exceptions import find_stack_level
from pa... |
0d95eb18ad3b855af96f4043cfa598839856da469db0a181d9cf8c0c8a76ebf1 | Python | 18,265 | 674 | import warnings
warnings.simplefilter(action="ignore", category=FutureWarning)
import pickle, copy, importlib, math, os
import seaborn as sns
import numpy as np
import pandas as pd
import umap
import scanpy as sc
from tqdm import tqdm
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
from scipy.clust... |
fb703530882be3f93ee3b3521449c606882d705dd4526cc3fcdcf1e19cbcfecc | Python | 18,289 | 462 | #!/usr/bin/env python3
import os
import sys
import time
import logging
import argparse
import tempfile
import resource
import subprocess
import collections
import distutils.spawn
import parallel_tools
import seqtools
import shims
# There can be problems with the submodules, but none are essential.
# Try to load these m... |
40cad00d1fd635f2427ba0dad0a6d237e8d3a76f40176627840d223274335bb0 | Python | 18,300 | 396 | from src.argus_models import MouseModel
import tifffile
import numpy as np
import cv2
import torch
from torchvision.transforms.functional import gaussian_blur
from src.indexes import IndexesGenerator
from src import constants
from src.inputs import get_inputs_processor
from src.responses import get_responses_processo... |
85a7ae61b63faafc922909cc290d299636ead6c6c4b26c3db1e518253d5c773e | Python | 18,309 | 552 | """
Created on Jun 14, 2024
@author: mning
3 methods:
percentage -> 3 classes
absolute -> 2 classes
t-test (need to compute LMFP for each trial)
compute p-value
for t-test, put in another file. totally different codes.
f"featureStore_Sbj_{op_str_delta}_10x_V1.csv" is for windows
starting at 20ms... |
314b6dcaff064f9de4b0b9eb83385e55c0cb347ef945d57726939ad321c192ea | Python | 18,331 | 467 | # Copyright (C) 2007-2025 Bernd Feige
# This file is part of avg_q and released under the GPL v3 (see avg_q/COPYING).
"""
Python interface to avg_q.
"""
__author__ = "Dr. Bernd Feige <Bernd.Feige@gmx.net>"
import sys
import subprocess
__all__ = ['avg_q', 'Epochsource', 'Script']
valuetype={
'sfreq': float,
'z_val... |
dbcaae93691329f5a129ee7a9f8bc8349f06f7078a05f73b1f2b0c944f49dff8 | Python | 18,341 | 494 | import pytest
from numpy.f2py.symbolic import (
Expr,
Op,
ArithOp,
Language,
as_symbol,
as_number,
as_string,
as_array,
as_complex,
as_terms,
as_factors,
eliminate_quotes,
insert_quotes,
fromstring,
as_expr,
as_apply,
as_numer_denom,
as_ternary,
... |
2a66b34e56d741775471515db9778707eaa5fd9ae8865120d9b871ab87e4647b | Python | 18,350 | 459 | import matplotlib
matplotlib.use('Agg') # Use a non-GUI backend to avoid Tkinter errors
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# =============================================================================
# DATA PATHS - UPDATE THESE FOR YOUR SYSTEM
# =======================... |
c514a88cd6a133738f536f019ecd52e0c5c02ea1ca0a67cad921a57998649baf | Python | 18,374 | 584 | # Disable type checking for this module since numba's internals
# are not typed, and we use numba's internals via its extension API
# mypy: ignore-errors
"""
Utility classes/functions to let numba recognize
pandas Index/Series/DataFrame
Mostly vendored from https://github.com/numba/numba/blob/main/numba/tests/pdlike_u... |
e949a656443d8275c0caf228e0c9bdc451959fcc03b6a7017688271d97b344d4 | Python | 18,376 | 463 | ## ...........................................................................
##
## PIMMS (Polymer Interactions in Multicomponent Mixtures)
## Alex Holehouse, Pappu Lab, Holehouse Lab
## Copyright 2015 - 2026
## ...........................................................................
"""Validation + speed harness... |
48e344284b5e1336cf0f9e414945a7b483a888596ab9a1c91a39663c263f6bfa | Python | 18,385 | 522 | # tests/test_run_test_plan.py
from __future__ import annotations
import importlib
import json
from contextlib import nullcontext
from types import SimpleNamespace
from unittest.mock import MagicMock, patch as mock_patch
import pytest
MOD = "cli.lib.core.vllm.lib"
# We import inside tests so the MOD override above ... |
d23bc006bdf7fc4c669f2ef53aa9c558b9b41520381c54b945ef10962dcf7d27 | Python | 18,404 | 407 | import argparse
import os
from glob import glob
import sys
import pandas as pd
import logging
import numpy as np
from src.logger import LOGGER, VERBOSE_LEVEL_NUM
from src.validate import (
valid_output_dir,
valid_readable_dir,
valid_subj_ses_ID,
valid_whole_number,
valid_readable_file
)
from src... |
bbe188227d6170cf4612bbbb77bbdbc6aff8d100cdfe4618f2ecbd023ee906d9 | Python | 18,406 | 523 | """
Stabilizer circuit simulator using Stim backend
"""
from typing import Any, Dict, List, Optional, Sequence
import numpy as np
import stim
from .abstractcircuit import AbstractCircuit
from .quantum import _resolve_keep_or_subsystem
Tensor = Any
class StabilizerCircuit(AbstractCircuit):
"""
Quantum circu... |
6631873255c852ba1f75495f0ccca7bd9520e42d1b639403eb3d2066572f43fe | Python | 18,413 | 497 | """Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import os
from typing import List
import torch
try:
from e3nn import o3
from e3nn.o3 import FromS2Grid, ToS2Grid
except ImportError:... |
304e51a6131c5ecc38e38d4c79805eda647e354faa769959f1e4437b99d4e578 | Python | 18,433 | 459 | import numpy as np
import torch
import torch.nn as nn
from torch.nn import *
import torch.nn.functional as F
from torch import einsum
from einops import rearrange
# from braincog.model_zoo.base_module import DeformConvPack
from braincog.model_zoo.base_module import BaseLinearModule
# from mmcv.ops import ModulatedDef... |
5a51967168cdb2574f5bbde4af16e047042f91a7262aa46a26c378555cfe1575 | Python | 18,448 | 772 | """
Templating for ops docstrings
"""
from __future__ import annotations
def make_flex_doc(op_name: str, typ: str) -> str:
"""
Make the appropriate substitutions for the given operation and class-typ
into either _flex_doc_SERIES or _flex_doc_FRAME to return the docstring
to attach to a generated metho... |
4dfea9dea08837139f87b86c39d569f35f8224f92a360d479c7dac99c59b441c | Python | 18,450 | 607 | """Test inter-conversion of different polynomial classes.
This tests the convert and cast methods of all the polynomial classes.
"""
import operator as op
from numbers import Number
import pytest
import numpy as np
from numpy.polynomial import (
Polynomial, Legendre, Chebyshev, Laguerre, Hermite, HermiteE)
from ... |
3475f3d9951b7f868102c633e04ac3bc7f041dba3c1552c1c0b471b71fbd8c21 | Python | 18,466 | 462 | """
Functions related to communication between server and client
"""
import os
import re
import sys
import time
import pathlib
import requests
import pandas as pd
import datetime as dt
from requests.adapters import HTTPAdapter, Retry
from requests.auth import HTTPBasicAuth
from cryptography.hazmat.primitives.asymmetri... |
2065bdbfce206841c2e9418c49cda438b3ed09648d5113fd02398b7e8e24df9a | Python | 18,469 | 529 | import torch
import torch.nn as nn
import torchvision.transforms as transforms
import torchvision.datasets as datasets
from tqdm import tqdm
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import cv2
import numpy as np
from copy import deepcopy
import os, time, math,random
from braincog.base... |
89b47da25c1760c239070db549211bcc1fa037f6348555e9301ccbbefea70287 | Python | 18,473 | 613 | """Contains functions to manipulate the in-db network"""
# from dependencies
import logging
import random
import string
import tqdm
import click
from typing import Optional, Generator, cast
from sqlalchemy import (
Column,
ForeignKey,
Integer,
Table,
and_,
delete,
or_,
select,
)
# from... |
87df09d52540d7b68b5bb5b2dded4bf9c0624b68f22b35535dfd4ccc7280e770 | Python | 18,498 | 405 | # 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.
"""Test suite for the cassis cluster detection plugin"""
# for test files, silence irrelevant and noisy pylint warnings
# pylint: disable=no-self-use,protected-access,mis... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.