Separate undershoot and scan phase adjustment#30
Draft
marktsuchida wants to merge 2 commits into
Draft
Conversation
These are two separate adjustments (time for scanner to settle into linear motion vs compensation for command-scanner lag), and it works better to have individual adjustments. Also decouple the scan waveform sample frequency from the pixel rate, and make the retrace duration scale with amplitude. These refactorings were easier to do in one step. Clock output, for now, uses aoRateHz. In the future it might make sense for it to follow detector acquisition instead. The default values of the new parameters preserve behavior for 256x256, 200kHz, zoom=1. Remove DumpWaveform rather than maintain it, because we now have WaveformTool and waveform_viewer.py (which are updated here). (Assisted by Claude Code; any errors are mine.)
Member
Author
|
Might need to rethink this, because completely decoupling scan waveform sample rate from detector pixel rate might not actually be feasible, at least when we want to generate accurate line/frame clocks.
So maybe we should require an integer multiple between AO/AI sample rates, or auto-choose the AO sample rate based on the desired AI rate, etc. |
Open
The AO scan waveform and the line/frame clocks are produced on the AO sample grid, but the detector acquires pixels on the pixel grid. With the AO rate an independent setting, the per-line scan window didn't exactly equal the acquisition window: the line clock edge could be a fraction of a pixel off at line end. Remove the user setting for AO rate; constrain aoRate = K * pixelRate for integer K dividing the pixel period in sample clock timebase (usually 100 MHz) ticks. This makes the AO rate an exact timebase divisor (keeping the timebase-derived line counter drift-free) and the scan window an exact integer number of pixels. Among valid K with the AO rate in [100 kHz, device max], pick the rate closest to 200 kHz (galvo bandwidth is ~kHz; higher only wastes memory/CPU), preferring the higher on a tie. (Assisted by Claude Code; any errors are mine.)
Member
Author
Did both of those. Not tested yet. |
Draft
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.
These are two separate adjustments (time for scanner to settle into linear motion vs compensation for command-scanner lag), and it works better to have individual adjustments.
Also decouple the scan waveform sample frequency from the pixel rate, and make the retrace duration scale with amplitude. These refactorings were easier to do in one step.
Clock output, for now, uses aoRateHz. In the future it might make sense for it to follow detector acquisition instead.
The default values of the new parameters preserve behavior for 256x256, 200kHz, zoom=1.
Remove DumpWaveform rather than maintain it, because we now have WaveformTool and waveform_viewer.py (which are updated here).