vortex-exoplanet / VIP

VIP is a python package/library for angular, reference star and spectral differential imaging for exoplanet/disk detection through high-contrast imaging.
http://vip.readthedocs.io/
MIT License
70 stars 57 forks source link

compute_binary_map function raises attribute error #615

Closed simalex44 closed 1 year ago

simalex44 commented 1 year ago
import numpy as np
import vip_hci as vip

probability_map=np.zeros((160,160))
probability_map[85,85] = 0.9
threshold = np.linspace(0.09, 0.99, 10)

vip.metrics.compute_binary_map(probability_map, threshold, injections=(85,85), fwhm=4, , debug=True)

This code will raise an attribute error when evaluating the probability map with threshold=0.99 This error is caused by photutils function detect_sources which, since v0.7, returns None (instead of ImageSegmentation object) if no source is found in the frame, so that compute_binary_map won't return 0 detection and 0 false positive.

VChristiaens commented 1 year ago

Hi @simalex44 , thanks for reporting this. I have just implemented a fix, which is now on the master branch. It will also be available in the next release.