LensFactory.LensModel.plot_corner — Function
LensFactory.LensModel.plot_corner(chains, logL; free_parameter_names=nothing,
                                                burn_in::Float64  = 0.3,
                                                thin::Int64       = 100,
                                                save_plot::Bool   = true,
                                                plot_name::String = "./corner.png",
                                                resolution::Int64 = 2)

Generates a corner plot for the given MCMC chains and log-likelihood values.

Arguments

  • chains: MCMC chains of shape (nsteps, nchains, n_params).
  • logL: Log-likelihood values corresponding to the chains, of shape (nsteps, nchains).

Keyword arguments

  • free_parameter_names=nothing: Optional list of parameter names for labeling the axes.
  • burn_in::Float64 = 0.3: Fraction of the initial samples to discard as burn-in.
  • thinn::Int64 = 100: Interval for thinning the chains to reduce autocorrelation.
  • save_plot::Bool = true: Whether to save the plot as "corner.png".
    • plot_name::String = "./corner.png": Filename for saving the plot.
    • resolution::Int64 = 2: Resolution for saving the plot.

Returns

  • A Makie figure object containing the corner plot.
source
LensFactory.LensModel.plot_trace — Function
LensFactory.LensModel.plot_trace(chains)

Generates trace plots for the given MCMC chains.

Arguments

  • chains: MCMC chains of shape (nsteps, nchains, n_params).

Keyword arguments

  • free_parameter_names = nothing: Optional list of parameter names for labeling the axes.
  • burn_in::Float64 = 0.0: Fraction of the initial samples to discard as burn-in.
  • thin::Int64 = 1: Interval for thinning the chains to reduce autocorrelation.
  • save_plot::Bool = true: Whether to save the plot as "corner_optimizer.png".
    • plot_name::String = "./trace.png": Filename for saving the plot.
    • resolution::Int64 = 2: Resolution for saving the plot.

Returns

  • A Makie figure object containing the trace plots.
source
LensFactory.LensModel.plot_best_model — Function
LensFactory.LensModel.plot_best_model(model, chains, logL)

Generates a plot comparing the observed image positions with the predicted image positions from the best-fit lens model.

Arguments

  • model: The lens model configuration.
  • chains: MCMC chains of shape (nsteps, nchains, n_params).
  • logL: Log-likelihood values corresponding to the chains, of shape (nsteps, nchains).

Keyword arguments

  • two_panel::Bool = false`: Whether to create a two-panel plot with source plane on the left and image plane on the right.
  • source::Union{Nothing, Integer} = nothing: Which system to plot. nothing plots every system and draws the critical curves/caustics at the redshift z_s. An integer plots only that system and draws the critical curves/caustics at that system's own angular-diameter distance ratio, in which case z_s is ignored.
  • z_s::RV = 1.5: Source redshift.
  • plot_error::Bool = true: Whether to plot the error ellipses for the observed image positions.
  • plot_critical::Bool = true: Whether to plot the critical curves.
    • critical_tan_kws::NamedTuple = (color=:red, linewidth=2, linestyle=:solid): Keyword arguments for plotting the tangential critical curve.
    • critical_rad_kws::NamedTuple = (color=:red, linewidth=2, linestyle=:dash): Keyword arguments for plotting the radial critical curve.
  • plot_caustics::Bool = true: Whether to plot the caustics.
    • caustic_tan_kws::NamedTuple = (color=:green, linewidth=2, linestyle=:solid): Keyword arguments for plotting the tangential caustic.
    • caustic_rad_kws::NamedTuple = (color=:green, linewidth=2, linestyle=:dash): Keyword arguments for plotting the radial caustic.
  • save_plot::Bool = true: Whether to save the plot as "best_model.png".
    • plot_name::String = "./best_model.png": Filename for saving the plot.
    • resolution::Int64 = 2: Resolution for saving the plot.

Returns

  • A Makie figure object containing the comparison plot.
source