CONAN._classes.load_lightcurves.get_decorr
==========================================

.. py:method:: CONAN._classes.load_lightcurves.get_decorr(T_0=None, Period=None, rho_star=None, Duration=None, D_occ=0, Impact_para=0, RpRs=1e-05, Eccentricity=None, omega=None, sesinw=None, secosw=None, Fn=None, ph_off=None, A_ev=0, f1_ev=0, A_db=0, K=0, q1=0, q2=0, cont=0.0, fit_offset=None, mask=False, ss_exp=None, Rstar=None, ttv=False, delta_BIC=-5, decorr_bound=(-10, 10), exclude_cols=[], enforce_pars=[], exclude_pars=[], show_steps=False, plot_model=True, use_jitter_est=False, setup_baseline=True, setup_planet=False, pc_model='cosine', custom_LCfunc=None, verbose=True)

   Function to obtain best decorrelation parameters for each light-curve file using the
   forward selection method. It compares a model with only an offset to a polynomial model
   constructed with the other columns of the data. It uses columns 0,3,4,5,6,7,8 to
   construct the polynomial trend model. The temporary decorr parameters are labelled Ai,Bi
   for 1st & 2nd order coefficients in column i. if a spline, sinusoid or gp has been setup
   for the LC object, it is varied also during the decorrelation process.

   Decorrelation parameters that reduce the BIC by 5(i.e delta_BIC = -5) are iteratively
   selected. This implies bayes_factor=exp(-0.5*-5) = 12 or more is required for a parameter
   to be selected.The result can then be used to populate the ``.lc_baseline()`` method,
   if use_result is set to True. The transit, limb darkening and phase curve parameters
   can also be setup from the inputs to this function.

   :param T_0: transit/eclipse parameters of the planet. ``T_0`` and ``Period`` must be in same units as
               the time axis (col0) in the data file. ``D_occ``, ``Fn``, ``A_ev`` and ``A_db`` are in ppm.
               if float/int, the values are held fixed. tuple/list of len 2 implies gaussian
               prior as (mean,std) while len 3 implies [min,start_val,max].
   :type T_0: floats,tuple, None;
   :param Period: transit/eclipse parameters of the planet. ``T_0`` and ``Period`` must be in same units as
                  the time axis (col0) in the data file. ``D_occ``, ``Fn``, ``A_ev`` and ``A_db`` are in ppm.
                  if float/int, the values are held fixed. tuple/list of len 2 implies gaussian
                  prior as (mean,std) while len 3 implies [min,start_val,max].
   :type Period: floats,tuple, None;
   :param rho_star/Duration: transit/eclipse parameters of the planet. ``T_0`` and ``Period`` must be in same units as
                             the time axis (col0) in the data file. ``D_occ``, ``Fn``, ``A_ev`` and ``A_db`` are in ppm.
                             if float/int, the values are held fixed. tuple/list of len 2 implies gaussian
                             prior as (mean,std) while len 3 implies [min,start_val,max].
   :type rho_star/Duration: floats,tuple, None;
   :param D_occ: transit/eclipse parameters of the planet. ``T_0`` and ``Period`` must be in same units as
                 the time axis (col0) in the data file. ``D_occ``, ``Fn``, ``A_ev`` and ``A_db`` are in ppm.
                 if float/int, the values are held fixed. tuple/list of len 2 implies gaussian
                 prior as (mean,std) while len 3 implies [min,start_val,max].
   :type D_occ: floats,tuple, None;
   :param Impact_para: transit/eclipse parameters of the planet. ``T_0`` and ``Period`` must be in same units as
                       the time axis (col0) in the data file. ``D_occ``, ``Fn``, ``A_ev`` and ``A_db`` are in ppm.
                       if float/int, the values are held fixed. tuple/list of len 2 implies gaussian
                       prior as (mean,std) while len 3 implies [min,start_val,max].
   :type Impact_para: floats,tuple, None;
   :param RpRs: transit/eclipse parameters of the planet. ``T_0`` and ``Period`` must be in same units as
                the time axis (col0) in the data file. ``D_occ``, ``Fn``, ``A_ev`` and ``A_db`` are in ppm.
                if float/int, the values are held fixed. tuple/list of len 2 implies gaussian
                prior as (mean,std) while len 3 implies [min,start_val,max].
   :type RpRs: floats,tuple, None;
   :param Eccentricity/sesinw: transit/eclipse parameters of the planet. ``T_0`` and ``Period`` must be in same units as
                               the time axis (col0) in the data file. ``D_occ``, ``Fn``, ``A_ev`` and ``A_db`` are in ppm.
                               if float/int, the values are held fixed. tuple/list of len 2 implies gaussian
                               prior as (mean,std) while len 3 implies [min,start_val,max].
   :type Eccentricity/sesinw: floats,tuple, None;
   :param omega/secosw: transit/eclipse parameters of the planet. ``T_0`` and ``Period`` must be in same units as
                        the time axis (col0) in the data file. ``D_occ``, ``Fn``, ``A_ev`` and ``A_db`` are in ppm.
                        if float/int, the values are held fixed. tuple/list of len 2 implies gaussian
                        prior as (mean,std) while len 3 implies [min,start_val,max].
   :type omega/secosw: floats,tuple, None;
   :param Fn: transit/eclipse parameters of the planet. ``T_0`` and ``Period`` must be in same units as
              the time axis (col0) in the data file. ``D_occ``, ``Fn``, ``A_ev`` and ``A_db`` are in ppm.
              if float/int, the values are held fixed. tuple/list of len 2 implies gaussian
              prior as (mean,std) while len 3 implies [min,start_val,max].
   :type Fn: floats,tuple, None;
   :param ph_off: transit/eclipse parameters of the planet. ``T_0`` and ``Period`` must be in same units as
                  the time axis (col0) in the data file. ``D_occ``, ``Fn``, ``A_ev`` and ``A_db`` are in ppm.
                  if float/int, the values are held fixed. tuple/list of len 2 implies gaussian
                  prior as (mean,std) while len 3 implies [min,start_val,max].
   :type ph_off: floats,tuple, None;
   :param A_ev: transit/eclipse parameters of the planet. ``T_0`` and ``Period`` must be in same units as
                the time axis (col0) in the data file. ``D_occ``, ``Fn``, ``A_ev`` and ``A_db`` are in ppm.
                if float/int, the values are held fixed. tuple/list of len 2 implies gaussian
                prior as (mean,std) while len 3 implies [min,start_val,max].
   :type A_ev: floats,tuple, None;
   :param f1_ev: transit/eclipse parameters of the planet. ``T_0`` and ``Period`` must be in same units as
                 the time axis (col0) in the data file. ``D_occ``, ``Fn``, ``A_ev`` and ``A_db`` are in ppm.
                 if float/int, the values are held fixed. tuple/list of len 2 implies gaussian
                 prior as (mean,std) while len 3 implies [min,start_val,max].
   :type f1_ev: floats,tuple, None;
   :param A_db: transit/eclipse parameters of the planet. ``T_0`` and ``Period`` must be in same units as
                the time axis (col0) in the data file. ``D_occ``, ``Fn``, ``A_ev`` and ``A_db`` are in ppm.
                if float/int, the values are held fixed. tuple/list of len 2 implies gaussian
                prior as (mean,std) while len 3 implies [min,start_val,max].
   :type A_db: floats,tuple, None;
   :param q1: Kipping quadratic limb darkening parameters. if float, the values are held fixed.
              if tuple/list of len 2 implies gaussian prior as (mean,std) while len 3 implies [min,start_val,max].
              Give list of values to assign value to each unique filter in the data, or one value
              to be used for all filtets. Default is 0 for all filters.
   :type q1: float,tuple, list  (optional);
   :param q2: Kipping quadratic limb darkening parameters. if float, the values are held fixed.
              if tuple/list of len 2 implies gaussian prior as (mean,std) while len 3 implies [min,start_val,max].
              Give list of values to assign value to each unique filter in the data, or one value
              to be used for all filtets. Default is 0 for all filters.
   :type q2: float,tuple, list  (optional);
   :param cont: contamination factor of the lightcurve. must be float or list of floats as it does not vary in this least-squares fit.
                if list, must contain float for each filter. If tuple (norm or uni) is given, the start value is extracted.
                Default is 0 for all filters.
   :type cont: float,list (optional);
   :param delta_BIC: BIC improvement a parameter needs to provide in order to be considered relevant for
                     decorrelation. Default is conservative and set to -5 i.e, parameters needs to lower
                     the BIC by 5 to be included as decorrelation parameter.
   :type delta_BIC: float (negative);
   :param fit_offset: whether to fit an offset for each LC data. if None, preset values are used. e.g adding
                      spline for an lc automatically sets fit_offset="n" for that lc.
   :type fit_offset: 'y'/'n' str or None;
   :param mask: If True, transits and eclipses are masked using T_0, P and rho_star (or duration).
   :type mask: bool ;
   :param decorr_bound: bounds when fitting decorrelation parameters. Default is (-1,1)
   :type decorr_bound: tuple of size 2;
   :param ss_exp: exposure time of the lcs to configure supersampling. Default is None which implies
                  no supersampling.
   :type ss_exp: list, None;
   :param Rstar: Stellar radius in solar radii, required for performing light travel time correction.
                 Default is None
   :type Rstar: float, None;
   :param ttv: whether to fit a different transit time for each lc file.
   :type ttv: Bool, optional;
   :param exclude_cols: list of column numbers (e.g. [3,4]) to exclude from decorrelation. Default is [].
                        Can also specify "all" to only fit an offset
   :type exclude_cols: list of int;
   :param exclude_pars: list of decorr parameters (e.g. ['B3', 'A5']) to exclude from decorrelation. Default is [].
   :type exclude_pars: list of str;
   :param enforce_pars: list of decorr params (e.g. ['B3', 'A5']) to enforce in decorrelation. Default is [].
   :type enforce_pars: list of int;
   :param show_steps: Whether to show the steps of the forward selection of decorr parameters.
                      Default is False
   :type show_steps: Bool, optional;
   :param plot_model: Whether to overplot suggested trend model on the data. Defaults to True.
   :type plot_model: Bool, optional;
   :param use_jitter_est: Whether to use the estimated jitter from the data in the decorrelation model.
                          Defaults to False.
   :type use_jitter_est: Bool, optional;
   :param setup_baseline: whether to use result to setup the baseline model and transit/eclipse models.
                          Default is True.
   :type setup_baseline: Bool, optional;
   :param setup_planet: whether to use input to setup the transit model(planet_parameters/phasecurve/LD functions).
                        Default is False.
   :type setup_planet: Bool, optional;
   :param pc_model: phase curve model to use. Default is "cosine". Can be one of ["cosine", "lambert"].
                    give list of length equal to number of lightcurves to define model for each lightcurve
   :type pc_model: list, list of str, optional;
   :param custom_LCfunc: namespace object created from `lc_obj.add_custom_LC_function()`. It contains a
                         custom function with a parameter dictionary and an operation function defining how
                         to combine the output with the LC model. It can also specify if the custom function
                         replaces the native CONAN LC model.
   :type custom_LCfunc: object, optional;
   :param verbose: Whether to show the table of baseline model obtained. Defaults to True.
   :type verbose: Bool, optional;

   :returns: **decorr_result** -- list containing result object for each lc.
   :rtype: list of result object

   .. attribute:: _tmodel

      list of SimpleNamespace objects containing result from leastsquares fit.

      :type: list;

   .. attribute:: _decorr_result

      list of parameter result from leastsquares fit.

   .. attribute:: _tra_occ_pars

      list of transit and occultation parameters.

