The kmo_fits_stack recipe
===============================================================

.. data:: kmo_fits_stack

Synopsis
--------

Creates KMOS conform fits-files

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

     #############################################
     ### INTENDED FOR PIPELINE DEVELOPERS ONLY ###
     #############################################

FITS files to be processed by the KMOS pipeline have to meet certain condi-
tions. This recipe is intended to provide to the user a simple way to test the
pipeline with own data, which wasn't produced by KMOS itself.


The input set of frame is checked for integrity (do all the frames have the
same size, do they correspond to the desired output type, is there the correct
number of files). Then an empty main header is written with desired keywords.

A keyword consists of the name, data type and value.

Additional keywords can be added either to the empty primary header or to all
sub headers. 

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

   DO                    KMOS                                                  
   category              Type   Explanation                    Required #Frames
   --------              -----  -----------                    -------- -------
   STACK_DATA            <none> >= 1 plain FITS files             Y       1-n  
   STACK_NOISE                  >= 1 plain FITS files             N       0,1-n
   or                                                                          
   STACK_BADPIXEL               3 plain FITS files                Y        3   

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

   DO                     KMOS
   category               Type    Explanation
   --------               -----   -----------
   FITS_STACK             RAW or  Stacked KMOS FITS file             
                          F1D or                                     
                          F2D or                                     
                          B2D or                                     
                          F1I or                                     
                          F2I or                                     
                          F3I or                                     
                          F1S or                                     
                          F1L or                                     
                          F2L                                        


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

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

   Create an object for the recipe kmo_fits_stack.

::

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

Parameters
----------

.. py:attribute:: kmo_fits_stack.param.type

    The KMOS data format type (either "RAW", "F1D", "F2D", "F1I", "F2I",  "F3I", "F1S", "F1L", "F2L") (str; default: '') [default=""].
.. py:attribute:: kmo_fits_stack.param.format

    The format of the columns for "F1L" and "F2L" frames: e.g. "%f;%f;%s"  (str; default: '') [default=""].
.. py:attribute:: kmo_fits_stack.param.title

    The titles of the columns for "F1L" and "F2L" frames: e.g.  "wavelength;strength" (str; default: '') [default=""].
.. py:attribute:: kmo_fits_stack.param.filename

    Optional: The output filename (.fits will be added as postfix) (str;  default: 'FITS_STACK') [default="FITS_STACK"].
.. py:attribute:: kmo_fits_stack.param.mainkey

    Optional: Additional keywords for primary header (str; default: '') [default=""].
.. py:attribute:: kmo_fits_stack.param.subkey

    Optional: Additional keywords for sub headers(This is ignored when  category=TRUE) (str; default: '') [default=""].
.. py:attribute:: kmo_fits_stack.param.valid

    Optional: Specify which IFUs are active. Either empty string or string  with 24 elements (ones or zeros) e.g: [1;0;1;0;0;...;1] (str; default:  '') [default=""].
.. py:attribute:: kmo_fits_stack.param.category

    Optional: IF a PRO.CATG should be added. (bool; default: False) [default=False].
.. py:attribute:: kmo_fits_stack.param.input

    Optional: input file (str; default: '') [default=""].


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

::

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

   kmo_fits_stack.param.type = ""
   kmo_fits_stack.param.format = ""
   kmo_fits_stack.param.title = ""
   kmo_fits_stack.param.filename = "FITS_STACK"
   kmo_fits_stack.param.mainkey = ""
   kmo_fits_stack.param.subkey = ""
   kmo_fits_stack.param.valid = ""
   kmo_fits_stack.param.category = False
   kmo_fits_stack.param.input = ""


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

::

   import cpl
   kmo_fits_stack = cpl.Recipe("kmo_fits_stack")
   [...]
   res = kmo_fits_stack( ..., param = {"type":"", "format":""})


.. 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>
