pypeit.display.spec1dview module

Spec1dView is a plugin for the Ginga viewer that provides functionality for visualizing and analyzing 1D spectra from FITS files. The plugin allows users to plot spectra, identify spectral lines from various line lists, and customize the display according to different parameters.

Plugin Type: Local

Spec1dView is a local plugin, which means it is associated with a specific channel in the Ginga viewer. An instance of the plugin can be opened for each channel, allowing for multiple spectra to be analyzed simultaneously.

Usage

  • Load and visualize 1D spectra from FITS files.

  • Customize the display by selecting different line lists, extraction types, and flux/mask settings.

  • Update the redshift to shift the spectral lines accordingly.

Editing

Users can modify the visualization by:

  • Choosing from a variety of line lists to identify spectral features.

  • Selecting different types of extraction methods (OPT, BOX).

  • Applying or removing flux calibration and masking options.

  • Updating the redshift value to reflect the observed wavelengths.

UI

The user interface provides controls for:

  • Selecting the line list from a combobox.

  • Entering a redshift value to shift the spectrum.

  • Choosing the extraction type, flux calibration, and masking options via comboboxes.

  • Buttons to load a FITS file and clear the current selection.

Buttons

  • Update z: Updates the redshift value and refreshes the spectrum plot.

  • Enter: Loads the specified FITS file for analysis.

  • Clear: Clears the current inputs and resets the UI settings.

Tips

  • Use the comboboxes to switch between different line lists and adjust the spectrum display settings.

  • Ensure that the correct FITS file path is entered before attempting to load the data.

class pypeit.display.spec1dview.Spec1dView(fv, fitsimage)[source]

Bases: LocalPlugin

add_marker(name, dct)[source]
autozoom_plot()[source]
build_gui(container)[source]

Construct the UI in the plugin container.

This get’s called just prior to the start method when the plugin is activated.

clear_marker(name)[source]
clear_markers()[source]
clear_region(name)[source]

Clear the region named name.

close()[source]

Method called to close the plugin when the Close button is pressed.

cut_x_range(name)[source]

Zoom the X range of the plot to the region named name.

fit_range(name)[source]

Perform a fitting on the flux data within the region named name.

fit_y()[source]

Zoom to fit Y axis

no_smooth()[source]

Completely remove all smoothing from the plot.

plot_error_cb(w, val)[source]

Callback for toggling the “Plot Error” checkbox in the UI.

plot_lines()[source]

Plot the line list + regions + markers.

Lines are made into a single compound object so that it is easier to remove them as a group if the line list is changed.

plot_markers()[source]

Plot the regions and markers.

process_file(filepath)[source]

Process filepath creating SpecObjs (a series of extensions), which can then have data extracted and plotted.

range_changed_cb(viewer, ranges)[source]

Called when the plot viewers displayed range has changed. We use this to replot lines of interest.

recalc()[source]

Reprocess the chosen extension, based on current choices for extraction method, fluxing and masking.

Replot everything as a result.

redo()[source]

Method called when a new FITS image or extension is loaded into the channel.

We do some minimal checks to make sure that it is a table, then call the routine to process the file that is behind this table.

replot()[source]

Replot the plot and line list.

set_exten_cb(w, val)[source]

Callback for changing the extension in the UI.

Try to process the new extension.

set_extraction_cb(w, idx)[source]

Callback for changing the extraction option in the plugin.

Redo the data extraction and replot everything as a result.

set_filepath_cb(w)[source]

Callback for changing the path in the UI.

Try to process the new file.

set_fluxed_cb(w, idx)[source]

Callback for changing the fluxed option in the plugin.

Redo the data extraction and replot everything as a result.

set_line_list_cb(w, idx)[source]

Callback for setting the line list in the plugin.

Construct a new line list (or None) and replot the lines as a result.

set_masked_cb(w, idx)[source]

Callback for changing the masked option in the plugin.

Redo the data extraction and replot everything as a result.

set_params(ext=None, extraction=None, masked=None, fluxed=None)[source]

Used to set up defaults from command line args to pypeit_show_1dspec script.

set_region_side(name, side, value)[source]

Define one side (left, right, top, bottom) of a named region.

Parameters:
  • name (str) – The name of a region (e.g. ‘mark’)

  • side (str ('left', 'right', 'top', 'bottom')) – The side of the region to set

  • value (float) – The value to set for this side of the region

set_z_cb(w)[source]

Callback for setting the zed value in the plugin.

Replot the lines as a result.

smooth_less()[source]

Decrease the level of smoothing in the plot.

smooth_more()[source]

Increase the level of smoothing in the plot.

start()[source]

Method called right after build_gui when the plugin is activated.

Simply attempt to process the latest FITS file loaded in the channel.

stop()[source]

Method called when the plugin is deactivated.

Clean up instance variables so we don’t hang on to any large data structures.