Repository navigation
Migrate Python modules to sbldpy (simplebuild/dgcode 2.0) and make LOKI tests platform independent - #6
Merged
Conversation
Migrate the GeoBCS, GeoBCSBanks, GeoLarmor2020, GeoLarmor2022 and GeoPlane geometry modules from pybind11 (pycpp_*) to sbldpy (pymod__*), following the migration recipe in the simplebuild-dgcode documentation. The Python API (e.g. G4GeoLoki.GeoBCSBanks.create()) is unchanged. Assisted-by: Claude
The compiled code is in private modules (_LokiAimHelper, _Larmor2022Bank, _TestUtils), and Python modules with the same names and APIs as before add the default values of constructor arguments, the module constants, and the conversion of results to lists (passed from C++ through callbacks). G4GeoLokiTests now depends on numpy. Assisted-by: Claude
Many positions in the geometry (e.g. pixel centres along the straws, like 7.8125 mm) are exactly halfway between two printed values, so tiny floating point differences between platforms decided the rounding, and test_geo_navigation failed on macOS even with fewer decimals. The fmt helper now first rounds to prec+6 decimals (removing such differences) and then rounds half away from zero. The reference logs change only in the last digit of such values (and in the hashes of the formatted pixel centres in test_larmor2022_bank). Assisted-by: Claude
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Yo @MilanKlausz we are finally getting to the dgcode_projects in this housekeeping + updating of simplebuild and dgcode.
It is mostly follow up fixes for the migration away from pybind11 to a new small custom python-c++ hooking I designed (it has less features but compiles a lot faster and will eventually allow me to drop the pybind11 support). There are also some fixes for one of your tests which was a bit flaky.
Claude will say the rest:
Converts all compiled Python modules from pybind11 (pycpp_* directories) to sbldpy (pymod_* directories), as introduced in simplebuild 2.0.0 and simplebuild-dgcode 2.0.0, and makes the output of the LOKI tests independent of the platform.
Python modules (the Python APIs are unchanged):
Test robustness:
All 44 tests pass on Linux (release and debug builds) and macOS. The cppcheck step requires simplebuild-dgcode 2.0.1, which fixes an error reported in its MCPLExtra package.
assisted-by: claude