Skip to content

Add software TES bias waveform generator - #79

Open
bengineerd wants to merge 5 commits into
pre-releasefrom
tes-bias-waveform
Open

Add software TES bias waveform generator#79
bengineerd wants to merge 5 commits into
pre-releasefrom
tes-bias-waveform

Conversation

@bengineerd

@bengineerd bengineerd commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Closes #55.

Adds the software TES bias waveform generator — TesBiasWaveformProcess (a
pr.Process) plus one TesBiasWaveformGenerator sub-device per TES bias line —
which plays software-clocked sine / square / constant waveforms on the TES bias
lines for testing and characterization. Registered on Group alongside the
other tuning/diagnostic processes and exported from warm_tdm_api.

  • Generator count is sized from the group config (numColumns ==
    ColumnBoards * 8) at construction time — one generator per TES bias entry.
  • Restores the original TES biases when the process is stopped, and no-ops with
    a warning if every generator is set to None.
  • Warns (once, via the process logger) if the requested SoftwareClock can't be
    sustained and waveform timing lags — the over-rate check called for in Feature request : Add TES bias waveform generator in software #55.
  • Status/stop/idle messages go through the process logger, not print.

Split out of #68/PR #78 so it can land independently: it's a server-side
device node with no dependency on the warm_tdm_api.operations client layer
being reworked in #78. Once merged, #78 picks it up via the next
pre-releasewtj-refactor merge and shrinks to just the operations work.

Validated in emulate mode: process registers on Group, generators sized from
config at construction (4 column boards → 32 generators), package imports,
compileall clean, waveform math checked.


Status: ready pending hardware testing. Code-complete and verified in emulate (construction-time sizing, input guards, paced loop, waveform math). The remaining gate is on the analog bench: confirm waveforms play correctly on real TES bias lines and measure the achievable UpdateRate (the host->board round-trip ceiling — issue #55).


Hardware verification procedure: https://github.com/slaclab/warm-tdm/wiki/HW-Verify-Issue-55-TES-Bias-Waveform-Generator (wiki → step-by-step bench steps + pass criteria; the analog-bench pass is this PR's remaining gate).

Adds TesBiasWaveformProcess (a pr.Process node) plus the tesBiasWaveformGenerator
device, which play software-clocked sine/square/constant waveforms on the TES
bias lines for testing and characterization. Registered on Group alongside the
other tuning/diagnostic processes; exported from warm_tdm_api.

Generator count is sized dynamically to the group's TesBias length. Uses the
process logger (not print) for status/stop/idle messages.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new server-side pyrogue.pr.Process (TesBiasWaveformProcess) and per-bias generator device to produce software-clocked TES bias waveforms (sine/square/constant) for testing/characterization, and wires it into the Group device tree and warm_tdm_api exports.

Changes:

  • Introduces _TesBiasWaveform.py implementing the waveform generator devices and the process loop that updates Group.TesBias.
  • Registers TesBiasWaveformProcess under Group alongside existing tuning/diagnostic processes.
  • Exports the new process/device via warm_tdm_api/__init__.py.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
software/python/warm_tdm_api/_TesBiasWaveform.py New TES bias waveform generator device + pr.Process implementation and software-timed update loop.
software/python/warm_tdm_api/_Group.py Adds TesBiasWaveformProcess to the Group’s tuning/diagnostic process list.
software/python/warm_tdm_api/init.py Re-exports the new module’s symbols from the package.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread software/python/warm_tdm_api/_TesBiasWaveform.py Outdated
Comment thread software/python/warm_tdm_api/_TesBiasWaveform.py Outdated
Comment thread software/python/warm_tdm_api/_TesBiasWaveform.py Outdated
Comment thread software/python/warm_tdm_api/_TesBiasWaveform.py
bengineerd and others added 4 commits August 13, 2026 09:58
Rework the TES bias waveform generator per PR #79 review:

- Size the generator list once at construction from `config.numColumns`
  (== ColumnBoards*8) instead of from `self.parent` in __init__. The parent
  isn't attached during __init__ (so the old call always hit the fallback of
  8), and the previous design otherwise mutated the device tree at run time via
  self.add() inside the process function, which would desync connected clients.
  TesBiasWaveformProcess now takes config= like the sibling processes.
- Add an over-rate latency warning: warn once (via the process logger) if the
  requested SoftwareClock can't be sustained and waveform timing lags (#55).
- Fix Mode enum ordering to 0:None, 1:Sine, 2:Square (was 1:Square, 2:Sine).
- PascalCase the sub-device: tesBiasWaveformGenerator -> TesBiasWaveformGenerator.
- Rename wfstep -> wfsquare for consistency with the 'Square' mode.

Verified in emulate: 4 column boards -> 32 generators created at construction,
enum order correct, package imports, compileall clean, waveform math checked.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Raise ValueError if SoftwareClock <= 0 before using it as a divisor
  (dt = 1/clk_hz), instead of a ZeroDivisionError / undefined behavior.
- Replace the 10 us busy-poll (`while t-t0 < step_t: sleep(10us)`) with a
  single sleep of the remaining time until the next tick, so a high
  SoftwareClock no longer spins the server CPU.

Verified: clk<=0 raises; loop paces and stops cleanly, restoring biases.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
"SoftwareClock" described the implementation, not the quantity, and invited
confusion with a hardware timebase / with per-line waveform Frequency. Rename to
UpdateRate (Hz) — the rate at which the host recomputes and writes the TES bias
vector (the waveform sample rate).

Expand the description: it's best-effort and host-limited (real ceiling is the
host->board TesBias.set() round-trip), must stay well above the highest per-line
Frequency, and the bench-achievable value is still TBD (issue #55) — start
~10-100 Hz until characterized.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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