RasterSequence

class sunraster.RasterSequence(data_list, common_axis, meta=None)[source]

Bases: sunraster.SpectrogramSequence

Class for holding, slicing and plotting series of spectrograph raster scans.

Parameters
  • data_list (list) – List of SpectrogramCube objects from the same spectral window and OBS ID. Must also contain the ‘detector type’ in its meta attribute.

  • common_axis (int) – The axis of the SpectrogramCube instances corresponding to the slit step axis.

  • meta (dict or header object (optional)) – Metadata associated with the sequence.

Attributes Summary

SnS_axis_extra_coords

SnS_dimensions

SnS_instrument_axes_types

SnS_world_axis_physical_types

raster_axis_extra_coords

raster_dimensions

raster_instrument_axes_types

raster_world_axis_physical_types

slice_as_SnS

Method to slice instance as though data were taken as a sit-and-stare, i.e.

slice_as_raster

Method to slice instance as though data were 4D, i.e.

Methods Summary

plot_as_SnS([axes, plot_axis_indices, …])

Visualizes data in the NDCubeSequence with the sequence axis folded into the common axis.

plot_as_raster([axes, plot_axis_indices, …])

Visualizes data in the NDCubeSequence with the sequence axis as a separate dimension.

Attributes Documentation

SnS_axis_extra_coords
SnS_dimensions
SnS_instrument_axes_types
SnS_world_axis_physical_types
raster_axis_extra_coords
raster_dimensions
raster_instrument_axes_types
raster_world_axis_physical_types
slice_as_SnS

Method to slice instance as though data were taken as a sit-and-stare, i.e. slit position and raster number are combined into a single axis.

slice_as_raster

Method to slice instance as though data were 4D, i.e. raster number, slit step position, position along slit, wavelength.

Methods Documentation

plot_as_SnS(axes=None, plot_axis_indices=None, axes_coordinates=None, axes_units=None, data_unit=None, **kwargs)

Visualizes data in the NDCubeSequence with the sequence axis folded into the common axis.

Based on the cube-like dimensionality of the sequence and value of plot_axis_indices kwarg, a Line/Image Plot/Animation is produced.

Parameters

axes: astropy.visualization.wcsaxes.core.WCSAxes or ??? or None.

The axes to plot onto. If None the current axes will be used.

plot_axis_indices: int or iterable of one or two int.

If two axis indices are given, the sequence is visualized as an image or 2D animation, assuming the sequence has at least 2 cube-like dimensions. The cube-like dimension indicated by the 0th index is displayed on the x-axis while the cube-like dimension indicated by the 1st index is displayed on the y-axis. If only one axis index is given (either as an int or a list of one int), then a 1D line animation is produced with the indicated cube-like dimension on the x-axis and other cube-like dimensions represented by animations sliders. Default=[-1, -2]. If sequence only has one cube-like dimension, plot_axis_indices is ignored and a static 1D line plot is produced.

axes_coordinates: None or list of None astropy.units.Quantity numpy.ndarray str

Denotes physical coordinates for plot and slider axes. If None coordinates derived from the WCS objects will be used for all axes. If a list, its length should equal either the number cube-like dimensions or the length of plot_axis_indices. If the length equals the number of cube-like dimensions, each element describes the coordinates of the corresponding cube-like dimension. If the length equals the length of plot_axis_indices, the 0th entry describes the coordinates of the x-axis while (if length is 2) the 1st entry describes the coordinates of the y-axis. Slider axes are implicitly set to None. If the number of cube-like dimensions equals the length of plot_axis_indices, the latter convention takes precedence. The value of each entry should be either None (implies derive the coordinates from the WCS objects), an astropy.units.Quantity or a numpy.ndarray of coordinates for each pixel, or a str denoting a valid extra coordinate. The physical coordinates expected by axes_coordinates should be an array of pixel_edges. A str entry in axes_coordinates signifies that an extra_coord will be used for the axis’s coordinates. The str must be a valid name of an extra_coord that corresponds to the same axis to which it is applied in the plot.

