Ipuch / bioNC

Natural Coordinates with python for biomechanics
MIT License
10 stars 4 forks source link

Non technical markers to build the model #123

Closed aaiaueil closed 4 months ago

aaiaueil commented 9 months ago

Would it be possible to use non technical markers to build the model?

In the function biomecanical_model.py on line 451 we had to do the following modification to use some non technical markers for the model creation. We are not sure with @ANaaim that only technical marker marker should pass down to the model creation. Any thought about it ? Did we do something ''illegal'' 👮‍♂️ ?

        # if markers.shape[1] != self.nb_markers_technical:
        #     raise ValueError(
        #         f"markers should have {self.nb_markers_technical} columns, "
        #         f"and should include the following markers: {self.marker_names_technical}"
        #     )

        # convert markers to Data
        from ..model_creation.generic_data import GenericData

        marker_data = GenericData(markers, self.marker_names)
aaiaueil commented 9 months ago

If you think some modifications should be done we can take care of it! For now an ugly solution has been implemented to bypass this issue but I'm trying to overcome my ugly code phase

Ipuch commented 9 months ago

Removing raise is globally a bad idea, because I excluded cases where I know my code is not safe to be used. I prevent the user to do something wrong, and also for the developer removing a raise, is a huge responsibility.

Why can set your marker as an anatomical and a technical marker ? Would it work for you ? Nothing prevents you to define a marker as technical and as anatomical at the same time.

ANaaim commented 9 months ago

Because if the marker is labeled as a technical marker it will be used later for the optimisation process.

Ipuch commented 9 months ago

Does it work if you set istechnical to false for the given marker after having built the model ?

ANaaim commented 9 months ago

Ok, did not think that was possible ==> we will have a look at it.

Ipuch commented 9 months ago

My thoughts got clearer:

aaiaueil commented 9 months ago
Ipuch commented 9 months ago

Ok so the problem is later... you should implement weights in inverse kinematics class add an extra argument that sets the weights to 1 to every marker if no weights are given, or take the user define weight list.

And yes, you cannot evaluate Qi through markers if you don't give the markers that has been used to build the model, that's the expected behavior

Normally, Q_from_markers is automatically called when you provide no Q_init to simplify the user interface.

Another way of by passing it, is to provide your custom Q_init to the inverse kinematics class so that it doesn't use Q_from_markers.

Ipuch commented 6 months ago

Can I close the issue ?

Ipuch commented 5 months ago

up @aaiaueil, @ANaaim ?