mhardcastle / radioflux

Measuring radio flux density with ds9
GNU General Public License v3.0
12 stars 3 forks source link

Compatibility issue with numpy 1.24 #16

Closed MaicolDella closed 8 months ago

MaicolDella commented 1 year ago

Hi! I recently tried using radioflux with the most recent version of numpy (1.24) through its stand-alone version through python. I'm able to install and launch radioflux.py, but once I pass it my .reg file and my .fits in which to calculate the flux, the code gives me the following error:

Traceback (most recent call last): File "/home/maicol/thesis/MACSJ1742_Maicol/GMRT_Band3/radioflux.py", line 309, in flux_for_files(args.files,args.fgr,args.bgr,args.indiv,args.bgsub,verbose=args.verbose) File "/home/maicol/thesis/MACSJ1742_Maicol/GMRT_Band3/radioflux.py", line 270, in flux_for_files rm=radiomap(fitsfile,verbose=verbose) File "/home/maicol/thesis/MACSJ1742_Maicol/GMRT_Band3/radioflux.py", line 196, in init header,data=flatten(fitsfile,freqaxis=freqaxis,channel=i) File "/home/maicol/thesis/MACSJ1742_Maicol/GMRT_Band3/radioflux.py", line 49, in flatten return header,f[0].data[slice] IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices

I then tried downgrading numpy to an older version (1.22) and had no problem running the code and I obtained the flux as expected. I wanted to highlight the problem as I might not be the only one not able to run the code through the most recent numpy version.

Thank you!

mhardcastle commented 8 months ago

It took a while for me to be able to reproduce this but it's fixed now!