Skip to content

Fix two example script bugs (default_timer typo; unguarded debug_plots) - #108

Merged
ibell merged 1 commit into
masterfrom
fix-example-script-bugs
Jun 10, 2026
Merged

Fix two example script bugs (default_timer typo; unguarded debug_plots)#108
ibell merged 1 commit into
masterfrom
fix-example-script-bugs

Conversation

@ibell

@ibell ibell commented Jun 10, 2026

Copy link
Copy Markdown
Owner

What

Two small, physics-independent bug fixes to example scripts, found while running all examples against the CoolProp v8 beta from test.pypi. Neither is CoolProp-specific — they would fail the same way on any version.

examples/scroll_compressor_multilump.py

Called the undefined bare name default_timer() (raising NameError before the solve even started). Changed to timeit.default_timer()timeit is already imported, and this matches simple_example.py / scroll_compressor.py.

examples/scroll_compressor_valves.py

The final debug_plots(ScrollComp, ...) call was unconditional, so it raised NameError: name 'debug_plots' is not defined whenever wxPython isn't installed (the import is gated behind a try/except that sets a plotting flag). The simulation itself ran to completion; only the trailing plot call failed. Guarded it with if plotting:, matching the idiom in recip_compressor.py.

Verification

Both run under the CoolProp v8 beta (7.2.1.dev20260610124924):

  • scroll_compressor_valves.py → completes cleanly (rc=0): VE 91.85%, AE 65.6%.
  • scroll_compressor_multilump.py → gets past the NameError into the solver.

Note (out of scope)

With the typo fixed, scroll_compressor_multilump.py now surfaces a separate, pre-existing geometry precision bug in PDSim/scroll/symm_scroll_geo.pyx:515 (_radial_leakage_angles): phi_max(15.148966328953213) < phi_min(15.148966328953215), a ~2-ULP ordering failure. Not addressed here.

🤖 Generated with Claude Code

- scroll_compressor_multilump.py: call timeit.default_timer() instead of
  the undefined bare name default_timer() (NameError before solving), matching
  the convention in the other examples.
- scroll_compressor_valves.py: guard the final debug_plots() call with the
  existing `plotting` flag so the run completes when wxPython isn't installed
  (the simulation already finished; only the plot call raised NameError).

Both surfaced while running the examples against the CoolProp v8 beta, but
neither is CoolProp-specific.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ibell
ibell merged commit 82e0195 into master Jun 10, 2026
8 checks passed
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.

1 participant