Skip to content

fix(afg): explicitly disable burst state when generating continuous waveforms - #630

Open
harshitj183 wants to merge 1 commit into
tektronix:mainfrom
harshitj183:fix/disable-burst-in-generate-function
Open

harshitj183 wants to merge 1 commit into
tektronix:mainfrom
harshitj183:fix/disable-burst-in-generate-function

Conversation

@harshitj183

Copy link
Copy Markdown

Proposed changes

When generate_function() is called on an AFG instrument, it configures channel properties via set_function_properties(burst_count=0). Previously, set_function_properties() only handled burst_count > 0 by invoking setup_burst_waveform(), leaving BURST:STATE enabled if the instrument had previously been placed in burst mode (e.g., via setup_burst()).

This change explicitly sets BURST:STATE to 0 prior to configuring waveform frequency/offset/function/amplitude when burst_count == 0. In addition to disabling residual burst state, calling set_burst_state(0) before updating frequency parameters prevents data-out-of-range validation errors that can occur when frequency values are validated against active burst constraints on physical instruments.

Addresses #440

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Functionality update (non-breaking change which updates or changes existing functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • CI/CD update (an update to the CI/CD workflows, scripts, and/or configurations)
  • Documentation update (an update to enhance the user experience when reading through the docs)

Checklist

  • I have followed the guidelines in the CONTRIBUTING document
  • I have signed the CLA
  • I have checked to ensure there are no other open Pull Requests for the same update/change
  • I have created (or updated) an Issue to track the status of this update/change and updated the link in this PR description (see above in the Proposed changes section) using the wording Addresses #440
  • I have performed a self-review of my code
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • Basic linting passes locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have added necessary documentation (if appropriate)
  • I have updated the Changelog with a brief description of my changes

…aveforms

When generate_function() is called on an AFG instrument, it configures channel properties via set_function_properties(burst_count=0). Previously, set_function_properties() only handled burst_count > 0 by invoking setup_burst_waveform(), leaving BURST:STATE enabled if the instrument had previously been placed in burst mode (e.g., via setup_burst()).

This commit explicitly sets BURST:STATE to 0 prior to configuring waveform frequency/offset/function/amplitude when burst_count == 0. Disabling burst state before updating frequency parameters also prevents data-out-of-range validation errors that can occur when frequency values are validated against active burst constraints on physical instruments.

Regression tests added in test_generate_waveform.py:
- Verifies generate_function() disables burst state on all channels and initiates phase sync
- Verifies BURST:STATE is explicitly 0 after calling setup_burst() followed by generate_function()

Closes tektronix#440

Signed-off-by: Harshit Jaiswal <[email protected]>
@nfelt14

nfelt14 commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

@michaelwagoner, can you take a look at this?

@codecov

codecov Bot commented Sep 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (d55e839) to head (f8b008c).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #630   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          166       166           
  Lines         4866      4868    +2     
  Branches       437       438    +1     
=========================================
+ Hits          4866      4868    +2     

☔ 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.

@github-actions

github-actions Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Test Results (ubuntu)

path passed subtotal
tests/test_abstract_device_expect_esr.py 1 1
tests/test_afgs.py 2 2
tests/test_alias_dict.py 1 1
tests/test_all_device_drivers.py 112 112
tests/test_alternative_connection_addresses.py 19 19
tests/test_awgs.py 4 4
tests/test_config_parser.py 50 50
tests/test_device_manager.py 18 18
tests/test_devices_legacy_tsp_ieee_cmds.py 3 3
tests/test_extension_mixin.py 1 1
tests/test_generate_waveform.py 6 6
tests/test_helpers.py 94 94
tests/test_ieee_scpi_cmds.py 1 1
tests/test_logging.py 5 5
tests/test_mainframe.py 13 13
tests/test_margin_testers.py 5 5
tests/test_pi_device.py 1 1
tests/test_psu.py 1 1
tests/test_rest_api_device.py 10 10
tests/test_schema.py 7 7
tests/test_scopes.py 10 10
tests/test_singleton.py 1 1
tests/test_smu.py 4 4
tests/test_ss.py 1 1
tests/test_tm_devices.py 471 471
tests/test_unsupported_device_type.py 1 1
tests/test_verification_functions.py 13 13
TOTAL 855 855

Link to workflow run

@github-actions

github-actions Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Test Results (windows)

path passed subtotal
tests\test_abstract_device_expect_esr.py 1 1
tests\test_afgs.py 2 2
tests\test_alias_dict.py 1 1
tests\test_all_device_drivers.py 112 112
tests\test_alternative_connection_addresses.py 19 19
tests\test_awgs.py 4 4
tests\test_config_parser.py 50 50
tests\test_device_manager.py 18 18
tests\test_devices_legacy_tsp_ieee_cmds.py 3 3
tests\test_extension_mixin.py 1 1
tests\test_generate_waveform.py 6 6
tests\test_helpers.py 94 94
tests\test_ieee_scpi_cmds.py 1 1
tests\test_logging.py 5 5
tests\test_mainframe.py 13 13
tests\test_margin_testers.py 5 5
tests\test_pi_device.py 1 1
tests\test_psu.py 1 1
tests\test_rest_api_device.py 10 10
tests\test_schema.py 7 7
tests\test_scopes.py 10 10
tests\test_singleton.py 1 1
tests\test_smu.py 4 4
tests\test_ss.py 1 1
tests\test_tm_devices.py 471 471
tests\test_unsupported_device_type.py 1 1
tests\test_verification_functions.py 13 13
TOTAL 855 855

Link to workflow run

@github-actions

github-actions Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Test Results (macos)

path passed subtotal
tests/test_abstract_device_expect_esr.py 1 1
tests/test_afgs.py 2 2
tests/test_alias_dict.py 1 1
tests/test_all_device_drivers.py 112 112
tests/test_alternative_connection_addresses.py 19 19
tests/test_awgs.py 4 4
tests/test_config_parser.py 50 50
tests/test_device_manager.py 18 18
tests/test_devices_legacy_tsp_ieee_cmds.py 3 3
tests/test_extension_mixin.py 1 1
tests/test_generate_waveform.py 6 6
tests/test_helpers.py 94 94
tests/test_ieee_scpi_cmds.py 1 1
tests/test_logging.py 5 5
tests/test_mainframe.py 13 13
tests/test_margin_testers.py 5 5
tests/test_pi_device.py 1 1
tests/test_psu.py 1 1
tests/test_rest_api_device.py 10 10
tests/test_schema.py 7 7
tests/test_scopes.py 10 10
tests/test_singleton.py 1 1
tests/test_smu.py 4 4
tests/test_ss.py 1 1
tests/test_tm_devices.py 471 471
tests/test_unsupported_device_type.py 1 1
tests/test_verification_functions.py 13 13
TOTAL 855 855

Link to workflow run

# if termination is MAXIMUM or MINIMUM or INFINITY
self._afg.set_if_needed(f"OUTPUT{self.num}:IMPEDANCE", termination)
if burst_count == 0:
self.set_burst_state(0)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It would be nice to keep the burst handling in one spot and move the "if burst count > 0..." from the bottom of the function to an elif under this.

Also looking at the AFG manual, I believe the only thing burst mode constrains is the available functions (DC/Noise are unavailable in burst mode) but where it's being set here is fine.

@nfelt14

nfelt14 commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

@harshitj183, are you going to make the changes necessary to get this ready for merge?

This branch was previously deployed

1 inactive deployment
package-build — f8b008c8 Deployed Sep 11, 2026 by harshitj183 via package-build / Build package #1927
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.

3 participants