quantumjot / btrack

Bayesian multi-object tracking
https://btrack.readthedocs.io
MIT License
311 stars 50 forks source link

'Matrices' is missing 'Q' (the full estimated error) #273

Closed p-j-smith closed 1 year ago

p-j-smith commented 1 year ago

btrack's MotionModel has a matrix Q that is calculated from G. But this matrix is missing from Matrices.names.

In the plugin interaces, only the scalarsigma of each matrix is exposed to the user. This is done by passing the scalar magicgui.widgets.create_widget. However, because Q is missing from Matrics.names, the entire matrix is passed to create_widget.

In magicgui<6 this would fail silently and return an empty widget, but with magicgui>=0.6 this causes the following error to be raised when loading the btrack plugin:

File ~/mambaforge/envs/napari-btrack/lib/python3.9/site-packages/magicgui/type_map/_type_map.py:262, in _pick_widget_type(value=<class 'numpy.ndarray'> (6, 6) float64, annotation=<class 'numpy.ndarray'>, options={'nullable': False}, is_result=False, raise_on_unknown=True)
    259     return _cls, {**options, **opts}
    261 if raise_on_unknown:
--> 262     raise ValueError(
        annotation = <class 'numpy.ndarray'>
        _type = <class 'numpy.ndarray'>
    263         f"No widget found for type {_type} and annotation {annotation!r}"
    264     )
    266 return widgets.EmptyWidget, {"visible": False}

ValueError: No widget found for type <class 'numpy.ndarray'> and annotation <class 'numpy.ndarray'> 

Do we need to add a widget for Q by adding it to Matrices.names? Or can we ignore it when looping over the MotionModel parameters and creating widgets?