examples: Speed up voltage_acq_clk_plot_wfm.py and handle multiple channels correctly#940
Open
examples: Speed up voltage_acq_clk_plot_wfm.py and handle multiple channels correctly#940
Conversation
…tiple channels correctly
Collaborator
Author
Contributor
Collaborator
Author
Collaborator
Author
|
Example of calculated time_offset: Note that it currently calculates time_offset=0.0 for high AI Convert Clock rates. There is already an internal bug for this, but I also filed #941 for visibility. |
Collaborator
Author
|
I ran PowerShell diff --git a/examples/analog_in/voltage_acq_int_clk_plot_wfm.py b/examples/analog_in/voltage_acq_int_clk_plot_wfm.py
index bf59a795..9ff8dd90 100644
--- a/examples/analog_in/voltage_acq_int_clk_plot_wfm.py
+++ b/examples/analog_in/voltage_acq_int_clk_plot_wfm.py
@@ -29,7 +29,7 @@ def plot_analog_waveform(
with nidaqmx.Task() as task:
task.ai_channels.add_ai_voltage_chan("Dev1/ai0")
- task.timing.cfg_samp_clk_timing(1000.0, sample_mode=AcquisitionType.FINITE, samps_per_chan=50)
+ task.timing.cfg_samp_clk_timing(1e6, sample_mode=AcquisitionType.FINITE, samps_per_chan=100_000)
waveforms = task.read_waveform(READ_ALL_AVAILABLE)
if not isinstance(waveforms, list):
@@ -44,4 +44,4 @@ with nidaqmx.Task() as task:
plot.legend()
plot.grid(True)
- plot.show()
+ plot.show(block=False)This is about the same as |
…ve enough type hints for them to work
zhindes
approved these changes
Mar 13, 2026
bkeryan
commented
Mar 13, 2026
Collaborator
Author
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.




I've added tests applicable for this pull requestWhat does this Pull Request accomplish?
Speed up
voltage_acq_clk_plot_wfm.pyby calculating the time data usingnp.linspaceinstead ofwaveform.timing.get_timestamps().get_timestamps()currently creates a list of datetime objects, which is very slow for large sample counts.Update
voltage_acq_clk_plot_wfm.pyto support multiple channels correctly:Why should this Pull Request be merged?
Closes #936
Demonstrates how to plot multiple waveforms.
What testing has been done?
Manual testing
Measured performance using PowerShell
Measure-Command