NumpyAxesSelector:Widget to select a view from a numpy array

This module defines a widget able to convert a numpy array from n-dimensions to a numpy array with less dimensions.

class NumpyAxesSelector(parent=None)[source]

Widget to select a view from a numpy array.


The widget is set with an input data using setData(), and a requested output dimension using setAxisNames().

Widgets are provided to selected expected input axis, and a slice on the non-selected axis.

The final selected array can be reached using the getter selectedData(), and the event selectionChanged.

If the input data is a HDF5 Dataset, the selected output data will be a new numpy array.


Emitted when the input data change


Emitted when the selected axis change


Emitted when the selected data change


Emitted when a custom axis change


Clear the widget.


Set the axis names of the output selected data.

Axis names are defined from slower to faster axis.

The size of the list will constrain the dimension of the resulting array.

Parameters:axesNames (List[str]) – List of distinct strings identifying axis names

Set the available list of named axis which can be set to a value.

Parameters:axesNames (List[str]) – List of customable axis names

Set the input data unsed by the widget.

Parameters:data (numpy.ndarray) – The input data

Returns the input data.

Return type:Union[numpy.ndarray,None]

Returns the output data.

This is equivalent to:

numpy.transpose([self.selection()], self.permutation())
Return type:Union[numpy.ndarray,None]

Returns the axes permutation to convert data subset to selected data.

If permutation cannot be computer, it returns None.

Return type:Union[List[int],None]

Returns the selection tuple used to slice the data.

Return type:tuple
setSelection(selection, permutation=None)[source]

Set the selection along each dimension.

tuple returned by selection() can be provided as input, provided that it is for the same the number of axes and the same number of dimensions of the data.

  • selection (List[Union[int,slice,None]]) – The selection tuple with as one element for each dimension of the data. If an element is None, then the whole dimension is selected.
  • permutation (Union[List[int],None]) – The data axes indices to transpose. If not given, no permutation is applied

ValueError – When the selection does not match current data shape and number of axes.


Show or hide the combo-boxes allowing to map the plot axes to the data dimension.

Parameters:visible – Boolean