NDCubeSequence

class ndcube.NDCubeSequence(data_list, meta=None, common_axis=None, **kwargs)[source] [edit on github]

Bases: ndcube.ndcube_sequence.NDCubeSequenceBase, ndcube.mixins.sequence_plotting.NDCubeSequencePlotMixin

Attributes Summary

common_axis_extra_coords
cube_like_dimensions
cube_like_world_axis_physical_types
dimensions
index_as_cube Method to slice the NDCubesequence instance as a single cube
sequence_axis_extra_coords
world_axis_physical_types

Methods Summary

explode_along_axis(axis) Separates slices of NDCubes in sequence along a given cube axis into (N-1)DCubes.
plot([axes, plot_axis_indices, …]) Visualizes data in the NDCubeSequence with the sequence axis as a separate dimension.

Attributes Documentation

common_axis_extra_coords
cube_like_dimensions
cube_like_world_axis_physical_types
dimensions
index_as_cube

Method to slice the NDCubesequence instance as a single cube

Example

>>> # Say we have three Cubes each cube has common_axis=0 is time and shape=(3,3,3)
>>> data_list = [cubeA, cubeB, cubeC] # doctest: +SKIP
>>> cs = NDCubeSequence(data_list, meta=None, common_axis=0) # doctest: +SKIP
>>> # return zeroth time slice of cubeB in via normal NDCubeSequence indexing.
>>> cs[1,:,0,:] # doctest: +SKIP
>>> # Return same slice using this function
>>> cs.index_sequence_as_cube[3:6, 0, :] # doctest: +SKIP
sequence_axis_extra_coords
world_axis_physical_types

Methods Documentation

explode_along_axis(axis) [edit on github]

Separates slices of NDCubes in sequence along a given cube axis into (N-1)DCubes.

Parameters:axis (int) – The axis along which the data is to be changed.
plot(axes=None, plot_axis_indices=None, axes_coordinates=None, axes_units=None, data_unit=None, **kwargs) [edit on github]

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.
  • 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 (matplotlib.axes.Axes, ndcube.mixins.sequence_plotting.ImageAnimatorNDCubeSequence or ndcube.mixins.sequence_plotting.ImageAnimatorCubeLikeNDCubeSequence) – Axes or animation object depending on dimensionality of NDCubeSequence