Repository navigation
Keep the input phase in the modulator field, optional input phase compensation - #104
Merged
Merged
Conversation
… the input phase (#98) The modulator field is the input field times the SLM field: its phase is the input phase plus the SLM phase, the SLM field never holds the input phase. Back-propagated phases go through slm_phase_from_modulator_phase. The algorithms controlling the output phase (ALGOTYPE not AMPLITUDE) encode target_phase(): minus the input phase when the new checkbox 'Compensate input phase' (Input Compensation group, default on) is checked. Docs: fields and planes table, compensations of the input beam. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RKuN83BLrbGKe3ynHHvZQm
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.
Closes #98. Decisions taken in the question table https://claude.ai/artifact/5umN3yU1phRbV8bJpad4dh.
What changes
set_phase_in_modulator_plane(phase)takes the SLM phase (wrapped, quantised, crosstalk applied to it alone) and the modulator phase becomesinput phase + SLM phase. The SLM field never holds the input phase. The initial phase is an SLM phase.back_propagate_amplitude(Gerchberg-Saxton, Projections) removes the input phase from the back-propagated phase (slm_phase_from_modulator_phase), so the loops see the true input field.Compensate input phasein the Input Compensation group (default on), shown whenALGOTYPEis notAMPLITUDE(can_compensate_input_phase): Direct, Binary Threshold, Parallel Lee, Superpixel, OL2014 encodetarget_phase()= target phase − input phase when it is on. Headless:set_compensate_input_phase(app, bool).Behaviour change
Results change for any input beam whose phase is not flat. A flat input phase gives the previous results.
Tests
tests/test_input_phase.py(11 tests, written first): modulator phase = input + SLM; GS with a curved input gives an output equal to the propagation of input × SLM field and converges as well as with a flat input; initial phase on top of the input phase; binary hologram keeps the input phase; checkbox offered per ALGOTYPE; compensation = encoding target − input phase with a flat input (Lee, Superpixel, Threshold, OL2014); Direct; AlgoApp visibility. Two existing tests now compare the SLM phase with the modulator phase minus the input phase, modulo 2π. Full local suite: 215 passed before that test update, the 3 failures being those comparisons; the two touched files pass (30).Generated by Claude Code