The hawki_cal_distortion recipe
===============================================================

.. data:: hawki_cal_distortion

Synopsis
--------

Distortion autocalibration

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

hawki_cal_distortion -- HAWK-I distortion and astrometry autocalibration.


The input files must be tagged:
distortion_field.fits DISTOR_OBS
sky_distortion.fits DISTOR_SKY
flat-file.fits FLAT_IM (optional)
dark-file.fits DARK_IM (optional)
bpm-file.fits BPM (optional)

The recipe creates as an output:
hawki_cal_distortion_distx.fits (DISTORTION_X) 
hawki_cal_distortion_disty.fits (DISTORTION_Y) 

The recipe performs the following steps:
-Basic calibration of astrometry fields
-Autocalibration of distortion, using method in A&A 454,1029 (2006)

Return code:
esorex exits with an error code of 0 if the recipe completes successfully
or 1 otherwise

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

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

   Create an object for the recipe hawki_cal_distortion.

::

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

Parameters
----------

.. py:attribute:: hawki_cal_distortion.param.sigma_det

    detection level (float; default: 6.0) [default=6.0].
.. py:attribute:: hawki_cal_distortion.param.grid_points

    number of points in distortion grid (long; default: 9) [default=9].
.. py:attribute:: hawki_cal_distortion.param.borders

    number of pixels to trim at the borders (long; default: 6) [default=6].
.. py:attribute:: hawki_cal_distortion.param.subtract_linear

    Subtract a linear term to the solution (bool; default: True) [default=True].


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

::

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

   hawki_cal_distortion.param.sigma_det = 6.0
   hawki_cal_distortion.param.grid_points = 9
   hawki_cal_distortion.param.borders = 6
   hawki_cal_distortion.param.subtract_linear = True


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

::

   import cpl
   hawki_cal_distortion = cpl.Recipe("hawki_cal_distortion")
   [...]
   res = hawki_cal_distortion( ..., param = {"sigma_det":6.0, "grid_points":9})


.. 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 `Cesar Enrique Garcia Dabo <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 HAWKI Instrument Pipeline
Copyright (C) 2002,2011 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:: Cesar Enrique Garcia Dabo <usd-help@eso.org>
