pypeit.core.wavecal.waveio module

Module for I/O in arclines

pypeit.core.wavecal.waveio.load_line_list(line_file, use_ion=False)[source]
Parameters:
  • line_file (str) – Full path to line_list or name of ion

  • use_ion (bool, optional) – Interpret line_file as an ion, e.g. CuI

Returns:

line_list

Return type:

astropy.table.Table

pypeit.core.wavecal.waveio.load_line_lists(lamps, all=False, include_unknown: bool = False, restrict_on_instr=None)[source]

Loads a series of line list files

Parameters:
  • lamps (list) – List of arc lamps to be used for wavelength calibration. E.g., [‘ArI’,’NeI’,’KrI’,’XeI’]

  • restrict_on_instr (str, optional) – Restrict according to the input spectrograph

  • all (bool, optional) – Load all line lists, independent of the input lamps (not recommended)

  • include_unknown (bool, optional) – If True, the tot_line_list includes the unknown lines

Returns:

  • tot_line_list (astropy Table of line lists (including unknown lines, if requested))

  • line_list (astropy Table of line lists)

  • unkn_lines (astropy Table of unknown lines)

pypeit.core.wavecal.waveio.load_reid_arxiv(arxiv_file)[source]

Load a REID arxiv file Now there are 2 possible formats. We need to consolidate

Parameters:

arxiv_file (str) –

Return type:

dict, dict-like

pypeit.core.wavecal.waveio.load_template(arxiv_file: str, det: int, wvrng: list | None = None) tuple[numpy.ndarray, numpy.ndarray, int][source]

Load a full template file from disk

Parameters:
  • arxiv_file (str) – File with archive spectrum

  • det (int) – Detector number

  • wvrng (list, optional) – min, max wavelength range for the arxiv

Returns:

  • wave (ndarray) – Wavelength vector

  • flux (ndarray) – Flux vector

  • binning (int) – binning of the template arc spectrum

pypeit.core.wavecal.waveio.load_tree(polygon=4, numsearch=20)[source]

Load a KDTree of ThAr patterns that is stored on disk

Parameters:
  • polygon (int) –

    Number of sides to the polygon used in pattern matching:

    • polygon=3 –> trigon (two anchor lines and one floating line)

    • polygon=4 –> tetragon (two anchor lines and two floating lines)

    • polygon=5 –> pentagon (two anchor lines and three floating lines)

  • numsearch (int) –

    Number of consecutive detected lines used to generate a pattern. For example, if numsearch is 4, then for a trigon, the following patterns will be generated (assuming line #1 is the left anchor):

    • 1 2 3 (in this case line #3 is the right anchor)

    • 1 2 4 (in this case line #4 is the right anchor)

    • 1 3 4 (in this case line #4 is the right anchor)

Returns:

  • file_load (KDTree instance) – The KDTree containing the patterns

  • index (ndarray) – For each pattern in the KDTree, this array stores the corresponding index in the linelist

pypeit.core.wavecal.waveio.load_unknown_list(lines, unknwn_file=None, all=False)[source]
Parameters:
  • lines (list) – Restricted lines; use all=True for all

  • unknwn_file (str, optional) –

  • all (bool, optional) –

Returns:

unknwn_lines

Return type:

astropy.table.Table

pypeit.core.wavecal.waveio.load_wavelength_calibration(filename: Path) dict[source]

Load the wavelength calibration data from a file.

Parameters:

filename (pathlib.Path) – Name of the json file.

Returns:

Returns the wavelength calibration dictionary. Lists read from the json file are returnes as numpy arrays.

Return type:

dict