Module: plotting#
- kbmod.analysis.plotting.iter_over_obj(objects)[source]#
Folds the given list of objects on their
Name
column and iterates over them sorted by date-time stamp.- Parameters:
- objectsastropy.table.Table
Table of objects.
- Returns:
- objiterator
Iterator over individual object observations.
- kbmod.analysis.plotting.plot_all_objs(ax, objects, count=-1, show_field=False, center=None, radius=1.1, lw=0.9, ms=1)[source]#
Plots object tracks on the given axis.
- Parameters:
- axmatplotlib.pyplot.Axes
Axis.
- objectsastropy.table.Table
Table of objects. Must contain columns
Name
,RA
andDEC
identifying unique objects, their right ascension and declination coordinates.- countint
Number of tracks to plot. Default -1, plots all objects.
- show_fieldbool
False by default, when True requires
center
and ``radius``to be specified. Adds an circle around the center coordinates with the given radius.- centerNone or tuple
A pair of
(x, y)
coordinates of the center of the field.- radiusfloat
Radius of the field, in decimal degrees. Useful to provide context as to which objects might have landed into the field of view. Default: 1.1 degrees, to match the DECam FOV.
- lwfloat
Line width of the object’s trajectory.
- msfloat
Marker size of the object’s ephemerides.
- Returns:
- axmatplotlib.pyplot.Axes
Axis.
- kbmod.analysis.plotting.plot_bbox(ax, bbox)[source]#
Adds the footprint defined by the given BBOX to the axis.
- Parameters:
- axmatplotlib.pyplot.Axes
Axis.
- bboxlist
List of 4 tuples representing (x, y) coordinates of the corners of a rectanlge, in clockwise convention.
- Returns:
- axmatplotlib.pyplot.Axes
Modified Axis.
- kbmod.analysis.plotting.plot_bboxes(ax, bboxes)[source]#
Adds the footprints defined by each given BBOX to the axis.
- Parameters:
- axmatplotlib.pyplot.Axes
Axis.
- bboxlist[list]
List of bboxes. Each bbox is a list of 4 tuples representing (x, y) coordinates of the corners of a rectanlge, in clockwise convention.
- Returns:
- axmatplotlib.pyplot.Axes
Modified Axis.
- kbmod.analysis.plotting.plot_cutouts(axes, cutouts, remove_extra_axes=True)[source]#
Plots cutouts (images) onto given axes.
The number of axes must be equal to or greater than the number of cutouts.
- Parameters:
- axlist[matplotlib.pyplot.Axes]
Axes.
- cutoutslist, np.array or astropy.ndutils.Cutout2D
Collection of numpy arrays or
Cutout2D
objects to plot.- remove_extra_axesbool, optional
When True (default), the axes that would be left empty are removed from the plot.
- Raises:
- ValueError - When number of given axes is less than
- the number of given cutouts.
- kbmod.analysis.plotting.plot_field(ax, center, radius)[source]#
Adds a circle of the given radius at the given center coordinates to the given axis.
- Parameters:
- axmatplotlib.pyplot.Axes
Axis.
- centertuple or list
An (x, y) pair of coordiantes
- radiusfloat
Radius of the circle around the center.
- Returns:
- axmatplotlib.pyplot.Axes
Modified Axis.
- kbmod.analysis.plotting.plot_focal_plane(ax, hdulist, showExtName=True, txt_x_offset=<Quantity 20. arcsec>, txt_y_offset=<Quantity -120. arcsec>)[source]#
Plots the footprint of given HDUList on the axis.
Iterates over each HDU in the HDUList and attempts to plot its footprint if it can determine a valid WCS. Otherwise skips it.
- Parameters:
- axmatplotlib.pyplot.Axes
Axis.
- hdulistlist[astropy.io.fits.HDUList]
An HDUList object.
- showExtNamebool
Display the value of keycard
EXTNAME
as a label at the center of the plotted footprint, if the header contains a keycardEXTNAME
.- txt_x_offsetastropy.units.arcsec
X-axis offset of the EXTNAME label, if one exists. Default: 20
- txt_y_offsetastropy.units.arcsec
Y-axis offset of the EXTNAME label, if one exists. Default: -120
- Returns:
- axmatplotlib.pyplot.Axes
Axis.
- kbmod.analysis.plotting.plot_footprint(ax, wcs)[source]#
Adds the footprint defined by the given WCS to the axis.
- Parameters:
- axmatplotlib.pyplot.Axes
Axis.
- wcsastropy.wcs.WCS
World Coordinate System instance from which the footprint will be calculated from.
- Returns:
- axmatplotlib.pyplot.Axes
Modified Axis.
- kbmod.analysis.plotting.plot_footprints(ax, wcs_list)[source]#
Adds the footprints defined by each given WCS to the axis.
- Parameters:
- axmatplotlib.pyplot.Axes
Axis.
- wcs_listlist[astropy.wcs.WCS]
List of WCS objects whose footprints are being plotted.
- Returns:
- axmatplotlib.pyplot.Axes
Modified Axis.
- kbmod.analysis.plotting.plot_image(img, ax=None, figure=None, norm=True, title=None, show_counts=True, cmap=None, clim=None)[source]#
If no axis is given creates a new figure. Draws a crosshair at the center of the image. Must provide both axis and figure; figure is required so a colorbar could be attached to it.
If a one-dimensional array is given (as for a stamp), the function will try to reshape as a square image.
- Parameters:
- imgnp.ndarray, RawImage, or LayeredImage
The image data.
- axmatplotlib.pyplot.Axes or None
Axes, None by default.
- figurematplotlib.pyplot.Figure or None
Figure, None by default.
- norm: `bool`, optional
Normalize the image using Astropy’s ImageNormalize using ZScaleInterval and AsinhStretch. True by default.
- titlestr or None, optional
Title of the plot.
- show_countsbool
Show the counts color bar.
True
by default.- cmapstr or None
Colormap to use.
None
by default.- clim: `tuple` or `None`
The minimum and maximum values for the colormap (vmin, vmax).
- Returns:
- figurematplotlib.pyplot.Figure
Modified Figure.
- axmatplotlib.pyplot.Axes
Modified Axes.
- kbmod.analysis.plotting.plot_multiple_images(images, figure=None, columns=3, labels=None, norm=False, cmap=None, clim=None)[source]#
Plot multiple images in a grid.
- Parameters:
- imagesa list, numpy.ndarray, or ImageStack of images.
The series of images to plot.
- figurematplotlib.pyplot.Figure or None
Figure,
None
by default.- columnsint
The number of columns to use. 3 by default.
- labelslist of str
The labels to use for each image.
None
by default.- norm: `bool`
Normalize the image using Astropy’s ImageNormalize using ZScaleInterval and AsinhStretch.
False
by default.- cmapstr or list(str) or None
Colormap to use.
None
by default.- clim: `tuple` or `list(tuple)` or `None`
The minimum and maximum values for the colormap (vmin, vmax).
- kbmod.analysis.plotting.plot_result_row(row, times=None, coadd_col='stamp', figure=None)[source]#
Plot a single row of the results table.
- Parameters:
- rowastropy.table.row.Row
The information from the results to plot.
- timesa list or numpy.ndarray of floats
The array of the time stamps. If
None
then uses equally spaced points. None by default.- coadd_colstr
The name of the coadd to display.
- figurematplotlib.pyplot.Figure or None
Figure, None by default.
- kbmod.analysis.plotting.plot_result_row_summary(row, times=None, figure=None)[source]#
Plot a single row of the results table.
- Parameters:
- rowastropy.table.row.Row
The information from the results to plot.
- timesa list or numpy.ndarray of floats
The array of the time stamps. If
None
then uses equally spaced points. None by default.- figurematplotlib.pyplot.Figure or None
Figure, None by default.
- kbmod.analysis.plotting.plot_search_trajectories(gen, figure=None)[source]#
Plot the search trajectorys as created by a TrajectoryGenerator.
- Parameters:
- genkbmod.trajectory_generator.TrajectoryGenerator
The generator for the trajectories.
- figurematplotlib.pyplot.Figure or None
Figure, None by default.
- Returns:
- figurematplotlib.pyplot.Figure
Modified Figure.
- axmatplotlib.pyplot.Axes
Modified Axes.
- kbmod.analysis.plotting.plot_time_series(values, times=None, indices=None, ax=None, figure=None, title=None)[source]#
Plot a time series on the graph.
- Parameters:
- valuesa list or numpy.ndarray of floats
The array of the values at each time.
- timesa list or numpy.ndarray of floats
The array of the time stamps. If
None
then uses equally spaced points. None by default.- indicesa list or numpy.ndarray of bools
The array of which indices are valid. If
None
then all indices are considered valid. None by default.- axmatplotlib.pyplot.Axes or None
Axes, None by default.
- figurematplotlib.pyplot.Figure or None
Figure, None by default.
- titlestr or None, optional
Title of the plot. None by default.
- kbmod.analysis.plotting.transform_rect(points)[source]#
Given a rectangle defined by 4 points (clockwise convention) returns top-left point, width, height, and angle of rectangle.
- Parameters:
- pointslist
List of 4 tuples representing (x, y) coordinates of the corners of a rectanlge, in clockwise convention.
- Returns:
- xytuple
Top left corner (x, y) coordinates.
- widthfloat
Width
- heightfloat
Height
- anglefloat
Angle of rotation, in radians.