Skip to content

Commit

Permalink
Remove size param from apply_tdr_offsets() and write_source_waveform_…
Browse files Browse the repository at this point in the history
…broadcast_u32()
  • Loading branch information
sbethur committed Nov 8, 2019
1 parent 004c7ae commit 3b7c604
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 32 deletions.
20 changes: 3 additions & 17 deletions docs/nidigital/class.rst
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ apply_tdr_offsets

.. py:currentmodule:: nidigital.Session
.. py:method:: apply_tdr_offsets(num_offsets, offsets)
.. py:method:: apply_tdr_offsets(offsets)
TBD
Expand All @@ -176,16 +176,9 @@ apply_tdr_offsets
.. code:: python
session.channels[0,1].apply_tdr_offsets(num_offsets, offsets)
session.channels[0,1].apply_tdr_offsets(offsets)
:param num_offsets:
:type num_offsets: int
:param offsets:
Expand Down Expand Up @@ -3277,7 +3270,7 @@ write_source_waveform_broadcast_u32

.. py:currentmodule:: nidigital.Session
.. py:method:: write_source_waveform_broadcast_u32(waveform_name, waveform_size, waveform_data)
.. py:method:: write_source_waveform_broadcast_u32(waveform_name, waveform_data)
TBD
Expand All @@ -3292,13 +3285,6 @@ write_source_waveform_broadcast_u32
:type waveform_name: str
:param waveform_size:
:type waveform_size: int
:param waveform_data:
Expand Down
10 changes: 3 additions & 7 deletions generated/nidigital/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ def _get_error_description(self, error_code):
''' These are code-generated '''

@ivi_synchronized
def apply_tdr_offsets(self, num_offsets, offsets):
def apply_tdr_offsets(self, offsets):
r'''apply_tdr_offsets
TBD
Expand All @@ -664,11 +664,9 @@ def apply_tdr_offsets(self, num_offsets, offsets):
You can specify a subset of repeated capabilities using the Python index notation on an
nidigital.Session repeated capabilities container, and calling this method on the result.:
session.channels[0,1].apply_tdr_offsets(num_offsets, offsets)
session.channels[0,1].apply_tdr_offsets(offsets)
Args:
num_offsets (int):
offsets (list of float):
'''
Expand Down Expand Up @@ -3574,16 +3572,14 @@ def write_sequencer_register(self, reg, value):
return

@ivi_synchronized
def write_source_waveform_broadcast_u32(self, waveform_name, waveform_size, waveform_data):
def write_source_waveform_broadcast_u32(self, waveform_name, waveform_data):
r'''write_source_waveform_broadcast_u32
TBD
Args:
waveform_name (str):
waveform_size (int):
waveform_data (list of int):
'''
Expand Down
4 changes: 2 additions & 2 deletions src/nidigital/metadata/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
'direction': 'in',
'name': 'offsets',
'size': {
'mechanism': 'passed-in',
'mechanism': 'len',
'value': 'numOffsets'
},
'type': 'ViReal64[]'
Expand Down Expand Up @@ -3672,7 +3672,7 @@
'direction': 'in',
'name': 'waveformData',
'size': {
'mechanism': 'passed-in',
'mechanism': 'len',
'value': 'waveformSize'
},
'type': 'ViUInt32[]'
Expand Down
80 changes: 74 additions & 6 deletions src/nidigital/system_tests/test_system_nidigital.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import nidigital
import os
import pytest

instr = ['PXI1Slot2', 'PXI1Slot5']
Expand All @@ -11,13 +12,15 @@ def multi_instrument_session():


def test_property_boolean(multi_instrument_session):
multi_instrument_session.channels[instr[0] + '/0'].ppmu_allow_extended_voltage_range = True
assert multi_instrument_session.channels[instr[0] + '/0'].ppmu_allow_extended_voltage_range == True
channel = multi_instrument_session.get_channel_name(index=42)
multi_instrument_session.channels[channel].ppmu_allow_extended_voltage_range = True
assert multi_instrument_session.channels[channel].ppmu_allow_extended_voltage_range == True


