The uves_cal_mkmaster recipe
===============================================================

.. data:: uves_cal_mkmaster

Synopsis
--------

Creates the master bias/dark/flat frame

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

This recipe calls uves_cal_mbias if any raw BIAS frame is provided
otherwise uves_cal_mdark if any raw DARK frame is provided, otherwise
it calls uves_cal_mflat Pls refer to those recipes for more details

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

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

   Create an object for the recipe uves_cal_mkmaster.

::

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

Parameters
----------

.. py:attribute:: uves_cal_mkmaster.param.backsub.mmethod

    Background measuring method. If equal to 'median' the background is  sampled using the median of a subwindow. If 'minimum', the subwindow  minimum value is used. If 'no', no background subtraction is done.  (str; default: 'median') [default="median"].
.. py:attribute:: uves_cal_mkmaster.param.backsub.npoints

    This is the number of columns in interorder space used to sample the  background. (int; default: 82) [default=82].
.. py:attribute:: uves_cal_mkmaster.param.backsub.radiusy

    The height (in pixels) of the background sampling window is (2*radiusy  + 1). This parameter is not corrected for binning. (int; default: 2) [default=2].
.. py:attribute:: uves_cal_mkmaster.param.backsub.sdegree

    Degree of interpolating splines. Currently only degree = 1 is  supported (int; default: 1) [default=1].
.. py:attribute:: uves_cal_mkmaster.param.backsub.smoothx

    If spline interpolation is used to measure the background, the  x-radius of the post-smoothing window is (smoothx * image_width).  Here, 'image_width' is the image width after binning. If negative, the  default values are used: (25.0/4096) for blue flat-field frames,  (50.0/4096) for red flat-field frames, (300.0/4096) for blue science  frames and (300.0/4096) for red science frames. (float; default: -1.0) [default=-1.0].
.. py:attribute:: uves_cal_mkmaster.param.backsub.smoothy

    If spline interpolation is used to measure the background, the  y-radius of the post-smoothing window is (smoothy * image_height).  Here, 'image_height' is the image height after binning. If negative,  the default values are used: (100.0/2048) for blue flat-field frames,  (300.0/2048) for red flat-field frames, (200.0/2048) for blue science  frames and (500.0/2048) for red science frames. (float; default: -1.0) [default=-1.0].
.. py:attribute:: uves_cal_mkmaster.param.clean_traps

    Clean detector traps. If TRUE detector traps are interpolated.The bad  pixels are replaced by the average of thenearest good pixels in the  same column, or simply marked as bad. The positions of bad pixels are  hard-coded (as function of UVES chip). (bool; default: False) [default=False].
.. py:attribute:: uves_cal_mkmaster.param.debug

    Whether or not to save intermediate results to local directory (bool;  default: False) [default=False].
.. py:attribute:: uves_cal_mkmaster.param.debug

    Whether or not to save intermediate results to local directory (bool;  default: False) [default=False].
.. py:attribute:: uves_cal_mkmaster.param.khigh

    Kappa used to clip high level values, when method is set to 'mean'  (float; default: 5.0) [default=5.0].
.. py:attribute:: uves_cal_mkmaster.param.khigh

    Kappa used to clip high level values, when method is set to 'mean'  (float; default: 5.0) [default=5.0].
.. py:attribute:: uves_cal_mkmaster.param.klow

    Kappa used to clip low level values, when method is set to 'mean'  (float; default: 5.0) [default=5.0].
.. py:attribute:: uves_cal_mkmaster.param.klow

    Kappa used to clip low level values, when method is set to 'mean'  (float; default: 5.0) [default=5.0].
.. py:attribute:: uves_cal_mkmaster.param.niter

    Number of kappa sigma iterations, when method is set to 'mean'  (int;  default: 5) [default=5].
.. py:attribute:: uves_cal_mkmaster.param.niter

    Number of kappa sigma iterations, when method is set to 'mean'  (int;  default: 5) [default=5].
.. py:attribute:: uves_cal_mkmaster.param.norm_method

    Method used to build master frame  (str; default: 'explevel') [default="explevel"].
.. py:attribute:: uves_cal_mkmaster.param.plotter

    Any plots produced by the recipe are redirected to the command  specified by this parameter. The plotting command must contain the  substring 'gnuplot' and must be able to parse gnuplot syntax on its  standard input. Valid examples of such a command may include 'gnuplot  -persist' and 'cat > mygnuplot$$.gp'. A finer control of the plotting  options can be obtained by writing an executable script, e.g.  my_gnuplot.pl, that executes gnuplot after setting the desired gnuplot  options (e.g. set terminal pslatex color). To turn off plotting, set  this parameter to 'no' (str; default: 'no') [default="no"].
.. py:attribute:: uves_cal_mkmaster.param.plotter

    Any plots produced by the recipe are redirected to the command  specified by this parameter. The plotting command must contain the  substring 'gnuplot' and must be able to parse gnuplot syntax on its  standard input. Valid examples of such a command may include 'gnuplot  -persist' and 'cat > mygnuplot$$.gp'. A finer control of the plotting  options can be obtained by writing an executable script, e.g.  my_gnuplot.pl, that executes gnuplot after setting the desired gnuplot  options (e.g. set terminal pslatex color). To turn off plotting, set  this parameter to 'no' (str; default: 'no') [default="no"].
.. py:attribute:: uves_cal_mkmaster.param.process_chip

    For RED arm data process the redl, redu, or both chip(s) (str;  default: 'both') [default="both"].
.. py:attribute:: uves_cal_mkmaster.param.process_chip

    For RED arm data process the redl, redu, or both chip(s) (str;  default: 'both') [default="both"].
.. py:attribute:: uves_cal_mkmaster.param.qc_dark.reg.border_x

    X distance between the left hand side of the detector and the left  hand side of the region [pix] (int; default: 100) [default=100].
.. py:attribute:: uves_cal_mkmaster.param.qc_dark.reg.border_y

    X distance between the left hand side of the detector and the left  hand side of the region [pix] (int; default: 100) [default=100].
.. py:attribute:: uves_cal_mkmaster.param.qc_dark.reg.box_sx

    Region X size [pix] (int; default: 100) [default=100].
.. py:attribute:: uves_cal_mkmaster.param.qc_dark.reg.box_sy

    Region Y size [pix] (int; default: 100) [default=100].
.. py:attribute:: uves_cal_mkmaster.param.qc_dark.reg.num_x

    Number of regions along the X axis (where mean/med/rms are computed).  (int; default: 4) [default=4].
.. py:attribute:: uves_cal_mkmaster.param.qc_dark.reg.num_y

    Number of regions along the Y axis(where mean/med/rms are computed).  (int; default: 4) [default=4].
.. py:attribute:: uves_cal_mkmaster.param.qc_dark.reg.when

    When QC analysis is performed. 0: on each raw frame or 1: on the  master frame (int; default: 0) [default=0].
.. py:attribute:: uves_cal_mkmaster.param.stack_method

    Method used to build master frame  (str; default: 'median') [default="median"].
.. py:attribute:: uves_cal_mkmaster.param.stack_method

    Method used to build master frame  (str; default: 'median') [default="median"].


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

::

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

   uves_cal_mkmaster.param.backsub.mmethod = "median"
   uves_cal_mkmaster.param.backsub.npoints = 82
   uves_cal_mkmaster.param.backsub.radiusy = 2
   uves_cal_mkmaster.param.backsub.sdegree = 1
   uves_cal_mkmaster.param.backsub.smoothx = -1.0
   uves_cal_mkmaster.param.backsub.smoothy = -1.0
   uves_cal_mkmaster.param.clean_traps = False
   uves_cal_mkmaster.param.debug = False
   uves_cal_mkmaster.param.debug = False
   uves_cal_mkmaster.param.khigh = 5.0
   uves_cal_mkmaster.param.khigh = 5.0
   uves_cal_mkmaster.param.klow = 5.0
   uves_cal_mkmaster.param.klow = 5.0
   uves_cal_mkmaster.param.niter = 5
   uves_cal_mkmaster.param.niter = 5
   uves_cal_mkmaster.param.norm_method = "explevel"
   uves_cal_mkmaster.param.plotter = "no"
   uves_cal_mkmaster.param.plotter = "no"
   uves_cal_mkmaster.param.process_chip = "both"
   uves_cal_mkmaster.param.process_chip = "both"
   uves_cal_mkmaster.param.qc_dark.reg.border_x = 100
   uves_cal_mkmaster.param.qc_dark.reg.border_y = 100
   uves_cal_mkmaster.param.qc_dark.reg.box_sx = 100
   uves_cal_mkmaster.param.qc_dark.reg.box_sy = 100
   uves_cal_mkmaster.param.qc_dark.reg.num_x = 4
   uves_cal_mkmaster.param.qc_dark.reg.num_y = 4
   uves_cal_mkmaster.param.qc_dark.reg.when = 0
   uves_cal_mkmaster.param.stack_method = "median"
   uves_cal_mkmaster.param.stack_method = "median"


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

::

   import cpl
   uves_cal_mkmaster = cpl.Recipe("uves_cal_mkmaster")
   [...]
   res = uves_cal_mkmaster( ..., param = {"backsub.mmethod":"median", "backsub.npoints":82})


.. 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 `Jonas M. Larsen <cpl@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 FLAMES/UVES Pipeline
Copyright (C) 2004, 2005, 2006, 2007 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:: Jonas M. Larsen <cpl@eso.org>
