The vmmoscombine recipe
===============================================================

.. data:: vmmoscombine

Synopsis
--------

Combine reduced MOS observations from different OBs.

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

This recipe is used to sum the contributes from a sequence of
2D-extracted spectral frames generated by the recipes vmmosobsstare,
vmmosobsjitter, and vmmoscombine itself. The only restriction is
that all frames must be obtained with the same mask. Sky subtraction,
fringing correction, flat fielding, etc., are not applied, since they
had been applied in the previous reduction of each input dataset.

Each input image is corrected to airmass zero before the stacking,
and for this reason an atmospheric extinction table must always be
specified. Optionally a correction for the instrument response can
also be applied.


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

  DO category:             Type:       Explanation:          Required:
  MOS_SCIENCE_EXTRACTED    Product     Combined slit spectra     Y
  GRISM_TABLE              Calib       Grism table               Y
  EXTINCT_TABLE            Calib       Atmospheric extinction    Y
  MOS_SPECPHOT_TABLE       Calib       Response curve            .


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

  DO category:             Data type:  Explanation:
  MOS_SCIENCE_REDUCED      FITS image  Extracted objects spectra
  MOS_SCIENCE_FLUX_REDUCED FITS image  Flux calibrated objects spectra
  MOS_SCIENCE_EXTRACTED    FITS image  Combined slit spectra
  OBJECT_TABLE             FITS table  Objects spectra identification
  WINDOW_TABLE             FITS table  Objects positions in slit

The positions of the extracted slit spectra and of the detected
objects that they may contain are listed in the window table.


If a spectro-photometric table (produced by the recipe vmmosstandard)
is specified and a flux calibration is requested, then a
MOS_SCIENCE_FLUX_REDUCED image is also created. This image is identical
to the MOS_SCIENCE_REDUCED, but the spectra it contains are flux
calibrated, and expressed in units of erg/cm/cm/s/Angstrom.


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


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

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

   Create an object for the recipe vmmoscombine.

::

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

Parameters
----------

.. py:attribute:: vmmoscombine.param.StackMethod

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

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

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

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

    Number of highest rejected values for rejection method. (long;  default: 1) [default=1].
.. py:attribute:: vmmoscombine.param.DetectionLevel

    Object detection level in units of sigma. (float; default: 2.0) [default=2.0].
.. py:attribute:: vmmoscombine.param.WatershedLevels

    Number of levels in the watershed method in object detection. (long;  default: 32) [default=32].
.. py:attribute:: vmmoscombine.param.WatershedFraction

    Flux fraction to use in watershed. (float; default: 0.01) [default=0.01].
.. py:attribute:: vmmoscombine.param.MinObjectSize

    Minimal size for an object candidate to be considered an object.  (long; default: 2) [default=2].
.. py:attribute:: vmmoscombine.param.MaxObjectSize

    Maximal size for an object candidate for not trying deblend into sub-  objects. (long; default: 7) [default=7].
.. py:attribute:: vmmoscombine.param.CalibrateFlux

    Extracted spectra are flux calibrated. (bool; default: False) [default=False].


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

::

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

   vmmoscombine.param.StackMethod = "Average"
   vmmoscombine.param.KSigmaLow = 5.0
   vmmoscombine.param.KSigmaHigh = 5.0
   vmmoscombine.param.MinRejection = 1
   vmmoscombine.param.MaxRejection = 1
   vmmoscombine.param.DetectionLevel = 2.0
   vmmoscombine.param.WatershedLevels = 32
   vmmoscombine.param.WatershedFraction = 0.01
   vmmoscombine.param.MinObjectSize = 2
   vmmoscombine.param.MaxObjectSize = 7
   vmmoscombine.param.CalibrateFlux = False


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

::

   import cpl
   vmmoscombine = cpl.Recipe("vmmoscombine")
   [...]
   res = vmmoscombine( ..., param = {"StackMethod":"Average", "KSigmaLow":5.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 `ESO VIMOS Pipeline Team and VIMOS Consortium <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 and VIMOS Consortium <usd-help@eso.org>
