Replace print-based diagnostics with the logging module#76
Open
kripnerl wants to merge 5 commits into
Open
Conversation
All modules now log through named loggers under the 'pleque' hierarchy. The package root installs a NullHandler (library best practice) and gains a pleque.set_log_level() convenience helper that attaches a single stream handler for interactive use. https://claude.ai/code/session_01T8Bv18R1iJkgxQ7e4rTAKc
- Initialisation hints (mg_axis, psi_lcfs, x_points, strike_points) can now also be provided as basedata variables; explicit arguments take precedence with a logged warning (idea from MR !63 / feature/fast_forward_init). - init_method is now functional: 'full' ignores all hints, 'hints' (default) uses them to assist the recognition, and 'fast_forward' takes the axis and X-point hints as final and skips the critical-point search (with fallback to 'hints' when the required hints are missing). Unknown values raise ValueError; read_geqdsk and EquilibriaTimeSlices.get_time_slice pass the option through. - The bare except around the initialisation now catches Exception, logs the traceback, and draws the (blocking) debug plot only when the new debug_plots setting is enabled (PLEQUE_DEBUG_PLOTS=1); the same gating applies to the diagnostic plot in find_extremes. Initialisation failures no longer open matplotlib windows in headless/CI environments. - First-wall resolution extracted into _resolve_first_wall with the synthetic rectangular wall construction moved to equi_tools.synthesize_rectangular_wall; the chosen wall source is logged. - find_extremes warns when no O-point candidate is found; F'=FF'/F is guarded against division by zero. - Class and constructor docstrings now describe the actual initialisation sequence, including where it deliberately differs from the thesis-chapter description (1D profile splines built after the critical-point search; LCFS found by marching squares + downhill refinement, not by field-line tracing). https://claude.ai/code/session_01T8Bv18R1iJkgxQ7e4rTAKc
- New tests/test_equilibrium_init.py: synthetic-wall generation, vacuum equilibria, profile-derivative vs direct-profile equivalence, hint arguments and basedata hints (incl. duplicity warning), init_method full/hints/fast_forward consistency on bundled cases, double-null X-points, spline-order override, logging assertions, and the failure path (logged exception, no debug plot by default, debug plot with PLEQUE_DEBUG_PLOTS=1). - The synthetic analytic equilibrium builder moved from tests/test_invert_equilibrium.py to pleque.tests.utils (synthetic_dataset/synthetic_test_wall) for reuse. - tests/test_equilibria.py::test_critical placeholder replaced with real assertions for limiter and X-point configurations. https://claude.ai/code/session_01T8Bv18R1iJkgxQ7e4rTAKc
Resolve conflict in pleque/core/coordinates.py: keep the Coordinates refactor from develop (PR #75) and re-apply the named logger, converting the warning print added by the refactor to logger.warning as well. https://claude.ai/code/session_01T8Bv18R1iJkgxQ7e4rTAKc
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.
All modules now log through named loggers under the 'pleque' hierarchy.
The package root installs a NullHandler (library best practice) and gains
a pleque.set_log_level() convenience helper that attaches a single stream
handler for interactive use.
https://claude.ai/code/session_01T8Bv18R1iJkgxQ7e4rTAKc