pypeit.core.gui.edge_inspector module

Implements a matplotlib GUI to inspect and interact with the slit edge tracing.

class pypeit.core.gui.edge_inspector.EdgeInspectorGUI(edges)[source]

Bases: object

matplotlib-based GUI to analyze/manipulate edge traces.

Parameters:

edges (EdgeTraceSet) – Edge tracing to inspect/edit. Note this object is edited directly!

_reset_traces()[source]

Re-initialize the internals that perform the trace bookkeeping.

_trace_color(side)[source]

Return the color to use for each edge sided.

Parameters:

side (int) – Edge side. Either -1 for left or 1 for right.

Returns:

The color to use for the trace.

Return type:

str

add_left(pos)[source]

Add a new left trace nearest the cursor spatial (x) position.

This is an event call-back function that must accept an array-like object giving the pointer coordinates.

Parameters:

pos (array-like) – List with x and y position of the cursor at the time of the window event.

add_right(pos)[source]

Add a new right trace nearest the cursor spatial (x) position.

This is an event call-back function that must accept an array-like object giving the pointer coordinates.

Parameters:

pos (array-like) – List with x and y position of the cursor at the time of the window event.

add_trace(spat, side)[source]

Add a new trace nearest the cursor spatial (x) position.

Parameters:
  • spat (float) – The spatial (x) position of the cursor at the time of the window event.

  • side (int) – Edge side. Either -1 for left or 1 for right.

close()[source]

Close the GUI. Restores matplotlib RC defaults and closes the figure.

delete(pos)[source]

Delete the trace nearest the cursor spatial (x) position.

This is an event call-back function that must accept an array-like object giving the pointer coordinates.

Parameters:

pos (array-like) – List with x and y position of the cursor at the time of the window event.

move(pos)[source]

Move the trace nearest the cursor spatial (x) position to the cursor’s location.

This is an event call-back function that must accept an array-like object giving the pointer coordinates.

Parameters:

pos (array-like) – List with x and y position of the cursor at the time of the window event.

nearest_trace(spat)[source]

Find the trace nearest to the spatial position of the cursor.

Parameters:

spat (float) – The spatial (x) position of the cursor

plot_traces()[source]

Plot the traces from scratch.

undo(*args)[source]

Undo all operations since the last time the edges object was updated.

The function call includes *args because it is used as an event call-back function that must support arguments passed by the event. But all of these arguments are ignored.

update_traces(*args)[source]

Update the underlying trace data and edges object.

Changes to the traces are kept by the internals until we’re ready to “update” the edges object. This performs the update and replots the trace data.

All arguments to this function are accepted but ignored. The reason is because this is the function passed to matplotlib.widgets.Button.on_clicked, but this function does not need any of the input from the Button event.