sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
08da408c1004eea8da57858287141e6a4f797b9c9439abbc02cbd3fbc9bac2cb
Python
7,663
235
from ._compat import PY2, filename_to_ui, get_text_stderr from .utils import echo def _join_param_hints(param_hint): if isinstance(param_hint, (tuple, list)): return ' / '.join('"%s"' % x for x in param_hint) return param_hint class ClickException(Exception): """An exception that Click can handl...
6f9c9bfd45f0b6ec41b0afd4f6cfbffd5cda550c62e7d605fbe9b34c91085bfc
Python
7,673
184
import numpy as np import json import matplotlib.pyplot as plt from pathlib import Path import reliableradiomics.metrics.statistics as stats from reliableradiomics.utils.radiomics import load_features from reliableradiomics.utils.logutils import NumpyEncoder def plot_ds(dataset, only_plot=True): # ---------...
91b560a14998e58cc3a38777047e8ef5e6184d003f34ff3f29a2403548640d92
Python
7,707
229
import numpy as np import os from matplotlib import pyplot as plt from matplotlib.patches import Rectangle from tensorflow.keras import callbacks from tensorflow.python.keras.callbacks import Callback from lib.pinn import PINN from lib.network import Network import pandas as pd import tensorflow as tf from tensorflow....
3582aaa855be701b6431568f820b4f1956c36f48cdc83ebfe5a08c450e0b0cd0
Python
7,720
217
""" BORIS plugin Inter Rater Reliability (IRR) Weighted Cohen's Kappa - Supports behaviors with duration (start < stop) AND instantaneous events (start == stop) - Aggregated warning when kappa is NaN to avoid multiple popups - event_weight configurable via QInputDialog.getDouble """ import math from typing import Opt...
d7deeec7601e73f77d6a625a281323f2f44c0f0beff4d928cc8d9e1adf8b1897
Python
7,728
194
#!/usr/bin/env python2 desc="""Plot histogram """ 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 import plotly.plotly as py import plotly.graph_objs as go data = ...
f14f5eca1d76460754959d56296cc45fede21578f75a0f020f09dc874322ead8
Python
7,731
202
############################################################################### # dcm2niix.py contains tools, that can be used in user plugins, # that can be used to convert DICOM to NIFTY formats on fly # these tools do require dcm2niix module installed #################################################################...
fbeafe8697c25401a8b2da14945676c1cf6b531c36b3bafe40834e22549b88d2
Python
7,741
202
import datetime import logging import os import shutil import tempfile from django.conf import settings from django.contrib.sessions.backends.base import ( VALID_KEY_CHARS, CreateError, SessionBase, UpdateError, ) from django.contrib.sessions.exceptions import InvalidSessionKey from django.core.exceptions import I...
3279b2ea3fa1f7052928626e1359b0a80349f131bbd13273a3718061d9fc908e
Python
7,742
223
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Functions for visualization of PCM models, Data, and model fits @author: jdiedrichsen """ import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as patches import matplotlib.lines as mlines import matplotlib.cm as cm import matplotlib.colors as c...
ca7f2f2df0f794374f8da4c4f4d1ac351dda42070a257dca342d14a3c877a778
Python
7,778
228
from __future__ import absolute_import import datetime import pytz from kombu import Exchange, Queue from celery.app.amqp import Queues, TaskPublisher from celery.five import keys from celery.tests.case import AppCase, Mock class test_TaskProducer(AppCase): def test__exit__(self): publisher = self.ap...
41ab5f6ac89b4ee94b48c7ff698e06bc9e865234662cfc80a6d215f834358cf9
Python
7,791
156
"""Coverage publication retains the executed report and trusted source binding.""" import hashlib import json import os import subprocess import sys from pathlib import Path import pytest import yaml from tools.coverage_badge import publish ROOT = Path(__file__).resolve().parents[2] def test_badge_preserves_execut...
9316ee3dfd53391c9e81e8f3a20b7253a5fd424625281644460329fd7ac57ab2
Python
7,794
214
import cgi import codecs import re from io import BytesIO from django.conf import settings from django.core import signals from django.core.handlers import base from django.http import HttpRequest, QueryDict, parse_cookie from django.urls import set_script_prefix from django.utils.encoding import repercent_broken_unic...
7d98ed9210c7fc8cdce9106b8c6462607f9378594589fe2112606dc257b50259
Python
7,796
185
#!/usr/bin/env python2 desc="""Plot histogram """ epilog="""Author: l.p.pryszcz+git@gmail.com Barcelona, 29/11/2012 """ import argparse, os, sys, random from datetime import datetime import matplotlib.pyplot as plt import matplotlib as mpl import numpy as np from scipy.stats import stats, wilcoxon, ranksums def grou...
2d9a667938d27e1e3042d74aa381be27b91b0796e42edc774531810cfe22e24a
Python
7,799
206
import numpy as np import numpy.testing as npt import scipy.ndimage from dipy.core.ndindex import ndindex from dipy.tracking.local import (BinaryTissueClassifier, ThresholdTissueClassifier, ActTissueClassifier, CmcTissu...
8a93a0f95d88c90f78b5f0b1b483b466b5965394cc4915729f83989a8db02e4f
Python
7,804
252
from re import I import re import numpy as np from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D from lib.pinn import PINN from lib.network import Network import pandas as pd from matplotlib.patches import Rectangle import tensorflow as tf import os from scipy.signal import savgol_filter l...
8e98e9166581c17e06515ad8bbd1a793a617467cdbfae545bdf6894a8fa6ff64
Python
7,827
310
# coding: utf-8 """ ASN.1 type classes for the time stamp protocol (TSP). Exports the following items: - TimeStampReq() - TimeStampResp() Also adds TimeStampedData() support to asn1crypto.cms.ContentInfo(), TimeStampedData() and TSTInfo() support to asn1crypto.cms.EncapsulatedContentInfo() and some oids and value ...
9ba1f17ac580110cbc0b39479a8d6290f355a188198274d76a71f98582b121bd
Python
7,832
247
""" 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...
8622b54272898a2062b5adfb86b7e28f064d76dfdfe64ce00c14b849425a2287
Python
7,843
216
""" Functions for Cross-block correlation estimation as laid out in Diedrichsen et al. 2026 """ import pandas as pd import numpy as np from pathlib import Path from scipy.spatial.distance import squareform def cond_to_item(cond_vec): """Takes a cond_vec and assigns the first half to condition1, and the second...
4d5e0162e826507a8aa50706e103aedefdbbb060c8a52e2d3da1388f728824ec
Python
7,844
157
"""Compile validated caller models and recorded identities into executable SFDs.""" import inspect import json from functools import wraps from importlib import import_module from pathlib import Path from talos.yaml.resolver import caller_imports, load_sfd, resolve_values, validate_sfd from talos.yaml.store import can...
61efe8829820141184a035479c1fbf220d57b63dc25a57edb4bf87bbf5399036
Python
7,850
233
from __future__ import division from __future__ import print_function import time import numpy as np import scipy.sparse as sp from utils import * import networkx as nx import tensorflow.compat.v1 as tf from sklearn.metrics import roc_auc_score from sklearn.metrics import average_precision_score flags =...
48cb002a285ade0656d6718fc360375a9797c3f190d92e9f4adac5ec4c442a5f
Python
7,861
203
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """ report.py Generates report on Bot Framework issues. See README.md for details on installing/using. """ import os import sys from datetime import datetime from github import Github from colorama import Fore, Style from o...
b512ea5cce65555ed47f4982b86a60e1cbdc3904f7617552c297de92160d1c8d
Python
7,861
202
import torch.nn as nn import torch class Modified3DUNet(nn.Module): def __init__(self, in_channels, n_classes, base_n_filter = 8): super(Modified3DUNet, self).__init__() self.in_channels = in_channels self.n_classes = n_classes self.base_n_filter = base_n_filter self.lrelu = nn.LeakyReLU() self.dropout3d...
0788dca7bac20f5ca2592fea6efd1933e46f9beeb8d1d0a1791b9f97649bb7df
Python
7,870
186
import os import numpy as np import cv2 import torch import yaml import pandas as pd from argparse import Namespace from monai.transforms import ( Compose, ToTensord, ScaleIntensityd, AsDiscrete ) from monai.networks.nets import UNet from brainCT.train_utils.metrics import DiceScore from torchmetrics im...
7390167e8bde7376d68bc74a2432b9dc34b256ad2cfe462a2e8563f970d24bef
Python
7,879
218
# coding: utf-8 from __future__ import (absolute_import, division, print_function, unicode_literals) from citeproc.py2compat import * import unicodedata from . import (parse_argument, eat_whitespace, parse_macro_name, OPEN_SCOPE, CLOSE_SCOPE, START_MACRO) __all__ = ['MACROS'...
fa403854016822fb6b175b3ec82fe0ca362525d6c36200358396d066a018731d
Python
7,906
210
#!/usr/bin/env python2 desc="""Report exact repeats in chromosomes. Apply distance criteria as a function of repeat length: #f(x) = 133.7480609953 * EXP( 0.2011797391 * x ) f(x) = 2x**2.0 you may optimise this! there is a hard limit of Require MUMMER3 (repeat-match): -f only forward (ff) matches otherwise ff an...
9d0af4b640f161fc87e3aa78ca4cdcce01164e7311d3d53ba0cff6a9b42d88f5
Python
7,927
236
import numpy as np import nibabel as nib from numpy.testing import (assert_equal, assert_almost_equal, run_module_suite) from dipy.data import get_fnames from dipy.segment.bundles import RecoBundles from dipy.tracking.distances import bundles_distances_mam from dipy...
b64c15cb00a6b60404fab008a3adbc038ce470fa271c34b423b1f5c29023320d
Python
7,928
239
from types import SimpleNamespace import pytest from PySide6.QtCore import QEvent, QRect from boris import coding_pad, config as cfg def project(): return { cfg.ETHOGRAM: { "0": {cfg.BEHAVIOR_CODE: "A", cfg.TYPE: cfg.STATE_EVENT, cfg.BEHAVIOR_CATEGORY: "Alpha", cfg.COLOR: "#ff0000"}, ...
50530737514a141545202069668c0a266c0266be9730f8b4839be90e9f524c5d
Python
7,939
224
import os import os.path import os.path import schema import sargasso.separator.options as opts from sargasso.filter import hits_manager, hits_checker from sargasso.separator.commandline_parser import CommandlineParser from sargasso.separator.parameter_validator import ParameterValidator from sargasso.utils import log...
c04f98fc29172dc95e0d3db13c5521b865f65500a656bd392c132b87e519242c
Python
7,954
221
import numpy as np from numpy.testing import assert_array_almost_equal from dipy.align import floating from dipy.align import crosscorr as cc def test_cc_factors_2d(): r""" Compares the output of the optimized function to compute the cross- correlation factors against a direct (not optimized, but less err...
5e0e3fc2ac3565311ed268266da1d7b766d7ee94ea30b9011d3acc8759ecce21
Python
7,956
249
# # Module which deals with pickling of objects. # # multiprocessing/reduction.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # from __future__ import absolute_import import copyreg import functools import io import os import pickle import socket import sys __all__ = ['send...
e03dafc8b0654df05b0c0dcd0b891e6819dd020bdf74061c11cbbc23915041fd
Python
7,966
210
import copy import os from pathlib import Path import sys from decimal import Decimal from types import SimpleNamespace import pytest from PySide6.QtWidgets import QApplication, QTableView sys.path.insert(0, str(Path(__file__).resolve().parents[1])) from boris import config as cfg @pytest.fixture(scope="module") d...
b316e8e54bc983207fa1cea8c8cd7c7d907180f75bbadbd89026ade2cffdd671
Python
7,967
188
# 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...
d3f08c9c40b2a7b072046772c867d25e3495f4d3c230899149d2fcb90198aa69
Python
7,972
248
""" 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...
2b9caee5c8cdf9fd5838931fabdd1735188a601f9550ef71d00cdad82545d00b
Python
7,979
228
from __future__ import annotations import functools import inspect import random from io import StringIO import numpy as np import albumentations from tests.aug_definitions import AUGMENTATION_CLS_PARAMS def convert_2d_to_3d(arrays, num_channels=3): # Converts a 2D numpy array with shape (H, W) into a 3D array...
051ebd8f3d310ba6b5afbab232eaf8606e5ea01f7ee2c9caf93490bc95b1601d
Python
7,986
225
import inspect import re from django.apps import apps as django_apps from django.conf import settings from django.core.exceptions import ImproperlyConfigured, PermissionDenied from django.middleware.csrf import rotate_token from django.utils.crypto import constant_time_compare from django.utils.module_loading import i...
eb72467928ee9955ac290ba5bbe1b9c2c6abf3ccc8bcc8a4a06e6cc0e140b8fd
Python
8,002
189
#!/usr/bin/env python3 desc="""Plot histogram """ 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 from io import IOBase # type file def histplot(ax, x, handle, bins...
2b01b6555b0448f893998a10ae1958f5e9e1613346cac670a88a5a59ee127ebd
Python
8,016
256
# 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 enum import Enum import six from cryptography import utils from cr...
a92acd92d27e02d0f35e81c10134ad50fe30a4b473eea46f38a36d94b5859982
Python
8,017
221
from collections import namedtuple class HitsChecker: REJECTED = -1 AMBIGUOUS = -2 CIGAR_GOOD = 0 CIGAR_LESS_GOOD = 1 CIGAR_FAIL = 2 CIGAR_OP_MATCH = 0 # From pysam CIGAR_OP_REF_INSERTION = 1 # From pysam CIGAR_OP_REF_DELETION = 2 # From pysam CIGAR_OP_REF_SKIP = 3 # From pys...
a2a03da0bf91e03f275e241eae264d0c848d2aa7433a979e4345ff0e43c36cc5
Python
8,023
248
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ test_indicator @author: jdiedrichsen """ # Import necessary libraries import PcmPy as pcm import numpy as np import pickle import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from numpy import exp, sqrt from sklearn.base import BaseEstimator, Tra...
002b9845679be04e6cde39f6187dceae9dfa30e45980a56699758bec7b97425c
Python
8,025
226
"""Python net specification. This module provides a way to write nets directly in Python, using a natural, functional style. See examples/pycaffe/caffenet.py for an example. Currently this works as a thin wrapper around the Python protobuf interface, with layers and parameters automatically generated for the "layers"...
1435ce22be10f6e08a7d043fa4bb667e02a1807e6081def4917ae9b71fe20b76
Python
8,026
255
# # Module which supports allocation of memory from an mmap # # multiprocessing/heap.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # from __future__ import absolute_import import bisect import mmap import os import sys import threading import itertools from ._ext import _b...
89f7d73e7e37dce8eabac3faf6a6ac491c54b0b4f0b1342af8d3abc3a517ec66
Python
8,029
156
''' Created on May 17, 2018 @author: helrewaidy ''' # models import argparse from pycparser.c_ast import Switch import torch import numpy as np import os ########################## Initializations ######################################## model_names = 'recoNet_Model1' parser = argparse.ArgumentParser(description='Py...
641a8b288f5ff012de314a9ff4d67320812946fe8de7cdf8ffd1bb74e5c0f1df
Python
8,033
211
#DEGnext #Copyright Tulika Kakati 2020 #Distributed under GPL v3 open source license #This code may be used to test the DEGnextModel.pth on new datasets. ############################################ import torch import torch.nn as nn import numpy as np import matplotlib.pyplot as plt from torch.utils.data im...
8f783e6cb81886f681c419d7f97d459f605b7adca712c783478c054de602e09a
Python
8,036
206
#----------------------------------------------------------------------- #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...
4ce8cf6ad92294635bae457620377faf348850bd232eb5d5968bea7994037306
Python
8,041
187
import unittest import os import logging from bidsme.bidsMeta import BidsSession from bidsme.Modules.exceptions import CharacteristicError from tests.testModule import testModule data_path = os.path.dirname(__file__) data_path = os.path.join(data_path, "data", "plugins", "curation") class TestMetadata(unittest.Test...
99ec968d72edd2a80f7ea335e0a19a5ac65a91b81afb0b875ecbb68241f243eb
Python
8,047
203
import os from importlib import import_module from django.core.exceptions import ImproperlyConfigured from django.utils.module_loading import module_has_submodule MODELS_MODULE_NAME = 'models' class AppConfig: """Class representing a Django application and its configuration.""" def __init__(self, app_name,...
c0ff57470ddc2f45972c00bb0e974ad87b1e4e290adef566db4212d156336d3c
Python
8,051
231
"""Convert between frames and higher-level AMQP methods""" # Copyright (C) 2007-2008 Barry Pederson <bp@barryp.org> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 ...
2070a377b779ac33429c84be248c5bc98ce33af7c5de3c059b02da1e45b875e1
Python
8,053
192
#!/usr/bin/env python3 desc="""Plot histogram from many files """ 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 from io import IOBase # type file def histplot(ax,...
361266cc2b585776b2eec07435e0d31d7e9facebad8140eec83018f53e93ab4a
Python
8,054
209
""" 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...
d44a4c65ee8dd6e94971e6af1558d0091f6bf8bdfa99d8a6b6f327bcad4b1ff2
Python
8,061
228
# This is an example of how to intergrate the T1 Mapping program into FIRE. # This file needs to be moved into the python-ismrmrd-server folder before running. import ismrmrd import os import itertools import logging import numpy as np import numpy.fft as fft import base64 import re import mrdhelper import copy import ...
a5e0de897d4e27a9559b3ab825575d011b2c270d519cd55ab9bbb4d9380bf73a
Python
8,073
284
# # The Python Imaging Library # $Id$ # # JPEG2000 file handling # # History: # 2014-03-12 ajh Created # # Copyright (c) 2014 Coriolis Systems Limited # Copyright (c) 2014 Alastair Houghton # # See the README file for information on usage and redistribution. # from . import Image, ImageFile import struct import os imp...
a61d669995d59aa53495c0a4c7619709e5ad52b53bd583a10c7025ab8d42f571
Python
8,083
190
import torch from torch.nn.parameter import Parameter import numpy as np import torch.nn as nn def polarToCylindricalConversion(input): real = input[:,:,:,:,0]*torch.cos(input[:,:,:,:,1]) imag = input[:,:,:,:,0]*torch.sin(input[:,:,:,:,1]) return torch.stack([real, imag],dim=4) def cylindricalToPolarCo...
b24c7ff2ae583f22794dfd5831c41500b0d519b913bbcf3785a9a01e4b84e0d3
Python
8,095
226
"""Desired behavior for independently reproduced bugs; all xfails are strict. Run with --runxfail to reproduce failures. Remove a mark when its production fix lands; an unexpected pass otherwise fails CI instead of silently going stale. """ import inspect import numpy as np import pandas as pd import pytest from sci...
9784d7f6610e53cf4a775c1c925e2df9d5f1be49f0878d0942d5897b67c4267a
Python
8,097
270
import inspect import itertools import numpy as np import os from glob import glob from dipy.utils.six import string_types from dipy.workflows.base import get_args_default def common_start(sa, sb): """Return the longest common substring from the beginning of sa and sb.""" def _iter(): for a, b in zip...
ff42fa696ef9dab08e3fc003bd8583e1a264ee0b8011549955b2585d34c1ab8b
Python
8,097
186
"""Implementation of XY masking for time-frequency domain transformations. This module provides the XYMasking transform, which applies masking strips along the X and Y axes of an image. This is particularly useful for audio spectrograms, time-series data visualizations, and other grid-like data representations where m...
1924eab16e7ea83dee7a53aacf23226a7c9ab4a5f9f4d5f7952685273acd88d6
Python
8,099
225
#!/usr/bin/env python2 desc="""Generate phylomeDB stats file. Check no. of phylomes, trees, algs, proteins, species and genomes. In addition, checks for web-serwer stats from last week i.e. the most common query etc. NOTE: Need to be run from cgenomics. """ epilog="""Author: l.p.pryszcz+git@gmail.com Barcelona/Mizerow,...
f76acdea012eb7149a5f834967b2b8c61765db9fcdbd5d16dbc73e0ba6a81881
Python
8,102
200
""" 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...
4ef0f54f97f106912d47a96641f2dde8c3715232ed0815e577455adbc1d55fb2
Python
8,132
196
"""Lazy backend-native metrics with dataset-level classification accumulation.""" from typing import TYPE_CHECKING if TYPE_CHECKING: from keras.metrics import Metric matthews: Metric precision: Metric recall: Metric f1score: Metric def _framework(): import keras if hasattr(keras, 'ops'): ...
63a78efb787ab49c1f739befee774b20d3b38216cebddd1efd1abd43bea6a805
Python
8,132
144
"""Checks added in v0.1.1 after an external review of v0.1.0. They are exploratory and leave the frozen protocol, code, run and verdicts unchanged. A. Readout rank. Symmetry under field reversal makes every neuron an even function of the field direction, so the population factors through RP². The population is RP² ...
56f6921d35d528b734a2176952404c769600dbe4eeeb335cbd4aae62b76f6a60
Python
8,133
209
import numpy as np import itertools from numpy.testing import (assert_array_equal, run_module_suite, assert_equal, assert_raises) from dipy.testing.memory import get_type_refcount from dipy.testing import assert_arrays_equal from dipy.segment.clustering import QuickBundles import dipy.segm...
d473190ea771dcea2bdc3db67238ec019dce9071570168d56b77923d85301797
Python
8,140
242
"Misc. utility functions/classes for admin documentation generator." import re from email.errors import HeaderParseError from email.parser import HeaderParser from django.urls import reverse from django.utils.encoding import force_bytes from django.utils.safestring import mark_safe try: import docutils.core ...
86bbc0fb928d71366321194e24d125bd03ef55309a41737923f072ec793754a7
Python
8,151
242
import logging import os from pathlib import Path import brainglobe_space as bg import numpy as np from brainglobe_atlasapi import BrainGlobeAtlas from brainglobe_utils.general.system import delete_directory_contents from brainglobe_utils.image.scale import scale_and_convert_to_16_bits from brainglobe_utils.IO.image.l...
093a04c1c9fcb94644c6893b1c4689ccbb72174167621b949db96507addfbdaf
Python
8,163
204
#!/usr/bin/env python3 desc="""Calculate completeness of transcripts Assumes sense read orientation (as in direct RNA-seq ONT). 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. US...
06dc55a25bf168d6c5f246c6d37a2783d48cde5a5b6ae2f03c80e8c5c273e5cb
Python
8,166
192
import sys import numpy as np from scipy.stats import pearsonr, spearmanr import scipy.cluster.hierarchy as sch import pandas as pd import matplotlib matplotlib.rc('pdf', fonttype=42) matplotlib.rc('font', **{'size': 14}) import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1.inset_locator import inset_axes from ...
5d80ed19608ce1fe80cb084aa65458d3501a75f131a00f40a8b60c64bf4e7bc9
Python
8,172
239
# import os import random import sys import cv2 import matplotlib.pyplot as plt import numpy as np import torch from pytraction.net.formats import DATASETS class CellTrackPreprocessor: """ Class used to preprocess datasets and det file for datasets. Here we assume that that each GT track ...
7601d58d2688753d73ff50219e68f4246c0e09cfdad794d6b76fddc42e121093
Python
8,173
282
"""Represent mutable parameter choices with portable checkpoint state.""" from __future__ import annotations from typing import Any, Protocol from talos.experiment.serialization import content_hash def values_equal(left, right): return left is right or content_hash(left) == content_hash(right) def _contains(...
5e7abe026e675a3c92612f7e3723198d11e378dbcabe6ad6543252f341dbe2df
Python
8,211
258
import itertools from typing import Optional, Union import numpy as np ERROR_TYPE = "Tile width and height should be integers, got {} and {}." ERROR_NONZERO = ( "Tile width and height should non-zero positive integers, got {} and {}." ) ERROR_DIMENSION = ( "Tile width ({}) and height ({}) should be smaller th...
b529981c4fc6b169e1c86d593870fd0a3523138c767e4ab69a77301b188d8ab1
Python
8,213
257
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt """Support for plugins.""" import os import os.path import sys from coverage.misc import CoverageException, isolate_module from coverage.plugin import CoveragePlu...
ae6ed70f9eb7c12a212b2c14cf8639870e56e17331b0fb5a2eb3150c8ae383d4
Python
8,225
182
import numpy as np from numpy.testing import assert_equal from dipy.testing import assert_false from os.path import join import nibabel as nib from nibabel.tmpdirs import TemporaryDirectory from dipy.data import (fetch_stanford_hardi, fetch_stanford_pve_maps, fetch_stanford_labels, get_fnames) ...
c62431d4270f7308971a2e31437cb578eab2b267c322a703d1cd00b761d0478f
Python
8,226
195
"""Independent reproduction of the two-site parity results (Fable 5.2, MAG_two_site_checks), written from scratch. Differences from her code on purpose: column-major vectorisation, full (non-axial) random hyperfine tensors, other rates, other field directions, and a second solver for the case without back hop (two Syl...
b086f963cd219171e9ea7a4878ddf87b343c15abe2433b9cedf767e3bf48832b
Python
8,231
234
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 = Path(__file__).resolve().parents[2] LINT_WORKFLOW: Final[Path] = REPO_ROOT / '.github/workflows/pr_checks_lint.yml' RULESET_WORKFLOW: Fina...
82a0988cca723f5011dfbf0d5d04001bfbe128b43ebb986a48f9863bc028a80e
Python
8,235
204
import itertools import numpy as np import pandas as pd import pytest from scipy import stats import scikit_posthocs as sp from tests._input_cases import LABELS, case, independent_samples, long_data OMNIBUS_CASES = [ case(sp.test_mackwolfe, p=1), case(sp.test_mackwolfe, n_perm=100), case(sp.test_osrt), ...
75ff43a234114013fdc8032764761e44758fc311f21e438f2624b56515272f17
Python
8,243
178
#!/usr/bin/env python3 """Build MAG-S3_colab.ipynb: a Colab notebook that carries the frozen MAG-S3 files (tar.gz, base64) with their SHA-256, installs the pinned packages and runs the environment check, the blind pipeline check and the confirmatory run on every processor of the runtime. Author's harness. python3 -I...
09d9fa24552074161a331c93e803ae3a5df5f0fc199fe0271137d8905911ba6c
Python
8,247
217
""" SQL functions reference lists: https://www.gaia-gis.it/gaia-sins/spatialite-sql-4.2.1.html """ from django.contrib.gis.db.backends.base.operations import ( BaseSpatialOperations, ) from django.contrib.gis.db.backends.spatialite.adapter import SpatiaLiteAdapter from django.contrib.gis.db.backends.utils import Sp...
c58dce090ccb2201d3252620843766a55ed95bb687116e30fd9e647787c8f530
Python
8,249
252
from ctypes import byref, c_double, c_int, c_void_p from django.contrib.gis.gdal.error import GDALException from django.contrib.gis.gdal.prototypes import raster as capi from django.contrib.gis.gdal.raster.base import GDALRasterBase from django.contrib.gis.shortcuts import numpy from django.utils.encoding import force...
19aa4c7f449f48c23797ced7dd3add16c7486fdb0512d609b1a6c987b2ead5cb
Python
8,250
229
#!/usr/bin/env python2 # -*- coding: utf-8 -*- ############################################################################### ## Vision Research Laboratory and ## ## Center for Multimodal Big Data Science and Healthcare ## ## University of California at S...
465c1c5f5523aa0a7fee98a16707b4103df604c8015c47f90a449a3880c9e680
Python
8,251
293
""" Statistics on spheres """ from __future__ import division, print_function, absolute_import import numpy as np import dipy.core.geometry as geometry from itertools import permutations def random_uniform_on_sphere(n=1, coords='xyz'): r"""Random unit vectors from a uniform distribution on the sphere. Param...
32b0dfb5436263b952183bb900676b3a966c9dedf1f6915e89d760fcab691721
Python
8,271
245
# A binary morphology add-on for the Python Imaging Library # # History: # 2014-06-04 Initial version. # # Copyright (c) 2014 Dov Grobgeld <dov.grobgeld@gmail.com> from __future__ import print_function from . import Image, _imagingmorph import re LUT_SIZE = 1 << 9 class LutBuilder(object): """A class for bui...
e23b913c985b4bd8b142ae4aaa317eda513a29430ebe826edcde0941ada52af5
Python
8,281
202
import itertools import os import sys sys.path.append(os.path.join(sys.path[0], '../')) import numpy as np import argparse import time import logging import torch import torch.nn as nn import torch.optim as optim import torch.utils.data from utils.config import num_epochs, gamma, patience, device, flusense_weights fr...
68059d801bcefaa1bc00db17d9a5bacf7f79d83a11b31af5ac383925aafc8525
Python
8,286
217
#----------------------------------------------------------------------- #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...
aa6162e62d18b58039b21faae5bab886d319b9156297d6c4a019ff9fcdbd9bc4
Python
8,287
216
""" This module contains the spatial lookup types, and the `get_geo_where_clause` routine for Oracle Spatial. Please note that WKT support is broken on the XE version, and thus this backend will not work on such platforms. Specifically, XE lacks support for an internal JVM, and Java libraries are required to use...
2a232dcd3a1bca208e449fb7b9969fa779c6ce30d3bdc5173fe3c2c1e0f40623
Python
8,292
246
# # The Python Imaging Library. # $Id$ # # PDF (Acrobat) file handling # # History: # 1996-07-16 fl Created # 1997-01-18 fl Fixed header # 2004-02-21 fl Fixes for 1/L/CMYK images, etc. # 2004-02-24 fl Fixes for 1 and P images. # # Copyright (c) 1997-2004 by Secret Labs AB. All rights reserved. # Copyright (c) ...
879462e57d1a85adbd60c31f2ccd4e2aaeebaca59e49389d1f35c585121857e4
Python
8,295
219
from django.db.models import Field, FloatField from django.db.models.expressions import CombinedExpression, Func, Value from django.db.models.functions import Coalesce from django.db.models.lookups import Lookup class SearchVectorExact(Lookup): lookup_name = 'exact' def process_rhs(self, qn, connection): ...
8c7fb0c5bd1f0bbe31518118bcd924aff9315e012995bf803deba22fc5f53665
Python
8,325
236
"""Select parameter cohorts with diverse metric performance.""" from typing import Any, Protocol, TypeGuard import numpy as np import numpy.typing as npt import polars as pl class _FittedScaler(Protocol): '''Typed facade over the sklearn StandardScaler surface used for selection.''' def fit_transform(self...
ed221247489ddccf85b419e05a7b245075248f59dc93b23a2d166a8c6559e954
Python
8,326
237
""" 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...
f63b2781e9ac80bd71c3678ec17caa2a0e9064ea02155948ec9765c6727320ec
Python
8,329
218
#!/usr/bin/env python2 """Run local assembly using subset of reads aligning to particular sequence(s). Prerequisites: Ray assembler (http://sourceforge.net/projects/denovoassembler/) bowtie aligner (http://bowtie-bio.sourceforge.net/ ; version 1) zlib [to enable -z] Author: l.p.pryszcz+git@gmail.com Barcelona, 1...
903ea35db564507f2ba8426238d74848c79cb92a73b6f460126c40d03825a3fa
Python
8,331
216
"""Small exact-null oracles and rank-order properties for ordered tests.""" # Seeds and input forms are pytest parameters, so failures reproduce by node ID. # Enumerating label assignments supplies Jonckheere's null moments independently # of the production variance formula. Page's reference uses SciPy's L statistic #...
477ea501dc34a7b8f217350f1d7e74df871f29f41d40f3bce679cd25d3ccb4c0
Python
8,333
204
import copy from types import SimpleNamespace import pytest from PySide6.QtCore import QByteArray, QSettings from boris import config as cfg from boris import config_file class RecordingTimer: def __init__(self): self.calls = [] def start(self, interval): self.calls.append(("start", interva...
ece67a4432346e568dc4a93a58e40460f8b9e2f1f8322e8061f2b254086257b6
Python
8,333
240
"""Pin the AST gate's detection across the three honesty-violation bypass shapes. The previous shell-grep implementation only caught the bare-name form (`except HonestyViolation`). This test pins that the AST replacement also catches the dotted form and the aliased form — and that it does NOT flag innocent excepts (fa...
d4ae9b9af37b41d852c9f2f0c5f9539acc4842ba528ab8b1e5bc638cb4c4e03d
Python
8,343
241
# -*- coding: utf-8 -*- """Signal class.""" from __future__ import absolute_import import weakref from . import saferef from celery.five import range from celery.local import PromiseProxy, Proxy __all__ = ['Signal'] WEAKREF_TYPES = (weakref.ReferenceType, saferef.BoundMethodWeakref) def _make_id(target): # pragm...
6b13e343f149c22b880305696606409fd3724a67795ee7e5086f8257280975d5
Python
8,352
226
from __future__ import division from __future__ import print_function import time import numpy as np import scipy.sparse as sp import networkx as nx import tensorflow.compat.v1 as tf from sklearn.metrics import roc_auc_score from sklearn.metrics import average_precision_score import random # # flag...
a11dbc0e847355531a48538c678ec9146bc500fdda4ed3c4107ec1d4bb26140b
Python
8,367
266
# -*- coding: utf-8 -*- """ celery.app.utils ~~~~~~~~~~~~~~~~ App utilities: Compat settings, bugreport tool, pickling apps. """ from __future__ import absolute_import import os import platform as _platform import re from collections import Mapping from types import ModuleType from kombu.utils.url impo...
4b66925e3352a9fa7165094911ce5ac3a2cf4f46d43cfce64b14b4eb37f8e29e
Python
8,368
221
#!/usr/bin/env python2 desc="""Run local assembly using subset of reads aligning to particular sequence(s). Prerequisites: Ray assembler (http://sourceforge.net/projects/denovoassembler/) bowtie2 aligner (http://bowtie-bio.sourceforge.net/bowtie2/) zlib [to enable -z] """ epilog="""Author: l.p.pryszcz+git@gmail.co...
910080d1dc025c007e2dc85318b7a9ea548bac6587c2cc9ed509c2dc73ff1689
Python
8,382
162
"""Produce reproducible legacy security wheels from authenticated upstream bytes.""" from __future__ import annotations import argparse import base64 import csv import io import json import sys import zipfile from pathlib import Path from urllib.request import urlopen from tools.security.patches import apply_patch, d...
bbff0110eb74e26db524f0a39bbd679dbbc5a44b08c46450b7a68357f04f89e3
Python
8,405
267
from __future__ import absolute_import import pytz from datetime import datetime, timedelta, tzinfo from pytz import AmbiguousTimeError from celery.utils.timeutils import ( delta_resolution, humanize_seconds, maybe_iso8601, maybe_timedelta, timedelta_seconds, timezone, rate, remaining...
672615abf25d6f56d5c07df3e3e8c779b7c01f00734e1cc720026ede48d716b8
Python
8,407
190
# -*- coding: utf-8 -*- from json import dump, load from survey.abc_search_engine import Questionnaires from survey.views import get_questionnaire_language BASE_DIRECTORY = "data" PER_PARTICIPANT_DIRECTORY = "Per_participant" PER_QUESTIONNAIRE_DIRECTORY = "Per_questionnaire" QUESTIONNAIRE_METADATA_DIRECTORY = "Questi...
d5f682d3b72eb1b6c8defbf3d3254121d40d6854ce61704a6eb64ebd842d184e
Python
8,407
227
"""Flag trial failures and prune parameter values with missing metrics.""" from typing import Any import polars as pl from typing_extensions import override from talos.experiment.reducer.pruning_strategy import ACTION_SUGGEST, PruningStrategy class SanityReducer(PruningStrategy): '''Remove parameter values wh...
7762b64ae311431db326438ab4836a34b99db0774b1fc626b26a1c5c4253980b
Python
8,411
248
import subprocess import os import os.path import schema import sargasso.separator.options as opts from sargasso.separator.commandline_parser import CommandlineParser from sargasso.separator.parameter_validator import ParameterValidator from sargasso.utils import log class FilterController(object): DOC = """Usag...
b86117931db193aaf1327c67627f78c44ec6fbc1c85755b4b9a86957db6722cc
Python
8,421
230
#!/usr/bin/env python3 """Pre-commit hook to check that classes inheriting from BaseModel (like InitSchema) do not have default values in their field definitions. This enforces the albumentations coding guideline: "We do not have ANY default values in the InitSchema class" """ from __future__ import annotations impo...
ecf91d1dac63b72f95db4cabc7e249b3fc207b53fcd40c7dd74065dad6e78682
Python
8,425
323
"""Python multiprocessing fork with improvements and bugfixes""" # # Package analogous to 'threading.py' but using processes # # multiprocessing/__init__.py # # This package is intended to duplicate the functionality (and much of # the API) of threading.py but uses processes instead of threads. A # subpackage 'multipr...
1ff36c16fd09913d1e172e397a8445038659d3826cec57b9b736fbc1d3598c33
Python
8,438
279
import os import subprocess import sys from unittest.mock import Mock sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) from boris import config as cfg from boris import observation_operations class FakeTimer: def __init__(self): self.stop_calls = 0 def stop(self): ...