Пример #1
0
import os
import sys

import numpy as np
from stsci.tools import fileutil, teal, logutil
from astropy.io import fits
from stsci.imagestats import ImageStats
from . import util
from . import processInput


__taskname__ = "drizzlepac.staticMask"
_step_num_ = 1


log = logutil.create_logger(__name__)


#this is called by the user
def createMask(input=None, static_sig=4.0, group=None, editpars=False, configObj=None, **inputDict):
    """ The user can input a list of images if they like to create static masks
        as well as optional values for static_sig and inputDict.

        The configObj.cfg file will set the defaults and then override them
        with the user options.
    """

    if input is not None:
        inputDict["static_sig"]=static_sig
        inputDict["group"]=group
        inputDict["updatewcs"]=False
Пример #2
0
from photutils import detect_sources, source_properties, deblend_sources
from photutils import Background2D, MedianBackground
from photutils import DAOStarFinder
from tweakwcs import FITSWCS
from stwcs.distortion import utils
from stwcs import wcsutil
from stsci.tools import fileutil as fu
from stsci.tools import parseinput
from stsci.tools import logutil
import pysynphot as S

from ..tweakutils import build_xy_zeropoint

__taskname__ = 'astrometric_utils'

log = logutil.create_logger(__name__, level=logutil.logging.INFO, stream=sys.stdout)



ASTROMETRIC_CAT_ENVVAR = "ASTROMETRIC_CATALOG_URL"
DEF_CAT_URL = 'http://gsss.stsci.edu/webservices'

if ASTROMETRIC_CAT_ENVVAR in os.environ:
    SERVICELOCATION = os.environ[ASTROMETRIC_CAT_ENVVAR]
else:
    SERVICELOCATION = DEF_CAT_URL

MODULE_PATH = os.path.dirname(inspect.getfile(inspect.currentframe()))
VEGASPEC = os.path.join(os.path.dirname(MODULE_PATH),
                        'data','alpha_lyr_stis_008.fits')
Пример #3
0
from . import tweakutils
from . import imgclasses
from . import catalogs
from . import imagefindpars
from . import refimagefindpars

__taskname__ = 'tweakreg' # unless someone comes up with anything better

PSET_SECTION        = '_SOURCE FINDING PARS_'
PSET_SECTION_REFIMG = '_REF IMAGE SOURCE FINDING PARS_'
# !! Use pre and post underscores to hide this added section in TEAL, so that
# TEAL allows its data to stay alongside the expected data during a call to
# TweakReg().  All of this needs to be revisited.

log = logutil.create_logger(__name__, level=logutil.logging.NOTSET)


def _managePsets(configobj, section_name, task_name, iparsobj=None, input_dict=None):
    """ Read in parameter values from PSET-like configobj tasks defined for
        source-finding algorithms, and any other PSET-like tasks under this task,
        and merge those values into the input configobj dictionary.
    """
    # Merge all configobj instances into a single object
    configobj[section_name] = {}

    # Load the default full set of configuration parameters for the PSET:
    iparsobj_cfg = teal.load(task_name)

    # Identify optional parameters in input_dicts that are from this
    # PSET and add it to iparsobj:
Пример #4
0
import shutil

from stsci.tools import logutil
from astropy.io import fits

from .. import astrodrizzle
from .. import wcs_functions
from . import align_utils
from . import astrometric_utils as amutils
from . import cell_utils

MSG_DATEFMT = '%Y%j%H%M%S'
SPLUNK_MSG_FORMAT = '%(asctime)s %(levelname)s src=%(name)s- %(message)s'
log = logutil.create_logger(__name__,
                            level=logutil.logging.NOTSET,
                            stream=sys.stdout,
                            format=SPLUNK_MSG_FORMAT,
                            datefmt=MSG_DATEFMT)


class HAPProduct:
    """ HAPProduct is the base class for the various products generated during the
        astrometry update and mosaicing of image data.
    """
    def __init__(self, prop_id, obset_id, instrument, detector, filename,
                 filetype, log_level):
        # set logging level to user-specified level
        log.setLevel(log_level)

        # Make sure the proposal ID is a 5-character string
        self.prop_id = prop_id.zfill(5)