axes_units: None or `list of None, astropy.units.Unit and/or str

If None units derived from the WCS objects will be used for all axes. If a list, its length should equal either the number cube-like dimensions or the length of plot_axis_indices. If the length equals the number of cube-like dimensions, each element gives the unit in which the coordinates along the corresponding cube-like dimension should displayed whether they be a plot axes or a slider axes. If the length equals the length of plot_axis_indices, the 0th entry describes the unit in which the x-axis coordinates should be displayed while (if length is 2) the 1st entry describes the unit in which the y-axis should be displayed. Slider axes are implicitly set to None. If the number of cube-like dimensions equals the length of plot_axis_indices, the latter convention takes precedence. The value of each entry should be either None (implies derive the unit from the WCS object of the 0th sub-cube), astropy.units.Unit or a valid unit str.

data_unit: astropy.unit.Unit or valid unit str or None

Unit in which data be displayed. If the length of plot_axis_indices is 2, a 2D image/animation is produced and data_unit determines the unit represented by the color table. If the length of plot_axis_indices is 1, a 1D plot/animation is produced and data_unit determines the unit in which the y-axis is displayed.

Returns

axndcube.mixins.sequence_plotting.ImageAnimatorCubeLikeNDCubeSequence Axes or animation object depending on dimensionality of NDCubeSequence

Return type

ax: matplotlib.axes.Axes, ndcube.mixins.sequence_plotting.ImageAnimatorNDCubeSequence or

plot_as_raster(axes=None, plot_axis_indices=None, axes_coordinates=None, axes_units=None, data_unit=None, **kwargs)

Visualizes data in the NDCubeSequence with the sequence axis as a separate dimension.

Based on the dimensionality of the sequence and value of plot_axis_indices kwarg, a Line/Image Animation/Plot is produced.

Parameters
  • axes (astropy.visualization.wcsaxes.core.WCSAxes or ??? or None.) – The axes to plot onto. If None the current axes will be used.

  • plot_axis_indices (int or iterable of one or two int.) – If two axis indices are given, the sequence is visualized as an image or 2D animation, assuming the sequence has at least 2 dimensions. The dimension indicated by the 0th index is displayed on the x-axis while the dimension indicated by the 1st index is displayed on the y-axis. If only one axis index is given (either as an int or a list of one int), then a 1D line animation is produced with the indicated dimension on the x-axis and other dimensions represented by animations sliders. Default=[-1, -2]. If sequence only has one dimension, plot_axis_indices is ignored and a static 1D line plot is produced.

  • axes_coordinates (None or list of None astropy.units.Quantity numpy.ndarray str) – Denotes physical coordinates for plot and slider axes. If None coordinates derived from the WCS objects will be used for all axes. If a list, its length should equal either the number sequence dimensions or the length of plot_axis_indices. If the length equals the number of sequence dimensions, each element describes the coordinates of the corresponding sequence dimension. If the length equals the length of plot_axis_indices, the 0th entry describes the coordinates of the x-axis while (if length is 2) the 1st entry describes the coordinates of the y-axis. Slider axes are implicitly set to None. If the number of sequence dimensions equals the length of plot_axis_indices, the latter convention takes precedence. The value of each entry should be either None (implies derive the coordinates from the WCS objects), an astropy.units.Quantity or a numpy.ndarray of coordinates for each pixel, or a str denoting a valid extra coordinate. The physical coordinates expected by axes_coordinates should be an array of pixel_edges. A str entry in axes_coordinates signifies that an extra_coord will be used for the axis’s coordinates. The str must be a valid name of an extra_coord that corresponds to the same axis to which it is applied in the plot.

  • axes_units (None or `list of None, astropy.units.Unit and/or str) – If None units derived from the WCS objects will be used for all axes. If a list, its length should equal either the number sequence dimensions or the length of plot_axis_indices. If the length equals the number of sequence dimensions, each element gives the unit in which the coordinates along the corresponding sequence dimension should displayed whether they be a plot axes or a slider axes. If the length equals the length of plot_axis_indices, the 0th entry describes the unit in which the x-axis coordinates should be displayed while (if length is 2) the 1st entry describes the unit in which the y-axis should be displayed. Slider axes are implicitly set to None. If the number of sequence dimensions equals the length of plot_axis_indices, the latter convention takes precedence. The value of each entry should be either None (implies derive the unit from the WCS object of the 0th sub-cube), astropy.units.Unit or a valid unit str.

  • data_unit (astropy.unit.Unit or valid unit str or None) – Unit in which data be displayed. If the length of plot_axis_indices is 2, a 2D image/animation is produced and data_unit determines the unit represented by the color table. If the length of plot_axis_indices is 1, a 1D plot/animation is produced and data_unit determines the unit in which the y-axis is displayed.

Returns

ax – or ndcube.mixins.sequence_plotting.ImageAnimatorCubeLikeNDCubeSequence Axes or animation object depending on dimensionality of NDCubeSequence

Return type

matplotlib.axes.Axes, ndcube.mixins.sequence_plotting.ImageAnimatorNDCubeSequence