pyLIMA.microloutputs module

Created on Mon Nov 9 16:38:14 2015

@author: ebachelet

pyLIMA.microloutputs.LM_fit_errors(fit)[source]

Estimate the parameters errors from the fit.fit_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.LM_outputs(fit)[source]

Standard ‘LM’ and ‘DE’ 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.LM_parameters_result(fit)[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:

object

pyLIMA.microloutputs.LM_plot_align_data(fit, figure_axe)[source]

Plot the aligned data.

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.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.LM_plot_model(fit, figure_axe)[source]

Plot the microlensing model 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.LM_plot_parameters(fit)[source]

NOT USED

pyLIMA.microloutputs.LM_plot_residuals(fit, figure_axe)[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.MCMC_compute_fs_g(fit, mcmc_chains)[source]

Compute the corresponding source flux fs and blending factor g corresponding to each mcmc chain.

Parameters:
  • fit – a fit object. See the microlfits for more details.
  • mcmc_chains – a numpy array representing the mcmc chains.
Returns:

a numpy array containing the corresponding fluxes parameters

Return type:

array_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.MCMC_outputs(fit)[source]

Standard ‘LM’ and ‘DE’ outputs.

Parameters:fit (object) – a fit object. See the microlfits for more details.
Returns:a namedtuple containing the following attributes :

MCMC_chains : a numpy array containing all the parameters chains + the corresponding objective function.

MCMC_correlations : a numpy array representing the fitted parameters correlation matrix from the MCMC chains

figure_lightcurve : a two matplotlib subplot showing the data and 35 models and the residuals corresponding to the best model.

figure_distributions : a multiple matplotlib subplot representing the parameters distributions (2D slice + histogram)

Return type:object
pyLIMA.microloutputs.MCMC_plot_align_data(fit, parameters, plot_axe)[source]

Plot the data on the figure. Telescopes are aligned to the survey telescope (i.e number 0).

Parameters:
  • fit – a fit object. See the microlfits for more details.
  • parameters – the parameters [list] of the model you want to plot.
  • plot_axe – the matplotlib axes where you plot the data
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.MCMC_plot_model(fit, reference_telescope, parameters, couleurs, figure_axes, scalar_couleur_map)[source]

Plot a model to a given figure, with the color corresponding to the objective function of the model.

Parameters:
  • fit – a fit object. See the microlfits for more details.
  • parameters – the parameters [list] of the model you want to plot.
  • couleurs – the values of the objective function for the model that match the color

table scalar_couleur_map :param figure_axes: the axes where the plot are draw :param scalar_couleur_map: a matplotlib table that return a color given a scalar value (the objective function here)

pyLIMA.microloutputs.MCMC_plot_parameters_distribution(fit, mcmc_best)[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.MCMC_plot_residuals(fit, parameters, ax)[source]

Plot the data residual on the appropriate figure.

Parameters:
  • fit – a fit object. See the microlfits for more details.
  • parameters – the parameters [list] of the model you want to plot.
  • ax – the matplotlib axes where you plot the data
pyLIMA.microloutputs.align_telescope_lightcurve(lightcurve_telescope_flux, model_ghost, model_telescope)[source]

Align data to the survey telescope (i.e telescope 0).

Parameters:
  • lightcurve_telescope_mag (array_like) – the survey telescope in magnitude
  • fs_reference (float) – thce survey telescope reference source flux (i.e the fitted value)
  • g_reference (float) – the survey telescope reference blending parameter (i.e the fitted

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
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.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.initialize_plot_parameters(fit)[source]

Initialize the parameters 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.pdf_output(fit, output_directory)[source]
pyLIMA.microloutputs.plot_LM_ML_geometry(fit)[source]

Plot the lensing geometry (i.e source trajectory) and the table of best parameters. :param object fit: a fit object. See the microlfits for more details. :param list best_parameters: a list containing the model you want to plot the trajectory

pyLIMA.microloutputs.plot_MCMC_ML_geometry(fit, best_chains)[source]

Plot the lensing geometry (i.e source trajectory) and the table of best parameters. :param object fit: a fit object. See the microlfits for more details. :param list best_parameters: a list containing the model you want to plot the trajectory

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