Fix two example script bugs (default_timer typo; unguarded debug_plots) - #108
Merged
Conversation
- 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>
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.
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.pyCalled the undefined bare name
default_timer()(raisingNameErrorbefore the solve even started). Changed totimeit.default_timer()—timeitis already imported, and this matchessimple_example.py/scroll_compressor.py.examples/scroll_compressor_valves.pyThe final
debug_plots(ScrollComp, ...)call was unconditional, so it raisedNameError: name 'debug_plots' is not definedwheneverwxPythonisn't installed (the import is gated behind atry/exceptthat sets aplottingflag). The simulation itself ran to completion; only the trailing plot call failed. Guarded it withif plotting:, matching the idiom inrecip_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 theNameErrorinto the solver.Note (out of scope)
With the typo fixed,
scroll_compressor_multilump.pynow surfaces a separate, pre-existing geometry precision bug inPDSim/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