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

Cylinder transformation and observables #4114

Closed
wants to merge 32 commits into from

Conversation

christophlohrmann
Copy link
Contributor

@christophlohrmann christophlohrmann commented Feb 12, 2021

Fixes #4023, fixes #4067

Description of changes:

  • Adds automatic orientation to core HollowConicalFrustum

  • Reworks the cylindrical observables tests

  • Fixes the LB fluxdensity observable by implementing a LB density interpolation

  • introduces a new object CylTrafoParams to make sure axis and orientation are always orthogonal

  • all cylindrical observables use CylTrafoParams

kwargs["orientation"] = vec / np.linalg.norm(vec)
orthogonal_component = vec - np.dot(vec, axis) * axis
norm = np.linalg.norm(orthogonal_component)
if norm > 0.01:
Copy link
Member

Choose a reason for hiding this comment

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

what is this magic 0.01 here? do want to check for sys.float_info.epsilon, maybe?

Copy link
Member

Choose a reason for hiding this comment

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

why do we replicate the logic from the core here?

Copy link
Contributor Author

@christophlohrmann christophlohrmann Feb 19, 2021

Choose a reason for hiding this comment

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

1.) if the orthogonal component is 2 epsilon long and we scale it to 1, it will probably not be very orthogonal due to precision error. I chose a very generous value of 0.1 because we always have the second vector to try which will be more orthogonal. I guess using 1/sqrt(2) as a threshold will choose the vector that is the most orthogonal already and remove some arbitraryness
2.) The core logic for default orientation is for hollowconicalfrustum, the python one for observables

Copy link
Member

Choose a reason for hiding this comment

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

  • okay
  • i think the logic is in the wrong place then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Where would you suggest is the right place to unite it?

Copy link
Member

Choose a reason for hiding this comment

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

algorithmically I think we could do something like: https://math.stackexchange.com/a/1681815

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but that is what I am doing here :)
The Gram-Schmidt-type orthogonalisation works in whatever dimension
You just have to start with a trial vector that is not parallel

@christophlohrmann
Copy link
Contributor Author

christophlohrmann commented Mar 4, 2021

I know I still have to adapt the tutorial and do the documentation, I will do that as soon as I get green light on the stuff that is here

@KaiSzuttor
Copy link
Member

KaiSzuttor commented Mar 5, 2021

could you please fix the sanitizer warnings

@KaiSzuttor
Copy link
Member

@christophlohrmann could you please take the final steps here? We can then merge this soon I think...

Copy link
Member

@jngrad jngrad left a comment

Choose a reason for hiding this comment

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

a few formatting issues

doc/sphinx/analysis.rst Outdated Show resolved Hide resolved
src/python/espressomd/observables.py Outdated Show resolved Hide resolved
testsuite/python/observable_cylindrical.py Outdated Show resolved Hide resolved
testsuite/python/observable_cylindricalLB.py Outdated Show resolved Hide resolved
testsuite/python/observable_cylindricalLB.py Outdated Show resolved Hide resolved
testsuite/python/observable_cylindrical.py Outdated Show resolved Hide resolved
testsuite/python/tests_common.py Outdated Show resolved Hide resolved
@kodiakhq kodiakhq bot closed this in #4152 Mar 10, 2021
kodiakhq bot added a commit that referenced this pull request Mar 10, 2021
…bles (#4152)

Fixes #4023, fixes #4067, closes #4114

Description of changes:
- add `orientation` to `HollowConicalFrustum`
- add an optional argument to control the orientation of cylindrical observables
- fix the LB fluxdensity observable by implementing a LB density interpolation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants