CONAN.fit_data.run_fit
======================

.. py:function:: CONAN.fit_data.run_fit(lc_obj=None, rv_obj=None, fit_obj=None, statistic='median', out_folder='output', init_only=False, progress=True, rerun_result=False, get_parameter_names=False, shared_params={}, conditionals={}, debug=False, save_burnin_chains=True, resume_sampling=False, skip_bwbr=False, dyn_kwargs=dict(sample='rwalk', bound='multi'), run_kwargs=dict(), verbose=True)

   function to fit the data using the light-curve object lc_obj, rv_object rv_obj, and fit_setup
   object fit_obj.

   :param lc_obj: object containing lightcurve data and setup parameters.
                  see CONAN.load_lightcurves() for more details.
   :type lc_obj: lightcurve object;
   :param rv_obj: object containing radial velocity data and setup parameters.
                  see CONAN.load_rvs() for more details.
   :type rv_obj: rv object
   :param fit_obj: object containing fit setup parameters.
                   see CONAN.fit_setup() for more details.
   :type fit_obj: fit_setup object;
   :param statistic: statistic to run on posteriors to obtain model parameters and create model output file
                     "_\*out.dat". must be one of ["median", "max", "bestfit"], default is "median". "max" and
                     "median" calculate the maximum and median of each parameter posterior respectively while
                     "bestfit" is the parameter combination that gives the maximum joint posterior probability.
   :type statistic: str;
   :param progress: if True, show MCMC progress bar, default is True.
   :type progress: bool;
   :param out_folder: path to output folder, default is "output".
   :type out_folder: str;
   :param init_only: generate only initial models, prior display, and \*out.dat files in the output folder.
                     useful for diagnosing starting points or generating full lc and rv models
   :type init_only: bool;
   :param rerun_result: if True, rerun CONAN with previous fit result in order to regenerate plots and files.
                        This also allows to create files compatibile with latest CONAN version. Default is False.
   :type rerun_result: bool;
   :param shared_params: dict specifying parameters that shared a value. Default is empty dict {}.
                         use `CONAN.get_parameter_names(lc_obj, rv_obj)` to see all parameter names.
   :type shared_params: dict, optional
   :param conditionals: dict specifying conditional parameter dependencies or constraints not captured by the prior function.
                        e.g cond = dict(cond1="sesinw**2 + secosw**2 < 1")  #TODO
   :type conditionals: dict, optional
   :param resume_sampling: resume sampling from last saved position
   :type resume_sampling: bool;
   :param verbose: if True, print out additional information, default is False.
   :type verbose: bool;
   :param debug: if True, print out additional debugging information, default is False.
   :type debug: bool;
   :param save_burnin_chains: if True, save burn-in chains to file, default is True.
   :type save_burnin_chains: bool;
   :param dyn_kwargs: other parameters sent to the dynesty.NestedSampler() or dynesty.DynamicNestedSampler()
                      function. e.g dyn_kwargs=dict(sample='rwalk',bound='multi')
   :type dyn_kwargs: dict;
   :param run_kwargs: other parameters sent to emcee's run_mcmc() function or dynesty's run_nested() function.
                      e.g., for emcee: run_kwargs=dict(thin_by=1, tune=True, skip_initial_state_check=False)
                      e.g., for dynesty dynamic sampling: run_kwargs=dict(maxiter_init=10000, maxiter_batch=1000,n_effective=30000)
                      e.g., for static sampling: run_kwargs=dict( nlive_batch=50, maxbatch=5,maxiter=10000, maxcall=50000, logl_max=12344, n_effective=30000)
   :type run_kwargs: dict;

   :returns: **result** -- Object that contains methods to plot the chains, corner, and histogram of parameters.
             e.g ``result.plot_chains()``, ``result.plot_burnin_chains()``, ``result.plot_corner``,
             ``result.plot_posterior("T_0")``
   :rtype: object containing labeled mcmc chains

