mzechmeister / serval

calculate radial velocities from stellar spectra
MIT License
36 stars 9 forks source link

KeyError when reading HARPS spectra #23

Closed rluquer closed 5 years ago

rluquer commented 5 years ago

I have some e2ds spectra from HARPS, but when I ran SERVAL I obtain the following error: File "/scratch1/SERVAL/serval/src/read_spec.py", line 409, in read_harps self.tmmean = hdr[k_tmmean] KeyError: 'HIERARCH ESO INS DET1 TMMEAN'

In the case of HARPS-N spectra, the error retrieved is: File "/scratch1/SERVAL/serval/src/read_spec.py", line 409, in read_harps self.tmmean = hdr[k_tmmean] KeyError: 'HIERARCH TNG EXP_METER_A EXP CENTROID'

Is it a problem with the spectra or my SERVAL configuration?

mzechmeister commented 5 years ago

SERVAL needs the midtime of the observation from the fits header. The keywords are different for HARPS and HARPN. In addition there was a header change in HARPN (after about the first year of operation). This is handled here: https://github.com/mzechmeister/serval/blob/ea9abf2f679a4e76efc698691124aba75a259fb4/src/read_spec.py#L379 https://github.com/mzechmeister/serval/blob/ea9abf2f679a4e76efc698691124aba75a259fb4/src/read_spec.py#L430-L432

Since your error arises in line 409, it seems your are using an older version. Playing around with git show HEAD~47:src/read_spec.py | cat -n | head -409 and git rev-parse HEAD~47, I found that you might have a version as old as https://github.com/mzechmeister/serval/commit/3387201fbd79bc7508100f0541a0400a41b49375 from 2018-02-05: https://github.com/mzechmeister/serval/blob/3387201fbd79bc7508100f0541a0400a41b49375/src/read_spec.py#L409 Please update your SERVAL version.