desihub / specex

DESI spectrograph PSF fitting
BSD 3-Clause "New" or "Revised" License
0 stars 4 forks source link

How to generate PSF file for another instrument? What's the format for --lampfile #11

Open jbudynk opened 8 years ago

jbudynk commented 8 years ago

Hi there,

I'm a member of the data reduction pipelines group for G-CLEF (GMT-Consortium Large Earth Finder), an optical echelle spectrograph. We have been testing out a couple of optical extraction methods, and are interested in the spectro-perfectionism method. We came across your implementation and wanted to use it to test the benefits and potential issues for spectro-perfectionism on echelle data. Thanks for making your code available!

I have been playing around with the DESI suite with the goal of creating a PSF model from a HARPS-N 2D echelle dataset, and using that with https://github.com/desihub/specter to extract the spectra.

I've created the PSF data product from desispec.bootcalib(). Now I'm trying to create the PSF file input to specter.extract.ex2d() with specex_desi_fit.sh, but I'm confused about the --lamplines parameter file. The README points to a default lampline file that doesn't exist. What is the purpose and format of the --lamplines parameter file? Is it a line list that tells what the wavelength is at a given (X, Y) pixel position on the arc image? I was thinking since the wavelength solution is stored in the desispec.bootcalib() PSF file that I'd have enough wavelength information. Since I'm using data from a different instrument, I'm not sure if the files provided in specex/data/ would work for HARPS-N, and wanted to understand which file format I should follow, and what information I should put in the file.

Nevertheless, I've tried running specex with what I think is the default lamplines file, but ran into errors. Here's the parameters and error message I received:

INFO using lamp lines file /home/jamie/specex/data/lamplines-specex.par
INFO Reading DESI preprocessed image in /home/jamie/HD127334/HD127334_arcimage.fits
INFO HDU=1 EXTNAME='IMAGE' NAXIS=2 NAXIS1=4096 NAXIS2=4096
INFO HDU=2 EXTNAME='IVAR' NAXIS=2 NAXIS1=4096 NAXIS2=4096
INFO HDU=3 EXTNAME='MASK' NAXIS=2 NAXIS1=8 NAXIS2=4096
INFO Will read flux in HDU 1
INFO Will read ivar in HDU 2
INFO Will read mask in HDU 3
INFO read one image in '/home/jamie/HD127334/HD127334_arcimage.fits' hdu=1 size=4096x4096 bitpix=-32 compressed=0
INFO read one image in '/home/jamie/HD127334/HD127334_arcimage.fits' hdu=2 size=4096x4096 bitpix=-32 compressed=0
INFO read one image in '/home/jamie/HD127334/HD127334_arcimage.fits' hdu=3 size=4096x4096 bitpix=8 compressed=1
INFO Set ivar=0 to pixels with mask!=0
WARNING Didn't find rdnoise image in file /home/jamie/HD127334/HD127334_arcimage.fits, look for header keyword (at line 271 of file ../../src/library/specex_desi_io.cc)
INFO Possible read noise header key 'RDNOISE'=5.0
INFO Use this one :5.0
INFO X WAVEMIN WAVEMAX 3714.51 6909.6
INFO X WAVE COEF SIZE  6 69
INFO Y WAVEMIN WAVEMAX 3714.51 6909.6
INFO Y WAVE COEF SIZE  6 69
INFO read traces in '/home/jamie/HD127334/HD127334_psf.fits' HDU 1 and '/home/jamie/HD127334/HD127334_psf.fits' HDU 2
INFO done reading traceset
INFO Guess number of bundles from traces
INFO Central wavelength             = 5312.06
INFO Median distance between fibers = -4.8949e+34
INFO Bundle of size 5
INFO Bundle of size 1
ERROR cannot deal awith varying bundle size (at line 42 of file ../../src/library/specex_spectrograph.cc)
dumping core ...
generate-psf.sh: line 30: 22109 Aborted                 (core dumped) specex_desi_psf_fit ${arguments} --out_xml $HARPN_DATA/${OBJECT}_psf.xml --first_bundle 0 --last_bundle 11 --out_fits $HARPN_DATA/final_${OBJECT}_psf.fits

Here's the output psf and trace file from desi.bootcalib(), the input arc lamp exposure, and the script I made to run specex.

Can you help me figure out what's wrong? Any advice is appreciated. The specex version I'm using is 6d72960a. Thanks!

jbudynk commented 8 years ago

Hi again, I was wondering if anyone had the chance to look over this issue? If you need more information, let me know. Thanks!

sbailey commented 8 years ago

FYI, the key person for answering this question is on vacation until the end of August...

jbudynk commented 8 years ago

Oh whoops - I forgot. Thanks for reminding me.

jbudynk commented 7 years ago

Hi, I was wondering if @julienguy had a chance to take a look at this issue yet?

weaverba137 commented 6 years ago

@julienguy or @tskisner, can you take a look at this please? This is more than a year old!