pypeit.core.gui.object_find module
This script allows the user to add/delete/modify object traces
Todo
Implement color scaling with RMB click+drag
- class pypeit.core.gui.object_find.ObjFindGUI(canvas, image, frame, det, sobjs, left, right, obj_trace, trace_models, axes, profdict, slit_ids=None, printout=False, runtime=False)[source]
Bases:
object
GUI to interactively identify object traces. The GUI can be run within PypeIt during data reduction, or as a standalone script outside of PypeIt. To initialise the GUI, call the initialise() function in this file.
- button_press_callback(event)[source]
What to do when the mouse button is pressed
- Parameters:
event (matplotlib.backend_bases.Event) – Matplotlib event instance containing information about the event
- button_release_callback(event)[source]
What to do when the mouse button is released
- Parameters:
event (matplotlib.backend_bases.Event) – Matplotlib event instance containing information about the event
- draw_callback(event)[source]
Draw callback (i.e. everytime the canvas is being drawn/updated)
- Parameters:
event (matplotlib.backend_bases.Event) – A matplotlib event instance
- get_axisID(event)[source]
Get the ID of the axis where an event has occurred
- Parameters:
event (matplotlib.backend_bases.Event) – Matplotlib event instance containing information about the event
- Returns:
Axis where the event has occurred
- Return type:
int, None
- get_ind_under_point(event)[source]
Get the index of the object trace closest to the cursor
- Parameters:
event (matplotlib.backend_bases.Event) – Matplotlib event instance containing information about the event
Initialise the menu buttons
- key_press_callback(event)[source]
What to do when a key is pressed
- Parameters:
event (matplotlib.backend_bases.Event) – Matplotlib event instance containing information about the event
- radio_meth(label, infobox=True)[source]
Tell the code what to do when a different trace method is selected
- Parameters:
label (str) – The label of the radio button that was clicked
- class pypeit.core.gui.object_find.ObjectTraces[source]
Bases:
object
Simple class to store the object traces
- add_object(det, pos_spat, pos_spec, trc_spat, trc_spec, fwhm, addrm=1)[source]
Add an object trace
- Parameters:
det (int) – Detector to add a slit on
pos_spat (float) – patial pixel position
pos_spec (float) – Spectral pixel position
trc_spat (numpy.ndarray) – Spatial trace of object
trc_spec (numpy.ndarray) – Spectral trace of object
fwhm (float) – FWHM of the object
addrm (int) – Flag to say if an object was been added (1), removed (-1), or was an auto found slit (0)
- delete_object(ind)[source]
Delete an object trace
- Parameters:
ind (int) – Index of object trace to remove
- get_pypeit_string()[source]
Construct a string that can be placed in the .pypeit file to define new object traces
- property nobj
- pypeit.core.gui.object_find.initialise(det, frame, left, right, obj_trace, trace_models, sobjs, slit_ids=None, runtime=False, printout=False)[source]
Initialise the ‘ObjFindGUI’ window for interactive object tracing
- Parameters:
det (int) – 1-indexed detector number
frame (numpy.ndarray) – Sky subtracted science image
left (numpy.ndarray) – Slit left edges
right (numpy.ndarray) – Slit right edges
obj_trace (dict) – Result of
pypeit.scripts.object_finding.parse_traces()
.trace_models (dict) – Dictionary with the object, standard star, and slit trace models
sobjs (SpecObjs, None) – SpecObjs Class
det – Detector index
slit_ids (list, None) – List of slit ID numbers
runtime (bool) – Is this GUI being launched during a data reduction?
printout (bool) – Should the results be printed to screen
- Returns:
Returns an instance of the ObjFindGUI class
- Return type: