pyomeca / bioviz

Biorbd visualization toolkit
MIT License
15 stars 26 forks source link

experimental markers need to be exactly the size of model markers #94

Open Ipuch opened 1 year ago

Ipuch commented 1 year ago

This is problematic as this was a feature of bioptim to find tracked markers and display them automatically in the animation.

https://github.com/pyomeca/bioptim/blob/2cecbe2cecb1ee262af857d83ba077a09d91d01f/bioptim/optimization/solution.py#L1409-L1417

Error message: `Traceback (most recent call last): File "/home/puchaud/Projets_Python/Pyomeca_github/bioviz/bioviz/init.py", line 881, in animate_from_slider self.set_experimental_markers_from_frame() File "/home/puchaud/Projets_Python/Pyomeca_github/bioviz/bioviz/init.py", line 1130, in __set_experimental_markers_from_frame self.vtk_model.update_experimental_markers( File "/home/puchaud/Projets_Python/Pyomeca_github/bioviz/bioviz/biorbd_vtk.py", line 481, in update_experimental_markers self._update_experimental_marker_link(virtual_to_experimental_markers_indices) File "/home/puchaud/Projets_Python/Pyomeca_github/bioviz/bioviz/biorbd_vtk.py", line 564, in _update_experimental_marker_link self._new_experimental_marker_link(virtual_to_experimental_markers_indices) File "/home/puchaud/Projets_Python/Pyomeca_github/bioviz/bioviz/biorbd_vtk.py", line 528, in _new_experimental_marker_link points.InsertNextPoint(self.markers["experimental"].data[:3, i, 0].data)


  File "/home/puchaud/miniconda3/envs/bio23/lib/python3.11/site-packages/xarray/core/dataarray.py", line 817, in __getitem__
    return self.isel(indexers=self._item_key_to_dict(key))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/puchaud/miniconda3/envs/bio23/lib/python3.11/site-packages/xarray/core/dataarray.py", line 1402, in isel
    variable = self._variable.isel(indexers, missing_dims=missing_dims)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/puchaud/miniconda3/envs/bio23/lib/python3.11/site-packages/xarray/core/variable.py", line 1336, in isel
    return self[key]
           ~~~~^^^^^
  File "/home/puchaud/miniconda3/envs/bio23/lib/python3.11/site-packages/xarray/core/variable.py", line 880, in __getitem__
    data = as_indexable(self._data)[indexer]
           ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/home/puchaud/miniconda3/envs/bio23/lib/python3.11/site-packages/xarray/core/indexing.py", line 1330, in __getitem__
    return array[key]
           ~~~~~^^^^^
IndexError: index 5 is out of bounds for axis 1 with size 5`
pariterre commented 1 year ago

It needs to be the same as they are fundamentally linked. It is necessary because there is a line that visually link markers

Ipuch commented 1 year ago

I should use nan values to fill the value with nan.