pypeit.core.wavecal.templates module
Module to generate templates for the PypeIt full_template wavelength calibration routine
This function uses direct access to the path
attribute in the relevant
pypeit data paths. This should not be replicated in other parts of the code.
This templates.py
script is a developer only script, and it really shouldn’t
be distributed as part of the code base.
- pypeit.core.wavecal.templates.build_template(in_files, slits, wv_cuts, binspec, outroot, outdir=None, normalize=False, subtract_conti=False, wvspec=None, lowredux=False, ifiles=None, det_cut=None, chk=False, miny=None, overwrite=True, ascii_tbl=False, in_vac=True, shift_wave=False, binning=None, micron=False, reid_files: bool = False)[source]
Generate a full_template for a given instrument
- Parameters:
in_files (list or str) – Wavelength solution files, XIDL or PypeIt If PypeIt, they can be a mix of WaveCalib JSON and FITS files
slits (list) – Slits in the archive files to use
wv_cuts (list) – Wavelengths to cut each slit at. The elements of the list correspond to the wavelengths where two spectra are stitched together.
binspec (int) – Spectral binning of the archived spectrum
outroot (str) – Name of output archive
outdir (str) – Name of output directory
lowredux (bool, optional) – If true, in_files are from LowRedux
reid_files (bool, optional) – If True, in_files are reid_arxiv files
wvspec (ndarray, optional) – Manually input the wavelength values
ifiles (list, optional) – Ordering of the in_files. Default is np.arange(len(in_files))
det_cut (dict, optional) – Cut the detector into pieces. Important for long detectors with wavelengths on one side
chk (bool, optional) – Show a plot or two
miny (float) – Impose a minimum value
normalize (bool, optional) – If provided multiple in_files, normalize each snippet to have the same maximum amplitude.
subtract_conti (bool, optional) – Subtract the continuum for the final archive
ascii_tbl (bool, optional) – Table is a simple ASCII 2 column wave,flux table
in_vac (bool, optional) – True if input wavelengths are in vacuum
shift_wave (bool, optional) – Shift wavelengths when splicing to sync up precisely (Recommended) Requires PypeIt file (old JSON works for now)
binning (list, optional) – Allows for multiple binnings for input files
micron (bool, optional) – If True, assume the in_files archive has a solution in microns, so convert this to Angstroms which is the PypeIt convention. Default=False
- pypeit.core.wavecal.templates.grab_wvlim(kk, wv_cuts, nslits)[source]
Set the wavelength range to cut on
- pypeit.core.wavecal.templates.poly_val(coeff, x, nrm)[source]
IDL style function for polynomial
- Parameters:
coeff (numpy.ndarray) – Polynomial coefficients
x (numpy.ndarray) – x array
nrm (numpy.ndarray) – Normalization terms
- Returns:
Same shape as x
- Return type:
- pypeit.core.wavecal.templates.pypeit_arcspec(in_file, slit, binspec, binning=None)[source]
Load up the arc spectrum from an input JSON file
- Parameters:
in_file (str or
pathlib.Path
) – File containing the arc spectrum and or fitslit (int) – slit index
- Returns:
numpy.ndarray, numpy.ndarray, PypeItFit: wave, flux, pypeitFitting
- Return type:
- pypeit.core.wavecal.templates.pypeit_identify_record(iwv_calib, binspec, specname, gratname, dispangl, outdir=None)[source]
From within PypeIt, generate a template file if the user manually identifies an arc spectrum
- pypeit.core.wavecal.templates.read_ascii(tbl_file, in_vac=True)[source]
The columns need to be wave, flux And the data should be monoonically increasing in wavelength
- pypeit.core.wavecal.templates.xidl_arcspec(xidl_file, slit)[source]
Read an XIDL format solution for a Longslit
Note: These are in air