The montecarlo recipe
===============================================================

.. data:: montecarlo

Synopsis
--------

Test function mos_montecarlo_polyfit()

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

This recipe is used to test the mos_montecarlo_polyfit() function.

It accepts a table with columns x, y, y_err, derives the best polynomial
fit y = p(x), and produces a table with the polynomial 1-sigma accuracy
on the given set of x coordinates.

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

  DO category:               Type:       Explanation:         Required:
  TABLE                      Raw         Table to evaluate       Y

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

  DO category:               Data type:  Explanation:
  MODEL_ERROR                FITS image  Model error at different x


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

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

   Create an object for the recipe montecarlo.

::

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

Parameters
----------

.. py:attribute:: montecarlo.param.x

    Name of independent variable column (str; default: 'x') [default="x"].
.. py:attribute:: montecarlo.param.y

    Name of dependent variable column (str; default: 'y') [default="y"].
.. py:attribute:: montecarlo.param.sigma

    Name of error column on dependent variable (str; default: '') [default=""].
.. py:attribute:: montecarlo.param.order

    Order of fitting polynomial (long; default: 1) [default=1].
.. py:attribute:: montecarlo.param.zero

    Origin of x for fit (float; default: 0.0) [default=0.0].
.. py:attribute:: montecarlo.param.start

    Start x for evaluation (float; default: 0.0) [default=0.0].
.. py:attribute:: montecarlo.param.end

    End x for evaluation (float; default: 0.0) [default=0.0].
.. py:attribute:: montecarlo.param.step

    x sampling interval (float; default: 0.0) [default=0.0].
.. py:attribute:: montecarlo.param.trials

    Size of statistical sample (long; default: 100) [default=100].


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

::

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

   montecarlo.param.x = "x"
   montecarlo.param.y = "y"
   montecarlo.param.sigma = ""
   montecarlo.param.order = 1
   montecarlo.param.zero = 0.0
   montecarlo.param.start = 0.0
   montecarlo.param.end = 0.0
   montecarlo.param.step = 0.0
   montecarlo.param.trials = 100


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

::

   import cpl
   montecarlo = cpl.Recipe("montecarlo")
   [...]
   res = montecarlo( ..., param = {"x":"x", "y":"y"})


.. 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 `Carlo Izzo <usd-help@eso.org>`_. Alternatively, you may 
send a report to the `ESO User Support Department <usd-help@eso.org>`_.

Copyright
---------

This file is currently part of the FORS Instrument Pipeline
Copyright (C) 2002-2010 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  02110-1301  USA


.. codeauthor:: Carlo Izzo <usd-help@eso.org>
