The kmo_shift recipe
===============================================================

.. data:: kmo_shift

Synopsis
--------

Shift a cube spatially

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

This recipe shifts a cube spatially. A positive x-shift shifts the data to the
left, a positive y-shift shifts upwards, where a shift of one pixel equals
0.2arcsec. The output will still have the same dimensions, but the borders 
will be filled with NaNs accordingly.

To adjust only the WCS without moving the data the --wcs-only parameter has to
be set to TRUE. The WCS is updated in the same way as if the data would have
moved as well. This means that the point at (x,y) has the same coordinates as
the point (x+1,y+1) after updating the WCS (the WCS moved in the opposite
direction).


Input files
^^^^^^^^^^^^
::

   DO                    KMOS                                                  
   category              Type   Explanation                    Required #Frames
   --------              -----  -----------                    -------- -------
   <none or any>         F3I    data frame                        Y        1   

Output files
^^^^^^^^^^^^
::

   DO                    KMOS
   category              Type   Explanation
   --------              -----  -----------
   SHIFT                 F3I    Shifted data cube


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

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

   Create an object for the recipe kmo_shift.

::

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

Parameters
----------

.. py:attribute:: kmo_shift.param.imethod

    Method to use for interpolation. ["BCS" (bicubic spline, default),  "NN" (nearest neighbor)] (str; default: 'BCS') [default="BCS"].
.. py:attribute:: kmo_shift.param.extrapolate

    Applies only to 'method=BCS' when doing sub-pixel shifts: FALSE:  shifted IFU will be filled with NaN's at the borders,TRUE: shifted IFU  will be extrapolated at the borders (bool; default: False) [default=False].
.. py:attribute:: kmo_shift.param.shifts

    The shifts for each spatial dimension for all specified  IFUs."x1,y1;x2,y2;..." (arcsec) (str; default: '') [default=""].
.. py:attribute:: kmo_shift.param.ifu

    The IFU to shift [1 to 24] or shift all IFUs Default value of 0  applies shift to all IFUs. (long; default: 0) [default=0].
.. py:attribute:: kmo_shift.param.flux

    Apply flux conservation: (TRUE (apply) or FALSE (don't apply) (bool;  default: False) [default=False].
.. py:attribute:: kmo_shift.param.wcs_only

    FALSE: if data and wcs should be updated.TRUE: if only wcs should be  corrected (bool; default: False) [default=False].


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

::

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

   kmo_shift.param.imethod = "BCS"
   kmo_shift.param.extrapolate = False
   kmo_shift.param.shifts = ""
   kmo_shift.param.ifu = 0
   kmo_shift.param.flux = False
   kmo_shift.param.wcs_only = False


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

::

   import cpl
   kmo_shift = cpl.Recipe("kmo_shift")
   [...]
   res = kmo_shift( ..., param = {"imethod":"BCS", "extrapolate":False})


.. 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 `Alex Agudo Berbel <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 CRIRES 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:: Alex Agudo Berbel <usd-help@eso.org>