Пример #5
0
:Authors: Warren Hack, Mihai Cara

:License: `<http://www.stsci.edu/resources/software_hardware/pyraf/LICENSE>`_

"""
from __future__ import division, print_function
import numpy as np
from numpy import linalg as npla
from stsci.tools import logutil

# This is specifically NOT intended to match the package-wide version information.
__version__ = '0.4.0'
__version_date__ = '10-Oct-2014'

log = logutil.create_logger(__name__)

if hasattr(np, 'float128'):
    ndfloat128 = np.float128
elif hasattr(np, 'float96'):
    ndfloat128 = np.float96
else:
    ndfloat128 = np.float64


def RADTODEG(rad):
    return (rad * 180. / np.pi)


def DEGTORAD(deg):
    return (deg * np.pi / 180.)
Пример #6
0
from stwcs import wcsutil
from stsci.tools import parseinput, logutil
from stsci.skypac.utils import get_ext_list, ext2str

from . import updatehdr
from . import linearfit
from . import util

__taskname__ = 'tweakback'  # unless someone comes up with anything better

# This is specifically NOT intended to match the package-wide version information.
__version__ = '0.4.0'
__version_date__ = '14-Oct-2014'

log = logutil.create_logger(__name__, level=logutil.logging.NOTSET)

if hasattr(np, 'float128'):
    ndfloat128 = np.float128
elif hasattr(np, 'float96'):
    ndfloat128 = np.float96
else:
    ndfloat128 = np.float64


#### Primary function
def tweakback(drzfile,
              input=None,
              origwcs=None,
              newname=None,
              wcsname=None,
Пример #7
0
from . import photometry_tools

try:
    from matplotlib import pyplot as plt
except Exception:
    plt = None

# Default background determination parameter values
BKG_BOX_SIZE = 50
BKG_FILTER_SIZE = 3
CATALOG_TYPES = ['aperture', 'segment']

__taskname__ = 'catalog_utils'

log = logutil.create_logger(__name__,
                            level=logutil.logging.INFO,
                            stream=sys.stdout)


class CatalogImage:
    def __init__(self, filename):
        if isinstance(filename, str):
            self.imghdu = fits.open(filename)
            self.imgname = filename
        else:
            self.imghdu = filename
            self.imgname = filename.filename()

        # Get header information to annotate the output catalogs
        if "total" in self.imgname:
            self.ghd_product = "tdp"
Пример #8
0
from astropy.io import fits
import drizzlepac
from drizzlepac import alignimages
from drizzlepac import astrodrizzle
from drizzlepac import wcs_functions
from drizzlepac.hlautils.catalog_utils import HAPCatalogs
from drizzlepac.hlautils import config_utils
from drizzlepac.hlautils import poller_utils
from drizzlepac.hlautils import processing_utils as proc_utils
from drizzlepac.hlautils import sourcelist_generation
from stsci.tools import logutil

__taskname__ = 'hapsequencer'
log = logutil.create_logger('hapsequencer',
                            level=logutil.logging.INFO,
                            stream=sys.stdout)

__version__ = 0.1
__version_date__ = '19-Mar-2019'

# ----------------------------------------------------------------------------------------------------------------------
# set up instrument/detector-specific params
# Parameters imported from the following HLA classic parameter files:
# - https://grit.stsci.edu/HLA/hla/tree/master/software/trunk/HLApipeline/HLApipe/param/parameter_acs_hrc.cfg
# - https://grit.stsci.edu/HLA/hla/tree/master/software/trunk/HLApipeline/HLApipe/param/parameter_acs_sbc.cfg
# - https://grit.stsci.edu/HLA/hla/tree/master/software/trunk/HLApipeline/HLApipe/param/parameter_acs_wfc.cfg
# - https://grit.stsci.edu/HLA/hla/tree/master/software/trunk/HLApipeline/HLApipe/param/parameter_wfc3_ir.cfg
# - https://grit.stsci.edu/HLA/hla/tree/master/software/trunk/HLApipeline/HLApipe/param/parameter_wfc3_uvis.cfg

param_dict = {