The muse_exp_combine recipe
===============================================================

.. data:: muse_exp_combine

Synopsis
--------

Combine several exposures into one datacube.

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

Sort reduced pixel tables, one per exposure, by exposure and combine them with applied weights into one final datacube.


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

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

   Create an object for the recipe muse_exp_combine.

::

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

Parameters
----------

.. py:attribute:: muse_exp_combine.param.save

    Select output product(s) to save. Can contain one or more of "cube"  (output cube and associated images; if this is not given, no  resampling is done at all) or "combined" (fully reduced and combined  pixel table for the full set of exposures; this is useful, if the  final resampling step is to be done again separately). If several  options are given, they have to be comma-separated. (str; default:  'cube') [default="cube"].
.. py:attribute:: muse_exp_combine.param.resample

    The resampling technique to use for the final output cube. (str;  default: 'drizzle') [default="drizzle"].
.. py:attribute:: muse_exp_combine.param.dx

    Horizontal step size for resampling (in arcsec or pixel). The  following defaults are taken when this value is set to 0.0: 0.2'' for  WFM, 0.025'' for NFM, 1.0 if data is in pixel units. (float; default:  0.0) [default=0.0].
.. py:attribute:: muse_exp_combine.param.dy

    Vertical step size for resampling (in arcsec or pixel). The following  defaults are taken when this value is set to 0.0: 0.2'' for WFM,  0.025'' for NFM, 1.0 if data is in pixel units. (float; default: 0.0) [default=0.0].
.. py:attribute:: muse_exp_combine.param.dlambda

    Wavelength step size (in Angstrom). Natural instrument sampling is  used, if this is 0.0 (float; default: 0.0) [default=0.0].
.. py:attribute:: muse_exp_combine.param.crtype

    Type of statistics used for detection of cosmic rays during final  resampling. "iraf" uses the variance information, "mean" uses standard  (mean/stdev) statistics, "median" uses median and the median median of  the absolute median deviation. (str; default: 'median') [default="median"].
.. py:attribute:: muse_exp_combine.param.crsigma

    Sigma rejection factor to use for cosmic ray rejection during final  resampling. A zero or negative value switches cosmic ray rejection  off. (float; default: 10.0) [default=10.0].
.. py:attribute:: muse_exp_combine.param.rc

    Critical radius for the "renka" resampling method. (float; default:  1.25) [default=1.25].
.. py:attribute:: muse_exp_combine.param.pixfrac

    Pixel down-scaling factor for the "drizzle" resampling method. Up to  three, comma-separated, floating-point values can be given. If only  one value is given, it applies to all dimensions, two values are  interpreted as spatial and spectral direction, respectively, while  three are taken as horizontal, vertical, and spectral. (str; default:  '0.6,0.6') [default="0.6,0.6"].
.. py:attribute:: muse_exp_combine.param.ld

    Number of adjacent pixels to take into account during resampling in  all three directions (loop distance); this affects all resampling  methods except "nearest". (int; default: 1) [default=1].
.. py:attribute:: muse_exp_combine.param.format

    Type of output file format, "Cube" is a standard FITS cube with  NAXIS=3 and multiple extensions (for data and variance). The extended  "x" formats include the reconstructed image(s) in FITS image  extensions within the same file. "sdpCube" does some extra  calculations to create FITS keywords for the ESO Science Data  Products. (str; default: 'Cube') [default="Cube"].
.. py:attribute:: muse_exp_combine.param.weight

    Type of weighting scheme to use when combining multiple exposures.  "exptime" just uses the exposure time to weight the exposures, "fwhm"  uses the best available seeing information from the headers as well,  "none" preserves an existing weight column in the input pixel tables  without changes. (str; default: 'exptime') [default="exptime"].
.. py:attribute:: muse_exp_combine.param.filter

    The filter name(s) to be used for the output field-of-view image. Each  name has to correspond to an EXTNAME in an extension of the  FILTER_LIST file. If an unsupported filter name is given, creation of  the respective image is omitted. If multiple filter names are given,  they have to be comma separated. (str; default: 'white') [default="white"].
.. py:attribute:: muse_exp_combine.param.lambdamin

    Cut off the data below this wavelength after loading the pixel  table(s). (float; default: 4000.0) [default=4000.0].
.. py:attribute:: muse_exp_combine.param.lambdamax

    Cut off the data above this wavelength after loading the pixel  table(s). (float; default: 10000.0) [default=10000.0].


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

::

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

   muse_exp_combine.param.save = "cube"
   muse_exp_combine.param.resample = "drizzle"
   muse_exp_combine.param.dx = 0.0
   muse_exp_combine.param.dy = 0.0
   muse_exp_combine.param.dlambda = 0.0
   muse_exp_combine.param.crtype = "median"
   muse_exp_combine.param.crsigma = 10.0
   muse_exp_combine.param.rc = 1.25
   muse_exp_combine.param.pixfrac = "0.6,0.6"
   muse_exp_combine.param.ld = 1
   muse_exp_combine.param.format = "Cube"
   muse_exp_combine.param.weight = "exptime"
   muse_exp_combine.param.filter = "white"
   muse_exp_combine.param.lambdamin = 4000.0
   muse_exp_combine.param.lambdamax = 10000.0


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

::

   import cpl
   muse_exp_combine = cpl.Recipe("muse_exp_combine")
   [...]
   res = muse_exp_combine( ..., param = {"save":"cube", "resample":"drizzle"})


.. seealso:: `cpl.Recipe <https://packages.python.org/python-cpl/recipe.html>`_
   for more information about the recipe object.

Bug reports
-----------

Please report any problems to `Peter Weilbacher <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 MUSE Instrument Pipeline
Copyright (C) 2005, 2018 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  02111-1307  USA

.. codeauthor:: Peter Weilbacher <usd-help@eso.org>
