hyperspy.drawing._widgets.range module

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

Bases: matplotlib.widgets.SpanSelector

contains(mouseevent)
draw_patch(*args)

Update the patch drawing.

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

When the button is released, 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(*args)

draw using newfangled blit or oldfangled draw depending on useblit

update_range()
class hyperspy.drawing._widgets.range.RangeWidget(axes_manager, ax=None, alpha=0.5, **kwargs)

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.already_warn_out_of_range = False
hyperspy.drawing._widgets.range.in_interval(number, interval)