PaulHancock / Aegean

The Aegean source finding program and associated tools
http://aegeantools.rtfd.io/
Other
47 stars 14 forks source link

Aegean dies with IndexError in fits_tools.py #197

Closed johnsmorgan closed 8 months ago

johnsmorgan commented 1 year ago

Trying to run Aegean on the attached fits file results in the following error

aegean:INFO This is Aegean 2.3.0-(2022-08-17)
aegean:INFO Found 8 cores
aegean:INFO Using 8 cores
aegean:INFO Finding sources.
Traceback (most recent call last):
  File "/home/.../miniconda3/bin/aegean", line 12, in <module>
    sys.exit(aegean.main(sys.argv[1:]))
  File "/home/.../miniconda3/lib/python3.9/site-packages/AegeanTools/CLI/aegean.py", line 373, in main
    found = sf.find_sources_in_image(filename, outfile=options.outfile,
  File "/home/.../miniconda3/lib/python3.9/site-packages/AegeanTools/source_finder.py", line 2242, in find_sources_in_image
    self.load_globals(
  File "/home/.../miniconda3/lib/python3.9/site-packages/AegeanTools/source_finder.py", line 1267, in load_globals
    img, header = load_image_band(filename,
  File "/home/.../miniconda3/lib/python3.9/site-packages/AegeanTools/fits_tools.py", line 273, in load_image_band
    data = a[hdu_index].section[0, cube_index,
  File "/home/jmorgan/miniconda3/lib/python3.9/site-packages/astropy/io/fits/hdu/image.py", line 966, in __getitem__
    indx = _IndexInfo(key[idx], axis)
  File "/home/.../miniconda3/lib/python3.9/site-packages/astropy/io/fits/hdu/image.py", line 1217, in __init__
    raise IndexError(f'Illegal index {indx}')
IndexError: Illegal index None

1243914632_121-132-XX-image.fits.gz

This error occurs with the most recent release:

aegean:INFO This is Aegean 2.3.0-(2022-08-17)
aegean:INFO AegeanTools 2.3.0 from /home/.../miniconda3/lib/python3.9/site-packages/AegeanTools/__init__.py
aegean:INFO Numpy 1.23.5 from /home/.../miniconda3/lib/python3.9/site-packages/numpy/__init__.py
aegean:INFO Scipy 1.9.3 from /home/.../miniconda3/lib/python3.9/site-packages/scipy/__init__.py
aegean:INFO AstroPy 5.1.1 from /home/.../miniconda3/lib/python3.9/site-packages/astropy/__init__.py
aegean:INFO LMFit 1.1.0 from /home/.../miniconda3/lib/python3.9/site-packages/lmfit/__init__.py

And I have reproduced the error on Pawsey as well as in a fresh conda install. BANE processes the same file without errors. The error arises with or without --autoload when the relevant files are present.

I have also confirmed that the following previous version of Aegean can process the file:

3837889:aegean:INFO This is Aegean 2.2.0-(2020-03-02)
3837889:aegean:INFO AegeanTools 2.2.0 from /home/.../env/lib/python3.8/site-packages/AegeanTools/__init__.py
3837889:aegean:INFO Numpy 1.20.0rc2 from /home/.../env/lib/python3.8/site-packages/numpy-1.20.0rc2-py3.8-linux-x86_64.egg/numpy/__init__.py
3837889:aegean:INFO Scipy 1.6.0 from /home/.../env/lib/python3.8/site-packages/scipy-1.6.0-py3.8-linux-x86_64.egg/scipy/__init__.py
3837889:aegean:INFO AstroPy 5.1 from /home/.../env/lib/python3.8/site-packages/astropy/__init__.py
3837889:aegean:INFO LMFit 1.0.2 from /home/.../env/lib/python3.8/site-packages/lmfit/__init__.py
johnsmorgan commented 1 year ago

Update: this problem appears to affect only 2.3.0 (have checked all the 2.2.x releases, no problem)

PaulHancock commented 1 year ago

It looks to me like #193 again. If you update to use the most recent version from github (still 2.3.0 but dated 2022-11-29) then the problem will be fixed.

johnsmorgan commented 1 year ago

Agree that it looks like exactly the same error.

PaulHancock commented 8 months ago

The related issue has been resolved and closed. So i'm closing this one also.