The kmo_dark recipe
===============================================================

.. data:: kmo_dark

Synopsis
--------

Create master dark frame & bad pixel mask

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

This recipe calculates the master dark frame.


It is recommended to provide three or more dark exposures to produce a reason-
able master with associated noise.


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

   DO                   KMOS                                                   
   category             Type   Explanation                     Required #Frames
   --------             -----  -----------                     -------- -------
   DARK                 RAW    Dark exposures                     Y       1-n  
                               (at least 3 frames recommended)                 

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

   DO                   KMOS
   category             Type   Explanation
   --------             -----  -----------
   MASTER_DARK          F2D    Calculated master dark frames

   BADPIXEL_DARK        B2D    Associated badpixel frames


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

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

   Create an object for the recipe kmo_dark.

::

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

Parameters
----------

.. py:attribute:: kmo_dark.param.pos_bad_pix_rej

    The positive rejection threshold for bad pixels (float; default: 50.0) [default=50.0].
.. py:attribute:: kmo_dark.param.neg_bad_pix_rej

    The negative rejection threshold for bad pixels (float; default: 50.0) [default=50.0].
.. py:attribute:: kmo_dark.param.file_extension

    Controls if EXPTIME keyword should be appended to product filenames.  (bool; default: False) [default=False].
.. py:attribute:: kmo_dark.param.cmethod

    Either apply "average", "median", "sum", "min_max." or "ksigma". (str;  default: 'ksigma') [default="ksigma"].
.. py:attribute:: kmo_dark.param.cpos_rej

    The positive rejection threshold for kappa-sigma-clipping (sigma).  (float; default: 3.0) [default=3.0].
.. py:attribute:: kmo_dark.param.cneg_rej

    The negative rejection threshold for kappa-sigma-clipping (sigma).  (float; default: 3.0) [default=3.0].
.. py:attribute:: kmo_dark.param.citer

    The number of iterations for kappa-sigma-clipping. (long; default: 3) [default=3].
.. py:attribute:: kmo_dark.param.cmax

    The number of maximum pixel values to clip with min/max-clipping.  (long; default: 1) [default=1].
.. py:attribute:: kmo_dark.param.cmin

    The number of minimum pixel values to clip with min/max-clipping.  (long; default: 1) [default=1].


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

::

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

   kmo_dark.param.pos_bad_pix_rej = 50.0
   kmo_dark.param.neg_bad_pix_rej = 50.0
   kmo_dark.param.file_extension = False
   kmo_dark.param.cmethod = "ksigma"
   kmo_dark.param.cpos_rej = 3.0
   kmo_dark.param.cneg_rej = 3.0
   kmo_dark.param.citer = 3
   kmo_dark.param.cmax = 1
   kmo_dark.param.cmin = 1


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

::

   import cpl
   kmo_dark = cpl.Recipe("kmo_dark")
   [...]
   res = kmo_dark( ..., param = {"pos_bad_pix_rej":50.0, "neg_bad_pix_rej":50.0})


.. 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 `Alex Agudo Berbel <kmos-spark@mpe.mpg.de>`_. Alternatively, you may 
send a report to the `ESO User Support Department <usd-help@eso.org>`_.

Copyright
---------

This file is part of the KMOS Instrument Pipeline
Copyright (C) 2002,2003 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, 51 Franklin Street, Suite 500, Boston, MA  02110-1335  USA

.. codeauthor:: Alex Agudo Berbel <kmos-spark@mpe.mpg.de>
