The muse_exp_align recipe
===============================================================

.. data:: muse_exp_align

Synopsis
--------

Create a coordinate offset table to be used to align exposures during exposure combination.

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

Compute the coordinate offset for each input field-of-view image with respect to a reference. The created list of coordinate offsets can then be used in muse_exp_combine as the field coordinate offsets to properly align the exposures during their combination.


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

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

   Create an object for the recipe muse_exp_align.

::

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

Parameters
----------

.. py:attribute:: muse_exp_align.param.rsearch

    Search radius (in arcsec) for each iteration of the offset  computation. (str; default: '30.,4.,2.,0.8') [default="30.,4.,2.,0.8"].
.. py:attribute:: muse_exp_align.param.nbins

    Number of bins to use for 2D histogram on the first iteration of the  offset computation. (int; default: 60) [default=60].
.. py:attribute:: muse_exp_align.param.weight

    Use weighting. (bool; default: True) [default=True].
.. py:attribute:: muse_exp_align.param.fwhm

    FWHM in pixels of the convolution filter. (float; default: 5.0) [default=5.0].
.. py:attribute:: muse_exp_align.param.threshold

    Initial intensity threshold for detecting point sources. If the value  is negative or zero the threshold is taken as sigma above median  background MAD. If it is larger than zero the threshold is taken as  absolute background level. (float; default: 15.0) [default=15.0].
.. py:attribute:: muse_exp_align.param.bkgignore

    Fraction of the image to be ignored. (float; default: 0.05) [default=0.05].
.. py:attribute:: muse_exp_align.param.bkgfraction

    Fraction of the image (without the ignored part) to be considered as  background. (float; default: 0.1) [default=0.1].
.. py:attribute:: muse_exp_align.param.step

    Increment/decrement of the threshold value in subsequent iterations.  (float; default: 0.5) [default=0.5].
.. py:attribute:: muse_exp_align.param.iterations

    Maximum number of iterations used for detecting sources. (int;  default: 100000) [default=100000].
.. py:attribute:: muse_exp_align.param.srcmin

    Minimum number of sources which must be found. (int; default: 5) [default=5].
.. py:attribute:: muse_exp_align.param.srcmax

    Maximum number of sources which may be found. (int; default: 80) [default=80].
.. py:attribute:: muse_exp_align.param.roundmin

    Lower limit of the allowed point-source roundness. (float; default:  -1.0) [default=-1.0].
.. py:attribute:: muse_exp_align.param.roundmax

    Upper limit of the allowed point-source roundness. (float; default:  1.0) [default=1.0].
.. py:attribute:: muse_exp_align.param.sharpmin

    Lower limit of the allowed point-source sharpness. (float; default:  0.2) [default=0.2].
.. py:attribute:: muse_exp_align.param.sharpmax

    Upper limit of the allowed point-source sharpness. (float; default:  1.0) [default=1.0].


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

::

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

   muse_exp_align.param.rsearch = "30.,4.,2.,0.8"
   muse_exp_align.param.nbins = 60
   muse_exp_align.param.weight = True
   muse_exp_align.param.fwhm = 5.0
   muse_exp_align.param.threshold = 15.0
   muse_exp_align.param.bkgignore = 0.05
   muse_exp_align.param.bkgfraction = 0.1
   muse_exp_align.param.step = 0.5
   muse_exp_align.param.iterations = 100000
   muse_exp_align.param.srcmin = 5
   muse_exp_align.param.srcmax = 80
   muse_exp_align.param.roundmin = -1.0
   muse_exp_align.param.roundmax = 1.0
   muse_exp_align.param.sharpmin = 0.2
   muse_exp_align.param.sharpmax = 1.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_exp_align = cpl.Recipe("muse_exp_align")
   [...]
   res = muse_exp_align( ..., param = {"rsearch":"30.,4.,2.,0.8", "nbins":60})


.. 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 `Ralf Palsa <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, 2018 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:: Ralf Palsa <usd-help@eso.org>
