sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
08858e93289bad69b2f3af001988e51c5efebbca768c9f0e99f7607e3a2d6ccc
Python
433
17
"""Optimizers.""" from mrpro.algorithms.optimizers.OptimizerStatus import OptimizerStatus from mrpro.algorithms.optimizers.adam import adam from mrpro.algorithms.optimizers.cg import cg from mrpro.algorithms.optimizers.lbfgs import lbfgs from mrpro.algorithms.optimizers.pdhg import pdhg from mrpro.algorithms.optimizer...
4046a5b628e589bb839fe39a0f587819cb17716cd1738e3a573d4e06ebb8d791
Python
435
15
import json json_file = r"E:\experiment\samples\api.json" count_file = r"E:\experiment\frequencydata\all_api.json" entitylist = [] with open(json_file, 'r') as f0: data = json.load(f0) for i in data: info = list(i.values())[0] for s_info in info: if s_info not in entitylist: ...
497f24412ce2718b09ea4d098daed5a918ca59f292a70d223f6424618bcabca6
Python
435
12
"""PyTest fixtures for reconstruction tests.""" import pytest from mrpro.data import KData from mrpro.data.traj_calculators import KTrajectoryCartesian from tests.data import IsmrmrdRawTestData @pytest.fixture(scope='session') def cartesian_kdata(ismrmrd_cart: IsmrmrdRawTestData) -> KData: """Create Cartesian KD...
901d265d5fe47129070e2ffda6460dda84bdf403a7bd8513fdef530c0ea2cc34
Python
435
15
#!/opt/local/bin/python2.7 import sys from Common import diffeo def main(): if not (len(sys.argv) == 3): print 'Usage: computeJacobianFromLDDMM LDDMM_map_file.vtk result.vtk' sys.exit(0) v = diffeo.Diffeomorphism(filename=sys.argv[1]) u = diffeo.jacobianDeterminant(v.data, resol = v.resol,...
feda99c39f86f959925a98f10145405222a3a90d78448d4b78eef476dceec320
Python
435
10
"""Removed — use the litpose CLI instead.""" raise SystemExit( "scripts/predict_multi_view.py has been removed.\n" "Please use the command line interface instead:\n\n" " To predict on a folder of video files:\n" " litpose predict <model_dir> <video_files_dir>\n\n" "For more information, visit:\...
e6bd67f43a7ec0ebf455487dde5a1047e94764e80ea4638c54d2a316ed6ab0af
Python
437
19
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Feb 26 17:41:51 2023 @author: tomas """ import glob import pathlib csvnames = glob.glob("framedata/**/*.csv", recursive=True) for name in csvnames: csvpath = pathlib.Path(name) txtpath = csvpath.with_suffix(".txt") with open(csvpath) as cs...
0d99665ed3117b0936fbe9b36185d9a8bf2024a785dc7501268018e1a879ce05
Python
438
22
from dataknead import Knead import csv import json def vanilla(): data = [] with open("input/cities.csv") as f: reader = csv.DictReader(f) for row in reader: data.append(row) with open("output/lead-cities-vanilla.json", "w") as f: json.dump(data, f) def knead(): ...
6c862343de554241931e4ea176ecf69d3c5002af9fc02a2731f2abad37276692
Python
439
9
from biophysics_fitting.setup_stim import setup_apical_epsp_injection as setup_apical_epsp_injection_ def apical_epsp_injection(cell, dist = None, amplitude = None, delay = None, rise = 1.0, decay = 5): ''' This injects epsp shaped current at a certain distance from the soma. ''' setup_apical_ep...
4266561d29a118c6c4d1b01e919bf3137e233b5fe8b3040bb3e46e7e37bae2ba
Python
440
10
from biophysics_fitting.setup_stim import setup_soma_step def apical_current_injection(cell, amplitude = None, delay = None, duration = None, dist = None): # note: setup_soma_step has been extended to support a dist parameter setup_soma_step(cell, amplitude = amplitude, ...
837125ea0b12bd51de6430f9b891e80eaa011e3e358d4f27ea019a301128fc09
Python
442
17
# -*- coding: utf-8 -*- try: from ptemcee import Sampler as PTSampler except ImportError: class PTSampler(object): def __init__(self, *args, **kwargs): raise ImportError( "The PTSampler from emcee has been forked to " "https://github.com/willvousden/ptemcee...
943e194e54183ffd3c8870b95e6519ee4399b400a0fb0910b57b82ff86f835df
Python
442
20
import torch import numpy as np class AvgMeter(object): def __init__(self): self.reset() def reset(self): self.val = 0 self.avg = 0 self.sum = 0 self.count = 0 self.losses = [] def update(self, val, n=1): self.val = val ...
e69adff026e6b07313d814be7dcb7ccd3c68ff9388e6cc5266efd76e83981ac7
Python
444
15
import sys punc = ["-LRB-", "-RRB-", ",", "-", ";", ":", "\'", "\'\'", '\"', "`", "``", ".", "!", "?", "*FOOT*", "-RRB-", ",", "-", ";", ":", ".", "!", "?"] for line in sys.stdin: if line.strip() != '': wrds_in = line.strip().split() wrds_out = [] for w in wrds_in: if w in punc...
6548b77e913bc28792bc05d1cf305fa7ea565c82a030aaf470c60854fd132122
Python
445
14
# JN 2016-01-22 from __future__ import absolute_import DATE_FNAME = 'start_stop_datetime.txt' from .helper.create_attrs import make_attrs from .helper.helper import parse_datetime from .manager.tools import debug from .manager.man_continuous import H5Manager from .manager.tools import expandts from .helper.helper imp...
e28bc12984f99d3011941206e322ba3575372219d7adab80b8646a0f353b132a
Python
445
14
"""Tests for simulation of coil sensitivities.""" from mrpro.data import SpatialDimension from mrpro.phantoms.coils import birdcage_2d def test_birdcage_sensitivities_shape(): n_z = 1 n_y = 200 n_x = 150 n_coils = 4 image_dimension = SpatialDimension(z=n_z, y=n_y, x=n_x) simulated_coil_sensit...
29555d5e8944a6c948216e965edca382f2445479171f492f6920737084cda3f9
Python
446
22
# JN 2016-06-01 """ given dropfiles, create a common one (lines contained in all files) """ def common_dropfile(fnames): sets = [] for fname in fnames: with open(fname, 'r') as fid: sets.append(set([l.strip() for l in fid.readlines()])) return sorted(sets[0].intersection(*(sets[...
9c4995f78e976a2a3e5a4bfab7e727b80b150ee2582b5f58e079fc0825542bf5
Python
446
19
import sys, os sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'resource-gcg', 'scripts')) import tree t = tree.Tree() left = '(1 ' right = ') ' for line in sys.stdin: line = line.strip() line = line.lower().split() string = '' for word in line[::-1]: w = left+word+right ...
be83c5c2a2205778eb5cfd24db1a1de2c965833b67263ad044cebf3d9805fbd3
Python
446
14
#!/usr/bin/env python from setuptools import find_packages, setup setup( name="GCPNet", version="0.0.1", description="A PyTorch implementation of Geometry-Complete SE(3)-Equivariant Perceptron Networks (GCPNets)", author="Alex Morehead", author_email="acmwhb@umsystem.edu", url="https://github....
e0295aec36c215415db518339ff493bafa55f07e186386a7daa502933b857286
Python
446
15
# from os import wait from OperationSystem.AnalysisProcess.BasicAnalysisProcess import BasicAnalysisProcess import time class WaitAnalysisProcess(BasicAnalysisProcess): def run(self): while (self.messenager.state.current_detect_state != 'STRD') and (self.messenager.state.control_state != 'EXI...
ede857ba78b9dc30c4c40594ce54de3305db00cb37d673c0daeddaa376bdf3b1
Python
446
20
"""Dataset and trained model downloading functions.""" from . import utils from .extract import ( download_abstracts, download_cognitive_atlas, download_nidm_pain, download_peaks2maps_model, fetch_neuroquery, fetch_neurosynth, ) __all__ = [ "download_nidm_pain", "download_cognitive_atla...
30fd156e177d32c654ffcc3f2fc57372b260085a79225279f966a472c8c1df94
Python
447
23
""" Public toolkit API. """ from pandas._libs.lib import infer_dtype from pandas.core.dtypes.api import * # noqa: F403 from pandas.core.dtypes.concat import union_categoricals from pandas.core.dtypes.dtypes import ( CategoricalDtype, DatetimeTZDtype, IntervalDtype, PeriodDtype, ) __all__ = [ "Ca...
74fa4d631df3cbe153eef38f3903badc4decf138676f3d3a2f036842e0d2143b
Python
447
22
name = "CELLEX" ### GLOBAL CONSTANTS # These must be defined first, as they are required in sub-packages. ES_METRICS = ["det", "ep", "ges", "nsi"] __author__ = ", ".join([ "Tobias O. Stannius", ]) __email__ = ', '.join([ 'stannius@sund.ku.dk', ]) # Load CELLEX modules from . import metrics from . impor...
c965d7c78cbcfa448e19f9ff84af00182950ca9d5e455041145770d7e9f46ec3
Python
447
14
import numpy as np def mod(x, y, decimals=8): """ Computes the remainder of the division x/y without floating point errors. The result of the division is rounded to the given number of decimals. :param float x: Dividend :param float y: Divisor :param int decimals: Number of decimals the divisi...
2e9b779a9874871b3b13fdb3326bd8ad7b58fe308b743ee44f2a0ee7c5e02335
Python
448
14
import sys, argparse, pandas as pd argparser = argparse.ArgumentParser(''' Concatenates two or more space-delimited data tables. ''') argparser.add_argument('tables', type=str, nargs='+', help='Paths to tables to concatenate') args, unknown = argparser.parse_known_args() data = [] for t in args.tables: data.appen...
15b144a0924d90abc096c47838ee62f7d4293a5c24180c88f72aabe190de2e4a
Python
450
23
from pandas.core.window.ewm import ( ExponentialMovingWindow, ExponentialMovingWindowGroupBy, ) from pandas.core.window.expanding import ( Expanding, ExpandingGroupBy, ) from pandas.core.window.rolling import ( Rolling, RollingGroupBy, Window, ) __all__ = [ "Expanding", "ExpandingGr...
22739085f07e6d3d5b84093b23cd44d9022025aac06971ffcc9cc34dfa8cf4a2
Python
451
17
from math import isclose import numpy as np import mantel np.random.seed(117) def test_stochasic_hundred_thousand(): n_objects = 27 n_distances = (n_objects**2 - n_objects) // 2 dists1 = np.random.random(n_distances) dists2 = np.random.random(n_distances) result = mantel.test(dists1, dists2, per...
360e0f5eec7047689634b2b8bcaf67d93b2759e545b266c80d66e9580623e898
Python
451
23
# -*- coding: utf-8 -*- from .de import DEMove from .de_snooker import DESnookerMove from .gaussian import GaussianMove from .kde import KDEMove from .mh import MHMove from .move import Move from .red_blue import RedBlueMove from .stretch import StretchMove from .walk import WalkMove __all__ = [ "Move", "MHMo...
3be45c2221cb0266bcd9622ac74808b29aa087718e0bf357eee4f65a097de75e
Python
451
10
"""Removed — use the litpose CLI instead.""" raise SystemExit( "scripts/converters/sleap2lp.py has been removed.\n" "Please use the command line interface instead:\n\n" " To convert a SLEAP .pkg.slp project to a Lightning Pose project:\n" " litpose convert <project>.pkg.slp --lp_dir <lp_dir>\n\n" ...
863dd66c86bd4e23f7c650f5ec515d387da7b4c6f9c9506d4ccf400e13b7d676
Python
452
12
"""PyTest fixtures for denoiser tests.""" import pytest from mrpro.data import IData, SpatialDimension @pytest.fixture def idata_single_coil(ellipse_phantom, random_kheader) -> IData: """Create single-coil image.""" image_dimensions = SpatialDimension(z=1, y=ellipse_phantom.n_y, x=ellipse_phantom.n_x) im...
1159415cff5dd8250416847a146a11c10f8f310a44096302dde1229e96a4bb53
Python
454
18
from .quality_control_connectivity import ( qcfc, partial_correlation, significant_level, calculate_median_absolute, ) from .distance_dependency import get_atlas_pairwise_distance, get_centroid from .network_modularity import louvain_modularity __all__ = [ "qcfc", "significant_level", "part...
00ddc8d7a3d69a9ba5b71c49abb6d08f8de92246bc3826ee1b31e9136f971377
Python
455
13
from setuptools import setup, find_packages setup( name='tnn', version='0.0.1', packages=find_packages(), url='https://github.com/elizabethnewman/tnn', license='MIT', author='Elizabeth Newman', author_email='elizabeth.newman@emory.edu', description='Matrix-Mimetic Tensor Neural Networks...
b41e9d66559bb1d2d16d687c814ca0ca08e7bcb6bcb87d4712912952bb08ad6d
Python
455
13
"""Phase 6: this submodule was the deep import path for the deleted legacy ``TSForecastingExperiment``. Kept as an empty namespace for back-compat — anything that imports from ``pycaret.time_series.forecasting`` should migrate to ``pycaret.time_series`` (or ``pycaret.tasks``): from pycaret.time_series import TimeS...
dd51a9cc57d580eaf1196be3d260181b7eaf187c2dbda7281d4fc5394452471b
Python
455
20
import csv import gzip import sys snum = sys.argv[1] sampleid = 0 for fname in sys.argv[2:]: with gzip.open(fname) as f: reader = csv.reader(f) header = True for row in reader: if header: header = False if sampleid != 0: #only print header for first line continue...
e2b4fb46b6b63ad46efdd00d9f4e36fb504821ee401599ab59a931781af5919f
Python
455
16
from sklearn import linear_model class Ridge: def __init__(self, alpha): self.alpha = alpha self.model = linear_model.Ridge(self.alpha) def fit(self, dstims_train_val, eeg_train_val): self.model.fit(dstims_train_val, eeg_train_val) self.coefs = self.m...
f2c1d088c4cc658d9766ba49354dbced9ebf8bb446ba3f1072b85c6dad727e4a
Python
455
12
# 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. from .base import BaseModel from .dimenet_plus_plus import DimeNetPlusPlusWrap as DimeNetPlusPlus from .gemnet.gemnet import GemNetT from .pai...
3ae4bbb1d5a73980d09abf348a7be50416d84319563c31f845dfcbb00b35f956
Python
456
13
import pandas as pd import argparse parser = argparse.ArgumentParser(description='Remove "sentences" column and change delimiter to space.') parser.add_argument('filename', help='The CSV file name to read from and write to.') args = parser.parse_args() df = pd.read_csv(args.filename) # delete the sentences col if 'se...
e4171c2c71ce141d389ba3c4b7bef8329f0b104781fe8f185e4577d16e74e45b
Python
457
21
project = "hadge" copyright = "2023, Fabiola Curion, Xichen Wu, Lukas Heumos" author = "Fabiola Curion, Xichen Wu, Lukas Heumos" release = "0.2.0" extensions = ["myst_parser", "nbsphinx"] source_suffix = { ".rst": "restructuredtext", ".txt": "markdown", ".md": "markdown", } templates_path = ["_templates"...
4c914117ecc9abeda38420351b663265d1e5e308e730a84d39c1a752e31dcc78
Python
459
16
# License: see [LICENSE, LICENSES/legged_gym/LICENSE] from setuptools import find_packages from distutils.core import setup setup( name='legged_gym', version='1.0.0', author='Nikita Rudin', license="BSD-3-Clause", packages=find_packages(), author_email='rudinn@ethz.ch', description='Isaac G...
0fc85246cec2402d598cc8370fdb162ff9d776bd2c3415025269bf024e36c50a
Python
460
14
from datetime import datetime import sys sys.path.append("..") from app import db class AuthKeys(db.Model): __tablename__ = 'auth_keys' id = db.Column(db.Integer, primary_key=True) designation = db.Column(db.String(150)) guid = db.Column(db.String(255)) deleted_at = db.Column(db.DateTime, default=...
3cb745bb028c5f62fefcc9fd2818b84a045b9e0571df54c0a79c58ef42e62f72
Python
462
14
__author__ = 'etseng@pacb.com' from Bio import SeqIO def check_ids_unique(fa_or_fq_filename, is_fq=False): """ Confirm that a FASTA/FASTQ file has all unique IDs (used probably by collapse or fusion finding script) """ seen = set() for r in SeqIO.parse(open(fa_or_fq_filename), 'fastq' if is_fq...
0a2c77827c414a2d80e426bf7376c1a07315a93c785b22ec92b0b54bf7967dd7
Python
464
21
"""Look for unreachable code.""" import argparse import sys from vulture import Vulture if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("files", nargs="*") args = parser.parse_args() v = Vulture() v.scavenge(args.files) ret = 0 for item in v.get_unused_c...
2e1d0d9980860703aea98f00021fe886838820b28308b2670819c153845564ae
Python
464
21
import numpy as np import pandas as pd def test_nunique(): # basics.rst doc example series = pd.Series(np.random.default_rng(2).standard_normal(500)) series[20:500] = np.nan series[10:20] = 5000 result = series.nunique() assert result == 11 def test_nunique_categorical(): # GH#18051 ...
6069e1da95283bbf55ef7f0e684a49dbbc6ca1ed9bf92e9817d4f24f834b407b
Python
464
17
#!/usr/bin/python3 # # filter-noisy-assembler-warnings.py # Author: Stuart Berg # <https://stackoverflow.com/a/41515691> import sys for line in sys.stdin: # If line is a 'noisy' warning, don't print it or the following two lines. if ('warning: section' in line and 'is deprecated' in line or 'note: change...
1d99e0586070ced445ef79b2ce53589792b32908c4f12ac3e6518ad5e942f099
Python
465
14
# coding: utf-8 from atropos.commands.trim.qualtrim import nextseq_trim_index from atropos.io.seqio import Sequence def test_nextseq_trim(): s = Sequence('n', '', '') assert nextseq_trim_index(s, cutoff=22) == 0 s = Sequence( 'n', 'TCTCGTATGCCGTCTTATGCTTGAAAAAAAAAAGGGGGGGGGGGGGGGGGNNNNNNNN...
208e7ded53ca5cf583b68afcc0323832988c1ebaee648c606258608ae6b33adc
Python
467
21
import matplotlib.pyplot as plt plt.rcParams.update({ 'xtick.labelsize': 15, 'xtick.major.size': 10, 'ytick.labelsize': 15, 'ytick.major.size': 10, 'font.size': 12, 'axes.labelsize': 15, 'axes.titlesize': 20, 'axes.titlepad' : 30, 'legend.fontsize': 15, # 'figure.subplot.wspace...
e90830379daf2b76aa327d1fbde1387e651cf371f56e96d06a7829ca1a0fd08d
Python
467
15
import numpy as np import pandas as pd import pandas._testing as tm class TestToSeries: def test_to_series(self): naive = pd.DatetimeIndex(["2013-1-1 13:00", "2013-1-2 14:00"], name="B") idx = naive.tz_localize("US/Pacific") expected = pd.Series(np.array(idx.tolist(), dtype="object"), na...
5c9ef626aed9a74de926c0f63b2fbb7fe66a162054d9e48e916f4c01bcf3583f
Python
469
16
import numpy as np import pytest import pandas as pd import pandas._testing as tm class TestInsert: @pytest.mark.parametrize("na", [np.nan, pd.NaT, None]) def test_insert(self, na): # GH#18295 (test missing) expected = pd.PeriodIndex( ["2017Q1", pd.NaT, "2017Q2", "2017Q3", "2017Q4...
a6940c5342c0aa417205cf143e88728ae402f4e40418268d1c4b7bf1683315c2
Python
471
17
# -*- coding: utf-8 -*- # Add classes from sub directory # from sdna.sim.core.detection.gc_content import * from sdna.sim.core.detection.homopolymers import * from sdna.sim.core.detection.kmers import * from sdna.sim.core.detection.undesired_sequences import * __all__ = ['GCContent', 'Homopolymers', ...
af30719a061fe9e3b5315cf8cf88b5c20431acc5fc251de8289b389d37d729a5
Python
471
23
# -*- coding: utf-8 -*- # JN 2016-01-12 from __future__ import print_function, division, absolute_import import numpy as np DEBUG = True def debug(msg): if DEBUG: print(msg) def expandts(ts, timestep, q=1): """ expands time stamps by inserting 512/q interpolated time points after each tim...
2df60780cb70964905ba585f898be1524ab8604e418fdf3ce2dfe775794c21e3
Python
473
14
import numpy as np from pandas.core.dtypes.cast import dict_compat import pandas as pd def test_dict_compat(): data_datetime64 = {np.datetime64("1990-03-15"): 1, np.datetime64("2015-03-15"): 2} data_unchanged = {1: 2, 3: 4, 5: 6} expected = {pd.Timestamp("1990-3-15"): 1, pd.Timestamp("2015-03-15"): 2} ...
8ef1843d8f5f5d612d768f62035fbbfacae04c2708ef8dfcd9736eedc1a67f08
Python
473
9
import sys import re for line in sys.stdin: for preterm,term in re.findall( '([^\(\)]+) ([^\(\)]+)', line ): term = term.lower() for _,formprefix,formsuffix,_,_,lemmaprefix,lemmasuffix in re.findall( '-x([^:|]*:|[^%:|]*)([^%:|]*?)%([^%:|]*)[|]([^%]?)([^-:|]*:|[^-%:|]*)([^-%:|]*?)%([^-%:|]*)', preterm ): ...
f078668090b06c61ff32ec4370d3df9a1b3a00ba8b05a45ded18e2a38282d033
Python
473
12
"""Calling cards data analysis in Python""" from ._Chipseq import calculate_signal, signal_heatmap, signal_plot from ._dotplots import dotplot_bulk, dotplot_sc, dotplot_sc_mu from ._GWAS import GWAS_adata_bulk, GWAS_adata_sc from ._heatmap_ccrna import heatmap from ._pair import plot_matched from ._peaks import draw_...
fe46cc0aee112622f403592ca557a1576524900847553d486424288167b3cb59
Python
474
16
from setuptools import setup setup( name='patchwork', version='1.0', description='Hierarchical CNNs for segmentations', license='MIT', keywords='CNN medical imaging', author='Marco Reisert', url='https://bitbucket.org/reisert/patchwork', download_url='https://bitbucket.org/reisert/patc...
a006ab4987a93461b771ca72de0f7e44b0d65cd9f73e17f48fc95d639c006b76
Python
477
20
import numpy as np from model.pointcloud import PointCloud from mayavi import mlab from traits.api import HasTraits, Instance, on_trait_change from traitsui.api import View, Item from mayavi.core.ui.api import MayaviScene, MlabSceneModel, \ SceneEditor from pyface.qt import QtGui, QtCore import random __author...
cc948cb221e6e6cd2b7fb944e495cc40ff4a322987029d7679f0ee07ff1c2326
Python
477
13
# MOFTransformer version 2.0.0 import os from moftransformer import __root_dir__ example_path = { "root_cif": os.path.join(__root_dir__, "examples/raw"), "root_dataset": os.path.join(__root_dir__, "examples/dataset"), "data_root": os.path.join(__root_dir__, "examples/dataset"), "downstream": ...
2332992ce141ca743f83687e8808591f2bbf95b6aab787d179ef16cfd733fe99
Python
479
12
'''For collecting global values''' # section A: general ----------------------------------------------------------- NUM_SNPS = 36 # number of seg sites, should be divisible by 4 L = 50000 # heuristic to get enough SNPs for simulations (50,000 or fifty-thousand) DEFAULT_SEED = 1833 DEFAULT_SAMPLE_SIZE =...
c74a71fe4dfded14f7307ff9baf82f442a47cc69e25e9ca8eccf2afb573a2e03
Python
480
24
TYPE_ALL = -3 TYPE_NON_NOISE = -2 TYPE_ART = -1 TYPE_NO = 0 TYPE_MU = 1 TYPE_SU = 2 CLID_UNMATCHED = 0 TYPE_NAMES = {TYPE_ART: 'Artifact', TYPE_NO: 'Not assigned', TYPE_MU: 'Multi-Unit', TYPE_SU: 'Single-Unit', TYPE_ALL: 'All spikes', TYPE_NON_NOIS...
f30d5bebe48d2f9f9084b28abb76abcbab9fa11ba2e1cca9a5cfecd5380c3409
Python
481
18
# Run this script as "panel serve 3_vizualize.py" # %% from pathlib import Path import pandas as pd from julearn.viz import plot_scores output_dir = Path(__file__).parent.parent / "results" / "1_brain_age" output_file_prefix = "ixi.S4_R8_scores" models = ["gauss", "rvr", "svm"] all_scores = [] for t_model in models:...
136d1d211fc10bfa3e39affce6466b44f6e9261f08635e3156d461c0e3e69154
Python
482
20
import os if 'PYTHONPATH' not in os.environ: print("Error: Run `source env.sh` to be able to run `/scripts/*.py`") exit(1) from pathlib import Path from time import time from typing import Iterable import ecgdigitize from ecgdigitize.otsu import otsuThreshold import ecgdigitize.visualization as viz from ecgdi...
802005d127ff32069174aea3982a2bdca6ba0b8929e67b31cb7beea04753958e
Python
485
17
try: from pandas._libs.tslibs.parsing import _does_string_look_like_datetime except ImportError: # Avoid whole benchmark suite import failure on asv (currently 0.4) pass class DoesStringLookLikeDatetime: params = (["2Q2005", "0.0", "10000"],) param_names = ["value"] def setup(self, value): ...
d15cdfcf170b2b77fd7dd89c597f1b0558127a89b20bdd718ff11ca5bfc3d774
Python
485
18
import sys, os, re sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'resource-gcg', 'scripts')) import tree trace = re.compile('\*') t = tree.Tree() for line in sys.stdin: if (line.strip() !='') and (line.strip()[0] != '%'): t.read(line) all_words = t.words() out = '' ...
5b390921a558900d2dc5bb4622dc6d01c2c1c5b3f416e7de03484541fea8d47d
Python
486
9
import os kcsd_loc = os.path.dirname(os.path.abspath(__file__)) sample_data_path = os.path.join(kcsd_loc, 'data') from .KCSD import KCSD1D, KCSD2D, KCSD3D, MoIKCSD, oKCSD1D, oKCSD2D, oKCSD3D from .sKCSD import sKCSD, sKCSDcell from .validation import csd_profile from .validation.ValidateKCSD import ValidateKCSD, Valid...
5c4af594dc67c5d7f432df5e8960a64adc6a6f0a9a68fac10da573350adf2dd5
Python
486
19
from pandas.io.excel._base import ( ExcelFile, ExcelWriter, read_excel, ) from pandas.io.excel._odswriter import ODSWriter as _ODSWriter from pandas.io.excel._openpyxl import OpenpyxlWriter as _OpenpyxlWriter from pandas.io.excel._util import register_writer from pandas.io.excel._xlsxwriter import XlsxWrite...
97bd602d3a59af577cf672432337cd1da91bcb1bfe2934466ac63c149b8523b3
Python
487
14
import setuptools setuptools.setup( name = "scNovel", version = "1.2.0", description = "scNovel, a neural network framework, " "provides a fast and reliable tools for scRNA-seq novel rare cell detection.", license = "MIT Licence", python_requires=">=3.5.0", packages=s...
a16299bf557e381b55f1f75bd0e8708c2dd5c6c74b7ec6c76218dd53ad53f636
Python
487
31
#!/usr/bin/env python """ File: test_load Date: 5/4/18 Author: Jon Deaton (jdeaton@stanford.edu) """ import io import BraTS import timeit import cProfile, pstats BraTS.set_root("/Users/jonpdeaton/Datasets/BraTS") brats = BraTS.DataSet(year=2017) def load(): subset = brats.train.subset(brats.train.ids[:10]) ...
8c2fd3e934a77d1fe849bbeabeb8d6fe59c641c5e100f848bc61c7e9ff3ddf36
Python
488
20
import os from pathlib import Path def calculate_difumo_centroids(): from fmriprep_denoise.features.distance_dependency import get_difumo_centroids for d in [64, 128, 256, 512, 1024]: get_difumo_centroids(d) def main(): tf_dir = Path(__file__).parents[1] / "data" / \ "fmriprep-denoise-b...
b209d3bb8a46e9b3268530217bf7a9d77f86fa7a48f5a8c78c6d6a87f839468b
Python
488
10
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved. # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and relat...
cf4a17b961b3923208a063439a714d3b3ee6a3bc0ed57e277d1e89e28013c767
Python
489
17
from setuptools import setup, find_packages setup(name='rsl_rl', version='1.0.2', packages=find_packages(), author='Nikita Rudin', author_email='rudinn@ethz.ch', license="BSD-3-Clause", # packages=find_packages(), description='Fast and simple RL algorithms implemented in pytor...
622e485ff67e1934fdee48ad620fcc9de72a73b9922dcc15f39e238e4adfeda3
Python
490
23
from flask import Blueprint from flask_restful import Api from app.auth import auth #from .person_study_resource import PersonStudyResource api = Blueprint('api_v1', __name__, url_prefix='/api/v1') @api.before_request @auth.login_required def before_request(): """All routes in this blueprint require authentica...
6ffc484bfbf82011cbfaf8b3ceaf0a373f936bd248094158159e41fbfdda630d
Python
490
15
from __future__ import division from statsmodels.genmod.generalized_linear_model import GLM from statsmodels.tools.sm_exceptions import PerfectSeparationError from statsmodels.distributions.empirical_distribution import ECDF from scipy import stats from collections import Counter from itertools import chain from utils ...
6959371bd0d449dda35f5d5b630176006a35e47f2711f718305c7a16529e09d6
Python
491
19
import pandas as pd import pandas._testing as tm def test_array_setitem_nullable_boolean_mask(): # GH 31446 ser = pd.Series([1, 2], dtype="Int64") result = ser.where(ser > 1) expected = pd.Series([pd.NA, 2], dtype="Int64") tm.assert_series_equal(result, expected) def test_array_setitem(): # ...
791034e118971199d6470b6c3f21ccdc40c273474917fd53e0b1c704402371cb
Python
491
18
# -*- coding: utf-8 -*- # JN 2014-10-21 # script creates a clinRecConv.py from ncs files import os import numpy as np from combinato import NcsFile from matplotlib.dates import date2num if __name__ == "__main__": if os.path.exists('clinRecConv.py'): print('File exists, doing nothing') else: fi...
3f69040050c9eb9b893a4b3ddf138aea696c17e62c3ad44d60f979d69bcefa8c
Python
492
20
import pytest import pandas as pd @pytest.mark.parametrize( "data, index, expected", [ ([1, 2, 3], None, 3), ({"a": 1, "b": 2, "c": 3}, None, 3), ([1, 2, 3], ["x", "y", "z"], 3), ([1, 2, 3, 4, 5], ["x", "y", "z", "w", "n"], 5), ([1, 2, 3, 4], ["x", "y", "z", "w"], 4), ...
831b0bf2a92ec0c4fdcdddf198c4fae8753199aae68798195af5c97355a1c95d
Python
492
20
import meniscus from pathlib import Path import cine import numpy as np datapath = Path("data2/") files = sorted(datapath.glob("*.cine")) for file in files: try: video = cine.Cine(str(file)) data = meniscus.find_meniscus(video, 0, video.image_count - 1) out = Path("men_data/") out...
e4fa8292e5e64e459492c059a7bc5c526618bfe80ddac3e1e48fef0c9c146aa2
Python
495
16
from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext ext_modules = [#Extension("BioReaders", ["BioReaders.pyx"]), \ Extension("c_branch", ["c_branch.pyx"]),\ Extension("intersection_unique", ["intersection_unique.pyx"])] setup( name = 'tof...
377dc66bff30de98cff94d19dadfecc9f630efa347c591db2f8a9b0134304210
Python
496
15
'''this module contains base settings of the model data base''' #from __future__ import absolute_import #import dask, dask.multiprocessing import os## # dask schedulers #from .compatibility import synchronous_scheduler #scheduler = dask.multiprocessing.get #multiprocessing_scheduler = dask.multiprocessing.get#schedu...
3ed86dbcb6e576c7b994da11eb6a31f6f9b0571c7717e980172841f32f0224bc
Python
496
20
from __future__ import print_function # makes this work for python2 and 3 import vegas # compile cfcn_cython, if needed, at import import pyximport pyximport.install(inplace=True) import cfcn_cython def main(): integ = vegas.Integrator(4 *[[0,1]]) print(integ(cfcn_cython.batch_f, neval=1e5, nitn=10).summa...
435b54c757d7262d313cfa5222041e00a245287d788adc3f9503a1e66f1b4174
Python
496
21
from .sci_ci import CoincidenceIndex from .sci_sccg import Smoothed_CCG from .sci_dsttc import directed_STTC from .sci_pyinform import TE_PyInform from .sci_idtxl import TE_IDTXL from .sci_glmpp import GLMPP from .sci_glmcc import GLMCC from .sci_ensemble import NNEnsemble from spycon.coninf import setup_ensemble __al...
a50bf70b70894a024b3c5f614904d3a756c328a221df46da659fc8e7900cae89
Python
496
24
import sys import re import pickle labelD = {} num = 0 for line in sys.stdin: m = re.match("^([^ ]+) : ([^ ]+)$", line) if m != None: feat = m.group(1).strip() label = m.group(2).strip() if label not in labelD: num += 1 labelD[label] = num feat = feat.replace("=1", "") ...
bcc4eab0333947fb682e4145976c84fdad03a455edc429e98cd8a7f24eab84a1
Python
496
16
sourcedir = 'V:\\\\cvs\\qwtplot3d\\' stext="&quot;$(QTDIR)&quot;\\bin\\" rtext="$(QTDIR)\\bin\\" import os, string, sys from os.path import join, getsize for root, dirs, files in os.walk(sourcedir): for name in files: if '.vcproj' in name: f = file(join(root,name),'r') s =...
ac17cecb3f50de9b36549592024197ec6e465ca51da6de3bc32c01edee85d806
Python
497
19
from kcsd.sKCSD_utils import check_estimated_shape import os import unittest import numpy as np class testCheckEstimatedShape(unittest.TestCase): def test_unchanged(self): array = np.ones((1, 5)) out = check_estimated_shape(array) self.assertEqual(array.shape, out.shape) def test_chang...
d312daf06910151e667f539d2d2bcccdd0ab0fa30470db43a1596aefc755507a
Python
498
26
from dclab.rtdc_dataset import feat_anc_core #: integer-valued features INTEGER_FEATURES = [ "fl1_max", "fl1_npeaks", "fl2_max", "fl2_npeaks", "fl3_max", "fl3_npeaks", "frame", "index", "ml_class", "nevents", ] #: features that by definition trend over the course of a measureme...
487c80e2073e69156c1a1974e6828a27ed0b84db9aaefa46e1bedf0fef7883a3
Python
499
13
import sys import pandas import re X = pandas.read_csv(sys.stdin,sep='\t') for disc in X['item'].unique(): print( '!ARTICLE' ) ## Concatenate all words in the same discourse... txt = ' '.join( X['word'][ X['item']==disc ].tolist() ) ## Segment sentences using rules with task-dependent exceptions for cases lik...
57c58021328c96537398b78a036fee2c8f786e21024f2adfca9caa86a812664c
Python
502
10
import tempfile from esmologs import foldseek2fasta import helpers def test_foldseek2fasta_1(shared_datadir): with tempfile.TemporaryDirectory() as output_dir: #output_dir = "tmp" foldseek2fasta.main(["-i", str(shared_datadir / "af2_examples"), "-o", output_dir + "/out"]) helpers.compare_fi...
ffbfb164fe5c9e9b4993f3c911c3ab67f106fda4f3b264cbff74261dc7fdf0b9
Python
502
14
from .tools import (get_node_parameter_value, get_parameter_value, initializeRedisFromYAML, get_node_parameter_dump, get_redis_info, main, get_node_io, unpack_string, node_stage) from .node import BRANDNode from .supervisor import Supervisor ...
72ed9da2260688a1bb4f6a2a6ccebba152bcf7c81b610c705188ade4e652d271
Python
503
17
import sys import re import lex DEBUG = False for a in sys.argv: if a=='-d': DEBUG = True ## For each line... for line in sys.stdin: ## For each paired preterminal and terminal... for preterm,term in re.findall( '\(([^\(\) ]+) ([^\(\) ]+)\)', line ): term = term.lower() out = lex.getFn( preterm, term )...
7cd47facbabb0e313374f014f9ffa3fc5a9465437b80ed8a93f1c17a199e3c14
Python
505
25
import numpy as np import os import csv import ase.db import ase.io if not os.path.exists('2D_data'): os.mkdir('2D_data') # Connect to database db = ase.db.connect('c2db.db') rows = db.select(selection='workfunction') count=0 out=[] for row in rows: atoms=row.toatoms() out.append(row.workfunction) ase.io.wri...
863f27e2804b5667062f92f391c87c39e1b8979db57589e012c2448dd998c47a
Python
507
19
#python pull_surp.py > output import scipy.io as io import sys data = io.loadmat('genmodel/ESNnew.mat') sents = data['possents'] surps = data['rawsurp_esn'] sents = sents.ravel() for size in xrange(6): for variant in xrange(3): print 'esnsurp{:d}{:d}'.format(size+1,variant), print for senti in xrange(len(sents...
ade459886cf76bcb3057cbc8b15ed62e94c043f6807976a95f15f20402d8305c
Python
508
14
""" BASALT: A modular metagenomic binning and refinement pipeline. This package exposes the high-level CLI entry point in ``BASALT.py`` and a number of internal modules implementing individual steps of the pipeline (autobinning, dereplication, outlier removal, contig retrieval, reassembly, and model utilities). Typic...
1936a927524a1278a8609c30063b25edbdf10f9414b8fab8d89ba48a36293e97
Python
509
24
# MOFTransformer version 2.2.0 import os __version__ = "2.2.0" __root_dir__ = os.path.dirname(__file__) from moftransformer import visualize, utils, modules, libs, gadgets, datamodules, assets from moftransformer.run import run from moftransformer.predict import predict from moftransformer.test import test ...
ec4099719d053412a76a8c264ceb1bd9e58a906fbfdc0b4e112146eeaa4ff45b
Python
509
24
import sys, os sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'resource-gcg', 'scripts')) from model import Model lexicon = Model('L') sfile = open(sys.argv[1],'r') opts = sys.argv[2:] unkhold = [o for o in opts if '-u' in o] if unkhold != []: unkhold = int(unkhold[0][2:]) else: unkhold = 0 ...
75dffd647e8108516799c6035dc56e488c8d83db521463a1db87ed5c69340d76
Python
510
23
import sys depth = 0 curStr = '' for line in sys.stdin: for c in line: curStr += c if c == '(': depth += 1 elif c == ')': depth -= 1 if depth == 0: print curStr curStr = '' elif depth < 0: print ...
6654b4d5c73b7bc6fc23171c9ad1d3c1cfda168660852fb6185b0ec0543b3cde
Python
511
10
"""Print the mean displacement of a greedy warp and its mean error against the synthetic warp, inside the box shown in the logo.""" import sys import numpy as np import nibabel as nib c = (slice(15, 63), slice(31, 49), slice(2, 64)) s = nib.load(sys.argv[1]).get_fdata().squeeze()[c] w = nib.load(sys.argv[2]).get_fdata(...
a9b002d9ca895dd685f73b36d7a7463b375cc72ee1f32154091649b5f2238d1e
Python
511
20
import numpy as np from values import * from defs import * def AE1(cell,memb_id,xAE1,area): bpp = cell.conc[3,2] cpp = cell.conc[2,2] betapp = bpp/dKbpp gampp = cpp/dKcpp bp = cell.conc[3,memb_id[1]] cp = cell.conc[2,memb_id[1]] betap = bp/dKbp gamp = cp/dKcp xT = xAE1/(1+bpp/172.0) summ = (1+betap+gamp)*(...
b574ace3ef966fdb74e5ae7c049c8ef88cf72af29e3cbf8d8b7847624ef9bb15
Python
512
21
import sys print('word sentid sentpos discid discpos') # 'id's start from 0, 'pos'es start from 1 discid = 0 sentid = 0 discpos = 1 for line in sys.stdin: line = line.strip() if line == "!ARTICLE": discid += 1 discpos = 1 continue if line: sentpos = 1 ...
45841976778d71f3a99810800d3c154f368d6abb8e5fef740e9ea65a2ef781f7
Python
514
16
import sys import random import configparser #undersample_rate = .2 #print only 20% of negative coref data #undersample_rate = 1.0 #off config = configparser.ConfigParser(allow_no_value=True) config.read(sys.argv[1]) undersample_rate = config["NModel"].getfloat("UndersampleNRate") for line in sys.stdin: if line.e...
3c8a30c6a0ace7ae4dd686949178a962744f64cebaa19bbffa02837b0284b3e1
Python
516
15
from __future__ import division from statsmodels.genmod.generalized_linear_model import GLM from statsmodels.tools.sm_exceptions import PerfectSeparationError from statsmodels.distributions.empirical_distribution import ECDF from scipy import stats from collections import Counter from itertools import chain import sys;...
78a457502dfd52faa29c860d692b5d223e6ce454565af0ef513b192f9ed6de5e
Python
516
17
import sys, pandas as pd def main(): data = pd.read_csv(sys.stdin, sep=' ', skipinitialspace=True) sys.stderr.write('Removing NaN fdurs.\n') fdur = None for name in ['fdur', 'fdurFP', 'fdurGP']: if name in data.columns.values: fdur = name break if fdur: data ...
4e4068b67925e1bcc5f7d3d4681403420cd94c94de396d49f09ea51232e734d0
Python
518
20
""" Tests for Indexes backed by arbitrary ExtensionArrays. """ import pandas as pd class BaseIndexTests: """Tests for Index object backed by an ExtensionArray""" def test_index_from_array(self, data): idx = pd.Index(data) assert data.dtype == idx.dtype def test_index_from_listlike_with_...
1e27d43a8cd324ae1e66b9ccc82822f0f32094089307ccddf1fbb3a766b3c42e
Python
519
20
def get_inputtype(input): """ Get input types based on input file format :param input:input file :return: type """ type = "Wrong Type" if input.split("/")[-1].split(".")[-1] == "mol2": type = "mol2" elif input.split("/")[-1].split(".")[-1] == "pdb": type = "pdb" ...
16c4ff3dac35742763af98db9324959184a827d6faaa02f4bc9f83caaab0fb28
Python
520
17
import sys, pandas as pd def main(): data = pd.read_csv(sys.stdin, sep=' ', skipinitialspace=True) sys.stderr.write('Removing unfixated tokens.\n') fdur = None for name in ['fdur', 'fdurFP', 'fdurGP']: if name in data.columns.values: fdur = name break if fdur: ...