Source code for pipeline.hif.cli.hif_makeimages

##################### generated by xml-casa (v2) from hif_makeimages.xml ############
##################### fffd9c21ccdc54826e983dd468a2484d ##############################
from __future__ import absolute_import
import numpy
from casatools.typecheck import CasaValidator as _val_ctor
_pc = _val_ctor( )
from casatools.coercetype import coerce as _coerce
from .private.task_hif_makeimages import hif_makeimages as _hif_makeimages_t
from casatasks.private.task_logging import start_log as _start_log
from casatasks.private.task_logging import end_log as _end_log

class _hif_makeimages:
    """
    hif_makeimages ---- Compute clean map

    
    Compute clean results from a list of specified targets.
    
    Output:
    
    results -- If pipeline mode is 'getinputs' then None is returned. Otherwise
    the results object for the pipeline task is returned.

    --------- parameter descriptions ---------------------------------------------

    vis                     The list of input MeasurementSets. Defaults to the list of
                            MeasurementSets specified in the h_init or hif_importdata task.
                            '': use all MeasurementSets in the context
                            
                            Examples: 'ngc5921.ms', ['ngc5921a.ms', ngc5921b.ms', 'ngc5921c.ms']
    target_list             Dictionary specifying targets to be imaged; blank will read list from context
    hm_masking              Clean masking mode. Options are 'centralregion', 'auto',
                            'manual' and 'none'
    hm_sidelobethreshold    sidelobethreshold * the max sidelobe level
    hm_noisethreshold       noisethreshold * rms in residual image
    hm_lownoisethreshold    lownoisethreshold * rms in residual image
    hm_negativethreshold    negativethreshold * rms in residual image
    hm_minbeamfrac          Minimum beam fraction for pruning
    hm_growiterations       Number of binary dilation iterations for growing the mask
    hm_dogrowprune          Do pruning on the grow mask
    hm_minpercentchange     Mask size change threshold
    hm_fastnoise            Faster noise calucation for automask or nsigma stopping
    hm_nsigma               Multiplicative factor for rms-based threshold stopping
    hm_perchanweightdensity Calculate the weight density for each channel independently
    hm_npixels              Number of pixels to determine uv-cell size for super-uniform weighting
    hm_cyclefactor          Scaling on PSF sidelobe level to compute the minor-cycle stopping threshold
    hm_minpsffraction       PSF fraction that marks the max depth of cleaning in the minor cycle
    hm_maxpsffraction       PSF fraction that marks the minimum depth of cleaning in the minor cycle
    hm_cleaning             Pipeline cleaning mode
    tlimit                  Times the sensitivity limit for cleaning
    masklimit               Times good mask pixels for cleaning
    cleancontranges         Clean continuum frequency ranges in cubes
    calcsb                  Force (re-)calculation of sensitivities and beams
    mosweight               Mosaic weighting
    overwrite_on_export     Replace existing image products when h/hifa/hifv_exportdata is
                            called.
                            If False, images that would have the same FITS name on export,
                            are amended to include a version number.  For example, if
                            oussid.J1248-4559_ph.spw21.mfs.I.pbcor.fits would already be
                            exported by a previous call to hif_makeimags, then
                            'oussid.J1248-4559_ph.spw21.mfs.I.pbcor.v2.fits' would also be
                            exported to the products/ directory. The first exported
                            product retains the same name.  Additional products start
                            counting with 'v2', 'v3', etc.
    parallel                Clean images using MPI cluster
    pipelinemode            The pipeline operating mode.
                            In 'automatic' mode the pipeline determines the values of all
                            context defined pipeline inputs automatically.
                            In 'interactive' mode the user can set the pipeline context
                            defined parameters manually.
                            In 'getinputs' mode the user can check the settings of all
                            pipeline parameters without running the task.
    dryrun                  Run the task (False) or just display the command (True)
    acceptresults           Add the results to the pipeline context

    --------- examples -----------------------------------------------------------

    


    """

    _info_group_ = """pipeline"""
    _info_desc_ = """Compute clean map"""

    def __call__( self, vis=[  ], target_list=[ ], hm_masking='auto', hm_sidelobethreshold=float(-999.0), hm_noisethreshold=float(-999.0), hm_lownoisethreshold=float(-999.0), hm_negativethreshold=float(-999.0), hm_minbeamfrac=float(-999.0), hm_growiterations=int(-999), hm_dogrowprune=True, hm_minpercentchange=float(-999.0), hm_fastnoise=True, hm_nsigma=float(0.0), hm_perchanweightdensity=False, hm_npixels=int(0), hm_cyclefactor=float(-999.0), hm_minpsffraction=float(-999.0), hm_maxpsffraction=float(-999.0), hm_cleaning='', tlimit=float(2.0), masklimit=int(4), cleancontranges=False, calcsb=False, mosweight=False, overwrite_on_export=True, parallel='automatic', pipelinemode='automatic', dryrun=False, acceptresults=True ):
        schema = {'vis': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'target_list': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'hm_masking': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'none', 'auto', 'manual', 'centralregion', '' ]}, 'hm_sidelobethreshold': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'hm_noisethreshold': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'hm_lownoisethreshold': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'hm_negativethreshold': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'hm_minbeamfrac': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'hm_growiterations': {'type': 'cInt'}, 'hm_dogrowprune': {'type': 'cBool'}, 'hm_minpercentchange': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'hm_fastnoise': {'type': 'cBool'}, 'hm_nsigma': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'hm_perchanweightdensity': {'type': 'cBool'}, 'hm_npixels': {'type': 'cInt'}, 'hm_cyclefactor': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'hm_minpsffraction': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'hm_maxpsffraction': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'hm_cleaning': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'timesmask', 'sensitivity', 'manual', 'rms', '' ]}, 'tlimit': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'masklimit': {'type': 'cInt'}, 'cleancontranges': {'type': 'cBool'}, 'calcsb': {'type': 'cBool'}, 'mosweight': {'type': 'cBool'}, 'overwrite_on_export': {'type': 'cBool'}, 'parallel': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'automatic', 'true', 'false' ]}, 'pipelinemode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'automatic', 'interactive', 'getinputs' ]}, 'dryrun': {'type': 'cBool'}, 'acceptresults': {'type': 'cBool'}}
        doc = {'vis': vis, 'target_list': target_list, 'hm_masking': hm_masking, 'hm_sidelobethreshold': hm_sidelobethreshold, 'hm_noisethreshold': hm_noisethreshold, 'hm_lownoisethreshold': hm_lownoisethreshold, 'hm_negativethreshold': hm_negativethreshold, 'hm_minbeamfrac': hm_minbeamfrac, 'hm_growiterations': hm_growiterations, 'hm_dogrowprune': hm_dogrowprune, 'hm_minpercentchange': hm_minpercentchange, 'hm_fastnoise': hm_fastnoise, 'hm_nsigma': hm_nsigma, 'hm_perchanweightdensity': hm_perchanweightdensity, 'hm_npixels': hm_npixels, 'hm_cyclefactor': hm_cyclefactor, 'hm_minpsffraction': hm_minpsffraction, 'hm_maxpsffraction': hm_maxpsffraction, 'hm_cleaning': hm_cleaning, 'tlimit': tlimit, 'masklimit': masklimit, 'cleancontranges': cleancontranges, 'calcsb': calcsb, 'mosweight': mosweight, 'overwrite_on_export': overwrite_on_export, 'parallel': parallel, 'pipelinemode': pipelinemode, 'dryrun': dryrun, 'acceptresults': acceptresults}
        assert _pc.validate(doc,schema), str(_pc.errors)
        _logging_state_ = _start_log( 'hif_makeimages', [ 'vis=' + repr(_pc.document['vis']), 'target_list=' + repr(_pc.document['target_list']), 'hm_masking=' + repr(_pc.document['hm_masking']), 'hm_sidelobethreshold=' + repr(_pc.document['hm_sidelobethreshold']), 'hm_noisethreshold=' + repr(_pc.document['hm_noisethreshold']), 'hm_lownoisethreshold=' + repr(_pc.document['hm_lownoisethreshold']), 'hm_negativethreshold=' + repr(_pc.document['hm_negativethreshold']), 'hm_minbeamfrac=' + repr(_pc.document['hm_minbeamfrac']), 'hm_growiterations=' + repr(_pc.document['hm_growiterations']), 'hm_dogrowprune=' + repr(_pc.document['hm_dogrowprune']), 'hm_minpercentchange=' + repr(_pc.document['hm_minpercentchange']), 'hm_fastnoise=' + repr(_pc.document['hm_fastnoise']), 'hm_nsigma=' + repr(_pc.document['hm_nsigma']), 'hm_perchanweightdensity=' + repr(_pc.document['hm_perchanweightdensity']), 'hm_npixels=' + repr(_pc.document['hm_npixels']), 'hm_cyclefactor=' + repr(_pc.document['hm_cyclefactor']), 'hm_minpsffraction=' + repr(_pc.document['hm_minpsffraction']), 'hm_maxpsffraction=' + repr(_pc.document['hm_maxpsffraction']), 'hm_cleaning=' + repr(_pc.document['hm_cleaning']), 'tlimit=' + repr(_pc.document['tlimit']), 'masklimit=' + repr(_pc.document['masklimit']), 'cleancontranges=' + repr(_pc.document['cleancontranges']), 'calcsb=' + repr(_pc.document['calcsb']), 'mosweight=' + repr(_pc.document['mosweight']), 'overwrite_on_export=' + repr(_pc.document['overwrite_on_export']), 'parallel=' + repr(_pc.document['parallel']), 'pipelinemode=' + repr(_pc.document['pipelinemode']), 'dryrun=' + repr(_pc.document['dryrun']), 'acceptresults=' + repr(_pc.document['acceptresults']) ] )
        return _end_log( _logging_state_, 'hif_makeimages', _hif_makeimages_t( _pc.document['vis'], _pc.document['target_list'], _pc.document['hm_masking'], _pc.document['hm_sidelobethreshold'], _pc.document['hm_noisethreshold'], _pc.document['hm_lownoisethreshold'], _pc.document['hm_negativethreshold'], _pc.document['hm_minbeamfrac'], _pc.document['hm_growiterations'], _pc.document['hm_dogrowprune'], _pc.document['hm_minpercentchange'], _pc.document['hm_fastnoise'], _pc.document['hm_nsigma'], _pc.document['hm_perchanweightdensity'], _pc.document['hm_npixels'], _pc.document['hm_cyclefactor'], _pc.document['hm_minpsffraction'], _pc.document['hm_maxpsffraction'], _pc.document['hm_cleaning'], _pc.document['tlimit'], _pc.document['masklimit'], _pc.document['cleancontranges'], _pc.document['calcsb'], _pc.document['mosweight'], _pc.document['overwrite_on_export'], _pc.document['parallel'], _pc.document['pipelinemode'], _pc.document['dryrun'], _pc.document['acceptresults'] ) )

hif_makeimages = _hif_makeimages( )