Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resultant velocity - trubles with calling xarrays with same commands as in older pyomeca version. #134

Open
Dareczin opened this issue Oct 11, 2022 · 4 comments

Comments

@Dareczin
Copy link

Hello!

I am writing again with the same issue after 2 years. You guys updated pyomeca and old code is not working.

vrtoe = (data[('B0346:RTOE')]/1000).derivative().norm()
v_RTOE = vrtoe.reshape(2720,1)

I cannot acess the c3d data in a same way once it becomes xarrays.

Is there any way to use old version of pyomeca? or I need to acess every axis now for x,y,z and make computation to get resultant velocity. I was pretty content with previous solution. Xarray documentation did not helped me with finding code as simple as that, only how to get to arrays and extract them to dataframes. It is more time consuming than previous solution.

I would be grateful for every hit how to solve my issue

@pariterre
Copy link
Member

Hi @Dareczin
I must admit that I never myself fully understood xarray as I am not the one who migrated the code, and haven't used it since. If I recall well, the method .loc can be used to access the data, but I am not sure.

If you need to access the actual c3d data, I would suggest to load from ezc3d directly (github.com/pyomeca/ezc3d) and access the point data as such:

import ezc3d

c = ezc3d.c3d("path_to_file.c3d")
data = c["data"]["points"]

as shown in the documentation here: https://github.com/pyomeca/ezc3d/#python-3


That said, I had a quick look at the pyomeca's doc (https://pyomeca.github.io/getting-started/). I think you can access the data just as before. You can't modify it the same way though. Sorry for not helping much, I never myself took the time to understand xarrays, and mainly dropped out of pyomeca code when Romain completely rewrote the code (I focussed on biorbd, ezc3d and bioptim, which is more than enough hahaha)

@Dareczin
Copy link
Author

Dear @pariterre

Sorry for late anwser I was at conference without PC to check if your suggestion is working. ezc3d reading also works. However from reading whole file to acessing and manipulating I need to check a docs. I do not know if i should go for issue elsewhere to discuss ezc3d, but description about reading could be litte more specific.

Anyway thank you for information about your not working with Romain now, I will not bother you longer with the issue. Thank you for anwsering me!

Best regards,
Dareczin

@pariterre
Copy link
Member

No worries, I am supposed to use pyomeca again in a project that came up last Friday. If I do, I will update the doc for sure!

@Dareczin
Copy link
Author

Great news! Looking forward to it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants