Plotting

Plotting#

jwpoint.plot.plot_dithers(img, xopt_all, yopt_all, size, full_frame=True, show_mask=True, psf=None)[source]#

Plot the pointing for multiple dithers

This function produces two plots:

  • A full image with the dithers marked by their pattern number

  • A figure with a zoomed-in view on each dither using zoom_plot().

Parameters:
  • img (ndarray) – The full-frame image

  • xopt_all (Iterable[int]) – The x position of each dither

  • yopt_all (Iterable[int]) – The y position of each dither

  • size (int) – The size to use for the zoomed-in plots

  • full_frame (bool) – Show the full frame image with the dithers on it.

  • show_mask (bool) – Show the bad pixel mask for each dither if True

  • psf (ndarray | None) – A PSF with shape (size, size) to visualize a point source in the region corresponding to each dither. Only the bad pixel mask is shown if no PSF is passsed. Defaults to None.

Return type:

tuple[Figure, Figure]

Returns:

The two figures (full frame and zoomed-in)

jwpoint.plot.zoom_plot(img, x, y, size, axs=None, show_mask=True, psf=None)[source]#

Zoomed plot on a region of an image

Also plots the NaN mask on a second panel, optionally with a reference PSF to see where bad pixels would fall on a point source image in that region.

The mask can be turned off with show_mask=False.

Parameters:
  • img (ndarray) – The full image as a 2D array

  • x (int) – x coordinates of the image center

  • y (int) – y coordinate of the image center

  • size (int) – The size of the region to crop

  • show_mask (bool) – Show the bad pixel mask if True

  • axs (ndarray[Axes] | None) – Two Axes on which the plots should go. Fetch from the current figure if None. Defaults to None.

  • psf (ndarray | None) – Image of a reference PSF as a 2D array. Must have a shape (size,  size). Defalts to None.

Return type:

ndarray

Returns:

The boolean mask indicating NaNs in the final zoomed in region.