-
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
Analysis progmeter #892
Analysis progmeter #892
Conversation
@richardjgowers any reason the progmeter wasn't in the base class already? |
No real reason, it would make a good addition for UI On Thu, 7 Jul 2016, 14:27 Max Linke, notifications@github.com wrote:
|
a711eaf
to
1fe8352
Compare
This should be done now. The docs could use an example of how to correctly derive from AnalysisBase. One other thing this breaks user code who have written their own analysis based on |
An other solution would be to test for |
Or setup the pm in _setup_frames which I think? Everyone uses On Fri, 8 Jul 2016, 09:03 Jonathan Barnoud, notifications@github.com
|
The old API works and is unit-tested as well. |
The docs need to be updated about that though. |
7ad1911
to
3c5f09b
Compare
LGTM |
@richardjgowers also not that it is now required to redefine I'll change the docs in the evening and then this can be merged. |
3c5f09b
to
f2d8d36
Compare
Doc strings updated. Please have a look if I misspelled anything. |
Enhancements | ||
|
||
* All classes derived from 'AnalysisBase' now display a ProgressMeter | ||
with 'quiet=False' |
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.
Shouldn't this be when quiet=True?
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.
This is correct. You are thinking of verbose=True
which is the normal way people turn on logging and output. For some reason MDAnalysis has decided in the past to rather go with the word quiet
and there False
would say the function can print and log stuff for me,
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.
Ah right yeah, it's backwards to what I expect, ok cool
This also adds an initialization function to AnalysisBase. This is done now because we need to do more then just to setup the iteration.
Returning an axis object is considered to be better since the user is able to adjust the plot by himself if he wishes to do so.
f2d8d36
to
b08dcac
Compare
Since user code might already exist we keep make sure the old API still works as well.
b08dcac
to
ffdf479
Compare
Afterwards the new analysis can be run like this. | ||
|
||
.. code-block:: python | ||
na = NewAnalysis(u.select_atoms('name CA'), 35).run() |
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.
I like this.
* PEP8 Changes * Add progressmeter to AnalysisBase This also adds an initialization function to AnalysisBase. This is done now because we need to do more then just to setup the iteration. * Adopt Contacts * Follow best practices for matplotlib Returning an axis object is considered to be better since the user is able to adjust the plot by himself if he wishes to do so. * Addopt Persistencelength * Adopt InterRDF * Adopt LinearDensity * Adopt AlignTrj * update changelog * Ensure old API still works Since user code might already exist we keep make sure the old API still works as well.
* PEP8 Changes * Add progressmeter to AnalysisBase This also adds an initialization function to AnalysisBase. This is done now because we need to do more then just to setup the iteration. * Adopt Contacts * Follow best practices for matplotlib Returning an axis object is considered to be better since the user is able to adjust the plot by himself if he wishes to do so. * Addopt Persistencelength * Adopt InterRDF * Adopt LinearDensity * Adopt AlignTrj * update changelog * Ensure old API still works Since user code might already exist we keep make sure the old API still works as well.
Changes made in this Pull Request:
This command will print a progressbar and immediately run the alignment.
Notice that the
quiet
parameter isn't explicitly added to theAlignTrj
init function. Instead I catch it in the kwargs parameter that is passed to theAnalysisBase
constructor. This is one of the few cases where I think it's OK to use a kwargs parameter instead of explicit typed parameters. As this allows us to add options to analysisbase that will be automatically picked up by any child-class.PR Checklist
Issue raised/referenced?