The vmimflatsky recipe
===============================================================

.. data:: vmimflatsky

Synopsis
--------

Create a master sky flat field from set of raw sky flat field frames.

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

This recipe is used to create a master sky flat field from a set of
raw sky flat fields. The master sky flat field is the dataset used
for the flat field correction of scientific data.


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

  DO category:              Type:       Explanation:         Required:
  IMG_SKY_FLAT              Raw         Sky flat exposure       Y
  MASTER_BIAS               Calib       Master bias             Y
  MASTER_DARK               Calib       Master dark             .

  IMG_MASTER_SCREEN_FLAT    Calib       Master screen flat      .

  CCD_TABLE                 Calib       Bad pixel table         .


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

  DO category:              Data type:  Explanation:
  IMG_MASTER_SKY_FLAT       FITS image  Master sky flat field

If a master screen flat is specified, the input sky flat exposures
are flat-fielded with it, and then just used to determine the large
scale trends of the instrument response; the result is then multiplied
by the master screen flat. A CCD table must be specified in input only
if a bad pixel cleaning is requested.


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


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

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

   Create an object for the recipe vmimflatsky.

::

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

Parameters
----------

.. py:attribute:: vmimflatsky.param.SmoothBoxSize

    Size of running box used for smoothing (int; default: 7) [default=7].
.. py:attribute:: vmimflatsky.param.SmoothMethod

    Smooth method for image trends removal (str; default: 'Median') [default="Median"].
.. py:attribute:: vmimflatsky.param.AllowSingleFrames

    Frame combination method is ignored. (bool; default: True) [default=True].
.. py:attribute:: vmimflatsky.param.StackMethod

    Frames combination method (str; default: 'Median') [default="Median"].
.. py:attribute:: vmimflatsky.param.KSigmaLow

    Low threshold for K-sigma clipping method (float; default: 5.0) [default=5.0].
.. py:attribute:: vmimflatsky.param.KSigmaHigh

    High threshold for K-sigma clipping method (float; default: 5.0) [default=5.0].
.. py:attribute:: vmimflatsky.param.MinRejection

    Number of lowest rejected values for rejection method (int; default:  1) [default=1].
.. py:attribute:: vmimflatsky.param.MaxRejection

    Number of highest rejected values for rejection method (int; default:  1) [default=1].
.. py:attribute:: vmimflatsky.param.BiasMethod

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

    Bad pixel correction on master flat (bool; default: False) [default=False].
.. py:attribute:: vmimflatsky.param.CleanCosmic

    Cosmic ray events cleaning from raw flats (bool; default: False) [default=False].
.. py:attribute:: vmimflatsky.param.CosmicThreshold

    Threshold to identify cosmic rays candidates. (float; default: 4.0) [default=4.0].
.. py:attribute:: vmimflatsky.param.CosmicRatio

    Min ratio between peak and nearby pixels for a cosmic ray. (float;  default: 2.0) [default=2.0].
.. py:attribute:: vmimflatsky.param.ComputeQC

    Compute QC1 parameters. (bool; default: True) [default=True].


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

::

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

   vmimflatsky.param.SmoothBoxSize = 7
   vmimflatsky.param.SmoothMethod = "Median"
   vmimflatsky.param.AllowSingleFrames = True
   vmimflatsky.param.StackMethod = "Median"
   vmimflatsky.param.KSigmaLow = 5.0
   vmimflatsky.param.KSigmaHigh = 5.0
   vmimflatsky.param.MinRejection = 1
   vmimflatsky.param.MaxRejection = 1
   vmimflatsky.param.BiasMethod = "Zmaster"
   vmimflatsky.param.CleanBadPixel = False
   vmimflatsky.param.CleanCosmic = False
   vmimflatsky.param.CosmicThreshold = 4.0
   vmimflatsky.param.CosmicRatio = 2.0
   vmimflatsky.param.ComputeQC = True


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

::

   import cpl
   vmimflatsky = cpl.Recipe("vmimflatsky")
   [...]
   res = vmimflatsky( ..., param = {"SmoothBoxSize":7, "SmoothMethod":"Median"})


.. seealso:: `cpl.Recipe <https://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 <usd-help@eso.org>`_. Alternatively, you may 
send a report to the `ESO User Support Department <usd-help@eso.org>`_.

Copyright
---------

This file is part of the VIMOS Instrument Pipeline
Copyright (C) 2002-2005 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 <usd-help@eso.org>
