The muse_create_sky recipe
===============================================================

.. data:: muse_create_sky

Synopsis
--------

Create night sky model from selected pixels of an exposure of empty sky.

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

This recipe creates the continuum and the atmospheric transition line spectra of the night sky from the data in a pixel table(s) belonging to one exposure of (mostly) empty sky.


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

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

   Create an object for the recipe muse_create_sky.

::

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

Parameters
----------

.. py:attribute:: muse_create_sky.param.fraction

    Fraction of the image (without the ignored part) to be considered as  sky. If an input sky mask is provided, the fraction is applied to the  regions within the mask. If the whole sky mask should be used, set  this parameter to 1. (float; default: 0.75) [default=0.75].
.. py:attribute:: muse_create_sky.param.ignore

    Fraction of the image to be ignored. If an input sky mask is provided,  the fraction is applied to the regions within the mask. If the whole  sky mask should be used, set this parameter to 0. (float; default:  0.05) [default=0.05].
.. py:attribute:: muse_create_sky.param.sampling

    Spectral sampling of the sky spectrum [Angstrom]. (float; default:  0.3125) [default=0.3125].
.. py:attribute:: muse_create_sky.param.csampling

    Spectral sampling of the continuum spectrum [Angstrom]. (float;  default: 0.3125) [default=0.3125].
.. py:attribute:: muse_create_sky.param.crsigma

    Sigma level clipping for cube-based and spectrum-based CR rejection.  This has to be a string of two comma-separated floating-point numbers.  The first value gives the sigma-level rejection for cube-based CR  rejection (using "median", see muse_scipost), the second value the  sigma-level for spectrum-based CR cleaning. Both can be switched off,  by passing zero or a negative value. (str; default: '15.,15.') [default="15.,15."].
.. py:attribute:: muse_create_sky.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_create_sky.param.lambdamax

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

    Reference wavelength used for correction of differential atmospheric  refraction. The R-band (peak wavelength ~7000 Angstrom) that is  usually used for guiding, is close to the central wavelength of MUSE,  so a value of 7000.0 Angstrom should be used if nothing else is known.  A value less than zero switches DAR correction off. (float; default:  7000.0) [default=7000.0].


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

::

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

   muse_create_sky.param.fraction = 0.75
   muse_create_sky.param.ignore = 0.05
   muse_create_sky.param.sampling = 0.3125
   muse_create_sky.param.csampling = 0.3125
   muse_create_sky.param.crsigma = "15.,15."
   muse_create_sky.param.lambdamin = 4000.0
   muse_create_sky.param.lambdamax = 10000.0
   muse_create_sky.param.lambdaref = 7000.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_create_sky = cpl.Recipe("muse_create_sky")
   [...]
   res = muse_create_sky( ..., param = {"fraction":0.75, "ignore":0.05})


.. 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 `Ole Streicher <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, 2019 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:: Ole Streicher <usd-help@eso.org>
