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

TrajectoryData: Fix bug in get_step_data #5734

Merged
merged 1 commit into from
Nov 1, 2022

Conversation

sphuber
Copy link
Contributor

@sphuber sphuber commented Oct 31, 2022

Fixes #4170

The get_step_data would raise a NameError in case a TrajectoryData does not define the cells array. The variable cell would be returned but it would only be defined if self.get_cells() does not return None.

@ltalirz
Copy link
Member

ltalirz commented Oct 31, 2022

haven't looked at the code in this PR, but possibly related: https://github.com/aiidateam/aiida-core/pull/5394/files

I was waiting for some data input there; perhaps we can get that one across the finish line as well with some sample data

@sphuber
Copy link
Contributor Author

sphuber commented Oct 31, 2022

I was waiting for some data input there; perhaps we can get that one across the finish line as well with some sample data

Looking at the linked issue it doesn't seem to be related. This issue solves a bug with the TrajectoryData class itself, whereas the issue of your PR has to do with the various external programs that can be called through the verdi data trajectory show command.

Don't think that you actually need real world data for the tests right? The issue is that exceptions are raised, not that the data is plotted incorrectly. Think you can just mock a trajectory with a fixture.

@sphuber sphuber requested a review from giovannipizzi November 1, 2022 09:39
Copy link
Member

@giovannipizzi giovannipizzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the implemented behaviour seems OK to me!

The `get_step_data` would raise a `NameError` in case a `TrajectoryData`
does not define the `cells` array. The variable `cell` would be returned
but it would only be defined if `self.get_cells()` does not return
`None`.
@sphuber sphuber force-pushed the fix/4170/trajectory-no-cells branch from c5e12b5 to a869c18 Compare November 1, 2022 11:47
@sphuber sphuber merged commit 9c54b73 into aiidateam:main Nov 1, 2022
@sphuber sphuber deleted the fix/4170/trajectory-no-cells branch November 1, 2022 13:23
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

Successfully merging this pull request may close these issues.

TrajectoryData.get_step_data throws error if trajectory does not contain cells array
4 participants