qumas.MicrolensingMaps.plots module

map_plot(mag_map_2d, cmap='RdYlBu', vmin=-1.5, vmax=0.5, cbar_side='right', remove_labels=True, cbar_label='$-2.5 \\, \\log(\\mu/\\langle \\mu \\rangle)$', save='', **kwargs)[source]
map_pmf_plot(mag_map, label='', label_color_bar='$-2.5 \\, \\log(\\mu/\\langle \\mu \\rangle)$', vmin=-1.5, vmax=0.5, text_right_plot='Right plot', bins_limit=3, num_bins=100, cmap='RdYlBu', **kwargs)[source]
compare_maps_plot(mag_map_left, mag_map_right, vmin=-1.5, vmax=0.5, label_color_bar='$-2.5 \\, \\log(\\mu/\\langle \\mu \\rangle)$', cmap='RdYlBu', plot_sep=0.05, **kwargs)[source]

Compare two magnification maps side by side with auto-sized colorbars, placed using make_axes_locatable and showing an ‘under’ triangle via extend=’min’.

Parameters:

plot_sep (float, default=0.05) – Horizontal separation between the left and right plots (wspace in subplots_adjust).

Notes

The code assumes that the two maps are normalized, but if this is not the case, you can change label_color_bar.

map_plot_with_zoom(mag_map_2d, cmap='RdYlBu', vmin=-1.5, vmax=0.5, cbar_side='right', remove_labels=True, cbar_label='$-2.5 \\, \\log(\\mu/\\langle \\mu \\rangle)$', save='', *, extent=(-2, 2, -2, 2), zoom_box=None, zoom_center=None, zoom_size=(1.0, 1.0), zoom_axes_position='right', share_colorbar=True, connect_boxes=True, zoom_label='Zoom', main_label=None, label_fontsize=30, fig_size=(20, 10), wspace=0.08, hspace=0.1, interpolation='nearest')[source]

Show the full map and an enlarged view of a selected box. Colorbars are placed with make_axes_locatable so their height matches the axes exactly.

compare_maps_pmf(mag_map_left, mag_map_right, vmin=-1.5, vmax=0.5, label_color_bar='$-2.5 \\, \\log(\\mu/\\langle \\mu \\rangle)$', bins_limit=3, num_bins=100, cmap='RdYlBu', plot_sep=0.2, **kwargs)[source]

Compare two magnification maps side by side with their Probability Mass Functions (PMF).

Parameters:
  • mag_map_left (2D arrays) – Magnification maps to compare.

  • mag_map_right (2D arrays) – Magnification maps to compare.

  • vmin (float, optional) – Color scale limits for both maps. Defaults are -1.5 and 0.5.

  • vmax (float, optional) – Color scale limits for both maps. Defaults are -1.5 and 0.5.

  • label_color_bar (str, optional) – Label for the colorbars.

  • bins_limit (float, optional) – Range for PMF histogram edges (in log μ). Default = 3.

  • num_bins (int, optional) – Number of histogram bins for PMF calculation. Default = 100.

  • cmap (str, optional) – Colormap to use for the images. Default = ‘RdYlBu’.

  • plot_sep (float, optional) – Horizontal separation between panels (same as wspace in subplots_adjust).

  • text_left_plot (str, optional) – Titles for each map panel.

  • text_right_plot (str, optional) – Titles for each map panel.

  • cbar_size (str or float, optional) – Size and padding of the colorbars (used in make_axes_locatable).

  • cbar_pad (str or float, optional) – Size and padding of the colorbars (used in make_axes_locatable).

  • save (str, optional) – If provided, saves the figure to this path (with .pdf extension if not included).

class CompareMapsPMF(vmin=-1.5, vmax=0.5, label_color_bar='$-2.5 \\, \\log(\\mu/\\langle \\mu \\rangle)$', bins_limit=3, num_bins=100, cmap='RdYlBu', plot_sep=0.2)[source]

Bases: object

Compare two magnification maps side by side with their Probability Mass Functions (PMF).

Example

cmp = CompareMapsPMF() cmp.plot(mag_map_left, mag_map_right, text_left_plot=”Model A”, text_right_plot=”Model B”)

plot(mag_map_left, mag_map_right, **kwargs)[source]
map_plot_with_profiles(mag_map_2d, p0=None, p1=None, *, lines=None, labels=None, line_kwargs=None, per_line_kwargs=None, profile_mode='pixels', cmap='RdYlBu', vmin=-1.5, vmax=0.5, cbar_side='left', remove_labels=True, cbar_label='$-2.5 \\, \\log(\\mu/\\langle \\mu \\rangle)$', pix_L=None, veff=None, extent=(-2, 2, -2, 2), lines_pix=None, save='')[source]

Plot a 2D map and multiple line profiles on the right.

profile_mode:
  • “bilinear_pixels”: bilinear sampling, exactly one sample per crossed pixel; x = pixel index

  • “pixels”: discrete Bresenham pixels (nearest); x = pixel index

Parameters:
  • mag_map_2d (ndarray)

  • p0 (Tuple[float, float] | None)

  • p1 (Tuple[float, float] | None)

  • lines (List[Tuple[Tuple[float, float], Tuple[float, float]]] | None)

  • labels (List[str] | None)

  • line_kwargs (Dict[str, Any] | None)

  • per_line_kwargs (List[Dict[str, Any]] | None)

  • profile_mode (str)

  • save (str)

map_plot_with_profiles_pixels(mag_map_2d, *, lines_pix=None, p0=None, p1=None, extent=(-2, 2, -2, 2), profile_mode='pixels', **kwargs)[source]

If lines_pix is given, convert to data coords then call map_plot_with_profiles.

Parameters:
  • mag_map_2d (ndarray)

  • lines_pix (List[Tuple[Tuple[int, int], Tuple[int, int]]] | None)

  • p0 (Tuple[float, float] | None)

  • p1 (Tuple[float, float] | None)

  • profile_mode (str)