sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
fd276a58c8d395995317f22b0aaeb691a1a2ba7c9a2371a00a425e93bf3dc5f2
Python
18,498
489
#!/usr/bin/env python # Author: LiYang@cmt.tsinghua # Date: 2021.04.08 # Descripution: This python code is designed for calculate the fermi energy # and plot the band structure use the *.Band file. # ::Input File:: # - *.Band # ::Output File:: # - *...
f48a1e84347ba8fb193880070dcb17e1e91a864794f0c124a5e60ca9bfdfc008
Python
18,502
643
""" Tests dtype specification during parsing for all of the parsers defined in parsers.py """ from collections import defaultdict from io import StringIO import numpy as np import pytest from pandas.errors import ParserWarning import pandas as pd from pandas import ( DataFrame, Timestamp, ) import pandas._te...
1677ac7ea391fe904fa24b15e3eab22e172eea39677d7580988b74cbf4d7a211
Python
18,531
382
import numpy as np import torch from scipy.sparse import issparse from torch.autograd.functional import jacobian import networkx as nx import matplotlib.pyplot as plt from .model import TNODE from .utils import latent_data import pandas as pd from matplotlib.lines import Line2D import scvelo as scv from matplotlib.anim...
df92b76edc6202909c4553c6e36f45640aaa5c82911cac786d573c4a0dc30a61
Python
18,553
523
from collections import abc import email from email.parser import Parser import numpy as np import pytest from pandas import ( CategoricalDtype, DataFrame, MultiIndex, Series, Timestamp, date_range, ) import pandas._testing as tm class TestDataFrameToRecords: def test_to_records_timeseri...
16409d6166a436353645685f3bf32c6f2588226544f6a7a16e671bc83dd4ba68
Python
18,570
393
# 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. """ Contains the results class for each variant of clusterblast """ from collections import OrderedDict import logging import os from typing import Any, Dict, List, Tupl...
a93388bec9094137d377b218ef502a92c659b406319dea789c9c7f5261ca951c
Python
18,570
522
"""Contains tests for the lcs module.""" # from python import unittest import random import string from pathlib import Path # from other modules import big_scape.comparison.record_pair import big_scape.genbank as bs_genbank import big_scape.hmm as bs_hmmer import big_scape.comparison as bs_comparison import big_scape...
826c421972832cdfc066be1d436940e332ab53ce2e0edc1f16b74051d1730cd0
Python
18,573
521
import re import numpy as np import pytest from pandas._libs import lib import pandas as pd from pandas import ( DataFrame, Index, Series, Timestamp, date_range, ) import pandas._testing as tm from pandas.tests.groupby import get_groupby_method_args class TestNumericOnly: # make sure that w...
d2252862981788baea9bf7560f8e42b353c527c7c700316d9413784e42cd350c
Python
18,576
555
"""Tests for hermite module. """ from functools import reduce import numpy as np import numpy.polynomial.hermite as herm from numpy.polynomial.polynomial import polyval from numpy.testing import ( assert_almost_equal, assert_raises, assert_equal, assert_, ) H0 = np.array([1]) H1 = np.array([0, 2]) H2 = np.ar...
f0faa287bb3804cfab65f910a4b02d371c676fb54568634fad5d3d8996b50997
Python
18,580
527
import MEArec as mr import numpy as np import scipy.optimize import os import sys import re import ast import matplotlib.pyplot as plt import pandas as pd from collections import defaultdict import spikeinterface as si import spikeinterface.core as sc import spikeinterface.extractors as se import spikeinterface.sorter...
6780b8d401ee17b619173b2a4d05c51205e651d00279479a91ff212d9110afe1
Python
18,581
566
"""Backing implementation for InstallRequirement's various constructors The idea here is that these formed a major chunk of InstallRequirement's size so, moving them and support code dedicated to them outside of that class helps creates for better understandability for the rest of the code. These are meant to be used...
98400563cb1241d915034ac909365bf1caa3540b13bcbea65f3412117cb11207
Python
18,586
553
import numpy as np import pytest import pandas as pd from pandas import ( Index, Series, ) import pandas._testing as tm class TestFloatNumericIndex: @pytest.fixture(params=[np.float64, np.float32]) def dtype(self, request): return request.param @pytest.fixture def simple_index(self, ...
d637979d8e7e6ef0886979175f02cbfc19b5b9ee7bd2f304deb6dff2c22f0460
Python
18,588
421
import torch from torch import Tensor from torch.autograd import Variable from torch.optim import Adam from MPE.utils.networks import MLPNetwork, RNN, SNNNetwork from MPE.utils.misc import hard_update, gumbel_softmax, onehot_from_logits from MPE.utils.noise import OUNoise import time class DDPGAgent(object): """ ...
6cd8be8aa123e0d3d9d34fa86feac7bf392f39bccdde5129830de0ea9692dd7c
Python
18,590
561
""" requests.cookies ~~~~~~~~~~~~~~~~ Compatibility code to be able to use `http.cookiejar.CookieJar` with requests. requests.utils imports from here, so be careful with imports. """ import calendar import copy import time from ._internal_utils import to_native_string from .compat import Morsel, MutableMapping, coo...
3ba3700992b9c1af70f5af0e9ba2c703691648b7d37ab6a4923ae061718921aa
Python
18,601
505
from collections.abc import Iterator from datetime import datetime from decimal import Decimal import numpy as np import pytest import pytz from pandas._config import using_pyarrow_string_dtype from pandas.compat import is_platform_little_endian from pandas import ( CategoricalIndex, DataFrame, Index, ...
5c415e3750a963743db1c1884d0ab06ab1f78c8eb5dac459af14ecdf3067f909
Python
18,607
520
# Copyright 2021 The NetKet Authors - 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/licenses/LICENSE-2.0 # # Unless required by applicable ...
42fa7be84f49737220c98b9b9e9a88f5f4bb7ac78639ee058e97952aa2adf48c
Python
18,612
447
# -*- coding: utf-8 -*- # # Copyright (C) 2013-2023 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # from io import BytesIO import logging import os import re import struct import sys import time from zipfile import ZipInfo from .compat ...
e0a98e7dcff5ca864f2e79d1b9e2b08a8b1bdf659875d0dc70a3d3d6bee210a1
Python
18,615
339
#!/usr/bin/env python import sqlite3 import csv import numpy as np import pandas as pd import datetime import argparse import plotly.graph_objects as go import plotly.io as pio import plotly.express as px import sys import timeit def isoprop_plot(db, exp, outPrefix): conn=sqlite3.connect(db) c=conn.cursor() exp_f...
62e44d141aefc62750409f0a4a7dbeaf1da5cbb67e9ac1fbe9ba1b981a275649
Python
18,624
494
from numpy import argmax import random, time, pygame, sys import pygame pygame.init() from pygame.locals import * import os os.environ["SDL_VIDEODRIVER"] = "dummy" from rulebasedpolicy.world_model import * from rulebasedpolicy.statedata_pre import * from rulebasedpolicy.Find_a_way import * import numpy as np from uti...
4d1d1d5c419cbd66fd128dda6901171a19ef352dc51781f841cb8b9ef02f628e
Python
18,636
603
import os import re import typing as t from gettext import gettext as _ from .core import Argument from .core import BaseCommand from .core import Context from .core import MultiCommand from .core import Option from .core import Parameter from .core import ParameterSource from .parser import split_arg_string from .uti...
04428db3bad416777f71967bc10cf4026289ed4fbb2ac108e95dde0296f5721c
Python
18,640
535
from collections import ( OrderedDict, defaultdict, ) from datetime import datetime import numpy as np import pytest import pytz from pandas import ( NA, DataFrame, Index, Interval, MultiIndex, Period, Series, Timedelta, Timestamp, ) import pandas._testing as tm class Tes...
ce0821a720da435b606084f596a1fd35e783c70e8c39745cdc5b947dbc088d97
Python
18,660
593
""" Benchmark TFIM VQE value and gradient evaluation. The TensorCircuit-NG paths mirror ``benchmark_mq_vs_tc_vqe.py``: JAX backend, TFIM Hamiltonian, ``depth=10`` by default, ``complex64`` by default, initial ``|+>^n``, nearest-neighbor ``RZZ`` gates, and single-qubit ``RX`` gates. Backends: - ``tc-jax-scan``: scan ...
6a1e65ca40a2adbf73f8c7f2c10e0b5532a24205bb235f93075e84d9cb64bae5
Python
18,661
528
#!/usr/bin/env python3 """Extract libtorch package from a PyTorch wheel. Creates a libtorch zip from a pre-built wheel by copying the C++ libraries, headers, and CMake files. On Linux, optionally splits debug symbols from libtorch_cpu.so into a separate debug zip. Usage: python extract_libtorch_from_wheel.py \ ...
7ed49bea741cfc407ece570f7de5cb388124750ac6baf18708596789349cf062
Python
18,662
461
from causarray.gcate_likelihood import * from causarray.utils import * import causarray.gcate_glm as _gcate_glm # module-qualified so _USE_FAST_BACKEND changes take effect at call time import scipy as sp from scipy.sparse.linalg import svds from joblib import Parallel, delayed from collections import defaultdict @nj...
4e449043de702c73ef06fd73dc23b12308f1dc4814ac37aa05e168f30559c482
Python
18,671
506
"""Batch GLM fitting for causarray, backed by crispyx. causarray's designs are always ``[covariates | one-hot treatments]``: a few dense columns (intercept, covariates, latent factors) beside one indicator column per perturbation, at most one of which is set for any cell. crispyx solves exactly that shape with :class...
716349dcabb8c176f2c16829f22ccd45943d2989937026c880524a9d6b4b1679
Python
18,671
568
import torch import torch.nn as nn from timm.models.layers import to_2tuple, trunc_normal_, DropPath from timm.models.registry import register_model from timm.models.vision_transformer import _cfg import torch.nn.functional as F from braincog.model_zoo.base_module import BaseModule from braincog.base.node.node import *...
e005ebc2bc42428439708325609a472670226a290b7ef94bf93e5363bcfd9b3a
Python
18,672
568
"""Tests for legendre module. """ from functools import reduce import numpy as np import numpy.polynomial.legendre as leg from numpy.polynomial.polynomial import polyval from numpy.testing import ( assert_almost_equal, assert_raises, assert_equal, assert_, ) L0 = np.array([1]) L1 = np.array([0, 1]) L2 = np.a...
2247477a607cd0dfbf806fa9644a544437aa516c54bca7acca4307ae06f3972e
Python
18,676
568
import torch import torch.nn as nn from timm.models.layers import to_2tuple, trunc_normal_, DropPath from timm.models.registry import register_model from timm.models.vision_transformer import _cfg import torch.nn.functional as F from braincog.model_zoo.base_module import BaseModule from braincog.base.node.node import *...
0f9d901a43bff8196c9ca1e0731042d11a73aabab8bf9cd3220a6401b83842c1
Python
18,684
522
""" Benchmark explicit ready-wave batching on one fixed OMECO contraction tree. The script builds a circuit expectation tensor network with ``reuse=False``, searches a single contraction tree with ``omeco.TreeSA``, and then replays the same path in two ways: - plain sequential pairwise contractions - ready-wave batch...
5805f6018536a6a4474dc26bfed15a3cdfc16a0591ed1e26aa8c77c816a18727
Python
18,712
574
"""Test CaliGui database-only loading mode (no raw imaging data).""" from pathlib import Path from unittest.mock import MagicMock, patch import pytest from pytestqt.qtbot import QtBot from qtpy.QtCore import Qt from cali.gui import CaliGui from cali.gui._init_dialog import InputDialogData, _InputDialog from cali.gui...
ad138ec21362730faeecaba0974a050c09bae3d3216c859bd0aee9602bcf9a11
Python
18,714
548
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 Maze(tk.Tk, object): def __init__(self): super(Maze, self).__init__() self.action_space = ['u', 'd', 'l', 'r'] self....
2062a1fc9e5075f2842e2b6745f4c61e779e8d6c680b0fcd5fdb5f31b75c837c
Python
18,730
623
import codecs import io import os import re import sys import typing as t from weakref import WeakKeyDictionary CYGWIN = sys.platform.startswith("cygwin") WIN = sys.platform.startswith("win") auto_wrap_for_ansi: t.Optional[t.Callable[[t.TextIO], t.TextIO]] = None _ansi_re = re.compile(r"\033\[[;?0-9]*[a-zA-Z]") def ...
19c5b872e8e69cb59ec62441e8db4d76be783f2116b3cfc280a2c99e487b7eec
Python
18,731
508
import glob import json import logging import os import sys from pathlib import Path logger = logging.getLogger(__name__) FILE = Path(__file__).resolve() ROOT = FILE.parents[3] # YOLOv5 root directory if str(ROOT) not in sys.path: sys.path.append(str(ROOT)) # add ROOT to PATH try: import comet_ml # Pr...
cd2c909a45bf012bc77e259b779d7651658a3223f7ccb33a3cdfd52d0a1b0c9c
Python
18,752
509
""" Created on Jun 17, 2024 @author: mning """ from typing import List from typing import Union import numpy as np import pandas as pd ## TODO: pick one of the two functions and clean up code for consistency. def getPairs(this_df: pd.DataFrame) -> tuple[pd.DataFrame, pd.DataFrame]: # return 2 lists, one for V1...
2d34c3aefbb390ee4834b9b1ba7af8687b502e179cfc23749330747c79ba62fd
Python
18,753
578
import datetime import re import numpy as np import pytest from pandas._libs.tslibs import Timestamp from pandas.compat import is_platform_windows import pandas as pd from pandas import ( DataFrame, DatetimeIndex, Index, Series, _testing as tm, bdate_range, date_range, read_hdf, ) fro...
3a52d112b510f41dd4fa438a4479b38c0f749d412e7ec2c9588d2c4f3b603ae7
Python
18,759
537
"""Temporal basis functions for the GLM.""" from __future__ import annotations from abc import ABC, abstractmethod import numpy as np import pint import xarray as xr import cedalion.typing as cdt import cedalion.dataclasses as cdc from cedalion import cite, Quantity, units from cedalion.sigproc.frequency import samp...
f8683bd03ac9ab7c2be7a359984262407eefd84632e659f3956cb0e893f1c18f
Python
18,775
413
import numpy as np from tkinter import messagebox from scipy.optimize import curve_fit from core.calculate_baseline import calculate_baseline def rise_function(t, tau, y0_baseline): """ Exponential growth: y = y0 x e^{t/tau} REF: https://www.graphpad.com/guides/prism/latest/curve-fitting/reg_exponential_gr...
e36b633265cae3a7b004ba5af46aa532ae37417fe76536f62b93566f3c82f132
Python
18,783
440
import pandas as pd from sklearn.neighbors import KDTree import numpy as np from tqdm import tqdm from sklearn.linear_model import LinearRegression from math import sqrt, atan2, pi from scipy.optimize import linear_sum_assignment from collections import Counter class Predictor: def __init__(self, min_sampling_cou...
f317e6f88a4515232ee1d0cb1a50a439e060013d29794cbc762a17f49892ea0b
Python
18,813
581
""" 2008-04-11, C. Schmidt-Hieber Batch analysis of Na IVs """ import numpy as np from scipy.io import write_array def dens_batch( nFunc = 0 ): """Fits activation and inactivation of 15 iv pulses using a biexponential funtion with a delay, creates a table showing the results. Keyword argument: ...
35a21e081f70ee233f3ed6a6c782282cc470206f5e510c6c4c9a54d9c041e72d
Python
18,819
543
from collections.abc import Iterator from io import StringIO from pathlib import Path import numpy as np import pytest import pandas as pd from pandas import ( DataFrame, read_json, ) import pandas._testing as tm from pandas.io.json._json import JsonReader pytestmark = pytest.mark.filterwarnings( "ignor...
9bc051201fec6cc0d3c9854d8697388bf9d6bb01bb8c4385c456277e2f81a46d
Python
18,835
421
import numpy as np try: from skimage.transform import resize, rescale except: print("Warning: skimage.transform is not available. Will use scipy.misc.imresize instead.") from PIL import Image def resize(img, size): return np.array(Image.fromarray(img).resize(size, Image.Resampling(2))) import ma...
0218155538581e37cc11c7274837c7d81de9b8753a6633f0c4f708b854a7cd10
Python
18,836
602
""" ============================ ``ctypes`` Utility Functions ============================ See Also -------- load_library : Load a C library. ndpointer : Array restype/argtype with verification. as_ctypes : Create a ctypes array from an ndarray. as_array : Create an ndarray from a ctypes array. References ---------- ...
965fbbd9186a088b483c1f7b9ce5a11fb1f6f768789d5217ff0d6da0a4cf3148
Python
18,841
541
"""Test functions for matrix module """ from numpy.testing import ( assert_equal, assert_array_equal, assert_array_max_ulp, assert_array_almost_equal, assert_raises, assert_ ) from numpy import ( arange, add, fliplr, flipud, zeros, ones, eye, array, diag, histogram2d, tri, mask_indices, triu_indices, t...
7091334c4b562f1cb1bcc97b1e8bf11cbc2585d348d772c1ef123f7d09768a9a
Python
18,848
530
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...
72c73ea62e929d0751cf042c77fadc127e63768c1f7de331aeb227d6a9d8e7c7
Python
18,848
454
"""Defines plotting functions used for analyzing data. See ``examples/analysis`` for examples of how to use. """ import json import os import warnings from typing import List import matplotlib.colorbar as cbar import matplotlib.colors as mplcolors import matplotlib.pyplot as plt import matplotlib.ticker as tick impo...
3297ef27af3e286d77b04c4446f33c680c360c414d5fdc09d20c5ac038b3cdc0
Python
18,857
386
from torch.utils.data import DataLoader import numpy as np import torch from utils import InfoNCE from tqdm import tqdm from torch.optim import Adam from utils import DualBranchContrast from pl_bolts.optimizers import LinearWarmupCosineAnnealingLR from model_scripts.VarCoNet import VarCoNet from utils import ABIDEDatas...
b760ef791561b59519dd065f641bb783a10b3510f4f0fc44dab944ccd7cb5376
Python
18,859
524
#!/usr/bin/env python3 """GPU/toolchain environment setup (runs once before any wheel is built). The manywheel builder image (.ci/docker/manywheel/Dockerfile_2_28) is expected to ship the heavy build dependencies (CUDA, cuDNN, NCCL, MAGMA, cuSPARSELt, MKL, plus the standard OS package set). This script: * Installs ...
fc0de8840592e075eb406d3a4bc2f8edd226759193c18a2c0979e8cb0ecbe39a
Python
18,911
556
"""Tests for hermite_e module. """ from functools import reduce import numpy as np import numpy.polynomial.hermite_e as herme from numpy.polynomial.polynomial import polyval from numpy.testing import ( assert_almost_equal, assert_raises, assert_equal, assert_, ) He0 = np.array([1]) He1 = np.array([0, 1]) He2...
0fe92c4b439a6c00f1f9861161fb2bcdeafe2005e110824129f86f3b072a43de
Python
18,914
379
import pickle import numpy as np import matplotlib.pyplot as plt import seaborn as sns from tools.Tools import save_fig, get_data_path # np.random.seed(0) class MazeTurnEnvVec: """Vectorized RL T-Maze environment written in pure Numpy. We require an efficient environment since we need to evaluate ...
eede85f905a8c2d2e1e85ffa97ee18578638c8d4dca85404bbd8b7ef3233ebcb
Python
18,925
562
import inspect import types import typing as t from functools import update_wrapper from gettext import gettext as _ from .core import Argument from .core import Command from .core import Context from .core import Group from .core import Option from .core import Parameter from .globals import get_current_context from ...
ac2659bd3c7141aa88960b4c55fcf184cccb2ab0dbca96164750f493133bd94d
Python
18,934
397
from Client_config import ( VENDOR_ID, PRODUCT_ID, USB_PREAMBLE, TEST_SERVER, WORD_LENGTH_IN_BYTES, MAX_PKG_ID, ZMQ_USBCOM_ENDPOINT, connect_to_zmq, drain_zmq_queue, ) import usb.core import usb.util import time import numpy as np import multiprocessing as mp import mu...
f8b25a570c07bce29d71efe0d39e822f6c00f9eefe38086c93dde4b9c830b42d
Python
18,966
525
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ The collection of helper functions for the DCBC calculation Created on Fri Sep 27 11:55:06 2024 Author: dzhi """ import os, warnings, scipy import numpy as np import nibabel as nb import matplotlib.pyplot as plt # Check if torch is available try: import torch as ...
6ca941b7949fb77b97ef88f848dfcdb42ca5b3a78792cfac1ed827c0baa84569
Python
18,969
541
import numpy as np np.random.seed(1) import tkinter as tk import time from PIL import ImageGrab UNIT = 40 # pixels MAZE_H = 11 # grid height MAZE_W = 5 # grid width class Maze2(tk.Tk, object): def __init__(self,lamda=0): super(Maze2, self).__init__() self.action_space = ['u', 'd', 'l', 'r'] ...
04de215e6d7a864cfa6c5439e8182fa116f461f74afb80a359be0571844505f9
Python
18,970
570
from __future__ import annotations from collections import defaultdict from collections.abc import ( Hashable, Iterable, ) import itertools from typing import ( TYPE_CHECKING, cast, ) import numpy as np from pandas._libs.sparse import IntIndex from pandas.core.dtypes.common import ( is_integer_d...
a2187b278dc2815d628f19fda333613b9570bb4935fb7c9444859359e34f4608
Python
18,978
614
from __future__ import annotations from datetime import ( datetime, timedelta, ) from typing import TYPE_CHECKING import warnings import numpy as np from pandas._libs import index as libindex from pandas._libs.tslibs import ( BaseOffset, NaT, Period, Resolution, Tick, ) from pandas._libs....
a19f2f27e93b3eed84edaccf7b7d241c3480301a0a68ce1a764361fafef4c0b8
Python
18,992
503
from numpy import argmax import random, time, pygame, sys import pygame pygame.init() from pygame.locals import * import os # os.environ['SDL_AUDIODRIVER'] = 'dsp' # os.environ['SDL_VIDEODRIVER']='windib' os.environ["SDL_VIDEODRIVER"] = "dummy" # os.environ['DISPLAY'] = "localhost:13.0" from rulebasedpolicy.world_mod...
9219a4283bb487d6ebb020518632decf55eafa7cb3d70028fbd10a4f4c25e93c
Python
19,007
540
import os import tempfile import numpy as np import pytest import warnings as _warnings from scipy.sparse import find import sys import xarray as xr import cedalion.data import cedalion.dot as cdot import cedalion.dot.forward_model as fw import cedalion.dataclasses as cdc import cedalion.nirs import cedalion.xrutils ...
a763b3f7d2cc761b8cb84919bacac9563da0df6c7943f24bc3aad4ba7dab9275
Python
19,026
418
import os import escargot.language_models as language_models import logging import io import threading import time from escargot import operations import escargot.controller as controller import escargot.memory as memory #vectorized knowledge from escargot.vector_db.weaviate import WeaviateClient from escargot.parser...
91467c32dc0438d21c64101db7ead5e5a7b80c7422137d6b4ae7acde87812e76
Python
19,029
516
#!/usr/bin/env python3.7 """Defines Slide 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 itertools import ...
7a64f8af8b987bc82a1b53e88f6e19d5b938a3f25adc0ead07b6d18257b50aff
Python
19,067
467
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 ...
878b2775ca45e4e1eb65037cbc3f0859be4e072bd6ec005b8514e8c68beba92f
Python
19,067
531
""" This module started out as largely a copy paste from the stdlib's optparse module with the features removed that we do not need from optparse because we implement them in Click on a higher level (for instance type handling, help formatting and a lot more). The plan is to remove more and more from here over time. ...
c65d61e055c1451712e7db471754683685829339991e9d0a6ea924f45ea21dfb
Python
19,067
488
#!/usr/bin/env python # Author: LiYang@cmt.tsinghua # Date: 2021.04.08 # Descripution: This python code is designed for calculate the fermi energy # and plot the band structure use the *.Band file. # ::Input File:: # - *.Band # ::Output File:: # ...
42105ccf0ca41ecf148722066c2fb8ebc52f4a1415e4e3538aacd5e275c042d9
Python
19,073
464
from __future__ import annotations import importlib.util import re from collections import defaultdict from pathlib import Path from typing import TYPE_CHECKING, Any, cast from pymmcore_plus.mda.handlers import ( ImageSequenceWriter, OMETiffWriter, OMEZarrWriter, TensorStoreHandler, ) from pymmcore_wi...
50835847347bebe28ed618568141f6289adfdfaea9a645bc739d05ac540479ea
Python
19,079
564
from unittest.mock import MagicMock, patch import numpy as np from cali.analysis._fov_metrics import ( _compute_jitter_synchrony_matrix_numba, _detect_spike_onsets, _get_calcium_peaks_event_correlations_matrix, _get_calcium_peaks_event_synchrony, _get_calcium_peaks_events_from_rois, ) from cali.pl...
c0d57b44bf8766807f23ad58945e67b24a47fb84710369f73ff823df58b5f053
Python
19,079
604
""" Functions for arithmetic and comparison operations on NumPy arrays and ExtensionArrays. """ from __future__ import annotations import datetime from functools import partial import operator from typing import ( TYPE_CHECKING, Any, ) import warnings import numpy as np from pandas._libs import ( NaT, ...
f3601c10e0703c2860a61382a2896280d3fb44d01390f7f0770697161cc5aa86
Python
19,085
535
import pysam from sinto import utils from scipy import sparse import numpy as np from collections import Counter, defaultdict from multiprocessing import Pool import functools import re import gc import tempfile import os import math def writeFragments(fragments, filepath): """Write fragments to file Paramet...
7699db336b2aef8adbe9c33b1b585abe69d602dc5a560cf6de2c3cd414ad7e98
Python
19,087
527
"""Virtual zarr-like reader for collections of TIFF files. This module provides a reader that maps TIFF files to a plate/well/FOV structure and provides lazy array-like access without loading everything into memory. """ from __future__ import annotations import json from dataclasses import dataclass from datetime im...
62a0b8137471845347f96e0b3aacb546dc5c1d1cbd851c98343f766523571307
Python
19,095
653
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. import ast import email.utils import errno import fcntl import html import importlib import inspect import io import logging import os import pwd import random import re import socket import sys import textwrap impo...
731d0797cc4b66052e5eecbbf068a1f406230adaaeae6623549c72038c96b7bc
Python
19,101
511
# SPDX-FileCopyrightText: 2015 Eric Larson # # SPDX-License-Identifier: Apache-2.0 """ The httplib2 algorithms ported for use with requests. """ from __future__ import annotations import calendar import logging import re import time import weakref from email.utils import parsedate_tz from typing import TYPE_CHECKING...
b1e1beab741233cd5b3cd106b92a18198f434249ad57c98f0c78cb2800bf7719
Python
19,118
441
parent_path = r'/.../baselines' import sys sys.path.append(parent_path) 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 utils import ABIDEDataset import os import pickle from sklearn.metrics import roc_auc_score fro...
4290eebd75dcc09178f65501707e418924f8e91cfdc121bb556fe9ecdff4dbb3
Python
19,132
512
from __future__ import annotations import collections.abc as c import sys import typing as t import weakref from collections import defaultdict from contextlib import contextmanager from functools import cached_property from inspect import iscoroutinefunction from ._utilities import make_id from ._utilities import ma...
d8c141489ccf3865538586e19c60e5e88a5750a53f84f20fd8e6b02ee85a738f
Python
19,139
530
import numpy as np import torch from utils.utils import * import os from dataset_modules.dataset_generic import save_splits from models.model_mil import MIL_fc, MIL_fc_mc from models.model_clam import CLAM_MB, CLAM_SB from sklearn.preprocessing import label_binarize from sklearn.metrics import roc_auc_score, roc_curve ...
4d37aa0eecd2fbf04548db944ad556984da7183a4abaf521041264fc20905d5d
Python
19,144
571
from __future__ import annotations import logging import os.path import pathlib import re import urllib.parse import urllib.request from dataclasses import replace from typing import Any from pip._internal.exceptions import BadCommand, InstallationError from pip._internal.utils.misc import HiddenText, display_path, h...
fe02d0793d0aa8a3de72467103350dedb4aea7e570dfdae596de2c841efbba4e
Python
19,147
613
import marimo __generated_with = "0.18.0" app = marimo.App(width="medium") with app.setup: import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.ticker as ticker import cmasher as cmr import pandas as pd import seaborn as sns from scipy.stats imp...
43f3271c8292301bc8bc0e83a4c36472c412bfc694f438af527d66940ffdcc4b
Python
19,151
598
from __future__ import annotations from typing import ( TYPE_CHECKING, cast, ) import warnings import numpy as np from pandas._libs import ( NaT, algos as libalgos, internals as libinternals, lib, ) from pandas._libs.missing import NA from pandas.util._decorators import cache_readonly from pa...
31d3fcccd95241e794ee9b0e5f0194750d7ef172b360297998a30872930288df
Python
19,152
643
""" datetimelike delegation """ from __future__ import annotations from typing import ( TYPE_CHECKING, cast, ) import warnings import numpy as np from pandas._libs import lib from pandas.util._exceptions import find_stack_level from pandas.core.dtypes.common import ( is_integer_dtype, is_list_like, ...
bda565d00d39369a80c526c877029ac5604c0a1e0fc10dcf0b99350939fe4ad0
Python
19,158
596
import math import os import shutil import subprocess import sys from typing import List, Tuple from AIMD import arguments from Calculators.device_strategy import DeviceStrategy from utils.pdb import reorder_atoms, standardise_pdb, translate_coord_pdb, reorder_coord_amber2tinker from utils.system import get_physical_c...
df37c1fbd952dadd0f267ef416aae4e9134f75cb46296a3c00327490564a607d
Python
19,166
603
from matplotlib import pyplot as plt import scipy.stats from scipy.sparse import spmatrix, issparse, csr_matrix from scipy.stats import multivariate_normal from anndata import AnnData from typing import Optional, Union from shapely.geometry import Point, MultiPoint from numpy.linalg import svd, solve, lstsq from numpy....
784f9550824653d61e79a572eed540bcc4568a032ccae00ca7192395ba6d6e3a
Python
19,188
528
"""PipSession and supporting code, containing all pip-specific network request configuration and behavior. """ from __future__ import annotations import email.utils import functools import io import ipaddress import json import logging import mimetypes import os import platform import shutil import subprocess import ...
14343e819d10363a030ecf3901c8e6f3f1edba9c2c8ab9da9fc7385a3e8da89c
Python
19,210
508
import logging # noqa: I001 import os import pandas as pd from pnet.data_processing import ( utils, data_manipulation, ) # for manipulating the germline VCFs, filtering, etc logger = logging.getLogger(__name__) ############################## # Prostate project data loading ##############################...
0eff5aed0091d5ba811e85e00a398fac611ec06d6fd8106d13ff157dc178c925
Python
19,220
699
"""Automatically adapted for numpy Sep 19, 2005 by convertcode.py """ import functools __all__ = ['iscomplexobj', 'isrealobj', 'imag', 'iscomplex', 'isreal', 'nan_to_num', 'real', 'real_if_close', 'typename', 'mintypecode', 'common_type'] from .._utils import set_module import numpy....
00c266da4f6011aebce6dcf2a01a2b79008db2b65612338b838f33ff055894d6
Python
19,227
278
#!/usr/bin/env python3 from lib.designer_input_utils import * from lib.designer_func_wrappers import * def usage(cmdline): #pylint: disable=unused-variable from mrtrix3 import app #pylint: disable=no-name-in-module, import-outside-toplevel cmdline.set_copyright("""Copyright (c) 2016 New York University.\n\n ...
6d91c5a59ebfd6d2a0007cc29c9c6a50d145366ff785557587209fa01b2ee2ed
Python
19,258
496
import torch,os from random import randint import torch from torch import nn from braincog.base.strategy.surrogate import * from braincog.model_zoo.bdmsnn import BDMSNN import pygame from pygame.locals import * from collections import deque from random import randint import numpy as np import matplotlib.py...
16fa7c606480bb1f028d727a9690a7f32e0ff6f0ff0ab7d8e79b2dacc4f859cc
Python
19,274
504
import torch import os from braincog.model_zoo.bdmsnn import BDMSNN import pygame from pygame.locals import * from collections import deque from random import randint import numpy as np try: pygame.display.init() except: os.environ["SDL_VIDEODRIVER"] = "dummy" def load_images(): """ ...
fe17ebdfab7e8e6f903a123d1b06ddeac41923969558c322c4763e3983aa2ae3
Python
19,293
551
import operator import numpy as np import pytest import pandas._libs.sparse as splib import pandas.util._test_decorators as td from pandas import Series import pandas._testing as tm from pandas.core.arrays.sparse import ( BlockIndex, IntIndex, make_sparse_index, ) @pytest.fixture def test_length(): ...
737573c6d86e79b96406e67c551909760fae9abddce22d4908e396e4dc5b3bdc
Python
19,308
586
# module.py import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions import Normal from typing import Tuple, Union, Literal, Optional from .mixin import NODEMixin class Encoder(nn.Module): """ Variational encoder mapping input states to latent distributions. Suppor...
6b86e501ef1b41d57267ef199ee93b3a3ee029f8d152f3c203a9b8783d193105
Python
19,311
410
## ........................................................................... ## ## PIMMS (Polymer Interactions in Multicomponent Mixtures) ## Alex Holehouse, Pappu Lab, Holehouse Lab ## Copyright 2015 - 2026 ## ........................................................................... import random import numpy a...
4c2b990e945df193d91fa491c0865c5990b76a819cd7c46597a15871ac12eaa6
Python
19,317
469
""" Modified version of build_clib that handles fortran source files. """ import os from glob import glob import shutil from distutils.command.build_clib import build_clib as old_build_clib from distutils.errors import DistutilsSetupError, DistutilsError, \ DistutilsFileError from numpy.distutils import log from d...
66e4a3ce725864ad193e9c92a78053e764549ba14d81ecc0e6c1e0dc0b846152
Python
19,347
512
from typing import List import pytest import numpy as np from scipy.sparse import csr_matrix, issparse from anndata import AnnData from scvelo.preprocessing.moments import ( get_moments, moments, second_order_moments, second_order_moments_u, ) class TestGetMoments: @pytest.mark.parametrize("da...
84e68e051f2a2a7a2373aab5c510b72e626aa3b11a9d54f5ec9e35ddbe570eed
Python
19,359
369
import torch import os import re import sys import json import numpy as np import torch.nn as nn from collections import OrderedDict from src.layers import conv2d_same from src.layers import padding as pad_utils from src.custom_modules import HannPooling2d class SimpleAttentionalGain(nn.Module): def __init__(se...
e451a87b5571266899f90e29dbcd5146c0e11abe1992a3807acf29aedb91f904
Python
19,380
408
''' Related Figures:s5 ''' import os import torch import scipy.io import torch.nn as nn import torch.nn.functional as F import numpy as np from sklearn.linear_model import LinearRegression class WaveletConvolution(nn.Module): """ A wrapper around two Conv1d layers, one (feat / hpf)which returns the interme...
bed5fbef0ca2ff6abc28efbecf66fd4d02fbbe01c32c9187ab336f236ffc2b47
Python
19,383
340
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(1, 0, 2) class MlpReplayBuffer(object): def __init__(self, policy_info, policy_agents, buffer_size, use_same_share_obs, use_avail_acts, ...
9da97924c91a7f4949a69449a3b0f70051ee793f9d4ec5d8e7ce42cb6f963871
Python
19,385
266
#!/usr/bin/env python # coding: utf-8 # # AdEx double pool SDE system # In[4]: #export # Initialization import numpy as np # ## Derivatives of transfer functions with respect to firing rates # In[5]: #export def diff_fe(TF, fe, fi ,XX, df=1e-5): return (TF(fe+df/2., fi,XX)-TF(fe-df/2.,fi,XX))/df ...
5e585918f390e6928bd0cab6c5005ab1585ccd2b634946948ad40675b85c47ba
Python
19,410
600
""" Backend magic inherited from tensornetwork: numpy backend """ # pylint: disable=invalid-name import logging from typing import Any, Callable, Optional, Sequence, Tuple, Union import numpy as np import tensornetwork from scipy.linalg import expm, solve, schur from scipy.special import softmax, expit, ive, jv fro...
cb8ac7e4f916f1db073ed61c2cefa0d4b8d1081b006c990a65d561f41b968f2c
Python
19,452
448
""" Additional filtering: germline-specific factors (e.g. MAF <0.01) Enable filter to a subset of variants likely to be high impact and biologically relevant. Modified from this notebook: https://app.terra.bio/#workspaces/vanallen-firecloud-nih/Germline_pipeline_components/analysis/launch/Jan2023_PathogenicVariantFilt...
f3682030da63912603bb84e4def992d334f09fc019dd5a828be3244133f6a5a0
Python
19,459
567
from __future__ import annotations import decimal import operator 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.decimal.array import ( DecimalArray, DecimalDtype, make_data, to_decimal, ) @pytest...
2c730cc3f71eb4d3da96a1b5b2e46c3d906a82968e4110996da092fec8611f41
Python
19,472
759
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Sep 1 18:04:35 2019 @author: charleshen @note: this code derived from PybioMed<https://github.com/gadsbyfly/PyBioMed>, with a major modified """ from rdkit import Chem from rdkit.Chem import rdPartialCharges as GMCharge import numpy ############...
9e3977f0fc6617f3e6d3529e8e6f60b37c7aa1af2a0ee06bb0416020dc9f6fc8
Python
19,473
541
import os os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3" import typing import numpy as np from tensorflow.keras.models import Model import plotly.graph_objects as go from plotly.subplots import make_subplots from plotly.colors import n_colors from .data import tokenize_sequence from .constants import * def get_determine...
bfac366c54ad022b89a617c5cb117d196002560934a36eebed7478b5cca062ab
Python
19,521
481
import time import numpy as np import multiprocessing as mp import sys from PyQt6 import QtWidgets, QtGui from PyQt6.QtWidgets import QApplication, QWidget from pyqtgraph.Qt import QtCore from datetime import datetime import os from GUI import App import zmq import struct import socket from ctypes import * from Clien...
5e173d0d0fe806ab1c2819499bb0096b9eaa34186dd3337fbd977ec548f008b5
Python
19,550
535
"""Widget for creating TiffCollectionReader configurations via a dialog interface.""" from __future__ import annotations from pathlib import Path from typing import TYPE_CHECKING, cast from pymmcore_widgets.useq_widgets import WellPlateWidget from pymmcore_widgets.useq_widgets._well_plate_widget import ( DATA_PO...
26491126fd1ffc15e407ece7549180027f344bd923bc0718651a074707538876
Python
19,610
593
import numpy as np import pytest import tensorcircuit as tc from tensorcircuit.pauliprop import ( PauliPropagationEngine, SPARSE_WORD_QUBITS, SparsePauliPropagationEngine, pauli_propagation, ) @pytest.mark.parametrize("backend", ["npb", "jaxb"]) def test_initialization(request, backend): request.g...