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 size
  • resolution = 2 – Resolution of the plot
  • figure_padding = 15 – Padding around the plot
  • fontsize = 20 – Font size for the plot
  • xlabel = L"θ_x \text{(in arcseconds)}" – X-axis label
  • ylabel = 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.
source
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 grid
  • adis – 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 right
  • plot_critical = true – Whether to plot the critical curves
    • critical_tan_kws = (color=:red, linewidth=2, linestyle=:solid) – Keywords for tangential critical curve
    • critical_rad_kws = (color=:red, linewidth=2, linestyle=:dash) – Keywords for radial critical curve
  • plot_caustic = true – Whether to plot the caustics
    • caustic_tan_kws = (color=:green, linewidth=2, linestyle=:solid) – Keywords for tangential caustic
    • caustic_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 profile
    • source_kws::NamedTuple = (color=:red, markersize=10, marker=:star5, heatmap=cgrad([:white, :blue])) – Keywords for source plot
    • image_kws::NamedTuple = (color=:blue, markersize=10, marker=:star5, heatmap=cgrad([:white, :red])) – Keywords for image plot
  • save_plot::Bool = false
    • plot_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.
source
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 grid
  • adis::Float64 – Distance ratio $(D_{ds}/D_s)$ for the lens system

Keyword arguments

  • D_d::Float64 = NaN – Angular diameter distance to the lens (required if unit != :convergence)
  • unit::Symbol = :kg_m2 – Unit for surface density. Options are :convergence, :kgm2, :msunpc2, :msun_arcsec2
  • figure_size::NTuple{2, RV} = (500, 400)
  • heatmap_kws::NamedTuple = (colormap=:cubehelix, colorrange=(0, 6))
  • plot_contour::Bool = false
    • contour_kws::NamedTuple = (levels=0.5:0.2:1.5, labels=false)
  • save_plot::Bool = false
    • plot_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.
source
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 grid
  • adis::Float64 – Distance ratio $(D_{ds}/D_s)$ for the lens system

Keyword arguments

  • plane::Symbol = :image – Whether to plot |μ| map in :image or :source plane
  • rays_per_pixel::Int64 = 1 – Only relevant if plane = :source
  • figure_size::NTuple{2, RV} = (500, 400)
  • heatmap_kws::NamedTuple = (colormap=:binary, colorrange=(1, 100))
  • save_plot::Bool = false
    • plot_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.
source
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 grid
  • adis::Float64 – Distance ratio $(D_{ds}/D_s)$ for the lens system

Keyword arguments

  • plane::Symbol = :image – Whether to plot |μ| map in :image or :source plane
  • rays_per_pixel::Int64 = 1 – Only relevant if plane = :source
  • mu_range::StepRange{<:RV, <:RV} = 1:5:500
  • unit::Float64 = ANGLE_ARCMIN^2
  • figure_size::NTuple{2, RV} = (500, 400)
  • plot_kws::NamedTuple = (color=:black, linewidth=2, linestyle=:solid)
  • save_plot::Bool = false
    • plot_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.
source