repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
roman_imsim-1.0 | roman_imsim-1.0/roman_imsim/sim.py | # from __future__ import division
# from __future__ import print_function
# from future import standard_library
# standard_library.install_aliases()
# from builtins import str
# from builtins import range
# from past.builtins import basestring
# from builtins import object
# from past.utils import old_div
import nump... | 36,112 | 48.133333 | 325 | py |
roman_imsim-1.0 | roman_imsim-1.0/roman_imsim/image.py | # from __future__ import division
# from __future__ import print_function
# from future import standard_library
# standard_library.install_aliases()
# from builtins import str
# from builtins import range
# from past.builtins import basestring
# from builtins import object
# from past.utils import old_div
import nump... | 51,355 | 45.986276 | 445 | py |
roman_imsim-1.0 | roman_imsim-1.0/roman_imsim/mpi_pool.py | class _close_pool_message(object):
def __repr__(self):
return "<Close pool message>"
class _function_wrapper(object):
def __init__(self, function, callback=None):
self.function = function
self.callback = callback
def _error_function(task):
raise RuntimeError("Pool was sent tasks ... | 3,912 | 29.811024 | 74 | py |
roman_imsim-1.0 | roman_imsim-1.0/roman_imsim/test_meas.py | import numpy as np
import healpy as hp
import sys, os
import math
import logging
import time
import yaml
import galsim as galsim
import galsim.wfirst as wfirst
import galsim.config.process as process
import galsim.des as des
import ngmix
import fitsio as fio
import cPickle as pickle
from astropy.time import Time
from m... | 30,374 | 36.874065 | 160 | py |
roman_imsim-1.0 | roman_imsim-1.0/roman_imsim/post.py |
import numpy as np
import healpy as hp
import sys, os, io
import math
import copy
import logging
import time
import yaml
import copy
import galsim as galsim
import galsim.roman as roman
import galsim.config.process as process
import galsim.des as des
# import ngmix
import fitsio as fio
import pickle as pickle
import p... | 61,550 | 45.735763 | 665 | py |
roman_imsim-1.0 | roman_imsim-1.0/roman_imsim/simulate.py | """
An implementation of galaxy and star image simulations for WFIRST.
Built from the WFIRST GalSim module.
Built with elements from galsim demo13...
# Copyright (c) 2012-2017 by the GalSim developers team on GitHub
# https://github.com/GalSim-developers
#
# This file is part of GalSim: The modular galaxy image simul... | 146,352 | 42.146521 | 858 | py |
roman_imsim-1.0 | roman_imsim-1.0/roman_imsim/misc.py | # from __future__ import division
# from __future__ import print_function
# from future import standard_library
# standard_library.install_aliases()
# from builtins import str
# from builtins import range
# from past.builtins import basestring
# from builtins import object
# from past.utils import old_div
import nump... | 11,490 | 33.404192 | 296 | py |
roman_imsim-1.0 | roman_imsim-1.0/roman_imsim/telescope.py | # from __future__ import division
# from __future__ import print_function
# from future import standard_library
# standard_library.install_aliases()
# from builtins import str
# from builtins import range
# from past.builtins import basestring
# from builtins import object
# from past.utils import old_div
import nump... | 22,038 | 44.914583 | 260 | py |
roman_imsim-1.0 | roman_imsim-1.0/roman_imsim/detector_modified.py | # from __future__ import division
# from __future__ import print_function
# from future import standard_library
# standard_library.install_aliases()
# from builtins import str
# from builtins import range
# from past.builtins import basestring
# from builtins import object
# from past.utils import old_div
import nump... | 21,535 | 35.876712 | 128 | py |
roman_imsim-1.0 | roman_imsim-1.0/roman_imsim/detector.py | # from __future__ import division
# from __future__ import print_function
# from future import standard_library
# standard_library.install_aliases()
# from builtins import str
# from builtins import range
# from past.builtins import basestring
# from builtins import object
# from past.utils import old_div
import nump... | 44,706 | 38.045415 | 222 | py |
roman_imsim-1.0 | roman_imsim-1.0/roman_imsim/dc2_translate.py | import numpy as np
import galsim
import galsim.wfirst as wfirst
import os
import fitsio as fio
# These are raw fits forms fo the relevant instance cats that I (slowly) translated from txt form
d = fio.FITS('disk_gal_cat_1616897.fits')[-1].read()
b = fio.FITS('bulge_gal_cat_1616897.fits')[-1].read()
n = fio.FITS('knot... | 6,786 | 40.895062 | 145 | py |
roman_imsim-1.0 | roman_imsim-1.0/roman_imsim/__init__.py | """
An image simulation suite for geneerating synthetic data
for the Roman Space Telescope.
Built using GalSim functionality, which is
Copyright (c) 2012-2017 by the GalSim developers team on GitHub
https://github.com/GalSim-developers
"""
# from __future__ import division
# from __future__ import print_function
# ... | 5,286 | 33.109677 | 312 | py |
roman_imsim-1.0 | roman_imsim-1.0/roman_imsim/universe.py | # from __future__ import division
# from __future__ import print_function
# from future import standard_library
# standard_library.install_aliases()
# from builtins import str
# from builtins import range
# from past.builtins import basestring
# from builtins import object
# from past.utils import old_div
import nump... | 36,467 | 43.419001 | 234 | py |
roman_imsim-1.0 | roman_imsim-1.0/roman_imsim/stamp_plot.py | import astropy
import pickle
import io
from matplotlib import pyplot as plt
import fitsio
filename='../debug/fiducial_H158_22531_1_3.cPickle'
#filename1='../debug/fiducial_H158_22531_1_1.cPickle'
with io.open(filename, 'rb') as p :
unpickler = pickle.Unpickler(p)
while p.peek(1) :
gal1 = unpickler.... | 677 | 23.214286 | 53 | py |
roman_imsim-1.0 | roman_imsim-1.0/roman_imsim/output.py | # from __future__ import division
# from __future__ import print_function
# from future import standard_library
# standard_library.install_aliases()
# from builtins import str
# from builtins import range
# from past.builtins import basestring
# from builtins import object
from past.utils import old_div
import numpy ... | 139,141 | 51.210882 | 863 | py |
cub | cub-master/benchmarks/scripts/verify.py | #!/usr/bin/env python3
import sys
import argparse
import cub.bench
def parse_arguments():
parser = argparse.ArgumentParser(description='Verify tuning variant')
parser.add_argument('--variant', type=str, help='Variant to verify', default=None, required=True)
variant = parser.parse_known_args()[0].varian... | 2,266 | 36.783333 | 103 | py |
cub | cub-master/benchmarks/scripts/analyze.py | #!/usr/bin/env python3
import os
import re
import cub
import math
import argparse
import itertools
import functools
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from scipy.stats import mannwhitneyu
from scipy.stats.mstats import hdquantiles
pd.options.display.max_colwid... | 18,558 | 30.833619 | 114 | py |
cub | cub-master/benchmarks/scripts/search.py | #!/usr/bin/env python3
import cub.bench as bench
# TODO:
# - driver version
# - host compiler + version
# - gpu clocks / pm
# - ecc
def main():
center_estimator = bench.MedianCenterEstimator()
bench.search(bench.BruteForceSeeker(center_estimator, center_estimator))
if __name__ == "__main__":
main()
| 319 | 15 | 76 | py |
cub | cub-master/benchmarks/scripts/cub/__init__.py | from . import bench
| 20 | 9.5 | 19 | py |
cub | cub-master/benchmarks/scripts/cub/bench/score.py | import math
import numpy as np
def importance_function(x):
return 1 - math.exp(-x)
def x_by_importance(y):
return -math.log(1 - y)
def compute_weights(num_values):
least_importance = 0.6
most_importance = 0.999
assert(least_importance < most_importance)
assert(least_importance >= 0 and le... | 2,537 | 26 | 84 | py |
cub | cub-master/benchmarks/scripts/cub/bench/storage.py | import os
import fpzip
import sqlite3
import numpy as np
import pandas as pd
db_name = "cub_bench_meta.db"
def blob_to_samples(blob):
return np.squeeze(fpzip.decompress(blob))
class StorageBase:
def __init__(self, db_path):
self.conn = sqlite3.connect(db_path)
def connection(self):
re... | 1,613 | 23.454545 | 90 | py |
cub | cub-master/benchmarks/scripts/cub/bench/logger.py | import logging
class Logger:
_instance = None
def __new__(cls, *args, **kwargs):
if cls._instance is None:
cls._instance = super().__new__(cls, *args, **kwargs)
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
file_handler = logging.FileHandle... | 609 | 29.5 | 84 | py |
cub | cub-master/benchmarks/scripts/cub/bench/config.py | import os
import sys
import itertools
class Range:
def __init__(self, definition, label, low, high, step):
self.definition = definition
self.label = label
self.low = low
self.high = high
self.step = step
class RangePoint:
def __init__(self, definition, label, value):
... | 3,724 | 29.284553 | 105 | py |
cub | cub-master/benchmarks/scripts/cub/bench/bench.py | import os
import json
import time
import fpzip
import signal
import itertools
import subprocess
import numpy as np
from .cmake import CMake
from .config import *
from .storage import Storage
from .score import *
from .logger import *
class JsonCache:
_instance = None
def __new__(cls):
if cls._instan... | 16,346 | 30.256214 | 119 | py |
cub | cub-master/benchmarks/scripts/cub/bench/cmake.py | import os
import time
import signal
import subprocess
from .build import Build
from .config import Config
from .storage import Storage
from .logger import *
def create_builds_table(conn):
with conn:
conn.execute("""
CREATE TABLE IF NOT EXISTS builds (
ctk TEXT NOT NULL,
cu... | 3,735 | 27.96124 | 103 | py |
cub | cub-master/benchmarks/scripts/cub/bench/__init__.py | from .config import *
from .storage import *
from .bench import Bench
from .cmake import CMake
from .score import *
from .search import *
| 138 | 18.857143 | 24 | py |
cub | cub-master/benchmarks/scripts/cub/bench/search.py | import re
import argparse
import numpy as np
from .bench import Bench, BaseBench
from .config import Config
from .storage import Storage
from .cmake import CMake
def list_axes(benchmarks, sub_space):
print("### Axes")
axes = {}
for algname in benchmarks:
bench = BaseBench(algname)
for a... | 4,230 | 28.587413 | 99 | py |
cub | cub-master/benchmarks/scripts/cub/bench/build.py |
class Build:
def __init__(self, code, elapsed):
self.code = code
self.elapsed = elapsed
def __repr__(self):
return "Build(code = {}, elapsed = {:.4f}s)".format(self.code, self.elapsed)
| 209 | 22.333333 | 82 | py |
cub | cub-master/benchmarks/docker/recipe.py | #!/usr/bin/env python
import hpccm
hpccm.config.set_container_format('docker')
Stage0 += hpccm.primitives.baseimage(image='nvidia/cuda:12.1.0-devel-ubuntu22.04')
Stage0 += hpccm.building_blocks.apt_get(ospackages=['git', 'tmux', 'gcc', 'g++', 'vim', 'python3', 'python-is-python3', 'ninja-build'])
Stage0 += hpccm.bui... | 617 | 43.142857 | 135 | py |
cub | cub-master/docs/tools/repoman/repoman.py | import os
import sys
import io
import contextlib
import packmanapi
REPO_ROOT = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../..")
REPO_DEPS_FILE = os.path.join(REPO_ROOT, "deps/repo-deps.packman.xml")
def bootstrap():
"""
Bootstrap all omni.repo modules.
Pull with packman from repo.packm... | 703 | 23.275862 | 100 | py |
cub | cub-master/docs/tools/packman/packmanconf.py | # Use this file to bootstrap packman into your Python environment (3.7.x). Simply
# add the path by doing sys.insert to where packmanconf.py is located and then execute:
#
# >>> import packmanconf
# >>> packmanconf.init()
#
# It will use the configured remote(s) and the version of packman in the same folder,
# giving y... | 3,644 | 34.735294 | 94 | py |
cub | cub-master/docs/tools/packman/bootstrap/install_package.py | # Copyright 2019 NVIDIA CORPORATION
# 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 agreed to in writi... | 5,334 | 35.047297 | 145 | py |
causalgraphicalmodels | causalgraphicalmodels-master/setup.py | """Setup.py for CausalGraphicalModels"""
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, "README.md"), encoding="utf-8") as f:
long_description = f.read()
with open(path.join(here, 'VERSION')) as versio... | 1,182 | 31.861111 | 66 | py |
causalgraphicalmodels | causalgraphicalmodels-master/causalgraphicalmodels/examples.py | """
A set of example causal systems
"""
import numpy as np
from causalgraphicalmodels.cgm import CausalGraphicalModel
from causalgraphicalmodels.csm import StructuralCausalModel, \
linear_model, logistic_model
chain = CausalGraphicalModel(
nodes=["x1", "x2", "x3"],
edges=[("x1", "x2"), ("x2", "x3")]
)
... | 2,098 | 24.597561 | 72 | py |
causalgraphicalmodels | causalgraphicalmodels-master/causalgraphicalmodels/__init__.py | from causalgraphicalmodels.cgm import CausalGraphicalModel
from causalgraphicalmodels.csm import StructuralCausalModel
import causalgraphicalmodels.examples as examples
import causalgraphicalmodels.csm as csm
| 209 | 41 | 59 | py |
causalgraphicalmodels | causalgraphicalmodels-master/causalgraphicalmodels/csm.py | import inspect
import numpy as np
import pandas as pd
import networkx as nx
from causalgraphicalmodels.cgm import CausalGraphicalModel
class StructuralCausalModel:
def __init__(self, assignment):
"""
Creates StructuralCausalModel from assignment of the form
{ variable: Function(parents) }... | 6,617 | 26.122951 | 96 | py |
causalgraphicalmodels | causalgraphicalmodels-master/causalgraphicalmodels/cgm.py | import networkx as nx
import graphviz
from itertools import combinations, chain
from collections import Iterable
class CausalGraphicalModel:
"""
Causal Graphical Models
"""
def __init__(self, nodes, edges, latent_edges=None, set_nodes=None):
"""
Create CausalGraphicalModel
Ar... | 12,903 | 28.939675 | 80 | py |
causalgraphicalmodels | causalgraphicalmodels-master/tests/test_sgm.py | import unittest
import numpy as np
from causalgraphicalmodels.examples import chain_csm
class TestSGM(unittest.TestCase):
def test_cgm(self):
chain_cgm = chain_csm.cgm
self.assertTrue(chain_cgm.is_d_separated("a", "c", {"b"}))
self.assertFalse(chain_cgm.is_d_separated("a", "c", set()))
... | 653 | 25.16 | 67 | py |
causalgraphicalmodels | causalgraphicalmodels-master/tests/test_cgm.py | import unittest
from causalgraphicalmodels.examples import sprinkler, simple_confounded, \
simple_confounded_hidden_confounder, front_door_example
class TestCGM(unittest.TestCase):
def test_is_d_separated(self):
s = sprinkler
self.assertTrue(s.is_d_separated("season", "slippery", {"wet"}))
... | 2,071 | 39.627451 | 80 | py |
causalgraphicalmodels | causalgraphicalmodels-master/tests/__init__.py | 0 | 0 | 0 | py | |
CTDE.jl | CTDE.jl-master/example/sir/Ball_Nasell.py | #/opt/local/bin/python3.3
#
# Formulae taken from Ball, F. and Nasell, I. 'The shape of the size
# distribution of an epidemic in a finite population.'
# Math. Biosc. 123:167-181 (1994).
#
import sys, argparse
import numpy as np
import scipy.sparse as sparse
import scipy.sparse.linalg as linalg
import matplotlib.py... | 4,099 | 29.827068 | 205 | py |
CTDE.jl | CTDE.jl-master/doc/source/conf.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# CTDE documentation build configuration file, created by
# sphinx-quickstart on Thu Mar 31 20:57:08 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autog... | 9,417 | 31.253425 | 80 | py |
imbalanceCXR | imbalanceCXR-master/plot_results.py | import pickle
import os,sys
sys.path.insert(0,".")
import numpy as np
from sklearn.metrics import auc,brier_score_loss, roc_curve, roc_auc_score, confusion_matrix,precision_recall_curve
from sklearn.metrics import auc as sklearnAUC
from imbalanceCXR.utils import plotDiscriminationMetrics,plotBrierMetrics
import arg... | 11,337 | 45.277551 | 131 | py |
imbalanceCXR | imbalanceCXR-master/train_model.py | # coding: utf-8
import os,sys, pickle
sys.path.insert(0,".")
import numpy as np
import torch
import torchvision, torchvision.transforms
from imbalanceCXR.configure_datasets import parseDatasets
import random
from imbalanceCXR.train_utils import train
from imbalanceCXR.test_utils import valid_epoch
from imbalanceCXR.u... | 8,990 | 45.107692 | 219 | py |
imbalanceCXR | imbalanceCXR-master/__init__.py | 0 | 0 | 0 | py | |
imbalanceCXR | imbalanceCXR-master/imbalanceCXR/utils.py | import os, sys
sys.path.insert(0,"..")
import torchvision.models as torch_mod
import numpy as np
import torch
import torchxrayvision as xrv
from focal_loss.focal_loss import FocalLoss
from tqdm import tqdm as tqdm_base
from matplotlib import pyplot as plt
def plotBrierMetrics(means, stds, sorted_pathologies, to_plot... | 9,802 | 36.849421 | 96 | py |
imbalanceCXR | imbalanceCXR-master/imbalanceCXR/train_utils.py | import os, sys
sys.path.insert(0,"..")
import pickle
import pprint
import random
from glob import glob
from os.path import exists, join
import numpy as np
import torch
from torch.optim.lr_scheduler import StepLR
from imbalanceCXR.utils import getCriterions, tqdm
from imbalanceCXR.test_utils import valid_epoch
def tr... | 7,923 | 36.201878 | 118 | py |
imbalanceCXR | imbalanceCXR-master/imbalanceCXR/__init__.py | 0 | 0 | 0 | py | |
imbalanceCXR | imbalanceCXR-master/imbalanceCXR/configure_datasets.py | import torchxrayvision as xrv
NIH_IMAGES = "/run/user/1000/gvfs/smb-share:server=lxestudios.hospitalitaliano.net,share=pacs/T-Rx/NIH/"
CHEXPERT_IMAGES = "/run/user/1000/gvfs/smb-share:server=lxestudios.hospitalitaliano.net,share=pacs/T-Rx/CheXpert-v1.0-small"
CHEXPERT_CSV = "/run/user/1000/gvfs/smb-share:server=lxestu... | 2,968 | 40.236111 | 146 | py |
imbalanceCXR | imbalanceCXR-master/imbalanceCXR/test_utils.py | import os, sys
sys.path.insert(0,"..")
import pickle
from os.path import join
import numpy as np
import torch
from sklearn.metrics import roc_auc_score, f1_score, accuracy_score, brier_score_loss, log_loss, roc_curve, precision_recall_curve
from sklearn.calibration import calibration_curve
from sklearn.metrics import... | 16,495 | 45.730878 | 137 | py |
intervaltree | intervaltree-master/setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Distribution logic
Note that "python setup.py test" invokes pytest on the package. With appropriately
configured setup.cfg, t... | 5,605 | 34.707006 | 95 | py |
intervaltree | intervaltree-master/test/progress_bar.py | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: progress bar
Copyright 2013-2018 Chaim Leib Halbert
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compli... | 13,152 | 28.961276 | 81 | py |
intervaltree | intervaltree-master/test/intervaltrees.py | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: utilities to generate test trees
Copyright 2013-2018 Chaim Leib Halbert
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this f... | 1,406 | 30.266667 | 73 | py |
intervaltree | intervaltree-master/test/intervals.py | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: utilities to generate intervals
Copyright 2013-2018 Chaim Leib Halbert
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this fi... | 3,941 | 27.985294 | 87 | py |
intervaltree | intervaltree-master/test/__init__.py | # Copyright 2013-2018 Chaim Leib Halbert
#
# 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 agreed to i... | 586 | 40.928571 | 74 | py |
intervaltree | intervaltree-master/test/pprint.py | # Author: Fred L. Drake, Jr.
# fdrake@acm.org
#
# This is a simple little module I wrote to make life easier. I didn't
# see anything quite like it in the library, though I may have overlooked
# something. I wrote this when I was trying to read some heavily nested
# tuples with fairly non-desc... | 16,790 | 34.127615 | 105 | py |
intervaltree | intervaltree-master/test/match.py | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: IntervalTree, test utilities
Copyright 2013-2018 Chaim Leib Halbert
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file ... | 882 | 30.535714 | 73 | py |
intervaltree | intervaltree-master/test/issues/issue26_test.py | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: IntervalTree, insertion and removal of float intervals
Submitted as issue #26 (Pop from empty list error) by sciencectn
Ensure that rotations that promote Inter... | 3,007 | 26.345455 | 77 | py |
intervaltree | intervaltree-master/test/issues/issue4.py | '''
PyIntervalTree issue #4 test
https://github.com/konstantint/PyIntervalTree/issues/4
Test contributed by jacekt
'''
from __future__ import absolute_import
from intervaltree import IntervalTree
from test.progress_bar import ProgressBar
from test import data
items = data.issue4.data
MAX = data.issue4.MAX
from test.in... | 2,372 | 23.214286 | 74 | py |
intervaltree | intervaltree-master/test/issues/issue72_test.py | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: IntervalTree, remove_overlap caused incorrect balancing
where intervals overlapping an ancestor's x_center were buried too deep.
Submitted as issue #72 (KeyErro... | 1,481 | 33.465116 | 73 | py |
intervaltree | intervaltree-master/test/issues/__init__.py | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: issues by tracking number
Copyright 2013-2018 Chaim Leib Halbert
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file exc... | 754 | 34.952381 | 73 | py |
intervaltree | intervaltree-master/test/issues/issue67_test.py | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: IntervalTree, insertion of a sequence of intervals caused
invariant violation
Submitted as issue #67 (Inserting intervals in specific sequence results in
invali... | 2,448 | 32.094595 | 75 | py |
intervaltree | intervaltree-master/test/issues/issue27_test.py | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: IntervalTree, insertion and removal of float intervals
Submitted as issue #26 (Pop from empty list error) by sciencectn
Ensure that rotations that promote Inter... | 1,909 | 30.833333 | 74 | py |
intervaltree | intervaltree-master/test/issues/issue41_test.py | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: IntervalTree, removal of intervals
Submitted as issue #41 (Interval removal breaks this tree) by escalonn
Copyright 2013-2018 Chaim Leib Halbert
Licensed unde... | 1,864 | 24.202703 | 73 | py |
intervaltree | intervaltree-master/test/issues/issue25_test.py | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: IntervalTree, insertion and removal of float intervals
Submitted as issue #25 (Incorrect KeyError) by sciencectn
Copyright 2013-2018 Chaim Leib Halbert
Licens... | 2,628 | 24.524272 | 73 | py |
intervaltree | intervaltree-master/test/optimality/optimality_test_matrix.py | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: IntervalTree optimality
Copyright 2013-2018 Chaim Leib Halbert
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file excep... | 5,173 | 30.938272 | 76 | py |
intervaltree | intervaltree-master/test/optimality/optimality_test.py | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: IntervalTree optimality
Copyright 2013-2018 Chaim Leib Halbert
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file excep... | 2,449 | 27.823529 | 78 | py |
intervaltree | intervaltree-master/test/optimality/__init__.py | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: IntervalTree structure optimality tests
Copyright 2013-2018 Chaim Leib Halbert
Licensed under the Apache License, Version 2.0 (the "License");
you may not use... | 768 | 35.619048 | 73 | py |
intervaltree | intervaltree-master/test/interval_methods/unary_test.py | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: Intervals, methods on self only
Copyright 2013-2018 Chaim Leib Halbert
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this fi... | 2,452 | 21.712963 | 73 | py |
intervaltree | intervaltree-master/test/interval_methods/sorting_test.py | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: Intervals, sorting methods
Copyright 2013-2018 Chaim Leib Halbert
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file ex... | 6,982 | 22.751701 | 73 | py |
intervaltree | intervaltree-master/test/interval_methods/__init__.py | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: Interval methods
Copyright 2013-2018 Chaim Leib Halbert
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in co... | 745 | 34.52381 | 73 | py |
intervaltree | intervaltree-master/test/interval_methods/binary_test.py | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: Intervals, methods on two intervals
Copyright 2013-2018 Chaim Leib Halbert
Licensed under the Apache License, Version 2.0 (the "License");
you may not use thi... | 3,542 | 29.543103 | 73 | py |
intervaltree | intervaltree-master/test/intervaltree_methods/setlike_test.py | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: IntervalTree, Special methods
Copyright 2013-2018 Chaim Leib Halbert
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file... | 11,347 | 23.456897 | 73 | py |
intervaltree | intervaltree-master/test/intervaltree_methods/insert_test.py | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: IntervalTree, Basic insertion methods
Copyright 2013-2018 Chaim Leib Halbert
Licensed under the Apache License, Version 2.0 (the "License");
you may not use t... | 4,382 | 25.889571 | 77 | py |
intervaltree | intervaltree-master/test/intervaltree_methods/query_test.py | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: IntervalTree, Basic query methods (read-only)
Copyright 2013-2018 Chaim Leib Halbert
Licensed under the Apache License, Version 2.0 (the "License");
you may n... | 5,332 | 30.187135 | 73 | py |
intervaltree | intervaltree-master/test/intervaltree_methods/restructure_test.py | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: IntervalTree, Special methods
Copyright 2013-2018 Chaim Leib Halbert
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file... | 17,270 | 27.128664 | 97 | py |
intervaltree | intervaltree-master/test/intervaltree_methods/__init__.py | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: IntervalTree methods
Copyright 2013-2018 Chaim Leib Halbert
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except i... | 749 | 34.714286 | 73 | py |
intervaltree | intervaltree-master/test/intervaltree_methods/delete_test.py | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: IntervalTree, Basic deletion methods
Copyright 2013-2018 Chaim Leib Halbert
Licensed under the Apache License, Version 2.0 (the "License");
you may not use th... | 3,555 | 25.147059 | 73 | py |
intervaltree | intervaltree-master/test/intervaltree_methods/debug_test.py | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: IntervalTree, Basic query methods (read-only)
Copyright 2013-2018 Chaim Leib Halbert
Licensed under the Apache License, Version 2.0 (the "License");
you may n... | 2,061 | 26.864865 | 73 | py |
intervaltree | intervaltree-master/test/intervaltree_methods/copy_test.py | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: IntervalTree, Copying
Copyright 2013-2018 Chaim Leib Halbert
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except ... | 2,030 | 28.014286 | 93 | py |
intervaltree | intervaltree-master/test/intervaltree_methods/init_test.py | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: IntervalTree, initialization methods
Copyright 2013-2018 Chaim Leib Halbert
Licensed under the Apache License, Version 2.0 (the "License");
you may not use th... | 2,289 | 25.627907 | 75 | py |
intervaltree | intervaltree-master/test/data/ivs1_float_copy_structure.py | """
Same as ivs1, but with floats.
"""
data = \
[(0.1, 0.2, '[1,2)'),
(0.4, 0.7, '[4,7)'),
(0.5, 0.9, '[5,9)'),
(0.6, 1.0, '[6,10)'),
(0.8, 1.0, '[8,10)'),
(0.8, 1.5, '[8,15)'),
(1.0, 1.2, '[10,12)'),
(1.2, 1.4, '[12,14)'),
(1.4, 1.5, '[14,15)')]
| 255 | 17.285714 | 30 | py |
intervaltree | intervaltree-master/test/data/ivs1.py | """
Tiny IntervalTree data. For tiny testing.
"""
data = \
[(1, 2, '[1,2)'),
(4, 7, '[4,7)'),
(5, 9, '[5,9)'),
(6, 10, '[6,10)'),
(8, 10, '[8,10)'),
(8, 15, '[8,15)'),
(10, 12, '[10,12)'),
(12, 14, '[12,14)'),
(14, 15, '[14,15)')]
| 239 | 16.142857 | 41 | py |
intervaltree | intervaltree-master/test/data/ivs0.py | """
Empty IntervalTree data.
"""
data = []
| 43 | 7.8 | 24 | py |
intervaltree | intervaltree-master/test/data/issue4_result.py | """
Result tree data from test/issue4.py.
"""
data = \
[(3899662336, 3899674624, None),
(870727680, 870731776, None),
(827572224, 827617280, None),
(569581568, 569618432, None),
(2489516032, 2489536512, None),
(3461218304, 3461222400, None),
(1344323584, 1344356352, None),
(2365292544, 2365296640, None),
(20916... | 1,083,603 | 31.562173 | 37 | py |
intervaltree | intervaltree-master/test/data/issue41_orig.py | """
Manually create the original tree that revealed the bug. I have to
do this, since with later code changes, the original sequence of
insertions and removals might not recreate that tree exactly, with
the same internal structure.
Node<961, depth=2, balance=0>
Interval(961, 986, 1)
<: Node<871, depth=1, balance=0>
... | 2,451 | 25.365591 | 66 | py |
intervaltree | intervaltree-master/test/data/issue4.py | """
Source data for test/issue4. Very long!
"""
MAX = 0xfe000000
data = \
[(0, 2019328, True),
(2023424, 2551808, True),
(2584576, 2592768, True),
(2600960, 2605056, True),
(2613248, 2625536, True),
(2641920, 2707456, True),
(2711552, 2748416, True),
(2752512, 2772992, True),
(2777088, 2854912, True),
(285900... | 4,903,833 | 32.197493 | 39 | py |
intervaltree | intervaltree-master/test/data/ivs3.py | """
Random integer ranges, with gaps.
"""
data = \
[(-50, -42, None),
(-36, -27, None),
(-27, -21, None),
(-21, -17, None),
(-17, -16, None),
(-14, -4, None),
(-4, 0, None),
(4, 12, None),
(13, 23, None),
(23, 32, None),
(41, 46, None),
(46, 55, None),
(55, 58, None),
(68, 69, None),
(69, 75, None),
(75,... | 1,923 | 17.32381 | 33 | py |
intervaltree | intervaltree-master/test/data/ivs2.py | """
Random integer ranges, no gaps.
"""
data = \
[(-50, -42, None),
(-42, -35, None),
(-35, -29, None),
(-29, -25, None),
(-25, -24, None),
(-24, -16, None),
(-16, -13, None),
(-13, -10, None),
(-10, -7, None),
(-7, -1, None),
(-1, 0, None),
(0, 1, None),
(1, 5, None),
(5, 13, None),
(13, 23, None),
(23,... | 1,893 | 17.038095 | 31 | py |
intervaltree | intervaltree-master/test/data/__init__.py | from . import issue4
from . import issue4_result
from . import issue25_orig
from . import issue41_orig
from . import ivs0
from . import ivs1
from . import ivs1_float_copy_structure
from . import ivs2
from . import ivs3
| 219 | 21 | 39 | py |
intervaltree | intervaltree-master/test/data/issue25_orig.py | """
Manually create the original tree that revealed the bug. I have to
do this, since with later code changes, the original sequence of
insertions and removals might not recreate that tree exactly, with
the same internal structure.
Node<10.58, depth=3, balance=1>
Interval(8.65, 13.65)
<: Node<5.66, depth=1, balance=... | 2,280 | 25.218391 | 66 | py |
intervaltree | intervaltree-master/intervaltree/intervaltree.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Core logic.
Copyright 2013-2018 Chaim Leib Halbert
Modifications Copyright 2014 Konstantin Tretyakov
Licensed under the Apac... | 41,550 | 33.086136 | 103 | py |
intervaltree | intervaltree-master/intervaltree/node.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Core logic: internal tree nodes.
Copyright 2013-2018 Chaim Leib Halbert
Modifications Copyright 2014 Konstantin Tretyakov
Li... | 21,024 | 33.410802 | 104 | py |
intervaltree | intervaltree-master/intervaltree/interval.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Interval class
Copyright 2013-2018 Chaim Leib Halbert
Modifications copyright 2014 Konstantin Tretyakov
Licensed under the A... | 10,230 | 30.097264 | 145 | py |
intervaltree | intervaltree-master/intervaltree/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Root package.
Copyright 2013-2018 Chaim Leib Halbert
Licensed under the Apache License, Version 2.0 (the "License");
you may... | 846 | 31.576923 | 73 | py |
Comp2Comp | Comp2Comp-master/setup.py | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import os
from os import path
from setuptools import find_packages, setup
def get_version():
init_py_path = path.join(path.abspath(path.dirname(__file__)), "comp2comp", "__init__.py")
init_py = open(init_py_path, "r... | 2,240 | 28.103896 | 94 | py |
Comp2Comp | Comp2Comp-master/comp2comp/inference_pipeline.py | """
@author: louisblankemeier
"""
import inspect
import os
from typing import Dict, List
from comp2comp.inference_class_base import InferenceClass
from comp2comp.io.io import DicomLoader, NiftiSaver
class InferencePipeline(InferenceClass):
"""Inference pipeline."""
def __init__(self, inference_classes: Lis... | 3,212 | 31.13 | 100 | py |
Comp2Comp | Comp2Comp-master/comp2comp/inference_class_base.py | """
@author: louisblankemeier
"""
from typing import Dict
class InferenceClass:
"""Base class for inference classes."""
def __init__(self):
pass
def __call__(self) -> Dict:
raise NotImplementedError
def __repr__(self):
return self.__class__.__name__
| 296 | 14.631579 | 43 | py |
Comp2Comp | Comp2Comp-master/comp2comp/__init__.py | from .utils.env import setup_environment
setup_environment()
# This line will be programatically read/write by setup.py.
# Leave them at the bottom of this file and don't touch them.
__version__ = "0.0.1"
| 208 | 22.222222 | 61 | py |
Comp2Comp | Comp2Comp-master/comp2comp/io/io.py | """
@author: louisblankemeier
"""
import os
import shutil
from pathlib import Path
from typing import Dict, Union
#import dicom2nifti
import dosma as dm
from comp2comp.inference_class_base import InferenceClass
import SimpleITK as sitk
class DicomLoader(InferenceClass):
"""Load a single dicom series."""
d... | 3,598 | 31.133929 | 97 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.