VIP
VIP copied to clipboard
Bug: normalize_psf fails silently if PSF.ndim = 4
Description
Calling vip_hci.fm.fakecomp.normalize_psf with a psf that has 4 dimensions fails to normalize the psf, does not raise an error and returns None instead. This occurs even if debug and verbose are set to True and no output is printed.
To Reproduce
import numpy as np
from vip_hci.fm.fakecomp import normalize_psf
psf = np.zeros((39, 4, 64, 64)) # e.g. some IFS PSF cubes
norm_psf_result = normalize_psf(psf, fwhm='fit', size=63, full_output=True, force_odd=True, debug=False, verbose=False, )
print(norm_psf_result) # None
# with debug=True and verbose=True
norm_psf_result = normalize_psf(psf, fwhm='fit', size=63, full_output=True, force_odd=True, debug=True, verbose=True, )
# no output
print(norm_psf_result) # None
psfn, flux_st, fwhm = normalize_psf(psf, fwhm='fit', size=63, full_output=True, force_odd=True, debug=False, verbose=False, )
# TypeError: cannot unpack non-iterable NoneType object
Expected behavior
Either the function should raise an error or normalize the PSFs separately