sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
d305fd48973b54b5e3ccec6eb0f141cbb32b44c7542c9985c05288b49b0a165a | Python | 27,224 | 852 | """Class that provides some basic functions of wave forms."""
import os
import numpy as np
import math
import logging
import parmap
from scipy.interpolate import interp1d
from scipy.spatial.distance import pdist, squareform
from scipy import signal
from yass import read_config
from yass.reader import READER
from yas... |
06dd5b19917fb823b0fb0d027f2307ee3441a5e859b4c6a7c2dd6809e85bb0f7 | Python | 27,232 | 765 | import pandas as pd
import uuid
import os
import time
import logging
from pathlib import Path
import requests
import json
from app.utils.environment import CONFIG
from fastapi import APIRouter, HTTPException, Query
from app.utils.constants import check_rev_rel, Ntype_split
from app.utils.database import neo4j_connecti... |
ce3c9d7ad2a9fc828df276a9cfac22411f5dfa85185c48c904bc9902b92923af | Python | 27,263 | 617 | 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 torch.nn.functional as F
import matplotlib.pyplot as plt
#from BrainCog.base.strategy.surrogate import *
from braincog.base.node.node import IFNode, SimHHNode
from ... |
52875a7c1dc8a647d03ce3e3deff4e2a130e81782ebc3dc83d2a9b1a13fb216d | Python | 27,264 | 781 | """
"""
import PySpin
from campy.cameras import unicam
import os, sys, time, logging
import numpy as np
os.environ["KMP_DUPLICATE_LIB_OK"] = "TRUE"
class ImageNotCompleteException(Exception):
"""Exception raised for errors in the input.
Attributes:
expression -- input expression in which the error... |
8ae6fffcbd89bdd1d6d8d5a65bfc55b9bf373f7df51538e86342e71fa00829c5 | Python | 27,308 | 631 | # 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.
""" Responsible for the construction of Clusterblast related SVGs.
Cluster query genes that were matched to any of the genes in a reference
cluster will be colour... |
684d5258d2d49f7dd62c6c1468b4dabc09763329b71923ca84d69479fc80f8d4 | Python | 27,312 | 728 | import pyglet
import psychopy
# set audio backend to psytoolbox before importing sound
#psychopy.prefs.hardware['audioLib'] = ['pyo']
from pynng import Req0
from psychopy import visual, event, monitors, core
from psychopy_pyo.backend_pyo import SoundPyo as Sound
import pyglet.gl as GL
from .helpers import... |
5c787a7d2de4108b9a69809221274a0e03ebea81c0c667546e590efd5220c3e0 | Python | 27,366 | 622 | from Bio import AlignIO
from Bio.Seq import Seq
from Bio import SeqIO
from Bio import pairwise2
import numpy as np
import pandas
thing = True
def msa_loader(fastapath,label,drop_dups = False):
thing = True; a = 0
fin_seq = []; fin_id = []; fin_title=[]
for seq_record in SeqIO.parse(fastapath,'fasta'):
... |
9806255eae4128b6aec8cc57927225a88552b29d9207082a06e99251e5ea1346 | Python | 27,375 | 661 | """
Utilities for checking compatibility of inputs to designer
Includes:
splitext_: a function to split .gz compressed images
get_input_info: a function to get datatype, gradient info, and image metadata for each input series
assert_inputs: asserts that any manual inputs match those found in the bids json, if avilab... |
0b4418f93f415999a6b2c4864ea6830218928fa929f1c8b762410fb538d8ab20 | Python | 27,392 | 730 | import pyglet
import psychopy
# set audio backend to psytoolbox before importing sound
#psychopy.prefs.hardware['audioLib'] = ['pyo']
from psychopy import visual, event, monitors, core
# from psychopy_pyo.backend_pyo import SoundPyo as Sound
import pyglet.gl as GL
from .helpers import Scroller, reverse_row... |
c1e51070394b01fa5864b26fe354e2689cc98c19c2fc507e15208a697d73a07c | Python | 27,416 | 511 | import sys
import numpy as np
import argparse
import time
import timm.models
import yaml
import os
import logging
from random import choice
from collections import OrderedDict
from contextlib import suppress
from datetime import datetime
from micro_encoding import ops
from braincog.base.node.node import *
from braincog... |
2aaecfbc6a2de9ec71083dbde4b6a3ab67df3def57455ed885c32a94ae6b9637 | Python | 27,423 | 699 | """
This script computes the mean activity in ROIS
for a given set of contrasts from the language network.
Authors: Ana Luisa Pinho, Bertrand Thirion
Last update: June 2020
Compatibility: Python 3.5
"""
import os
import glob
import re
import json
from joblib import Memory
import numpy as np
from math import *
... |
0579700d41be3a9655ed5a22718aed17ba2845ccd584364068a5c11814b17225 | Python | 27,441 | 803 | """Various algorithms for motion correction of fNIRS data."""
from __future__ import annotations
import numpy as np
import xarray as xr
from scipy.interpolate import UnivariateSpline
from scipy.linalg import svd
from scipy.signal import savgol_filter
import pywt
import logging
import cedalion.dataclasses as cdc
impo... |
0ab9ed168e396914e26055632fb4432a7c11a6deac6b175e1d25995a47e55c3d | Python | 27,444 | 772 | """
Cloud provider from TianYan (中电信天衍量子计算云平台)
https://qc.zdxlz.com
"""
from collections import Counter
from datetime import datetime
import logging
from typing import Any, cast, Dict, List, Optional, Sequence, Set, Tuple, Union
from .abstraction import Device, sep, Task
from ..abstractcircuit import AbstractCircuit
... |
5b5abeb60044352d7dc2938a4b3122eb73928dab44e2a0b5be2406db6aa869c1 | Python | 27,488 | 808 | import numpy as np
import functools
import sys
import pytest
from numpy import (
apply_along_axis, apply_over_axes, array_split, split, hsplit, dsplit,
vsplit, dstack, column_stack, kron, tile, expand_dims, take_along_axis,
put_along_axis
)
from numpy.exceptions import AxisError
from numpy.testing impo... |
2067435a9fc48af24f25899fbf78db24db6de8166d6eea51b2428fbd0d7a288a | Python | 27,534 | 756 | """
Read SAS7BDAT files
Based on code written by Jared Hobbs:
https://bitbucket.org/jaredhobbs/sas7bdat
See also:
https://github.com/BioStatMatt/sas7bdat
Partial documentation of the file format:
https://cran.r-project.org/package=sas7bdat/vignettes/sas7bdat.pdf
Reference for binary data compression:
http:/... |
a1a632ce3daf0066ff1caa9d16db3bad8d20c7cd16f4caea3d0099a5fbc68f69 | Python | 27,534 | 678 | """distutils.command.install
Implements the Distutils 'install' command."""
import sys
import os
from distutils import log
from distutils.core import Command
from distutils.debug import DEBUG
from distutils.sysconfig import get_config_vars
from distutils.errors import DistutilsPlatformError
from distutils.file_util ... |
9938584eb9ca79f2f87d68aab0b9893fd9ec25c2b1f5e8dd3cd5e7756e800f3a | Python | 27,541 | 758 | import io
import os
import sys
from zipfile import ZipFile
from _csv import Error
import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
Index,
compat,
)
import pandas._testing as tm
class TestToCSV:
def test_to_csv_with_single_column(self):
# see gh-18676, http... |
e41def7977338592a56cb3f6fe00b19856156da591dde1a1a2298962f0ea51ce | Python | 27,556 | 681 | import torch
from torch import nn
from torch.utils.data import DataLoader
from torch.utils.data import Dataset
import pandas as pd
import os
import numpy as np
import sys
class SourceDataset(Dataset):
def __init__(self, x_data, x_gene, y_data):
self.x_data = x_data
self.x_gene = x_gene
sel... |
fc7514dd232033d1aa57c3a920f6a02023c21358894217763b9061f98e870f13 | Python | 27,571 | 747 | # -*- coding: utf-8 -*-
"""
Helper functions for interacting with MNE Python objects.
Written by Joshua Kosnoff
jkosnoff@andrew.cmu.edu
"""
import mne
import numpy as np
import nibabel.freesurfer as fs
import os
import platform
import datetime
import typing
import shutil
mne.set_log_level('CRITI... |
177a845f783805205dcebcbb353b57b39be17ea57b280bb061140992b6313dfb | Python | 27,634 | 450 | from pathlib import Path
import numpy as np
import torch
import argus
from src.data import get_mouse_data
from src.predictors import Predictor
import utils_reconstruction.image_similarity as im_sim
import time
import matplotlib.pyplot as plt
from src import constants
from tqdm import tqdm
import utils_reconstruction.u... |
1305d97c526489d61f4927d5ddbdb6ae3c65f3ba0ee08cc794beff6a77224758 | Python | 27,650 | 743 | import re
import unicodedata
import numpy as np
import pytest
import pandas.util._test_decorators as td
from pandas.core.dtypes.common import is_integer_dtype
import pandas as pd
from pandas import (
ArrowDtype,
Categorical,
CategoricalDtype,
CategoricalIndex,
DataFrame,
Index,
RangeInde... |
986fdcd3819e184b9ef29a4de46f1d8dd3725457b8bca52204ba223b887e7615 | Python | 27,664 | 810 | import functools
import sys
import sysconfig
import subprocess
import pkgutil
import types
import importlib
import inspect
import warnings
import numpy as np
import numpy
from numpy.testing import IS_WASM
import pytest
try:
import ctypes
except ImportError:
ctypes = None
def check_dir(module, module_name=N... |
ba70654b0a15d0ec057f2b12afc64aaeaaeb7e81fb1516cf946a75f175bce0e4 | Python | 27,731 | 764 | import numpy as np
import pytest
import pandas.util._test_decorators as td
import pandas as pd
from pandas import (
CategoricalIndex,
DataFrame,
Index,
NaT,
Series,
date_range,
offsets,
)
import pandas._testing as tm
class TestDataFrameShift:
def test_shift_axis1_with_valid_fill_valu... |
9cb61a9eae5bd69b3ea02d59d9a9b9869aa252c900ca17ba36793b0e842f2391 | Python | 27,772 | 618 | #!/usr/bin/env python3.7
"""Defines Query class.
The copyrights of this software are owned by Duke University.
Please refer to the LICENSE and README.md files for licensing
instructions. The source code can be found on the following GitHub
repository: https://github.com/wmglab-duke/ascent
"""
import os
import pickle... |
b929f3b7cedb42820df6daba5f2a280f05d55e924742fb68ba4547704099efd3 | Python | 27,787 | 511 | r"""
This module contains PyTorch dataset classes used during training and inference to load nanopolish-preprocessed data
"""
import os
import pandas as pd
import numpy as np
import torch
import json
import joblib
from ast import literal_eval
from .norm_utils import annotate_kmer_information, create_kmer_mapping_df, cr... |
3781d2b90e2d1e717e0e730643b8085b62e96b6e4367b119d5701317f5265580 | Python | 27,804 | 446 | from pathlib import Path
import numpy as np
import torch
import argus
from src.data import get_mouse_data
from src.predictors import Predictor
import utils_reconstruction.image_similarity as im_sim
import time
# from src.indexes import IndexesGenerator
import matplotlib.pyplot as plt
# import tifffile
#import torchsum... |
3277a99a9ade798d75397f674078f94f181876738f248442f82af73320e70b7f | Python | 27,845 | 964 | from __future__ import annotations
from textwrap import dedent
from typing import (
TYPE_CHECKING,
Any,
Callable,
Literal,
)
from pandas.util._decorators import (
deprecate_kwarg,
doc,
)
from pandas.core.indexers.objects import (
BaseIndexer,
ExpandingIndexer,
GroupbyIndexer,
)
fr... |
012ce0263e92605699d5e30c0f1c0c92a1eea0bec127cfa1fcbda70a479e9de1 | Python | 27,854 | 646 | from causarray.gcate_opt import *
import contextlib
import pandas as pd
from causarray.utils import comp_size_factor, _filter_params
import time
import causarray.gcate_glm as _gcate_glm # module-qualified so _USE_FAST_BACKEND changes take effect at call time
def _check_input(Y, X, family, disp_glm, disp_family, offs... |
6768419784f22a9209facb5a3e75959806d132ff56834b502bf5bc6297083174 | Python | 27,866 | 753 | import numpy as np
import pytest
import pandas as pd
from pandas import (
Categorical,
DataFrame,
Index,
Series,
)
import pandas._testing as tm
@pytest.fixture(
params=list(
{
"bool": [True, False, True],
"int64": [1, 2, 3],
"float64": [1.1, np.nan, 3.3... |
2bff3cdd7dabc3cf059f96bb6d93c8d37345037603f79358a295f4387c5c6403 | Python | 27,868 | 964 | import re
import shlex
import subprocess
import sys
import textwrap
from pathlib import Path
from collections import namedtuple
import platform
import pytest
from . import util
from numpy.f2py.f2py2e import main as f2pycli
from numpy.testing._private.utils import NOGIL_BUILD
#######################
# F2PY Test util... |
aae0982e5661b859c40c4de9819e99b0e24ab98da595754f932787c66fd121de | Python | 27,876 | 745 | #!/usr/bin/env python3.7
"""Defines Trace class.
The copyrights of this software are owned by Duke University.
Please refer to the LICENSE and README.md files for licensing
instructions. The source code can be found on the following GitHub
repository: https://github.com/wmglab-duke/ascent
"""
import random
from cop... |
5ea34ac012be663d3a4b8013606779f6728fcebceef239a4fd56e94adbc1eedb | Python | 27,880 | 825 | import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
Index,
MultiIndex,
Series,
)
import pandas._testing as tm
pytestmark = pytest.mark.filterwarnings(
"ignore:Passing a BlockManager|Passing a SingleBlockManager:DeprecationWarning"
)
@pytest.fixture()
def gpd_styl... |
8e6b3bed5be0908826d1b4821d7f8830eb58b91d30da3779b96dd4a02d9f9bfe | Python | 27,893 | 815 | from datetime import datetime
import re
import numpy as np
import pytest
from pandas._libs.tslibs import period as libperiod
from pandas.errors import InvalidIndexError
import pandas as pd
from pandas import (
DatetimeIndex,
NaT,
Period,
PeriodIndex,
Series,
Timedelta,
date_range,
not... |
0e287d9d70b164008a72343663cdecd3f63af5916dacaa581139895695df87d0 | Python | 27,913 | 297 | import argparse
from argparse import RawTextHelpFormatter
desc = """==================================================================================================
Bias factorized, base-resolution deep learning models of chromatin accessibility reveal
cis-regulatory sequence syntax, transcription factor footp... |
e87d0ae35f574783668e4d1e9f181ab3e350bd8b9525933b83ad7065609c8a69 | Python | 27,922 | 663 | from collections import OrderedDict, defaultdict
import torch
import torch.nn as nn
from torch.utils.hooks import RemovableHandle
def get_layer_names(model):
layername = []
conv_cnt = 0
fc_cnt = 0
pool_cnt = 0
do_cnt = 0
for layer in list(model.features)+list(model.classifier):
if isi... |
ca8f67641a5c39b954fb76e07e64e0dfe0904fba7ea7799c884ae83150df9831 | Python | 27,931 | 782 | from datetime import datetime
from itertools import product
import numpy as np
import pytest
from pandas.core.dtypes.common import (
is_float_dtype,
is_integer_dtype,
)
import pandas as pd
from pandas import (
Categorical,
CategoricalIndex,
DataFrame,
Index,
Interval,
IntervalIndex,
... |
7afac95f99805aabaad250faa8cd879f8ff5fe691293c729373523ebf41c6451 | Python | 27,936 | 797 | import inspect
import sys
import os
import tempfile
from io import StringIO
from unittest import mock
import pickle
import pytest
import numpy as np
from numpy.testing import (
assert_, assert_equal, assert_raises, assert_raises_regex)
from numpy.testing.overrides import get_overridable_numpy_array_functions
from... |
e66ee22f8d05f891c8e64956eab29cc9fcdaf22e16b6942f98a15bb4ffb1eaa1 | Python | 27,940 | 724 | import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import pytorch_lightning as pl
from torch.optim import AdamW
from collections import OrderedDict
import pandas as pd
import numpy as np
import pickle
class MultiHeadAttention(nn.Module):
def __init__(self, d_mode... |
f1a7a9c710059a7cd916d70c0affb52384ff99a12441de215d9ced616138c91d | Python | 27,956 | 746 | """Support for installing and building the "wheel" binary package format."""
from __future__ import annotations
import collections
import compileall
import contextlib
import csv
import importlib
import logging
import os.path
import re
import shutil
import sys
import textwrap
import warnings
from base64 import urlsafe... |
973f4bc562e7bef020c33b9f1e449ae43b44eb2f9244ddb9815fda7d49ca2484 | Python | 28,050 | 899 | #!/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... |
88c55e5032af888199c52ec6f21c0adfcd31dfc487a3b4187d54d07dc2360ccd | Python | 28,091 | 731 | #!/usr/bin/env python3
"""Normalize the header of an iad .rxt file.
The seventeen experimental parameters at the top of an .rxt file are read by
position, not by name, so the comment beside each one is documentation and
nothing else. Over the years those comments drifted: the same quantity is
described three differen... |
0ac5ef120bf54f7c2f0801faa98bbc4425a840e688e3f826eda58d8404b84118 | Python | 28,174 | 818 | import pickle
from functools import partial
import numpy as np
import pytest
from numpy.testing import assert_equal, assert_, assert_array_equal
from numpy.random import (Generator, MT19937, PCG64, PCG64DXSM, Philox, SFC64)
@pytest.fixture(scope='module',
params=(np.bool, np.int8, np.int16, np.int32, ... |
a2486a52f6b785e70b03cd67e1e5da6ad1c7afe3cc2577ba70c16ea1dd8cede5 | Python | 28,185 | 778 | # -*- coding: utf-8 -*-
# ----------------------------------------------------------
# SLT_DCM - fMRI TRAINING
#
# Preamble
#
#
# ----------------------------------------------------------
# --------
# Librarys
# --------
from __future__ import division
import viz
import vizact
import vizinput
import vizshape
impo... |
9363ded6c4cd0842eccd47d15374957fee785874638a04a9d03e750aada99910 | Python | 28,189 | 921 | import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
Index,
MultiIndex,
Series,
Timestamp,
isna,
)
import pandas._testing as tm
def test_first_last_nth(df):
# tests for first / last / nth
grouped = df.groupby("A")
first = grouped.first()
expecte... |
28ce719068567d3f290a764fa3dfced68ee386de3cbf87c520d35648cca1a364 | Python | 28,190 | 751 | #!/usr/bin/env python3.7
"""Submits NEURON fiber simulations.
The copyrights of this software are owned by Duke University.
Please refer to the LICENSE and README.md files for licensing
instructions. The source code can be found on the following GitHub
repository: https://github.com/wmglab-duke/ascent
"""
import arg... |
d339f119a2e8a034121b1da9a77cc1aed960cec9fbe8b42670fb6d781ea06ab3 | Python | 28,205 | 751 | #!/usr/bin/env python3.7
"""Submits NEURON fiber simulations.
The copyrights of this software are owned by Duke University.
Please refer to the LICENSE and README.md files for licensing
instructions. The source code can be found on the following GitHub
repository: https://github.com/wmglab-duke/ascent
"""
import arg... |
c9f17a8dedc511547c1c646361b45e226666beca04d9863b23feba5e337a6a8e | Python | 28,239 | 589 | """Utilities and tools for tracking runs with Weights & Biases."""
import logging
import os
import sys
from contextlib import contextmanager
from pathlib import Path
from typing import Dict
import yaml
from tqdm import tqdm
FILE = Path(__file__).resolve()
ROOT = FILE.parents[3] # YOLOv5 root directory
if str(ROOT) ... |
ab05ec02523da672e5775a63f6ea877f6ce29d777e7e3f06137919f9735569c5 | Python | 28,253 | 894 | """
Concat routines.
"""
from __future__ import annotations
from collections import abc
from typing import (
TYPE_CHECKING,
Callable,
Literal,
cast,
overload,
)
import warnings
import numpy as np
from pandas._config import using_copy_on_write
from pandas.util._decorators import cache_readonly
fr... |
03731973f7c327f01fd9e2523cdc1b09088b5b206b32509540c69751de35e97e | Python | 28,290 | 843 | import streamlit as st
def show_intro_page():
st.markdown(f"""
<style>
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
:root {{
--primary:#0f4c81;
--gradient:linear-gradient(135deg,#1f8ef1,#0f4c81);
--text:#2f3e52;
--mut... |
74bc624bbd143af21805d6bf9c411968f0053950d5991b35b043ccb8b0e8c10a | Python | 28,310 | 784 | import inspect
import io
import itertools
import sys
import typing as t
from gettext import gettext as _
from ._compat import isatty
from ._compat import strip_ansi
from .exceptions import Abort
from .exceptions import UsageError
from .globals import resolve_color_default
from .types import Choice
from .types import c... |
247f3fa363493508f5034374605702de6e674064ad69c2396efd46f9dcd82950 | Python | 28,377 | 843 | """
Base and utility classes for tseries type pandas objects.
"""
from __future__ import annotations
from abc import (
ABC,
abstractmethod,
)
from typing import (
TYPE_CHECKING,
Any,
Callable,
cast,
final,
)
import warnings
import numpy as np
from pandas._config import using_copy_on_write... |
db463521f017b5d8f0f260b7b94a75e75e3faff6c23fc98af4661116a0040cb6 | Python | 28,415 | 437 | from __future__ import print_function
import numpy as np
import argparse
import torch
import torch.nn as nn
import pdb
import os
import pandas as pd
from utils.utils import *
from math import floor
from utils.eval_utils import initiate_model as initiate_model
from models.model_clam import CLAM_MB, CLAM_SB
from model... |
a7bd054bda545bac07df2aea1b02d488e7d91016d1b67982298f241b7ef8cdf8 | Python | 28,431 | 680 | # -*- coding: utf-8 -*-
#
# general_models.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.ap... |
a5be14df27f726e9492256af0c1097d2e5597ed43235cad5969fe5080c495132 | Python | 28,472 | 761 |
import numpy as np
import multiprocessing as mp
import pyqtgraph as pg
from PyQt6 import QtWidgets, QtGui
from PyQt6.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QGraphicsRectItem
from pyqtgraph.Qt import QtCore
from datetime import datetime
from ctypes import *
from Client_config import (
MEA_NUM,
PL... |
801917ffa0cc1fe8e813ee068f06692188161c992b58f3c327c47d80ab87a87f | Python | 28,488 | 670 | """ Test cases for DataFrame.plot """
import re
import numpy as np
import pytest
import pandas as pd
from pandas import DataFrame
import pandas._testing as tm
from pandas.tests.plotting.common import (
_check_colors,
_check_plot_works,
_unpack_cycler,
)
from pandas.util.version import Version
mpl = pytes... |
c1d4450c49dcf55bcd8c0de2799dc7776b431e05e8088966bbd542b9be5f7125 | Python | 28,491 | 822 | ## ...........................................................................
##
## PIMMS (Polymer Interactions in Multicomponent Mixtures)
## Alex Holehouse, Pappu Lab, Holehouse Lab
## Copyright 2015 - 2026
## ...........................................................................
import numpy as np
from .la... |
e131c4a4453a3d4d6a1a9af81120bd2b4ddf6924cabd4acbe3e287e5c08c1969 | Python | 28,494 | 722 | import os
import captum
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pytorch_lightning as pl
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.optim.lr_scheduler import StepLR
from pnet import ReactomeNetwork_2Regulatory, pnet_lo... |
abac89852383cdc6f1e8b990cc726ab452ac5b8ff17eebb2d010be44ae2dea62 | Python | 28,510 | 745 | """
Tests related to deprecation warnings. Also a convenient place
to document how deprecations should eventually be turned into errors.
"""
import warnings
import pytest
import tempfile
import re
import numpy as np
from numpy.testing import (
assert_raises, assert_warns, assert_, assert_array_equal, SkipTest,
... |
99168c9e6c4fdaa1f0431a93b7b55d828040129a5caab6f0cca5230f7cfac6fd | Python | 28,543 | 513 | """
AmygdalaEngrams Model
This file defines the AmygdalaEngrams model described in:
"Werne et al., Learning, sleep replay and consolidation of contextual fear memories: A neural network model."
The AmygdalaEngrams model simulates associative learning and consolidation processes in hippocampal-amygdala-cortical circu... |
fce2dad11dc2e37adb12027e6eadc6a07881ab3a4fb07aa7abff0e44cf07efb5 | Python | 28,619 | 652 | import RNA
import numpy as np
from collections import OrderedDict
import forgi.graph.bulge_graph as fgb
import scipy.sparse as sp
import re
NUC_VOCAB = ['A', 'C', 'G', 'U']
HYPERGRAPH_VOCAB = ['H', 'I', 'M', 'S', 'P']
allowed_basepairs = [[False, False, False, True],
[False, False, True, False],
... |
637578929e70fabe2cf6fa4d8d2efb7c825c1aae3c2eb3cf730ccd7afc59dfde | Python | 28,636 | 769 | import os
from functools import partial
from typing import List, Type
from operations import *
from motifs import *
from utils import drop_path
from timm.models import register_model
from braincog.base.node.node import *
from braincog.base.connection.layer import *
from braincog.model_zoo.base_module import BaseModule... |
555e7951e18c19a84d54f20824ee989605e62fa32a52b0ce3d1ec193a1c3b1e4 | Python | 28,690 | 826 | import os
import re
import sys
import platform
import shlex
import time
import subprocess
from copy import copy
from pathlib import Path
from distutils import ccompiler
from distutils.ccompiler import (
compiler_class, gen_lib_options, get_default_compiler, new_compiler,
CCompiler
)
from distutils.errors import... |
2c842b4c8877ae7a9ccf1f5509cbdc35c78fd66fe06f70f9e13efd40d6f91457 | Python | 28,720 | 574 | 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... |
8c6c65aad9aac2bedda52dec2aa7c724a34ef0b95d6106a653ffbc69dda0ae41 | Python | 28,742 | 731 | """
Static layout data for fixed-shape dense MPS algorithms.
"""
import math
from dataclasses import dataclass
from functools import lru_cache
from typing import Iterable, Mapping, Optional, Tuple
from .symmetry import AbelianSymmetry, Charge, SectorIndex
def _u1_auto_bond_sectors(
nsites: int, total_charge: in... |
b84a09a044c31e6cf5d718134f0b658a41c2bf867fee871e02635ebe2c2ccb22 | Python | 28,758 | 742 | """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 json
import logging
from pathlib import Path
from typing import Dict, Optional, Union
import numpy as np
import torch
from torch_scatte... |
377a4dfbd8313d8d4abef3048e85ebee42f14c637c6903abf2aa3982696b9bdd | Python | 28,778 | 808 | import re, textwrap, os
from os import sys, path
from distutils.errors import DistutilsError
is_standalone = __name__ == '__main__' and __package__ is None
if is_standalone:
import unittest, contextlib, tempfile, shutil
sys.path.append(path.abspath(path.join(path.dirname(__file__), "..")))
from ccompiler_o... |
a03f9b19ae00669b964be943c88e267f711a45c6c20d0a0375ce45570d8d2101 | Python | 28,820 | 724 | from typing import Dict, Union
import torch
from torch.nn.modules.loss import _Loss
from torch_geometric.data import Data
from torch_cluster import radius_graph
import torch.nn as nn
import os
from e3nn import o3
from e3nn.math import soft_one_hot_linspace
from e3nn.nn import Gate, Dropout, BatchNorm, FullyConnectedNe... |
2314571b989088ece97d2b9059d1f63b4f9bd7ba3ed06246a889fb02158959d6 | Python | 28,835 | 699 | 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... |
8a76f4f643249188a0f1ae918b38fac6f1ee5977eba99cd7875a19833d1d66f3 | Python | 28,838 | 783 | """
f2py2e - Fortran to Python C/API generator. 2nd Edition.
See __usage__ below.
Copyright 1999 -- 2011 Pearu Peterson all rights reserved.
Copyright 2011 -- present NumPy Developers.
Permission to use, modify, and distribute this software is given under the
terms of the NumPy License.
NO WARRANTY IS EXPRE... |
197d975f6574be146e56c8f477d5f3efa386652f6a70a60aeea042447ec51311 | Python | 28,850 | 656 | # ADD A CATCH TO SUPPRESS WARNINGS JUST FOR PIP VERSION OF THE APP
import warnings
warnings.simplefilter("ignore")
from Bio import AlignIO
from Bio.Seq import Seq
from Bio import SeqIO
from Bio import pairwise2
import numpy as np
import pandas
# More special stuff for the pip version of the script....
import aims_imm... |
1d6bfaebc205b9a48d1251b78352790cbfb0307a54e53fe24184ce91a240f345 | Python | 28,852 | 767 | """
An exhaustive list of pandas methods exercising NDFrame.__finalize__.
"""
import operator
import re
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
# TODO:
# * Binary methods (mul, div, etc.)
# * Binary outputs (align, etc.)
# * top-level methods (concat, merge, get_dummies, etc... |
d9607f1d2fde5cc7976393fd4bc058acfbb10c0ae6b0b384581f2ba8cffee21e | Python | 28,857 | 844 | # -*- coding: utf-8 -*-
"""
Created on Sun Aug 16 17:10:53 2020
@author: wanxiang.shen@u.nus.edu
"""
import warnings
warnings.filterwarnings("ignore")
import os
import numpy as np
import pandas as pd
import tensorflow as tf
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)
from sklearn.utils.validatio... |
3da8d252fa7b8cc592102eec2cf68174a5afeec8a8615768074244584a2b2ecc | Python | 28,914 | 748 | """Prepares a distribution for installation"""
# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
from __future__ import annotations
import mimetypes
import os
import shutil
from collections.abc import Iterable
from dataclasses import dataclass
from pathlib import Pat... |
ca591255841ca0c9aec6abc4a3210fe981f3795b462fdcbab9e0047cdebf4736 | Python | 28,917 | 899 | from __future__ import annotations
from collections.abc import (
Hashable,
Sequence,
)
from typing import (
TYPE_CHECKING,
Callable,
Literal,
cast,
)
import warnings
import numpy as np
from pandas._libs import lib
from pandas.util._decorators import (
Appender,
Substitution,
)
from pa... |
73b5200adfb68721d7317bd9e436063547a8e93ae34b09df9702c0b4c35321cc | Python | 28,954 | 689 | ## ...........................................................................
##
## PIMMS (Polymer Interactions in Multicomponent Mixtures)
## Alex Holehouse, Pappu Lab, Holehouse Lab
## Copyright 2015 - 2026
## ...........................................................................
##
## restart
##
## The Resta... |
cd7fce213448b439cd02fd225635dd1558ad7f77faded1f32bf999d6c231b2e7 | Python | 28,970 | 721 | """distutils.command.install
Implements the Distutils 'install' command."""
import sys
import os
import contextlib
import sysconfig
import itertools
from distutils import log
from distutils.core import Command
from distutils.debug import DEBUG
from distutils.sysconfig import get_config_vars
from distutils.errors imp... |
1f2937156475b8476b5854adc4ab636d9b640a9817143f557cd99d3c58b9403c | Python | 28,975 | 659 | # 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 classes and functions that allow each antismash module to
specify its own command line options.
Also constructs the general/default options.
"... |
911545bf0789480c3387d80d233a227eecbafd4d9df6667e2bbcd747f2b9a2dc | Python | 28,986 | 752 | """ Test cases for DataFrame.plot """
import string
import numpy as np
import pytest
from pandas.compat import is_platform_linux
from pandas.compat.numpy import np_version_gte1p24
import pandas as pd
from pandas import (
DataFrame,
Series,
date_range,
)
import pandas._testing as tm
from pandas.tests.plo... |
e19fa6241c3ac8a7a9de5c4eb03d1791f0cc57a8bd2e3fd11ec041f864d575c9 | Python | 28,996 | 659 | """
Functions to calculate autocorrelation function.
On continuous signal:
* using ACF equation (my_acf and my_autocorr replicate acf function from stattools),
* using iSTTC,
On trials:
* Pearsonr trial averaged (as in Murray et al, 2014),
* iSTTC trial averaged (with 0-padding),
* iSTTC trial concat (with 0-padding)... |
16838313427ffbc28805b352e513a41165603671773f0693a2a277f18b620185 | Python | 29,112 | 840 | """
Tests for DatetimeArray
"""
from __future__ import annotations
from datetime import timedelta
import operator
try:
from zoneinfo import ZoneInfo
except ImportError:
# Cannot assign to a type
ZoneInfo = None # type: ignore[misc, assignment]
import numpy as np
import pytest
from pandas._libs.tslibs i... |
8ccecd5c4dcdfdb3a380ff6f32acb3cdc2172706c84445e244ae3589c8a08000 | Python | 29,138 | 933 | import itertools
import pytest
import numpy as np
from numpy._core._multiarray_tests import solve_diophantine, internal_overlap
from numpy._core import _umath_tests
from numpy.lib.stride_tricks import as_strided
from numpy.testing import (
assert_, assert_raises, assert_equal, assert_array_equal
)
ndims = 2
... |
0b020a96609f676d58f5db3b64b6bd6deedd014c2417625902b48ccf73a8ff4d | Python | 29,160 | 882 | # agent.py
from .environment import Env
import scanpy as sc # type: ignore
from anndata import AnnData # type: ignore
import numpy as np
import torch
from tqdm.auto import tqdm # type: ignore
import time
from typing import Literal, Optional
from scipy.stats import norm # type: ignore
from scipy.sparse import isspar... |
07cb7a9b1bda0e8bb113e08e474d74bf8fcf507373385f261e015ab513e52569 | Python | 29,164 | 963 | """
A place for internal code
Some things are more easily handled Python.
"""
import ast
import math
import re
import sys
import warnings
from ..exceptions import DTypePromotionError
from .multiarray import dtype, array, ndarray, promote_types, StringDType
from numpy import _NoValue
try:
import ctypes
except Imp... |
0d9eccb93453b8dcd07f36cca517ab5fca0c8602f04e890534aea8fd874fe808 | Python | 29,319 | 761 | """ Test cases for .boxplot method """
import itertools
import string
import numpy as np
import pytest
from pandas import (
DataFrame,
MultiIndex,
Series,
date_range,
plotting,
timedelta_range,
)
import pandas._testing as tm
from pandas.tests.plotting.common import (
_check_axes_shape,
... |
aea7e000f13e065b41960c994be6b27e581c7ac1cd74a2411f1dc080a0611575 | Python | 29,361 | 848 | from typing import Sequence, Mapping, Tuple
from collections import defaultdict
from pathlib import Path
from Bio import PDB
from rna3db.utils import PathLike
import dataclasses
import json
def parse_as_dict(
path: PathLike,
modifications_cache_path: PathLike = None,
molecule_type: str = "RNA",
nmr_... |
991c3503c14c8468ed342499c880664f6acaa65d15403bfe675250bcfc5397e8 | Python | 29,369 | 778 | #!/usr/bin/env python3.7
"""Defines Trace class.
The copyrights of this software are owned by Duke University.
Please refer to the LICENSE and README.md files for licensing
instructions. The source code can be found on the following GitHub
repository: https://github.com/wmglab-duke/ascent
"""
import random
from cop... |
1790200f54cfc669436e47a4bf412bcaeb687e97de82fde9fe03c99c4e5638d1 | Python | 29,456 | 724 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
#
# In[1]:
"""
═══════════════════════════════════════════════════════════════════════════════
EvoAge 1-to-MANY KG — Build edge tensors + 80/10/10 reproducible split
═══════════════════════════════════════════════════════════════════════════════
- Uses EXISTING no... |
8e06aa6254a9a62d95f0ad5478d23b889167bd6754a121bae9178018a202501c | Python | 29,502 | 943 | """
Created on Feb 24, 2025
2x2 subplots
Only one model
Left col: Experiment 1a
Right col: Experiment 2a
Top row: internal validation
Bottom row: external validation
For Draft #3
@author: mning
"""
import os
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import sci... |
2ca80690895a393ecb388912df026fddbd3f43d1e2539988dabd353d7edbf643 | Python | 29,521 | 503 | """ pre-trained GAN models for feature visualization
Examples:
# Load a state dict
G = upconvGAN("fc6")
# Load a state dict from a pretrained model
G = upconvGAN("pool5")
G.G.load_state_dict(torch.hub.load_state_dict_from_url(r"https://drive.google.com/uc?export=download&id=1vB_tOoXL064v9D6AKwl0gTs1... |
776387b22e184f87eb0a41593b4f817a90ab81dda590ddfb680cf4fe820d837e | Python | 29,566 | 646 | from __future__ import annotations
import os
from dataclasses import dataclass
from datetime import datetime
from typing import cast
from qtpy.QtCore import Qt, Signal
from qtpy.QtWidgets import (
QDoubleSpinBox,
QGroupBox,
QHBoxLayout,
QLabel,
QPushButton,
QScrollArea,
QSizePolicy,
QS... |
96a9d63de031dec6deb6405b7246c4b50d541e16d67d7ebc1cf09ea882c97df5 | Python | 29,592 | 898 | """Exceptions used throughout package.
This module MUST NOT try to import from anything within `pip._internal` to
operate. This is expected to be importable from any/all files within the
subpackage and, thus, should not depend on them.
"""
from __future__ import annotations
import configparser
import contextlib
impo... |
023da691d60f3cf7464bf30411fe4903a4709eb13dd846c75cb22b5d0fa61b8b | Python | 29,614 | 838 | """Contains tests for the GBK class and functions"""
# from python
import logging
from pathlib import Path
from unittest import TestCase
# from dependencies
from Bio.Seq import Seq
# from other modules
from big_scape.genbank import GBK, Region, ProtoCore, CDS
from big_scape.errors import InvalidGBKError
from big_sca... |
94114c235dd33683e85df94952005be24977471a724a4e624b45d6ff2faec555 | Python | 29,625 | 571 | import sys
import numpy as np
import argparse
import time
import obj
import timm.models
import yaml
import os
import logging
from random import choice
from collections import OrderedDict
from contextlib import suppress
from datetime import datetime
from micro_encoding import ops
from braincog.base.node.node import *
fr... |
4d3826451e574501e2941f779b5217b47cdf721988e8bbde49f624b1e78776b0 | Python | 29,635 | 765 | """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 json
import logging
from pathlib import Path
from typing import Dict, Optional, Union
import numpy as np
import torch
import torch.nn a... |
3ab38539777162c26f364708260fae232ccbd472079df653ddc3cd21e0f1a5b9 | Python | 29,654 | 662 | # Copyright 2024 RADar-AZDelta
# SPDX-License-Identifier: gpl3+
import logging
import sys
from datetime import date
from importlib import metadata
from pathlib import Path
from typing import Any, Optional, cast
from google.cloud.bigquery import ScalarQueryParameter
from google.cloud.exceptions import NotFound
from po... |
74f35728907a94fbaee3638c3923ca970dd31ccfae3bd868c4e783a2e571cddf | Python | 29,664 | 856 | """Module containing code to load and store GBK files"""
# from python
from __future__ import annotations
import logging
# from enum import Enum
from pathlib import Path
import random
import string
from typing import Dict, Optional
import hashlib
# from dependencies
from Bio import SeqIO
from Bio.SeqRecord import S... |
3532bb1bf47090843bcbe6b46f10b3296c23e3a5572082031fac85e84b8b8047 | Python | 29,666 | 508 | import time
import numpy as np
from numpy import sqrt, zeros, floor, log, log2, eye, exp, linspace, logspace, log10, mean, std
from numpy.linalg import norm
from numpy.random import randn
from core.utils.geometry_utils import ExpMap, renormalize, ang_dist, SLERP
class CholeskyCMAES:
""" Note this is a variant of ... |
0423d7e169f29589f07cf20e5f0421f5e89a73ffac30f1f2142348acf8e64b85 | Python | 29,698 | 659 | import torch
from torch import Tensor
from torch.autograd import Variable
from torch.optim import Adam
from .networks import MLPNetwork, RNN, SNNNetwork, LSTMClassifier
from .misc import hard_update, gumbel_softmax, onehot_from_logits
from .noise import OUNoise
import time
class DDPGAgent(object):
"""
General ... |
2d88988a8e9bafe4dea7d9cf72ea565ec3c4b6396ec37a75994fa534155151f9 | Python | 29,786 | 868 | """Implements a Jinja / Python combination lexer. The ``Lexer`` class
is used to do some preprocessing. It filters out invalid operators like
the bitshift operators we don't allow in templates. It separates
template code and python code in expressions.
"""
import re
import typing as t
from ast import literal_eval
from... |
9b40d9f78159a1fd470c914f7b377376f4aedbdc463aa993f629462242cdf798 | Python | 29,806 | 825 | #!/usr/bin/env python
"""
Comprehensive Sensitivity Analysis for Cytocraft Algorithm
Analysis includes:
1. 100 independent runs with distinct random initializations for rotation matrices (R)
2. Measurement of deviation of final converged solutions (F* and R*) from ground truth
3. Convergence rate analysis
4. Multi-sta... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.