-
Notifications
You must be signed in to change notification settings - Fork 667
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
change _single_frame by using timeseries #4028
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello there first time contributor! Welcome to the MDAnalysis community! We ask that all contributors abide by our Code of Conduct and that first time contributors introduce themselves on the developer mailing list so we can get to know you. You can learn more about participating here. Please also add yourself to package/AUTHORS
as part of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The _single_frame
method is called repeatedly over the trajectory by run()
to access the values in each frame. The equivalent is done in timeseries()
so you don't need to call timeseries every frame, only once. _prepare()
would be a good place to do this. Have a look at the AnalysisBase
class for hints and check the results of any failing tests for more clues.
Thank you for the hints! I submitted another change to this pull request. |
Hi, I tried a few times to solve the array shape issue in |
@hmacdope I have tried to change the |
@SophiaRuan , since PR #4004 was closed, your PR is now considered the active one addressing issue #3993 . |
package/MDAnalysis/analysis/msd.py
Outdated
# self.results.timeseries not set here | ||
start, stop, step = self._trajectory.check_slice_indices(self.start, self.stop, self.step) | ||
self._position_array = self._trajectory.timeseries() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use the arguments to timeseries
to control start, stop and step.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be careful of the inclusive range bug (#3893)
package/MDAnalysis/analysis/msd.py
Outdated
start, stop, step = self._trajectory.check_slice_indices(self.start, self.stop, self.step) | ||
self._position_array = self._trajectory.timeseries() | ||
self._position_array = self._position_array[start: stop: step] | ||
self._position_array = np.transpose(self._position_array, (1, 0, 2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use the order
argument to timeseries
to control the output order so that you don't need this transpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your suggestions! I will try to fix them.
I think it's to do with the timeseries indexing being inclusive. See my other comment. You may need to add one to the index |
Sorry I meant remove one. |
@hmacdope I've tried to remove 1 from |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## develop #4028 +/- ##
===========================================
- Coverage 93.54% 85.38% -8.16%
===========================================
Files 191 177 -14
Lines 25065 23957 -1108
Branches 4042 3460 -582
===========================================
- Hits 23446 20456 -2990
- Misses 1099 3022 +1923
+ Partials 520 479 -41
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@SophiaRuan As an advice I will say try removing |
Hi @MohitKumar020291, thank you for your suggestion! I'll look into that! |
Hi @MohitKumar020291 @hmacdope, I am not sure if I need to remove |
@SophiaRuan There is something like that the issue want to insert |
@SophiaRuan I am going to close your PR, following the discussion in #3993. Sorry that we asked you to do all the work. I really appreciated how you asked important questions that ultimately convinced us that we had not thought the suggested approach through. Please ping @hmacdope and myself once you have a new PR up so that we can give you feedback. |
Fixes #3993
Changes made in this Pull Request:
PR Checklist