ThOR & ParticleFilter: Provide user-friendly error in case predicate is not wrapped in FILTER
When the ParticleFilter
is invoked as such:
ParticleFilter( detached_particles, Cut=F.PID_K < 5 )
the application segfaults (spectacularly), as the cut should have been wrapped in a F.FILTER
. Ideally, this trivial mistake is caught early on and a friendly error message is provided.
Maybe to get started:
Looking in the Python code, I wonder whether we can test the type of the "Cut" argument already in Python (in the ParticleFilter
in agorithms_thor.py). This type seems to be a ComposedBoundFunctor
in the incorrect case, and a BoundFunctor
in the correct case. However, I'm not sure whether it's intended that a ComposedBoundFunctor (which, by inheritance, is a BoundFunctor) would fail logically and which other types are expected to fail. Input from those familiar with the logic design of the filters would be much appreciated here.