1.7 KiB
1.7 KiB
ADC YOFF Sign Bug — sras_viewer.py
Status
Fix applied, awaiting user testing.
What was wrong
DC_YOFF_ADC in sras_viewer.py was +87.04 instead of -87.04.
The Tektronix scope stores CH3/CH4 waveform data as signed int8 (−128 to +127), where ADC 0 = screen center. The scope's vertical position for CH3/CH4 is set to −2.72 div in sc3_aui_app.py, which places 0 V below center at ADC count −2.72 × 32 = −87.04. The comment in the code had the formula as -position × (256/8) (sign flipped), producing +87.04 instead of the correct −87.04.
Effect of the bug
adc_to_mvwas off by 272 mV in the negative direction- ADC −87 (true 0 V signal) → −272 mV (should be ≈ 0 mV)
- ADC 0 (screen center, above ground) → −136 mV (should be +136 mV)
- DC images for CH3/CH4 (Bias A/B) showed large negative voltages, physically impossible for DC bias signals
- RF mask threshold (
mv_to_adc) was also broken: threshold ADC value ~+87 was being compared against pixel means clustered around −87, so nearly every pixel would have been incorrectly masked
The fix
sras_viewer.py line 48:
# Before
DC_YOFF_ADC = 87.04 # ADC count that represents 0 V
# After
DC_YOFF_ADC = -87.04 # ADC count that represents 0 V
Comment on line 47 also corrected from -position × (256/8) to position × (256/8).
What to verify during testing
- CH3 and CH4 DC images show positive (or near-zero) voltages consistent with the bias signal levels
- RF (CH1) image is not excessively masked — pixels with a genuine bias signal above the threshold should appear
mv_to_adc(0.0)should now return −87.04 (not +87.04)- The default threshold of 0.125 mV should correspond to ADC ≈ −87.0, not +87.1