Skip to content

Input compensation as a modular option in the AlgoApp settings - #103

Merged
seb5g merged 9 commits into
5.3.xfrom
feature/input-compensation
Nov 9, 2026
Merged

seb5g merged 9 commits into
5.3.xfrom
feature/input-compensation

Conversation

@seb5g

@seb5g seb5g commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • The compensation of the input beam is a modular piece of code like the initial phase: algorithms/compensation.py (base class, CompensationFactory) and algorithms/compensations/ (NoCompensation, DivideByInput with Min input level, default 0.2).
  • It is chosen in a new Input Compensation group of the AlgoApp settings, shown only for the algorithms that set INPUT_COMPENSATION = True (an opt-in class attribute) and use self.compensate_target(...): the binary holograms (Parallel Lee, Superpixel with block averaging) and the checkerboard OL2014.
  • compensate_input / min_input_level are removed from the binary hologram settings (old saved values are simply ignored, no migration).
  • The unreachable region is outlined in red as soon as the compensation, the algorithm or the input/target changes, before any run (AlgoBase.preview_unreachable, BeamShaping.update_unreachable_preview): input and target loaders and target views, then also modulator and output views after a run; never the intermediate plane.
  • Headless: set_compensation(app, name, params).
  • Behaviour change to check: OL2014 is now compensated by default (DivideByInput); NoCompensation gives the previous result.

Test plan

  • tests/test_compensation.py (array level), algorithm level (test_algo_helpers.py: checkerboard flatter with the compensation, preview equals the region of a run, Superpixel blocks), AlgoApp group and signal (test_custom_apps.py), real extension preview (test_region_outline.py).
  • Full suite: 185 passed (3 parametrized test_algo_app_saves_what_is_sent_to_the_shaper cases deselected locally for time before; the whole test_custom_apps.py passes).
  • Not tried on a bench; the checkerboard compensation is checked in simulation only.

Generated by Claude Code

A factory of compensations like the initial phases (NoCompensation, DivideByInput), a settings group shown for the algorithms that use it (INPUT_COMPENSATION), used by the binary holograms and the checkerboard. The unreachable region is outlined as soon as the compensation is chosen, before any run.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKuN83BLrbGKe3ynHHvZQm
…for every modulator type

The phase sent to the modulator is not the modulator phase anymore once the input phase is kept in the modulator field (issue #98).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKuN83BLrbGKe3ynHHvZQm
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKuN83BLrbGKe3ynHHvZQm
…orithm (None: not used)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKuN83BLrbGKe3ynHHvZQm
…thm saved and loaded

Loading a setting called value_changed, which saved all the settings: the ones not loaded yet were replaced by their current values (only the first setting of the tree came back after a restart, and values leaked from an algorithm to another). Also the OL2014 name has no slash anymore (it is a section of the config file).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKuN83BLrbGKe3ynHHvZQm
…ear error)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKuN83BLrbGKe3ynHHvZQm
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKuN83BLrbGKe3ynHHvZQm
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKuN83BLrbGKe3ynHHvZQm
@seb5g
seb5g merged commit 6291d67 into 5.3.x Nov 9, 2026
7 checks passed
@seb5g
seb5g deleted the feature/input-compensation branch November 9, 2026 20:52
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