pypeit.scripts.chk_noise_2dspec module

This script explores the noise in a slit or spectrum for one of the outputs of PypeIt

class pypeit.scripts.chk_noise_2dspec.ChkNoise2D[source]

Bases: ScriptBase

classmethod get_parser(width=None)[source]

Construct the command-line argument parser.

Derived classes should override this. Ideally they should use this base-class method to instantiate the ArgumentParser object and then fill in the relevant parser arguments

Warning

Any argument that defaults to the string 'current working directory' will be replaced by the result of os.getcwd() when the script is executed. This means help dialogs will include this replacement, and parsing of the command line will use os.getcwd() as the default. This functionality is largely to allow for PypeIt’s automated documentation of script help dialogs without the “current working” directory being that of the developer that most recently compiled the docs.

Parameters:
  • description (str, optional) – A short description of the purpose of the script.

  • width (int, optional) – Restrict the width of the formatted help output to be no longer than this number of characters, if possible given the help formatter. If None, the width is the same as the terminal width.

  • formatter (argparse.HelpFormatter) – Class used to format the help output.

Returns:

Command-line interpreter.

Return type:

argparse.ArgumentParser

static main(args)[source]

Execute the script.

pypeit.scripts.chk_noise_2dspec.get_flux_slit(spec2DObj, slitidx, pad=0)[source]

Returns the flux and error of a specific slit. The flux would be sky subtracted and object removed.

Parameters:
  • spec2DObj (Spec2DObj) – 2D spectra object

  • slitidx (int) – Given slit/order

  • pad (int, optional) – Ignore pixels within pad of edges.

Returns:

tuple of numpy.ndarray with flux and error of the 2D spectrum

Return type:

tuple

pypeit.scripts.chk_noise_2dspec.plot(image: ndarray, chi_select: ndarray, flux_select: ndarray, err_select: ndarray, basename: str, line_wav, line_names, lbda_1d, lbda_min=None, lbda_max=None, aspect_ratio=1)[source]

Generate the plot

Parameters:
  • image (numpy.ndarray) – Image of the slit to plot.

  • chi_select (numpy.ndarray) – 2D array of the chi value for a selected part of the slit.

  • line_wav (numpy.ndarray) – Array of wavelength of spectral features to be plotted.

  • line_names (numpy.ndarray) – Array of names of spectral features to be plotted.

  • lbda_1d (numpy.ndarray) – 1D array of the wavelength

  • lbda_min (float) – Minimum wavelength of the select pat of the slit

  • lbda_max (float) – Maximum wavelength of the select pat of the slit

  • aspect_ratio ([type]) – Aspect ratio for plotting the spec2d image.

  • flux_select (numpy.ndarray) – Flux of the 2D spectrum

  • err_select (numpy.ndarray) – Sig of the 2D spectrum

  • basename (str) – Basename