Fix Version/s: None
Team:Data Release Production
The current PropagateVisitFlagsTask at https://github.com/lsst/pipe_tasks/blob/c7c10ab8074954fee4cfab5bfd8db91f106dff96/python/lsst/pipe/tasks/propagateVisitFlags.py has several issues that will all be addressed on this ticket:
1) The inputs are afw src tables rather than (faster!) parquet tables.
2) The inputs do not have access to the finalized psf characterization flags from FinalizeCharacterizationTask.
3) As noted in the comments, the matching from coadd objects to flagged sources can be done more efficiently by reusing a kd-tree.
4) The code is an unholy mishmash of gen2 and gen3.
This ticket will create a new task (provisionally called NewPropagateVisitFlagsTask; yes, that's a terrible name) that will take per-visit dataframe inputs. It will use smatch as a convenient wrapper around scipy's fast kd-tree implementation for matching (while reusing the tree created from the coadd objects). And it will be gen3 only.
At the current time, the dataframe input will be the per-visit dataframes from FinalizeCharacterizationTask, which will be modified on this ticket to (a) include the initial photometry and astrometry flags that are also propagated here, and (b) include the isolated star id (as per request from Yusra AlSayyad).
In the future, after we have final-final source tables that have been rerun with the refined fgcmcal/jointcal photometry/astrometry, the default input dataframe can be changed to these new tables, and updated photometry and astrometry flags from fgcmcal and jointcal can be similarly propagated to the coadd catalogs (which is not done at the current time, and will also not be included in this ticket).