Closed jchar32 closed 1 year ago
Dear @jchar32 !
The Marker
structure is basically an xarray
. So everything you can do with xarrays, you can do with Marker
. I am unfortunately not so much familiar with xarray.DataArray
as I am not the one who coded pyomeca. That said, I faced the same issue recently and what I have found that it was not possible to change individual channel name, but it was possible to override the full name list. It would give something like that:
marker_names = makers.channel.data
marker_names[0] = 'MY_NEW_NAME'
makers['channel'] = marker_names
I could not actually test the previous snippet, but I think you can figure out the rest! In all cases, looking at the xarray
documentation can definitely help :) (https://docs.xarray.dev/en/stable/generated/xarray.DataArray.html)
Hope this helps!
Thanks for creating pyomeca, it certainly expedites analyzing biomechanical data.
I am having difficulty with renaming channel names within the markers object (which was loaded from a c3d file). I can index into the specific channel name (e.g., markers.channel.data[n] where n=the marker index). I can then set this to a new string (markers.channel.data[0] = "test") and the code executes. However, the values do not change when I recall the specific channel name again. Perhaps this is a simple issue I am missing? I am using pyomeca version 2020.0.2 on python 3 and in vs code (if that matters).
The reason for needing to do this is the c3d file read function does not differentiate between marker names for some reason. So if despite a cluster of markers having different names in the motion capture software, the c3d file format doesn't include this differentiation and thus a cluster of markers on the thigh (for example) is names the same "RTHI". I am trying to identify these duplicate marker names and append a "_1" or the like. The same goes for medial/lateral markers at a joint.