The vmimstandard recipe
===============================================================

.. data:: vmimstandard

Synopsis
--------

Reduce an imaging standard star exposure.

Description
-----------

This recipe is used to determine the instrumental magnitude of the
stars matching the entries of a photometric catalog. The same procedure
applied by the recipe vmimobsstare is used to reduce the standard field
image. SExtractor v2.1.6 is used for the source detection task.


Input files
^^^^^^^^^^^^
::

  DO category:              Type:       Explanation:         Required:
  IMG_STANDARD              Raw         Standard stars image    Y
  MASTER_BIAS               Calib       Master bias             Y
  MASTER_DARK               Calib       Master dark             .

  IMG_MASTER_SKY_FLAT       Calib       Master sky flat         Y
  PHOTOMETRIC_CATALOG       Calib       Photometric catalog     Y
  PHOTOMETRIC_TABLE         Calib       Photometric table       Y
  CCD_TABLE                 Calib       Bad pixel table         .


Output files
^^^^^^^^^^^^
::

  DO category:              Data type:  Explanation:
  IMG_STAR_MATCH_TABLE      FITS table  List of found standard stars
  IMG_STANDARD_REDUCED      FITS image  Reduced scientific exposure
  IMG_GALAXY_TABLE          FITS table  List of detected objects

The galaxy table is the output of SExtractor converted into FITS
format. The star match table is the list of identified standard stars,
with their positions on sky and CCD and their instrumental and catalog
magnitudes.


For more details, please refer to the VIMOS Pipeline User's Guide.


Constructor
-----------

.. method:: cpl.Recipe("vmimstandard")
   :noindex:

   Create an object for the recipe vmimstandard.

::

   import cpl
   vmimstandard = cpl.Recipe("vmimstandard")

Parameters
----------

.. py:attribute:: vmimstandard.param.BiasMethod

    Bias removal method. (str; default: 'Zmaster') [default="Zmaster"].
.. py:attribute:: vmimstandard.param.CleanBadPixel

    Bad pixel correction on reduced science image. (bool; default: False) [default=False].
.. py:attribute:: vmimstandard.param.CleanCosmic

    Cosmic ray removal from input science image. (bool; default: True) [default=True].
.. py:attribute:: vmimstandard.param.CosmicsThreshold

    Threshold for cosmic ray candidate selection. (float; default: 4.0) [default=4.0].
.. py:attribute:: vmimstandard.param.CosmicsRatio

    Ratio for discrimination of objects and cosmics. (float; default: 2.0) [default=2.0].
.. py:attribute:: vmimstandard.param.MagLimit

    Magnitude upper limit for selection of detected objects. (float;  default: 100.0) [default=100.0].
.. py:attribute:: vmimstandard.param.StarIndex

    Stellarity index used to select stars in the image. (float; default:  0.01) [default=0.01].
.. py:attribute:: vmimstandard.param.MinStars

    Minimum number of stars required. (long; default: 3) [default=3].
.. py:attribute:: vmimstandard.param.SearchRadius

    Aperture used for object identification. (float; default: 5.0) [default=5.0].
.. py:attribute:: vmimstandard.param.MagInitial

    Magnitude tolerance for initial selection of matching stars. (float;  default: 2.5) [default=2.5].
.. py:attribute:: vmimstandard.param.MagFinal

    Magnitude tolerance for final selection of matching stars. (float;  default: 1.5) [default=1.5].
.. py:attribute:: vmimstandard.param.KSigmaClip

    Sigma clipping factor used when matching stars. (float; default: 2.0) [default=2.0].
.. py:attribute:: vmimstandard.param.TemperatureCheck

    Check beam temperature when updating the world coordinate system.  (bool; default: True) [default=True].
.. py:attribute:: vmimstandard.param.TemperatureTolerance

    Maximum allowed difference between beam and ambient temperature.  (float; default: 3.0) [default=3.0].
.. py:attribute:: vmimstandard.param.RemoteCatalog

    Enable online access to a catalog server. (Not yet implemented!)  (bool; default: False) [default=False].
.. py:attribute:: vmimstandard.param.ComputeQC

    Compute QC1 parameters (bool; default: True) [default=True].
.. py:attribute:: vmimstandard.param.ReduceAnyFrame

    Reduce any frame. (bool; default: True) [default=True].
.. py:attribute:: vmimstandard.param.SExtractor.AnalysisThresh

    Surface brightness threshold for FWHM computation. (float; default:  2.5) [default=2.5].
.. py:attribute:: vmimstandard.param.SExtractor.AssocData

    Column indices for columns to copy to the catalog output. (str;  default: '2,3,4') [default="2,3,4"].
.. py:attribute:: vmimstandard.param.SExtractor.AssocName

    Name of the ASSOC file. (str; default: 'sky.list') [default="sky.list"].
.. py:attribute:: vmimstandard.param.SExtractor.AssocParams

    Column indices in the ASSOC file to use as coordinates and weight for  cross-matching. (str; default: '2,3,4') [default="2,3,4"].
.. py:attribute:: vmimstandard.param.SExtractor.AssocRadius

    Search radius for ASSOC. (float; default: 2.0) [default=2.0].
.. py:attribute:: vmimstandard.param.SExtractor.AssocSelecType

    Output selector for detected sources. (str; default: 'MATCHED') [default="MATCHED"].
.. py:attribute:: vmimstandard.param.SExtractor.AssocType

    Method for cross-matching. (str; default: 'MAG_SUM') [default="MAG_SUM"].
.. py:attribute:: vmimstandard.param.SExtractor.BackFilterSize

    Size (in background meshes) of the background filtering mask. (long;  default: 3) [default=3].
.. py:attribute:: vmimstandard.param.SExtractor.BackPhotoThick

    Thickness of the background LOCAL annulus. (long; default: 24) [default=24].
.. py:attribute:: vmimstandard.param.SExtractor.BackPhotoType

    Select background for magnitude computation. (str; default: 'GLOBAL') [default="GLOBAL"].
.. py:attribute:: vmimstandard.param.SExtractor.BackSize

    Size of a background mesh. (long; default: 64) [default=64].
.. py:attribute:: vmimstandard.param.SExtractor.BackValue

    Constant to subtract from the images for MANUAL background  subtraction. (float; default: 0.0) [default=0.0].
.. py:attribute:: vmimstandard.param.SExtractor.CatalogType

    Select output catalog format (only ASCII_HEAD is supported). (str;  default: 'ASCII_HEAD') [default="ASCII_HEAD"].
.. py:attribute:: vmimstandard.param.SExtractor.CheckImageName

    Check image file name. (str; default: 'check.fits') [default="check.fits"].
.. py:attribute:: vmimstandard.param.SExtractor.CheckImageType

    Select information to put in the `check image'. (str; default: 'NONE') [default="NONE"].
.. py:attribute:: vmimstandard.param.SExtractor.Clean

    If `Y', clean catalog before writing. (str; default: 'Y') [default="Y"].
.. py:attribute:: vmimstandard.param.SExtractor.CleanParam

    Cleaning efficiency. (float; default: 1.0) [default=1.0].
.. py:attribute:: vmimstandard.param.SExtractor.DeblendMinCont

    Minimum contrast for deblending. (float; default: 0.005) [default=0.005].
.. py:attribute:: vmimstandard.param.SExtractor.DeblendNthresh

    Number of deblending sub-thresholds. (long; default: 32) [default=32].
.. py:attribute:: vmimstandard.param.SExtractor.DetectMinArea

    Minimum number of pixels above threshold triggering detection. (long;  default: 5) [default=5].
.. py:attribute:: vmimstandard.param.SExtractor.DetectThresh

    Detection threshold (relative to background RMS). (float; default:  2.0) [default=2.0].
.. py:attribute:: vmimstandard.param.SExtractor.DetectType

    Device type the image originates from. (str; default: 'CCD') [default="CCD"].
.. py:attribute:: vmimstandard.param.SExtractor.Filter

    If `Y', filter data before extraction. (str; default: 'N') [default="N"].
.. py:attribute:: vmimstandard.param.SExtractor.FilterName

    Name of the file containing the filter definition. (str; default:  '/usr/share/esopipes/vimos-2.9.9/config/vimos.conv') [default="/usr/share/esopipes/vimos-2.9.9/config/vimos.conv"].
.. py:attribute:: vmimstandard.param.SExtractor.FilterThresh

    Lower, upper threshold (in background sigmas) for filtering (retina-  filtering only). (str; default: '') [default=""].
.. py:attribute:: vmimstandard.param.SExtractor.FlagImage

    Flag image file name. (str; default: 'flag.fits') [default="flag.fits"].
.. py:attribute:: vmimstandard.param.SExtractor.FlagType

    Flag combination method. (str; default: 'OR') [default="OR"].
.. py:attribute:: vmimstandard.param.SExtractor.InterpMaxXlag

    Maximum X gap allowed in interpolation. (long; default: 16) [default=16].
.. py:attribute:: vmimstandard.param.SExtractor.InterpMaxYlag

    Maximum Y gap allowed in interpolation. (long; default: 16) [default=16].
.. py:attribute:: vmimstandard.param.SExtractor.InterpType

    Interpolation method. (str; default: 'ALL') [default="ALL"].
.. py:attribute:: vmimstandard.param.SExtractor.MagGamma

    Gamma of emulsion (only used in PHOTO mode). (float; default: 4.0) [default=4.0].
.. py:attribute:: vmimstandard.param.SExtractor.MagZeropoint

    Zero-point offset to apply to magnitudes. (float; default: 0.0) [default=0.0].
.. py:attribute:: vmimstandard.param.SExtractor.MaskType

    Masking of neighbours for photometry. (str; default: 'CORRECT') [default="CORRECT"].
.. py:attribute:: vmimstandard.param.SExtractor.MemoryBufSize

    Number of scan-lines in the image buffer. (long; default: 1024) [default=1024].
.. py:attribute:: vmimstandard.param.SExtractor.MemoryObjStack

    Maximum number of objects the object stack can contain. (long;  default: 2000) [default=2000].
.. py:attribute:: vmimstandard.param.SExtractor.MemoryPixStack

    Maximum number of pixels the pixel stack can contain. (long; default:  100000) [default=100000].
.. py:attribute:: vmimstandard.param.SExtractor.PhotApertures

    Aperture diameters used for MAG_APER. (float; default: 5.0) [default=5.0].
.. py:attribute:: vmimstandard.param.SExtractor.PhotAutoParams

    MAG_AUTO controls: 1st order moment scaling parameter, minimum Rmin.  (str; default: '2.5,3.5') [default="2.5,3.5"].
.. py:attribute:: vmimstandard.param.SExtractor.SExtractor

    Path to the sextractor executable. (str; default: '/usr/bin/sex') [default="/usr/bin/sex"].
.. py:attribute:: vmimstandard.param.SExtractor.SaturLevel

    Pixel values above are considered saturated. (float; default: 60000.0) [default=60000.0].
.. py:attribute:: vmimstandard.param.SExtractor.StarNnwName

    Name of the neuronal network weights file. (str; default:  '/usr/share/esopipes/vimos-2.9.9/config/vimos.nnw') [default="/usr/share/esopipes/vimos-2.9.9/config/vimos.nnw"].
.. py:attribute:: vmimstandard.param.SExtractor.Timeout

    Time after which sextractor will be aborted. (float; default: 300.0) [default=300.0].
.. py:attribute:: vmimstandard.param.SExtractor.VerboseType

    Selects verbosity level. (str; default: 'QUIET') [default="QUIET"].
.. py:attribute:: vmimstandard.param.SExtractor.WeightType

    Selects the weighting scheme. (str; default: 'NONE') [default="NONE"].
.. py:attribute:: vmimstandard.param.SExtractor.Window

    Frame window used in SExtractor detection. (str; default:  '100,100,1948,2340') [default="100,100,1948,2340"].


The following code snippet shows the default settings for the available 
parameters.

::

   import cpl
   vmimstandard = cpl.Recipe("vmimstandard")

   vmimstandard.param.BiasMethod = "Zmaster"
   vmimstandard.param.CleanBadPixel = False
   vmimstandard.param.CleanCosmic = True
   vmimstandard.param.CosmicsThreshold = 4.0
   vmimstandard.param.CosmicsRatio = 2.0
   vmimstandard.param.MagLimit = 100.0
   vmimstandard.param.StarIndex = 0.01
   vmimstandard.param.MinStars = 3
   vmimstandard.param.SearchRadius = 5.0
   vmimstandard.param.MagInitial = 2.5
   vmimstandard.param.MagFinal = 1.5
   vmimstandard.param.KSigmaClip = 2.0
   vmimstandard.param.TemperatureCheck = True
   vmimstandard.param.TemperatureTolerance = 3.0
   vmimstandard.param.RemoteCatalog = False
   vmimstandard.param.ComputeQC = True
   vmimstandard.param.ReduceAnyFrame = True
   vmimstandard.param.SExtractor.AnalysisThresh = 2.5
   vmimstandard.param.SExtractor.AssocData = "2,3,4"
   vmimstandard.param.SExtractor.AssocName = "sky.list"
   vmimstandard.param.SExtractor.AssocParams = "2,3,4"
   vmimstandard.param.SExtractor.AssocRadius = 2.0
   vmimstandard.param.SExtractor.AssocSelecType = "MATCHED"
   vmimstandard.param.SExtractor.AssocType = "MAG_SUM"
   vmimstandard.param.SExtractor.BackFilterSize = 3
   vmimstandard.param.SExtractor.BackPhotoThick = 24
   vmimstandard.param.SExtractor.BackPhotoType = "GLOBAL"
   vmimstandard.param.SExtractor.BackSize = 64
   vmimstandard.param.SExtractor.BackValue = 0.0
   vmimstandard.param.SExtractor.CatalogType = "ASCII_HEAD"
   vmimstandard.param.SExtractor.CheckImageName = "check.fits"
   vmimstandard.param.SExtractor.CheckImageType = "NONE"
   vmimstandard.param.SExtractor.Clean = "Y"
   vmimstandard.param.SExtractor.CleanParam = 1.0
   vmimstandard.param.SExtractor.DeblendMinCont = 0.005
   vmimstandard.param.SExtractor.DeblendNthresh = 32
   vmimstandard.param.SExtractor.DetectMinArea = 5
   vmimstandard.param.SExtractor.DetectThresh = 2.0
   vmimstandard.param.SExtractor.DetectType = "CCD"
   vmimstandard.param.SExtractor.Filter = "N"
   vmimstandard.param.SExtractor.FilterName = "/usr/share/esopipes/vimos-2.9.9/config/vimos.conv"
   vmimstandard.param.SExtractor.FilterThresh = ""
   vmimstandard.param.SExtractor.FlagImage = "flag.fits"
   vmimstandard.param.SExtractor.FlagType = "OR"
   vmimstandard.param.SExtractor.InterpMaxXlag = 16
   vmimstandard.param.SExtractor.InterpMaxYlag = 16
   vmimstandard.param.SExtractor.InterpType = "ALL"
   vmimstandard.param.SExtractor.MagGamma = 4.0
   vmimstandard.param.SExtractor.MagZeropoint = 0.0
   vmimstandard.param.SExtractor.MaskType = "CORRECT"
   vmimstandard.param.SExtractor.MemoryBufSize = 1024
   vmimstandard.param.SExtractor.MemoryObjStack = 2000
   vmimstandard.param.SExtractor.MemoryPixStack = 100000
   vmimstandard.param.SExtractor.PhotApertures = 5.0
   vmimstandard.param.SExtractor.PhotAutoParams = "2.5,3.5"
   vmimstandard.param.SExtractor.SExtractor = "/usr/bin/sex"
   vmimstandard.param.SExtractor.SaturLevel = 60000.0
   vmimstandard.param.SExtractor.StarNnwName = "/usr/share/esopipes/vimos-2.9.9/config/vimos.nnw"
   vmimstandard.param.SExtractor.Timeout = 300.0
   vmimstandard.param.SExtractor.VerboseType = "QUIET"
   vmimstandard.param.SExtractor.WeightType = "NONE"
   vmimstandard.param.SExtractor.Window = "100,100,1948,2340"


You may also set or overwrite some or all parameters by the recipe 
parameter `param`, as shown in the following example:

::

   import cpl
   vmimstandard = cpl.Recipe("vmimstandard")
   [...]
   res = vmimstandard( ..., param = {"BiasMethod":"Zmaster", "CleanBadPixel":False})


.. seealso:: `cpl.Recipe <http://packages.python.org/python-cpl/recipe.html>`_
   for more information about the recipe object.

Bug reports
-----------

Please report any problems to `ESO VIMOS Pipeline Team and VIMOS Consortium <usd-help@eso.org>`_. Alternatively, you may 
send a report to the `ESO User Support Department <usd-help@eso.org>`_.

Copyright
---------

This file is currently part of the VIMOS Instrument Pipeline
Copyright (C) 2002-2011 European Southern Observatory

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA


.. codeauthor:: ESO VIMOS Pipeline Team and VIMOS Consortium <usd-help@eso.org>
