CIRADA-Tools/RM-Tools

peakfitcube tool fails with index error

candersoncsiro opened this issue · 4 comments

Generated Stokes QU cubes from ASKAP data using WSClean. Ran rmsynth_3d (which completes), then rmtools_peakfitcube, which fell over with an index error. Output log for both tasks and traceback are below.

(possum-mamba-env) canders@rsaa-074284 rmsythesis_working % rmsynth3d ./pbeam20.1-Q-mosaiccrrg-cube.fits ./pbeam20.1-U-mosaiccrrg-cube.fits ./freqs.txt -l 150 -f -v

Reading ./pbeam20.1-Q-mosaiccrrg-cube.fits ...
done.
Dimensions of the input cube are: NAXIS1 = 6000 NAXIS2 = 6000 NAXIS3 = 16
Dimensions of the input array are: (16, 6000, 6000)
Reading ./pbeam20.1-U-mosaiccrrg-cube.fits ...
done.
Dimensions of the input cube are: NAXIS1 = 6000 NAXIS2 = 6000 NAXIS3 = 16
Dimensions of the input array are: (16, 6000, 6000)
PhiArr = -149.55 to 149.55 by 11.50 (27 chans).
Weight type is 'uniform'.
Running RM-synthesis by channel.
[========================================] 100%
Calculating 1D RMSF and replicating along X & Y axes.

RM-synthesis completed in 145.62 seconds.
Saving the dirty FDF, RMSF and ancillary FITS files.
./FDF_dirty.fits
WARNING: VerifyWarning: Card is too long, comment will be truncated. [astropy.io.fits.card]
./RMSF.fits
./FDF_maxPI.fits
./FDF_peakRM.fits

(possum-mamba-env) canders@rsaa-074284 rmsythesis_working % rmtools_peakfitcube -v ./FDF_dirty.fits ./freqs.txt ./cena_inner_

0%| | 27/36000000 [00:00<48:22, 12401.03it/s]

Traceback (most recent call last):
File "/Users/canders/miniconda3/envs/possum-mamba-env/bin/rmtools_peakfitcube", line 33, in
sys.exit(load_entry_point('RM-Tools', 'console_scripts', 'rmtools_peakfitcube')())
File "/Applications/RM-Tools-master/RMtools_3D/RMpeakfit_3D.py", line 380, in main
map_dict=pixelwise_peak_fitting(FDF, phiArr_radm2, fwhmRMSF,lambdaSqArr_m2,
File "/Applications/RM-Tools-master/RMtools_3D/RMpeakfit_3D.py", line 103, in pixelwise_peak_fitting
fwhmRMSF_pix=fwhmRMSF[xarr[i],yarr[i]]
IndexError: index 27 is out of bounds for axis 0 with size 27

I think I know what's going on. Try running rmsynth3d without the -f flag? That flag is partially deprecated and the resulting output format isn't properly supported by most of the other tools (including peakfitcube). I should probably either commit fully to deprecating that keyword, or supporting it fully in all tools, but so far my laziness has led to this problem.

Let me know if that doesn't help.
Cheers,
Cameron

I've set up the tools so that you can feed in one the filename of the components, and it will automatically search for the other(s) with the same filenames. Maybe not the most robust (or obvious) solution, but it will work if you directly feed the rmsynth3d output into peakfitcube.

I'm going to make another pass through all the documentation sometime soon(TM), to hopefully clean up some of these ambiguities.