sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
3d6a9412f262607154592c4ec0b2a5f7188f201bc11ee7f3ce5b829dc3109de0
Python
10,901
254
import os import numpy as np import cv2 import torch import yaml from argparse import Namespace from monai.transforms import ( Compose, ToTensord, ScaleIntensityd, AsDiscrete ) from monai.networks.nets import UNet from torchmetrics import JaccardIndex from torchmetrics.segmentation import DiceScore from...
c6473f5359153d9962998df48e840de6f6e883ddb9aec40e7a69e252f6b639b3
Python
10,914
329
# This code is © K. Heining, 2020, developed at the University of Freiburg. # This code is made available under the BSD license enclosed with the software (see licence.txt). # Over and above the legal restrictions imposed by this license, if you use this software for an academic # publication then you are obliged to pr...
e1907d534278bbcdae2fe975e5aa3d9ea0cbbeb919ddc075832e09fa8482e4fd
Python
10,932
281
""" 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...
2856913007cb56e5c003b4410bef3da0cc7279634e7b0b5ef22abfc8480b5c94
Python
10,950
331
""" module for testing time budget analysis pytest -s -vv test_time_budget.py """ import pytest import sys import json import os from pathlib import Path sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) from boris import time_budget_functions from boris import db_functions from bor...
48d4b483d2f522b4330bcdff3b2af72106e45f5702a3a35e8008c446b0354d0c
Python
10,959
141
"""Mutation testing of the revised analyze.py against the revised test_analyze.py (author's harness, not part of the study). Usage: python3 -I mutate2.py CODE_DIR OUT_DIR""" import os import shutil import subprocess import sys CODE, OUT = sys.argv[1], sys.argv[2] SRC = open(os.path.join(CODE, "analyze.py")).read() M ...
2fac762cf2db8eadc233f65f5d47201bdec0647f1b10be26a57d4fc40dd9c79c
Python
10,962
274
"""Implementation of mask-based dropout augmentation. This module provides the MaskDropout transform, which identifies objects in a segmentation mask and drops out random objects completely. This augmentation is particularly useful for instance segmentation and object detection tasks, as it simulates occlusions or mis...
3926bf7d5abbdd82e017f2ba8bd24502097cd6b4f917d9184bd2e5ff32f8ffb5
Python
10,967
351
from . import Image, ImageFile try: from . import _webp SUPPORTED = True except ImportError: SUPPORTED = False from io import BytesIO _VALID_WEBP_MODES = { "RGBX": True, "RGBA": True, "RGB": True, } _VALID_WEBP_LEGACY_MODES = { "RGB": True, "RGBA": True, } _VP8_MODES_BY_IDENT...
5229e35e8a979cbb6d1ef647c085f811d37c612fc2a3a2e4e21bce152b8f8cb6
Python
10,974
242
""" Library to create neural nets with partially trainable layers. In Keras currently, only the trainablilty of whole layers can be set. To create partial trainabliity, I need to split the layer into two layers, and assign one to trainable and the other one to not trainable. Both layers get the same input. The out...
e13736404400140981abd6346f6741b0647080d6fabd736e275e2d7bec26ec3a
Python
10,975
298
import numpy as np import pytest import torch from PIL import Image from torchvision.transforms import ColorJitter import albumentations as A from tests.conftest import RECTANGULAR_UINT8_IMAGE, SQUARE_UINT8_IMAGE, UINT8_IMAGES @pytest.mark.parametrize("image", UINT8_IMAGES) def test_torch_to_tensor_v2_augmentations(...
3e1ce1e2d42402d25a25b8794cacd36b5c42de13443322b90d8636c03fa1eb4c
Python
10,981
275
from collections import Counter, defaultdict from itertools import product import os import pickle import subprocess import numpy as np import pandas as pd from tqdm import tqdm from sklearn.linear_model import LogisticRegression from sklearn.model_selection import GridSearchCV from sklearn.metrics import roc_auc_score...
35ca3a3e5bcfd0ae44ad19701f1023442f3c2dd21ef87c6d8d320459e229e9b0
Python
10,991
299
"""Transforms for text rendering and augmentation on images. This module provides transforms for adding and manipulating text on images, including text augmentation techniques like word insertion, deletion, and swapping. """ from __future__ import annotations import re from pathlib import Path from typing import Ann...
89a3549adc5a83460f7f16dadd30d808d89eb624cc408aef8512e3f87f289055
Python
11,014
293
import copy import os import re from .utils import echo from .parser import split_arg_string from .core import MultiCommand, Option, Argument from .types import Choice try: from collections import abc except ImportError: import collections as abc WORDBREAK = '=' # Note, only BASH version 4.4 and later have ...
ec2aefc72644f9f216d20483bdf5126da64de6719dec058549494a282e405e82
Python
11,023
317
# -*- coding: utf-8 -*- """ celery.app.control ~~~~~~~~~~~~~~~~~~~ Client for worker remote control commands. Server implementation is in :mod:`celery.worker.control`. """ from __future__ import absolute_import import warnings from kombu.pidbox import Mailbox from kombu.utils import cached_property ...
ed05edbf9f696895cee24593176dfe92211a5f29466ae19da284eb8292c985da
Python
11,048
330
"""Prune parameter choices from metric correlations in experiment results.""" import logging from typing import Any, Literal import polars as pl from typing_extensions import override from talos.experiment.reducer.correlation_analysis import experiment_parameter_correlation from talos.experiment.reducer.pruning_stra...
32626b73369e22b5a841c1656d0c40e27451c77ab81fd2dfab4ab4109a57b2b3
Python
11,059
336
""" 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...
03f86f10afa6f55b4475a5c5daf14d771eaa94859b288f8b7988c3466d0f696a
Python
11,072
254
"""Contract tests for the hard-mechanical bloat gates (slice #11).""" from __future__ import annotations import json import re import subprocess import sys from pathlib import Path from typing import Final from _common import loads_toml REPO_ROOT: Final[Path] = Path(__file__).resolve().parents[2] BUDGET_JSON: Final[...
2df97fc0035e5c305d9debb5a58aac322245b95d26a6dd13a1ae9e06cb25a3ab
Python
11,077
282
from datalad import cfg from datalad.core.distributed.clone import ( Clone, ) from datalad.distribution.dataset import Dataset from datalad.utils import ( better_wraps, ensure_list, optional_args, Path, rmtree, wraps ) from datalad.support.annexrepo import AnnexRepo from datalad.tests.utils ...
fb14270ff31927594da62a80ec8d3d237fa95a8d68e114c569c3025cefa9edc1
Python
11,095
276
# -- encoding: UTF-8 -- from babel._compat import string_types from babel.core import Locale from babel.numbers import format_decimal, LC_NUMERIC class UnknownUnitError(ValueError): def __init__(self, unit, locale): ValueError.__init__(self, "%s is not a known unit in %s" % (unit, locale)) def get_unit...
fadd845b0f5a4991b4906963e2c0b93922805e4d59de4ab38b2c2869ba7a60c3
Python
11,102
347
import itertools import numpy as np import pytest from .utils import create_label_array from bg_space import AnatomicalSpace, SpaceConvention valid_origins = ["asl", "ipl", "pli"] some_shapes = [(3, 3, 3), (15, 5, 10)] @pytest.mark.parametrize( "origin", [ "rsa", ["r", "s", "a"], ("...
741bce0d67104214bd6f957f02ec66f4a9d2c5ca4ec62b5e3a766fa8f54ea8f4
Python
11,122
359
############################################################################### # BidsSession.py defines class that conserves information on current processed # subject and session ############################################################################### # Copyright (c) 2019-2020, University of Liège # Author: Ni...
7aa3bf5f2c4d983725f480495c33ec4c60cc6606c57c70654c1c15892bd87afc
Python
11,169
323
############################################################################### # General.py contains general tools, that can be used in user plugins # general tools do not require additional modules installation ############################################################################### # Copyright (c) 2019-2020, ...
4944f6f58ff52516499bd78659e70162e061a45a5017444a780682fdcc606ff8
Python
11,182
281
#DEGnext #Copyright Tulika Kakati 2020 #Distributed under GPL v3 open source license #This code may be used to fine-tune and test the model on F1 and T3 data for all the cancer datatsets and save the model for each cancer dataset. ################################## import torch import torch.nn as nn import numpy as np ...
b47328d2e43e86dce622ff56042d3e29d2d978b93eef908aa8b5f6b852e7e3a6
Python
11,182
314
from __future__ import absolute_import, unicode_literals from contextlib import contextmanager from amqp import ChannelError from kombu import Connection, Producer, Queue, Exchange from kombu.transport.virtual import QoS from celery.contrib.migrate import ( StopFiltering, State, migrate_task, migra...
55c4a09d4bfd4a606aecf71fe9876e98b0dc4a54a942dd54f878a0afe346d080
Python
11,193
370
# -*- coding: utf-8 -*- """ celery.utils.timeutils ~~~~~~~~~~~~~~~~~~~~~~ This module contains various utilities related to dates and times. """ from __future__ import absolute_import import numbers import os import sys import time as _time from calendar import monthrange from datetime import date, date...
42b30ba810ea1a77868a2a3bc630b2e02ab5eb4cfe0ecefc713e084e5a8aa090
Python
11,202
360
import io import os import pickle import tempfile from typing import Tuple, Type import h5py import numpy as np import segmentation_models_pytorch as smp import tifffile import torch import yaml from google_drive_downloader import GoogleDriveDownloader as gdd from numpy.lib.npyio import load from shapely...
1fb9d1926049c3a2f0958450fa8af77916ac8e1eca150918ad592dc402140cd6
Python
11,207
256
import itertools import numpy as np import pandas as pd import pytest from scipy import stats from statsmodels.stats.multitest import multipletests import scikit_posthocs as sp from tests._input_cases import LABELS, assert_matrix, long_data REFERENCES = [ (sp.posthoc_ttest, {"pool_sd": True}, "pooled_t"), (s...
27d127cf6adb25bf421cfa96956439b90112a32af4b9cecc356ba07218d706fe
Python
11,207
306
# # DEPRECATED: implementation for ffi.verify() # import sys, os, binascii, shutil, io from . import __version_verifier_modules__ from . import ffiplatform from .error import VerificationError if sys.version_info >= (3, 3): import importlib.machinery def _extension_suffixes(): return importlib.machiner...
3afdd9f90e094eeb92cea3886481bf3b6c5d614a0e26bbf97966f03aa4175dac
Python
11,218
314
""" BORIS Behavioral Observation Research Interactive Software Copyright 2012-2026 Olivier Friard This program 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 2 of the License, or (at your...
e1dd7d5ad218604207482e83b1747faf35dac61f0d6b5d020e440a5712ce4407
Python
11,225
286
from tkinter import HIDDEN, NORMAL, TclError from tkinter.ttk import Notebook from bidshandler import BIDSTree from Biscuit.FileTypes import FileInfo, Folder, FIFData # TODO: import just InfoTabs and then . these to make this cleaner? from Biscuit.InfoTabs import (FifFileFrame, SessionInfoFrame, ConFileFrame, ...
89d2ade9db8b5147c015fb6b1e84448bc30949ddfd5d6dfaa54547b617609709
Python
11,226
311
import sys import inspect from functools import update_wrapper from ._compat import iteritems from ._unicodefun import _check_for_unicode_literals from .utils import echo from .globals import get_current_context def pass_context(f): """Marks a callback as wanting to receive the current context object as fir...
5764a55049e26467d59e3ffdaf5ed79de4fbc3e3a8094a642ffb2e98a2212db5
Python
11,229
339
import threading from ctypes import POINTER, Structure, byref, c_byte, c_char_p, c_int, c_size_t from django.contrib.gis.geos.base import GEOSBase from django.contrib.gis.geos.libgeos import ( GEOM_PTR, GEOSFuncFactory, geos_version_tuple, ) from django.contrib.gis.geos.prototypes.errcheck import ( check_geom,...
e3052f8d7b2cdc2a09bdd179076ef5868b75aeab8e9f6ea75c7bd9d9d6d01dac
Python
11,238
274
# -*- coding: utf-8 -*- """ celery.app.defaults ~~~~~~~~~~~~~~~~~~~ Configuration introspection and defaults. """ from __future__ import absolute_import import sys from collections import deque, namedtuple from datetime import timedelta from celery.five import items from celery.utils import strtobool f...
7cdaaa461a32ebaaf6ac0971611d811cc91332a1bee06484699201157b1e9e77
Python
11,247
293
#!/usr/bin/env python2 desc="""Report coverage from BAM file. Support spliced alignments and mapping quality filtering. By default ignores secondary alignments, duplicates and quality failed reads. Takes into account only the first read from pair. bam2cov_pool.py is nearly 2x faster on large BAM files than bam2cov.p...
f2ebdf6b158a1002779a0506eea4abc0c3c8dec4783d8c30ee632b967cdfbebd
Python
11,255
232
from tkinter import (StringVar, BooleanVar, DISABLED, NORMAL, Entry, messagebox, IntVar) from tkinter.ttk import Frame, Label, Separator, Button, Combobox from Biscuit.CustomWidgets.InfoEntries import (InfoEntry, InfoLabel, InfoCheck, InfoChoice) from...
16e273767e43b01358473c184d1f13d3dbf6a798a16604fa8854622cce276668
Python
11,268
303
#!/usr/bin/env python2 desc="""Get phylogenetic profile of orthologs for given list of proteins. problems to resolve: -if getting tree by seedfriend, you have to check if seed is ortholog of query sequence! Code based on neptune:~/assembly_trial/virulence/profile.py """ epilog="""Author: l.p.pryszcz+git@gmail.com Bar...
b8d33e2c4639d8267654d30c5bf0bd42e928c93bcf9507fcbdc6c66b59500472
Python
11,281
365
from .const import Bound from .interval import Interval, singleton from collections.abc import MutableMapping, Mapping from sortedcontainers import SortedDict def _sort(i): # Sort by lower bound, closed first return (i[0].lower, i[0].left is Bound.OPEN) class IntervalDict(MutableMapping): """ An I...
a099e99b892c5c202ae477cb8abab5912135367a69b483cdfdf2f40c9d905e77
Python
11,286
294
from __future__ import print_function, division from methods import base import segmentation_models_pytorch as smp import torch.optim import torch.nn as nn import glob from torch.utils.data import DataLoader from torchvision.transforms import Compose from tqdm import tqdm from torch.cuda.amp import autocast, GradScale...
2700f78ea4ded2e28f0235d278d09d2bc6454627f529b42dc28c1806406dd818
Python
11,295
286
"""Tests for advanced event filtering.""" import sqlite3 from decimal import Decimal from types import SimpleNamespace import pytest from boris import advanced_event_filtering, config def make_events(): return { "obs-1": { "Alice|Run": advanced_event_filtering.ico([1, 3]) | advanced_event_f...
f045c8b5bace413d4bf9b28fd1fc638b092412310c880a6a049acbc34c6a6c87
Python
11,301
332
from __future__ import absolute_import import os from celery.bin.base import ( Command, Option, Extensions, HelpFormatter, ) from celery.tests.case import ( AppCase, Mock, depends_on_current_app, override_stdouts, patch, ) class Object(object): pass class MyApp(object): user_options = ...
02d0102431c6d04a63333b6c539d1980c92b0f333f6a214ffe6916a7f8f4629c
Python
11,371
400
############################################################################### # _dicom_common.py provides common functionalities to read and parce DICOM file ############################################################################### # Copyright (c) 2019-2020, University of Liège # Author: Nikita Beliy # Owner: L...
fa762667fabd44e3f642f45358b64206206c1d1b88c02e622e809cbc97e5bd8d
Python
11,381
323
""" monkeypatching and mocking functionality. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import re import sys import warnings from contextlib import contextmanager import six import pytest from _pytest.fixtures import fixture from _pyte...
c3e9d90cbcbdde6628a51d8dd199a1e3a506014027276f857ca34fac6e81aeea
Python
11,406
302
# This method is reverse engineered from Kang Yu et al. 2017 # https://link.springer.com/article/10.1186/s13007-017-0168-4 from methods import base import numpy as np from sklearn.svm import SVC from sklearn.utils import resample from skimage.color import rgb2hsv, rgb2lab import glob from os.path import split import t...
2cc3cfba7e7001593294c8145cb59a21edc21f134afc2f3a5b472c20a686d397
Python
11,407
326
# coding: utf-8 # # Imports # In[1]: import pandas as pd import os import numpy as np from rdkit.Chem import AllChem as Chem import sys sys.path.append('..') # In[2]: WORK_DIR = os.getcwd() DATA_DIR = os.path.join(WORK_DIR,'original') data_processed_dir = os.path.join(WORK_DIR,'processed') if not os.path.exi...
e887d245b31207b47dc97506951e2c764a0975ead1bca87ebadcbcb6a7257a33
Python
11,410
385
# -*- coding: utf-8 -*- """ celery.worker.control ~~~~~~~~~~~~~~~~~~~~~ Remote control commands. """ from __future__ import absolute_import import io import tempfile from kombu.utils.encoding import safe_repr from celery.exceptions import WorkerShutdown from celery.five import UserDict, items, string_t...
ac6a7144291c7fc7e6e3c51ba98cf503e027606c8724c7cc0a0f81dc8a674a0a
Python
11,427
319
""" Testing utility functions """ import numpy as np import random from dipy.core.geometry import (sphere2cart, cart2sphere, nearest_pos_semi_def, sphere_distance, cart_distance, vector_co...
77c6fb559e1a29d388d87dd9b56525b5e755bedc9325dd4dae1fe6c85ad2e310
Python
11,441
290
"""Tests for the modifier editor dialog.""" import json import pytest from PySide6.QtWidgets import QWidget from boris import add_modifier, config @pytest.fixture def modifier_dialog(qapp): editor = add_modifier.addModifierDialog("", subjects=[("Alice", "A"), ("Bob", "")], ask_at_stop_enabled=True) editor....
df1761f1539511f196a0eceec244510f4b765d684f84dc641fcce20da1356665
Python
11,445
383
from torch.nn.functional import one_hot from torchvision.transforms.functional import rotate, center_crop, hflip, vflip, normalize, to_tensor, crop from torch.nn.functional import interpolate, pad from torchvision.transforms import ColorJitter from torchvision.transforms import InterpolationMode import torch import nu...
30f8b4d95bd18cdb9d500a6b7da839a28d14701901550359fb3c029b7c5ab06a
Python
11,458
372
# # Module implementing queues # # multiprocessing/queues.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # from __future__ import absolute_import import sys import os import threading import collections import weakref import errno from . import Pipe from ._ext import _billi...
0a8f43a3209b888c73cea8fd4f852b197902e63b1041eae30432c8815ea46557
Python
11,491
337
""" BORIS plugin Export observations to FERAL (getferal.ai) """ import json from pathlib import Path import pandas as pd from PySide6.QtCore import Qt from PySide6.QtWidgets import ( QDialog, QFileDialog, QHBoxLayout, QLabel, QListWidget, QListWidgetItem, QPushButton, QVBoxLayout, ) ...
70642a97034a6d58cec7f86b29e5127b16feb94ca436b98665930155f0fcb729
Python
11,532
321
import os import numpy as np import cv2 import torch import yaml import csv import argparse from argparse import Namespace from monai.transforms import ( Compose, ToTensord, ScaleIntensityd, AsDiscrete ) from monai.networks.nets import UNet #from torchmetrics import Dice, JaccardIndex from monai.metrics...
9e6570b1716863e51b8f0bb2886de2b0d7e07cf054b09af1a14860eebe3e2e3c
Python
11,534
283
"""Mutation tests for every bloat gate: prove each gate fires on its violation.""" from __future__ import annotations import json import shutil import subprocess import sys import textwrap from pathlib import Path from typing import Final import yaml REPO_ROOT: Final[Path] = Path(__file__).resolve().parents[2] GOVER...
8c90c802944f3219ba8103552a6a82ceb82e7f1d4c168e3812eeed93f125bbb9
Python
11,540
335
""" The Spatial Reference class, represents OGR Spatial Reference objects. Example: >>> from django.contrib.gis.gdal import SpatialReference >>> srs = SpatialReference('WGS84') >>> print(srs) GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS 84",6378137,298.257223563, AUTHORITY...
6ec1c4c6c6a3fd2ce5d5e3f076e204ec805c4b1fe515d6745b9c9037f5151035
Python
11,548
285
"""Import a DICOM tarball into a study dataset""" from os import listdir from os import makedirs from os import rename import os.path as op import shutil from datalad.consts import ARCHIVES_SPECIAL_REMOTE from datalad.consts import DATALAD_SPECIAL_REMOTES_UUIDS from datalad.interface.base import build_doc, Interface f...
979806e5df5c19c33c2b67bd97ac54dafeeaef1645800c65668a0f9abc241f11
Python
11,581
343
""" 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...
3a4006fd97a3d5a7468d7162b5441a42440db12466988789983ccf096517ed33
Python
11,585
286
#!/usr/bin/env python2 desc="""Generate nice graph with coverage for multiple samples. Tracks are in colors and merged track is added if less than 13 samples. First generate cov.bed files is: for f in bowtie2/*.bam; do echo `date` $f; bedtools coverage -counts -abam $f -b ../ensembl/Fusarium_oxysporum.FO2.15.dna.topl...
9938dee4087bff8a80b19d199f574c311e14a1114769c26692af10c7a52d46a7
Python
11,605
358
import logging import lzma from simplejson import loads as json_loads from os import environ lgr = logging.getLogger(__name__) # map the various guesses to the cannonical labels modality_label_map = { 't1': 'T1w', 't1w': 'T1w', 't2': 'T2w', 't2w': 'T2w', 't1rho': 'T1rho', 't1map': 'T1map', ...
87b3061b8a555ebe935b1492e1d4151388007f86e51db471e4ba4fef460ac18c
Python
11,621
320
import sys import numpy as np import dipy.segment.metric as dipymetric from dipy.segment.featurespeed import extract from dipy.testing import assert_true, assert_false from numpy.testing import (assert_array_equal, assert_array_almost_equal, assert_raises, assert_equal, run_module_suite) d...
a7572827de9b251f95fff473b54e7ccf396295c96716a2b5324a753589dfe381
Python
11,622
317
# -*- coding: utf-8 -*- """ celery.backends.amqp ~~~~~~~~~~~~~~~~~~~~ The AMQP result backend. This backend publishes results as messages. """ from __future__ import absolute_import import socket from collections import deque from operator import itemgetter from kombu import Exchange, Queue, Produ...
0f17d2e09bedb68774a49339f2447c64787a11c7ce90c16211d850015ad61072
Python
11,629
324
import sys import inspect import argparse from dipy.workflows.docstring_parser import NumpyDocString def get_args_default(func): if sys.version_info[0] >= 3: sig_object = inspect.signature(func) params = sig_object.parameters.values() names = [param.name for param in params if param.name ...
5a84029ffb20f556e3ec1af277eb1437135e3edb25f75739fce8b7cf55b4fc99
Python
11,651
380
# -*- coding: utf-8 -*- """ The :program:`celery amqp` command. .. program:: celery amqp """ from __future__ import absolute_import, print_function, unicode_literals import cmd import sys import shlex import pprint from functools import partial from itertools import count from kombu.utils.encoding import safe_str ...
190667767c557f96b2f4c7e65d34376dfc876a7e1c21d310543f95f43bfcbe4b
Python
11,653
346
from inspect import Parameter, signature from typing import Any, Dict, Optional, Tuple, Union import pytest from pydantic import BaseModel import albumentations as A from albumentations.core.pydantic import ( NonNegativeFloatRangeType, NonNegativeIntRangeType, OnePlusFloatRangeType, OnePlusIntRangeTyp...
067dc1e3f7995f10197095e8c51c282e6efa17dbafed8c1609f55c73ecb3449c
Python
11,665
338
#!/usr/bin/env python2 desc="""Generate nice graph with coverage for multiple samples. First generate cov.bed files is: for f in bowtie2/*.bam; do echo `date` $f; bedtools coverage -counts -abam $f -b ../ensembl/Fusarium_oxysporum.FO2.15.dna.toplevel.fa.no_gaps.1kb.bed > $f.cov.bed; done TODOs: Normalise by GC? """ ...
6bee256db6fea879c49b4921ec18c4370588b9fb7e4785b3202da1b5e9a722c6
Python
11,695
392
# -*- coding: utf-8 -*- """ celery.five ~~~~~~~~~~~ Compatibility implementations of features only available in newer Python versions. """ from __future__ import absolute_import import io import operator import sys from importlib import import_module from types import ModuleType from kombu.five im...
e872858687c9324c0dd43a59203b7d33a09b2070a8946ade8d7fdd3a32f4e9f6
Python
11,720
329
############################################################################### # MNE.py provides an implementation of mne interface for EEG modalities ############################################################################### # Copyright (c) 2019-2020, University of Liège # Author: Nikita Beliy # Owner: Liege Uni...
8925a69c5c73bddf08dcba77aea2b71a4b82615e1613396f0abba3632d4c4bbb
Python
11,726
334
""" 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...
f5cfc9083af5fedf1fdc308917ffa85796fa9bcfb518518c40238f9f18fce754
Python
11,744
329
############################################################################### # MNE.py provides an implementation of mne interface for EEG modalities ############################################################################### # Copyright (c) 2019-2020, University of Liège # Author: Nikita Beliy # Owner: Liege Uni...
9039019e667d70c8639940f060514fa205f1ccddfac51aa634459b587af93886
Python
11,765
342
import numpy as np from numpy import ceil, sum, diag, log, eye, exp, trace, einsum import PcmPy as pcm import pandas as pd import scipy.optimize as opt def _CKA_individ(theta, M, G_est): # return deriv 1 for ''' Compute CKA (cosine similarity) between two matrices Returns: CKA (double): ...
2a0190e2e9a31b045ef2821cbb35509f2f603cc77f05c36b2e09283eabb8355f
Python
11,777
275
import numpy as np import pytest from collections.abc import Sequence from albumentations.core.label_manager import LabelEncoder, LabelManager @pytest.mark.parametrize( "input_labels, expected_encoded, expected_decoded", [ (["a", "b", "c", "a", "b"], [0, 1, 2, 0, 1], ["a", "b", "c", "a", "b"]), ...
5b4750f6e2028a82195b1be3fc5cccdb661facdf165d21a158ee0580eb6df390
Python
11,785
309
#!/usr/bin/env python2 desc="""Find putative telomers in short reads. """ epilog="""Author: l.p.pryszcz+git@gmail.com Mizerow, 14/09/2016 """ import math, os, re, resource, sys from datetime import datetime from collections import Counter, defaultdict nucleotides = 'ACGT' DNAcomplement = {'A': 'T', 'C': 'G', 'G': 'C'...
c083e8cda9f785060e73b536ef3ea7fd7452992f423331abe1b4c9da2de99842
Python
11,799
286
import torch from torch.nn.parameter import Parameter import numpy as np import torch.nn as nn from utils.polarTransforms import * from saveNet import * class FrequencyWeighting(nn.Module): def __init__(self, rank, grid, center=(0, 0), sigma=(1, 1), polar=False): super(FrequencyWeighting, self).__init__...
6ed115fa538e5cd26d0e0f81cd07c68a2183ae727b1aece7b2a828f767c3cfd5
Python
11,843
397
# # The Python Imaging Library. # $Id$ # # macOS icns file decoder, based on icns.py by Bob Ippolito. # # history: # 2004-10-09 fl Turned into a PIL plugin; removed 2.3 dependencies. # # Copyright (c) 2004 by Bob Ippolito. # Copyright (c) 2004 by Secret Labs. # Copyright (c) 2004 by Fredrik Lundh. # Copyright (c) 201...
4db7c4f79ef976955f9b1df09486d4d9bd37ab172d7996fe6c3e228b86828601
Python
11,848
286
""" 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...
1c087372dd48abb931edde3b8909caefd7a1aa652c910df7ec5d50c404741d2e
Python
11,857
337
from functools import wraps import os.path as op from os import makedirs from math import log from tkinter import messagebox from copy import copy from threading import Thread from datetime import datetime import numpy as np from mne.io.kit.kit import get_kit_info from bidshandler import BIDSTree, Project, Subject, S...
2cc2441c58d7a52d8063d27d94cd37bf187d40e6b2d791d45a3d6cee11001a9b
Python
11,892
301
from __future__ import absolute_import import os from contextlib import contextmanager from celery.fixups.django import ( _maybe_close_fd, fixup, DjangoFixup, DjangoWorkerFixup, ) from celery.tests.case import ( AppCase, Mock, patch, patch_many, patch_modules, mask_modules, ) class FixupCase(A...
2bea3bbbdff145af0d5ecebcdfab222434dcffe2f6a8b188b285c160c6528968
Python
11,899
208
#!/usr/bin/env python3 """Execute all documentation fences and examples, then reject missing or stale evidence.""" import argparse import hashlib import importlib.metadata import json import os import signal import subprocess import sys import time from concurrent.futures import ThreadPoolExecutor, as_completed from pa...
acc6d8fbbb27eec826c24a6a0e5785081520d6a475c1e4a2dc30e62186ecb3e7
Python
11,911
365
# -*- coding: utf-8 -*- """ celery.contrib.migrate ~~~~~~~~~~~~~~~~~~~~~~ Migration tools. """ from __future__ import absolute_import, print_function, unicode_literals import socket from functools import partial from itertools import cycle, islice from kombu import eventloop, Queue from kombu.common im...
0feeb53f000fba924c4c222cd789acb357ddf9662a9b9e77ab3b97d69875b9ff
Python
11,915
378
import inspect import warnings from collections import namedtuple from operator import attrgetter import attr import six from ..compat import ascii_escaped from ..compat import getfslineno from ..compat import MappingMixin from ..compat import NOTSET from _pytest.outcomes import fail EMPTY_PARAMETERSET_OPTION = "emp...
09c91985d77fd0116cdbadbc430027d64a102628629e57516809c00f1f997e00
Python
11,929
359
""" 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...
b926e5f31e01bab02e0d86aea459c0e3af5b0b6fd5c9d50032e2dafe0d52b243
Python
11,930
349
import base64 import logging import string from datetime import datetime, timedelta from django.conf import settings from django.contrib.sessions.exceptions import SuspiciousSession from django.core.exceptions import SuspiciousOperation from django.utils import timezone from django.utils.crypto import ( constant_t...
a52dab84ba60eb746f774650f8cd96b6aecbcc61b7bbc8e50d998dc9b265fc8d
Python
11,944
374
import itertools from contextlib import nullcontext import numpy as np import pytest from brainglobe_space import AnatomicalSpace, SpaceConvention from .utils import create_label_array valid_origins = ["asl", "ipl", "pli"] some_shapes = [(3, 3, 3), (15, 5, 10)] @pytest.mark.parametrize( "origin", [ ...
04b59390330cba7bda37d951f100ee8e628ec54ca10502b2d7402ea349e90da4
Python
11,948
333
# Copyright (c) 2007, Robert Coup <robert.coup@onetrackmind.co.nz> # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, #...
9512862e463492eaa043124d7866bb541762aac861f22c43717ab920a86031e7
Python
11,961
292
import re from datetime import date, datetime from decimal import Decimal from django import template from django.conf import settings from django.template import defaultfilters from django.utils.formats import number_format from django.utils.safestring import mark_safe from django.utils.timezone import is_aware, utc ...
623032592ccd2d7d0886297ecc3eba3de21adda8d154e220bd983507ce4ac724
Python
11,976
375
""" basic collect and runtest protocol implementations """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import bdb import os import sys from time import time import attr import six from .reports import CollectErrorRepr from .reports import CollectReport...
32f541f94d6fd12859b09a6218aab9e187cb7591d469492651e07d26e70492c4
Python
12,035
329
import random import numpy as np import pytest from albumentations.augmentations.mixing.transforms import Mosaic from albumentations.core.composition import Compose from albumentations.core.bbox_utils import BboxParams from albumentations.core.keypoints_utils import KeypointParams @pytest.mark.parametrize( "img_...
6d0b34feb0c1b062b1b4756d42c0f9e73672395a880c87ea46e670084adfbdd4
Python
12,045
352
import numpy as np import PcmPy as pcm from PcmPy import sim import pandas as pd import plotly.io as pio import plotly.graph_objects as go import scipy.stats as ss margdict = dict(l=10,r=10, b=10, t=10, pad=4) def get_corr(X,cond_vec): """ Get normal correlation """ p1 = X[cond_vec==0,:].mean(axi...
6fc3f9464b74172b86c532b9b9f2a9af108d7aa4d83b4a77eca20dd5f6d8e69d
Python
12,068
290
#!/usr/bin/env python from __future__ import division import logging import numpy as np from nibabel.streamlines import save, Tractogram from dipy.direction import (DeterministicMaximumDirectionGetter, ProbabilisticDirectionGetter, ClosestPeakDirectionGetter) f...
a6e681e749184fd5d6c623d7a82b057a9654ce2ddd73a6344a43aee1ead96711
Python
12,071
250
#!/usr/bin/env python3 desc="""Estimate polyA tail lengths Dependencies: h5py mappy ont_fast5_api scipy numpy """ epilog="""Author: l.p.pryszcz+git@gmail.com Cologne, 15/04/2020 """ import itertools, h5py, mappy, math, os, resource, scipy, sys, numpy as np import matplotlib.pyplot as plt from multiprocessing import ...
38778c959f69650b7ac6cb351a745e6c793feaaa2193900a295d20d136f86877
Python
12,153
329
""" This module implements connections for MySQLdb. Presently there is only one class: Connection. Others are unlikely. However, you might want to make your own subclasses. In most cases, you will probably override Connection.default_cursor with a non-standard Cursor class. """ import re import sys from MySQLdb import...
36ecff319290591e4f6fb7b337d1d2efa6baad4ec78a2b58ebe81e04b890508b
Python
12,158
340
# 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.exceptions import ( ...
8f4a4da0bf140b639a6db73e79f8a1fe5e6495c48c5fc8e0185f95d3d9e90a58
Python
12,201
283
# Copyright 2023 Masatoshi Suzuki (@singletongue) # # 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 law or a...
e96c1838f7b171cb7dcb17874606dcd2f31160b0d1cfc98190983f11a5c82bc6
Python
12,230
331
#!/usr/bin/env python2 desc="""Generate nice graph with coverage for multiple samples. First generate cov.bed files is: for f in bowtie2/*.bam; do echo `date` $f; bedtools coverage -counts -abam $f -b ../ensembl/Fusarium_oxysporum.FO2.15.dna.toplevel.fa.no_gaps.1kb.bed > $f.cov.bed; done TODOs: Normalise by GC? """ ...
d8c0c7bf043ea9bbb4c1940e8099cefae73ede22ff6ad00efc6de42e5b3c9751
Python
12,231
327
""" Testing Free Water Elimination Model """ from __future__ import division, print_function, absolute_import import numpy as np import dipy.reconst.dti as dti import dipy.reconst.fwdti as fwdti from dipy.reconst.fwdti import fwdti_prediction from numpy.testing import (assert_array_almost_equal, assert_almost_equal, ...
93b1ea8b6fedfe46bf2ed6d0833b5635ad860797879a715d82cf4cd7fef3205e
Python
12,251
303
import os import sys import numpy as np import pandas as pd import argparse import librosa import math from scipy import signal import time from utilities import read_audio, read_audio_flusense, create_folder import config import soundfile import h5py sys.path.insert(1, os.path.join(sys.path[0], '../utils')) class ...
f10e7323643a6fd1136f173bfc90aea993ecdca59a879370909ac0f1769038a6
Python
12,262
347
"""Helper class for preprocessing tile images.""" __all__ = ["OutlierDetector"] from typing import Optional, Union import matplotlib.pyplot as plt import numpy as np import polars as pl from PIL import Image from sklearn.cluster import MiniBatchKMeans from histoprep.functional._images import create_image_collage, r...
bcc93e8089804cec3659c271dd6bb6c9db6cf99ea7716f1a705565fb9b1a070d
Python
12,318
307
from os.path import join as pjoin import os.path import numpy.testing as npt import numpy as np import nibabel as nib from nibabel.tmpdirs import TemporaryDirectory from dipy.align.tests.test_imwarp import get_synthetic_warped_circle from dipy.align.tests.test_parzenhist import setup_random_transform from dipy.align...
c0abe2de54a58a5a9451c10d12268c0aa6eff7a20b226018e6455f1981ba1b04
Python
12,326
300
#!/usr/bin/env python2 desc="""Report heterozygous sites from bam alignments. """ epilog="""Author: l.p.pryszcz@gmail.com Warsaw, 11/04/2017 """ import os, sys, pysam, resource, gzip from datetime import datetime from multiprocessing import Pool import numpy as np alphabet = "ACGT" base2index = {b: i for i, b in en...
a94317fe941ce9a6591845bb195c8be30b98d2af93fe8dcfbc9098abab561243
Python
12,339
368
from __future__ import division, print_function import numpy as np from scipy.special import gammainccinv from scipy.ndimage.filters import convolve def _inv_nchi_cdf(N, K, alpha): """Inverse CDF for the noncentral chi distribution See [1]_ p.3 section 2.3""" return gammainccinv(N * K, 1 - alpha) / K ...
79a420a67b1acd2e322024be0b20db27bdf6489fc5eb56259c59cac0c2e77c21
Python
12,353
258
# emacs: -*- mode: python-mode; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*- # -*- coding: utf-8 -*- # ex: set sts=4 ts=4 sw=4 noet: # ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # # See COPYING file distributed along with the datalad package for the # copyright and...
2d8dbdc2a408af3f50baaa19f509cd4ead032be3033d5c5f2b6ab6700edc64aa
Python
12,360
390
from __future__ import division, print_function, absolute_import import numpy as np import numpy.testing as nt import warnings from dipy.utils.six.moves import xrange from dipy.core.sphere import (Sphere, HemiSphere, unique_edges, unique_sets, faces_from_sphere_vertices, HemiSphere, ...
81af14d8c7019bc7a63805d89b72986038b1dcdb0bd1a0159ebb8f93204d0f49
Python
12,360
295
import torch import os import argparse import datetime import numpy as np import random from torch.utils.data import DataLoader from tqdm import tqdm import pandas as pd from brainCT.networks.unets import UNet, UNet3d_AG, UNet_PlusPlus4 from monai.transforms import ( Compose, ToTensord, RandAffined, Sc...