Wavelength calibration for LRS2 images.
Updated: Oct16,2020

You can go right a Table of LRS2 Wavelength Solutions.

The LRS2 wavelength calbrations are usually run in stages. This is becasue we have 4 channels: uv, or, rd, fr; and each channel is read with two amplifiers (hence two FITS images). We usually have several different sources of calibrating spectral features, primarily twilight flat and arc lamp images. You can read some older Sep2020 notes on LRS2 wavelength calibration.

Primary List
  1. Step1: Visual spectral feature identification.
  2. Step2: Combine different spectral line sets.
  3. Step3: Refine the final wavelength solution.
  4. Using the new solutions.



Step1: Visual spectral feature identification.

In the first step, we run different calibration image through lmap_markII to bias-correct the LRS2 images and visually identify spectral features.

 
%  lmap_markII 2 1 uv -w 

usage: lmap_markII 32 2 or [-v] [-h] [-k] [-e] [-p] [-w]  
arg1 = observation value 
arg2 = exposure number 
arg3 = channel name (uv,or,rd,fr)
Additional options: 
  -c = treat as a calibration image 
  -k = keep the processed images 
  -h = just show usage message  
  -v = run in verbose/debug mode 
  -e = make early exit after lrs2see4 call 
  -p = paint frames with ds9 region files 
  -w = perform visual wavelegth solutions  
 
Each run produces a set of files, one set per "device", that are deposited in a local subdirectory. The "device" is the part of the PAS image name that ideifies the IFU, the dichroic channel, and the amplifier used, e.g. 056LU (056 = LRS2-B, L = left side giving the uv channel, and U = upper amplifier). As you see in the command example above, lmap_markII works on one channel at a time, and since a channel has two amps, each lmap_markII run withh result in additions to two device subdirectories. For example, if we indetify lines in the uv channel, file are deposited in the local directories names 056LL and 056LU. The local subdirectory is named using the device designation. Each time we run different cal sets (i.e. Hg, FeAR, Cd, twi) the outputput files are deposited in the appropriate device subdiretory.

It is useful to clarify some things about NAMING CONVENTIONS. The use is queried ofr a name to be used in querying the spectral line catalogs:

 
Enter line catalog (ALL, Cd , Hg, FeAr): ALL
 
If yoy do not use one of the four names listed above, then no lines will be available for plotting. The "ALL" catlog name is unfortunate. It encompasses lines from multiple sources: twilight (solar) flats, night sky emission lines, and astrophysical lines. The other sources (Cd , Hg, FeAr) refer specifically to features in arc lamp spectra.

The next thing the user is queried for is a name that is used to characterize the data set.

 
Enter a unique identifier for saving this fit (i.e. Hg,Cd,FeAr,twi): twi
 
Here is where things are a little confusing. We could used the name "ALL", but we night have multiple examples of ALL: twilight flats (twi), night sky lines (nsky), or others. The phrase entered here is used to construct file names, and if we use a general name like "ALL", then we risk overwriting files. For instance, suppose I have a twilight flat (twi) and a night sky line image (nsky). Both of these images would use the "ALL" spectral catalog, but if I use the "ALL" name to identify them, then I'll end up with only one set of files at the end.

There is one file from a run of lmap_markII that remains in the local directory named "Images.Summary". Each time you run a new image set, useful information (device, channel name, LineCat, image FITS name) are appended to the Images.Summary file. This way, yu can easily keep track of which calibartions sets you have processed. Here is an example:

 
% pwd 
/home/sco/LRS2_wavesols/20200529-30/uv

% ls 
056LL_wsol/  056LU_wsol/  BaseDir  Date  Images.Summary  keep/	S/

% cat Images.Summary 
056LL uv ALL 20200530T020734.3_056LL_twi.fits 
056LU uv ALL 20200530T020734.3_056LU_twi.fits 
056LL uv FeAr  20200529T231708.8_056LL_cmp.fits 
056LU uv FeAr  20200529T231708.8_056LU_cmp.fits 
056LL uv Hg  20200529T232057.1_056LL_cmp.fits 
056LU uv Hg  20200529T232057.1_056LU_cmp.fits 
 
Once you have processed all of the available calibration sources (i.e. Cd, FeAR, twi, Hg, etc...) for a given channle (i.e. uv, or, rd, fr), then you can combine all of the spectral line information in the step 2.

Return to top of page.



Step2: Combine different spectral line sets.

After we have identified spectral line positions on the available calibration images, we combine thsese spectral line sets to derive a linear wavelength calibration for each device (e.g. 056LU). This procedure assume there are no systematic differences bewteen the images, and it usually results in many more calibration points that cover a much wider wavelength range. This step is done with the combine_waversols routine, which must be run in the appropriate device subdirectory (created and filled by the lamp_markII runs discussed above).

 
% cd ./056LL_wsol 
% combine_waversols 056LU 

% ls ./Plot_1
056RL.solution	    curve_runner.results    line.clcf_rstats.out.Last	  line.fitcurve.1     line.out.2
Axes.1		    Figure_1.png	    line.clcf_rstats.resids.1	  line.fitcurve.2     line.out.Last
clcf_rstats.out     line.clcf_rstats.out.1  line.clcf_rstats.resids.2	  line.fitcurve.Last  List.1
clcf_rstats.resids  line.clcf_rstats.out.2  line.clcf_rstats.resids.Last  line.out.1


