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

Refactor Analysis module: distance functions #3586

Merged
merged 10 commits into from
Mar 20, 2020

Conversation

jngrad
Copy link
Member

@jngrad jngrad commented Mar 18, 2020

Description of changes:

jngrad added 7 commits March 18, 2020 14:11
Reduce code complexity by storing Vector3d objects directly.
The function was unused, untested, and the documentation was wrong
(it returned the squared distance). The same result can be obtained
with `system.distance(system.part[i], system.part[j])**2`.
@jngrad jngrad added this to the Espresso 4.2 milestone Mar 18, 2020
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

You'll be able to see Jupyter notebook diff and discuss changes. Powered by ReviewNB.

@jngrad jngrad changed the title Refactor analysis: distance functions Refactor Analysis module: distance functions Mar 18, 2020
@jngrad jngrad requested a review from RudolfWeeber March 18, 2020 19:57
@jngrad
Copy link
Member Author

jngrad commented Mar 18, 2020

@RudolfWeeber I'm splitting the work in multiple PRs. I'm converting the analysis functions rdf, linear_momentum and angular_momentum as observables in another branch. It's gonna be a substantial extension of the Observable framework. The current framework doesn't scale well, e.g. the PidProfileObservable assumes a 3D profile (to get a 1D profile, one has to duplicate the 3D profile class), and has a lot of code duplication with CylindricalProfile for no good reason (from what I understand, it's only to get class attributes named min_r/min_phi instead of min_x/min_y). A solution of the style template <size_t dimension=3> class ProfileObservable leads to compiler errors because the templated classes have the same symbol. The long-term solution here is probably to have a templated class with structs as template argument, e.g. Cartesian1D, Cartesian3D, Cylindrical3D, Radial1D, etc. As an illustration, the RDF requires the creation of either a PtypeProfileObservable1d -> {PtypeObservable, ProfileObservable1d} class or a RadialProfile class.

@codecov
Copy link

codecov bot commented Mar 18, 2020

Codecov Report

Merging #3586 into python will increase coverage by <1%.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           python   #3586    +/-   ##
=======================================
+ Coverage      88%     88%   +<1%     
=======================================
  Files         528     528            
  Lines       23607   23590    -17     
=======================================
- Hits        20785   20777     -8     
+ Misses       2822    2813     -9
Impacted Files Coverage Δ
src/core/statistics.hpp 86% <ø> (-2%) ⬇️
src/core/observables/PidProfileObservable.hpp 100% <100%> (ø) ⬆️
src/core/statistics.cpp 76% <100%> (+1%) ⬆️

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 3ba2d1d...638348c. Read the comment docs.

Copy link
Member

@KaiSzuttor KaiSzuttor left a comment

Choose a reason for hiding this comment

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

Maybe we can get rid of distto

@KaiSzuttor
Copy link
Member

Concerning the histogram observables: this is probably a bit more involved because currently it also has the issue that histogram information cannot be retrieved. Also it may be worth to first refactor the observable framework and afterwards think about interaction with the histograms?

@jngrad
Copy link
Member Author

jngrad commented Mar 19, 2020

I haven't looked into histograms, not sure how much of if it will overlap with my work on the ProfileObservable classes. I'm not really convinced by the current framework, for example ProfileObservable inherits from Observable but CylindricalProfile doesn't. It's unclear whether SphericalProfile should derive from Observable or not. Also, the way CylindricalProfile is currently used, it would simplify the code to have it inherit from Observable, but I'm not sure it's the right direction. Having a template class ProfileObservable<coord_system> inheriting from Cartesian/Cylindrical/Spherical would be less confusing.

@RudolfWeeber
Copy link
Contributor

RudolfWeeber commented Mar 19, 2020 via email

@jngrad jngrad added the automerge Merge with kodiak label Mar 20, 2020
@kodiakhq kodiakhq bot merged commit ca52334 into espressomd:python Mar 20, 2020
@jngrad jngrad deleted the refactor-analysis branch January 18, 2022 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants