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

Python - No data in output file #300

Closed
lukas-lbm opened this issue Oct 24, 2023 · 9 comments
Closed

Python - No data in output file #300

lukas-lbm opened this issue Oct 24, 2023 · 9 comments

Comments

@lukas-lbm
Copy link

Hello,

I'm not sure if this is the right place to ask, but I have encountered a problem while trying to use ezc3d with python. I am trying to adapt the position of the corners of the force plates in my .c3d-File.

This is my code:

import os
import numpy as np
import ezc3d

PathC3D = 'R:/Data'
PathOutput = 'R:/NewFiles'

FileName = '417351_laq_k.c3d'

File =  ezc3d.c3d(os.path.join(PathC3D, FileName))

Position = File['parameters']['FORCE_PLATFORM']['CORNERS']['value']

PositionNew = np.flip(Position, axis=2)

File['parameters']['FORCE_PLATFORM']['CORNERS']['value'] = PositionNew

File.write(os.path.join(PathOutput, FileName))

The code runs without error however the file in R:/NewFiles seems is only 2KB large compared to the 1200 KB of the original file. Also when I open the file with Mokka I can see the force plates but there seems to be no data in the file.

Furthermore if I run the following code and just load and then save the file again it is also empty?

import os
import numpy as np
import ezc3d

PathC3D = 'R:/Data'
PathOutput = 'R:/NewFiles'

FileName = '417351_laq_k.c3d'

File =  ezc3d.c3d(os.path.join(PathC3D, FileName))

File.write(os.path.join(PathOutput, FileName))

I would greatly appreciate any help on the matter :)

Many thanks in advance!

Attached here are the original file and the copy:
File.zip

@pariterre
Copy link
Member

Dear @michael-lbm

When looking at your original file, it seems corrupted, i.e. the problem does not occur when writing is used, but when reading the original file. Indeed, File['header']['points']['last_frame'] returns 18446744073709551615 (which is -1 interpreted as unsigned int). This means that for some reason, the data header of your original file tells ezc3d that there is no data in your file.

I suspect the c3d was created without points and instead of properly declaring the header, the manufacturor did not declare the number of frames. This means ezc3d skips entirely the analog reading part as well.

Do you know the company this c3d is from? I can make a fix, but I would need to specify the manufacturor in the source code for reference

@lukas-lbm
Copy link
Author

Hi @pariterre

thanks for the quick reply.

The file was created from the recordings of two type 3 force plates from kistler (model 9260AA6). The file was exported from the BioWare software from Kistler. Since for this recording only the force plates were used without any motion capture system I guess you are right and the c3d was created without any points.

If you need any further information on the file or recording setup please feel free to ask.

@lukas-lbm
Copy link
Author

Hi,

I just wanted to ask it there any updates regarding this issue?

@pariterre
Copy link
Member

Hi @michael-lbm!
Sorry I haven't had the time to work on this lately. I'll try to have a look this weeken! Thanks for the reminder!

@pariterre
Copy link
Member

Fixed in #302
:)

I am pushing a new release on conda soon :)

@pariterre
Copy link
Member

@michael-lbm
Done, version 1.5.6 should do the trick :)

@lukas-lbm
Copy link
Author

Hi @pariterre ,

thank you for the new version, I really appreciate your effort.

I'm sorry to bother you again, but unfortunately I still can't seem to get it to work.

Now when I run the same code with my file I get an error:

Number of frames in the data set must match the analog rate X point frame

Unfortunately I don't understand the .c3d format quite well so don't really know what might be the problem here.

@pariterre
Copy link
Member

@michael-lbm
Hello there!
Sorry again for the time since my last response... I've had the time to look at this error. It should now be fixed thanks to #304
I'll push the 1.5.7 version during the day!

@lukas-lbm
Copy link
Author

Hi @pariterre,

I just tried it with version 1.5.7 and now it works :)

Thanks again for your time and effort!

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