Plotting support
This part contains plotting support for the LensFactory.jl package.
LensFactory.Lenses.plot_sky — Function
LensFactory.Lenses.plot_sky(θx::Real, θy::Real;
figure_size:: NTuple{2, Real} = (500, 500),
figure_padding::Int64 = 15,
fontsize::Int64 = 20,
xlabel::String = L"θ_x \text{(in arcseconds)}",
ylabel::String = L"θ_y \text{(in arcseconds)}"
)This function initializes a blank sky plot with specified axis labels and limits. The user can then add additional elements to the plot as needed. The function returns the figure and axis objects for further customization.
Arguments
θx– x-coordinates half sizeθy– y-coordinates half size
Keyword Arguments
figure_size = (500, 400)– Figure sizeresolution = 2– Resolution of the plotfigure_padding = 15– Padding around the plotfontsize = 20– Font size for the plotxlabel = L"θ_x \text{(in arcseconds)}"– X-axis labelylabel = L"θ_y \text{(in arcseconds)}"– Y-axis label
Returns
fig: A Makie figure object containing the sky plot.ax: The axis object of the plot for further customization.
LensFactory.Lenses.plot_image_plane — Function
LensFactory.Lenses.plot_image_plane(lens::Lenses.AbstractLens, θx::Matrix{<:RV}, θy::Matrix{<:RV}, adis::Float64;
two_panel::Bool = false,
plot_critical::Bool = true,
critical_tan_kws::NamedTuple = (color=:red, linewidth=2, linestyle=:solid),
critical_rad_kws::NamedTuple = (color=:red, linewidth=2, linestyle=:dash),
plot_caustic::Bool = true,
caustic_tan_kws::NamedTuple = (color=:green, linewidth=2, linestyle=:solid),
caustic_rad_kws::NamedTuple = (color=:green, linewidth=2, linestyle=:dash),
source::Union{Nothing, NTuple{2, RV}, Matrix{<:RV}} = nothing,
source_kws::NamedTuple = (color=:red, markersize=10, marker=:star5, heatmap=cgrad([:white, :blue])),
image_kws::NamedTuple = (color=:blue, markersize=10, marker=:star5, heatmap=cgrad([:white, :red])),
save_plot::Bool = false,
plot_name::String = "image_plane.png",
resolution::Int64 = 2,
fontsize::Int64 = 20,
figure_size::NTuple{2, Int64} = (800, 400),
figure_padding::Int64 = 15,
xlabel::AbstractString = L"θ_x~ ext{(in arcseconds)}",
ylabel::AbstractString = L"θ_y~ ext{(in arcseconds)}")Arguments
lens– The lens model to plotθx– x-coordinates gridθy– y-coordinates gridadis– Distance ratio ($D_{ds}/D_s$) for the lens system
Keyword arguments
two_panel = false– Whether to create a two-panel plot with source plane on the left and image plane on the rightplot_critical = true– Whether to plot the critical curvescritical_tan_kws = (color=:red, linewidth=2, linestyle=:solid)– Keywords for tangential critical curvecritical_rad_kws = (color=:red, linewidth=2, linestyle=:dash)– Keywords for radial critical curve
plot_caustic = true– Whether to plot the causticscaustic_tan_kws = (color=:green, linewidth=2, linestyle=:solid)– Keywords for tangential causticcaustic_rad_kws = (color=:green, linewidth=2, linestyle=:dash)– Keywords for radial caustic
source = nothing– Whether to plot source.nothing– No source to plot(x, y)– Postion of a point source (in arcseconds)Matrix– Extendes source profilesource_kws::NamedTuple = (color=:red, markersize=10, marker=:star5, heatmap=cgrad([:white, :blue]))– Keywords for source plotimage_kws::NamedTuple = (color=:blue, markersize=10, marker=:star5, heatmap=cgrad([:white, :red]))– Keywords for image plot
save_plot::Bool = falseplot_name::String = "image_plane.png"resolution::Int = 2
Returns
fig: A Makie figure object containing the image plane plot.ax: The axis object of the plot for further customization.
LensFactory.Lenses.plot_surface_density — Function
LensFactory.Lenses.plot_surface_density(lens::Lenses.AbstractLens, θx::Matrix{<:RV}, θy::Matrix{<:RV}, adis::Float64)Arguments
lens::Lenses.AbstractLens– The lens model to plotθx::Matrix{<:RV}– x-coordinates gridθy::Matrix{<:RV}– y-coordinates gridadis::Float64– Distance ratio $(D_{ds}/D_s)$ for the lens system
Keyword arguments
D_d::Float64 = NaN– Angular diameter distance to the lens (required ifunit != :convergence)unit::Symbol = :kg_m2– Unit for surface density. Options are :convergence, :kgm2, :msunpc2, :msun_arcsec2figure_size::NTuple{2, RV} = (500, 400)heatmap_kws::NamedTuple = (colormap=:cubehelix, colorrange=(0, 6))plot_contour::Bool = falsecontour_kws::NamedTuple = (levels=0.5:0.2:1.5, labels=false)
save_plot::Bool = falseplot_name::String = "surface_density.png"resolution::Int = 2
Returns
fig: A Makie figure object containing the surface density plot.ax: The axis object of the plot for further customization.
LensFactory.Lenses.plot_magnification_map — Function
LensFactory.Lenses.plot_magnification_map(lens::Lenses.AbstractLens, θx::Matrix{<:RV}, θy::Matrix{<:RV}, adis::Float64)Arguments
lens::Lenses.AbstractLens– The lens model to plotθx::Matrix{<:RV}– x-coordinates gridθy::Matrix{<:RV}– y-coordinates gridadis::Float64– Distance ratio $(D_{ds}/D_s)$ for the lens system
Keyword arguments
plane::Symbol = :image– Whether to plot |μ| map in:imageor:sourceplanerays_per_pixel::Int64 = 1– Only relevant ifplane = :sourcefigure_size::NTuple{2, RV} = (500, 400)heatmap_kws::NamedTuple = (colormap=:binary, colorrange=(1, 100))save_plot::Bool = falseplot_name::String = "magnification_map.png"resolution::Int = 2
Returns
fig: A Makie figure object containing the magnification map.ax: The axis object of the plot for further customization.
LensFactory.Lenses.plot_magnification_profile — Function
LensFactory.Lenses.plot_magnification_profile(lens::Lenses.AbstractLens, θx::Matrix{<:RV}, θy::Matrix{<:RV}, adis::Float64)Arguments
lens::Lenses.AbstractLens– The lens model to plotθx::Matrix{<:RV}– x-coordinates gridθy::Matrix{<:RV}– y-coordinates gridadis::Float64– Distance ratio $(D_{ds}/D_s)$ for the lens system
Keyword arguments
plane::Symbol = :image– Whether to plot |μ| map in:imageor:sourceplanerays_per_pixel::Int64 = 1– Only relevant ifplane = :sourcemu_range::StepRange{<:RV, <:RV} = 1:5:500unit::Float64 = ANGLE_ARCMIN^2figure_size::NTuple{2, RV} = (500, 400)plot_kws::NamedTuple = (color=:black, linewidth=2, linestyle=:solid)save_plot::Bool = falseplot_name::String = "magnification_profile.png"resolution::Int = 2
Returns
fig: A Makie figure object containing the magnification profile plot.ax: The axis object of the plot for further customization.