def test_property_int32(multi_instrument_session):
multi_instrument_session.channels[instr[0] + '/0'].termination_mode = nidigital.TerminationMode.HIGH_Z
assert multi_instrument_session.channels[instr[0] + '/0'].termination_mode == nidigital.TerminationMode.HIGH_Z
channel = multi_instrument_session.get_channel_name(index=42)
multi_instrument_session.channels[channel].termination_mode = nidigital.TerminationMode.HIGH_Z
assert multi_instrument_session.channels[channel].termination_mode == nidigital.TerminationMode.HIGH_Z


def test_property_int64(multi_instrument_session):
Expand All @@ -26,10 +29,75 @@ def test_property_int64(multi_instrument_session):


def test_property_real64(multi_instrument_session):
multi_instrument_session.channels[instr[0] + '/0'].ppmu_voltage_level = 4
assert multi_instrument_session.channels[instr[0] + '/0'].ppmu_voltage_level == pytest.approx(4, rel=1e-3)
channel = multi_instrument_session.get_channel_name(index=42)
multi_instrument_session.channels[channel].ppmu_voltage_level = 4
assert multi_instrument_session.channels[channel].ppmu_voltage_level == pytest.approx(4, rel=1e-3)


def test_property_string(multi_instrument_session):
multi_instrument_session.start_label = 'foo'
assert multi_instrument_session.start_label == 'foo'


def test_tdr_all_channels(multi_instrument_session):
applied_offsets = multi_instrument_session.tdr(apply_offsets=False)
assert len(applied_offsets) == multi_instrument_session.channel_count

multi_instrument_session.apply_tdr_offsets(applied_offsets)

channels = [multi_instrument_session.get_channel_name(i) for i in range(1, multi_instrument_session.channel_count + 1)]
fetched_offsets = [multi_instrument_session.channels[i].tdr_offset for i in channels]
assert fetched_offsets == applied_offsets


def test_tdr_some_channels(multi_instrument_session):
channels = [multi_instrument_session.get_channel_name(i) for i in [64, 1, 50, 25]]
applied_offsets = multi_instrument_session.channels[channels].tdr(apply_offsets=False)
assert len(applied_offsets) == len(channels)

multi_instrument_session.channels[channels].apply_tdr_offsets(applied_offsets)

fetched_offsets = [multi_instrument_session.channels[i].tdr_offset for i in channels]
assert fetched_offsets == applied_offsets


def test_source_waveform_parallel_broadcast(multi_instrument_session):
configure_session(multi_instrument_session)

multi_instrument_session.create_source_waveform_parallel(
pin_list='LowPins',
waveform_name='new_waveform',
data_mapping=2600)

multi_instrument_session.write_source_waveform_broadcast_u32(
waveform_name='new_waveform',
waveform_data=[i for i in range(4)])

multi_instrument_session.burst_pattern(
site_list='',
start_label='new_pattern',
select_digital_function=False,
wait_until_done=True,
timeout=5)

pass_fail = multi_instrument_session.get_site_pass_fail(site_list='')
assert pass_fail == [True, True]


def configure_session(session):
test_files_dir = os.path.join(os.getcwd(), 'src\\nidigital\\system_tests\\test_files')

session.load_pin_map(os.path.join(test_files_dir, 'pin_map.pinmap'))

session.load_specifications(os.path.join(test_files_dir, 'specifications.specs'))
session.load_levels(os.path.join(test_files_dir, 'pin_levels.digilevels'))
session.load_timing(os.path.join(test_files_dir, 'timing.digitiming'))
session.apply_levels_and_timing(
site_list='',
levels_sheet='pin_levels',
timing_sheet='timing',
initial_state_high_pins='',
initial_state_low_pins='',
initial_state_tristate_pins='')

session.load_pattern(os.path.join(test_files_dir, 'pattern.digipat'))

0 comments on commit 3b7c604

Please sign in to comment.