Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_create_capture_waveform_serial(multi_instrument_session):
test_name = 'test_create_capture_waveform_serial'
configure_session(multi_instrument_session, test_name)
multi_instrument_session.load_pattern(get_test_file_path(test_name, 'pattern.digipat'))
num_samples = 2
multi_instrument_session.pins['HI0'].create_capture_waveform_serial(
waveform_name='capt_wfm',
sample_width=2,
bit_order=nidigital.BitOrder.LSB)
# The pattern references a wfm 'src_wfm', so we have to load it before we can burst
multi_instrument_session.pins['LO0'].create_source_waveform_serial(
waveform_name='src_wfm',
data_mapping=nidigital.SourceDataMapping.BROADCAST,
sample_width=2,
bit_order=nidigital.BitOrder.LSB)
multi_instrument_session.write_source_waveform_broadcast(
waveform_name='src_wfm',
waveform_data=[1, 2])
multi_instrument_session.burst_pattern(start_label='new_pattern')
# Fetch to confirm that configuration went okay
fetched_waveforms = multi_instrument_session.sites[1, 0].fetch_capture_waveform(
waveform_name='capt_wfm',
samples_to_read=num_samples)
test_name = 'test_create_capture_waveform_serial'
configure_session(multi_instrument_session, test_name)
multi_instrument_session.load_pattern(get_test_file_path(test_name, 'pattern.digipat'))
num_samples = 2
multi_instrument_session.pins['HI0'].create_capture_waveform_serial(
waveform_name='capt_wfm',
sample_width=2,
bit_order=nidigital.BitOrder.LSB)
# The pattern references a wfm 'src_wfm', so we have to load it before we can burst
multi_instrument_session.pins['LO0'].create_source_waveform_serial(
waveform_name='src_wfm',
data_mapping=nidigital.SourceDataMapping.BROADCAST,
sample_width=2,
bit_order=nidigital.BitOrder.LSB)
multi_instrument_session.write_source_waveform_broadcast(
waveform_name='src_wfm',
waveform_data=[1, 2])
multi_instrument_session.burst_pattern(start_label='new_pattern')
# Fetch to confirm that configuration went okay
fetched_waveforms = multi_instrument_session.sites[1, 0].fetch_capture_waveform(
waveform_name='capt_wfm',
samples_to_read=num_samples)
assert sorted(fetched_waveforms.keys()) == sorted([0, 1])
assert all(len(fetched_waveforms[site]) == num_samples for site in fetched_waveforms)