lsd_cat_measure.py: ffhdu and ffsnhdu do not understand a 0 as input

Issue #13 closed
Kasper Schmidt created an issue

When running lsd_cat_measure.py I encountered the problem:

 File "/Users/kschmidt/work/lsdcat/lsd_cat_measure.py", line 316, in <module>
   nanvalue=0.)
 File "/Users/kschmidt/work/lsdcat/lib/line_em_funcs.py", line 76, in read_hdu
   header = hdu[hdunum].header
 File "/Users/kschmidt/ureka/Ureka/variants/common/lib/python2.7/site-packages/astropy/io/fits/hdu/hdulist.py", line 196, in __getitem__
   idx = self.index_of(key)
 File "/Users/kschmidt/ureka/Ureka/variants/common/lib/python2.7/site-packages/astropy/io/fits/hdu/hdulist.py", line 535, in index_of
   raise KeyError('Extension %s not found.' % repr(key))
KeyError: "Extension '0' not found."

Apparently the ffhdu and ffsnhdu do not understand a 0 as input. It was easy to fix by using the actual extension names, i.e., using: --filteredfluxcube ${filteredcube} --ffhdu FILTERED_DATA #instead of 0 --sncube ${input_SNcube} --ffsnhdu SIGNALTONOISE #instead of 0 Currently the documentation on Bitbucket read "HDU name (or number)" when describing these keywords. I would suggest to either add something like try: hdunum = int(hdunum) except: hdunum = str(hdunum) to line_em_funcs.read_hdu() or adjust the documentation on Bitbucket.

Comments (5)

  1. Christian Herenz repo owner

    Hi Kasper,

    I looked into this and made a quick fix.

    The quick fix is applied in 5a2106dca017d20472fea7e1a8edf81c8b8d3f11 in the iss13 branch.

    Howver, on second thought, I think it might also affect all the other routines. So could you maybe test if this works for you now in lsd_cat_measure.py, then I would apply this globally.

  2. Christian Herenz repo owner

    It definately affects lsd_cat.py as well. I tested the fix to lsd_cat_measure.py and it works... I have to apply it globally to... Keeping this open until then. Thanks for reporting!

  3. Log in to comment