`IndexError` when running ADI contrast curve in HEEPS with VIP
While running the demo in the HEEPS environment, we encountered an IndexError related to rad_samp when attempting to generate the ADI contrast curve. Despite extending the COMPASS wavefront file to include 1000 screens and modifying some configuration code, the same error persists. In particular, as you can see in the HEEPS output, the value of the FWHM is a reasonable float (20.75) and the full detector size is 421x421 pixels.
Could you please take a look and see if this might be connected to the recent bugfix you mentioned?
Code Snippet
sep1, adi1 = heeps.contrast.cc_adi(savepsf=True, savefits=True, verbose=True, **conf)
HEEPS Simulation Output
Apply ADI technique: add_bckg=False
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
mode=CVC, band=N2, pscale=19 mas
ncube=1000, ndet=421
duration=3600, dit=0.3 s
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Starting time: 2024-10-27 23:34:51
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ALGO : median_sub, FWHM = 20.75390589200986, # BRANCHES = 1, SIGMA = 5, STARPHOT = 100000000000.0
Finished the throughput calculation
Running time: 0:01:04.316576
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Full Error Traceback:
IndexError: index 0 is out of bounds for axis 0 with size 0
Traceback (most recent call last):
File "Cell In[13]", line 3, in <module>
sep1, adi1 = heeps.contrast.cc_adi(savepsf=True, savefits=True, verbose=True, **conf)
File "~/Github/HEEPS/heeps/contrast/cc_adi.py", line 129, in cc_adi
cc_pp = vip_hci.metrics.contrast_curve(psf_ON, pa, psf_OFF_crop,
fwhm, pscale/1e3, starphot, algo=algo, nbranch=1, sigma=5,
debug=False, plot=False, transmission=OAT, imlib='opencv',
verbose=verbose, **algo_dict)
File "~/Github/VIP-master/vip_hci/metrics/contrcurve.py", line 313, in contrast_curve
radmax_fwhm = ((cube.shape[-1]-1)//2)-fwhm_med/2
radmax = min(vector_radd.astype(int).max(), radmax_fwhm)
cutin2 = np.where(rad_samp.astype(int) == radmax)[0][0]
IndexError: index 0 is out of bounds for axis 0 with size 0
Thanks for pointing this out. This should hopefully be solved with PR #650. I'll leave the issue open for a few more days just in case.