The kmos_extract_spec recipe
===============================================================

.. data:: kmos_extract_spec

Synopsis
--------

Extract a spectrum from a cube

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

This recipe extracts a spectrum from a datacube. The datacube is with or 
without noise). The output will be a similarly formatted FITS file.


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

   DO                    KMOS                                              
   category              Type   Explanation                Required #Frames
   --------              -----  -----------                -------- -------
   <none or any>         F3I    The datacubes                 Y        1   
   <none or any>         F2I    The mask                      N       0,1  

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

   DO                    KMOS
   category              Type   Explanation
   --------              -----  -----------
   EXTRACT_SPEC          F1I    Extracted spectrum                         
   EXTRACT_SPEC_MASK     F2I    (optional, if --save_mask=true and         
                            --mask_method='optimal': The calculated mask)  


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

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

   Create an object for the recipe kmos_extract_spec.

::

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

Parameters
----------

.. py:attribute:: kmos_extract_spec.param.mask_method

    Method used : mask, integrated or optimal (str; default: 'integrated') [default="integrated"].
.. py:attribute:: kmos_extract_spec.param.centre

    The centre of the circular mask (pixel) (str; default: '7.5,7.5') [default="7.5,7.5"].
.. py:attribute:: kmos_extract_spec.param.radius

    The radius of the circular mask (pixel) (float; default: 3.0) [default=3.0].
.. py:attribute:: kmos_extract_spec.param.save_mask

    Flag to save the mask (bool; default: False) [default=False].
.. py:attribute:: kmos_extract_spec.param.cmethod

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

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

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

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

    The number of maximum pixel values to clip with min/max-clipping.  (long; default: 1) [default=1].
.. py:attribute:: kmos_extract_spec.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
   kmos_extract_spec = cpl.Recipe("kmos_extract_spec")

   kmos_extract_spec.param.mask_method = "integrated"
   kmos_extract_spec.param.centre = "7.5,7.5"
   kmos_extract_spec.param.radius = 3.0
   kmos_extract_spec.param.save_mask = False
   kmos_extract_spec.param.cmethod = "ksigma"
   kmos_extract_spec.param.cpos_rej = 3.0
   kmos_extract_spec.param.cneg_rej = 3.0
   kmos_extract_spec.param.citer = 3
   kmos_extract_spec.param.cmax = 1
   kmos_extract_spec.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
   kmos_extract_spec = cpl.Recipe("kmos_extract_spec")
   [...]
   res = kmos_extract_spec( ..., param = {"mask_method":"integrated", "centre":"7.5,7.5"})


.. 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, Y. Jung <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 CRIRES 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, Inc., 59 Temple Place, Suite 330, Boston, 
MA  02111-1307  USA

.. codeauthor:: Alex Agudo Berbel, Y. Jung <usd-help@eso.org>
