pypeit.qa module

Module for QA in PypeIt

pypeit.qa.arc_tilts_2d_qa(tilts_dspat, tilts, tilts_model, tot_mask, rej_mask, spat_order, spec_order, rms, fwhm, slitord_id=0, setup='A', outfile=None, show_QA=False, out_dir=None)[source]

..todo.. this method needs docs

Parameters:
  • tilts_dspat

  • tilts

  • tilts_model

  • tot_mask

  • rej_mask

  • spat_order

  • spec_order

  • rms

  • fwhm

  • slitord_id

  • setup

  • outfile

  • show_QA

  • out_dir

Returns:

pypeit.qa.arc_tilts_spat_qa(tilts_dspat, tilts, tilts_model, tilts_spec_fit, tot_mask, rej_mask, spat_order, spec_order, rms, fwhm, setup='A', slitord_id=0, outfile=None, show_QA=False, out_dir=None)[source]

NEEDS A DOC STRING!

pypeit.qa.arc_tilts_spec_qa(tilts_spec_fit, tilts, tilts_model, tot_mask, rej_mask, rms, fwhm, slitord_id=0, setup='A', outfile=None, show_QA=False, out_dir=None)[source]

Generate a QA plot of the residuals for the fit to the tilts in the spectral direction one slit at a time

pypeit.qa.close_qa(pypeit_file, qa_path)[source]

Tie off QA under a crash

Parameters:
  • pypeit_file (str) – PypeIt file name

  • qa_path (str) – Path to QA directory

pypeit.qa.gen_exp_html()[source]

Generate the HTML for an Exposure set

pypeit.qa.gen_mf_html(pypeit_file, qa_path)[source]

Generate the HTML for QA

Parameters:
  • pypeit_file (str) – Name of the PypeIt file, no path

  • qa_path (str) – Path to the QA folder

pypeit.qa.gen_qa_dir(qa_path)[source]

Make the QA directory if it doesn’t already exist

Parameters:

qa_path (str) – Path to the QA folder

pypeit.qa.get_dimen(x, maxp=25)[source]

Assign the plotting dimensions to be the “most square”

Parameters:
  • x (int) – An integer that equals the number of panels to be plot

  • maxp (int (optional)) – The maximum number of panels to plot on a single page

Return type:

tuple[list, list]

Returns:

  • pages (list) – The number of panels in the x and y direction on each page

  • npp (list) – The number of panels on each page

pypeit.qa.html_end(f, body, links=None)[source]

Fill in the HTML file with a proper ending

Parameters:
Returns:

end – The text written to the end of the HTML file

Return type:

str

pypeit.qa.html_exp_pngs(exp_name, det)[source]

Generate HTML for Exposure PNGs

Parameters:
  • exp_name (str) – PypeIt-standard exposure name

  • det (int) – Detector number

Return type:

tuple[str, str]

Returns:

  • links – Links to the individual images

  • body – Body HTML for the page showing the images

pypeit.qa.html_header(title)[source]

Generate a simple HTML header

Parameters:

title (str) – Title for the header

Returns:

head – An HTML header as a long string

Return type:

str

pypeit.qa.html_init(f, title)[source]

Initialize the HTML file

Parameters:
Returns:

Initial HTML text incluing the header and links

Return type:

str

pypeit.qa.html_mf_pngs(idval)[source]

Generate HTML for QA PNGs

Parameters:

idval (str) – str Key identifier of the calibration set

Returns:

  • links – HTML links to the PNGs

  • body – HTML edits for the main body

Return type:

tuple

pypeit.qa.set_qa_filename(root, method, det=None, slit=None, prefix=None, mode=None, out_dir=None)[source]

Generate the filename for the QA file from the input parameters.

Parameters:
  • root (str) – Root name for the output file

  • method (str) – Describes the QA routine

  • det (str | None) – The name of the detector or mosaic (e.g., DET01)

  • slit (int | None) – Name of the slit / order being plotted

  • prefix (str | None) – Start the name of the QA file (used for multiple-PNG PCA plots)

  • mode (str | None) – Additional differentiating information (e.g., gloabl vs local flexure correction)

  • out_dir (str | None) – Path to the QA/ directory

Return type:

str

Returns:

Output filename

pypeit.qa.spat_flexure_qa(img, slits, shift, gpm=None, vrange=None, outfile=None)[source]

Generate QA for the spatial flexure

Parameters:
  • img (numpy.ndarray) – Image of the detector

  • slits (pypeit.slittrace.SlitTraceSet) – Slits object

  • shift (float) – Shift in pixels

  • gpm (numpy.ndarray, optional) – Good pixel mask (True = Bad)

  • vrange (tuple, optional) – Tuple with the min and max values for the imshow plot

  • outfile (str, optional) – Path to the output file where the QA is saved. If None, the QA is shown on screen and not saved.

pypeit.qa.spec_flexure_corrQA(ax, this_flex_dict, cntr, name)[source]

Spectral Flexure QA Plot

Creates one panel of the spectral felxure QA plot, with the overall figure container being handled by the calling function.

Parameters:
  • ax (Axes) – Axes onto which to draw the plot

  • this_flex_dict (dict) – Dictionary of flexure-related information needed for the plot

  • cntr (int) – The index into this_flex_dict’s arrays corresponding to the particular object, trace, or location of interest.

  • name (str) – Object, trace, or location name to be printed in the plot

pypeit.qa.spec_flexure_qa(slitords, bpm, basename, flex_list, specobjs=None, out_dir=None)[source]

Generate QA for the spectral flexure calculation

Parameters:
  • slitords (numpy.ndarray) – Array of slit/order numbers

  • bpm (numpy.ndarray) – Boolean mask; True = masked slit

  • basename (str) – Used to generate the output file name

  • flex_list (list) – list of dict objects containing the flexure information

  • specobjs (SpecObjs, optional) – Spectrally extracted objects

  • out_dir (str, optional) – Path to the output directory for the QA plots. If None, the current is used.