sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
4b1e2fbe88e19ffb6a98d1ce868d93733771f22af26cddd8fe826d94a118e0f9
Python
4,199
111
#!/usr/bin/env python2 desc="""Generate batch file for IGV """ epilog="""Author: l.p.pryszcz+git@gmail.com Mizerow, 17/03/2014 """ import os, sys import pickle, pysam, resource from datetime import datetime import numpy as np from scipy import stats def bed2batch(bed, out, session, bam, genome, outdir, ext, offset, ...
64513e83e37d26d9e963c8e93cf91b7d0a0dcb136eaddf769e53a6cc5cc8a077
Python
4,199
155
#!/usr/bin/env python2 """ Look for telomeric sequence in genomic reads from Illumina. USAGE: out=telomers.txt; for fn in */q10_1.fastq; do d=`echo $fn | cut -d'/' -f1`; echo $d >> $out; echo "find_telomers.py $d/q10*merFreq.txt"; find_telomers.py $d/q10*merFreq.txt >> $out; done """ import gzip, re, sys ...
1bf00e9b14bac2c00c43c04f71958ad80a13e32df44a6efa4ed91974681d96b8
Python
4,203
171
# -*- coding: utf-8 -*- """ celery.concurrency.base ~~~~~~~~~~~~~~~~~~~~~~~ TaskPool interface. """ from __future__ import absolute_import import logging import os import sys from billiard.einfo import ExceptionInfo from billiard.exceptions import WorkerLostError from kombu.utils.encoding import safe_re...
a5c60411e31ea1e87c251cbbbf1057ac1ecee69a172996d1f37d6c642fae565b
Python
4,209
136
import torch.nn as nn import torch.nn.functional as F import math import torch # adapt from https://github.com/MIC-DKFZ/BraTS2017 def normalization(planes, norm='gn'): if norm == 'bn': m = nn.BatchNorm3d(planes) elif norm == 'gn': m = nn.GroupNorm(4, planes) elif norm == 'in': m = ...
3b17e89ce2bbe2363450e8a6d5cfe27d332176d46b55bb5fd27e6cd20c7b862a
Python
4,212
150
"""Calculate length and number of branching points of curvilinear structures.""" import numpy as np import os from igraph import * import readimg import cv2 import natsort def get_measurements(files, inFolderNetwork, inFolderOriginal, inFolderBinary): vessel_length = [] num_branch_point = [] z_interp = np.zeros(...
cb804add4a098d7db61227e32f7462e6da37669cb15e27de9ccbde23b4db01a4
Python
4,216
143
""" Slightly modified versions of shutil.copy to provide sub-file resolution of file transfer """ import os import stat from hashlib import md5 class SameFileError(OSError): """Raised when source and destination are the same file.""" def _samefile(src, dst): # Macintosh, Unix. if hasattr(os.path, 'same...
8710b8c56cd364a2706f3a6dc1ff2ae849e26a3639bbca1b7e3c4fee64f53e6c
Python
4,219
128
"""Two-site toy (bridge state '*' = FAD/W_B-like pair, terminal state 'CS' = FAD/W_C-like pair). Invented system: 2 electrons + 3 spin-1/2 nuclei (n1 on radical A at both sites, n2 on radical B at the bridge site only, n3 on radical B at the terminal site only), invented axial tensors, invented rates (not Cry4a). d rh...
cb602fe2ad5787b2bf90cf5849bc44a27ec93b6a6ad698691a23c30b52ab2b52
Python
4,220
117
#!/usr/bin/env python2 desc="""Convert BAM to BigWig. Inspired by: https://www.biostars.org/p/64495/#64680 Added support for non-UCSC genomes. Require: - bedGraphToBigWig - samtools - pybedtools - pysam TBD: - you can avoid genome fasta if faidx is generated from bam header """ epilog="""Author: l.p.pryszcz+git@gmail...
cabef72915ee8b304888aad2b207fc8dab73886ad44cc17bbf07e6e261e501c8
Python
4,222
111
import json from django import template from django.template.context import Context from .base import InclusionAdminNode register = template.Library() def prepopulated_fields_js(context): """ Create a list of prepopulated_fields that should render Javascript for the prepopulated fields for both the adm...
841ac4b768c6684d9e77c1d3eb552961117da27cd7bc4ae4ee3487e28300bde5
Python
4,226
144
""" First Experiment: Feature Projection in Neural Networks [Sec 3.4.1] """ import numpy as np import matplotlib.pyplot as plt from keras.models import Sequential from keras.layers import Dense, Activation from keras.optimizers import SGD from scipy.special import expit # calculate Logistic sigmoid import scipy.io a...
3dd8c8a812b4f374b339db47ca6338936194cdc2aae1c74d1fb69a40ab6932a1
Python
4,229
131
import numpy as np import pandas as pd import pytest import scikit_posthocs as sp @pytest.mark.parametrize( "function", [sp.posthoc_lsd, sp.posthoc_snk, sp.posthoc_duncan, sp.posthoc_vanwaerden], ) def test_independent_posthoc_missing_values_match_complete_input(function): complete = [[1, 2, 4, 5, 8], [3...
bc423c4ed12c7d435b41b9df5994b4b4c547262ffba1f28f4155ef530c38d958
Python
4,234
92
#!/usr/bin/env python3 """Select successful protected-master CI evidence before any release mutation.""" from __future__ import annotations import argparse import json import os import re import subprocess from pathlib import Path from create_release import compute_tag, current_version REPOSITORY = 'autonomio/talos'...
ce3de9d231fb971a665940006824b5107eae6d6a759b7be6c9159df1f095e820
Python
4,236
144
# -*- coding: utf-8 -*- """ timer2 ~~~~~~ Scheduler for Python functions. """ from __future__ import absolute_import import os import sys import threading from itertools import count from time import sleep from celery.five import THREAD_TIMEOUT_MAX from kombu.async.timer import Entry, Timer as Schedule...
3235713a3e9cc7ea9c49226af9e8c88fec75fef521a7d89e9f70e2b36f84d9e9
Python
4,237
169
# # The Python Imaging Library # $Id$ # # WMF stub codec # # history: # 1996-12-14 fl Created # 2004-02-22 fl Turned into a stub driver # 2004-02-23 fl Added EMF support # # Copyright (c) Secret Labs AB 1997-2004. All rights reserved. # Copyright (c) Fredrik Lundh 1996. # # See the README file for information on...
6b9ce880cf14b1f0b83f51568b3ebce37b89c03262e7d9f73192e119f55d290b
Python
4,242
158
# # The Python Imaging Library. # $Id$ # # PPM support for PIL # # History: # 96-03-24 fl Created # 98-03-06 fl Write RGBA images (as RGB, that is) # # Copyright (c) Secret Labs AB 1997-98. # Copyright (c) Fredrik Lundh 1996. # # See the README file for information on usage and redistribution. # f...
bd641edb2a5b9589f8de6352f9725dffd9f428cbfd2926b4da173fb1887ace58
Python
4,243
132
from __future__ import division, print_function, absolute_import import os import numpy as np import numpy.testing as npt from nibabel.tmpdirs import InTemporaryDirectory from dipy.direction.peaks import PeaksAndMetrics from dipy.data import get_sphere from dipy.io.peaks import load_peaks, save_peaks, peaks_to_nifti...
8820eb26248249cd85d5f798818f7f8747b50c5979f8794e663dbe37020442c0
Python
4,244
149
"""Report experiment search-space and sampled runtime estimates.""" from pathlib import Path import click from talos.cli.commands._load_yaml import load_and_validate from talos.yaml.compiler import CompiledSFD from talos.yaml.profiler import ProfileResult, profile _COMPLEXITY_COLOURS = { 'low': 'green', 'me...
13d3636de1357a5d3cc675215971a99da9595c3728483e2d704e1d03abbfc9ca
Python
4,253
126
from tkinter import StringVar, BooleanVar from .FileInfo import FileInfo from Biscuit.Management import OptionsVar class BIDSFile(FileInfo): """ BIDSFiles are the main files which will contain the data that is to be converted to BIDS format. For KIT data this is the .con file. For Elekta data thi...
a4eb810a39ae1aa043f9bd2e5657437431bdb6a92235cc1c87e76a39e600bcb0
Python
4,253
136
"""Generates Figure6.pdf To get this, you have to generate test data first, and also run custom matlab scripts to get the DANCo results first. 0.0. Generate the data navigate into the ./benchmark_data/ folder and run the data generating script with GNU octave $ octave gen_benchmark_data.m 0.1. G...
ab3058bf00e0dc26ee54562816e3bc20c2da19ed1ca911ba58732e73007bb652
Python
4,262
111
from multiprocessing import Pool, cpu_count import warnings import numpy as np from scipy.ndimage import affine_transform def _affine_transform(kwargs): with warnings.catch_warnings(): warnings.filterwarnings("ignore", message=".*scipy.*18.*", category=UserWarning) ...
3403864b4fdfecb2699c0f57fa4d221c81209ae3930ee22a93af16981d9c15d9
Python
4,263
130
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """ helpers.py Performs filtering and other git helpers. See README.md for details on installing/using. """ import copy import os from datetime import datetime, timedelta BOT_SERVICES_LABEL = 'Bot Services' CUSTOMER_REPO...
ad9e5704f8e80418e51155a2cd80f5b294a8dd155c099d9e82b05c1faca72fde
Python
4,271
72
"""Validate SFD selection and experiment controls before caller imports.""" from collections.abc import Mapping, Sequence from typing import cast from talos.yaml.errors import YAMLError def objective_errors(value: object, path: str) -> list[YAMLError]: """Reject ambiguous objective shapes and invalid metric dire...
7364772bd4eba68c38dd292f9df173911eb981b8a12612014c2690a1dd4b0fb1
Python
4,287
161
# -*- coding: utf-8 -*- """ celery.concurrency.eventlet ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Eventlet pool implementation. """ from __future__ import absolute_import import sys from time import time __all__ = ['TaskPool'] W_RACE = """\ Celery module with %s imported before eventlet patched\ """ RACE_MODS = ('b...
430c0999589907739a5c932a85fdb735b5c2430cd03d6710ca405f5d3e1ec94f
Python
4,288
115
#----------------------------------------------------------------------- #Copyright 2019 Centrum Wiskunde & Informatica, Amsterdam # #Author: Daniel M. Pelt #Contact: D.M.Pelt@cwi.nl #Website: http://dmpelt.github.io/foam_ct_phantom/ #License: MIT # #This file is part of foam_ct_phantom, a Python package for generating...
95dbdebf3c24a9cf14093d3816f260585ad2d4022ce909dcfe3beb83d7266f1f
Python
4,295
110
"""Seeded scale, missing-group, and design checks for Hartley's test.""" # Fixed chi-square draws separate input/statistic errors from Monte Carlo noise. # Extreme scales, ndarray shapes, nullable values, and missing-only groups are # separate from invalid designs that must fail before sampling. import numpy as np im...
ff6fcb20dfcd6a1ec4f0abcfc845ab388da326b4bbaf7fecc4dd5017ed902af9
Python
4,300
95
#----------------------------------------------------------------------- #Copyright 2019 Centrum Wiskunde & Informatica, Amsterdam # #Author: Daniel M. Pelt #Contact: D.M.Pelt@cwi.nl #Website: http://dmpelt.github.io/foam_ct_phantom/ #License: MIT # #This file is part of foam_ct_phantom, a Python package for generating...
de335d945e9b27fae42c923cab67f2c24b76beb6e2ae30391c88dd278ff14617
Python
4,305
114
from typing import Optional, Union import numpy as np from matplotlib.font_manager import fontManager from PIL import Image, ImageDraw, ImageFont from ._check import check_image from ._tiles import _divide_xywh ERROR_TEXT_ITEM_LENGTH = ( "Length of text items ({}) does not match length of coordinates ({})." ) ...
8653be85b2dcf14139e883742f9abac8c1257eec1ee02b6047a688e8ba6ac7e3
Python
4,306
141
import os import pickle import tempfile import numpy as np from scipy.ndimage.measurements import label from shapely.geometry import Polygon from pytraction.core import (TractionForceConfig, _custom_noise, _find_uv_outside_single_polygon, _get_noise, ...
dd434ba3a350561a09b6ace71b37af034c943ccdd10bb023e0738e51e88bf038
Python
4,307
123
############################################################################### # selector.py provides the function for identify recordings and select # the recording class accordingly ############################################################################### # Copyright (c) 2019-2020, University of Liège # Author...
9fc58264ef492d33ce8d56a344a3e568723fa8f442eadaf70e054f3bfde5676d
Python
4,309
146
from __future__ import absolute_import from celery.concurrency.gevent import ( Schedule, Timer, TaskPool, apply_timeout, ) from celery.tests.case import ( AppCase, Mock, SkipTest, mock_module, patch, patch_many, skip_if_pypy, ) gevent_modules = ( 'gevent', 'gevent.monkey', 'gevent.gre...
d414d7da2dadaa92c42068e78e16709a5a6e60f1ffbfa6bce0f8b171739cc4a0
Python
4,314
128
from django import forms from django.contrib.gis.geos import GEOSException, GEOSGeometry from django.utils.translation import gettext_lazy as _ from .widgets import OpenLayersWidget class GeometryField(forms.Field): """ This is the basic form field for a Geometry. Any textual input that is accepted by G...
7fe539e0f6220fb61214fa64c945581011ad9243e347fc181a14efb33730dfcd
Python
4,317
106
import numpy as np import pandas as pd import pytest import scikit_posthocs as sp import scikit_posthocs._posthocs as posthocs @pytest.mark.parametrize("value_position", [0, 1]) def test_explicit_array_column_positions_keep_zero_as_a_valid_position(value_position): data = np.array([[2, 20], [2, 30], [1, 40], [1,...
e0d787f9741542559e0641b9fda733c6427a3639671e400a82db62e81fbd7638
Python
4,325
124
def bland_altman_plot(m1, m2, sd_limit=1.96, ax=None, scatter_kwds=None, mean_line_kwds=None, limit_lines_kwds=None): """ Bland-Altman Plot. A Bland-Altman plot is a graphical method to analyze t...
0c5917e5a7d2dd6b93ed1978af4d3e5ad859c0d79a4a6df92c66cac517331768
Python
4,326
125
#!/usr/bin/env python2 """ xlsx2tsv file1.xlsx [file2.xlsx ... fileN.xlsx] Parse a .xlsx file(s) (Excel OOXML, which is not OpenOffice) into tab-separated values. Output directory (ie. file1.xls_sheets/) is created per each input file. In this directory the sheets from given xlsx file are stored as separate .tsv files...
05aeb06883fad0d07484a0e613569fdedf3c070152108ee91dcc10a17b99f30c
Python
4,339
100
""" Custom copying function for copying and tracking the progress of BIDS data """ import os import os.path as op from hashlib import md5 import logging from Biscuit.utils.copyutils import copy BUFFER_SIZE = 1024 * 1024 # 1Mb class BIDSCopy(): """ combine two bids-compatible folders Parameters ---...
a6f5c69cbdb148ca13295b50d33403928308d21605091659092215c4208f06d2
Python
4,340
113
"""Honesty gate: config, written laws, and enforced ruleset agree exactly. Three descriptions of the same fact, from three files that a change can touch independently: * `governance.yml` -- the gates configured to run *and* to block * `CLAUDE.md` -- the laws, each workflow-gate law carrying its required-statu...
28a4466c65f79d2c0285eba655a11df6e30b7a7e71b47e94c0bf86c59ce62c86
Python
4,345
140
import numpy as np from dipy.tracking.metrics import downsample from dipy.tracking.distances import local_skeleton_clustering from dipy.tracking.distances import bundles_distances_mdf from warnings import warn deprecation_msg = ("Class 'dipy.segment.quickbundles.QuickBundles' is" " deprecated, inste...
75afb56e59a707a938051ce7de38a7ea133657c5eed3e2142d224e475f2fdfbc
Python
4,361
96
# -*- coding: utf8 -*- """ Generates hippocampal like spike trains (see also helper file: `poisson_proc.py`) authors: András Ecker, Eszter Vértes, Szabolcs Káli last update: 10.2018 """ import os, pickle import numpy as np from tqdm import tqdm # progress bar from poisson_proc import hom_poisson, inhom_poisson from h...
407cb6ff98d8957fb7e8ef8956b4c73671ceaa0f2daae511d0799015ebfb21cb
Python
4,364
125
import os import sys import codecs from ._compat import PY2 # If someone wants to vendor click, we want to ensure the # correct package is discovered. Ideally we could use a # relative import here but unfortunately Python does not # support that. click = sys.modules[__name__.rsplit('.', 1)[0]] def _find_unicode_l...
0e2f58f89fda1236071ef5e6a2b073af65bb0a4582701c19c9ace209f81c9cfc
Python
4,366
100
#!/usr/bin/env python3 """Exploratory check of H3 after the confirmatory run (post hoc; outside the frozen analysis). For birds of stage 2 the script rebuilds the compass recording of both H3 designs (simultaneous recording and probe pseudo-population, sigma_g = 0.2, delta = 0.4, 200 cells) with the frozen mag_s3.py, ...
f83698ba322e00449a8845325a99257dacafd370d205db0bf38dca88bbee088c
Python
4,366
146
import albumentations as albu import cv2 import numpy as np from PIL import Image from torch.utils.data import DataLoader from torch.utils.data import Dataset as BaseDataset class Dataset(BaseDataset): """Read images, apply augmentation and preprocessing transformations. Adopted for CamVid example ...
d6860133cea6848f6fa4f0b2ebfc87e67213ce370e89e8adb938dc699a15c309
Python
4,367
137
# # The Python Imaging Library. # $Id$ # # Sun image file handling # # History: # 1995-09-10 fl Created # 1996-05-28 fl Fixed 32-bit alignment # 1998-12-29 fl Import ImagePalette module # 2001-12-18 fl Fixed palette loading (from Jean-Claude Rimbault) # # Copyright (c) 1997-2001 by Secret Labs AB # Copyright (c...
2cfd70eef996be62b0caa2da535676e3714e58635032b80c519aef805b8e95ca
Python
4,374
121
# pkg-config, https://www.freedesktop.org/wiki/Software/pkg-config/ integration for cffi import sys, os, subprocess from .error import PkgConfigError def merge_flags(cfg1, cfg2): """Merge values from cffi config flags cfg2 to cf1 Example: merge_flags({"libraries": ["one"]}, {"libraries": ["two"]}) ...
8215d392ea5ce6bd922c00f3551830a69a224479db03f7a3e63cdc66b3b1dc2a
Python
4,374
118
#!/usr/bin/env python """ for f in *_R1.fastq.gz; do s=`echo $f | cut -d"_" -f1`; echo `date` $s; fastq2shuffledFasta.py -l31 -q20 > ../assemblies/identity_confirmation/mapsembler/$s.fa ${s}_*.gz 2> filterReads.log; done """ import gzip, os, sys from Bio import Seq from datetime import datetime from optparse imp...
ce2a4057e2d948e4786fa56fb4eb6d8acc801ed2d44344e4fa5c685b9de80342
Python
4,379
111
#!/usr/bin/env python3 """File size balance gate: largest <= max_ratio x median. The bound is per-repository: a package of many small single-purpose modules and a package of a few large ones are different shapes, and a ratio that is right for one is arbitrary for the other. Configured under `gates.file_size_balance.ma...
3e0e8d2a839de2d6da8dac6b22931c62a57f81b82e0a75866d46af35426d4558
Python
4,380
150
# -*- coding: utf-8 -*- """ celery.app ~~~~~~~~~~ Celery Application. """ from __future__ import absolute_import import os from celery.local import Proxy from celery import _state from celery._state import ( get_current_app as current_app, get_current_task as current_task, connect_on_app_fin...
53de1c387238d819608aa4570e5b0fa2a51ae42fd6c3fbaebb6363afddddd5f0
Python
4,381
153
# 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. from __future__ import absolute_import, division, print_function import base64 import struct import six from cryptography import utils f...
21d6e30d9c267c4b719d56f829e7214a0f816de4e778dafb03f0e5f027703076
Python
4,383
134
import numpy as np import dipy.data as dpd import nibabel as nib from numpy.testing import (run_module_suite, assert_, assert_equal, assert_array_almost_equal) from dipy.denoise.non_local_means import non_local_means from dipy.denoise.nois...
a6d5288550e37fd41b487a2fdbf392d2f0dcbf28ebedbbbaf0a14cf5d9e2df11
Python
4,383
118
# -*- coding: utf-8 -*- # @Author: liangou # @Date: 2021-02-26 11:14:00 # @Last Modified by: liangou # @Last Modified time: 2021-04-06 10:52:31 ''' 1.filter and combination all the motif site 2.apply model to features table ''' import itertools import pickle,subprocess from collections import defaultdict from co...
23929fd789d929ec3e3561403e8fab46427ce5083f343344130072107f71adc0
Python
4,388
100
from django.contrib.gis.gdal import OGRGeomType from django.db.backends.postgresql.introspection import DatabaseIntrospection class GeoIntrospectionError(Exception): pass class PostGISIntrospection(DatabaseIntrospection): # Reverse dictionary for PostGIS geometry types not populated until # introspectio...
dbbcc18206e7abbd7a7ae6ca391ddabfc277e343982c070975a2fda557183ccf
Python
4,389
103
############################################################################### # _MNE.py contains settings and constants needed to read mne files # It is highly inspired by mne-bids tool, all credits goes there # https://github.com/mne-tools/mne-bids ####################################################################...
a3724a56f67621ed57856fd296b177e834fc254abeb4ed0fff3b24224f3b4723
Python
4,393
175
# # The Python Imaging Library. # $Id$ # # FLI/FLC file handling. # # History: # 95-09-01 fl Created # 97-01-03 fl Fixed parser, setup decoder tile # 98-07-15 fl Renamed offset attribute to avoid name clash # # Copyright (c) Secret Labs AB 1997-98. # Copyright (c) Fredrik Lundh 1995-97. # ...
efbde3b0f0ceed13d613ef74b54c0bfe5daa3d024da1d1b1d525a6ccc3fa390d
Python
4,398
86
#!/usr/bin/env python2 # -*- coding: utf-8 -*- ############################################################################### ## Vision Research Laboratory and ## ## Center for Multimodal Big Data Science and Healthcare ## ## University of California at ...
5fe24b56993dbebedd99a67c8f117579d30fd43d4937d126c377adbb666036e1
Python
4,400
107
# Adapted from https://github.com/chemprop/chemprop/blob/master/chemprop/data/scaffold.py from collections import defaultdict import logging from random import Random from typing import Dict, List, Set, Tuple, Union import warnings from rdkit import Chem from rdkit.Chem.Scaffolds import MurckoScaffold from tqdm impor...
21403239d3eaddc2bbd491c1678fb92b7874daa736f096033255af5614db70a2
Python
4,403
128
#!/usr/bin/env python2 """Parses multiple files and find common rows between these. Author: l.p.pryszcz+git@gmail.com Barcelona, 21/03/2012 """ import os, sys from optparse import OptionParser from datetime import datetime def compare_csv( fnames,exclude,include,fraction,columns,delimiter,minCommon,splitFn ): "...
4ea7c480288ece633dd8c76277bf98c151aacfb130a65049b6de22eeb6e8123c
Python
4,406
110
#!/usr/bin/env python3 desc="""Fetch entires from NCBI. """ epilog="""Author: l.p.pryszcz+git@gmail.com Barcelona/Mizerow, 23/02/2014 """ import argparse, os, sys from datetime import datetime from Bio import Entrez def ncbi_fetch(queries, taxids, ignored_taxids, db, rettype, batchSize, retmax, \ ...
90c63c4a910331dbd20f705c96ecfe11d498755dd58604ecdf4676a88a4dff03
Python
4,407
70
# This file is distributed under the same license as the Django package. # # The *_FORMAT strings use the Django date format syntax, # see https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'j F Y' # '20 januari 2009' TIME_FORMAT = 'H:i' # '15:23' DATE...
000bbb427c22819fb70e67beb87b0ec92953d531af0184afa85d6966d6ae32da
Python
4,413
81
""" This module houses the ctypes function prototypes for OGR DataSource related data structures. OGR_Dr_*, OGR_DS_*, OGR_L_*, OGR_F_*, OGR_Fld_* routines are relevant here. """ from ctypes import POINTER, c_char_p, c_double, c_int, c_long, c_void_p from django.contrib.gis.gdal.envelope import OGREnvelope from djan...
a3578dbce3708b17f0b4854f0b34e7aaa41e5ad6fc7752c147d12246aa0cc38d
Python
4,415
98
"""Synchronize the software bibliography with authoritative CFF metadata.""" from __future__ import annotations import argparse import ast import re from pathlib import Path from ruamel.yaml import YAML __all__ = ['main', 'render_bibtex'] def _text(record: dict[str, object], key: str) -> str: value = record.ge...
095a4c04a0ed9321f8f07bc081faf2f84dea33b50fb9d2366f989534df590670
Python
4,419
126
#!/usr/bin/env python2 desc="""Convert FastQ to FASTA. Note, reads are reported in arbitrary order due to multiprocessing! """ epilog=""" l.p.pryszcz+git@gmail.com Barcelona, 10/05/2013 """ import argparse, gzip, os, sys, subprocess from datetime import datetime from multiprocessing import Pool def init_args(*args...
454f3d409a45853e6e72ebccd679012edd186a53a60e49843bdbdeb958881a9a
Python
4,419
129
# -*- coding: utf-8 -*- """ Created on Thu Sep 12 16:14:25 2019 by Jeffrey Mc Hugh mchughj3@tcd.ie @author: jm2080 """ import os import glob import numpy as np import matplotlib.pyplot as plt import pandas as pd import file_dialog2 as fd import TDMSfns2 as tdm plt.close('all') indir = fd.filedlg(...
22c47a68fe6e09fb837fa9922c0bd596bcd8413006bbe104d06b8dcc02c05d7f
Python
4,426
112
import pickle import sys import numpy as np import matplotlib.pyplot as plt import matplotlib matplotlib.rc('pdf', fonttype=42) matplotlib.rc('font', **{'size': 14}) import seaborn as sns sns.set_style('ticks') if __name__ == '__main__': if len(sys.argv)>=2: if 'pdf' in sys.argv[1].lower(): di...
2767052d163a8d1a3675257bfd253474b9a9e6d16a215348cb701404cb7119c7
Python
4,430
69
"""Mutation testing of estimate.py against test_s3b.py (author's harness, not part of the study). Every mutation changes one rule of the dipole test or of the estimate; test_s3b.py must fail on each. Usage: python3 -I scripts/mutate_estimate.py CODE_DIR OUT_DIR""" import json import os import shutil import subprocess i...
1a56583adbecf44532b3a2c4d15296fa816066b772f667b300f609c2217e0ab4
Python
4,433
87
import distutils.util import os from argparse import ArgumentParser import torch from mlopt import Mlopt from truss import Truss from utils import unique, get_logger, Batch_evaluate def main(args): os.makedirs(args.log_root, exist_ok=True) logger = get_logger(args) truss = Truss(n_node=args.n_node, dev...
ce9897357acbddd6a37da5bd9dfd636cddec494582a1940dba8a483d33df5123
Python
4,442
115
#!/usr/bin/python3 import os import argparse import h5py import ismrmrd import numpy as np from PIL import Image def main(args): dset = h5py.File(args.filename, 'r') if not dset: print("Not a valid dataset: %s" % (args.filename)) return dsetNames = dset.keys() print("File %s contains ...
bc106675a8dcec65e2b137510eb88710945cd22ae3349b1317ca83b47af9a385
Python
4,443
151
from ctypes import c_uint from django.contrib.gis import gdal from django.contrib.gis.geos import prototypes as capi from django.contrib.gis.geos.error import GEOSException from django.contrib.gis.geos.geometry import GEOSGeometry class Point(GEOSGeometry): _minlength = 2 _maxlength = 3 has_cs = True ...
32bffe16694092c12396d2cf9c05517281c9662ef8d7f08369652c68c58aa789
Python
4,444
120
import numpy as np from scipy.signal import butter,filtfilt import os from functools import reduce from scipy import signal from scipy import fftpack def notch_filt(data,fs,freqs): nyq=fs/2 Q=30 tmp_data=data.copy() for f in freqs: tmp_w=f/(nyq) b,a=signal.iirnotch(tmp_w,Q) tmp...
fd728d7e77056c43e07a21c27e466642ff2b8e708d374afdd296b80d948e5b4d
Python
4,444
141
import struct from django.forms import ValidationError from .const import ( GDAL_TO_POSTGIS, GDAL_TO_STRUCT, POSTGIS_HEADER_STRUCTURE, POSTGIS_TO_GDAL, STRUCT_SIZE, ) def pack(structure, data): """ Pack data into hex string with little endian format. """ return struct.pack('<' + structure, *...
753b13fa7f637ca99719e70686da6cfb4f568c161f23510169f4552ee2189efd
Python
4,449
125
import torch.nn as nn import torch import numpy as np from utils.polarTransforms import * # def normalizeMagnitudeBatch(x): # ''' normalize each slice alone''' # ndim = x.ndimension() # if ndim == 3: # xs = x.reshape((x.shape[0],x.shape[1]*x.shape[2])) # elif ndim==4: # xs = x.reshape...
41c6ab9f3da0b08446ff58f58662281efd7e41d677ae2aa209ef863a5a02b949
Python
4,451
143
#!/usr/bin/env python3 """Privileged post-merge ruleset audit for full live parity on main. Unlike the PR-time `ruleset_gate` (whose unprivileged token may not observe `bypass_actors`), this runs on push to `main` with a privileged token and REQUIRES `bypass_actors` to be present and equal to the snapshot. It is a pos...
122f5c16df8e432d83c33cfbce89216bbdddbf64861545bfc98d2604d3537ad3
Python
4,453
112
#!/usr/bin/env python3 desc="""Plot scatter plots from many files. First column has to be name of the feature. """ epilog="""Author: l.p.pryszcz+git@gmail.com Barcelona, 29/11/2012 """ import argparse, os, sys from datetime import datetime import matplotlib.pyplot as plt import matplotlib as mpl import numpy as np fr...
7ebd6318410b2bfaf5e84977f01aa3f357c7b61fff145391a87c45f7c7e1deb4
Python
4,456
120
# -*- coding: utf-8 -*- # @Author: liangou # @Date: 2021-02-26 11:14:00 # @Last Modified by: liangou # @Last Modified time: 2021-04-06 10:52:31 ''' 1.filter and combination all the motif site 2.apply model to features table ''' import itertools import pickle,subprocess from collections import defaultdict from co...
198ceee4c157e2a03d4a40549ef8960c28677ba03e3e244ab8ecec31d5202c04
Python
4,457
139
""" This module allows importing AbstractBaseUser even when django.contrib.auth is not in INSTALLED_APPS. """ import unicodedata from django.contrib.auth import password_validation from django.contrib.auth.hashers import ( check_password, is_password_usable, make_password, ) from django.db import models from djang...
07186defde9367a6f6d65fc26a72318099e4d0734e85a9aaccdfaf1f8051a99f
Python
4,459
119
# -*- coding: utf-8 -*- # @Author: liangou # @Date: 2020-11-23 19:02:25 # @Last Modified by: liangou # @Last Modified time: 2020-12-09 14:53:26 ''' import modules ''' import multiprocessing import numpy as np import pandas as pd import pysam import os,sys,glob import argparse import joblib import pdb,time import d...
ea40acd8821066a19e550b2fd7ac1423eeed73e36b72abe9548698aff1746548
Python
4,461
119
# -*- coding: utf-8 -*- # @Author: liangou # @Date: 2020-11-23 19:02:25 # @Last Modified by: liangou # @Last Modified time: 2020-12-09 14:53:26 ''' import modules ''' import multiprocessing import numpy as np import pandas as pd import pysam import os,sys,glob import argparse import joblib import pdb,time import d...
2276638037479addce0ec89246c57d908a37c63387f3743c1e1df685960c6fc8
Python
4,466
113
""" module for testing column_visibility.py (show / hide the columns of the ethogram, subjects and events tables) pytest -s -vv test_column_visibility.py """ import os import sys import pytest from PySide6.QtCore import QAbstractTableModel, QSettings, Qt from PySide6.QtWidgets import QApplication, QTableView, QTable...
1fe65a6c2b4b1b622af1ea67bd1f56dd67acc6a1c6ab916beb3c8b45ec336a62
Python
4,473
148
""" A class for handling large tractography datasets. It is built using the h5py which in turn implement key features of the HDF5 (hierachical data format) API [1]_. References ---------- .. [1] http://www.hdfgroup.org/HDF5/doc/H5.intro.html """ import numpy as np import h5py from nibabel.stream...
ef8186f925434259f1d8e853b6a882ab9000d578dfb2d7bf82100dd6b3e68c9d
Python
4,480
161
""" BORIS Behavioral Observation Research Interactive Software Copyright 2012-2026 Olivier Friard This file is part of BORIS. BORIS is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the L...
094ca8e141e476d8cf4dbc0e0099f3b42549a9b21c8f04e5285f74d2b095c3c8
Python
4,486
107
#!/usr/bin/env python3 """Environment check of MAG-S3 (author's harness): the same numbers computed in two environments must agree. python3 -I scripts/env_check.py CHECK_DIR reads CHECK_DIR/calibration.json and CHECK_DIR/physics_s3.json, writes CHECK_DIR/env_chec...
fdb7b39a5dcbcd91dd55edb55e9f0d0249fa30010a8e6aa16e2413948390ab81
Python
4,492
120
""" DataSource is a wrapper for the OGR Data Source object, which provides an interface for reading vector geometry data from many different file formats (including ESRI shapefiles). When instantiating a DataSource object, use the filename of a GDAL-supported data source. For example, a SHP file or a TIGER/Line...
a485f4b0e8b6565a79decd075a000981653815b7887cf2a681f00b8f6da9cd89
Python
4,497
91
"""Train and recover inference models with caller data and manifests.""" import inspect import numbers from pathlib import Path import numpy as np class Trainer: """Explicit caller-SFD retraining with optional saved-trial metric verification.""" def __init__(self, sfd=None, *, params=None, backend=None, mod...
bda04e3d79aa888b7f21c69b151953ce923d4798a7a5262394d6c661e499b4a4
Python
4,508
108
"""`--update-budget` regenerates one section without destroying the others. The budgets used to be one file per gate. Each gate's `--update-budget` read its file, edited it, and wrote the whole thing back -- correct for a file it owned alone. When the six files merged into `.github/budgets.json` the read side was sect...
1b40df10d4eb34cb91421716f6991c731d0e73532b65c7211b9c9f5513b5600b
Python
4,521
128
"""Check launcher behavior in fresh processes, before Qt initializes.""" import os from pathlib import Path import subprocess import sys import pytest PROJECT_ROOT = Path(__file__).resolve().parents[1] PROBE = r''' import builtins import importlib from pathlib import Path import runpy import sys import tomllib from...
d861088d306f0dbb6edd6e6094f219ebda6c4aa616a0d7291d4c0001c6dca144
Python
4,521
125
import numpy as np import h5py import os import random import torch from utils.config import valid_labels from sklearn.model_selection import train_test_split from torch.utils.data import Dataset, DataLoader from sklearn import preprocessing class JSTSP2021(Dataset): def __init__(self, hdf5_path, flusense): ...
f681d892c3ee42c853dac6d09f147d7d3b706e19ed468ac7a189ea546df17ad2
Python
4,521
143
import pytest import warnings import albumentations as A def test_from_dict_without_p_uses_correct_defaults(): """Test that from_dict uses correct default p values when p is missing.""" # Test transform with p=1.0 default (Resize) config = { "transform": { "__class_fullname__": "Resiz...
f84d2960619548a377bcfaecd2755e9110cb16a0d8ac099032c4dc9375632dfd
Python
4,522
165
import shutil import subprocess from pathlib import Path def git_executable() -> str: ''' Locate the git binary on PATH. Returns: str: Absolute path to the git executable Raises: FileNotFoundError: If git is not found on PATH ''' git = shutil.which('git') if git is Non...
7811aeba1fc8acdb3352edcdbf9c4bdac1ef16e1cb827f00e8fb74f98324f62b
Python
4,524
133
#!/usr/bin/env python2 desc="""Generate sorted query ids list for mummerplot. Example: show-coords -r $ref.r.delta > $ref.r.coords coords2ordered.py -i $ref.r.coords -f query.fasta > query.ordered.txt """ epilog="""Author: l.p.pryszcz+git@gmail.com 26/02/2013 Barcelona """ import argparse, commands, os, subprocess, ...
ef13b3da37e12a164ad649e949f0eecac6df19e228ede25792114c6b2fb1af9d
Python
4,524
123
# 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. from __future__ import absolute_import, division, print_function from cryptography import utils from cryptography.hazmat.backends.openssl....
f12255f8fa1fa22c8ec1b4b36fc0ae79578a9410d32431e49203d01354aebbec
Python
4,526
171
# -*- coding: utf-8 -*- """ celery.exceptions ~~~~~~~~~~~~~~~~~ This module contains all exceptions used by the Celery API. """ from __future__ import absolute_import import numbers from .five import string_t from billiard.exceptions import ( # noqa SoftTimeLimitExceeded, TimeLimitExceeded, Worker...
e79ca2f64094dc75345b3def6f7f1f56b1eef1cf852547569d15060366b8a788
Python
4,527
160
import re from typing import cast import polars as pl DEFAULT_SCALING_RULES = {r'.*': 'standard'} def build_rules( overrides: dict[str, list[str]] | None = None, base_rules: dict[str, str] | None = None, ) -> dict[str, str]: """ Build scaling rules by combining base rules and user overrides. A...
5ab6ff3165082c9318da4995675f7f8b2dfb16be1026162121b1e21e847ae3be
Python
4,529
136
from tkinter import Entry, Frame, FLAT, Label, END, SUNKEN, LEFT from datetime import datetime """ Code c/o pydesigner from stackoverflow: https://stackoverflow.com/a/13243973 (with a heavy personal modifications) """ DEFAULTVALUE = ['', '', ''] class DateEntry(Frame): """ 3-part entry box for entering dates ""...
e550182dbc7112d7dd6462a08f320dc6598d91883d77fec99990057ebd047009
Python
4,533
135
# Copyright (c) 2009 Raymond Hettinger # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without limitation the rights to use, copy, modify, merge, # publish,...
611c65a58cd863fa77e8b4bb496d4fbdde87c2b9b356ef93bd82b7981abfe665
Python
4,539
115
#!/usr/bin/env python2 desc="""2D plot""" epilog="""Author: l.p.pryszcz+git@gmail.com Barcelona, 10/05/2013 """ import argparse, math, os, sys from datetime import datetime import matplotlib.pyplot as plt import numpy as np def plot_2d(inputs, output, title, xlab, ylab, xmax, xmin, log, ndivide=20): """ """...
a2a3a1a9869541fffaa7153ac460fe26d6d78d5fa2d6fe5595bc4fe75b7dfa79
Python
4,554
157
""" BORIS Behavioral Observation Research Interactive Software Copyright 2012-2026 Olivier Friard This file is part of BORIS. BORIS is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the L...
aa1a0cff8e98c7b5e5639b3b5ec7be6afd27b9d06386ac69794b9e9fb0d9ae2c
Python
4,560
130
"""Scale caller observations with causal rolling median and IQR statistics.""" from typing import cast import polars as pl class CausalRollingRobustScaler: '''Causal trailing-window median and IQR scaling, with no look-ahead.''' def __init__(self, x_train: pl.DataFrame, w...
559924c82808a7c3f6f7719988a9a2f489feeced4d4a406f862cfd5a79903dcf
Python
4,563
149
"""Genenrates the benchmark table with MPE values """ import numpy as np import pandas as pd from cmfsapy.evaluation.mpe import compute_mpe from scipy.io import loadmat from constants import * def insert_charachter(mylist, charachter='&'): """ inserts a charachter element between each list element :param m...
abe2867ef68eef607c01fbe8970b2a8404298eeaa79047333dd75760b0455121
Python
4,566
193
# coding: utf-8 """ ASN.1 type classes for PKCS#12 files. Exports the following items: - CertBag() - CrlBag() - Pfx() - SafeBag() - SecretBag() Other type classes are defined that help compose the types listed above. """ from __future__ import unicode_literals, division, absolute_import, print_function from ....
9736ee63b6d655bf9bcf772cdd561aa3307f95b12092008d9b0481357a75cf68
Python
4,572
127
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import torch ################################################################################ ################################################################################ def roll_nn(X...
853a413a807c512c2ec59c56600709f0c991a6131a5be270de3181a75f6557c8
Python
4,576
102
"""Coverage evidence must measure the complete package without rounding up.""" from __future__ import annotations import json import os import shlex import subprocess import sys from pathlib import Path import pytest import yaml from tools.check_statement_coverage import check_statement_coverage def _report(tmp_pa...
19c8ea587af051619509b0ca63bb7062df91affe273c9a819dfadfe52787b086
Python
4,583
159
from __future__ import absolute_import, division, print_function import platform import sys import types import warnings PY2 = sys.version_info[0] == 2 PYPY = platform.python_implementation() == "PyPy" if PYPY or sys.version_info[:2] >= (3, 6): ordered_dict = dict else: from collections import OrderedDict ...