The kmo_arithmetic recipe
===============================================================

.. data:: kmo_arithmetic

Synopsis
--------

Perform basic arithmetic on cubes

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

With this recipe simple arithmetic operations, like addition, subtraction,
multiplication, divison and raising to a power can be performed.

Since FITS files formatted as F1I, F2I and F3I can contain data (and eventually
noise) of either just one IFU or of all 24 IFUs, kmo_arithmetic behaves diffe-
rently in these cases.

When the number of IFUs is the same for both operands, the first IFU of the
first operand is processed with the first IFU of the second operand.

When the second operand has only one IFU while the first operand has more IFUs,
then the all the IFUs of the first operand are processed individually which the
IFU of the second operand.

If an operand contains noise and the other doesn't, the noise will not be
processed.


Noise is only propagated if both operand contain noise extensions. If the
second operator is a scalar noise is also propagated, of course.


If two cubes are given as operands, they will be combined according to the 
given operator.If a cube is given as first operand and an image as second,
then it operates on each slice of the cube; similarly if a spectrum is given
as the second operand, it operates on each spectrum of the cube; and a number
as the second operand operates on each pixel of the cube.


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

   DO                    KMOS                                                  
   category              Type   Explanation                    Required #Frames
   --------              -----  -----------                    -------- -------
   <none or any>         F3I or Data with or                      Y        1   
                         F2I or without noise frame                            
                         F1I or                                                
                         F2D or                                                
                         RAW                                                   
   <none or any>         F3I or Data with or                      N       0,1  
                         F2I or without noise frame                            
                         F1I or                                                
                         F2D or                                                
                         RAW                                                   

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

   DO                    KMOS
   category              Type   Explanation
   --------              -----  -----------
   ARITHMETIC            F3I or                                                
                         F2I or                                                
                         F1I or                                                
                         F2D                                                   


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

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

   Create an object for the recipe kmo_arithmetic.

::

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

Parameters
----------

.. py:attribute:: kmo_arithmetic.param.operator

    The operator ('+', '-', '*', '/' or '^') (str; default: '') [default=""].
.. py:attribute:: kmo_arithmetic.param.scalar

    The scalar operand (float; default: -1.7976931348623157e+308) [default=-1.79769313486e+308].
.. py:attribute:: kmo_arithmetic.param.file_extension

    String to add to product filename. (str; default: '') [default=""].


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

::

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

   kmo_arithmetic.param.operator = ""
   kmo_arithmetic.param.scalar = -1.79769313486e+308
   kmo_arithmetic.param.file_extension = ""


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

::

   import cpl
   kmo_arithmetic = cpl.Recipe("kmo_arithmetic")
   [...]
   res = kmo_arithmetic( ..., param = {"operator":"", "scalar":-1.79769313486e+308})


.. 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 <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 <usd-help@eso.org>
