Skip to content

RFC: Add results class for storing analysis results#3233

Merged
orbeckst merged 37 commits intoMDAnalysis:developfrom
PicoCentauri:3115-AnalysisBase-results-class
May 6, 2021
Merged

RFC: Add results class for storing analysis results#3233
orbeckst merged 37 commits intoMDAnalysis:developfrom
PicoCentauri:3115-AnalysisBase-results-class

Conversation

@PicoCentauri
Copy link
Contributor

@PicoCentauri PicoCentauri commented Apr 16, 2021

Fixes #3115

Changes made in this Pull Request:
This PR adds a _Results class to the AnalysisBase for similarly storing results across all analysis modules. One could think about using Python's "new" dataclass decorator when Py3.6 is dropped.

I would like to know what you think about the approach and I'm open to discussing improvements or other suggestions.
The docs definitely need some polishing.

PR Checklist

  • Tests?
  • Docs?
  • CHANGELOG updated?
  • Issue raised/referenced?

@pep8speaks
Copy link

pep8speaks commented Apr 16, 2021

Hello @PicoCentauri! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-05-05 07:29:03 UTC

@codecov
Copy link

codecov bot commented Apr 16, 2021

Codecov Report

Merging #3233 (85940f9) into develop (79183bf) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3233      +/-   ##
===========================================
+ Coverage    92.87%   92.88%   +0.01%     
===========================================
  Files          170      170              
  Lines        22870    22905      +35     
  Branches      3243     3249       +6     
===========================================
+ Hits         21240    21275      +35     
  Misses        1582     1582              
  Partials        48       48              
Impacted Files Coverage Δ
package/MDAnalysis/analysis/__init__.py 100.00% <ø> (ø)
package/MDAnalysis/analysis/base.py 96.63% <100.00%> (+1.18%) ⬆️
package/MDAnalysis/analysis/gnm.py 99.20% <100.00%> (+0.02%) ⬆️
package/MDAnalysis/analysis/lineardensity.py 84.41% <100.00%> (+0.20%) ⬆️
package/MDAnalysis/analysis/polymer.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 79183bf...85940f9. Read the comment docs.

@IAlibay IAlibay added this to the 2.0 milestone Apr 22, 2021
@IAlibay
Copy link
Member

IAlibay commented Apr 22, 2021

Just going to ping all the @MDAnalysis/coredevs this is central to the 2.0 release so the more eyes the better.

Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

  • I think the _Results class could be made more dict like, which would also help with integrating it into the existing classes.
  • I am not clear how AnalysisFromFunction will use the new results class.

@PicoCentauri
Copy link
Contributor Author

I'm wondering and don't see a reason why GNMAnalysis is not inheriting from AnalysisBase. I could adjust this here or create a different PR to fix this.

@PicoCentauri PicoCentauri force-pushed the 3115-AnalysisBase-results-class branch from c909b12 to 0326737 Compare April 24, 2021 16:44
@orbeckst
Copy link
Member

I'm wondering and don't see a reason why GNMAnalysis is not inheriting from AnalysisBase. I could adjust this here or create a different PR to fix this.

History... very old code.

Would be awesome to have it AnalysisBase-derived but better in a different PR – small, self-contained PRs are more easily reviewed and merged.

@orbeckst
Copy link
Member

If you raise an issue then you can attach the PR to the issue for making GNM analysis canonical.

@orbeckst
Copy link
Member

With GNM now AnalysisBase-based #3244, could you please update the PR, @PicoCentauri ?

@orbeckst
Copy link
Member

I am pretty much ready to approve this PR and the use of the Results class for holding results.

@MDAnalysis/coredevs if you see issues with this approach, now is the time to make a blocking review.

@orbeckst orbeckst added the API label Apr 28, 2021
Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

I am generally happy with the approach.

The two major things I see

  • document what API should contain (or that it contain anything)
  • prevent Results to have keys that collide with dict methods/attributes

Otherwise I have various minor doc things – please see comments.

@PicoCentauri PicoCentauri force-pushed the 3115-AnalysisBase-results-class branch 3 times, most recently from f343989 to fb55489 Compare April 29, 2021 19:34
Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

Looking very good, just minor doc/style comments.

@orbeckst
Copy link
Member

I didn't have time to see why the tests fail but obviously they should pass, too.

@PicoCentauri PicoCentauri force-pushed the 3115-AnalysisBase-results-class branch from fb55489 to 15528a2 Compare April 29, 2021 20:49
Copy link
Member

@lilyminium lilyminium left a comment

Choose a reason for hiding this comment

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

I saw you updated while I was reviewing so not all comments may be applicable @PicoCentauri. I've left comments on the docs :)

@PicoCentauri PicoCentauri force-pushed the 3115-AnalysisBase-results-class branch from 81a552f to 85940f9 Compare May 5, 2021 07:28
@PicoCentauri
Copy link
Contributor Author

Thank for your suggestion @orbeckst. I implemented the doc changes. While removing the available analysis section I merged the docstring of the analysis' __init__.py into `analysis_modules.rst. For me this seemed more reasonable as an extra documentation page with only one paragraph.

@orbeckst
Copy link
Member

orbeckst commented May 5, 2021

@lilyminium if you have a few minutes to spare to do a final look at this PR then please do. Otherwise I am happy to merge it tonight (so that we can add Results to other analysis classes – see #3115 (comment) ).

@IAlibay , you said on discord you found some duplicate authorship/names — I didn't understand what that was about. Anything that needs to be fixed here?

@IAlibay
Copy link
Member

IAlibay commented May 5, 2021

@IAlibay , you said on discord you found some duplicate authorship/names — I didn't understand what that was about. Anything that needs to be fixed here?

O yeah, nothing major, there's just two PicoCentauri entries in the CHANGELOG for 2.0. We can just remove it when we update a few of the other AnalysisBase things to use Results (i.e. there's no point to triggering CI again just for that).

@PicoCentauri
Copy link
Contributor Author

PicoCentauri commented May 5, 2021

O yeah, nothing major, there's just two PicoCentauri entries in the CHANGELOG for 2.0. We can just remove it when we update a few of the other AnalysisBase things to use Results (i.e. there's no point to triggering CI again just for that).

Sorry, that was probably me who messed this up.

@orbeckst orbeckst dismissed lilyminium’s stale review May 6, 2021 06:38

Comments were addressed as far as I can see and @lilyminium said I should dismiss her review if necessary as she is busy.

@orbeckst orbeckst merged commit 903ae4c into MDAnalysis:develop May 6, 2021
@orbeckst
Copy link
Member

orbeckst commented May 6, 2021

@PicoCentauri and @joaomcteixeira – the new AnalysisBase is in 2.0.0 !

As @IAlibay said: let's get at least the most used AnalysisBase classes to also use .results (in a backward compatible way) so that we can teach the new way at the PRACE workshop.

@joaomcteixeira
Copy link
Member

Fantastic! All kudos for this implementation to @PicoCentauri. Congratz! 🎉

@PicoCentauri PicoCentauri deleted the 3115-AnalysisBase-results-class branch June 5, 2024 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Common AnalysisBase framework for storing results

10 participants