-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #209 from pariterre/master
Added a function to get the index of marker and segment from name
- Loading branch information
Showing
5 changed files
with
70 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
def marker_index(model, marker_name): | ||
try: | ||
return [n.to_string() for n in model.markerNames()].index(marker_name) | ||
except ValueError: | ||
raise ValueError(f"{marker_name} is not in the biorbd model") | ||
|
||
|
||
def segment_index(model, segment_name): | ||
try: | ||
return [model.segment(i).name().to_string() for i in range(model.nbSegment())].index(segment_name) | ||
except ValueError: | ||
raise ValueError(f"{segment_name} is not in the biorbd model") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters