We have a standard API for star selectors, including a selectStars method that optionally takes matches, a list of source/reference object matches. Some star selectors require this argument, whereas others ignore it (and we may eventually have selectors that use it if provided), but there is no way to tell if matches are used by querying the star selector.
In some cases the user may have to make an extra call to obtain matches, but there is no easy way to tell if this call would be useful. for instance a new DetectAndMeasure task runs a star selector if computing aperture corrections and it will do its own matching if required.
I propose adding a new method usesMatches() to all star selectors. It returns True if selectStars can use the matches argument and False otherwise.
Variants I considered, but am mildly against:
- Adding a second requiresMatches() method. I don't think it is needed, though it would allow slightly earlier error reporting (e.g. if matches are required but no matcher is provided).
- Making usesMatches a property instead of a method. Some star selectors are C++, though admittedly they need wrapping, so a property is possible; it's just more work.