-
Notifications
You must be signed in to change notification settings - Fork 20
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
loadC3D in pyCGM_Single/pyCGMIO.py does not reset the mydictunlabeled dictionary. #35
Comments
Can you clarify what the problem is? What is being not loaded correctly? |
When I use loadC3D without resetting the mydictunlabeled dictionary first, the values for unlabeled frames are not correct. If I change the function to not split the data into labeled and unlabeled data, I can get accurately loaded data for all frames. I compared this to the output I get from splitting the data into the two dictionaries, and the data for the labeled dictionaries matches, but the data for the unlabeled dictionary does not. The problem is fixed when I add this line at the end of the for loop: |
Can you post a snippet of the input and output/expected output. I see the problem you are saying, but want to make sure we didn't have a reason to do that. |
Here is a snippet of the code I am using for testing this bug. loadC3D is the function as it exists right now. loadC3DModified is the function where the data and unlabeled data dictionaries are combined, and loadC3DFixed is the function with the proposed change. I am using Sample_Static.c3d for testing. loadC3D returns data in the format: [data,dataunlabeled,markers], so I access index 0 in modifiedc3dresults since I have combined data and unlabeled data. I am testing for the value for the unlabeled data with the name *112 in frame 0.
It produces this output: |
Okay now I see it. Good find. I suspect the issue is the dictionary added to the list is maintaining a reference to it and is being modified each loop, which modifies an earlier value. Please make a PR with your fix and label it to close this issue. |
pyCGM/pyCGM_Single/pycgmIO.py
Line 133 in 360fb86
In the above loop, the dictionary
mydict
is set to an empty dictionary to prepare it for the next frame in the loop, but the dictionarymydictunlabeled
is not. This causes unlabeled data to load incorrectly when usingloadC3D
.The text was updated successfully, but these errors were encountered: