regularizepsf.visualize#

Visualization tools for PSFs.

Attributes#

Functions#

visualize_patch_counts(→ matplotlib.axes.Axes)

Visualize the number of stars identified within each patch.

_generate_colormap(→ matplotlib.colors.ListedColormap)

visualize_PSFs(→ matplotlib.figure.Figure)

Visualize estimated PSFs.

visualize_transfer_kernels(→ matplotlib.figure.Figure)

Compute and visualize transfer kernels.

Module Contents#

regularizepsf.visualize.visualize_patch_counts(patch_collection: regularizepsf.fitter.PatchCollectionABC, ax: matplotlib.axes.Axes | None = None, label_pixel_bounds: bool = False) matplotlib.axes.Axes#

Visualize the number of stars identified within each patch.

Parameters:
  • patch_collection (PatchCollectionABC) – A patch collection, such as that returned by CoordinatePatchCollection.find_stars_and_average.

  • ax (matplotlib.axes.Axes) – An Axes object on which to plot. If not provided, a new Figure will be generated.

  • label_pixel_bounds (bool) – If True, the axes of the plot will be labeled with the pixel range spanned by each patch.

regularizepsf.visualize._generate_colormap() matplotlib.colors.ListedColormap#
regularizepsf.visualize._colormap#
regularizepsf.visualize.visualize_PSFs(psfs: regularizepsf.corrector.ArrayCorrector, corrected: regularizepsf.fitter.PatchCollectionABC | None = None, all_patches: bool = False, region_size: int = 0, label_pixel_bounds: bool = False, fig: matplotlib.figure.Figure | None = None, fig_scale: float = 1, colorbar_label: str = 'Normalized brightness', axis_border_color: str = 'white', imshow_args: dict | None = None) matplotlib.figure.Figure#

Visualize estimated PSFs.

Accepts an ArrayCorrector, which contains the estimated PSFs across the image.

This utility can also produce a “before and after” visualization. To do this, apply your ArrayCorrector to your image set, and then run CoordinatePatchCollection.find_stars_and_average on your corrected images. This will estimated the PSF of your corrected images. Pass this CoordinatePatchCollection as the corrected argument to this function.

Parameters:
  • psfs (ArrayCorrector) – An ArrayCorrector containing the estimated PSFs

  • corrected (PatchCollectionABC) – A CoordinatePatchCollection computed on the corrected set of images

  • all_patches (boolean) – PSFs are estimated in a grid of overlapping patches, with each image pixel being covered by four patches. If True, all of these patches are plotted, which can be useful for diagnosing the estimated PSFs. If False, only a fourth of all patches are plotted (every other patch in both x and y), which can produce simpler illustrations.

  • region_size (int) – The width of the central region of each patch to plot, or 0 to plot each entire patch. If the PSFs were computed with a psf_size less than patch_size, it may be convenient to set region_size=psf_size, to omit the empty edges of each patch.

  • label_pixel_bounds (bool) – If True, the axes of the plot will be labeled with the pixel range spanned by each patch.

  • fig (matplotlb.figure.Figure) – A Figure on which to plot. If not provided, one will be created.

  • fig_scale (float) – If fig is not provided, scale the generated Figure up or down by this factor.

  • colorbar_label (str) – The label to show on the colorbar

  • axis_border_color (str) – The color to use for the lines separating the patch plots.

  • imshow_args (dict) – Additional arguments to pass to each plt.imshow() call

Returns:

fig – The generated figure

Return type:

matplotlib.figure.Figure

regularizepsf.visualize.visualize_transfer_kernels(psfs: regularizepsf.corrector.ArrayCorrector, alpha: float, epsilon: float, all_patches: bool = False, region_size: int = 0, label_pixel_bounds: bool = False, fig: matplotlib.figure.Figure | None = None, fig_scale: float = 1, colorbar_label: str = 'Transfer kernel amplitude', axis_border_color: str = 'black', imshow_args: dict | None = None) matplotlib.figure.Figure#

Compute and visualize transfer kernels.

Accepts an ArrayCorrector, which contains the estimated PSFs across the image. These PSFs, and the target PSF, will be used to compute each transfer kernel.

Parameters:
  • psfs (ArrayCorrector) – An ArrayCorrector containing the estimated PSFs and target PSF

  • alpha (float) – Values used in computing the regularized reciprocal of the computed PSFs. Provide the same values that you would pass to ArrayCorrector.correct_image.

  • epsilon (float) – Values used in computing the regularized reciprocal of the computed PSFs. Provide the same values that you would pass to ArrayCorrector.correct_image.

  • all_patches (boolean) – PSFs are estimated in a grid of overlapping patches, with each image pixel being covered by four patches. If True, all of these patches are plotted, which can be useful for diagnosing the computed PSFs. If False, only a fourth of all patches are plotted (every other patch in both x and y), which can produce simpler illustrations.

  • region_size (int) – The width of the central region of each patch to plot, or 0 to plot each entire patch. If the PSFs were computed with a psf_size less than patch_size, it may be convenient to set region_size=psf_size, to omit the empty edges of each patch.

  • label_pixel_bounds (bool) – If True, the axes of the plot will be labeled with the pixel range spanned by each patch.

  • fig (matplotlb.figure.Figure) – A Figure on which to plot. If not provided, one will be created.

  • fig_scale (float) – If fig is not provided, scale the generated Figure up or down by this factor.

  • colorbar_label (str) – The label to show on the colorbar

  • axis_border_color (str) – The color to use for the lines separating the patch plots.

  • imshow_args (dict) – Additional arguments to pass to each plt.imshow() call

Returns:

fig – The generated figure

Return type:

matplotlib.figure.Figure