pyLIMA.microloutputs¶
Created on Mon Nov 9 16:38:14 2015
@author: ebachelet
Module Contents¶
Functions¶
json_output(fit, output_directory) |
|
latex_output(fit, output_directory) |
Function to output a LaTeX format table of the fit parameters |
pdf_output(fit, output_directory) |
|
statistical_outputs(fit) |
Compute statistics to estimate the fit quality |
fit_outputs(fit) |
Standard outputs. |
complete_MCMC_parameters(fit, parameters) |
|
create_the_fake_telescopes(fit, parameters) |
|
plot_distributions(fit, mcmc_chains) |
Plot the fit parameters distributions. |
parameters_result(fit, parameters=None) |
Produce a namedtuple object containing the fitted parameters in the fit.fit_results. |
MCMC_covariance(mcmc_chains) |
Estimate the covariance matrix from the mcmc_chains |
fit_errors(fit, covariance_matrix=None) |
Estimate the parameters errors from the covariance matrix. |
cov2corr(covariance_matrix) |
Covariance matrix to correlation matrix. |
MCMC_plot_lightcurves(fit, mcmc_best) |
Plot 35 models from the mcmc_best sample. This is made to have 35 models equally spaced |
LM_plot_lightcurves(fit) |
Plot the aligned datasets and the best fit on the first subplot figure_axes[0] and residuals |
initialize_plot_lightcurve(fit) |
Initialize the lightcurve plot. |
plot_model(figure_axe, fit, parameters=None, telescope_index=0, model_color=’b’, model_alpha=1.0, label=True, bokeh_plot=None) |
Plot the microlensing model corresponding to parameters, time and with the same properties as telescope, the best fit and first telescope. |
plot_residuals(figure_axe, fit, parameters=None, bokeh_plot=None) |
Plot the residuals from the fit. |
plot_align_data(figure_axe, fit, telescope_index=0, parameters=None, bokeh_plot=None) |
Plot the aligned data. |
align_telescope_lightcurve(lightcurve_telescope_flux, model_ghost, model_telescope) |
Align data to the survey telescope (i.e telescope 0). |
parameters_table(fit) |
Plot the fit parameters and errors. |
plot_geometry(fit) |
Plot the lensing geometry (i.e source trajectory) and the table of best parameters. |
-
pyLIMA.microloutputs.latex_output(fit, output_directory)[source]¶ Function to output a LaTeX format table of the fit parameters
-
pyLIMA.microloutputs.statistical_outputs(fit)[source]¶ Compute statistics to estimate the fit quality
Parameters: fit (object) – a fit object. See the microlfits for more details. Returns: a namedtuple containing the following attributes : fit_parameters : an namedtuple object containing all the fitted parameters
fit_errors : an namedtuple object containing all the fitted parameters errors
fit_correlation_matrix : a numpy array representing the fitted parameters correlation matrix
figure_lightcurve : a two matplotlib figure showing the data and model and the correspoding residuals
Return type: object
-
pyLIMA.microloutputs.fit_outputs(fit)[source]¶ Standard outputs.
Parameters: fit (object) – a fit object. See the microlfits for more details. Returns: a namedtuple containing the following attributes : fit_parameters : an namedtuple object containing all the fitted parameters
fit_errors : an namedtuple object containing all the fitted parameters errors
fit_correlation_matrix : a numpy array representing the fitted parameters correlation matrix
figure_lightcurve : a two matplotlib figure showing the data and model and the correspoding residuals
Return type: object
-
pyLIMA.microloutputs.plot_distributions(fit, mcmc_chains)[source]¶ Plot the fit parameters distributions. Only plot the best mcmc_chains are plotted. :param fit: a fit object. See the microlfits for more details. :param mcmc_best: a numpy array representing the best (<= 6 sigma) mcmc chains. :return: a multiple matplotlib subplot representing the parameters distributions (2D slice + histogram) :rtype: matplotlib_figure
-
pyLIMA.microloutputs.parameters_result(fit, parameters=None)[source]¶ Produce a namedtuple object containing the fitted parameters in the fit.fit_results.
Parameters: - fit – a fit object. See the microlfits for more details.
- fit_parameters – a namedtuple object containing the fitted parameters.
Return type:
-
pyLIMA.microloutputs.MCMC_covariance(mcmc_chains)[source]¶ Estimate the covariance matrix from the mcmc_chains
Parameters: mcmc_chains – a numpy array representing the mcmc chains. :return : a numpy array representing the covariance matrix of your MCMC sampling. :rtype: array_like
-
pyLIMA.microloutputs.fit_errors(fit, covariance_matrix=None)[source]¶ Estimate the parameters errors from the covariance matrix.
Parameters: fit – a fit object. See the microlfits for more details. Returns: a namedtuple object containing the square roots of parameters variance. Return type: object
-
pyLIMA.microloutputs.cov2corr(covariance_matrix)[source]¶ Covariance matrix to correlation matrix.
Parameters: covariance_matrix (array_like) – a (square) numpy array representing the covariance matrix Returns: a (square) numpy array representing the correlation matrix Return type: array_like
-
pyLIMA.microloutputs.MCMC_plot_lightcurves(fit, mcmc_best)[source]¶ Plot 35 models from the mcmc_best sample. This is made to have 35 models equally spaced in term of objective funtion (~chichi)
Parameters: - fit – a fit object. See the microlfits for more details.
- mcmc_best – a numpy array representing the best (<= 6 sigma) mcmc chains.
Returns: a two matplotlib subplot showing the data and 35 models and the residuals
corresponding to the best model. :rtype: matplotlib_figure
-
pyLIMA.microloutputs.LM_plot_lightcurves(fit)[source]¶ Plot the aligned datasets and the best fit on the first subplot figure_axes[0] and residuals on the second subplot figure_axes[1].
Parameters: fit (object) – a fit object. See the microlfits for more details. Returns: a figure representing data+model and residuals. Return type: matplotlib_figure
-
pyLIMA.microloutputs.initialize_plot_lightcurve(fit)[source]¶ Initialize the lightcurve plot.
Parameters: fit (object) – a fit object. See the microlfits for more details. Returns: a matplotlib figure and the corresponding matplotlib axes Return type: matplotlib_figure,matplotlib_axes
-
pyLIMA.microloutputs.plot_model(figure_axe, fit, parameters=None, telescope_index=0, model_color='b', model_alpha=1.0, label=True, bokeh_plot=None)[source]¶ Plot the microlensing model corresponding to parameters, time and with the same properties as telescope, the best fit and first telescope.
Parameters: - fit (object) – a fit object. See the microlfits for more details.
- figure_axe (matplotlib_axes) – a matplotlib axes correpsonding to the figure.
:param list parameters : a list of model parameters. :param np.array time : the time stamps for the model. :param int telescope_index : which telescope you want a model (depends on filter, location etc…) :param str model_color : the model color :param float model_alpha : the intensity of the model line
-
pyLIMA.microloutputs.plot_residuals(figure_axe, fit, parameters=None, bokeh_plot=None)[source]¶ Plot the residuals from the fit.
Parameters: - fit (object) – a fit object. See the microlfits for more details.
- figure_axe (matplotlib_axes) – a matplotlib axes correpsonding to the figure.
-
pyLIMA.microloutputs.plot_align_data(figure_axe, fit, telescope_index=0, parameters=None, bokeh_plot=None)[source]¶ Plot the aligned data.
Parameters: - figure_axe (matplotlib_axes) – a matplotlib axes correpsonding to the figure.
- fit (object) – a fit object. See the microlfits for more details.
:param int telescope_index : the telescope to align data to.
-
pyLIMA.microloutputs.align_telescope_lightcurve(lightcurve_telescope_flux, model_ghost, model_telescope)[source]¶ Align data to the survey telescope (i.e telescope 0).
Parameters: value) :param float fs_telescope: the telescope source flux (i.e the fitted value) :param float g_reference: the telescope blending parameter (i.e the fitted value)
Returns: the aligned to survey lightcurve in magnitude Return type: array_like