-
Notifications
You must be signed in to change notification settings - Fork 189
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
Python maintenance #4516
Python maintenance #4516
Conversation
806d3cd
to
a84e824
Compare
Fix code samples, spell check and grammar check, cleanup docstrings.
`TabulatedNonBonded.is_active()` now returns False instead of None when the bond is inactive. Let ScriptInterface classes automatically generate interface methods. Always checks for runtime errors when the cell system changes or when a ScriptInterface object is created. Don't return True from methods that can return void (relic from the ES_OK / ES_ERROR signaling strategy that has been replaced by Python exceptions).
The algorithm searched for particles in a cylinder perpendicular to the plane instead of searching for particles in a slab parallel to the plane.
Re-use existing utility functions in tests_common to reduce code duplication. Replace unreachable exceptions by unittest assertions. Fix tolerance of LBGPU test case up to single-precision accuracy.
a84e824
to
6d91ec5
Compare
@@ -235,6 +234,13 @@ cdef Vector3d make_Vector3d(a): | |||
return v | |||
|
|||
|
|||
cdef Vector3i make_Vector3i(a): |
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.
should there be an assert that len(a) == 3
?
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 don't think it's necessary, the helper functions make_Vector3i()
and make_Vector3d()
should only be called on a variable a
after it passed the sanity check check_type_or_throw_except(a, 3, float, "...")
.
Handle 0-dimensional arrays in type checks. Improve error messages. Cleanup user guide. Convert uppercase comments to lowercase in the visualizer and remove comments that are redundant with docstrings. Co-authored-by: Patrick Kreissl <[email protected]>
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.
Thanks a lot for the nice code improvements and for putting in the extra work of capitalization in the visualizer!
@@ -92,7 +92,7 @@ class LBGPULinearMomentum(LinearMomentumTest, ut.TestCase): | |||
"""Test for the GPU implementation of the LB.""" | |||
|
|||
lb_class = espressomd.lb.LBFluidGPU | |||
atol = 1e-6 | |||
atol = 1e-5 |
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.
what happened here that the tolerance needs to be increased?
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 test is failing at random in CI, e.g. logfile 317102 in the long-range actors refactoring PR. The numerical error is random with a probability distribution that looks Chi-squared. The test fixes all random seeds and the core is supposed to sum the densities in a deterministic order, so I'm not sure what the root cause is. I ran that test in a loop for several thousand times and the largest deviation was 4e-6.
Description of changes:
"bind_centers"
vs."bond_centers"
)tests_common.py
more oftensystem.analysis.nbhood()
was removed (fixes Slab neighborhood search is broken #4517)TabulatedNonBonded.is_active()
now returnsFalse
instead ofNone
when the bond is inactiveScriptInterface
object is instantiatedTrue
to signal they didn't raise an exceptionSystem
class and document why the_Globals
class (now renamed to_BoxGeometry
) has to existScriptInterfaceHelper
classes using automatically generated member methods