pypeit.core.gui.skysub_regions module
This script allows the user to manually select the sky background regions
- class pypeit.core.gui.skysub_regions.SkySubGUI(canvas, image, frame, outname, det, slits, axes, pypeline, spectrograph, printout=False, runtime=False, resolution=None, initial=False, flexure=None, overwrite=False)[source]
Bases:
object
GUI to interactively define the sky regions. The GUI can be run within PypeIt during data reduction, or as a standalone script outside of PypeIt. To initialize the GUI, call the initialize() function in this file.
- button_cont(event)[source]
What to do when the ‘exit and save’ button is clicked
- Parameters:
event – matplotlib.backend_bases.Event A matplotlib event instance
- button_exit(event)[source]
What to do when the ‘exit and do not save changes’ button is clicked
- Parameters:
event – matplotlib.backend_bases.Event A matplotlib event instance
- 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_regb(event)[source]
Allow for text to be entered in the terminal. If the text is valid, and then apply to all slits. The text should be a comma separated list of percentages to apply to all slits Example: The following string :10, 35:65, 80: would select the first 10%, the inner 30%, and the final 20% of all slits
- Parameters:
event – matplotlib.backend_bases.Event A matplotlib event instance
- 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_current_slit(event)[source]
Get the index of the slit closest to the cursor
- Parameters:
event – matplotlib.backend_bases.Event Matplotlib event instance containing information about the event
- get_outname()[source]
Get an output filename
- Returns:
outfil – The output filename to use for the Sky Regions calibration frame
- Return type:
- get_result()[source]
Generate a calibration file containing a mask of the skysub regions, and print information for what the user should include in their .pypeit file
- Returns:
msskyreg – Returns an instance of the
SkyRegions
class. If None is returned, the user has requested to not use the updates.- Return type:
SkyRegions
, None
- classmethod initialize(det, frame, slits, pypeline, spectrograph, outname='skyregions.fits', overwrite=False, initial=False, flexure=None, runtime=False, printout=False)[source]
Initialize the ‘ObjFindGUI’ window for interactive object tracing
- Parameters:
det (int) – Detector index
frame (numpy.ndarray) – Sky subtracted science image
slits (
SlitTraceSet
) – Object with the image coordinates of the slit edgespypeline (str) – Name of the reduction pipeline
spectrograph (str) – Name of the spectrograph
printout (bool) – Should the results be printed to screen
runtime (bool) – Is this GUI being launched during a data reduction?
- Returns:
srgui – Returns an instance of the
SkySubGUI
class- Return type:
Initialize 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
- operations(key, axisID)[source]
Canvas operations
- Parameters:
key – str Which key has been pressed
axisID – int The index of the axis where the key has been pressed (see get_axisID)
- update_infobox(message="Press '?' to list the available options", yesno=True, default=False)[source]
Send a new message to the information window at the top of the canvas
- Parameters:
message – str Message to be displayed
yesno – bool Is a yes/no option desired?
default – bool Would you like to refresh the info box and just display the default message