The flames_cal_predict recipe
===============================================================

.. data:: flames_cal_predict

Synopsis
--------

Implements the UVES physical model

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

This recipe implements the UVES physical model
Input files are flames-uves formatcheck frames identified by the tag
FIB_ARC_LAMP_FORM_RED and a ThAr line reference table
identified by the tag LINE_REFER_TABLE.

Optional input are master bias frames identified by the tag 
MASTER_BIAS_(REDL|REDU).

The recipe extracts from the input files FITS header data indicating the
instrument setting and ambiental atmospheric conditions, then using the
model predicts X,Y position of the lines listed in the LINE_REFER_TABLE
table which are imaging on the detector and stores this information in an
guess order and a guess line table.

Output are a guess line table, FIB_LIN_GUE_(REDL|REDU), and a guess order 
table, FIB_ORD_GUE_(REDL|REDU).

If the user provides in input also master format checks having tag
MASTER_FORM_(REDL|REDU), the recipe performs also a stability check

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

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

   Create an object for the recipe flames_cal_predict.

::

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

Parameters
----------

.. py:attribute:: flames_cal_predict.param.debug

    Whether or not to save intermediate results to local directory (bool;  default: False) [default=False].
.. py:attribute:: flames_cal_predict.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:: flames_cal_predict.param.process_chip

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

    Match box X size (long; default: 40) [default=40].
.. py:attribute:: flames_cal_predict.param.mbox_y

    Match box Y size (long; default: 40) [default=40].
.. py:attribute:: flames_cal_predict.param.trans_x

    Detector translation along X (float; default: 0.0) [default=0.0].
.. py:attribute:: flames_cal_predict.param.trans_y

    Detector translation along Y (float; default: 0.0) [default=0.0].
.. py:attribute:: flames_cal_predict.param.ech_angle_off

    Offset on echelle angle (float; default: 0.0) [default=0.0].
.. py:attribute:: flames_cal_predict.param.cd_angle_off

    Offset on cross disperser angle (float; default: 0.0) [default=0.0].
.. py:attribute:: flames_cal_predict.param.ccd_rot_angle_off

    Offset on CCD rotation angle (float; default: 0.0) [default=0.0].
.. py:attribute:: flames_cal_predict.param.compute_regression_sw

    Compute regression? (bool; default: True) [default=True].
.. py:attribute:: flames_cal_predict.param.def_pol1

    Polynomial X deg (long; default: 4) [default=4].
.. py:attribute:: flames_cal_predict.param.def_pol2

    Polynomial Y deg (long; default: 5) [default=5].
.. py:attribute:: flames_cal_predict.param.kappa

    Kappa value in kappa sigma clipping on RESIDUAL between YFIT and Y  columns (float; default: 4.5) [default=4.5].
.. py:attribute:: flames_cal_predict.param.tol

    Tolerance in kappa sigma clipping on RESIDUAL between YFIT and Y  columns (float; default: 2.0) [default=2.0].


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

::

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

   flames_cal_predict.param.debug = False
   flames_cal_predict.param.plotter = "no"
   flames_cal_predict.param.process_chip = "both"
   flames_cal_predict.param.mbox_x = 40
   flames_cal_predict.param.mbox_y = 40
   flames_cal_predict.param.trans_x = 0.0
   flames_cal_predict.param.trans_y = 0.0
   flames_cal_predict.param.ech_angle_off = 0.0
   flames_cal_predict.param.cd_angle_off = 0.0
   flames_cal_predict.param.ccd_rot_angle_off = 0.0
   flames_cal_predict.param.compute_regression_sw = True
   flames_cal_predict.param.def_pol1 = 4
   flames_cal_predict.param.def_pol2 = 5
   flames_cal_predict.param.kappa = 4.5
   flames_cal_predict.param.tol = 2.0


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

::

   import cpl
   flames_cal_predict = cpl.Recipe("flames_cal_predict")
   [...]
   res = flames_cal_predict( ..., param = {"debug":False, "plotter":"no"})


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