Implement a JSON writer replacing NaN with null #199
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Time estimate or Size
xsmall
Problem
Currently, if there is any
nanin the input files or during calculations withinsimulariumiousingnumpy, it might break the output JSON since JSON does not supportNaNas a valid numerical value.Solution
This new implemented
save_replacing_nansaves theTrajectoryDatato aJSONwhile replacing allNaNwithnull(which is supported byJSON). This should fix the error you get when uploading the.simulariumto the simularium website converted fromNERDSStrajectory withsimulariumio.A new pytest for this function is included.
Type of change
Please delete options that are not relevant.
Change summary:
Steps to Verify:
Pytest implemented at
simulariumio/tests/writers/test_json_writer.py. See the file level docstring.Screenshots (optional):
Previous

savefunction that breaks the web interface:New

save_replacing_nanfunction:Yue "Moon" Ying
NERDSS software development
Dr. Margaret Johnson Group, JHU