Closed kenfus closed 1 year ago
Currently I can't reproduce this issue because all I got was a PyBDSF error (not IndexError) with no sources and I can't see where an IndexError from Karabo could even occur.
However, I've seen some potential improvements in the current API (e.g. Imager
object is not needed in detect_sources_in_dirty_image
where the according should belong to the Image
object itself.).
I'll therefore rewrite detect_sources_in_dirty_image
and make the according adjustments on Image
. Afterwards I'll test it against no sources and if there are KaraboErrors I will handle them. However, I think it is best to leave PyBDSF errors as they are and let the user handle them.
The only case where we directly access the detected sources by indices is in karabo.sourcedeection.result.SourceDetectionResult.get_pixel_position_of_sources
and karabo.sourcedeection.result.PyBDSFSourceDetectionResult.__transform_bdsf_to_reduced_result_array
. The first function is not part of SourceDetectionResult.detect_sources_in_image
, but the second is. Therefore I assume this is the location where the error occured. In both cases I would expect an empty np.ndarray and error-free code. As soon as I've rewritten the api as discussed in the comment above, I'll test it and if it is not as expected I intend to rewrite it.
Currently I'm not able to reproduce this issue and therefore have requested the corresponding image from the author of the report.
In addition, as partially mentioned above I've done the following in branch LG_210_detect_sources_in_image
:
detect_sources_in_dirty_image
because too much redundancy with detect_sources_in_image
, thus is no longer dependent on Imager
.Image
. So the instance variable is always accessed directly. That means you always know where the information comes from.Image
is now always loaded from a file when instantiation is performed. That means, the image instance is not only used to get the file-path
and save something there (like before) but the file has to be saved first, so that an image
instance can be created.SourceDetectionResult.detect_sources_in_image
catches bdsf RuntimeError
if all pixels in the image are blanked.SourceDetectionResult.detect_sources_in_image
and sky.explore_sky
.