The sinfo_utl_skycor recipe
===============================================================

.. data:: sinfo_utl_skycor

Synopsis
--------

Sky lines residuals correction

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

This recipe perform a correction of possible sky line residuals in the 
object cube after standard data reduction.

Input frames are cubes with target and sky observations.

Their tags can be respectively OBS_OBJ (or OBS_PSF or OBS_STD) and OBS_SKY.

The output is a cube with same tag as the corresponding input target frame.



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

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

   Create an object for the recipe sinfo_utl_skycor.

::

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

Parameters
----------

.. py:attribute:: sinfo_utl_skycor.param.skycor_mask_ws

    Starting wavelength for object-sky cross correlation (float; default:  1.4) [default=1.4].
.. py:attribute:: sinfo_utl_skycor.param.skycor_mask_we

    End wavelength for object-sky cross correlation (float; default: 2.5) [default=2.5].
.. py:attribute:: sinfo_utl_skycor.param.skycor_min_frac

    Threshold value for fraction of spatial pixels to be sky (float;  default: 0.8) [default=0.8].
.. py:attribute:: sinfo_utl_skycor.param.skycor_sky_bkg_filter_width

    Width of sky-thermal background pre filter (to remove emission lines  before fitting a Black Body). (long; default: 12) [default=12].
.. py:attribute:: sinfo_utl_skycor.param.skycor_line_hw

    Threshold value for full width in pixels of unresolved emission line.  Lines with FWHM smaller than this value are not considered in the  object-sky cross correlation and in computation of the optimal sky  lines scaling factor (float; default: 4.0) [default=4.0].
.. py:attribute:: sinfo_utl_skycor.param.skycor_scale_method

    Optimal sky lines scaling factor computation method: amoeba fit (0),  maximum likelihood (1)  (long; default: 1) [default=1].
.. py:attribute:: sinfo_utl_skycor.param.skycor_rot_cor

    Computes scaling factor correction due to rotational levels  transitions (bool; default: False) [default=False].
.. py:attribute:: sinfo_utl_skycor.param.skycor_fit_obj_noise

    Do Gaussian fit of object noise (bool; default: False) [default=False].
.. py:attribute:: sinfo_utl_skycor.param.skycor_niter

    Number of iterations of background fit (long; default: 10) [default=10].
.. py:attribute:: sinfo_utl_skycor.param.skycor_pshift

    Sky spectrum shift towar object (float; default: 0.0) [default=0.0].
.. py:attribute:: sinfo_utl_skycor.param.skycor_llx

    Lower left X defining object spectrum location (long; default: 1) [default=1].
.. py:attribute:: sinfo_utl_skycor.param.skycor_lly

    Lower left Y defining object spectrum location (long; default: 1) [default=1].
.. py:attribute:: sinfo_utl_skycor.param.skycor_urx

    Upper right X defining object spectrum location (long; default: 64) [default=64].
.. py:attribute:: sinfo_utl_skycor.param.skycor_ury

    Upper right Y defining object spectrum location (long; default: 64) [default=64].
.. py:attribute:: sinfo_utl_skycor.param.skycor_sub_thr_bkg_from_obj

    Subtract thermal background contribute from object spectra. Set it to  TRUE if stack-sub_raw_sky is set to FALSE (bool; default: False) [default=False].


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

::

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

   sinfo_utl_skycor.param.skycor_mask_ws = 1.4
   sinfo_utl_skycor.param.skycor_mask_we = 2.5
   sinfo_utl_skycor.param.skycor_min_frac = 0.8
   sinfo_utl_skycor.param.skycor_sky_bkg_filter_width = 12
   sinfo_utl_skycor.param.skycor_line_hw = 4.0
   sinfo_utl_skycor.param.skycor_scale_method = 1
   sinfo_utl_skycor.param.skycor_rot_cor = False
   sinfo_utl_skycor.param.skycor_fit_obj_noise = False
   sinfo_utl_skycor.param.skycor_niter = 10
   sinfo_utl_skycor.param.skycor_pshift = 0.0
   sinfo_utl_skycor.param.skycor_llx = 1
   sinfo_utl_skycor.param.skycor_lly = 1
   sinfo_utl_skycor.param.skycor_urx = 64
   sinfo_utl_skycor.param.skycor_ury = 64
   sinfo_utl_skycor.param.skycor_sub_thr_bkg_from_obj = False


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

::

   import cpl
   sinfo_utl_skycor = cpl.Recipe("sinfo_utl_skycor")
   [...]
   res = sinfo_utl_skycor( ..., param = {"skycor_mask_ws":1.4, "skycor_mask_we":2.5})


.. 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 `Andrea Modigliani <Andrea.Modigliani@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 SINFONI 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:: Andrea Modigliani <Andrea.Modigliani@eso.org>
