Skip to content

fix: update ImagePlane to the bdsim 1.5 graphics block interface - #251

Merged
petercorke merged 2 commits into
mainfrom
bug/imageplane-start
Nov 23, 2026
Merged

petercorke merged 2 commits into
mainfrom
bug/imageplane-start

Conversation

@petercorke

Copy link
Copy Markdown
Owner

Updates the IMAGEPLANE block to the graphics block interface of bdsim 1.5, which changed a lot since the block was written. Found while annotating blocks/camera.py (Issue 60).

Faults:

  • IMAGEPLANE(watch=True) crashed at the start of a run with AttributeError: 'StartPlug' object has no attribute 'start'. The block added its input signals to the watchlist itself, and bdsim 1.5 does that in GraphicsBlock.start.
  • It opened a second figure of its own, leaving the one that the base class makes empty (bug list item 8).
  • With graphics=False it still opened a figure and used axes that did not exist.

Changes, following what bdsim's own Scope does:

  • watch is passed to the base class constructor.
  • start() uses the figure and axes from the base class, and returns early when graphics are off (_enabled).
  • Data is collected in record(), which bdsim calls for every accepted sample. step() only redraws, and bdsim may call it less often.

Tests (real bdsim runs on the Agg backend): one figure is opened, watch=True records the input signal, no watch records nothing, and graphics=False draws nothing, opens no figure and still records a watched signal. The existing simulation tests are unchanged and pass. mypy reports no issues and the full suite passes (2143 passed, 33 skipped).

AI-assisted: written with Claude Code (Claude Sonnet 5.5) and reviewed by the maintainer.

🤖 Generated with Claude Code

IMAGEPLANE(watch=True) failed with AttributeError ('StartPlug' object has no
attribute 'start'), because ImagePlane added its input signals to the
watchlist itself and bdsim 1.5 now does that in GraphicsBlock.start. It also
made a second figure, leaving the one the base class makes empty, and
opened a figure when graphics were turned off. watch goes to the base class,
start() uses the figure and axes it makes, data is collected in record(),
which runs for every accepted sample, and step() only redraws.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 4 complexity · 0 duplication

Metric Results
Complexity 4
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@petercorke
petercorke merged commit 76e6d2a into main Nov 23, 2026
34 checks passed
@petercorke
petercorke deleted the bug/imageplane-start branch November 23, 2026 06:48
@github-actions github-actions Bot mentioned this pull request Nov 23, 2026
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