hyperspyui.hooksignal module

Created on Sat Feb 28 17:52:42 2015

@author: Vidar Tonaas Fauske

class hyperspyui.hooksignal.HookedSignal(data, **kwds)

Bases: BaseSignal

plot(*args, **kwargs)

Plot the signal at the current coordinates.

For multidimensional datasets an optional figure, the “navigator”, with a cursor to navigate that data is raised. In any case it is possible to navigate the data using the sliders. Currently only signals with signal_dimension equal to 0, 1 and 2 can be plotted.

Parameters:
  • navigator (str, None, or BaseSignal (or subclass).)

  • 'auto' (Allowed string values are) –

    • If 'auto':

      • If navigation_dimension > 0, a navigator is provided to explore the data.

      • If navigation_dimension is 1 and the signal is an image the navigator is a sum spectrum obtained by integrating over the signal axes (the image).

      • If navigation_dimension is 1 and the signal is a spectrum the navigator is an image obtained by stacking all the spectra in the dataset horizontally.

      • If navigation_dimension is > 1, the navigator is a sum image obtained by integrating the data over the signal axes.

      • Additionally, if navigation_dimension > 2, a window with one slider per axis is raised to navigate the data.

      • For example, if the dataset consists of 3 navigation axes “X”, “Y”, “Z” and one signal axis, “E”, the default navigator will be an image obtained by integrating the data over “E” at the current “Z” index and a window with sliders for the “X”, “Y”, and “Z” axes will be raised. Notice that changing the “Z”-axis index changes the navigator in this case.

      • For lazy signals, the navigator will be calculated using the compute_navigator() method.

    • If 'slider':

      • If navigation dimension > 0 a window with one slider per axis is raised to navigate the data.

    • If 'spectrum':

      • If navigation_dimension > 0 the navigator is always a spectrum obtained by integrating the data over all other axes.

      • Not supported for lazy signals, the 'auto' option will be used instead.

    • If None, no navigator will be provided.

    Alternatively a BaseSignal (or subclass) instance can be provided. The navigation or signal shape must match the navigation shape of the signal to plot or the navigation_shape + signal_shape must be equal to the navigator_shape of the current object (for a dynamic navigator). If the signal dtype is RGB or RGBA this parameter has no effect and the value is always set to 'slider'.

  • 'slider'

    • If 'auto':

      • If navigation_dimension > 0, a navigator is provided to explore the data.

      • If navigation_dimension is 1 and the signal is an image the navigator is a sum spectrum obtained by integrating over the signal axes (the image).

      • If navigation_dimension is 1 and the signal is a spectrum the navigator is an image obtained by stacking all the spectra in the dataset horizontally.

      • If navigation_dimension is > 1, the navigator is a sum image obtained by integrating the data over the signal axes.

      • Additionally, if navigation_dimension > 2, a window with one slider per axis is raised to navigate the data.

      • For example, if the dataset consists of 3 navigation axes “X”, “Y”, “Z” and one signal axis, “E”, the default navigator will be an image obtained by integrating the data over “E” at the current “Z” index and a window with sliders for the “X”, “Y”, and “Z” axes will be raised. Notice that changing the “Z”-axis index changes the navigator in this case.

      • For lazy signals, the navigator will be calculated using the compute_navigator() method.

    • If 'slider':

      • If navigation dimension > 0 a window with one slider per axis is raised to navigate the data.

    • If 'spectrum':

      • If navigation_dimension > 0 the navigator is always a spectrum obtained by integrating the data over all other axes.

      • Not supported for lazy signals, the 'auto' option will be used instead.

    • If None, no navigator will be provided.

    Alternatively a BaseSignal (or subclass) instance can be provided. The navigation or signal shape must match the navigation shape of the signal to plot or the navigation_shape + signal_shape must be equal to the navigator_shape of the current object (for a dynamic navigator). If the signal dtype is RGB or RGBA this parameter has no effect and the value is always set to 'slider'.

  • 'spectrum'. (and) –

    • If 'auto':

      • If navigation_dimension > 0, a navigator is provided to explore the data.

      • If navigation_dimension is 1 and the signal is an image the navigator is a sum spectrum obtained by integrating over the signal axes (the image).

      • If navigation_dimension is 1 and the signal is a spectrum the navigator is an image obtained by stacking all the spectra in the dataset horizontally.

      • If navigation_dimension is > 1, the navigator is a sum image obtained by integrating the data over the signal axes.

      • Additionally, if navigation_dimension > 2, a window with one slider per axis is raised to navigate the data.

      • For example, if the dataset consists of 3 navigation axes “X”, “Y”, “Z” and one signal axis, “E”, the default navigator will be an image obtained by integrating the data over “E” at the current “Z” index and a window with sliders for the “X”, “Y”, and “Z” axes will be raised. Notice that changing the “Z”-axis index changes the navigator in this case.

      • For lazy signals, the navigator will be calculated using the compute_navigator() method.

    • If 'slider':

      • If navigation dimension > 0 a window with one slider per axis is raised to navigate the data.

    • If 'spectrum':

      • If navigation_dimension > 0 the navigator is always a spectrum obtained by integrating the data over all other axes.

      • Not supported for lazy signals, the 'auto' option will be used instead.

    • If None, no navigator will be provided.

    Alternatively a BaseSignal (or subclass) instance can be provided. The navigation or signal shape must match the navigation shape of the signal to plot or the navigation_shape + signal_shape must be equal to the navigator_shape of the current object (for a dynamic navigator). If the signal dtype is RGB or RGBA this parameter has no effect and the value is always set to 'slider'.

  • axes_manager (None or AxesManager) – If None, the signal’s axes_manager attribute is used.

  • plot_markers (bool, default True) – Plot markers added using s.add_marker(marker, permanent=True). Note, a large number of markers might lead to very slow plotting.

  • navigator_kwds (dict) – Only for image navigator, additional keyword arguments for matplotlib.pyplot.imshow().

  • norm (str, default 'auto') – The function used to normalize the data prior to plotting. Allowable strings are: 'auto', 'linear', 'log'. If 'auto', intensity is plotted on a linear scale except when power_spectrum=True (only for complex signals).

  • autoscale (str) – The string must contain any combination of the 'x' and 'v' characters. If 'x' or 'v' (for values) are in the string, the corresponding horizontal or vertical axis limits are set to their maxima and the axis limits will reset when the data or the navigation indices are changed. Default is 'v'.

  • **kwargs (dict) – Only when plotting an image: additional (optional) keyword arguments for matplotlib.pyplot.imshow().

hyperspyui.hooksignal._on_plotted(signal)
hyperspyui.hooksignal._on_plotting(signal)
hyperspyui.hooksignal.connect_plotted(callback, userdata=None)

Call to subscribe to Signal plot events. ‘callback’ is called on the event. The Signal being plotted is passed as the first argument, then follows the arguments passed to plot(). If userdata is not None is is passed as a keyword argument, otherwise, it is left out. Plotted event are called just after the plot call is executed.

hyperspyui.hooksignal.connect_plotting(callback)

Call to subscribe to Signal plot events. ‘callback’ is called on the event. The Signal being plotted is passed as the first argument, then follows the arguments passed to plot(). Plotting event are called just before the plot call is executed.

hyperspyui.hooksignal.dehook_signal()

Call this function to remove hooks from Signal

hyperspyui.hooksignal.disconnect_plotted(callback)

Disconnect callback from subscription.

hyperspyui.hooksignal.disconnect_plotting(callback)

Disconnect callback from subscription.

hyperspyui.hooksignal.hook_signal()

Call this function to enable hooks of Signal