Skip to content

Replace print-based diagnostics with the logging module#76

Open
kripnerl wants to merge 5 commits into
developfrom
claude/equilibrium-init-refactor-4biwkn
Open

Replace print-based diagnostics with the logging module#76
kripnerl wants to merge 5 commits into
developfrom
claude/equilibrium-init-refactor-4biwkn

Conversation

@kripnerl

Copy link
Copy Markdown
Owner

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

claude added 5 commits June 12, 2026 12:51
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants