Skip to content

Optional "pulse" waveform option for galvo#1226

Merged
AdvancedImagingUTSW merged 3 commits into
developfrom
add-galvo-square-wave
Jun 26, 2026
Merged

Optional "pulse" waveform option for galvo#1226
AdvancedImagingUTSW merged 3 commits into
developfrom
add-galvo-square-wave

Conversation

@conorhughmcfadden

Copy link
Copy Markdown
Collaborator

Resonant galvos work differently from linear galvos: they run at a fixed frequency with only the amplitude being controllable by a DC input voltage. I'm tired of fiddling with the little USB voltage generators every time I image. The goal is to have a simple pulse which can run the resonant galvo while acquiring, but is otherwise silent.

Example config

galvo:
  amplitude: 0.3
  hardware:
  channel: PCIe-6738-A/ao8
    max: 5
    min: 0
    name: daq
    type: NI
  name: resonant_galvo
  offset: 0
  phase: 0.0
  waveform: pulse

Pretty basic pulse, delayed by camera delay and lasting sweep time duration.
Creates a waveforms.single_pulse for the galvo with just amplitude as a user flex parameter.

Pretty basic pulse, delayed by camera delay and lasting sweep time duration.

Goal is to have a simple pulse which can run the resonant galvo while acquiring.
Expose the new galvo pulse waveform in the configuration selector and user documentation so NI and synthetic galvo users can choose it explicitly.

The underlying single_pulse waveform expects delay and pulse_width values as percentages of the sweep, but the galvo pulse branch was passing camera_delay / sweep_time as a fractional ratio. Convert the camera delay to percent before calling single_pulse and derive the remaining pulse width from that percent value.

Add a regression test that uses the real SyntheticGalvo adjust path with a 10 ms camera delay over a 100 ms sweep. The test verifies the pulse starts after the expected delay and remains active for the rest of the sweep.

Validation: python -m pytest -o addopts='' test/model/devices/galvo/test_galvo_base.py test/model/test_waveforms.py -q; ruff check/format on changed Python files; git diff --check.

Copy link
Copy Markdown
Collaborator

@conorhughmcfadden I pushed an update in cf3bdf580 that exposes/documents the new pulse galvo waveform and fixes the pulse timing conversion.

The key correction is that single_pulse() expects delay and pulse_width as percentages of the sweep. The galvo pulse branch was using camera_delay / sweep_time as a fractional ratio, so it now converts that delay to percent before generating the waveform.

Could you please pull the latest branch and test the software again on your machine with your resonant galvo setup?

@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.54%. Comparing base (74f76b4) to head (cf3bdf5).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1226      +/-   ##
===========================================
+ Coverage    64.53%   64.54%   +0.01%     
===========================================
  Files          190      190              
  Lines        26408    26412       +4     
===========================================
+ Hits         17042    17048       +6     
+ Misses        9366     9364       -2     
Flag Coverage Δ
unittests 64.54% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Last sample in single_pulse must be zero to clear the buffer, or else the galvo never shuts off.

I did this before by making the pulse width max 99%, but better to just set the last sample to zero.
@AdvancedImagingUTSW AdvancedImagingUTSW merged commit f09abe3 into develop Jun 26, 2026
1 check failed
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