hyperspy.drawing._widgets.range module

class hyperspy.drawing._widgets.range.ModifiableSpanSelector(ax, **kwargs)

Bases: matplotlib.widgets.SpanSelector

contains(mouseevent)
dummy(*args, **kwargs)
mm_on_press(event)
mm_on_release(event)
move_left(event)
move_rect(event)
move_right(event)
range
release(event)

When the button is realeased, the span stays in the screen and the iteractivity machinery passes to modify mode

set_initial(initial_range=None)

Remove selection events, set the spanner, and go to modify mode.

switch_left_right(x, left_to_right)
turn_off()
update_range()
class hyperspy.drawing._widgets.range.RangeWidget(axes_manager)

Bases: hyperspy.drawing.widget.ResizableDraggableWidgetBase

RangeWidget is a span-patch based widget, which can be dragged and resized by mouse/keys. Basically a wrapper for ModifiablepanSelector so that it conforms to the common widget interface.

For optimized changes of geometry, the class implements two methods ‘set_bounds’ and ‘set_ibounds’, to set the geometry of the rectangle by value and index space coordinates, respectivly.

Implements the internal method _validate_geometry to make sure the patch will always stay within bounds.

disconnect()

Disconnect from all events (both matplotlib and navigation).

set_bounds(*args, **kwargs)

Set bounds by values. Bounds can either be specified in order left, bottom, width, height; or by keywords:

  • ‘bounds’: tuple (left, width)

OR * ‘x’/’left’ * ‘w’/’width’, alternatively ‘right’ (x+w)

If specifying with keywords, any unspecified dimensions will be kept constant (note: width will be kept, not right).

set_ibounds(*args, **kwargs)

Set bounds by indices. Bounds can either be specified in order left, bottom, width, height; or by keywords:

  • ‘bounds’: tuple (left, width)

OR * ‘x’/’left’ * ‘w’/’width’, alternatively ‘right’

If specifying with keywords, any unspecified dimensions will be kept constant (note: width will be kept, not right).

set_on(value)

Change the on state of the widget. If turning off, all patches will be removed from the matplotlib axes and the widget will disconnect from all events. If turning on, the patch(es) will be added to the matplotlib axes, and the widget will connect to its default events.

hyperspy.drawing._widgets.range.in_interval(number, interval)