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.

add_region()[source]

Add/subtract a defined region

add_region_all()[source]

Set the sky regions for all slits simultaneously

button_cont(event)[source]

What to do when the ‘exit and save’ button is clicked

Parameters:

eventmatplotlib.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:

eventmatplotlib.backend_bases.Event A matplotlib event instance

button_press_callback(event)[source]

What to do when the mouse button is pressed

Parameters:

eventmatplotlib.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:

eventmatplotlib.backend_bases.Event A matplotlib event instance

button_release_callback(event)[source]

What to do when the mouse button is released

Parameters:

eventmatplotlib.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:

eventmatplotlib.backend_bases.Event A matplotlib event instance

draw_regions()[source]

Refresh the fit regions

finalize()[source]
get_axisID(event)[source]

Get the ID of the axis where an event has occurred

Parameters:

eventmatplotlib.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:

eventmatplotlib.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:

str

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 edges

  • pypeline (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:

SkySubGUI

initialize_menu()[source]

Initialize the menu buttons

key_press_callback(event)[source]

What to do when a key is pressed

Parameters:

eventmatplotlib.backend_bases.Event Matplotlib event instance containing information about the event

mouse_move_callback(event)[source]

Store the locations of mouse as it moves across the canvas

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)

print_help()[source]

Print the keys and descriptions that can be used for Identification

recenter()[source]
region_help()[source]
replot()[source]

Redraw the entire canvas

reset_regions()[source]

Reset the sky regions for all slits simultaneously

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