sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
2ea72ed35c28694eed05a93a045cbd8a0424802ebfbc6c8caa87bdad8399645a
Python
632
21
"""Tools for visualizing data on brain and scalp surface representations.""" from .brain_and_scalp import plot_brain_in_axes, plot_brain_and_scalp from .image_recon import image_recon, image_recon_multi_view, image_recon_view from .montage import plot_montage3D from .optode_selector import OptodeSelector from .scalp_p...
4ee61f051f889f978da011eb64d40c5007d7db5bb210b86a9e1768dcdd99141d
Python
632
23
#!/usr/bin/env python3.7 """Defines the Saveable 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 pickle ...
b9e7d462791cf8e11a32d0e7cdc517f5cd44d09a23b7ed6946e3c9eafe9471bb
Python
633
45
""" Created on Jun 5, 2024 Not standard 10-20 EEG Montage. Duke just called it this. @author: mning """ import logging logger = logging.getLogger("root") def get1020() -> list: chns_10_20 = [ "Fp1", "Fp2", "F7", "F3", "Fz", "F4", "F8", "FC5", ...
940f343403a4bb4cf6f8be54f25ee7bdd6a1140070ec2d5b2788da63c18f96f8
Python
634
13
def debug_vscode(): """ Since this requires listening on a local port, this will only work when VSCode is connected to the same machine. Before running, add the following to your launch.json: {"version":"0.2.0","configurations":[{"name":"Python: Remote Attach","type":"python","request":"attach","con...
b5ff5c14a869b869b053e08830b148da8859df7f7be8381a1fcf172146618858
Python
634
28
from __future__ import annotations from ..utils._typed_cache import typed_cache from ..counts._count_sentences import count_sentences from ..counts._count_words import count_words @typed_cache def sentences_per_word(text: str) -> float: """Get the number of sentences per word. A combination of the functions...
d7452ba25835683006d041d87dcbce6f33a0a915740118761a10e4944838bd2d
Python
634
17
# XXX: Handle setuptools ? from distutils.core import Distribution # This class is used because we add new files (sconscripts, and so on) with the # scons command class NumpyDistribution(Distribution): def __init__(self, attrs = None): # A list of (sconscripts, pre_hook, post_hook, src, parent_names) ...
e57148afb1d5d4389ca21826d1926efba6ab827d907743b0112d9b0714300a3d
Python
635
30
""" Functions for defining unary operations. """ from __future__ import annotations from typing import ( TYPE_CHECKING, Any, ) from pandas.core.dtypes.generic import ABCExtensionArray if TYPE_CHECKING: from pandas._typing import ArrayLike def should_extension_dispatch(left: ArrayLike, right: Any) -> bo...
05aff6d7b9a4f513d0cf495d334e93c1e7d5694584d2ce13480883c25f26b4a7
Python
637
28
from __future__ import annotations from ..utils._typed_cache import typed_cache from ..counts._count_syllables import count_syllables from ..counts._count_words import count_words @typed_cache def syllables_per_word(text: str, lang: str) -> float: """Get the average number of syllables per word. Parameters ...
2f77c48c04cfb00cb76baceb75025a5d7690ec5bd1d8b39e88f24c8c6364c0a4
Python
637
18
from pandas import Index import pandas._testing as tm from pandas.core.construction import extract_array def test_extract_array_rangeindex(): ri = Index(range(5)) expected = ri._values res = extract_array(ri, extract_numpy=True, extract_range=True) tm.assert_numpy_array_equal(res, expected) res =...
7e038a3f4cd2021c438bc6018d3a858430287d8474a7c06dd5e41414dbe70a42
Python
637
34
project = "Textstat" master_doc = 'index' extensions = ['releases'] releases_github_path = 'textstat/textstat' releases_unstable_prehistory = True html_theme = 'alabaster' templates_path = [ '_templates', ] html_sidebars = { '**': [ 'about.html', 'navigation.html', 'relations.html'...
64d4e9c12cd12efc4c33c0233703d152e61abe066c445e621a5fc4349b187453
Python
638
16
import os import sys sys.path.append('/ImagePTE1/ajoshi/code_farm/bfp/src/stats') from surfproc import view_patch_vtk, smooth_patch from dfsio import readdfs,writedfs bfp_path='/ImagePTE1/ajoshi/code_farm/bfp' lsurf='' smooth_iter=1000 lsurf = readdfs(os.path.join(bfp_path, 'supp_data/bci32kleft.dfs')) lsurf = smooth_p...
965f302782ae99ecf72033eb3ccfea17314138b7db2d5e7ca609410cb32c9988
Python
638
24
import muon as mu import scanpy as sc mdata = mu.MuData( { 'rna': sc.read_h5ad(snakemake.input.merged_rna_anndata), # type: ignore 'atac': sc.read_h5ad(snakemake.input.merged_atac_anndata) # type: ignore } ) mu.pp.neighbors(mdata, key_added='wnn', metric='cosine', low_memory=True) mu.tl.um...
d6753c06cd65858bd7e4f83c0177a06404647d19d40a5d84dd4d85c679f5755b
Python
638
26
from __future__ import annotations import pytest from textstat.backend import counts from .. import resources @pytest.mark.parametrize( "text,expected", [ ("", 0), ("a", 1), ("a ", 1), ("a b", 2), ("They're here, and they're there.", 24), ( """Who's...
dfb798c0c36a30bc1a9c85bdfbade1ae891a7274b3d8afeab4f52591da6c4e3a
Python
640
47
import numpy as np nd1 = np.array([[1, 2], [3, 4]]) # reshape nd1.reshape(4) nd1.reshape(2, 2) nd1.reshape((2, 2)) nd1.reshape((2, 2), order="C") nd1.reshape(4, order="C") # resize nd1.resize() nd1.resize(4) nd1.resize(2, 2) nd1.resize((2, 2)) nd1.resize((2, 2), refcheck=True) nd1.resize(4, refcheck=True) nd2 = n...
ef6f0cdc4be69cf6d55d2ec4c5796fda432ee9bef012ca0fbad11f97eb9593f2
Python
640
27
from ..structs import RequirementInformation from .abstract import AbstractResolver, Result from .criterion import Criterion from .exceptions import ( InconsistentCandidate, RequirementsConflicted, ResolutionError, ResolutionImpossible, ResolutionTooDeep, ResolverException, ) from .resolution im...
f69fd2466b718f6cdcd5da18f487b7772cb92735b2fad090585a1a8dc0095263
Python
640
20
"""Test deprecation and future warnings. """ import numpy as np from numpy.testing import assert_warns def test_qr_mode_full_future_warning(): """Check mode='full' FutureWarning. In numpy 1.8 the mode options 'full' and 'economic' in linalg.qr were deprecated. The release date will probably be sometime ...
046685fb6bef1d1a62a7a61dee34778ef02735154a3bb91b67dfae74ab5e339d
Python
641
24
import inharmonicon import numpy as np import antropy jitters = np.geomspace(0.005, .5, 10)[:7] f0 = 440 f_max = 20000 n_runs=100 entropies = np.zeros((n_runs,7)) for i in range(n_runs): sounds = [] for jitter in jitters: this_series = inharmonicon.Harmonics(f0=f0, fmax=20000, jitter_rate=jitter) ...
54fb32d122ea6ca6941a00ea7ac6179a362e2e99cf2be5f2cec7aa995e509e13
Python
641
20
import pytest import numpy as np from . import util @pytest.mark.slow class TestCommonBlock(util.F2PyTest): sources = [util.getpath("tests", "src", "common", "block.f")] def test_common_block(self): self.module.initcb() assert self.module.block.long_bn == np.array(1.0, dtype=np.float64) ...
5012837e745e2506b54eb13719809db4cf92068e48ddec9e9a5c217f7e4d9dd0
Python
642
22
import csv import os def write_csv(foldername, sess, prot, fname, liste): """ Define the output pathway and create the corresponding csv files """ path_output = os.path.join(foldername, sess, prot, fname) with open(path_output, 'w') as fp: a = csv.writer(fp, delimiter=',') a.writer...
9a3f8e81fe53adb1a6f7845db06f0a23941d6186de69b60e38ff0ccd66eec812
Python
642
20
from __future__ import annotations from typing import TYPE_CHECKING from micromanager_gui._widgets._stage_control import StagesControlWidget if TYPE_CHECKING: from pymmcore_plus import CMMCorePlus from pytestqt.qtbot import QtBot def test_stage_widget(qtbot: QtBot, global_mmcore: CMMCorePlus, _run_after_ea...
a691a354bbc178df21c2b556e24bd5f62bd573c9a6728b0c52fd28ece26cd0d1
Python
642
18
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name = "scrublet", packages = ['scrublet'], package_dir={'': 'src'}, version = '0.2.2', description = 'Doublet prediction in single-cell RNA-sequencing data', long_description=long_descripti...
e693f729ce5de1027f734285b31adfca18e23d57bb275ccea9215b140cdc57e6
Python
642
34
class ConsoleError(Exception): """An error in console operation.""" class StyleError(Exception): """An error in styles.""" class StyleSyntaxError(ConsoleError): """Style was badly formatted.""" class MissingStyle(StyleError): """No such style.""" class StyleStackError(ConsoleError): """Style...
0f474534acb0592fc6d71b2647a306172215b1e093663013b3df5f2f67b97e54
Python
643
23
#replace this code with code to read inputs from file, normalize, and sort into lists import tensorflow as tf import numpy as np # import pulse2percept as p2p import random def parse_inputs(inputsfile): inputlist = [] infile = open(inputsfile, "r") data = infile.readlines() infile.close() for line ...
54bfb151fe670f9d9a611a3ad2a9970cb30eb4d8c25d22ef76950116ecb3bf57
Python
643
25
from protgps.utils.registry import register_object import pytorch_lightning as pl import os from protgps.utils.classes import ProtGPS @register_object("tensorboard", "logger") class PLTensorBoardLogger(pl.loggers.TensorBoardLogger, ProtGPS): def __init__(self, args) -> None: super().__init__(args.logger_d...
1462649ed30facdf229b0be7087561995b2b38bbb043bc6030857c80ca7a7bd0
Python
645
32
from abc import ABC, abstractmethod import numpy as np class CameraSource(ABC): @abstractmethod def get_width(self) -> int: raise NotImplementedError @abstractmethod def get_height(self) -> int: raise NotImplementedError @abstractmethod def get_fps(self) -> float: ra...
5ea4a05caf80824e59b68dc7740661994779ce5dbe20c8b9e2293a217ede775a
Python
645
28
import numpy as np import circe as ci import scanpy as sc import scipy as sp adata = sc.read_h5ad(snakemake.input.celltype_atac) adata.var['start'] = adata.var['start'].astype(int) adata.var['end'] = adata.var['end'].astype(int) adata.var['chr'] = adata.var['chromosome'] adata = ci.metacells.compute_metacells( ad...
28bd716a2a79afb9d8fb7a0b5b5e9b9a881f918963b062442462b19fac3bd85a
Python
646
28
import pytest from pandas.compat import PY311 from pandas import ( offsets, period_range, ) import pandas._testing as tm class TestFreq: def test_freq_setter_deprecated(self): # GH#20678 idx = period_range("2018Q1", periods=4, freq="Q") # no warning for getter with tm.as...
2e08b745110b5557a872af61125cd2bb8cf1e1cd479b02b3da201ff072454543
Python
646
29
from __future__ import annotations from ..utils._typed_cache import typed_cache from ._sentences_per_word import sentences_per_word from ._chars_per_word import chars_per_word @typed_cache def gulpease_index(text: str) -> float: """Calculate Indice Gulpease Index for Italian texts https://it.wikipedia.org/wi...
8d364d8feaff9f498bd27dc7cb3511ac9b139cc55b4110f55f1a696bbec3cedb
Python
647
23
import os from os import PathLike from pathlib import Path from typing import List, Sequence def basename(path: os.PathLike) -> str: while Path(path).stem != str(path): path = Path(path).stem return str(path) def write_empty_file(filename: os.PathLike) -> None: open(filename, mode='w').close() ...
01f17dd02edbef8f69345844d7574be9b1619f35da95e0ce52b0d3e6708c9434
Python
648
29
from .layer import Layer from .titlecluster import TitleCluster class TitleLayer(Layer): ''' classdocs ''' def __init__(self, neutype='LIF'): ''' Constructor ''' self.neutype = neutype self.groups = {} def setTestStates(self): for id, g in self.g...
f0bc3390275870f2177bf6fe7b874c273ebe4b2f145e491e0caedb31af669ba8
Python
648
24
import numpy as np import logging import yass from yass import preprocess from yass import detect from yass import cluster np.random.seed(0) # configure logging module to get useful information logging.basicConfig(level=logging.INFO) # set yass configuration parameters yass.set_config('config_sample.yaml', 'preproc...
7e13b6ed185df91f084092a7b8fbcc20c82db3394a12a935812772101b6f2cbd
Python
649
21
import numpy as np def construct_balanced_subset(x, y): xdata, ydata = [], [] minsize = np.inf for cls_ in np.unique(y): xdata.append(x[y == cls_]) ydata.append(y[y == cls_]) if ydata[-1].shape[0] < minsize: minsize = ydata[-1].shape[0] for i in range(len(xdata)): ...
bb9fe52cf7e8314ea2fab9eae64b5b57b94b5daa5364b5fb1475dc6722528cd5
Python
649
17
## ........................................................................... ## ## PIMMS (Polymer Interactions in Multicomponent Mixtures) ## Alex Holehouse, Pappu Lab, Holehouse Lab ## Copyright 2015 - 2026 ## ........................................................................... from . import mega_crank #...
f6ad72e7a377f37e49007d66d1c7063502350000e28e4eded3a94b3ff76187e6
Python
651
19
# -*- coding: utf-8 -*- import numpy as np def calc_score(probe_type_list, pt_fdbk_list, key_present, key_absent): """ Calculate the final score of the participant based on the number of correct answers. """ probe_type = np.array(probe_type_list) pt_fdbk = np.array(pt_fdbk_list) correct_a...
f0d28e52c13c5ad87e5a6238265bdf100b110f1be1cad944ce88c00654e57542
Python
652
30
import torch import numpy as np device = torch.device("cuda" if torch.cuda.is_available() else "cpu") def unit(x): if len(x.shape)>0: maxx=np.max(x) minx=np.min(x) marge=maxx-minx if marge!=0: xx=(x-minx)/marge xx=np.clip(xx, 0,1) else: xx...
8090d05c99306423f55c750cdd54d9f3ab031ee8927870219482e457725785d5
Python
653
27
"""Tests for fooof.plts.fm.""" from py.test import raises from fooof import FOOOF from fooof.plts.fm import * from fooof.tests.utils import plot_test ################################################################################################### ###################################################################...
85eff0e2a410552d99d66b391824e9b434d734e5c15f0d27f334ae582a7c9fa6
Python
653
26
from __future__ import annotations import typing as t from .extension import SQLAlchemy __all__ = [ "SQLAlchemy", ] def __getattr__(name: str) -> t.Any: if name == "__version__": import importlib.metadata import warnings warnings.warn( "The '__version__' attribute is de...
a924783d4b801c43ead68f0d51e89ffcc4ab378debbd279642db264cae88d5ae
Python
653
30
import pytest from pandas import ( Period, PeriodIndex, Series, period_range, ) import pandas._testing as tm pytestmark = pytest.mark.filterwarnings( "ignore:Setting a value on a view:FutureWarning" ) @pytest.mark.parametrize( "cons", [ lambda x: PeriodIndex(x), lambda x:...
529e5edc2025a33fe64ebccbba01f08597de386ef6177eee7267a0ff1f852548
Python
654
23
"""Helper script to download datasets. This script retrieves datasets used in example notebooks so that notebooks can be rendered in parallel. """ import cedalion.data as data data.get_fingertapping() data.get_fingertappingDOT() data.get_colin27_headmodel_files() data.get_icbm152_headmodel_files() data.get_ninja_ca...
915dfd52030cbd4082c4a4f8543b073a6d8a19919344b5fe9f66f7d86f948502
Python
654
26
from __future__ import annotations from ..utils._typed_cache import typed_cache from ._count_syllables import count_syllables from ..selections._list_words import list_words @typed_cache def count_polysyllable_words(text: str, lang: str) -> int: """Count the words with three or more syllables. Contractions and h...
54e7a4375874f8bddc974feb0aee5c809ba9ac7782c43997c2983178f697c2b8
Python
656
22
import os import seaborn as sns from nilearn.plotting import view_img_on_surf from nilearn import image sns.set_theme() sns.set_style("whitegrid") sns.set_context("talk") ### plot fmri image for methods cache = DATA_ROOT = "/storage/store/work/haggarwa/" DATA_ROOT2 = "/storage/store2/work/haggarwa/" output_dir = os.p...
6d3c82cfd118dcd55c7056f8ef6c3b82a331ae689d06cc4766396c7cc6b03ec9
Python
657
21
__all__ = [ 'LFC', #'ATE', 'SATE', 'FC', 'fit_glm', 'reset_random_seeds', 'fit_gcate' ] from causarray.DR_learner import LFC # ATE, SATE, FC from causarray.gcate_glm import fit_glm from causarray.utils import prep_causarray_data, reset_random_seeds, comp_size_factor from causarray.gcate import * from ca...
d28fdb89523ec0b87b91cc3d147bdbc18cb336f3343c8d3a4110f6661883d85b
Python
658
29
""" Helpers for sharing tests between DataFrame/Series """ from __future__ import annotations from typing import TYPE_CHECKING from pandas import DataFrame if TYPE_CHECKING: from pandas._typing import DtypeObj def get_dtype(obj) -> DtypeObj: if isinstance(obj, DataFrame): # Note: we are assuming on...
3b8d61c1518bc85b4886ffb36ded890598aa0f785e180ecb3a4d7446ec5f70a7
Python
659
25
def get_groupby_method_args(name, obj): """ Get required arguments for a groupby method. When parametrizing a test over groupby methods (e.g. "sum", "mean", "fillna"), it is often the case that arguments are required for certain methods. Parameters ---------- name: str Name of the ...
670e8a487f08387d285c597a2391931fe58f1ff456ddc1f1ea75566d2a24e6ec
Python
659
16
import pandas as pd # Read the files cluster_df = pd.read_csv('CT2_log/euclidean/final_candidate/cluster.csv') distances_df = pd.read_csv('CT2_log/euclidean/high_variation_genes/deletion_distance.csv') # Merge the dataframes merged_df = pd.merge(cluster_df, distances_df, left_on='Gene Name', righ...
e134df8ec98fb03c815091be24d38c8e1c193c39bafedf19ccf34e59ae93477f
Python
660
23
from .lifneuron import LIFNeuron class GenreLIFNeuron(LIFNeuron): ''' classdocs ''' def __init__(self, tau_ref=0, vthresh=5, Rm=2, Cm=0.2): ''' Constructor ''' LIFNeuron.__init__(self, tau_ref, vthresh, Rm, Cm) def update(self, dt, t): self.spike = False ...
208447a4eb099494a0923ab5528781a0c4ea86f369de037d17231be4a7fc125e
Python
661
26
# This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. __all__ = [ "__title__", "__summary__", "__uri__", "__version__", "__author__", "__email__", "__license__", ...
2f57c60eccb676666a7ffcb76d7568f6650caf526c962f4175270284e110927b
Python
661
30
import pytest from pandas import ( Series, Timedelta, TimedeltaIndex, timedelta_range, ) import pandas._testing as tm pytestmark = pytest.mark.filterwarnings( "ignore:Setting a value on a view:FutureWarning" ) @pytest.mark.parametrize( "cons", [ lambda x: TimedeltaIndex(x), ...
374d3f8a0536e7f1e362ebc0a8340aa81a6a6f3e878c1f7ba3d131bdba3d0733
Python
662
27
import pytest from pandas import DataFrame import pandas._testing as tm class TestGet: def test_get(self, float_frame): b = float_frame.get("B") tm.assert_series_equal(b, float_frame["B"]) assert float_frame.get("foo") is None tm.assert_series_equal( float_frame.get("...
7550de992a50779226414c9dc849f1de91616db47dd46f3a4040289fa8e41430
Python
663
17
from DPOAE_analysis import ExperimentEvaluator main_path = '/Path/To/Your/Data/' # Update this to your actual data path # create list of participants to be processed # also works for subsample of participants subjects = [f'P{str(p).zfill(2)}' for p in range(1, 41)] exclude = ['P13', 'P20'] subjects = [subject for su...
eda8d96d8657f626cb17e9cd40dc5418da320ed81dd62cbd7848eb70a6d98d1d
Python
663
18
# -*- coding: utf-8 -*- # # __init__.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.o...
01d8b9291959c439327bc29b398250511708e2b0bbc3a1f4113761b6d443ca29
Python
665
28
import pytest import pandas import sbmlcore def test_tempfactors(): a = sbmlcore.TempFactors('tests/3pl1.pdb') assert len(a.results) == 185 # check that all the -180 < phi <= 180 (and also for psi) assert all(a.results.temp_factor >= 0) assert float(a.results[a.results.resid==1].temp_factor)...
065b2f6c7cb1e80518b6e645cd5ef2da5514ec9f897d32bac3942f762ac0a984
Python
666
19
## ........................................................................... ## ## PIMMS (Polymer Interactions in Multicomponent Mixtures) ## Alex Holehouse, Pappu Lab, Holehouse Lab ## Copyright 2015 - 2026 ## ........................................................................... from . import mega_crank #...
75708fb4b8867d0f41da983fb3f60aedfbd6c145be09b54e3d8527f69685a2c9
Python
666
24
""" Tests for Timestamp timezone-related methods """ from datetime import datetime from pandas._libs.tslibs import timezones from pandas import Timestamp class TestTimestampTZOperations: # ------------------------------------------------------------------ def test_timestamp_timetz_equivalent_with_datetime_...
9f9df45a13c274cf5280b0305a7589f49d6f61f616deff460f2d9a37cd5dd39f
Python
666
24
from .lifneuron import LIFNeuron class ComposerLIFNeuron(LIFNeuron): ''' classdocs ''' def __init__(self, tau_ref=0, vthresh=5, Rm=2, Cm=0.2): ''' Constructor ''' LIFNeuron.__init__(self, tau_ref, vthresh, Rm, Cm) def update(self, dt, t): self.spike = Fals...
adf2a0cb7d5405c52102f3fd9a8ce5493dc4fd1e4af32fc310fe875ea6e913a4
Python
667
29
from __future__ import annotations from ..utils._typed_cache import typed_cache from ..counts._count_letters import count_letters from ..counts._count_words import count_words @typed_cache def letters_per_word(text: str) -> float: """Calculate the average word length in letters. This function is a combinati...
1e06453d3d3686e8093bbba14938f079b70a39ddf82647186368123ed3b27668
Python
668
25
""" config for datetime formatting """ from __future__ import annotations from pandas._config import config as cf pc_date_dayfirst_doc = """ : boolean When True, prints and parses dates with the day first, eg 20/01/2005 """ pc_date_yearfirst_doc = """ : boolean When True, prints and parses dates with the yea...
6991ad516a67e02a054c3d114cc5627de994c05bdd663bf9eebbd862f3d61dbc
Python
669
30
from __future__ import annotations from ..utils._typed_cache import typed_cache from ._letters_per_word import letters_per_word from ._words_per_sentence import words_per_sentence @typed_cache def gutierrez_polini(text: str) -> float: """Calculate Guttierrez de Polini index https://legible.es/blog/comprensi...
6321547bfb34c509d85a0ca43ebb4da21f37555fed0305421fb69332554ad184
Python
670
22
from __future__ import annotations import pytest from textstat.backend import metrics from .. import resources @pytest.mark.parametrize( "text, lang, expected", [ (resources.EMPTY_STR, "en_US", 0.0), (resources.EASY_TEXT, "en_US", 113.418), (resources.SHORT_TEXT, "en_US", 117.74), ...
6815343635486134103c1e29c21008b8252c6b96c6dfcb9b9f80554c08c10550
Python
670
23
from typing import Union from ase import Atoms from ase.calculators.calculator import Calculator, compare_atoms from AIMD.protein import Protein def check_state(self: Calculator, atoms: Union[Atoms, Protein], tol=1e-15): r""" Check for any system changes since last calculation. - Skips the check and ass...
d4ac9ea5d284e35670452f89cdc2b38ce7dc5cda3b2a78e30960c5e084ed01c9
Python
670
26
import numpy as np from rulebasedpolicy.point import * class RandomMap: def __init__(self, size, board): self.size = size self.board = board self.obstacle = size//8 self.GenerateObstacle() def GenerateObstacle(self): self.obstacle_point = [] # Generate an obsta...
5453e8e701aef94bed00e171de1a3120b991748f644cec4220824ce1faa04419
Python
671
33
import pytest import pandas as pd from pandas.tests.extension.list.array import ( ListArray, ListDtype, make_data, ) @pytest.fixture def dtype(): return ListDtype() @pytest.fixture def data(): """Length-100 ListArray for semantics test.""" data = make_data() while len(data[0]) == len(d...
8de920013ad3369d68be34ab9520f1934caf66e7e2d20c5249b048a99629581f
Python
671
17
import numpy as np import torch def assert_shapes_hamiltonian(batch): assert batch.forces.shape == batch.pos.shape assert isinstance(batch.hamiltonian, list) assert isinstance(batch.overlap, list) assert isinstance(batch.core, list) for H, S, C in zip(batch.hamiltonian, batch.overlap, batch.core):...
fe1131a738ed1f3daf2f31df5a5f00c5f5a1c29a3da661e32bf67f13c9f6c280
Python
671
25
"""Contains enums for partial task detection""" from enum import Enum class TASK(Enum): SAVE_GBKS = 0 HMM_SCAN = 1 HMM_ALIGN = 2 COMPARISON = 3 class INPUT_TASK(Enum): NO_DATA = 0 # nothing done yet NEW_DATA = 1 # new data incoming, all data in database accounted for PARTIAL_DATA = 2 ...
ea2fa97599dc56188244bfc284acab4cb3619f5e1a0dbb18c36e37f8f7c09c94
Python
673
27
__all__ = [ "NaT", "NaTType", "OutOfBoundsDatetime", "Period", "Timedelta", "Timestamp", "iNaT", "Interval", ] # Below imports needs to happen first to ensure pandas top level # module gets monkeypatched with the pandas_datetime_CAPI # see pandas_datetime_exec in pd_datetime.c import p...
045da7e4e790cf5416db149ecb62f17cd0adc1b8e74da7577481f6b68a8979c8
Python
677
29
# SPDX-FileCopyrightText: 2015 Eric Larson # # SPDX-License-Identifier: Apache-2.0 """CacheControl import Interface. Make it easy to import from cachecontrol without long namespaces. """ __author__ = "Eric Larson" __email__ = "eric@ionrock.org" __version__ = "0.14.3" from pip._vendor.cachecontrol.adapter import Cac...
150845476227a70240dc57d74c32c0762bdfe93337327939d818b497c110431e
Python
677
29
import pytest import pandas import sbmlcore def test_rasp(): a = sbmlcore.RaSP('tests/cavity_pred_3PL1_A.csv') assert len(a.results) == 185*20 assert all((a.results.rasp_score_ml_fermi >= 0) & (a.results.rasp_score_ml_fermi <= 1)) assert all(a.results.rasp_score_ml >= -2) # these should...
304a1dadfda53f07595fbb2db6425b6a7ad47b169ee5321a55301c153993c3e9
Python
677
25
from .hamiltonian_dataset import ( # database interface for Hamiltonian datasets HamiltonianDatabase, HamiltonianDataset, ) from .nablaDFT_dataset import ( # PyTorch Lightning interfaces for datasets ASENablaDFT, PyGHamiltonianDataModule, PyGNablaDFTDataModule, ) from .pyg_datasets import ( # PyT...
26d760d8c37cb4b02a7f16dbe30313589b2b0a8d0d2167ba95c3242e76544c43
Python
678
22
import torch from .rk_common import _ButcherTableau, RKAdaptiveStepsizeODESolver _FEHLBERG2_TABLEAU = _ButcherTableau( alpha=torch.tensor([1 / 2, 1.0], dtype=torch.float64), beta=[ torch.tensor([1 / 2], dtype=torch.float64), torch.tensor([1 / 256, 255 / 256], dtype=torch.float64), ]...
03e19b08795b0df54f181d7474d1a71a0e03b6b2ab9516d1b2961fb834d498f3
Python
679
22
import pytest from pandas import ( DataFrame, MultiIndex, ) class TestGetValue: def test_get_set_value_no_partial_indexing(self): # partial w/ MultiIndex raise exception index = MultiIndex.from_tuples([(0, 1), (0, 2), (1, 1), (1, 2)]) df = DataFrame(index=index, columns=range(4)) ...
923c01e75b490894b13dc401e7fa9d032610e1caa41f1d5f9b9b67ff03d20add
Python
679
20
# License: GNU Affero General Public License v3 or later # A copy of GNU AGPL v3 should have been included in this software package in LICENSE.txt. # for test files, silence irrelevant and noisy pylint warnings # pylint: disable=no-self-use,protected-access,missing-docstring import unittest from antismash.detection....
b6760ff84327a8f98abfe4790812c7265562681a7fdd3248de3e3ef8d7e002d1
Python
679
23
import os import sys import inspect from pettingzoo import test from smac.env.pettingzoo import StarCraft2PZEnv as sc2 import pickle current_dir = os.path.dirname( os.path.abspath(inspect.getfile(inspect.currentframe())) ) parent_dir = os.path.dirname(current_dir) sys.path.insert(0, parent_dir) if __name__ == "_...
b92cfada4a1ec6723c59ab7304d9fff4414e4bf83f98956d3f546142adb324fb
Python
679
27
from typing import List import torch def accuracy(output: torch.Tensor, target: torch.Tensor, top_k=(1,)) -> List[float]: """Computes the precision@k for the specified values of k""" max_k = max(top_k) batch_size = target.size(0) _, predict = output.topk(max_k, 1, True, True) predict = predict.t...
424e72f83e7e39d4582a40a073e92d7312863464823ed788484b01c9715623d3
Python
680
41
from pandas.core.reshape.concat import concat from pandas.core.reshape.encoding import ( from_dummies, get_dummies, ) from pandas.core.reshape.melt import ( lreshape, melt, wide_to_long, ) from pandas.core.reshape.merge import ( merge, merge_asof, merge_ordered, ) from pandas.core.reshap...
703a239af287c691d2f6e94b0a495b5ae4299742a9e92fda46124881b1abe82a
Python
680
21
''' Primary Auditory Cortex ''' import torch from braincog.base.node.node import * from braincog.base.brainarea.BrainArea import * from braincog.base.connection import CustomLinear from braincog.base.learningrule.STDP import * class PAC(BrainArea): def __int__(self,w,mask): self.noteNetworks = NoteLIFNode...
85d13958177a4b2f869e7223ec08a96f4b4b91ebfeaabbfafd0e29aa8290750a
Python
680
30
"""Module containing code related to genbank file parsing and storage""" from .gbk import GBK from .region import Region from .candidate_cluster import CandidateCluster from .proto_cluster import ProtoCluster, MergedProtoCluster from .proto_core import ProtoCore, MergedProtoCore from .cds import ( CDS, check_tr...
95950b86d33ad0f598259242479cd50457e99cf6e45e738f319c59e4b39e503a
Python
680
21
import iaode def test_package_metadata() -> None: assert isinstance(iaode.__version__, str) assert iaode.__version__.startswith("0."), "Expected release-style version" assert "agent" in iaode.__all__ def test_get_data_dir_idempotent() -> None: cache_dir = iaode.datasets.get_data_dir() assert cac...
c0288df75f9e2f13915e546aba20f4f9e77fd27f1e19a51e0f5f3564e7c4b789
Python
680
15
from enum import Enum class Phase(Enum): """ Enumerates the distinct phases in the AmygdalaEngrams model: - PERCEPTION: Network processes sensory input and updates synaptic weights. - REFLECTION: (This constant exists for historical reasons -- Fiebig & Lansner (2014) postulated a replay of patterns in...
5eabc67806fd96b5cfd557702923af6c3bb2b6a0ee2795520ec2ca4006b98089
Python
682
19
import pytest import pandas._testing as tm class TestCategoricalWarnings: def test_tab_complete_warning(self, ip): # https://github.com/pandas-dev/pandas/issues/16409 pytest.importorskip("IPython", minversion="6.0.0") from IPython.core.completer import provisionalcompleter code =...
3bbb66ce9bc84f4baff47e4afb231329cc19a6697d704681e422d53225244429
Python
685
33
""" Public API for extending pandas objects. """ from pandas._libs.lib import no_default from pandas.core.dtypes.base import ( ExtensionDtype, register_extension_dtype, ) from pandas.core.accessor import ( register_dataframe_accessor, register_index_accessor, register_series_accessor, ) from pand...
be67b3b8a3112b73ddae7a6799412bcee0408e129de73cde9630df060e5cae8d
Python
685
29
from __future__ import annotations from ..utils._typed_cache import typed_cache from ..counts._count_words import count_words from ..counts._count_sentences import count_sentences @typed_cache def words_per_sentence(text: str) -> float: """Calculate the average number of words per sentence. This function is...
719a6dcf357d12b73eb246b78825d65b4ea5500c754f92818100a3a5827f73c9
Python
687
22
from .layer import Layer from .genrecluster import GenreCluster class GenreLayer(Layer): ''' This layer defines the information of composer name. One neuron corresponds to a composer ''' def __init__(self, neutype='LIF'): self.neutype = neutype self.groups = {} def setTestState...
c32e816398274bf7995cf83aab9bebb3b40ddaac7d162cebfa0672c31d259a6d
Python
687
20
import tensorflow as tf import tensorflow_probability as tfp #from https://github.com/kundajelab/basepair/blob/cda0875571066343cdf90aed031f7c51714d991a/basepair/losses.py#L87 def multinomial_nll(true_counts, logits): """Compute the multinomial negative log-likelihood Args: true_counts: observed count va...
7ee88172311b856da775a4f29e56420aa05381590e9daf29f7f7979557ec156d
Python
688
17
from typing import Optional from qtpy.QtCore import QModelIndex from qtpy.QtWidgets import QTableView, QWidget class ChannelTableView(QTableView): def __init__(self, parent: Optional[QWidget] = None) -> None: super(ChannelTableView, self).__init__(parent) self.horizontalHeader().setStretchLastSec...
b0431adfca9aaa3bf1d5989ddce0805236b7d4138153e512b9230f06f537ca3a
Python
689
24
"""Filetype information.""" from pip._internal.utils.misc import splitext WHEEL_EXTENSION = ".whl" BZ2_EXTENSIONS: tuple[str, ...] = (".tar.bz2", ".tbz") XZ_EXTENSIONS: tuple[str, ...] = ( ".tar.xz", ".txz", ".tlz", ".tar.lz", ".tar.lzma", ) ZIP_EXTENSIONS: tuple[str, ...] = (".zip", WHEEL_EXTENSI...
0cab8487657622424ebbe067bab5af6b1f0cab911c407b46f8afb39dc199469a
Python
690
21
""" Tests for the deprecated keyword arguments for `read_json`. """ from io import StringIO import pandas as pd import pandas._testing as tm from pandas.io.json import read_json def test_good_kwargs(): df = pd.DataFrame({"A": [2, 4, 6], "B": [3, 6, 9]}, index=[0, 1, 2]) with tm.assert_produces_warning(None...
fa13adf7fa6f95d785ebd314283d392c8661e19e890bb8a8ddafa473328537d8
Python
690
20
import time, os import pandas as pd os.environ["CUDA_VISIBLE_DEVICES"]="6" start = time.time() res = [] for epoch in [1, 10, 50, 100, 150, 300, 500]: cmd = '/home/sxh/anaconda3/envs/chemprop/bin/python train.py --data_path DMPNN/train_dmpnn.csv --dataset_type regression --config_path DMPNN/logs_config --save_...
040e2e7b9997e47d1684ba86fa093855231b60cf5fc3b8540f6bd6a4805770f1
Python
691
23
""" Testing pipeline.run """ import yaml from yass import pipeline def test_works_with_nnet_config(patch_triage_network, path_to_config, make_tmp_folder): pipeline.run(path_to_config, output_dir=make_tmp_folder) # def test_works_with_threshold_config(path_to_config_threshold, # ...
70f07f6bd2d7cf9c6fb116d7d68daac807632dab5925d43f2dce4c70d5fe5fb6
Python
691
31
"""Wrappers to call pyproject.toml-based build backend hooks. """ from typing import TYPE_CHECKING from ._impl import ( BackendUnavailable, BuildBackendHookCaller, HookMissing, UnsupportedOperation, default_subprocess_runner, quiet_subprocess_runner, ) __version__ = "1.2.0" __all__ = [ "B...
71147a23e948b1e7c6f79bc465bf13b9776f9b0ee974f15e76906778b54a046f
Python
692
20
import pytest import pandas._testing as tm from pandas.core.arrays import TimedeltaArray class TestAccumulator: def test_accumulators_disallowed(self): # GH#50297 arr = TimedeltaArray._from_sequence(["1D", "2D"], dtype="m8[ns]") with pytest.raises(TypeError, match="cumprod not supported")...
96c8e9527ea7c2e00cf886e5d17206fdcb1e56c14ad9f300d2ae95cfcaa4976b
Python
692
22
import numpy as np # from https://github.com/songrotek/DDPG/blob/master/ou_noise.py class OUNoise: def __init__(self, action_dimension, scale=0.1, mu=0, theta=0.15, sigma=0.2): self.action_dimension = action_dimension self.scale = scale self.mu = mu self.theta = theta self....
97d03bf6ee4f4dca1aef4836eb014f2d31a76ef6297bbea13e4d48bf7df881bd
Python
692
26
import numpy as np import pytest from pandas import ( NaT, PeriodIndex, period_range, ) import pandas._testing as tm from pandas.tseries import offsets class TestPickle: @pytest.mark.parametrize("freq", ["D", "M", "Y"]) def test_pickle_round_trip(self, freq): idx = PeriodIndex(["2016-05-...
c26524f71627636931df3d86bb0fb622027f153c13e00698b9dfbf15544ede19
Python
692
17
# Copyright (C) 2008,2010,2013 Bernd Feige # This file is part of avg_q and released under the GPL v3 (see avg_q/COPYING). """ Utility function to make a set_channelposition compatible string from a vector of channel names """ import math def channelnames2channelpos(channelnames): nr_of_channels=len(channelnames) nco...
7b7679e947ec16c14c4508e38c86b7107bee79f5b972cb12926ad1e68b9a2e04
Python
695
17
# 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 ...
08338dd396e70835f5e07a4a6e9d69ed9764e0c534d5a520f47d856f4ea510ec
Python
696
32
from __future__ import annotations import re from ..utils._typed_cache import typed_cache from ._count_words import count_words @typed_cache def count_sentences(text: str) -> int: """Count the sentences of the text. Parameters ---------- text : str A text string. Returns ------- ...
5cbe413a569111194f2d99db9cb96f1a6aeb8024de41fa721c4d77210b2be0ed
Python
697
19
import pandas as pd # PWS region genes pws_region_genes = ["MKRN3", "MAGEL2", "NDN", "NPAP1", "SNURF", "SNRPN", "UBE3A", "GABRB3", "GABRA5", "GABRG3", "ATP10A", "OCA2", "HERC2", "NIPA1", "NIPA2", "CYFIP1", "TUBGCP5"] # Read candidate genes candidates_df = pd.read_csv('CT2_log/euclidean/final_candi...
3324354c9196d981389afc35c2eebca126dc9b75d66a4bfffe78271824329a25
Python
698
25
import os import pandas as pd import starfile from pydantic import BaseModel class RlnTiltSeries(BaseModel): name: str data: pd.DataFrame class Config: arbitrary_types_allowed = True @classmethod def from_star_file(cls, filename: os.PathLike): star = starfile.read(filename, alwa...
4c9791e9e4328d928f06beb269098b650e42a6d8cc145bf6a5fbd14eb86decec
Python
698
32
"""Module containing code related to enums""" from .input_parameters import INPUT_MODE from .input_parameters import RUN_MODE from .source_type import SOURCE_TYPE from .partial_task import TASK, INPUT_TASK, HMM_TASK from .comparison import ( ALIGNMENT_MODE, EXTEND_STRATEGY, LCS_MODE, COMPARISON_MODE, ...
e3699d26ab6abd7dcf94149d721d58ea3441be17b42336713a82edf81197d374
Python
698
27
import numpy as np import pytest from pandas import ( Index, MultiIndex, ) # Note: identical the "multi" entry in the top-level "index" fixture @pytest.fixture def idx(): # a MultiIndex used to test the general functionality of the # general functionality of this object major_axis = Index(["foo",...
83f715dda83e80d3bdb26ef86f39a6fd1b710754caaa57550b0100cfc412ff4e
Python
700
25
"""module containing a test for the profiler""" # from python from unittest import TestCase import psutil import os import time # from this module from big_scape.diagnostics.profiler import calc_cpu_percent class TestProfiler(TestCase): """Test class for the profiler functions""" def test_cpu_percent_withi...