njcuk9999 / lbl

Line by line code for radial velocity
MIT License
15 stars 3 forks source link

HARPSN: accomodate to newer blaze loader #43

Closed astronasko closed 5 months ago

astronasko commented 7 months ago

Hello,

I deal with cases where blaze files are not readily available for every observation, and only one common daily blaze file is provided. Some times they don't have headers, which leads to an error of this kind:

Traceback (most recent call last):
  File "/lbl/recipes/lbl_template.py", line 79, in main
    namespace = __main__(inst)
  File "/lbl/recipes/lbl_template.py", line 185, in __main__
    bout = inst.load_blaze_from_science(*bargs, normalize=False)
  File "/lbl/instruments/harpsn.py", line 849, in load_blaze_from_science
    blaze, _ = io.load_fits(abspath, kind='blaze fits file')
ValueError: too many values to unpack (expected 2)

Because LBL unpacks the data-header tuple and discards the header anyway, I thought it might be useful to catch this error.

astronasko commented 6 months ago

You are correct that this was an artifact of an "older function"; apologies for not having been more thorough. I checked that this has been accounted for in other instrument files (carmenes.py, espresso.py, nirps.py etc.), which validates your argument. I think this is enough for this PR.