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 |
|---|---|---|---|---|---|---|
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/core/moments_accountant/rdp_accountant.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# 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 applica... | 13,880 | 36.314516 | 103 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/core/dp_multiq/base.py | # coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# 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 applicab... | 3,091 | 30.55102 | 79 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/core/dp_multiq/run_experiment.py | # coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# 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 applicab... | 1,342 | 38.5 | 79 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/core/dp_multiq/tree.py | # coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# 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 applicab... | 23,670 | 37.364668 | 127 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/core/dp_multiq/smooth_utils.py | # coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# 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 applicab... | 5,676 | 39.262411 | 80 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/core/dp_multiq/experiment.py | # coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# 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 applicab... | 17,930 | 39.567873 | 80 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/core/dp_multiq/csmooth.py | # coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# 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 applicab... | 7,321 | 40.134831 | 80 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/core/dp_multiq/joint_exp.py | # coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# 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 applicab... | 6,824 | 34.732984 | 80 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/core/dp_multiq/smooth.py | # coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# 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 applicab... | 2,302 | 39.403509 | 80 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/core/dp_multiq/ind_exp.py | # coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# 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 applicab... | 5,129 | 37.863636 | 80 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/core/binning/sparse_vector.py | # sparse vector ------------------------------------------------------
class SparseVector:
"""
sparse vector: dict, record (indices, data) kv tuples
shape: the real feature shape of data
"""
def __init__(self, indices=None, fn=None, data=None, shape=0):
self.sparse_vec = dict(zip(indices, da... | 542 | 29.166667 | 70 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/core/binning/base_binning.py | from federated_gbdt.core.binning.bin_inner_param import BinInnerParam
from federated_gbdt.core.binning.bin_result import BinResults
import pandas as pd
import functools
import copy
import bisect
from federated_gbdt.core.binning.sparse_vector import SparseVector
class BaseBinning(object):
"""
This is use for d... | 19,723 | 37.224806 | 135 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/core/binning/bin_inner_param.py | import copy
class BinInnerParam(object):
"""
Use to store columns related params for binning process
"""
def __init__(self):
self.bin_indexes = []
self.bin_names = []
self.col_name_maps = {}
self.header = []
self.transform_bin_indexes = []
self.transfor... | 5,774 | 36.745098 | 92 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/core/binning/quantile_binning.py | from federated_gbdt.core.binning.feature_binning_param import FeatureBinningParam
from federated_gbdt.core.binning.base_binning import BaseBinning
from federated_gbdt.core.binning.quantile_summaries import SparseQuantileSummaries, QuantileSummaries
from federated_gbdt.core.baseline_constants import DEFAULT_RELATIVE_ERR... | 11,784 | 36.651757 | 106 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/core/binning/__init__.py | 0 | 0 | 0 | py | |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/core/binning/quantile_summaries.py | from federated_gbdt.core import baseline_constants
import math
class Stats(object):
def __init__(self, value, g: int, delta: int):
self.value = value
self.g = g
self.delta = delta
class QuantileSummaries(object):
def __init__(self, compress_thres=baseline_constants.DEFAULT_COMPRESS_T... | 8,918 | 32.156134 | 102 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/core/binning/feature_binning_param.py | from federated_gbdt.core import baseline_constants
import copy
class TransformParam:
"""
Define how to transfer the cols
Parameters
----------
transform_cols : list of column index, default: -1
Specify which columns need to be transform. If column index is None, None of columns will be tr... | 6,386 | 39.681529 | 118 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/core/binning/bin_result.py | import numpy as np
class BinColResults(object):
def __init__(self, woe_array=(), iv_array=(), event_count_array=(), non_event_count_array=(),
event_rate_array=(), non_event_rate_array=(), iv=None):
self.woe_array = list(woe_array)
self.iv_array = list(iv_array)
self.event_... | 7,011 | 40.988024 | 102 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/models/__init__.py | from .gbdt.private_gbdt import PrivateGBDT
__all__ = ["PrivateGBDT"] | 69 | 22.333333 | 42 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/models/base/tree_base.py | import numpy as np
import federated_gbdt.core.baseline_constants as consts
from abc import ABC, abstractmethod
import pandas
from sklearn.metrics import roc_auc_score, accuracy_score
import _pickle as pickle
class TreeBase(ABC):
def __init__(self, min_samples_split=2,
max_depth=3, task_type=consts... | 5,100 | 33.466216 | 105 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/models/base/tree_node.py | from numba.experimental import jitclass
from numba import float32, int32, deferred_type, optional, types
# Node of decision tree, recursive model
node_type = deferred_type() # numba
array_type = types.float32[:]
spec = [ # numba
('feature_i', int32),
('threshold', optional(float32)),
# ('value', optiona... | 1,675 | 37.976744 | 155 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/models/base/jit_functions.py | import numba
import math
@numba.jit(nopython=True)
def _L1_clip(total_grads, reg_alpha):
"""
L1 regularisation on the gradients, controlled by self.reg_alpha
:param total_grads:
:return:
"""
if total_grads > reg_alpha:
return total_grads - reg_alpha
elif total_grads < -1 * reg_alph... | 1,972 | 34.872727 | 281 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/models/base/__init__.py | 0 | 0 | 0 | py | |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/models/gbdt/private_gbdt.py | import math
import random
import sys
import pandas as pd
import numpy as np
from collections import Counter, defaultdict
from copy import copy
from fast_histogram import histogram1d
from federated_gbdt.models.base.tree_base import TreeBase
from federated_gbdt.models.base.tree_node import DecisionNode
from federated... | 57,288 | 61.748083 | 346 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/models/gbdt/__init__.py | 0 | 0 | 0 | py | |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/models/gbdt/components/index_sampler.py | import numpy as np
import math
import itertools
class IndexSampler():
def __init__(self, subsample, row_sample_method, colsample_bytree, colsample_bylevel, colsample_bynode):
self.subsample = subsample
self.row_sample_method = row_sample_method
self.colsample_bytree = colsample_bytree # Nu... | 3,735 | 60.245902 | 197 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/models/gbdt/components/privacy_accountant.py | import numpy as np
import math
from collections import defaultdict
from federated_gbdt.core.moments_accountant.compute_noise_from_budget_lib import compute_noise
from autodp.mechanism_zoo import GaussianMechanism, SubsampleGaussianMechanism
from autodp.transformer_zoo import Composition, ComposeGaussian, Amplificatio... | 20,470 | 52.449086 | 271 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/models/gbdt/components/split_candidate_manager.py | import statsmodels.distributions.empirical_distribution as edf
import pandas as pd
import numpy as np
import math
from federated_gbdt.core.pure_ldp.frequency_oracles.square_wave.sw_client import SWClient
from federated_gbdt.core.pure_ldp.frequency_oracles.square_wave.sw_server import SWServer
from federated_gbdt.core.... | 16,878 | 57.203448 | 203 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/models/gbdt/components/train_monitor.py | import numpy as np
import time
from collections import defaultdict
class TrainMonitor():
def __init__(self, num_clients, num_classes=2):
self.gradient_info = [] # List of tuples containing (gradient, hess) info
self.leaf_gradient_tracker = [[], []]
self.root_gradient_tracker = [[],[]]
... | 6,460 | 39.892405 | 167 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/federated_gbdt/models/gbdt/components/__init__.py | 0 | 0 | 0 | py | |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/experiments/__init__.py | 0 | 0 | 0 | py | |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/experiments/replication_experiments/experiment_replicator.py | from experiments.paper_experiments.paper_experiments import *
from experiments.paper_experiments.paper_plotter import *
import os.path
base_path = "./replication_data/"
class ExperimentReplicator():
def __init__(self):
pass
def replicate(self, figure_num, dataset="Credit 1", overwrite=False):
... | 3,862 | 51.202703 | 145 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/experiments/replication_experiments/__init__.py | 0 | 0 | 0 | py | |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/experiments/experiment_helpers/data_loader.py | import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.datasets import make_classification
from collections import Counter
from pmlb import fetch_data
import random
import os
dirname = os.path.split(os.path.split(os.path.dirname(__file__))[0])[0]
data_path = dirname +... | 17,241 | 46.10929 | 179 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/experiments/experiment_helpers/experiment_runner.py | import time
import pandas as pd
import numpy as np
import os
from collections import Counter
import itertools
import pathos.multiprocessing as mp
dirname = os.path.dirname(__file__)
base_path = os.path.split(dirname)[0] + os.sep + "experiment_data" + os.sep
from federated_gbdt.models.gbdt.private_gbdt import PrivateG... | 20,586 | 52.611979 | 220 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/experiments/paper_experiments/paper_experiments.py | import math
import numpy as np
from experiments.experiment_helpers.data_loader import DataLoader
from experiments.experiment_helpers.experiment_runner import ExperimentRunner
from dev.communication_framework import CommunicationsFramework
global_seeds = [1, 4, 100, 333, 1002]
data_loader = DataLoader([1, 4, 100, 333... | 63,493 | 50.537338 | 224 | py |
federated-boosted-dp-trees | federated-boosted-dp-trees-master/experiments/paper_experiments/paper_plotter.py | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import os
import shutil
import matplotlib.lines as mlines
from collections import defaultdict
sns.set_theme(style="whitegrid")
def set_fontsize(size=14):
tex_fonts = {
#"text.usetex": True,
"font.family"... | 112,721 | 38.704826 | 472 | py |
drizzlepac | drizzlepac-master/conftest.py | """Project default for pytest"""
# Utilities to support command line passing of arguments to test_randomlist.py
def pytest_addoption(parser):
"""Support options for the pytest test_randomlist.py."""
parser.addoption("--start_row", action="store", default=0)
parser.addoption("--num_rows", action="store", d... | 496 | 44.181818 | 89 | py |
drizzlepac | drizzlepac-master/setup.py | #!/usr/bin/env python
import sys
from glob import glob
from pathlib import Path
import numpy
from astropy import wcs
from setuptools import setup, Extension
# Setup C module include directories
include_dirs = []
numpy_includes = [numpy.get_include()]
wcs_include_path = Path(wcs.get_include())
wcs_includes = [
str... | 875 | 18.909091 | 42 | py |
drizzlepac | drizzlepac-master/tests/combine_ecsv_files.py | #!/usr/bin/env python
"""Simple script to combine the ecsv files from individual test runs into a single monolithic file for easier
review.
"""
import argparse
import datetime
import glob
import os
import sys
from astropy.io import ascii
from astropy.table import Table, vstack
# ------------------------------------... | 7,331 | 38.419355 | 110 | py |
drizzlepac | drizzlepac-master/tests/resources.py | import getpass
import os
import sys
import math
from io import StringIO
import shutil
import datetime
from os.path import splitext
from difflib import unified_diff
import pytest
from astropy.io import fits
from astropy.io.fits import FITSDiff
from astropy.utils.data import conf
import numpy as np
import stwcs
from st... | 18,686 | 32.853261 | 116 | py |
drizzlepac | drizzlepac-master/tests/test_imageObject.py | #!/usr/bin/env python
import pytest
from drizzlepac import imageObject
#from http://blog.moertel.com/articles/2008/03/19/property-checking-with-pythons-nose-testing-framework
def forall_cases(cases):
def decorate(testfn):
def gen():
for case in cases:
yield testfn, case
... | 1,097 | 30.371429 | 103 | py |
drizzlepac | drizzlepac-master/tests/__init__.py | 0 | 0 | 0 | py | |
drizzlepac | drizzlepac-master/tests/acs/test_acs_kernels.py | import os
from stsci.tools import teal
from drizzlepac import astrodrizzle
from ci_watson.artifactory_helpers import get_bigdata
from ..resources import BaseACS
def pytest_generate_tests(metafunc):
# called once per each test function
funcarglist = metafunc.cls.params[metafunc.function.__name__]
argnames... | 2,465 | 39.42623 | 83 | py |
drizzlepac | drizzlepac-master/tests/acs/test_unit.py | import os
import pytest
import numpy as np
from stwcs import distortion
from ..resources import BaseUnit
import drizzlepac.adrizzle as adrizzle
import drizzlepac.ablot as ablot
class TestDriz(BaseUnit):
def test_square_with_point(self):
"""
Test do_driz square kernel with point
"""
... | 20,923 | 39.550388 | 106 | py |
drizzlepac | drizzlepac-master/tests/acs/test_acs_tweak.py | import os
import shutil
import pytest
from stsci.tools import teal
from stwcs import updatewcs
from drizzlepac import astrodrizzle, tweakreg
from drizzlepac import pixtopix, pixtosky, skytopix
from ..resources import BaseACS
class TestAcsTweak(BaseACS):
@pytest.mark.xfail
def test_tweak(self):
""" ... | 6,335 | 42.696552 | 89 | py |
drizzlepac | drizzlepac-master/tests/acs/test_acs_narrowband.py | from stsci.tools import teal
from drizzlepac import astrodrizzle
from ..resources import BaseACS
from ci_watson.hst_helpers import raw_from_asn
class TestAsnNarrowband(BaseACS):
def test_acs_narrowband(self):
rootname = 'j8dw01010'
asn_file = rootname + '_asn.fits'
# Prepare input files... | 1,706 | 39.642857 | 91 | py |
drizzlepac | drizzlepac-master/tests/acs/test_asn_regress.py | import os
from stsci.tools import teal
import drizzlepac
from drizzlepac import astrodrizzle
from ..resources import BaseACS
from ci_watson.hst_helpers import raw_from_asn
class TestAsnRegress(BaseACS):
def test_hrc_asn(self):
# Customized tolerances as Linux and Mac would need different truth files.
... | 1,932 | 38.44898 | 91 | py |
drizzlepac | drizzlepac-master/tests/acs/__init__.py | 0 | 0 | 0 | py | |
drizzlepac | drizzlepac-master/tests/hap/base_classes.py | """Regression test helpers."""
import os
import pytest
from astropy.io import fits
from astropy.utils.data import conf
from ci_watson.artifactory_helpers import get_bigdata
from ci_watson.artifactory_helpers import compare_outputs
from drizzlepac.haputils.astroquery_utils import retrieve_observation
# Base classes ... | 6,217 | 33.544444 | 81 | py |
drizzlepac | drizzlepac-master/tests/hap/test_svm_wfc3ir.py | """ This module tests full pipeline SVM processing as a demonstration template.
"""
import datetime
import os
import pytest
import numpy as np
from drizzlepac.haputils import astroquery_utils as aqutils
from drizzlepac import runsinglehap
from astropy.io import fits, ascii
from pathlib import Path
"""
test_svm_d... | 8,900 | 40.4 | 123 | py |
drizzlepac | drizzlepac-master/tests/hap/test_svm_ibyt50.py | """ This module tests full pipeline SVM processing of a WFC3 dataset containing both IR and UVIS data.
The two detectors have the same WCS solution.
"""
import datetime
import os
import math
import numpy as np
import pytest
from drizzlepac.haputils import astroquery_utils as aqutils
from drizzlepac import runsing... | 10,863 | 42.983806 | 138 | py |
drizzlepac | drizzlepac-master/tests/hap/test_pipeline.py | """ This module tests full pipeline use of the drizzlepac package.
"""
import os
import pytest
from astropy.utils.data import conf
from ci_watson.artifactory_helpers import get_bigdata
from ci_watson.hst_helpers import download_crds, ref_from_image
from drizzlepac.haputils import astroquery_utils as aqutils
from dr... | 5,446 | 34.37013 | 93 | py |
drizzlepac | drizzlepac-master/tests/hap/test_align.py | """ This module runs tests on specific datasets to determine if the datasets can
be aligned to an astrometric catalog. """
import sys
import pytest
from drizzlepac import align as alignimages
from ci_watson.artifactory_helpers import get_bigdata
from .base_test import BaseHLATest
from stsci.tools import logutil
l... | 14,245 | 52.758491 | 100 | py |
drizzlepac | drizzlepac-master/tests/hap/test_svm_j97e06.py | """ This module tests full pipeline SVM processing of ACS WFC Grism and Direct image data.
"""
import datetime
import glob
import os
import math
import numpy as np
import pytest
from drizzlepac.haputils import astroquery_utils as aqutils
from drizzlepac import runsinglehap
from astropy.io import fits, ascii
from astr... | 11,293 | 41.618868 | 145 | py |
drizzlepac | drizzlepac-master/tests/hap/test_svm_canary.py | """ This module tests full pipeline SVM processing as a demonstration template.
"""
import datetime
import glob
import os
import pytest
import numpy as np
from drizzlepac.haputils import astroquery_utils as aqutils
from drizzlepac import runsinglehap
from astropy.io import fits, ascii
from pathlib import Path
"""
... | 6,092 | 38.057692 | 112 | py |
drizzlepac | drizzlepac-master/tests/hap/base_test.py | import os
import pytest
import math
from astropy.io import fits
from astropy.table import Table
import numpy as np
import stwcs
from stwcs import updatewcs
from stsci.tools import fileutil
from ci_watson.artifactory_helpers import get_bigdata_root
from ci_watson.hst_helpers import raw_from_asn, ref_from_image, downl... | 14,411 | 34.497537 | 116 | py |
drizzlepac | drizzlepac-master/tests/hap/test_svm_ibqk07.py | """ This module tests full pipeline SVM processing of a WFC3 dataset containing both IR and UVIS data.
The two detectors do NOT have the same WCS solution.
"""
import datetime
import os
import math
import numpy as np
import pytest
from drizzlepac.haputils import astroquery_utils as aqutils
from drizzlepac import ... | 13,236 | 43.123333 | 145 | py |
drizzlepac | drizzlepac-master/tests/hap/test_randomlist.py | """ This module is the high-level wrapper for running a test on a list of input
datasets in order to collect statistics on alignment of each dataset to an
astrometric catalog."""
import sys
import datetime
import os
import shutil
import numpy as np
from astropy.table import Table
import pytest
from drizzlepac ... | 9,648 | 42.660633 | 117 | py |
drizzlepac | drizzlepac-master/tests/hap/test_alignpipe_randomlist.py | """ This module is the high-level wrapper for running a test on a list of input
datasets in order to process the dataset in manner similar to the pipeline
processing (updatewcs, alignment, astrodrizzle).
"""
import datetime
import traceback
import os
import shutil
import sys
import numpy as np
from astropy.... | 15,350 | 42.86 | 109 | py |
drizzlepac | drizzlepac-master/tests/hap/__init__.py | 0 | 0 | 0 | py | |
drizzlepac | drizzlepac-master/tests/hap/test_svm_hrcsbc.py | """ This module tests full pipeline SVM processing as a demonstration template.
"""
import datetime
import glob
import os
import pytest
import numpy as np
from drizzlepac.haputils import astroquery_utils as aqutils
from drizzlepac import runsinglehap
from astropy.io import fits, ascii
from pathlib import Path
"""
... | 10,391 | 42.3 | 138 | py |
drizzlepac | drizzlepac-master/tests/hap/test_run_svmpoller.py | """ This module is the high-level wrapper for running a test on a list of input
poller files (e.g., ib4606.out) in order to process the specified data through
the Single Visit Mosaic pipeline.
"""
import datetime
import glob
import os
import shutil
import sys
import traceback
import numpy as np
import pytes... | 6,730 | 40.042683 | 116 | py |
drizzlepac | drizzlepac-master/tests/hap/test_svm_je281u.py | """ This module tests full pipeline SVM processing for an ACS WFC, full-frame, one filter dataset.
"""
import datetime
import glob
import os
import pytest
from drizzlepac.haputils import astroquery_utils as aqutils
from drizzlepac import runsinglehap
from astropy.io import fits, ascii
from pathlib import Path
"""
... | 7,099 | 39.112994 | 127 | py |
drizzlepac | drizzlepac-master/tests/hap/test_apriori.py | """ This module computes alignment solutions between all "a priori" solutions
for a dataset and GAIA.
"""
import pytest
import numpy as np
from drizzlepac.haputils import testutils
from ..resources import BaseACS, BaseWFC3
def compare_apriori(dataset):
"""This test will perform fits between ALL a priori s... | 4,890 | 33.687943 | 87 | py |
drizzlepac | drizzlepac-master/tests/hap/template_svm_demo.py | """ This module tests full pipeline SVM processing as a demonstration template.
"""
import datetime
import glob
import os
import pytest
from drizzlepac.haputils import astroquery_utils as aqutils
from drizzlepac import runsinglehap
from astropy.io import fits, ascii
from pathlib import Path
"""
template_svm_demo... | 7,683 | 40.76087 | 136 | py |
drizzlepac | drizzlepac-master/tests/wfpc2/test_wfpc2.py | import os
import pytest
from stsci.tools import teal
from drizzlepac import astrodrizzle
from stwcs import updatewcs
from ..resources import BaseWFPC2
class TestWFPC2(BaseWFPC2):
@pytest.mark.skip(reason="disable until truth files can be updated")
def test_waiver_single(self):
""" This test confirms... | 6,956 | 40.410714 | 89 | py |
drizzlepac | drizzlepac-master/tests/wfpc2/__init__.py | 0 | 0 | 0 | py | |
drizzlepac | drizzlepac-master/tests/drizzle/test_kernel.py | import os
import pytest
import numpy as np
from astropy import wcs
import cdriz_setup
@pytest.fixture
def kernel_pars():
_params = cdriz_setup.Get_Grid(inx=50, iny=60, outx=51, outy=66)
_params.zero_background()
return _params
@pytest.mark.parametrize("kernel", ["square", "point", "turbo", "gaussian", "... | 5,090 | 32.493421 | 100 | py |
drizzlepac | drizzlepac-master/tests/drizzle/test_cdriz.py | import pytest
import os
import numpy as np
import cdriz_setup
@pytest.fixture
def kernel_pars():
# get cdriz.triz inputs from cdriz_setup.py
_params = cdriz_setup.Get_Grid(inx=10, iny=10, outx=13, outy=13)
_params.zero_background()
return _params
# "square", "point", "turbo", "gaussian", "lanczos3"
... | 2,347 | 31.164384 | 100 | py |
drizzlepac | drizzlepac-master/tests/drizzle/cdriz_setup.py | import os
import numpy as np
from astropy import wcs
from drizzlepac import cdriz
def get_wcs(_grid, pscale=0.04):
w = wcs.WCS()
w.wcs.ctype = ["RA---TAN", "DEC--TAN"]
w.wcs.crpix = [_grid[0] / 2.0, _grid[1] / 2.0] # define as center pixel in array
w.wcs.crval = [10.000, 10.000] # RA/Decl. in decima... | 4,888 | 29.943038 | 88 | py |
drizzlepac | drizzlepac-master/tests/stis/__init__.py | 0 | 0 | 0 | py | |
drizzlepac | drizzlepac-master/tests/stis/test_stis.py | import os
import shutil
from stsci.tools import teal
from drizzlepac import astrodrizzle
from drizzlepac import pixtopix, pixtosky, skytopix
from stwcs import updatewcs
from ..resources import BaseSTIS
class TestSTIS(BaseSTIS):
def test_fuv_mama(self):
""" This test confirms that drizzlepac can correcl... | 8,557 | 42.887179 | 89 | py |
drizzlepac | drizzlepac-master/tests/wfc3/test_vary_perf.py | import os
from stsci.tools import teal
from drizzlepac import astrodrizzle
from stwcs import updatewcs
from ..resources import BaseWFC3
def pytest_generate_tests(metafunc):
# called once per each test function
funcarglist = metafunc.cls.params[metafunc.function.__name__]
argnames = sorted(funcarglist[0])
... | 2,993 | 41.771429 | 85 | py |
drizzlepac | drizzlepac-master/tests/wfc3/test_wfc3.py | import os
from stsci.tools import teal
import drizzlepac
from drizzlepac import astrodrizzle
from stwcs import updatewcs
from ..resources import BaseWFC3
from ci_watson.hst_helpers import raw_from_asn
class TestWFC3(BaseWFC3):
def test_binned_single(self):
# Customized tolerances as Linux and Mac woul... | 5,311 | 36.942857 | 88 | py |
drizzlepac | drizzlepac-master/tests/wfc3/__init__.py | 0 | 0 | 0 | py | |
drizzlepac | drizzlepac-master/doc/source/conf.py | # -*- coding: utf-8 -*-
#
# STSCI documentation build configuration file, created by
# sphinx-quickstart on Thu Oct 22 17:25:41 2015.
#
# 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
# autogenerated file.
#
# All... | 10,719 | 32.08642 | 143 | py |
drizzlepac | drizzlepac-master/drizzlepac/runmultihap.py | #!/usr/bin/env python
""" runmultihap.py - Module to control processing of multi-visit mosaics
:License: :doc:`LICENSE`
USAGE:
>>> python drizzlepac/runmultihap [-dl] inputFilename
- The '-d' option will run this task in DEBUG mode producing additional outputs. If not explicitly specified,
the default value i... | 6,269 | 44.434783 | 120 | py |
drizzlepac | drizzlepac-master/drizzlepac/mdriz.py | #!/usr/bin/env python
"""
Main program for running MultiDrizzle from the command line.
:Authors: Warren Hack
:License: :doc:`LICENSE`
"""
import getopt
import sys, os
from drizzlepac.astrodrizzle import AstroDrizzle
from drizzlepac import __version__
from drizzlepac import util
ruler = '-' * 80
print('{0:s}\nDEPRE... | 1,967 | 27.114286 | 91 | py |
drizzlepac | drizzlepac-master/drizzlepac/runsinglehap.py | #!/usr/bin/env python
""" runsinglehap.py - Module to control processing of single-visit mosaics
:License: :doc:`LICENSE`
USAGE:
>>> runsinglehap [-cdl] inputFilename
- The '-c' option allows the user to specify a customized configuration JSON file which has been tuned for
specialized processing. Thi... | 6,225 | 46.526718 | 120 | py |
drizzlepac | drizzlepac-master/drizzlepac/quickDeriv.py | """
MODULE RECEIVES A NUMARRAY OBJECT AS INPUT, REPRESENTING A 2-D IMAGE,
AND COMPUTES THE ABSOLUTE DERIVATE OF THAT IMAGE. A NUMARRY OBJECT
IS RETURNED BY :py:func:`quickderiv`.
:Authors: CHRISTOPHER HANLEY
:License: :doc:`LICENSE`
"""
#
# VERSION:
# Version 0.1.0: created -- CJH
#
import numpy as np
from . impo... | 2,331 | 30.513514 | 82 | py |
drizzlepac | drizzlepac-master/drizzlepac/align.py | #!/usr/bin/env python
"""This script is a modernized implementation of tweakreg.
"""
import copy
import datetime
import sys
import glob
import math
import os
import pickle
from collections import OrderedDict
import traceback
import numpy as np
from astropy.table import Table
from astropy.io import fits
from stsci.t... | 54,829 | 46.595486 | 151 | py |
drizzlepac | drizzlepac-master/drizzlepac/imagefindpars.py | """
:Authors: Warren Hack, Mihai Cara
:License: :doc:`LICENSE`
"""
import os, string
from stsci.tools import teal
from . import util
from . import __version__
__taskname__ = 'imagefindpars'
__doc__ = util._def_help_functions(
locals(), module_file=__file__, task_name=__taskname__, module_doc=__doc__
)
| 313 | 15.526316 | 78 | py |
drizzlepac | drizzlepac-master/drizzlepac/buildwcs.py | """
Provides function for manipulating WCS in images.
:Authors: Warren Hack
:License: :doc:`LICENSE`
"""
import sys, types, os, copy
from . import util
import numpy as np
from astropy.io import fits
from stsci.tools import fileutil,teal
from . import outputimage, wcs_functions, processInput,util
import stwcs
from s... | 15,081 | 37.085859 | 100 | py |
drizzlepac | drizzlepac-master/drizzlepac/tweakutils.py | """
:Authors: Warren Hack
:License: :doc:`LICENSE`
"""
import string
import os
import sys
import numpy as np
from scipy import signal, ndimage
from stsci.tools import asnutil, irafglob, parseinput, fileutil, logutil
from astropy.io import fits
import astropy.coordinates as coords
import astropy.units as u
from astr... | 38,916 | 31.758418 | 79 | py |
drizzlepac | drizzlepac-master/drizzlepac/updatehdr.py | """
:Authors: Warren Hack, Mihai Cara
:License: :doc:`LICENSE`
"""
import re
import sys
from astropy.io import fits
import numpy as np
from astropy import wcs as pywcs
from stsci.tools import fileutil, logutil
from stwcs import wcsutil
from stwcs.wcsutil import wcscorr, altwcs
from stsci.skypac.utils import get_e... | 18,887 | 32.548845 | 101 | py |
drizzlepac | drizzlepac-master/drizzlepac/astrodrizzle.py | """
``AstroDrizzle`` - Python implementation of ``MultiDrizzle``
``AstroDrizzle`` automates the process of aligning images in an output frame,
identifying cosmic-rays, removing distortion, and then combining the images
after removing the identified cosmic-rays.
This process involves a number of steps, such as:
* P... | 10,978 | 34.762215 | 89 | py |
drizzlepac | drizzlepac-master/drizzlepac/createMedian.py | """
Create a median image from the singly drizzled images.
:Authors: Warren Hack, Mihai Cara
:License: :doc:`LICENSE`
"""
import os
import sys
import math
import numpy as np
from astropy.io import fits
from stsci.imagestats import ImageStats
from stsci.image import numcombine
from stsci.tools import iterfile, teal,... | 16,857 | 34.267782 | 79 | py |
drizzlepac | drizzlepac-master/drizzlepac/mapreg.py | """
This module provides functions for mapping DS9 region files given in sky
coordinates to DS9 region files specified in image coordinates
of multiple images using the WCS information from the images.
:Authors: Mihai Cara
:License: :doc:`LICENSE`
"""
from astropy.io import fits
import stregion as pyregion
import st... | 41,728 | 37.35386 | 91 | py |
drizzlepac | drizzlepac-master/drizzlepac/photeq.py | """
A tool to adjust data values of images by equalizing each chip's PHOTFLAM value
to a single common value so that all chips can be treated equally
by ``AstroDrizzle``.
:Authors: Mihai Cara
:License: :doc:`LICENSE`
"""
# HISTORY:
# v0.1 - 14-Aug-2015 - Initial release
# v0.2 - 06-Nov-2015 - Added doctstrings, log... | 24,476 | 37.790808 | 85 | py |
drizzlepac | drizzlepac-master/drizzlepac/updatenpol.py | #!/usr/bin/env python
# $Id: updatenpol.py 8609 2010-01-19 16:22:48Z hack $
"""
``updatenpol``::
Update the header of ACS file(s) with the names of new
``NPOLFILE`` and ``D2IMFILE`` reference files for use with the
AstroDrizzle.
:Authors: Warren Hack
:License: :doc:`LICENSE`
"""
__docformat__ = 'restr... | 13,308 | 35.067751 | 87 | py |
drizzlepac | drizzlepac-master/drizzlepac/run_config_utils.py | #!/usr/bin/env python
import pdb
import sys
from drizzlepac.haputils import config_utils
from drizzlepac.haputils import poller_utils
input_filename = sys.argv[1]
obs_info_dict, total_list = poller_utils.interpret_obset_input(input_filename)
out_pars_file = None
for total_item in total_list:
total_item.confi... | 1,225 | 24.541667 | 111 | py |
drizzlepac | drizzlepac-master/drizzlepac/tweakreg.py | """ ``TweakReg`` - A replacement for IRAF-based ``tweakshifts``
:Authors: Warren Hack, Mihai Cara
:License: :doc:`LICENSE`
"""
import os
import sys
import numpy as np
from copy import copy
from stsci.tools import parseinput, teal
from stsci.tools import logutil, textutil
from stsci.tools.cfgpars import DuplicateKey... | 33,212 | 38.258865 | 95 | py |
drizzlepac | drizzlepac-master/drizzlepac/imgclasses.py | """
Classes to keep track of all WCS and catalog information.
Used by ``TweakReg``.
:Authors: Warren Hack, Mihai Cara
:License: :doc:`LICENSE`
"""
import os
import sys
import copy
import numpy as np
from astropy import wcs as pywcs
from astropy.io import fits
from spherical_geometry.polygon import SphericalPolygon
... | 75,761 | 41.32514 | 171 | py |
drizzlepac | drizzlepac-master/drizzlepac/catalogs.py | """
:Authors: Warren Hack
:License: :doc:`LICENSE`
"""
import os, sys
import copy
import numpy as np
import astropy
from astropy import wcs as pywcs
import astropy.coordinates as coords
from astropy import units as u
from stsci.tools import logutil, textutil
from stsci.skypac.utils import basicFITScheck, get_extver_... | 29,115 | 36.28041 | 107 | py |
drizzlepac | drizzlepac-master/drizzlepac/make_custom_mosaic.py | #!/usr/bin/env python
""" make_custom_mosaic.py - Module to control the generation of user-defined multi-skycell mosaics. This
script extends the capabilities of the HAP multi-visit mosaics (MVM) processing code (hapmultisequencer.py).
Based on user input, this script will produce drizzle-combined mosaics that will be... | 24,259 | 49.227743 | 211 | py |
drizzlepac | drizzlepac-master/drizzlepac/staticMask.py | """
This module provides functions and classes that manage the creation
of the global static masks.
For ``staticMask``, the user interface function is :py:func:`createMask`.
:Authors: Ivo Busko, Christopher Hanley, Warren Hack, Megan Sosey
:License: :doc:`LICENSE`
"""
import os
import sys
import numpy as np
from s... | 9,673 | 32.707317 | 114 | py |
drizzlepac | drizzlepac-master/drizzlepac/wfpc2Data.py | """
``wfpc2Data`` module provides classes used to import WFPC2 specific instrument data.
:Authors: Warren Hack, Ivo Busko, Christopher Hanley
:License: :doc:`LICENSE`
"""
import copy
import os
import shutil
import glob
from astropy.io import fits
import numpy as np
from stsci.tools import fileutil, readgeis
from ... | 24,419 | 39.164474 | 147 | py |
drizzlepac | drizzlepac-master/drizzlepac/acsData.py | """
Class used to model ACS specific instrument data.
:Authors: Christopher Hanley, Warren Hack, Ivo Busko, David Grumm
:License: :doc:`LICENSE`
"""
from stsci.tools import fileutil
import numpy as np
from .imageObject import imageObject
class ACSInputImage(imageObject):
SEPARATOR = '_'
def __init__(self... | 11,942 | 41.960432 | 106 | py |
drizzlepac | drizzlepac-master/drizzlepac/skytopix.py | """ skytopix - A module to perform coordinate transformation from sky
to pixel coordinates.
:Authors: Warren Hack
:License: :doc:`LICENSE`
PARAMETERS
----------
input : str
full filename with path of input image, an extension name
['sci',1] should be provided if input is a mul... | 6,124 | 32.653846 | 97 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.