From 4eb862408081a48bf127a0eb251266592c1cf9c2 Mon Sep 17 00:00:00 2001 From: NI-velmurugan Date: Wed, 7 Oct 2026 19:45:14 +0530 Subject: [PATCH 01/12] Add @Avinash2Suresh as a code owner --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 17a4e6de4d..dac883d426 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @marcoskirsch @ni-jfitzger @vnktshr21 +* @marcoskirsch @ni-jfitzger @vnktshr21 @Avinash2Suresh From 8305ba26e923b280a766b480f52f77b1170c6fcd Mon Sep 17 00:00:00 2001 From: Divakar Date: Thu, 8 Oct 2026 16:17:45 +0530 Subject: [PATCH 02/12] Remove @Avinash2Suresh from CODEOWNERS --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index dac883d426..17a4e6de4d 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @marcoskirsch @ni-jfitzger @vnktshr21 @Avinash2Suresh +* @marcoskirsch @ni-jfitzger @vnktshr21 From a8a0743acc2654871aca028aa395b5ca5fb96657 Mon Sep 17 00:00:00 2001 From: "Selvam, Divakar" Date: Sun, 1 Nov 2026 00:34:33 +0530 Subject: [PATCH 03/12] add: Add Initial Version of the Example --- CHANGELOG.md | 1 + docs/nidigital/examples.rst | 9 ++ .../CaptureWaveform.digicapture | Bin 0 -> 798 bytes .../examples/capture_waveform/Pattern.digipat | Bin 0 -> 4336 bytes .../capture_waveform/PinLevels.digilevels | 15 +++ .../examples/capture_waveform/PinMap.pinmap | 69 ++++++++++ .../capture_waveform/Specifications.specs | 9 ++ .../capture_waveform/Timing.digitiming | 23 ++++ .../capture_waveform.digiproj | 39 ++++++ .../nidigital_capture_waveform.py | 126 ++++++++++++++++++ 10 files changed, 291 insertions(+) create mode 100644 src/nidigital/examples/capture_waveform/CaptureWaveform.digicapture create mode 100644 src/nidigital/examples/capture_waveform/Pattern.digipat create mode 100644 src/nidigital/examples/capture_waveform/PinLevels.digilevels create mode 100644 src/nidigital/examples/capture_waveform/PinMap.pinmap create mode 100644 src/nidigital/examples/capture_waveform/Specifications.specs create mode 100644 src/nidigital/examples/capture_waveform/Timing.digitiming create mode 100644 src/nidigital/examples/capture_waveform/capture_waveform.digiproj create mode 100644 src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bc3af6804..8b527c8756 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -558,6 +558,7 @@ #### [nidigital] Unreleased - Added - (Common) Added `nitlsconfig[grpc]>=1.0.0a2` to the optional gRPC dependencies. + - Added the `nidigital_capture_waveform.py` example. - Changed - Removed diff --git a/docs/nidigital/examples.rst b/docs/nidigital/examples.rst index b8c8cc689a..fb1b863632 100644 --- a/docs/nidigital/examples.rst +++ b/docs/nidigital/examples.rst @@ -12,6 +12,15 @@ nidigital_burst_with_start_trigger.py :encoding: utf8 :caption: `(nidigital_burst_with_start_trigger.py) `_ +nidigital_capture_waveform.py +----------------------------- + +.. literalinclude:: ../../src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py + :language: python + :linenos: + :encoding: utf8 + :caption: `(nidigital_capture_waveform.py) `_ + nidigital_configure_time_set_and_voltage_levels.py -------------------------------------------------- diff --git a/src/nidigital/examples/capture_waveform/CaptureWaveform.digicapture b/src/nidigital/examples/capture_waveform/CaptureWaveform.digicapture new file mode 100644 index 0000000000000000000000000000000000000000..35e83dc457b423f31d960ee1e768f234e641a27f GIT binary patch literal 798 zcmbtSO-sZu5RLea2SGuvz3pv3F5a!hrNXX-F7B~}?dV3Dwxp^1^Yu-)fq0Oz_+WU+ zO#0rWnN^hPGa-b!5#kffaD0R{$K)G0!GfcdngZ}O;z`!FHMEvr^j;Z#g;Y+>#;Dq= zs^n9QQ-oEv=sx2F`^naBD--Y*Sb1GM>{G%qcfe+oQAxXO*L#h)CocVA>MPEBMaKh* zw>Z9xvq*iYMA|G-Wo$_|0n(QU?B}Lx>zQxyhyug$VHTmXuO_GNcN{}yk%s>ezk`C; ze=2od&|2kodyWcs=8L~z&u~1@`8|$$;_m4eRo*@C1wJ=2oBIQw75lbgdU)A5UB#; zanjkq7^UM=^thy&H61ogn8f%Oa+K7Brk+m60Q>|kvzq7vev(ui?|1ExC%D5qez@M@ zGFBUl4a>l_bDQl5?y+;4CM+o3B&svPTB5NMOxm}RFt$eE*fsJL10;fbnB1U0XTms) zT2U#9Xf0v2t|oQ3t~3(_H2IVwB!md! zwTq-3TScFkMJhJ_bs8>^V#;ngL<2p%VYn5CX0d5>7_SugRd+$7JSGSagQP{j5=LrH znJg<>VPk?Yc7BJkqW_Wha1QH{puT1bPZ;~6AYnx&MbZjtDl_6nOVTcg7j62>Q6tfr zg0;+^1YzqOY0+m}xy1^-02@$pE(iuT_p@PKHY&=J`|tEJL=eU!3g)2o`ACU09^CDaT7{Gfn1Un&qzUV9ESN z)*#O;q?Y@M#tEMPl@Wj=1yM#}pr_v=y+eu$94DQeuTZK-E!?;8z`{cdV-_A+cx++Z z-4@@-4&;S}lyA1U33E2^PjI`V^btYiV33qDX0HnU^b=`L(qaXB8^fJqLf2M9qiUw5 zm96Fd6I&oNi7q9r*kC8&>f;)_N53J0y@}!YEjK?X)tIQ$z2YX`ax*3MB?wErvp8OP z-T9CkiYC(NEsH%F-MIWV9JWmj0hDo=#P|@EegD2d2bEtaFLbf@g+n3FA*q+UHw5Js + + + + + 0 + 3.3 + 0.8 + 2 + 0 + HighZ + + + + \ No newline at end of file diff --git a/src/nidigital/examples/capture_waveform/PinMap.pinmap b/src/nidigital/examples/capture_waveform/PinMap.pinmap new file mode 100644 index 0000000000..e34e3f5408 --- /dev/null +++ b/src/nidigital/examples/capture_waveform/PinMap.pinmap @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/nidigital/examples/capture_waveform/Specifications.specs b/src/nidigital/examples/capture_waveform/Specifications.specs new file mode 100644 index 0000000000..51ba58bb5a --- /dev/null +++ b/src/nidigital/examples/capture_waveform/Specifications.specs @@ -0,0 +1,9 @@ + + +
+ + 1 µs + +
+ +
\ No newline at end of file diff --git a/src/nidigital/examples/capture_waveform/Timing.digitiming b/src/nidigital/examples/capture_waveform/Timing.digitiming new file mode 100644 index 0000000000..d020f8c7bb --- /dev/null +++ b/src/nidigital/examples/capture_waveform/Timing.digitiming @@ -0,0 +1,23 @@ + + + + + + timing.period + + + + 0 µs + timing.period / 2 + timing.period + + + (3 * timing.period) / 4 + + Pattern + + + + + + \ No newline at end of file diff --git a/src/nidigital/examples/capture_waveform/capture_waveform.digiproj b/src/nidigital/examples/capture_waveform/capture_waveform.digiproj new file mode 100644 index 0000000000..e71b471e51 --- /dev/null +++ b/src/nidigital/examples/capture_waveform/capture_waveform.digiproj @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py b/src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py new file mode 100644 index 0000000000..649e37f585 --- /dev/null +++ b/src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py @@ -0,0 +1,126 @@ +#!/usr/bin/python + +import argparse +import nidigital +import os +import sys + + +CAPTURE_WAVEFORM_TYPES = ('Serial', 'Parallel', 'From File: Digicapture') +WAVEFORM_NAME = 'new_waveform' + + +def example(resource_name, options, samples_to_read, pin_list, capture_waveform_type, sample_width, bit_order, waveform_file_path): + + with nidigital.Session(resource_name=resource_name, reset_device=True, options=options) as session: + + directory = os.path.dirname(os.path.abspath(__file__)) + + # Load the pin map (.pinmap) created using the Digital Pattern Editor + pin_map_filename = os.path.join(directory, 'PinMap.pinmap') + session.load_pin_map(pin_map_filename) + + # Load the specifications (.specs), levels (.digilevels), and timing (.digitiming) sheets created using the Digital Pattern Editor + spec_filename = os.path.join(directory, 'Specifications.specs') + levels_filename = os.path.join(directory, 'PinLevels.digilevels') + timing_filename = os.path.join(directory, 'Timing.digitiming') + session.load_specifications_levels_and_timing(spec_filename, levels_filename, timing_filename) + + # Apply the settings from the levels and timing sheets we just loaded to the session + session.apply_levels_and_timing(levels_filename, timing_filename) + + # Load the pattern file (.digipat) created using the Digital Pattern Editor + pattern_filename = os.path.join(directory, 'Pattern.digipat') + session.load_pattern(pattern_filename) + + try: + if capture_waveform_type == 'Serial': + # Configure the capture waveform for serial acquisition + session.pins[pin_list].create_capture_waveform_serial( + waveform_name=WAVEFORM_NAME, + sample_width=sample_width, + bit_order=bit_order) + elif capture_waveform_type == 'Parallel': + # Configure the capture waveform for parallel acquisition + session.pins[pin_list].create_capture_waveform_parallel(waveform_name=WAVEFORM_NAME) + else: + # Load the capture waveform configuration from the Digicapture file + capture_file_path = os.path.abspath(os.path.join(directory, waveform_file_path)) + session.create_capture_waveform_from_file_digicapture( + waveform_name=WAVEFORM_NAME, + waveform_file_path=capture_file_path) + + # Burst the pattern from the start label specified in the pattern file + print('Start bursting pattern') + session.burst_pattern(start_label='new_pattern') + + # Fetch the captured waveform data from instrument memory + waveforms = session.fetch_capture_waveform( + waveform_name=WAVEFORM_NAME, + samples_to_read=samples_to_read) + captured_waveforms = {site: list(data) for site, data in waveforms.items()} + print('Captured data:') + for site, samples in sorted(captured_waveforms.items()): + print('Site {} ({} samples): {}'.format(site, len(samples), samples)) + finally: + # Disconnect the selected pins using programmable onboard switching + session.pins[pin_list].selected_function = nidigital.SelectedFunction.DISCONNECT + + print('Done capturing waveform') + return captured_waveforms + + +def _main(argsv): + parser = argparse.ArgumentParser(description='Demonstrates how to configure a capture waveform and capture data on the digital pattern instrument.', formatter_class=argparse.ArgumentDefaultsHelpFormatter) + parser.add_argument('-n', '--resource-name', default='PXI1Slot2,PXI1Slot3', help='The specified resource name shown in Measurement & Automation Explorer (MAX) for a digital pattern instrument, for example, PXI1Slot3, where PXI1Slot3 is an instrument resource name.') + parser.add_argument('-s', '--simulate', default='True', choices=['True', 'False'], help='Whether to run on simulated hardware or real hardware') + parser.add_argument('-r', '--samples-to-read', default=4, type=int, help='Number of samples to fetch.') + parser.add_argument('-p', '--pin-list', default='DUTPin1', help='List of pins to capture.') + parser.add_argument('-t', '--capture-waveform-type', default='Serial', type=str.title, choices=CAPTURE_WAVEFORM_TYPES, help='Selects the capture waveform configuration to use.') + parser.add_argument('-sw', '--sample-width', default=32, type=int, help='Width in bits of each serial sample. Valid values are between 1 and 32.') + parser.add_argument('-bo', '--bit-order', default='MSB', type=str.upper, choices=nidigital.BitOrder.__members__, help='Order in which to shift the bits.') + parser.add_argument('-wf', '--waveform-file', default='CaptureWaveform.digicapture', help='Absolute file path to the capture waveform file (.digicapture) you want to load.') + args = parser.parse_args(argsv) + + example(args.resource_name, + 'Simulate=1, DriverSetup=Model:6570' if args.simulate == 'True' else '', + args.samples_to_read, args.pin_list, args.capture_waveform_type, + args.sample_width, nidigital.BitOrder[args.bit_order], args.waveform_file) + + +def main(): + _main(sys.argv[1:]) + + +def test_main(): + _main([]) + _main(['--capture-waveform-type', 'Parallel']) + _main(['--capture-waveform-type', 'From File: Digicapture']) + _main(['--samples-to-read', '2', '--sample-width', '8', '--bit-order', 'LSB']) + + +def test_example(): + resource_name = 'PXI1Slot2,PXI1Slot3' + options = {'simulate': True, 'driver_setup': {'Model': '6570'}} + samples_to_read = 4 + pin_list = 'DUTPin1' + sample_width = 32 + bit_order = nidigital.BitOrder.MSB + waveform_file_path = 'CaptureWaveform.digicapture' + + for capture_waveform_type in CAPTURE_WAVEFORM_TYPES: + captured_waveforms = example( + resource_name, options, samples_to_read, pin_list, + capture_waveform_type, sample_width, bit_order, waveform_file_path) + assert sorted(captured_waveforms) == [0, 1, 2, 3] + assert all(len(samples) == samples_to_read for samples in captured_waveforms.values()) + + captured_waveforms = example( + resource_name, options, 2, pin_list, 'Serial', 8, + nidigital.BitOrder.LSB, waveform_file_path) + assert sorted(captured_waveforms) == [0, 1, 2, 3] + assert all(len(samples) == 2 for samples in captured_waveforms.values()) + + +if __name__ == '__main__': + main() From 2b839f3dd5c742d8279898edd8bcd5f761a348d9 Mon Sep 17 00:00:00 2001 From: "Selvam, Divakar" Date: Mon, 2 Nov 2026 18:09:10 +0530 Subject: [PATCH 04/12] nit: simplify tests --- .../nidigital_capture_waveform.py | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py b/src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py index 649e37f585..b6f3212ae9 100644 --- a/src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py +++ b/src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py @@ -43,12 +43,14 @@ def example(resource_name, options, samples_to_read, pin_list, capture_waveform_ elif capture_waveform_type == 'Parallel': # Configure the capture waveform for parallel acquisition session.pins[pin_list].create_capture_waveform_parallel(waveform_name=WAVEFORM_NAME) - else: + elif capture_waveform_type == 'From File: Digicapture': # Load the capture waveform configuration from the Digicapture file capture_file_path = os.path.abspath(os.path.join(directory, waveform_file_path)) session.create_capture_waveform_from_file_digicapture( waveform_name=WAVEFORM_NAME, waveform_file_path=capture_file_path) + else: + raise ValueError('Unsupported capture waveform type: {}'.format(capture_waveform_type)) # Burst the pattern from the start label specified in the pattern file print('Start bursting pattern') @@ -96,7 +98,7 @@ def test_main(): _main([]) _main(['--capture-waveform-type', 'Parallel']) _main(['--capture-waveform-type', 'From File: Digicapture']) - _main(['--samples-to-read', '2', '--sample-width', '8', '--bit-order', 'LSB']) + _main(['--sample-width', '8', '--bit-order', 'LSB']) def test_example(): @@ -108,18 +110,14 @@ def test_example(): bit_order = nidigital.BitOrder.MSB waveform_file_path = 'CaptureWaveform.digicapture' - for capture_waveform_type in CAPTURE_WAVEFORM_TYPES: - captured_waveforms = example( - resource_name, options, samples_to_read, pin_list, - capture_waveform_type, sample_width, bit_order, waveform_file_path) - assert sorted(captured_waveforms) == [0, 1, 2, 3] - assert all(len(samples) == samples_to_read for samples in captured_waveforms.values()) - - captured_waveforms = example( - resource_name, options, 2, pin_list, 'Serial', 8, - nidigital.BitOrder.LSB, waveform_file_path) - assert sorted(captured_waveforms) == [0, 1, 2, 3] - assert all(len(samples) == 2 for samples in captured_waveforms.values()) + example(resource_name, options, samples_to_read, pin_list, 'Serial', + sample_width, bit_order, waveform_file_path) + example(resource_name, options, samples_to_read, pin_list, 'Parallel', + sample_width, bit_order, waveform_file_path) + example(resource_name, options, samples_to_read, pin_list, 'From File: Digicapture', + sample_width, bit_order, waveform_file_path) + example(resource_name, options, samples_to_read, pin_list, 'Serial', 8, + nidigital.BitOrder.LSB, waveform_file_path) if __name__ == '__main__': From ef694fb3a7f8c6b01f5b965d0151ada93da7839c Mon Sep 17 00:00:00 2001 From: "Selvam, Divakar" Date: Mon, 2 Nov 2026 21:07:50 +0530 Subject: [PATCH 05/12] nit: fix formatting --- .../capture_waveform/nidigital_capture_waveform.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py b/src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py index b6f3212ae9..f96718b7bf 100644 --- a/src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py +++ b/src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py @@ -69,7 +69,6 @@ def example(resource_name, options, samples_to_read, pin_list, capture_waveform_ session.pins[pin_list].selected_function = nidigital.SelectedFunction.DISCONNECT print('Done capturing waveform') - return captured_waveforms def _main(argsv): @@ -110,14 +109,10 @@ def test_example(): bit_order = nidigital.BitOrder.MSB waveform_file_path = 'CaptureWaveform.digicapture' - example(resource_name, options, samples_to_read, pin_list, 'Serial', - sample_width, bit_order, waveform_file_path) - example(resource_name, options, samples_to_read, pin_list, 'Parallel', - sample_width, bit_order, waveform_file_path) - example(resource_name, options, samples_to_read, pin_list, 'From File: Digicapture', - sample_width, bit_order, waveform_file_path) - example(resource_name, options, samples_to_read, pin_list, 'Serial', 8, - nidigital.BitOrder.LSB, waveform_file_path) + example(resource_name, options, samples_to_read, pin_list, 'Serial', sample_width, bit_order, waveform_file_path) + example(resource_name, options, samples_to_read, pin_list, 'Parallel', sample_width, bit_order, waveform_file_path) + example(resource_name, options, samples_to_read, pin_list, 'From File: Digicapture', sample_width, bit_order, waveform_file_path) + example(resource_name, options, samples_to_read, pin_list, 'Serial', 8, nidigital.BitOrder.LSB, waveform_file_path) if __name__ == '__main__': From 4da84436084f78239bf6f16707b41953531f6e1d Mon Sep 17 00:00:00 2001 From: "Selvam, Divakar" Date: Tue, 3 Nov 2026 12:24:23 +0530 Subject: [PATCH 06/12] nit: fix formatting --- .../capture_waveform/nidigital_capture_waveform.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py b/src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py index f96718b7bf..fb14aae428 100644 --- a/src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py +++ b/src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py @@ -36,19 +36,14 @@ def example(resource_name, options, samples_to_read, pin_list, capture_waveform_ try: if capture_waveform_type == 'Serial': # Configure the capture waveform for serial acquisition - session.pins[pin_list].create_capture_waveform_serial( - waveform_name=WAVEFORM_NAME, - sample_width=sample_width, - bit_order=bit_order) + session.pins[pin_list].create_capture_waveform_serial(waveform_name=WAVEFORM_NAME, sample_width=sample_width, bit_order=bit_order) elif capture_waveform_type == 'Parallel': # Configure the capture waveform for parallel acquisition session.pins[pin_list].create_capture_waveform_parallel(waveform_name=WAVEFORM_NAME) elif capture_waveform_type == 'From File: Digicapture': # Load the capture waveform configuration from the Digicapture file capture_file_path = os.path.abspath(os.path.join(directory, waveform_file_path)) - session.create_capture_waveform_from_file_digicapture( - waveform_name=WAVEFORM_NAME, - waveform_file_path=capture_file_path) + session.create_capture_waveform_from_file_digicapture(waveform_name=WAVEFORM_NAME, waveform_file_path=capture_file_path) else: raise ValueError('Unsupported capture waveform type: {}'.format(capture_waveform_type)) @@ -57,9 +52,7 @@ def example(resource_name, options, samples_to_read, pin_list, capture_waveform_ session.burst_pattern(start_label='new_pattern') # Fetch the captured waveform data from instrument memory - waveforms = session.fetch_capture_waveform( - waveform_name=WAVEFORM_NAME, - samples_to_read=samples_to_read) + waveforms = session.fetch_capture_waveform(waveform_name=WAVEFORM_NAME, samples_to_read=samples_to_read) captured_waveforms = {site: list(data) for site, data in waveforms.items()} print('Captured data:') for site, samples in sorted(captured_waveforms.items()): From da15ec22ea7c5afb1d37b7929d15490cb536c607 Mon Sep 17 00:00:00 2001 From: "Selvam, Divakar" Date: Wed, 4 Nov 2026 18:48:18 +0530 Subject: [PATCH 07/12] removing self explainatory comments Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../capture_waveform/nidigital_capture_waveform.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py b/src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py index fb14aae428..fdef7aab45 100644 --- a/src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py +++ b/src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py @@ -16,49 +16,39 @@ def example(resource_name, options, samples_to_read, pin_list, capture_waveform_ directory = os.path.dirname(os.path.abspath(__file__)) - # Load the pin map (.pinmap) created using the Digital Pattern Editor pin_map_filename = os.path.join(directory, 'PinMap.pinmap') session.load_pin_map(pin_map_filename) - # Load the specifications (.specs), levels (.digilevels), and timing (.digitiming) sheets created using the Digital Pattern Editor spec_filename = os.path.join(directory, 'Specifications.specs') levels_filename = os.path.join(directory, 'PinLevels.digilevels') timing_filename = os.path.join(directory, 'Timing.digitiming') session.load_specifications_levels_and_timing(spec_filename, levels_filename, timing_filename) - # Apply the settings from the levels and timing sheets we just loaded to the session session.apply_levels_and_timing(levels_filename, timing_filename) - # Load the pattern file (.digipat) created using the Digital Pattern Editor pattern_filename = os.path.join(directory, 'Pattern.digipat') session.load_pattern(pattern_filename) try: if capture_waveform_type == 'Serial': - # Configure the capture waveform for serial acquisition session.pins[pin_list].create_capture_waveform_serial(waveform_name=WAVEFORM_NAME, sample_width=sample_width, bit_order=bit_order) elif capture_waveform_type == 'Parallel': - # Configure the capture waveform for parallel acquisition session.pins[pin_list].create_capture_waveform_parallel(waveform_name=WAVEFORM_NAME) elif capture_waveform_type == 'From File: Digicapture': - # Load the capture waveform configuration from the Digicapture file capture_file_path = os.path.abspath(os.path.join(directory, waveform_file_path)) session.create_capture_waveform_from_file_digicapture(waveform_name=WAVEFORM_NAME, waveform_file_path=capture_file_path) else: raise ValueError('Unsupported capture waveform type: {}'.format(capture_waveform_type)) - # Burst the pattern from the start label specified in the pattern file print('Start bursting pattern') session.burst_pattern(start_label='new_pattern') - # Fetch the captured waveform data from instrument memory waveforms = session.fetch_capture_waveform(waveform_name=WAVEFORM_NAME, samples_to_read=samples_to_read) captured_waveforms = {site: list(data) for site, data in waveforms.items()} print('Captured data:') for site, samples in sorted(captured_waveforms.items()): print('Site {} ({} samples): {}'.format(site, len(samples), samples)) finally: - # Disconnect the selected pins using programmable onboard switching session.pins[pin_list].selected_function = nidigital.SelectedFunction.DISCONNECT print('Done capturing waveform') From 327ec60260aa6b0f54b140caded98c09c7f486c2 Mon Sep 17 00:00:00 2001 From: "Selvam, Divakar" Date: Wed, 4 Nov 2026 18:51:24 +0530 Subject: [PATCH 08/12] Update resource-name argument description Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../examples/capture_waveform/nidigital_capture_waveform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py b/src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py index fdef7aab45..60f3aceba1 100644 --- a/src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py +++ b/src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py @@ -56,7 +56,7 @@ def example(resource_name, options, samples_to_read, pin_list, capture_waveform_ def _main(argsv): parser = argparse.ArgumentParser(description='Demonstrates how to configure a capture waveform and capture data on the digital pattern instrument.', formatter_class=argparse.ArgumentDefaultsHelpFormatter) - parser.add_argument('-n', '--resource-name', default='PXI1Slot2,PXI1Slot3', help='The specified resource name shown in Measurement & Automation Explorer (MAX) for a digital pattern instrument, for example, PXI1Slot3, where PXI1Slot3 is an instrument resource name.') + parser.add_argument('-n', '--resource-name', default='PXI1Slot2,PXI1Slot3', help='The specified resource name of a digital pattern instrument, for example, PXI1Slot3, where PXI1Slot3 is an instrument resource name.') parser.add_argument('-s', '--simulate', default='True', choices=['True', 'False'], help='Whether to run on simulated hardware or real hardware') parser.add_argument('-r', '--samples-to-read', default=4, type=int, help='Number of samples to fetch.') parser.add_argument('-p', '--pin-list', default='DUTPin1', help='List of pins to capture.') From 5ff15cc9e36b661b2d5a1e2b4883e79b02153f63 Mon Sep 17 00:00:00 2001 From: NI-velmurugan Date: Thu, 5 Nov 2026 15:45:42 +0000 Subject: [PATCH 09/12] Adding Source Waveform example in NI-Digital --- CHANGELOG.md | 1 + docs/nidigital/examples.rst | 9 ++ .../examples/source_waveform/Pattern.digipat | Bin 0 -> 5413 bytes .../source_waveform/PinLevels.digilevels | 15 +++ .../examples/source_waveform/PinMap.pinmap | 51 +++++++++ .../source_waveform/SourceWaveform.tdms | Bin 0 -> 1619 bytes .../source_waveform/Specifications.specs | 9 ++ .../source_waveform/Timing.digitiming | 23 ++++ .../nidigital_source_waveform.py | 100 ++++++++++++++++++ .../source_waveform/source_waveform.digiproj | 39 +++++++ 10 files changed, 247 insertions(+) create mode 100644 src/nidigital/examples/source_waveform/Pattern.digipat create mode 100644 src/nidigital/examples/source_waveform/PinLevels.digilevels create mode 100644 src/nidigital/examples/source_waveform/PinMap.pinmap create mode 100644 src/nidigital/examples/source_waveform/SourceWaveform.tdms create mode 100644 src/nidigital/examples/source_waveform/Specifications.specs create mode 100644 src/nidigital/examples/source_waveform/Timing.digitiming create mode 100644 src/nidigital/examples/source_waveform/nidigital_source_waveform.py create mode 100644 src/nidigital/examples/source_waveform/source_waveform.digiproj diff --git a/CHANGELOG.md b/CHANGELOG.md index 83d1d3267b..7fefe411b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -558,6 +558,7 @@ #### [nidigital] Unreleased - Added - (Common) Added `nitlsconfig[grpc]>=1.0.0a2` to the optional gRPC dependencies. + - Added the `nidigital_source_waveform.py` example. - Changed - Removed diff --git a/docs/nidigital/examples.rst b/docs/nidigital/examples.rst index b8c8cc689a..303dcff661 100644 --- a/docs/nidigital/examples.rst +++ b/docs/nidigital/examples.rst @@ -30,3 +30,12 @@ nidigital_ppmu_source_and_measure.py :encoding: utf8 :caption: `(nidigital_ppmu_source_and_measure.py) `_ +nidigital_source_waveform.py +---------------------------- + +.. literalinclude:: ../../src/nidigital/examples/source_waveform/nidigital_source_waveform.py + :language: python + :linenos: + :encoding: utf8 + :caption: `(nidigital_source_waveform.py) `_ + diff --git a/src/nidigital/examples/source_waveform/Pattern.digipat b/src/nidigital/examples/source_waveform/Pattern.digipat new file mode 100644 index 0000000000000000000000000000000000000000..0ee9d4fef983edd6c923bfa0c4eeb74e1a9f9bf2 GIT binary patch literal 5413 zcmcgwTXP#V6y9(x<&uWN3^Ux6;bDhPr*2vb<=zk%aGTOh?KV7-S=(}~va2<+T(@uG zjTv6~A^Zz|Ryp79IgXsz9dCj;6XjdW(sw>dM@L$>>dow>D2mLRQPd`c39isHO6@7x z3-o|ulT0hZm#OR|-fL%HrN^!wcAOb_lUsZXdy$GaJ}sJ~0)CQ_@8?e8BUvl(ezB~I z1gE^?L+BkYtsd_UN(CX$W#$n)#&ez;Y~|U&q`JFneE)%VLz0aFk)02@J}&Db!DC#n zQ3LLOCwZ7Vkf70tNsOIM@+B(~Jf`FWYH-I`lZ`SAF7c+F>bf(Jw3{B_N~lff1Q(;d z*)=|Y7VQ_TR`3|@`_!PGkL|uox_UQp*4X{KwwXNAQ)17pg<@qz1;P3Xm0J9xCK?wb zPEk20Ai?zpeT`T*gfKyLLtsp}YB5b?rmc_PqiRJ3O^(`gR58aJsz=uNy`gtBI>lYX z0c~)dAUvF#WM!|4N-< zf*^aFN-Y+$;^_yMj|NLzf7wiekn!#u8QgzNqil2*<_1R-R7u8@1Wr=7MP-7Tb`Av%bi?lf^sBM4?Bk8ny$MWHb^x-Ll+cnk_~!SJ*cqWL4A< zB4HePrIcMNUcTk#=w5MSh(~6aN=0&Q-VEs1={bzC!+kd=+@~CbiLS}4^?0mN4~yOrNCCy;L=|GfAp; z>2$5_Xu569jj7lfZ8$X`T;4H&@wBjS+4Zh-z*f zVFQPBSNMzY0H@$ literal 0 HcmV?d00001 diff --git a/src/nidigital/examples/source_waveform/PinLevels.digilevels b/src/nidigital/examples/source_waveform/PinLevels.digilevels new file mode 100644 index 0000000000..1908b117fa --- /dev/null +++ b/src/nidigital/examples/source_waveform/PinLevels.digilevels @@ -0,0 +1,15 @@ + + + + + + 0 + 3.3 + 0.8 + 2 + 0 + HighZ + + + + \ No newline at end of file diff --git a/src/nidigital/examples/source_waveform/PinMap.pinmap b/src/nidigital/examples/source_waveform/PinMap.pinmap new file mode 100644 index 0000000000..46d985a9f9 --- /dev/null +++ b/src/nidigital/examples/source_waveform/PinMap.pinmap @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/nidigital/examples/source_waveform/SourceWaveform.tdms b/src/nidigital/examples/source_waveform/SourceWaveform.tdms new file mode 100644 index 0000000000000000000000000000000000000000..4f85ffcdff1deaa6c969a39131b2c23dc77153ea GIT binary patch literal 1619 zcmeHHO-sW-5RD&IL{L!CYi_yq<6_T-C{~CTQtdG;$=VJyA8fYv>Oa>vX%^N(iQ=^b z!`sg8yf?ee%p{1iBgb**0uE#|xQ8`+?+bQ_1$!pH-QL$8soQexlM{)z>w2n!!^{*zbxRh zN!h{f1?(=lZ=Sg4*rKsxin46R#R-UfRfseZm9|wzwT9yuY*E>`$@-ZdFqnmQ!BqdzGNJ6} bRs2T8V2cRmsr_7UQdP~Y?_g)p?RWd%nF`^h literal 0 HcmV?d00001 diff --git a/src/nidigital/examples/source_waveform/Specifications.specs b/src/nidigital/examples/source_waveform/Specifications.specs new file mode 100644 index 0000000000..65c615cfd6 --- /dev/null +++ b/src/nidigital/examples/source_waveform/Specifications.specs @@ -0,0 +1,9 @@ + + +
+ + 1 µs + +
+ +
\ No newline at end of file diff --git a/src/nidigital/examples/source_waveform/Timing.digitiming b/src/nidigital/examples/source_waveform/Timing.digitiming new file mode 100644 index 0000000000..b5908eabfb --- /dev/null +++ b/src/nidigital/examples/source_waveform/Timing.digitiming @@ -0,0 +1,23 @@ + + + + + + timing.period + + + + 0 ns + timing.period / 2 + timing.period + + + (3 * timing.period) / 4 + + Pattern + + + + + + \ No newline at end of file diff --git a/src/nidigital/examples/source_waveform/nidigital_source_waveform.py b/src/nidigital/examples/source_waveform/nidigital_source_waveform.py new file mode 100644 index 0000000000..266d731ca5 --- /dev/null +++ b/src/nidigital/examples/source_waveform/nidigital_source_waveform.py @@ -0,0 +1,100 @@ +#!/usr/bin/python + +import argparse +import nidigital +import os +import sys + + +def example(resource_name, options, source_waveform_type='PARALLEL', data_mapping='BROADCAST', waveform_name='new_waveform', start_label='new_pattern', + parallel_channel_list='PinGroup1', serial_channel_list='DUTPin1', sample_width=32, bit_order='MSB', waveform_file=None, write_waveform_data=True): + + with nidigital.Session(resource_name=resource_name, options=options) as session: + + dir = os.path.join(os.path.dirname(__file__)) + if waveform_file is None: + waveform_file = os.path.join(dir, 'SourceWaveform.tdms') + + session.load_pin_map(os.path.join(dir, 'PinMap.pinmap')) + + spec_filename = os.path.join(dir, 'Specifications.specs') + levels_filename = os.path.join(dir, 'PinLevels.digilevels') + timing_filename = os.path.join(dir, 'Timing.digitiming') + session.load_specifications_levels_and_timing(spec_filename, levels_filename, timing_filename) + + session.apply_levels_and_timing(levels_filename, timing_filename) + + session.load_pattern(os.path.join(dir, 'Pattern.digipat')) + + mapping = nidigital.SourceDataMapping[data_mapping] + + # Configure the source waveform type + if source_waveform_type == 'PARALLEL': + session.pins[parallel_channel_list].create_source_waveform_parallel(waveform_name, mapping) + elif source_waveform_type == 'SERIAL': + session.pins[serial_channel_list].create_source_waveform_serial(waveform_name, mapping, sample_width, nidigital.BitOrder[bit_order]) + elif source_waveform_type == 'TDMS': + # Waveform configuration and data are read from the TDMS file + session.create_source_waveform_from_file_tdms(waveform_name, waveform_file, write_waveform_data) + + # Write the source waveform data + if source_waveform_type != 'TDMS': + # Placeholder ramp data for illustration; replace with your own waveform samples + sample_count = 2 ** min(sample_width, 8) if source_waveform_type == 'SERIAL' else 256 + samples = [i % sample_count for i in range(sample_count)] + if mapping == nidigital.SourceDataMapping.BROADCAST: + session.write_source_waveform_broadcast(waveform_name, samples) + else: + # Site-unique data is a dict of site number to samples; both sites use the same placeholder data here + session.write_source_waveform_site_unique(waveform_name, {0: samples, 1: samples}) + + print('Start bursting pattern') + session.burst_pattern(start_label=start_label) + + session.selected_function = nidigital.SelectedFunction.DISCONNECT + print('Done bursting pattern') + + +def _main(argsv): + parser = argparse.ArgumentParser(description='Demonstrates how to configure, write, and burst a source waveform using NI-Digital source memory.', formatter_class=argparse.ArgumentDefaultsHelpFormatter) + parser.add_argument('-n', '--resource-name', default='PXI1Slot2,PXI1Slot3', help='The specified resource name shown in Measurement & Automation Explorer (MAX) for a digital pattern instrument, for example, PXI1Slot3, where PXI1Slot3 is an instrument resource name.') + parser.add_argument('-s', '--simulate', default='True', choices=['True', 'False'], help='Whether to run on simulated hardware or real hardware') + parser.add_argument('-w', '--waveform-name', default='new_waveform', help='The name to assign to the waveform. Use the waveform_name with source_start opcode in your pattern.') + parser.add_argument('-l', '--start-label', default='new_pattern', help='Pattern name or exported pattern label from which to start bursting the pattern.') + parser.add_argument('-d', '--data-mapping', default='BROADCAST', choices=nidigital.SourceDataMapping.__members__.keys(), type=str.upper, help='Parameter that specifies how to map data on multiple sites.') + parser.add_argument('-t', '--source-waveform-type', default='PARALLEL', choices=['PARALLEL', 'SERIAL', 'TDMS'], type=str.upper, help='Type of source waveform to configure.') + parser.add_argument('--parallel-channel-list', default='PinGroup1', help='Pins that source data for a parallel waveform.') + parser.add_argument('--serial-channel-list', default='DUTPin1', help='Pins that source data for a serial waveform.') + parser.add_argument('--sample-width', default=32, type=int, help='Width in bits of each serial sample. Valid values are between 1 and 32.') + parser.add_argument('--bit-order', default='MSB', choices=nidigital.BitOrder.__members__.keys(), type=str.upper, help='Order in which to shift the bits.') + parser.add_argument('--waveform-file', default=None, help='Absolute file path to the load source waveform file (.tdms). Defaults to SourceWaveform.tdms next to this example.') + parser.add_argument('--write-waveform-data', default='True', choices=['True', 'False'], help='A Boolean that writes waveform data to source memory if True and the waveform data is in the file.') + args = parser.parse_args(argsv) + + example(args.resource_name, + 'Simulate=1, DriverSetup=Model:6571' if args.simulate == 'True' else '', + args.source_waveform_type, args.data_mapping, args.waveform_name, args.start_label, + args.parallel_channel_list, args.serial_channel_list, args.sample_width, args.bit_order, + args.waveform_file, args.write_waveform_data == 'True') + + +def main(): + _main(sys.argv[1:]) + + +def test_main(): + _main([]) + _main(['--source-waveform-type', 'SERIAL', '--data-mapping', 'SITE_UNIQUE']) + _main(['--source-waveform-type', 'TDMS']) + + +def test_example(): + resource_name = 'PXI1Slot2,PXI1Slot3' + options = {'simulate': True, 'driver_setup': {'Model': '6571'}, } + example(resource_name, options) + example(resource_name, options, 'SERIAL', 'SITE_UNIQUE') + example(resource_name, options, 'TDMS') + + +if __name__ == '__main__': + main() diff --git a/src/nidigital/examples/source_waveform/source_waveform.digiproj b/src/nidigital/examples/source_waveform/source_waveform.digiproj new file mode 100644 index 0000000000..971b8ff9b9 --- /dev/null +++ b/src/nidigital/examples/source_waveform/source_waveform.digiproj @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From b151b5e8b7604a4af3dfd2d50237b939146de0b8 Mon Sep 17 00:00:00 2001 From: NI-velmurugan Date: Thu, 5 Nov 2026 15:46:25 +0000 Subject: [PATCH 10/12] Revert "Adding Source Waveform example in NI-Digital" This reverts commit 5ff15cc9e36b661b2d5a1e2b4883e79b02153f63. --- CHANGELOG.md | 1 - docs/nidigital/examples.rst | 9 -- .../examples/source_waveform/Pattern.digipat | Bin 5413 -> 0 bytes .../source_waveform/PinLevels.digilevels | 15 --- .../examples/source_waveform/PinMap.pinmap | 51 --------- .../source_waveform/SourceWaveform.tdms | Bin 1619 -> 0 bytes .../source_waveform/Specifications.specs | 9 -- .../source_waveform/Timing.digitiming | 23 ---- .../nidigital_source_waveform.py | 100 ------------------ .../source_waveform/source_waveform.digiproj | 39 ------- 10 files changed, 247 deletions(-) delete mode 100644 src/nidigital/examples/source_waveform/Pattern.digipat delete mode 100644 src/nidigital/examples/source_waveform/PinLevels.digilevels delete mode 100644 src/nidigital/examples/source_waveform/PinMap.pinmap delete mode 100644 src/nidigital/examples/source_waveform/SourceWaveform.tdms delete mode 100644 src/nidigital/examples/source_waveform/Specifications.specs delete mode 100644 src/nidigital/examples/source_waveform/Timing.digitiming delete mode 100644 src/nidigital/examples/source_waveform/nidigital_source_waveform.py delete mode 100644 src/nidigital/examples/source_waveform/source_waveform.digiproj diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fefe411b8..83d1d3267b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -558,7 +558,6 @@ #### [nidigital] Unreleased - Added - (Common) Added `nitlsconfig[grpc]>=1.0.0a2` to the optional gRPC dependencies. - - Added the `nidigital_source_waveform.py` example. - Changed - Removed diff --git a/docs/nidigital/examples.rst b/docs/nidigital/examples.rst index 303dcff661..b8c8cc689a 100644 --- a/docs/nidigital/examples.rst +++ b/docs/nidigital/examples.rst @@ -30,12 +30,3 @@ nidigital_ppmu_source_and_measure.py :encoding: utf8 :caption: `(nidigital_ppmu_source_and_measure.py) `_ -nidigital_source_waveform.py ----------------------------- - -.. literalinclude:: ../../src/nidigital/examples/source_waveform/nidigital_source_waveform.py - :language: python - :linenos: - :encoding: utf8 - :caption: `(nidigital_source_waveform.py) `_ - diff --git a/src/nidigital/examples/source_waveform/Pattern.digipat b/src/nidigital/examples/source_waveform/Pattern.digipat deleted file mode 100644 index 0ee9d4fef983edd6c923bfa0c4eeb74e1a9f9bf2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5413 zcmcgwTXP#V6y9(x<&uWN3^Ux6;bDhPr*2vb<=zk%aGTOh?KV7-S=(}~va2<+T(@uG zjTv6~A^Zz|Ryp79IgXsz9dCj;6XjdW(sw>dM@L$>>dow>D2mLRQPd`c39isHO6@7x z3-o|ulT0hZm#OR|-fL%HrN^!wcAOb_lUsZXdy$GaJ}sJ~0)CQ_@8?e8BUvl(ezB~I z1gE^?L+BkYtsd_UN(CX$W#$n)#&ez;Y~|U&q`JFneE)%VLz0aFk)02@J}&Db!DC#n zQ3LLOCwZ7Vkf70tNsOIM@+B(~Jf`FWYH-I`lZ`SAF7c+F>bf(Jw3{B_N~lff1Q(;d z*)=|Y7VQ_TR`3|@`_!PGkL|uox_UQp*4X{KwwXNAQ)17pg<@qz1;P3Xm0J9xCK?wb zPEk20Ai?zpeT`T*gfKyLLtsp}YB5b?rmc_PqiRJ3O^(`gR58aJsz=uNy`gtBI>lYX z0c~)dAUvF#WM!|4N-< zf*^aFN-Y+$;^_yMj|NLzf7wiekn!#u8QgzNqil2*<_1R-R7u8@1Wr=7MP-7Tb`Av%bi?lf^sBM4?Bk8ny$MWHb^x-Ll+cnk_~!SJ*cqWL4A< zB4HePrIcMNUcTk#=w5MSh(~6aN=0&Q-VEs1={bzC!+kd=+@~CbiLS}4^?0mN4~yOrNCCy;L=|GfAp; z>2$5_Xu569jj7lfZ8$X`T;4H&@wBjS+4Zh-z*f zVFQPBSNMzY0H@$ diff --git a/src/nidigital/examples/source_waveform/PinLevels.digilevels b/src/nidigital/examples/source_waveform/PinLevels.digilevels deleted file mode 100644 index 1908b117fa..0000000000 --- a/src/nidigital/examples/source_waveform/PinLevels.digilevels +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - 0 - 3.3 - 0.8 - 2 - 0 - HighZ - - - - \ No newline at end of file diff --git a/src/nidigital/examples/source_waveform/PinMap.pinmap b/src/nidigital/examples/source_waveform/PinMap.pinmap deleted file mode 100644 index 46d985a9f9..0000000000 --- a/src/nidigital/examples/source_waveform/PinMap.pinmap +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/nidigital/examples/source_waveform/SourceWaveform.tdms b/src/nidigital/examples/source_waveform/SourceWaveform.tdms deleted file mode 100644 index 4f85ffcdff1deaa6c969a39131b2c23dc77153ea..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1619 zcmeHHO-sW-5RD&IL{L!CYi_yq<6_T-C{~CTQtdG;$=VJyA8fYv>Oa>vX%^N(iQ=^b z!`sg8yf?ee%p{1iBgb**0uE#|xQ8`+?+bQ_1$!pH-QL$8soQexlM{)z>w2n!!^{*zbxRh zN!h{f1?(=lZ=Sg4*rKsxin46R#R-UfRfseZm9|wzwT9yuY*E>`$@-ZdFqnmQ!BqdzGNJ6} bRs2T8V2cRmsr_7UQdP~Y?_g)p?RWd%nF`^h diff --git a/src/nidigital/examples/source_waveform/Specifications.specs b/src/nidigital/examples/source_waveform/Specifications.specs deleted file mode 100644 index 65c615cfd6..0000000000 --- a/src/nidigital/examples/source_waveform/Specifications.specs +++ /dev/null @@ -1,9 +0,0 @@ - - -
- - 1 µs - -
- -
\ No newline at end of file diff --git a/src/nidigital/examples/source_waveform/Timing.digitiming b/src/nidigital/examples/source_waveform/Timing.digitiming deleted file mode 100644 index b5908eabfb..0000000000 --- a/src/nidigital/examples/source_waveform/Timing.digitiming +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - timing.period - - - - 0 ns - timing.period / 2 - timing.period - - - (3 * timing.period) / 4 - - Pattern - - - - - - \ No newline at end of file diff --git a/src/nidigital/examples/source_waveform/nidigital_source_waveform.py b/src/nidigital/examples/source_waveform/nidigital_source_waveform.py deleted file mode 100644 index 266d731ca5..0000000000 --- a/src/nidigital/examples/source_waveform/nidigital_source_waveform.py +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/python - -import argparse -import nidigital -import os -import sys - - -def example(resource_name, options, source_waveform_type='PARALLEL', data_mapping='BROADCAST', waveform_name='new_waveform', start_label='new_pattern', - parallel_channel_list='PinGroup1', serial_channel_list='DUTPin1', sample_width=32, bit_order='MSB', waveform_file=None, write_waveform_data=True): - - with nidigital.Session(resource_name=resource_name, options=options) as session: - - dir = os.path.join(os.path.dirname(__file__)) - if waveform_file is None: - waveform_file = os.path.join(dir, 'SourceWaveform.tdms') - - session.load_pin_map(os.path.join(dir, 'PinMap.pinmap')) - - spec_filename = os.path.join(dir, 'Specifications.specs') - levels_filename = os.path.join(dir, 'PinLevels.digilevels') - timing_filename = os.path.join(dir, 'Timing.digitiming') - session.load_specifications_levels_and_timing(spec_filename, levels_filename, timing_filename) - - session.apply_levels_and_timing(levels_filename, timing_filename) - - session.load_pattern(os.path.join(dir, 'Pattern.digipat')) - - mapping = nidigital.SourceDataMapping[data_mapping] - - # Configure the source waveform type - if source_waveform_type == 'PARALLEL': - session.pins[parallel_channel_list].create_source_waveform_parallel(waveform_name, mapping) - elif source_waveform_type == 'SERIAL': - session.pins[serial_channel_list].create_source_waveform_serial(waveform_name, mapping, sample_width, nidigital.BitOrder[bit_order]) - elif source_waveform_type == 'TDMS': - # Waveform configuration and data are read from the TDMS file - session.create_source_waveform_from_file_tdms(waveform_name, waveform_file, write_waveform_data) - - # Write the source waveform data - if source_waveform_type != 'TDMS': - # Placeholder ramp data for illustration; replace with your own waveform samples - sample_count = 2 ** min(sample_width, 8) if source_waveform_type == 'SERIAL' else 256 - samples = [i % sample_count for i in range(sample_count)] - if mapping == nidigital.SourceDataMapping.BROADCAST: - session.write_source_waveform_broadcast(waveform_name, samples) - else: - # Site-unique data is a dict of site number to samples; both sites use the same placeholder data here - session.write_source_waveform_site_unique(waveform_name, {0: samples, 1: samples}) - - print('Start bursting pattern') - session.burst_pattern(start_label=start_label) - - session.selected_function = nidigital.SelectedFunction.DISCONNECT - print('Done bursting pattern') - - -def _main(argsv): - parser = argparse.ArgumentParser(description='Demonstrates how to configure, write, and burst a source waveform using NI-Digital source memory.', formatter_class=argparse.ArgumentDefaultsHelpFormatter) - parser.add_argument('-n', '--resource-name', default='PXI1Slot2,PXI1Slot3', help='The specified resource name shown in Measurement & Automation Explorer (MAX) for a digital pattern instrument, for example, PXI1Slot3, where PXI1Slot3 is an instrument resource name.') - parser.add_argument('-s', '--simulate', default='True', choices=['True', 'False'], help='Whether to run on simulated hardware or real hardware') - parser.add_argument('-w', '--waveform-name', default='new_waveform', help='The name to assign to the waveform. Use the waveform_name with source_start opcode in your pattern.') - parser.add_argument('-l', '--start-label', default='new_pattern', help='Pattern name or exported pattern label from which to start bursting the pattern.') - parser.add_argument('-d', '--data-mapping', default='BROADCAST', choices=nidigital.SourceDataMapping.__members__.keys(), type=str.upper, help='Parameter that specifies how to map data on multiple sites.') - parser.add_argument('-t', '--source-waveform-type', default='PARALLEL', choices=['PARALLEL', 'SERIAL', 'TDMS'], type=str.upper, help='Type of source waveform to configure.') - parser.add_argument('--parallel-channel-list', default='PinGroup1', help='Pins that source data for a parallel waveform.') - parser.add_argument('--serial-channel-list', default='DUTPin1', help='Pins that source data for a serial waveform.') - parser.add_argument('--sample-width', default=32, type=int, help='Width in bits of each serial sample. Valid values are between 1 and 32.') - parser.add_argument('--bit-order', default='MSB', choices=nidigital.BitOrder.__members__.keys(), type=str.upper, help='Order in which to shift the bits.') - parser.add_argument('--waveform-file', default=None, help='Absolute file path to the load source waveform file (.tdms). Defaults to SourceWaveform.tdms next to this example.') - parser.add_argument('--write-waveform-data', default='True', choices=['True', 'False'], help='A Boolean that writes waveform data to source memory if True and the waveform data is in the file.') - args = parser.parse_args(argsv) - - example(args.resource_name, - 'Simulate=1, DriverSetup=Model:6571' if args.simulate == 'True' else '', - args.source_waveform_type, args.data_mapping, args.waveform_name, args.start_label, - args.parallel_channel_list, args.serial_channel_list, args.sample_width, args.bit_order, - args.waveform_file, args.write_waveform_data == 'True') - - -def main(): - _main(sys.argv[1:]) - - -def test_main(): - _main([]) - _main(['--source-waveform-type', 'SERIAL', '--data-mapping', 'SITE_UNIQUE']) - _main(['--source-waveform-type', 'TDMS']) - - -def test_example(): - resource_name = 'PXI1Slot2,PXI1Slot3' - options = {'simulate': True, 'driver_setup': {'Model': '6571'}, } - example(resource_name, options) - example(resource_name, options, 'SERIAL', 'SITE_UNIQUE') - example(resource_name, options, 'TDMS') - - -if __name__ == '__main__': - main() diff --git a/src/nidigital/examples/source_waveform/source_waveform.digiproj b/src/nidigital/examples/source_waveform/source_waveform.digiproj deleted file mode 100644 index 971b8ff9b9..0000000000 --- a/src/nidigital/examples/source_waveform/source_waveform.digiproj +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 649bcbe5969dd699cd0847f6c43b912d11bc0a74 Mon Sep 17 00:00:00 2001 From: NI-velmurugan Date: Mon, 16 Nov 2026 09:22:41 +0000 Subject: [PATCH 11/12] Renaming the example --- docs/nidigital/examples.rst | 18 +++++++++--------- .../CaptureWaveform.digicapture | Bin .../Pattern.digipat | Bin .../PinLevels.digilevels | 0 .../PinMap.pinmap | 0 .../Specifications.specs | 0 .../Timing.digitiming | 0 .../capture_waveform.digiproj | 0 .../nidigital_capture_waveform.py | 0 9 files changed, 9 insertions(+), 9 deletions(-) rename src/nidigital/examples/{capture_waveform => nidigital_capture_waveform}/CaptureWaveform.digicapture (100%) rename src/nidigital/examples/{capture_waveform => nidigital_capture_waveform}/Pattern.digipat (100%) rename src/nidigital/examples/{capture_waveform => nidigital_capture_waveform}/PinLevels.digilevels (100%) rename src/nidigital/examples/{capture_waveform => nidigital_capture_waveform}/PinMap.pinmap (100%) rename src/nidigital/examples/{capture_waveform => nidigital_capture_waveform}/Specifications.specs (100%) rename src/nidigital/examples/{capture_waveform => nidigital_capture_waveform}/Timing.digitiming (100%) rename src/nidigital/examples/{capture_waveform => nidigital_capture_waveform}/capture_waveform.digiproj (100%) rename src/nidigital/examples/{capture_waveform => nidigital_capture_waveform}/nidigital_capture_waveform.py (100%) diff --git a/docs/nidigital/examples.rst b/docs/nidigital/examples.rst index f51bde101a..8b5e268715 100644 --- a/docs/nidigital/examples.rst +++ b/docs/nidigital/examples.rst @@ -12,15 +12,6 @@ nidigital_burst_with_start_trigger.py :encoding: utf8 :caption: `(nidigital_burst_with_start_trigger.py) `_ -nidigital_capture_waveform.py ------------------------------ - -.. literalinclude:: ../../src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py - :language: python - :linenos: - :encoding: utf8 - :caption: `(nidigital_capture_waveform.py) `_ - nidigital_configure_time_set_and_voltage_levels.py -------------------------------------------------- @@ -39,6 +30,15 @@ nidigital_load_sheets_and_burst.py :encoding: utf8 :caption: `(nidigital_load_sheets_and_burst.py) `_ +nidigital_capture_waveform.py +----------------------------- + +.. literalinclude:: ../../src/nidigital/examples/nidigital_capture_waveform/nidigital_capture_waveform.py + :language: python + :linenos: + :encoding: utf8 + :caption: `(nidigital_capture_waveform.py) `_ + nidigital_ppmu_source_and_measure.py ------------------------------------ diff --git a/src/nidigital/examples/capture_waveform/CaptureWaveform.digicapture b/src/nidigital/examples/nidigital_capture_waveform/CaptureWaveform.digicapture similarity index 100% rename from src/nidigital/examples/capture_waveform/CaptureWaveform.digicapture rename to src/nidigital/examples/nidigital_capture_waveform/CaptureWaveform.digicapture diff --git a/src/nidigital/examples/capture_waveform/Pattern.digipat b/src/nidigital/examples/nidigital_capture_waveform/Pattern.digipat similarity index 100% rename from src/nidigital/examples/capture_waveform/Pattern.digipat rename to src/nidigital/examples/nidigital_capture_waveform/Pattern.digipat diff --git a/src/nidigital/examples/capture_waveform/PinLevels.digilevels b/src/nidigital/examples/nidigital_capture_waveform/PinLevels.digilevels similarity index 100% rename from src/nidigital/examples/capture_waveform/PinLevels.digilevels rename to src/nidigital/examples/nidigital_capture_waveform/PinLevels.digilevels diff --git a/src/nidigital/examples/capture_waveform/PinMap.pinmap b/src/nidigital/examples/nidigital_capture_waveform/PinMap.pinmap similarity index 100% rename from src/nidigital/examples/capture_waveform/PinMap.pinmap rename to src/nidigital/examples/nidigital_capture_waveform/PinMap.pinmap diff --git a/src/nidigital/examples/capture_waveform/Specifications.specs b/src/nidigital/examples/nidigital_capture_waveform/Specifications.specs similarity index 100% rename from src/nidigital/examples/capture_waveform/Specifications.specs rename to src/nidigital/examples/nidigital_capture_waveform/Specifications.specs diff --git a/src/nidigital/examples/capture_waveform/Timing.digitiming b/src/nidigital/examples/nidigital_capture_waveform/Timing.digitiming similarity index 100% rename from src/nidigital/examples/capture_waveform/Timing.digitiming rename to src/nidigital/examples/nidigital_capture_waveform/Timing.digitiming diff --git a/src/nidigital/examples/capture_waveform/capture_waveform.digiproj b/src/nidigital/examples/nidigital_capture_waveform/capture_waveform.digiproj similarity index 100% rename from src/nidigital/examples/capture_waveform/capture_waveform.digiproj rename to src/nidigital/examples/nidigital_capture_waveform/capture_waveform.digiproj diff --git a/src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py b/src/nidigital/examples/nidigital_capture_waveform/nidigital_capture_waveform.py similarity index 100% rename from src/nidigital/examples/capture_waveform/nidigital_capture_waveform.py rename to src/nidigital/examples/nidigital_capture_waveform/nidigital_capture_waveform.py From a9b697987f04dfc146067981872626b312f274d4 Mon Sep 17 00:00:00 2001 From: NI-velmurugan Date: Mon, 16 Nov 2026 12:22:43 +0000 Subject: [PATCH 12/12] Trigger CI build