ArrayAnimatorWCS#

class mpl_animators.ArrayAnimatorWCS(data, wcs, slices, coord_params=None, ylim='dynamic', ylabel=None, clip_interval: Unit('%') = None, **kwargs)[source]#

Bases: ArrayAnimator

Animate an array with associated BaseLowLevelWCS object.

The following keyboard shortcuts are defined in the viewer:

  • ‘left’: previous step on active slider.

  • ‘right’: next step on active slider.

  • ‘top’: change the active slider up one.

  • ‘bottom’: change the active slider down one.

  • ‘p’: play/pause active slider.

Parameters:
  • data (numpy.ndarray) – The data to be visualized.

  • wcs (astropy.wcs.wcsapi.BaseLowLevelWCS) – The world coordinate object associated with the array.

  • slices (tuple or list) – A list specifying which axes of the array should be plotted on which axes. The list should be the same length as the number of pixel dimensions with 'x' and (optionally) 'y' in the elements corresponding to the axes to be plotted. If only 'x' is present a line plot will be drawn. All other elements should be 0.

  • coord_params (dict, optional) –

    This dict allows you to override WCSAxes parameters for each world coordinate. The keys of this dictionary should be a value which can be looked up in WCSAxes.coords (i.e. em.wl or hpln) and the values should be a dict which supports the following keys, and passes their values to the associated WCSAxes methods.

  • ylim (tuple or str, optional) – The yaxis limits to use when drawing a line plot, if ‘fixed’ then use the global data limits, if ‘dynamic’ then set the y limit for each frame individually (meaning the y limits change as you animate).

  • ylabel (string, optional) – The yaxis label to use when drawing a line plot. Setting the label on the y-axis on an image plot should be done via coord_params.

  • clip_interval (two-element Quantity, optional) – If provided, the data for each step will be clipped to the percentile interval bounded by the two numbers.

Attributes Summary

data_transposed

Return data for 2D plotting, transposed if needed.

Methods Summary

plot_start_image(ax)

Abstract method for plotting first slice of array.

plot_start_image_1d(ax)

Set up a line plot.

plot_start_image_2d(ax)

Setup an image plot.

update_plot(val, artist, slider)

Update the plot when a slider changes.

update_plot_1d(val, line, slider)

Update the line plot.

update_plot_2d(val, im, slider)

Update the image plot.

Attributes Documentation

data_transposed#

Return data for 2D plotting, transposed if needed.

Methods Documentation

plot_start_image(ax)[source]#

Abstract method for plotting first slice of array.

Must exist here but be defined in subclass.

plot_start_image_1d(ax)[source]#

Set up a line plot.

When plotting with WCSAxes, we always plot against pixel coordinate.

plot_start_image_2d(ax)[source]#

Setup an image plot.

update_plot(val, artist, slider)[source]#

Update the plot when a slider changes.

This method both updates the state of the Animator and also re-draws the matplotlib artist.

update_plot_1d(val, line, slider)[source]#

Update the line plot.

update_plot_2d(val, im, slider)[source]#

Update the image plot.