hyperspy.interactive module

class hyperspy.interactive.Interactive(f, event='auto', recompute_out_event='auto', *args, **kwargs)

Bases: object

Chainable operations on Signals that update on events.

Update operation result when a given event is triggered.

Parameters
  • f (function or method) – A function that returns an object and that optionally can place the result in an object given through the out keyword.

  • event ({Event, "auto", None, iterable of events}) – Update the result of the operation when the event is triggered. If “auto” and f is a method of a Signal class instance its data_changed event is selected if the function takes an out argument. If None, update is not connected to any event. The default is “auto”. It is also possible to pass an iterable of events, in which case all the events are connected.

  • recompute_out_event ({Event, "auto", None, iterable of events}) – Optional argument. If supplied, this event causes a full recomputation of a new object. Both the data and axes of the new object are then copied over to the existing out object. Only useful for Signal or other objects that have an attribute axes_manager. If “auto” and f is a method of a Signal class instance its AxesManager any_axis_chaged event is selected. Otherwise the Signal data_changed event is selected. If None, recompute_out is not connected to any event. The default is “auto”. It is also possible to pass an iterable of events, in which case all the events are connected.

  • *args – Arguments to be passed to f.

  • **kwargs – Keyword arguments to be passed to f.

recompute_out()
update()
hyperspy.interactive._connect_events(event, to_connect)
hyperspy.interactive.interactive(f, event='auto', recompute_out_event='auto', *args, **kwargs)

Update operation result when a given event is triggered.

Parameters
  • f (function or method) – A function that returns an object and that optionally can place the result in an object given through the out keyword.

  • event ({Event, "auto", None, iterable of events}) – Update the result of the operation when the event is triggered. If “auto” and f is a method of a Signal class instance its data_changed event is selected if the function takes an out argument. If None, update is not connected to any event. The default is “auto”. It is also possible to pass an iterable of events, in which case all the events are connected.

  • recompute_out_event ({Event, "auto", None, iterable of events}) – Optional argument. If supplied, this event causes a full recomputation of a new object. Both the data and axes of the new object are then copied over to the existing out object. Only useful for Signal or other objects that have an attribute axes_manager. If “auto” and f is a method of a Signal class instance its AxesManager any_axis_chaged event is selected. Otherwise the Signal data_changed event is selected. If None, recompute_out is not connected to any event. The default is “auto”. It is also possible to pass an iterable of events, in which case all the events are connected.

  • *args – Arguments to be passed to f.

  • **kwargs – Keyword arguments to be passed to f.