HyperSpy is an open-source Python package primarily for working with multi-dimensional signals, i.e. multi-dimensional spectra, images and, in general n-dimensional signals. It simplifies the data analysis workflow by providing an elegant and powerful syntax to operate on this sort of data. The core idea of HyperSpy is that, when the array dimensions can be classified into two categories, “signal” and “navigation”, many operations become well defined. An example of this sort of data is a three-dimensional array that, depending on the case, could be looked at as a volume (3D signal, 0D navigation), a stack of images (2D signal, 1D navigation), a matrix of spectra (1D signal, 2D navigation), or a cube array of scalars (0D signal, 3D navigation). Data structures like these are common in many fields – from HyperSpy’s origins in electron microscopy, to remote sensing, particle physics and medical imaging (MRI, PET) to name a few.
I will show how this classification enables easy, interactive, multi-dimensional visualization and a powerful and intuitive syntax to write code that can operate on data regardless of the actual number of navigation dimensions. I will then discuss the recent addition of several powerful interactive tools, such as dynamically chained signals including interactive regions of interest. The interactive side of HyperSpy has also been leveraged by the recent development of a Qt-based graphical user interface (HyperSpyUI) with a custom matplotlib backend which captures all matplotlib figures as MDI-subwindows. This eases window management, and allows all figures to share a common set of toolbars, menus and widgets. The UI also has a framework for recording actions from the UI or code from an integrated IPython console, and a way to quickly turn such code into new user interface buttons and/or menu entries as plugins.