Closed leejjoon closed 5 months ago
I can save the wavelength solution if I add the following line to recipes/recipe_wvlsol_sky.py:
pyfits.writeto('outdata/'+utdate+'/wavelength_solution_'+band+'.fits', np.array(wvl_sol), clobber=True) #Save wavelength solution as a fits file
Under the following:
for o in orders_w_solutions:
oo = np.empty_like(xx)
oo.fill(o)
wvl = p(xx, oo) / o
wvl_sol.append(list(wvl))
oh_sol_products = PipelineProducts("Wavelength solution based on ohlines")
#from libs.process_thar import ONED_SPEC_JSON
from libs.products import PipelineDict
from libs.storage_descriptions import SKY_WVLSOL_JSON_DESC
oh_sol_products.add(SKY_WVLSOL_JSON_DESC,
PipelineDict(orders=orders_w_solutions,
wvl_sol=wvl_sol))
pyfits.writeto('outdata/'+utdate+'/wavelength_solution_'+band+'.fits', np.array(wvl_sol), clobber=True) #Save wavelength solution as a fits file
This only works for the .spec.fits files that have already been collapsed into 1D spectra (per ordeR), but allows me to read in an object's .spec.fits file along with wavelength_solution.fits for plotting in a separate program.
Thanks for the suggestion @kfkaplan. Commit 938cbc6 should address this issue. Instead of having a separate file, I recycled "_.wvlsolv1.fits" to save the wavelength solution. This file is used to save the fits header with WAT keywords. An empty array was saved previously, and now "np.array(wvl_sol)" is saved as a data for this file.
With the commit a7765f9 (which is a part of the current master branch), the "sky-wvlsol" recipe should save following files under "calib/primary/UTDATE".
These should be compatible to "array mapping" files provided in http://irlab.khu.ac.kr/~igrins/. These files give you order, slit position (normalized from 0 to 1), and wavelength (in um) for each pixel.
v3.0.0 of the PLP saves these files in the calib/primary/DATE/ directories. I am going to close this issue since it has been solved.