Most of the useful files from this routine are dumped into the local subdirectory named Plot_1. One exception is a hard copy of the final linear fit to the wavelength data, which I usually name Figure_1.png. This file I produce with the matplotlib show() module, and I manually place it in the ./Plot_1 directory fpr safe storage.

One final point should be recorded. The basic plot files from this routine are storde in the local subdirectory named ./Plot_1. However, the table files that contain the actual data to be plotted are not move. I often like to renamin some of the labels in the plot legend or change the plot limits, hence, I have to change the pathes of these files in my modified List.1 file. Here is an example for my fit to the 066LL wavelength solution after I added night sky exission lines from two images:

 
% pwd 
/home/sco/LRS2_wavesols/20200529-30/rd/066LL_wsol/Plot_1

% cat List.1  
line.fitcurve.2 1 2 0 0   line  c - 10  Iter2
../20200529T231708.8_066LL_cmp_rd_FeAr_wsol.table  1 2 0 0 pointopen  m o 50 FeAr
../20200529T232057.1_066LL_cmp_rd_Hg_wsol.table    1 2 0 0 pointopen  g o 50 Hg
../20200530T020734.3_066LL_twi_rd_ALL_wsol.table   1 2 0 0 pointopen  b o 50 twi
../20200530T033635.1_066LL_sci_rd_nskye_wsol.table 1 2 0 0 pointopen  c o 50 nskye(1)
../20200530T042121.0_066LL_sci_rd_nskye_wsol.table 1 2 0 0 pointopen  c o 50 nskye(2) 


Return to top of page.



Step3: Refine the final wavelength solution.

In this third and final set, we refine the wavelength solutions using the routine waversol_refine.

 
% waversol_refine 056RU 
% ls 
20200529T231208.2_056RL_cmp.fits		 20200529T232458.0_056RL_cmp_or_Hg_wsol.parlab	 Big.table
20200529T231208.2_056RL_cmp.Image.Info		 20200529T232458.0_056RL_cmp_or_Hg_wsol.table	 lines_Cd_arc.reg
20200529T231208.2_056RL_cmp_or_Cd_wsol.parlab	 20200530T020734.3_056RL_twi.fits		 lines_FeAr_arc.reg
20200529T231208.2_056RL_cmp_or_Cd_wsol.table	 20200530T020734.3_056RL_twi.Image.Info		 lines_Hg_arc.reg
20200529T231708.8_056RL_cmp.fits		 20200530T020734.3_056RL_twi_or_ALL_wsol.parlab  lines_other.reg
20200529T231708.8_056RL_cmp.Image.Info		 20200530T020734.3_056RL_twi_or_ALL_wsol.table	 matplotlibrc
20200529T231708.8_056RL_cmp_or_FeAr_wsol.parlab  Big2.params					 Plot_1/
20200529T231708.8_056RL_cmp_or_FeAr_wsol.table	 Big2.parlab					 Plot_2/
20200529T232458.0_056RL_cmp.fits		 Big2.table					 S/
20200529T232458.0_056RL_cmp.Image.Info		 Big.parlab					 xyplotter_auto.pars

You see that a lot of files now reside in our wsol directory, but at the point the most usefule ones are the bias-subtracted images files and the ds9 regions file (*.reg) that can be used to overplot the final set of selected lines in a ds9 image display of the FITS files. There is a simple routine for doing this, and I use the
 
% cat ../Images.Summary |grep 056RL  
056RL or ALL  20200530T020734.3_056RL_twi.fits 
056RL or Cd   20200529T231208.2_056RL_cmp.fits 
056RL or FeAr 20200529T231708.8_056RL_cmp.fits 
056RL or Hg   20200529T232458.0_056RL_cmp.fits 

% ls *.reg  
lines_Cd_arc.reg  lines_FeAr_arc.reg  lines_Hg_arc.reg	lines_other.reg

% lmap_spec_chart 20200530T020734.3_056RL_twi.fits lines_other.reg 056RL twi      
% lmap_spec_chart 20200529T231208.2_056RL_cmp.fits lines_Cd_arc.reg 056RL Cd      
% lmap_spec_chart 20200529T231708.8_056RL_cmp.fits lines_FeAr_arc.reg 056RL FeAr  
% lmap_spec_chart 20200529T232458.0_056RL_cmp.fits lines_Hg_arc.reg 056RL Hg      

% 

The convenient part of using lmap_spec_chart is that it generates well-named png files of the final line charts (like 056RL_twi.png). These can be plopped down into a page like THIS to create a simple webdoc that shows some easy line identificatios for a given LRS2 device.

Return to top of page.



Using the new solutions.

We want to now apply our new linear solutions to random lines marked in the bias-subtracted LRS2 spectral images. Here is a simple way.

 

% pwd
/home/sco/LRS2_wavesols/20200529-30

*** We build the solution file using the device name, then search for a local version: 
% find . -name '066RL.solution' -print
./20200529-30/fr/066RL_wsol/Plot_1/066RL.solution

Then we use the file: 
% pix2angs.sh 250.2 ./20200529-30/fr/066RL_wsol/Plot_1/066RL.solution 
 250.2    10288.3
 

This is terse, but can be used in a slick wrapper. I can use this to identify more useful lines in my calibration spectra, especially the night sky emission lines.

Return to top of page.



Back to calling page