NDCubeSequence

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

Bases: NDCubeSequenceBase

Class representing a sequence of NDCube-like objects.

The cubes are assumed to have the same dimensionality and axis physical types.

Parameters:
  • data_list (list) – List of ndcube.NDCube-like objects.

  • meta (dict or None) – Meta data relevant to the sequence as a whole.

  • common_axis (int or None) – The array axis of the cubes along which the cubes are ordered. For example, if the cubes are sequenced in chronological order and time is the 1st axis of each Cube, then common_axis should be set to 0. This enables the “cube_like” methods to be used, e.g. ndcube.NDCubeSequence.index_as_cube which slices the sequence as though it were a single cube concatenated along the common axis.

Attributes Summary

array_axis_physical_types

The physical types associated with each array axis, including the sequence axis.

common_axis_coords

The coordinate values at each location along the common axis across all cubes.

cube_like_array_axis_physical_types

The physical types associated with each array axis, omitting the sequence axis.

cube_like_dimensions

The length of each array axis as if all cubes were concatenated along the common axis.

dimensions

The length of each axis including the sequence axis.

index_as_cube

Slice the NDCubesequence instance as a single cube concatenated along the common axis.

plotter

sequence_axis_coords

Return the coordinate values along the sequence axis.

Methods Summary

explode_along_axis(axis)

Separates slices of N-D cubes along a given cube axis into (N-1)D cubes.

plot([sequence_axis_coords, sequence_axis_unit])

Visualize the NDCubeSequence.

plot_as_cube(*args, **kwargs)

Attributes Documentation

array_axis_physical_types

The physical types associated with each array axis, including the sequence axis.

common_axis_coords

The coordinate values at each location along the common axis across all cubes.

Only coordinates associated with the common axis in all cubes in the sequence are returned. Coordinates from different cubes are concatenated along the common axis. They thus represent the coordinate values at each location as if all cubes in the sequence were concatenated along the common axis.

cube_like_array_axis_physical_types

The physical types associated with each array axis, omitting the sequence axis.

cube_like_dimensions

The length of each array axis as if all cubes were concatenated along the common axis.

dimensions

The length of each axis including the sequence axis.

index_as_cube

Slice the NDCubesequence instance as a single cube concatenated along the common axis.

Example

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

Return the coordinate values along the sequence axis.

These are compiled from the GlobalCoords objects attached to each NDCube where each cube represents a location along the sequence axis. Only coordinates that are common to all cubes are returned.

Methods Documentation

explode_along_axis(axis)

Separates slices of N-D cubes along a given cube axis into (N-1)D cubes.

Parameters:

axis (int) – The axis along which the data is to be changed.

Returns:

New sequence of (N-1)D cubes broken up along given axis.

Return type:

ndcube.NDCubeSequence

plot(sequence_axis_coords=None, sequence_axis_unit=None, **kwargs)

Visualize the NDCubeSequence.

Parameters:
plot_as_cube(*args, **kwargs)[source]