sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
41e12516d660214cc259ad507cb85bf6ba5bf9765263ec5a971f913403790a84 | Python | 5,104 | 129 | from functools import partial
from django.contrib.admin.checks import InlineModelAdminChecks
from django.contrib.admin.options import InlineModelAdmin, flatten_fieldsets
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.forms import (
BaseGenericInlineFormSet, generi... |
da40e655e56a7fbc5d29d9e5f8831c099bc9aa1de4961e36405e8bec8580a9ac | Python | 5,104 | 160 | from .niftyreg_binaries import get_binary
class RegistrationParams:
"""
A class to store and access the variables required for the registration
including the paths of the different binaries and atlases.
Options are typically stored as a tuple of (option_string, option_value)
"""
def __init__(... |
1b8c13b6d6d2730b23ed6167973cb605e687b5150eb62df896564b4c1d1b6c06 | Python | 5,105 | 125 | # coding=utf-8
from django.forms import ModelForm, Form, TextInput, CharField, BooleanField, MultipleChoiceField, \
CheckboxSelectMultiple, ChoiceField, SelectMultiple, IntegerField, NumberInput, RadioSelect
from django.utils.translation import ugettext_lazy as _
from patient.models import Patient, Diagnosis
HEA... |
09c292c80346d122af79d64a20fa511a366eaf19e5561ff848cd766e363a4f0b | Python | 5,118 | 163 | """Drop-in replacement for the thread module.
Meant to be used as a brain-dead substitute so that threaded code does
not need to be rewritten for when the thread module is not present.
Suggested usage is::
try:
import _thread
except ImportError:
import _dummy_thread as _thread
"""
# Exports ... |
02d30fe463c68233cf43383393c1be7f10c55a585dedef8b591e22740ddd5e1f | Python | 5,127 | 175 | """
This module houses the ctypes initialization procedures, as well
as the notice and error handler function callbacks (get called
when an error occurs in GEOS).
This module also houses GEOS Pointer utilities, including
get_pointer_arr(), and GEOM_PTR.
"""
import logging
import os
from ctypes import CDLL, CFUNCT... |
a8833af43169b6c2d43bedb46ffebc5bbaa4737cff4416f61a8c2dd51d44904f | Python | 5,134 | 158 | #!/usr/bin/env python2
desc="""Convert sam to fastq/fastq.
NOTE: sam has to be sorted by read name if paired output requested!
"""
epilog="""Author:
l.p.pryszcz+git@gmail.com
Dublin, 28/06/2012
"""
import argparse, os, sys
from Bio import Seq
from datetime import datetime
def sam2fasta( handle,outlist,last,firs... |
b1c3dd8ce3b544654697900ff759fe0f7769917476fc0a102838491b1b9d1e67 | Python | 5,140 | 152 | #!/usr/bin/env python2
desc="""Report exact matches in fastq reads for repeats.
Repeats are given as fasta.
Use repeats2fasta.py to generate it.
"""
epilog="""Author:
l.p.pryszcz+git@gmail.com
Barcelona, 20/10/2012
"""
import argparse, gzip, os, sys
import subprocess
from datetime import datetime
from math imp... |
a91727468b3962ebe4c49f48b5228026d917264a1ac13d240abdeca39d82a4e8 | Python | 5,143 | 129 | """A budget-raise marker must state a reason to unlock a raise.
The marker exists to record *why* a calibrated budget moved. A marker that
parses with a blank reason unlocks the raise while recording nothing, which is
worse than no marker at all: the gate reports PASS and the PR looks compliant.
`check_budget_ratchet... |
85162ebe672c74346ecdacf450910537d5223d4d732676db53848fd3bb51f2be | Python | 5,144 | 157 | # This Method is reverse engineered from Pouria Sadeghi-Tehran et al 2017
# https://plantmethods.biomedcentral.com/articles/10.1186/s13007-017-0253-8
from methods import base
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sklearn.preprocessing import StandardScaler
from skimage.color impor... |
7e2c4d413c4c661e9978618dd442ebe0de823b352404aae4fe18679707542c21 | Python | 5,149 | 151 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
""" Test scripts
Run scripts and check outputs
"""
"""
from __future__ import division, print_function, absolute_import
import glob
import os
import shutil
from os.path import (dirname, join as pjoin, ab... |
56d0d49b9328195c4fd9586455b4b794a4532e5f180ebe52498c76706532afc5 | Python | 5,153 | 171 | ###############################################################################
# info.py contains set of classes and functions to manage logging
###############################################################################
# Copyright (c) 2019-2020, University of Liège
# Author: Nikita Beliy
# Owner: Liege Universit... |
1d93f5404f462bf43f6bd12a0170fe76eeb560bd8365654794fc2b35eebffca7 | Python | 5,158 | 176 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
3e77cba98067aa0ad99d6056f385fdc21cab2808c8ff76f37846e08c532ef933 | Python | 5,163 | 142 | import torch,time,os
import torch.nn as nn
import torch.nn.functional as F
import math
from shared_parameters import *
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
import numpy as np
import random
import matplotlib.pyplot as plt
def setup_seed(seed):
torch.manual_seed(seed)
torch.... |
a9b7d57b38711527a02a06af17f9e2c218de10e82d45f1c7a9af82c6a8bc2238 | Python | 5,168 | 143 | import torch,time,os
import torch.nn as nn
import torch.nn.functional as F
import math
from shared_parameters import *
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
import numpy as np
import random
import matplotlib.pyplot as plt
def setup_seed(seed):
torch.manual_seed(seed)
torch.c... |
3dff09f85b17ad05f368a9ef708a2f8202f8dfbcdeceb43c47132ca0c2311cf5 | Python | 5,171 | 155 | """
support for presenting detailed information in failing assertions.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import six
from _pytest.assertion import rewrite
from _pytest.assertion import truncate
from _pytest.assertion import util... |
3e1bb5a3458e495c49859587c1d4f8f33d4482e6471fed06bf82db50e6fa82ab | Python | 5,178 | 144 | #-----------------------------------------------------------------------
#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... |
7c6986593b2e72f46bb4862cf59252520d9cb2d3e602ca5714f2b1ed4cae3288 | Python | 5,185 | 148 | import os
import py
from .exceptions import UsageError
from _pytest.outcomes import fail
def exists(path, ignore=EnvironmentError):
try:
return path.check()
except ignore:
return False
def getcfg(args, config=None):
"""
Search the list of arguments for a valid ini-file for pytest,
... |
62edf520cd1c2aa339156b759a8b418d104062fa48b0e0eb3d10c0a7527f2182 | Python | 5,189 | 151 | # -*- coding: utf-8 -*-
"""
celery.apps.beat
~~~~~~~~~~~~~~~~
This module is the 'program-version' of :mod:`celery.beat`.
It does everything necessary to run that module
as an actual application, like installing signal handlers
and so on.
"""
from __future__ import absolute_import, unicode_li... |
e25b28de2af1a22a1d92b8fb73fbbab55f4760937302683818de15dbb0a3002b | Python | 5,189 | 144 | import torch,time,os
import torch.nn as nn
import torch.nn.functional as F
import math
from shared_parameters import *
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
import numpy as np
import random
import matplotlib.pyplot as plt
def setup_seed(seed):
torch.manual_seed(seed)
torch.... |
414655b7d6c55f4a16f2351ed4964990cafb295436a85e9f0f196339e46e749d | Python | 5,204 | 138 | import numpy as np
import pandas as pd
import os
from sklearn.metrics import mean_absolute_error, mean_squared_error, r2_score
from rdkit.Chem import AllChem as Chem
from rdkit.DataStructs import ConvertToNumpyArray
def get_morgan_fingerprints(df, mol_or_solv='molecules', nbits=None):
"""Gets Morgan fingerprints f... |
31d5cda96a33705172e50481ad74c54131eaff2e182e32bf3c5503963d6184a0 | Python | 5,208 | 160 | import numpy as np
from scipy.stats import norm
from cmfsapy.dimension.correction import compute_mFSA_correction_coef, correct_estimates, polynom_func
import time
from constants import *
from scipy.stats import normaltest, shapiro
from statsmodels.stats.multitest import multipletests
t0 = time.time()
figsave_path ... |
080e22590bcf0de17d10dd085aaf31cae041a8cbdca44135ec88bc5466e2d7d6 | Python | 5,220 | 171 | # 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 binascii
import os
import struct
import time
import... |
b083778c52cf6e00227c7d3e26ca8d4a92cf6570c26f9c95cf85fa3afcf66dba | Python | 5,221 | 126 | #!/usr/bin/env python3
"""Budget ratchet gate: budgets can only be lowered without PR-body marker."""
from __future__ import annotations
import argparse
import json
import os
import re
import subprocess
import sys
from functools import partial
from pathlib import Path
from typing import Final
from _common import REPO... |
8b52ba44146aa701f321bbaa66e4d74c01dd97283c02009dcbadb4a87d4c5985 | Python | 5,222 | 124 | import torch
import tqdm
@torch.no_grad()
def ba(func, dim=100, n=200, maxiter=2000, is_min=True, topk=100, topk_coef=10, fmin=0, fmax=1, loud_A=0.95, r0=0.85, alpha=0.999, gamma=0.1,
w_init=0.9, n_batch=1,
w_final=0.2, seed=None, progress=False, device=None, low_mem=False):
"""
Bat Algorithm, l... |
d56af95e396913c8e2a487a1ba4fe4cc76bc21413f0e8688f107b0d4c653e70c | Python | 5,225 | 179 | #
# The Python Imaging Library.
# $Id$
#
# PCX file handling
#
# This format was originally used by ZSoft's popular PaintBrush
# program for the IBM PC. It is also supported by many MS-DOS and
# Windows applications, including the Windows PaintBrush program in
# Windows 3.
#
# history:
# 1995-09-01 fl Created
# 1996... |
c3a6240526b3477da91ac524bdbbdcb9325d6ab4dd586667a2a09c6014a61d2d | Python | 5,230 | 160 | ###############################################################################
# jsonNIFTI.py provides an implementation of MRI class for Nifti file format
# with a generic json file containing metadata
###############################################################################
# Copyright (c) 2019-2020, Universit... |
d9c485afb909f9db5749834df79ec5697b9f9d586d3ffd21a0b9132e448c15c1 | Python | 5,233 | 127 | #!/usr/bin/env python2
desc="""Plot boxplot
"""
epilog="""Author:
l.p.pryszcz+git@gmail.com
Warsaw, 23/12/2015
"""
import argparse, os, sys, random
from datetime import datetime
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
def plot(handle, out, cols, names, bins, title, xlab, ylab, xlo... |
44970300e7a10c43e38b0e8455f62f65da5046b863803a66990d81a8717f9ddc | Python | 5,235 | 128 | import re
from summa import summarizer
import nltk
from gensim.summarization.summarizer import summarize
from sumy.parsers.plaintext import PlaintextParser
from sumy.nlp.tokenizers import Tokenizer
from sumy.summarizers.lex_rank import LexRankSummarizer
from sumy.summarizers.reduction import ReductionSummarize... |
3a8b49736642fec9c4c27169d8694d65f0896c604ad496fd0ef0f6b7770a8f80 | Python | 5,239 | 167 | ###############################################################################
# jsonNIFTI.py provides an implementation of PET class for Nifti file format
# with a generic json file containing metadata
###############################################################################
# Copyright (c) 2019-2020, Universit... |
bacb38db86f4efe3b91ef59a0402b8469ad87164d812d790c666e03a42b27d3d | Python | 5,241 | 123 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
test_indicator
@author: jdiedrichsen
"""
# import sys
# sys.path.append('/Users/jdiedrichsen/Python')
import unittest
import PcmPy as pcm
import numpy as np
import pickle
import os
base_dir = os.path.dirname(os.path.dirname(__file__))
data_file = os.path.join(base_d... |
3012b2cb06d2c3e7377291784518c08ece492296e9e765cd5893001bad8a51a5 | Python | 5,249 | 132 | #!/usr/bin/env python3
"""Forbid catching any HonestyViolation (or subclass) anywhere under code we own.
AST-based: catches the bare form (`except HonestyViolation`), the dotted
form (`except package.exceptions.HonestyViolation`), and the aliased form
(`from X import HonestyViolation as HV; ...; except HV`). Aliases a... |
696d22cae96bf0b1c448b77436eaba518c42503ca14698e198e1bb20efe9e0c1 | Python | 5,252 | 190 | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
"""Add things to old Pythons so I can pretend they are newer."""
# This file does tricky stuff, so disable a pylint warning.
# pylint: disable=unused-import
impor... |
369f82d3e1d8fb5dab93ff63eed28e6dcf43f05f47437e4696d973d4fd1d98a4 | Python | 5,266 | 163 | """ generic mechanism for marking and selecting python functions. """
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .legacy import matchkeyword
from .legacy import matchmark
from .structures import EMPTY_PARAMETERSET_OPTION
from .structures import get... |
9c5ce39e299ca65eb2ca81f0f6655c22cf7f85ae324b245ecac5d0860bb67c49 | Python | 5,271 | 192 | """Load historical example datasets from remote CSV and framework sources."""
def telco_churn(quantile=.5):
'''Returns dataset in format x, [y1, y2].
This dataset is useful for demonstrating multi-output model or for experimenting with reduction strategy creation.
The data is from hyperparameter optimi... |
caa9b8af38d53f25e52dbd0f273bdba04c9498377d0c1e3efe9679f1cde414b3 | Python | 5,272 | 132 | # -*- coding: utf8 -*-
"""
Functions used for generating hippocampal like spike trains (inhomogeneous Poisson process)
Setup: many repetitions on a circular track or (mapped) linear [0, 2pi] track
authors: András Ecker, Eszter Vértes, Szabolcs Káli last update: 10.2018
"""
import numpy as np
f_theta = 7.0 # theta o... |
57ad6db17863c549cbc5f355010054521bd282f74384b2f76a3212e530869722 | Python | 5,275 | 183 | """
Global Django exception and warning classes.
"""
class FieldDoesNotExist(Exception):
"""The requested model field does not exist"""
pass
class AppRegistryNotReady(Exception):
"""The django.apps registry is not populated yet"""
pass
class ObjectDoesNotExist(Exception):
"""The requested obje... |
c682212f9adbe9b2a30581abcc786e9124393cc518f7310228294f144bd7f25d | Python | 5,275 | 134 | """Implementation of the Channel Dropout transform for multi-channel images.
This module provides the ChannelDropout transform, which randomly drops (sets to a fill value)
one or more channels in multi-channel images. This augmentation can help models become more
robust to missing or corrupted channel information and ... |
3c67a4e6fe57248fb878746728068390d9e2dabb5f1d3cb322d6aae97de511c9 | Python | 5,280 | 113 | #!/usr/bin/env python2
desc="""Parse bowtie2 local bam and report split reads for partially aligned reads.
"""
epilog="""Author:
l.p.pryszcz+git@gmail.com
Barcelona, 18/1/2013
"""
import argparse, os, re, sys
from Bio import Seq
from datetime import datetime
cigarPat = re.compile('\d+\w')
patM = re.compile(r'\d... |
a7143d73d1e0ab1c4d6942d514458aee4b947db5a8317bff943b6b68d8b87235 | Python | 5,281 | 147 | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 24 21:38:40 2021
@author: Naeem
"""
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 28 17:21:24 2020
@author: Naeem
# Code modified from: Pytorch. 2021. Transfer learning for computer vision tutorial. https://pytorch.org/tutorials/beginner/transfer_learning... |
72a8d16c337a3e2655bc5dc479c102b140a74a9290ed9ab5ed88ed7e6c13a019 | Python | 5,284 | 142 | """Wraps the best available JSON implementation available in a common
interface"""
import sys
VERSION = (0, 3, 3)
__version__ = ".".join(map(str, VERSION[0:3])) + "".join(VERSION[3:])
__author__ = "Rune Halvorsen"
__contact__ = "runefh@gmail.com"
__homepage__ = "http://bitbucket.org/runeh/anyjson/"
__docformat__ = "r... |
285155e71abb93540cb47af88a674fe4095b7e13c3c6ed1a74caaa446b5540d6 | Python | 5,295 | 142 | from __future__ import division, print_function, absolute_import
import numpy as np
import numpy.testing as npt
from dipy.reconst.recspeed import (local_maxima, remove_similar_vertices,
search_descending)
from dipy.data import get_sphere, get_data
from dipy.core.sphere import unique_... |
96c3d1e31ff444c39e641c95409ad076edc6d14112eee3de6d10d6db27790902 | Python | 5,298 | 147 | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 24 21:44:59 2021
@author: Naeem
"""
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 10 11:44:57 2021
@author: Naeem
# Code modified from: Pytorch. 2021. Transfer learning for computer vision tutorial. https://pytorch.org/tutorials/beginner/transfer_learning... |
489fc18d4e77f82352db6f5602eab6f531b243fa067928d00abcd025a770f6a2 | Python | 5,311 | 214 | # -*- coding: utf-8 -*-
"""
Django settings for qdc project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.jo... |
7c91a9455f0e824883e6a65dca92230c7e5f4a135ca398053b0e5ac68e68402e | Python | 5,311 | 155 | #DEGnext
#Copyright Tulika Kakati, 2020
#Distributed under GPL v3 license
#This code may be used to import cancer RNA-seq dataset(s) into Pytorch DataLoader
from torch.utils.data import Dataset
import numpy as np
from sklearn.preprocessing import Normalizer
import torch
import os
dir_path = os.path.dirname(os.path.abs... |
2872c8f44215118a063b5498e7f4cdd8a4f65f156c67a52eb7101cad62b64968 | Python | 5,312 | 145 | #-----------------------------------------------------------------------
#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... |
c654a9e19e83d5f826281f0573223d91a60066c572bc6909bc281fa8557f15ef | Python | 5,312 | 177 | """Cache lines from Python source files.
This is intended to read lines from modules imported -- hence if a filename
is not found, it will look down the module search path for a file by
that name.
"""
import functools
import sys
import os
import tokenize
__all__ = ["getline", "clearcache", "checkcache"]
def getline... |
1342715a38d03e86d7ea990e3d733cce6f13c0ac95018a7f529e4ac87f3d5293 | Python | 5,315 | 149 | #!/usr/bin/env python
"""Contain functions useful for dealing with phylomeDB."""
import sys
import MySQLdb
from ete2 import PhylomeDB3Connector as PhylomeDBConnector
#from phylomeDB2 import PhylomeDBConnector
#from ete2 import PhylomeDB3Connector
from MyGraph import MyGraph
try:
from rooted_phylomes import... |
f919b68270b23c63d7f1c3ec2a97923827d3e0c503b861c9a7835a70335c6539 | Python | 5,318 | 154 | #!/usr/bin/env python2
desc="""Combine values for transcripts and report summed values for genes.
CHANGELOG:
- v1.2
-- report also gene_name beside geneid
-- added hyperlinks
- v1.1
-- .tsv annotation support
"""
epilog="""Author: l.p.pryszcz+git@gmail.com
Warsaw, 30/09/2015
"""
import os, sys
import numpy as np
from... |
4c157cb338346c20d261f62ea57ff0c0f7f9e69068fbc93f29fb8ce45515f2f5 | Python | 5,330 | 133 | from django.contrib.admin import ModelAdmin
from django.contrib.gis.admin.widgets import OpenLayersWidget
from django.contrib.gis.db import models
from django.contrib.gis.gdal import OGRGeomType
from django.forms import Media
spherical_mercator_srid = 3857
class GeoModelAdmin(ModelAdmin):
"""
The administrat... |
5e359d86515fa321460b2fcb7b96d127a0cc3bb2b4efd23b01c883a33b44d8b7 | Python | 5,333 | 144 | """
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... |
a847af1248ddd62ded492a9e06f84260e9cf51c12f78241203542d11abb0484d | Python | 5,336 | 164 | """Redo the builtin repr() (representation) but with limits on most sizes."""
__all__ = ["Repr", "repr", "recursive_repr"]
import builtins
from itertools import islice
try:
from _thread import get_ident
except ImportError:
from _dummy_thread import get_ident
def recursive_repr(fillvalue='...'):
'Decorato... |
d3eb01529eeacec5b3f43259781705a750bc47bf92636ee11056b97f076059b8 | Python | 5,337 | 133 | """Construct task-aware Keras models for automatic parameter scans."""
class AutoModel:
def __init__(self, task, experiment_name, metric=None, backend='tensorflow'):
'''Creates an input model for Scan().
Optimized for being used together with Params(). For example:
p = talos.AutoParams... |
959f85334c431e3f4622a88487ff1f9dee56a8f31875d4082d07293a72180bf6 | Python | 5,343 | 123 | from brainglobe_utils.general.numerical import (
check_positive_float,
check_positive_int,
)
def niftyreg_parse(parser):
niftyreg_opt_parser = parser.add_argument_group(
"NiftyReg registration backend options"
)
niftyreg_opt_parser.add_argument(
"--affine-n-steps",
dest="af... |
66ea166abce5b73cd1c79f1c07c75a9bc8b5aa464a7f4d00d88a640717c25a44 | Python | 5,354 | 158 | from __future__ import absolute_import
from kombu import Exchange
from kombu.utils.functional import maybe_evaluate
from celery.app import routes
from celery.exceptions import QueueNotFound
from celery.utils.functional import LRUCache
from celery.tests.case import AppCase
def Router(app, *args, **kwargs):
retu... |
e44d63533c335ecbd5d0127cbdbb9a8072b2b33002114b32da1326563260fbf1 | Python | 5,355 | 155 | from tkinter import ALL, Canvas, Scrollbar
from tkinter.ttk import Frame
from platform import system as os_name
from Biscuit.utils.constants import OSCONST
class ScrollableFrame(Frame):
"""
A wrapper for the Frame class to make it scrollable.
To make use of this fuctionality, pack anything into the .fra... |
a7ef6b8811d8c4b140d9952fde3d1bdab1259947aa25218237032021b8c8574d | Python | 5,365 | 163 | import random
from typing import Any
import numpy as np
import pytest
from deepdiff import DeepDiff
import albumentations as A
from tests.conftest import UINT8_IMAGES, FLOAT32_IMAGES, MULTI_IMAGES
def image_generator():
yield {"image": np.random.randint(0, 256, [100, 100, 3], dtype=np.uint8)}
def complex_imag... |
a5f843c4504a84b9f28b757485cb56aeca9fecf2c903cc6651911b19a2d7ee08 | Python | 5,367 | 106 | """Retain upstream findings and fail on any unproved legacy dependency disposition."""
from __future__ import annotations
import argparse
import json
import subprocess
import sys
from importlib import metadata
from pathlib import Path
from packaging.requirements import Requirement
from packaging.utils import canonica... |
d9356c0a12c73f98743f0ab104f3b0615c37a29dafd2b2aa662024a03b508926 | Python | 5,368 | 146 | import tempfile
import os.path as op
import sys
import os
import numpy.testing as npt
from nibabel.tmpdirs import TemporaryDirectory
import dipy.data.fetcher as fetcher
from dipy.data import SPHERE_FILES
from threading import Thread
if sys.version_info[0] < 3:
from SimpleHTTPServer import SimpleHTTPRequestHandler ... |
635eab82ecaf9bac058281fc961ba3ce0961dae39668071fddb3d81aceb142e0 | Python | 5,371 | 129 | #! /usr/bin/python3.6
# -- coding: utf-8 -- **
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QSizePolicy, QMessageBox, QWidget, \
QPushButton, QLineEdit, QDesktopWidget, QGridLayout, QFileDialog, QListWidget, QLabel,QFrame,QGroupBox
from PyQt5.QtCore import Qt, QThread
from PyQt5.QtGui impor... |
3c27e2a9af8af89beee4d09c029d2bf8d9c33e7a019896d435e028c450013df9 | Python | 5,383 | 129 | """Module containing validation mechanisms for transform parameters.
This module provides a metaclass that enables parameter validation for transforms using
Pydantic models. It intercepts the initialization of transform classes to validate their
parameters against schema definitions, raising appropriate errors for inv... |
002780ef119b6b1976d840b86d8338c5864ca62a4efe504427b3181034743b6f | Python | 5,387 | 141 | from __future__ import annotations
import contextlib
import importlib
import io
import json
import types
from pathlib import Path
import pytest
REPO_ROOT = Path(__file__).resolve().parents[2]
RULESET_WORKFLOW = REPO_ROOT / '.github/workflows/pr_checks_ruleset.yml'
AUDIT_WORKFLOW = REPO_ROOT / '.github/workflows/audi... |
0e21cdd29fe67398c07bab02644e2c5f13fee421d0ebed879535a6057f29230d | Python | 5,389 | 162 | ###############################################################################
# DICOM.py provides an implementation of MRI class for DICOM file format
###############################################################################
# Copyright (c) 2019-2020, University of Liège
# Author: Nikita Beliy
# Owner: Liege Un... |
6316d64a4a89a937a13f82627b1594d2c51757ce6769417953155dca9c7a6b35 | Python | 5,395 | 149 | # ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the DataLad package for the
# copyright and license terms.
#
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
import os
from os.path import dirname, join as op... |
02f2c2c62514ebaa973bbdfe3d8825cb9e52a19a427957ed49e855f82fe5a99b | Python | 5,396 | 170 | import cv2
import numpy as np
from scipy.spatial import distance
from shapely import geometry
from pytraction.net import segment as pynet
from pytraction.utils import align_slice, bead_density, normalize
# get the images of interest
def _get_reference_frame(ref_stack, _, bead_channel):
return normaliz... |
b9be264e1741890d0ebc1a7d78a821cb7177cfbbe21e318ab639c5747073f94d | Python | 5,396 | 162 | #!/usr/bin/env python2
"""
Identify SNP sites in mpileup out from BAM alignments.
In addition calculates overall and each contig coverage.
At first run: /users/tg/lpryszcz/cluster/assembly/mpileup.sh (s=MCO456; samtools mpileup -f gem/$s.fa gem/${s}.bam > gem/${s}.mpileup)
Execute:
python ~/workspace/assembly/src... |
4ac551abf586ffab824743e9cbf72c1ecf6c8d3e95b0748bf51aacd3a1478508 | Python | 5,397 | 168 | """
Some codes from https://github.com/Newmu/dcgan_code
"""
from __future__ import division
import math
import pprint
import scipy.misc
import numpy as np
import copy
import openslide
import cv2
from PIL import ImageFilter, Image
try:
_imread = scipy.misc.imread
except AttributeError:
from imageio import imread... |
c81d547a174b90f96c6edbad822026eeafef87c072d4126d244055284d2e2ae1 | Python | 5,397 | 171 | import os
import sys
import platform
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import login_required, permission_required
from django.urls import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.utils.tra... |
8a1b64c1dab220d6830e2c75c3758a13d19ac9a180058f3c8fa76b574987183b | Python | 5,399 | 123 | from django.conf import settings
from django.contrib import auth
from django.contrib.auth import load_backend
from django.contrib.auth.backends import RemoteUserBackend
from django.core.exceptions import ImproperlyConfigured
from django.utils.deprecation import MiddlewareMixin
from django.utils.functional import Simple... |
c6f8e64b0edc327e8624559465a8fe8936e0dbc5afcebef40189b4a8b5e63534 | Python | 5,400 | 142 | import warnings
import cv2
import numpy as np
from sklearn.cluster import AgglomerativeClustering
from sklearn.metrics import silhouette_score
def get_spot_coordinates(
spot_mask: np.ndarray,
) -> dict[str, tuple[int, int, int, int]]:
"""Dearray tissue microarray spots based on a spot mask.
Numbers each... |
21aba400930526befe1310e20b44c6b2e90bb3824690b7eb579606f64a2a8f80 | Python | 5,410 | 164 | ###############################################################################
# jsonNIFTI.py provides an implementation of PET class for Nifti file format
# with a generic json file containing metadata
###############################################################################
# Copyright (c) 2019-2020, Universit... |
75064edd8b774b74c7d475b991b41776bef55809f9ddc5b3fb56e01b11b9b333 | Python | 5,417 | 173 | ###############################################################################
# parcing.py contains functions to parceand test selectors from BIDSschema
###############################################################################
# Copyright (c) 2019-2020, University of Liège
# Author: Nikita Beliy
# Owner: Liege ... |
25b80e4afc680991bdd3b482ed0390c22c4cab56fb066d7ab79bd02b6d2622bb | Python | 5,426 | 165 | ###############################################################################
# jsonNIFTI.py provides an implementation of MRI class for Nifti file format
# with a generic json file containing metadata
###############################################################################
# Copyright (c) 2019-2020, Universit... |
7cefa6e4324f32748de0db7b649ea3649557d2b4bf312ef8512980f71d2d73e9 | Python | 5,427 | 150 | import SimpleITK as sitk
import numpy as np
import torch
import cv2
import tkinter as tk
from tkinter import messagebox
from PIL import Image, ImageTk
from torchvision.utils import make_grid
import torchvision
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import ImageGrid
from display_gui import load_... |
4c0e76754be8b362eeefb2fbcbc24fe497e4d7364e24627454534860deba34f0 | Python | 5,428 | 127 |
import logging
import numpy as np
from os.path import join as pjoin
import numpy.testing as npt
import nibabel as nib
from dipy.io.peaks import load_peaks
from dipy.io.gradients import read_bvals_bvecs
from dipy.core.gradients import generate_bvecs
from nibabel.tmpdirs import TemporaryDirectory
from dipy.data import... |
660f2b76b31a021a89f24cb2cd1d7e8e93c87f6def343e553e402a8e4bdbec48 | Python | 5,428 | 144 | """
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... |
15a382641713b6b41c9628c64b314f0336cb98b2c77a01ec73f186f78205f18a | Python | 5,435 | 114 | """Audit of the seed records, added in v0.1.1 after an external review. The frozen analysis (code/analyze.py) is
unchanged; this script adds the two checks the review found missing from it.
1. Every number anywhere in every seed record, nested fields included, is finite.
2. Every label stored together with its persist... |
8966cbe8b61a7e35c5e798162b7da1f025672164b3a41ce866d6aed67e95af69 | Python | 5,436 | 153 | """Datasets for pytorch."""
__all__ = ["SlideReaderDataset", "TileImageDataset"]
import ctypes
import math
import multiprocessing
from collections.abc import Callable, Iterator
from pathlib import Path
from typing import Any, Optional, Union
import numpy as np
from PIL import Image
from histoprep._backend import Cz... |
8eac78a82ed40a2daac8749592b6f5c87190c2efc51b670aa0b9957475daca61 | Python | 5,439 | 143 | """Generate publication-quality data acquisition methods section from BIDS
dataset.
"""
from __future__ import print_function
import json
from os.path import dirname
from os.path import abspath
from os.path import join as pathjoin
from collections import Counter
from bids.reports import utils
from bids.reports import ... |
97f00b49c24ceb312da1079fa0410bf934930c956108ef82cc9bd1deb2e5929a | Python | 5,445 | 136 | import numpy as np
import torch
from torch.autograd import Variable
from torch.nn.parameter import Parameter
from torch.nn import Module
from torch.nn.init import normal
class KAF(Module):
"""Basic KAF module. Each activation function is a kernel expansion over a fixed dictionary
of D elements, and the combin... |
0bdd7e34ff4e1396f7f8fe9c4dd42926a2d2b48169a0074c19d765139fe14c58 | Python | 5,450 | 171 | from layers import *
from metrics import *
from utils import *
flags = tf.app.flags
FLAGS = flags.FLAGS
def masked_cross_entropy(preds, labels, label_mask, test_mask):
"""Accuracy with masking."""
preds = tf.cast(preds, tf.float32)
labels = tf.cast(labels, tf.float32)
# error = tf.nn.si... |
e97974d5b8d354714271d26bdcf876710ee1c6461879daa6f927a4669c679ed6 | Python | 5,454 | 212 | # 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 abc
import six
from cryptography import utils
def generate_par... |
f8a137deab3607a7fd3783c06f2fb36fa56a42ed1410f80a10b8d997ef2cc7a1 | Python | 5,457 | 191 | # -*- coding: utf-8 -*-
"""
celery.five
~~~~~~~~~~~
Compatibility implementations of features
only available in newer Python versions.
"""
from __future__ import absolute_import
# ############# py3k #########################################################
import sys
PY3 = sys.version_info[0] == 3
... |
3ac9aa6369e0df5ae6bfb6854e551982708045edfb5f457e3b1e367704c125ac | Python | 5,460 | 144 | #!/usr/bin/env python3
"""Module-level docstring gate: one line, required on every non-empty module.
Exemptions exist because a docstring can only restate what the reader
already has. In a package built on one public symbol per file with the
filename matching that symbol, the module docstring says what the filename
sa... |
2ea8e4548b3bb9be48e60c266126fd21ad1575732a5961e69ca49d43b1ce1840 | Python | 5,462 | 154 | # 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 struct
from cryptography.hazmat.primitives.ciphers import Cipher
... |
42f4de731db2a9cf9ed0aad08ea01707768849cf7df481dcfff235d2ceb23897 | Python | 5,464 | 196 | from __future__ import absolute_import
import logging
import sys
from collections import defaultdict
from celery import beat
from celery import platforms
from celery.bin import beat as beat_bin
from celery.apps import beat as beatapp
from celery.tests.case import AppCase, Mock, patch, restore_logging
from kombu.tes... |
90c6fba886b971b501255c99840b731293b0e389e941c4b540e0526b786b7761 | Python | 5,469 | 133 | #!/usr/bin/env python3
"""Coverage ratchet gate: the coverage floor can only be lowered with a marker.
The mechanical twin of `check_budget_ratchet.py`, inverted. A module
budget is a ceiling, so *raising* it is the loosening that needs a marker;
the coverage floor in `.github/budgets.json` is a floor, so
*lowering* i... |
24145f1b32926620421aa179783358e014ac5f6aaa4fad447fa2ec8c5c2abdd9 | Python | 5,474 | 160 | import numpy as np
from sklearn import preprocessing
from sklearn.preprocessing import OneHotEncoder
def print_for_tikz(x_list):
x_list = x_list.reshape(-1)
l = len(x_list)
s = ''
for i in range(l):
s = s + str((i+1, x_list[i]))
return s
def save_table_for_tikz(mean_list, std_list, fname):... |
afcacc3829300b0273bdb78ed714efbc1b1c6f7f4b289946a9311c5d8909f8f1 | Python | 5,475 | 148 | # This script mainly builds a class to train the deep neuron network and obtain the optimized solution based on the DNN.
import time
import numpy as np
import scipy.io as scio
import torch
import torch.nn as nn
from scipy.optimize import dual_annealing
from torch.utils.data import DataLoader
class mlopt():
def ... |
b2fb2b61dfaada77c7102de04c7869dede7cd7f59626c2ad6ef5a47d3580e5c0 | Python | 5,475 | 148 | # This script mainly builds a class to train the deep neuron network and obtain the optimized solution based on the DNN.
import time
import numpy as np
import scipy.io as scio
import torch
import torch.nn as nn
from scipy.optimize import dual_annealing
from torch.utils.data import DataLoader
class mlopt():
def ... |
839ce309e3ed0e73f2ec432c1b02c2108d05e97028953965b3c57a6b63ba61c0 | Python | 5,476 | 146 | from typing import Optional
import numpy as np
from sklearn.decomposition import DictionaryLearning
from ._check import check_image
ERROR_GRAYSCALE = "Stain matrix is not defined for grayscale images."
# These are from: https://github.com/mitkovetta/staining-normalization
REFERENCE_STAIN_MATRIX = np.array([[0.5626, ... |
02d0bd0d6076f5a52bd5e0437b320aefcc34ce1357aa5224550e731194ff44d3 | Python | 5,484 | 169 | import tensorflow as tf
from tensorflow.keras.models import Model
import cv2
from DTS_Models import DTS_Net, DTS_Net_Lite, Joint_DTS_Net
import numpy as np
import sys
from Filteration import NLF
from depth_metrics import compute_errors
import time
import matplotlib.pyplot as plt
#choose dataset to load the... |
16c18c9fa2756657f26ac4f8056514776dba7acd9adf1c7fbeda72d02e8cada7 | Python | 5,490 | 192 | # -*- coding: utf-8 -*-
"""
celery.five
~~~~~~~~~~~
Compatibility implementations of features
only available in newer Python versions.
"""
from __future__ import absolute_import
# ############# py3k #########################################################
import sys
PY3 = sys.version_info[0] == 3
... |
25b1d11c20122c16a1423ec3182db1d8fe3e63c793d7f260c684e80df98ebadd | Python | 5,490 | 157 | from typing import Union
import cv2
import numpy as np
from PIL import Image
from ._check import check_image
ERROR_QUANTILES = "Quantiles should be between (0, 1)."
DEFAULT_QUANTILES = (0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)
DEFAULT_SHAPE = (64, 64)
GRAYSCALE_NDIM = 2
MIN_TISSUE_PIXELS = 10
MIN_QUANTILE = 0.0
MAX_Q... |
b080246fd54b21b9f87c7abff313bbf67750d5b6793bcac33bc3921dae7e458b | Python | 5,497 | 151 | # Author:: Donald Stufft (<donald@stufft.io>)
# Copyright:: Copyright (c) 2013 Donald Stufft
# License:: Apache License, Version 2.0
#
# 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:/... |
d0bad6bc09abfc078a4064cdc20d344c9ab511c0b394de267ba119fe6d7ca661 | Python | 5,509 | 121 | """Exercise release/configuration refusal paths and distribution content contracts."""
from __future__ import annotations
import importlib.util
import json
import sys
import tarfile
import tempfile
import unittest
import zipfile
from contextlib import redirect_stdout
from io import StringIO
from pathlib import Path
fr... |
b439d6c98fab5391c28eb5d2ab39d35391b9310310a0ff4731ff83ce8651a2d4 | Python | 5,512 | 139 | """CodeQL fallback: bootstrap can mechanically remove CodeQL and keep the bijection."""
from __future__ import annotations
import importlib
import json
import re
import shutil
import types
from pathlib import Path
import pytest
REPO_ROOT = Path(__file__).resolve().parents[2]
BOOTSTRAP_WORKFLOW = REPO_ROOT / '.github... |
30e1ffcfc92b285132bb8f778adec9557d357e52ce4553719a2393c566114a11 | Python | 5,513 | 146 | import numpy as np
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, Activation, Flatten
from tensorflow.keras.layers import Conv1D, MaxPooling1D, BatchNormalization
import os
import random
import time
from sklearn.metrics import classific... |
f4b943be5bf92fad3e5fd5a40760e31ab4107815265cd9d8fbfe95f8cb937033 | Python | 5,518 | 170 | ###############################################################################
# common.py provides various common functions to use by Module subclasses
###############################################################################
# Copyright (c) 2019-2020, University of Liège
# Author: Nikita Beliy
# Owner: Liege U... |
4357e3c329fb57a0528c040ae9b7b6b6aa041c262eeb9d4da32780cee4bed361 | Python | 5,520 | 166 | ###############################################################################
# jsonNIFTI.py provides an implementation of MRS class for Nifti file format
# with a generic json file containing metadata
###############################################################################
# Copyright (c) 2019-2020, Universit... |
2f4391fe94c84bce3b69a878f9a5a30cebc70d8bddd74050e59b59623dd92b30 | Python | 5,523 | 127 | """The scheduled sweep must reach the same verdict as the gate it re-runs.
The sweep exists because `pr_checks_slice` computes its verdict from the
judged PR's own merge ref; re-running the gate from `main` is what closes that
self-attestation channel. Publishing a *different* answer than the gate is
therefore not a s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.