diff --git a/.gitignore b/.gitignore index eaaa5c2e7..06c40b3d8 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ nidcpowerunittest.xml nidigitalunittest.xml nifakeunittest.xml nimodinstunittest.xml +nirfsgunittest.xml niscopeunittest.xml nitclkunittest.xml codegen.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a4793d5b..ff4855850 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1685,6 +1685,7 @@ #### [nirfsg] Unreleased - Added - Enabled selected public APIs + - Enabled custom object expansion for repeated capabilities - Basic example - Documentation for APIs (not final) - Changed diff --git a/build/helper/__init__.py b/build/helper/__init__.py index f6d8dbcfa..620646a8a 100644 --- a/build/helper/__init__.py +++ b/build/helper/__init__.py @@ -51,6 +51,7 @@ from build.helper.metadata_filters import filter_library_functions # noqa: F401 from build.helper.metadata_filters import filter_parameters # noqa: F401 from build.helper.metadata_filters import filter_public_functions # noqa: F401 +from build.helper.metadata_filters import filter_rep_cap_supported_attributes # noqa: F401 from build.helper.metadata_find import find_custom_type # noqa: F401 from build.helper.metadata_find import find_session_handle_parameter # noqa: F401 diff --git a/build/helper/documentation_helper.py b/build/helper/documentation_helper.py index 5c60c11e6..3933351a7 100644 --- a/build/helper/documentation_helper.py +++ b/build/helper/documentation_helper.py @@ -4,6 +4,7 @@ from .documentation_snippets import enum_note_text from .documentation_snippets import func_note_text from .documentation_snippets import rep_cap_attr_desc +from .documentation_snippets import rep_cap_attr_desc_without_global from .documentation_snippets import rep_cap_method_desc from .helper import get_array_type_for_api_type from .helper import get_numpy_type_for_api_type @@ -116,7 +117,10 @@ def add_attribute_rep_cap_tip(attr, config): multi_capability = get_attribute_repeated_caps_with_conjunction(attr) single_capability = attr['supported_rep_caps'][0] - attr['documentation']['tip'] = rep_cap_attr_desc.format(config['module_name'], multi_capability, single_capability, attr['python_name']) + if config['repeated_capability_object_type']['python'] != 'applicable-attributes-only': + attr['documentation']['tip'] = rep_cap_attr_desc.format(config['module_name'], multi_capability, single_capability, attr['python_name']) + else: + attr['documentation']['tip'] = rep_cap_attr_desc_without_global.format(config['module_name'], multi_capability, single_capability, attr['python_name']) def get_documentation_for_node_rst(node, config, indent=0): diff --git a/build/helper/documentation_snippets.py b/build/helper/documentation_snippets.py index 2b4a9524c..4e76c552e 100644 --- a/build/helper/documentation_snippets.py +++ b/build/helper/documentation_snippets.py @@ -24,6 +24,13 @@ Example: :py:attr:`my_session.{3}` ''' +rep_cap_attr_desc_without_global = ''' +This property can be set/get on specific {1} within your :py:class:`{0}.Session` instance. +Use Python index notation on the repeated capabilities container {1} to specify a subset. + +Example: :py:attr:`my_session.{2}[ ... ].{3}` +''' + func_note_text = ''' One or more of the referenced functions are not in the Python API for this driver. ''' diff --git a/build/helper/metadata_add_all.py b/build/helper/metadata_add_all.py index ed9d836b6..77195417f 100644 --- a/build/helper/metadata_add_all.py +++ b/build/helper/metadata_add_all.py @@ -721,6 +721,9 @@ def add_all_config_metadata(config): if 'uses_nitclk' not in config: config['uses_nitclk'] = False + if 'repeated_capability_object_type' not in config: + config['repeated_capability_object_type'] = {'python': 'session'} + return config diff --git a/build/helper/metadata_filters.py b/build/helper/metadata_filters.py index 3a4d5bb1c..1cdf6b88e 100644 --- a/build/helper/metadata_filters.py +++ b/build/helper/metadata_filters.py @@ -451,3 +451,16 @@ def filter_codegen_enums(enums): return {k: v for k, v in enums.items() if v['codegen_method'] != 'no'} +def filter_rep_cap_supported_attributes(attributes, rep_cap_name): + '''Returns attribute metadata only for those attributes that support the specified repeated capability. + + Args: + attributes: Dictionary of attribute metadata. + + rep_cap_name: The name of the repeated capability to filter by. + + Returns: + Dictionary of attributes that support the specified repeated capability. + ''' + return {k: v for k, v in attributes.items() if rep_cap_name in v.get('supported_rep_caps', [])} + diff --git a/build/templates/session.py.mako b/build/templates/session.py.mako index df755677b..27f0f0a02 100644 --- a/build/templates/session.py.mako +++ b/build/templates/session.py.mako @@ -3,6 +3,7 @@ ${template_parameters['encoding_tag']} <% import build.helper as helper import os + from string import capwords grpc_supported = template_parameters['include_grpc_support'] @@ -33,7 +34,9 @@ from functools import wraps % if attributes: import ${module_name}._attributes as _attributes % endif +% if config['repeated_capability_object_type']['python'] != 'applicable-attributes-only': import ${module_name}._converters as _converters +% endif import ${module_name}._library_interpreter as _library_interpreter import ${module_name}.enums as enums import ${module_name}.errors as errors @@ -91,6 +94,72 @@ class _Lock(object): % endif % if len(config['repeated_capabilities']) > 0: +% if config['repeated_capability_object_type']['python'] == 'applicable-attributes-only': +class _RepeatedCapabilityAttributeOnlyBase(object): + def __init__(self, session, prefix): + object.__setattr__(self, '_session', session) + object.__setattr__(self, '_prefix', prefix) + object.__setattr__(self, '_repeated_capability', '') + + def _get_attribute_vi_real64(self, attribute): + value = self._session._interpreter.get_attribute_vi_real64(self._prefix + self._repeated_capability, attribute) + return value + + def _set_attribute_vi_real64(self, attribute, value): + self._session._interpreter.set_attribute_vi_real64(self._prefix + self._repeated_capability, attribute, value) + + def _get_attribute_vi_int32(self, attribute): + value = self._session._interpreter.get_attribute_vi_int32(self._prefix + self._repeated_capability, attribute) + return value + + def _set_attribute_vi_int32(self, attribute, value): + self._session._interpreter.set_attribute_vi_int32(self._prefix + self._repeated_capability, attribute, value) + + def _get_attribute_vi_string(self, attribute): + value = self._session._interpreter.get_attribute_vi_string(self._prefix + self._repeated_capability, attribute) + return value + + def _set_attribute_vi_string(self, attribute, value): + self._session._interpreter.set_attribute_vi_string(self._prefix + self._repeated_capability, attribute, value) + + + % for rep_cap in config['repeated_capabilities']: +class _RepeatedCapability${capwords(rep_cap['python_name'].replace('_', ' ')).replace(' ', '')}(_RepeatedCapabilityAttributeOnlyBase): + % for attribute in helper.sorted_attrs(helper.filter_rep_cap_supported_attributes(attributes, rep_cap['python_name'])): +<% +helper.add_attribute_rep_cap_tip(attributes[attribute], config) +%>\ + % if attributes[attribute]['enum']: + % if helper.enum_uses_converter(enums[attributes[attribute]['enum']]): + ${attributes[attribute]['python_name']} = _attributes.AttributeEnumWithConverter(_attributes.AttributeEnum(_attributes.Attribute${attributes[attribute]['type']}, enums.${enums[attributes[attribute]['enum']]['python_name']}, ${attribute}), _converters.${enums[attributes[attribute]['enum']]['enum_to_converted_value_function_name']}, _converters.${enums[attributes[attribute]['enum']]['converted_value_to_enum_function_name']}) + % else: + ${attributes[attribute]['python_name']} = _attributes.AttributeEnum(_attributes.Attribute${attributes[attribute]['type']}, enums.${enums[attributes[attribute]['enum']]['python_name']}, ${attribute}) + % endif + % else: + ${attributes[attribute]['python_name']} = _attributes.${attributes[attribute]['attribute_class']}(${attribute}) + % endif + % if 'documentation' in attributes[attribute] and len(helper.get_documentation_for_node_docstring(attributes[attribute], config, indent=4).strip()) > 0: + '''Type: ${attributes[attribute]['type_in_documentation']} + + ${helper.get_documentation_for_node_docstring(attributes[attribute], config, indent=4)} + ''' + % endif + % endfor + def __init__(self, session): + super(_RepeatedCapability${capwords(rep_cap['python_name'].replace('_', ' ')).replace(' ', '')}, self).__init__(session, '${rep_cap["prefix"]}') + + def __setattr__(self, key, value): + if key not in dir(self): + raise AttributeError("'{0}' object has no attribute '{1}'".format(type(self).__name__, key)) + object.__setattr__(self, key, value) + + def __getitem__(self, repeated_capability): + super(_RepeatedCapability${capwords(rep_cap['python_name'].replace('_', ' ')).replace(' ', '')}, self).__setattr__('_repeated_capability', repeated_capability) + return self + + + % endfor + % else: class _RepeatedCapabilities(object): def __init__(self, session, prefix, current_repeated_capability_list): self._session = session @@ -128,6 +197,7 @@ class _NoChannel(object): self._session._repeated_capability = self._repeated_capability_cache + % endif % endif class _SessionBase(object): '''Base class for all ${config['driver_name']} sessions.''' @@ -136,6 +206,7 @@ class _SessionBase(object): _is_frozen = False % for attribute in helper.sorted_attrs(helper.filter_codegen_attributes(attributes)): +% if not ('supported_rep_caps' in attributes[attribute] and len(attributes[attribute]['supported_rep_caps']) > 0 and config['repeated_capability_object_type']['python'] == 'applicable-attributes-only'): <% helper.add_attribute_rep_cap_tip(attributes[attribute], config) %>\ @@ -154,6 +225,7 @@ helper.add_attribute_rep_cap_tip(attributes[attribute], config) ${helper.get_documentation_for_node_docstring(attributes[attribute], config, indent=4)} ''' % endif +% endif % endfor <% init_function = config['functions']['_init_function'] @@ -179,7 +251,11 @@ constructor_params = helper.filter_parameters(init_function['parameters'], helpe % if len(config['repeated_capabilities']) > 0: # Instantiate any repeated capability objects % for rep_cap in config['repeated_capabilities']: +% if config['repeated_capability_object_type']['python'] == 'applicable-attributes-only': + self.${rep_cap['python_name']} = _RepeatedCapability${capwords(rep_cap['python_name'].replace('_', ' ')).replace(' ', '')}(self) +% else: self.${rep_cap['python_name']} = _RepeatedCapabilities(self, '${rep_cap["prefix"]}', repeated_capability_list) +% endif % endfor % endif diff --git a/build/unit_tests/test_metadata_add_all.py b/build/unit_tests/test_metadata_add_all.py index 67a5750a4..ea4975067 100644 --- a/build/unit_tests/test_metadata_add_all.py +++ b/build/unit_tests/test_metadata_add_all.py @@ -979,6 +979,9 @@ def _compare_dicts(actual, expected): }, ], 'enum_whitelist_suffix': ['_POINT_FIVE'], + 'repeated_capability_object_type': { + 'python': 'session' + }, 'repeated_capabilities': [ {'python_name': 'channels', 'prefix': '', }, ], diff --git a/docs/nirfsg/class.rst b/docs/nirfsg/class.rst index 9d0012789..07de47675 100644 --- a/docs/nirfsg/class.rst +++ b/docs/nirfsg/class.rst @@ -5073,10 +5073,6 @@ deembedding_compensation_gain Example: :py:attr:`my_session.deembedding_port[ ... ].deembedding_compensation_gain` - To set/get on all deembedding_port, you can call the property directly on the :py:class:`nirfsg.Session`. - - Example: :py:attr:`my_session.deembedding_compensation_gain` - The following table lists the characteristics of this property. +-----------------------+------------------+ @@ -5118,10 +5114,6 @@ deembedding_selected_table Example: :py:attr:`my_session.deembedding_port[ ... ].deembedding_selected_table` - To set/get on all deembedding_port, you can call the property directly on the :py:class:`nirfsg.Session`. - - Example: :py:attr:`my_session.deembedding_selected_table` - The following table lists the characteristics of this property. +-----------------------+------------------+ @@ -5177,10 +5169,6 @@ deembedding_type Example: :py:attr:`my_session.deembedding_port[ ... ].deembedding_type` - To set/get on all deembedding_port, you can call the property directly on the :py:class:`nirfsg.Session`. - - Example: :py:attr:`my_session.deembedding_type` - The following table lists the characteristics of this property. +-----------------------+-------------------------------+ @@ -5340,10 +5328,6 @@ digital_edge_script_trigger_edge Example: :py:attr:`my_session.script_triggers[ ... ].digital_edge_script_trigger_edge` - To set/get on all script_triggers, you can call the property directly on the :py:class:`nirfsg.Session`. - - Example: :py:attr:`my_session.digital_edge_script_trigger_edge` - The following table lists the characteristics of this property. +-----------------------+-----------------------------+ @@ -5443,10 +5427,6 @@ digital_edge_script_trigger_source Example: :py:attr:`my_session.script_triggers[ ... ].digital_edge_script_trigger_source` - To set/get on all script_triggers, you can call the property directly on the :py:class:`nirfsg.Session`. - - Example: :py:attr:`my_session.digital_edge_script_trigger_source` - The following table lists the characteristics of this property. +-----------------------+-----------------+ @@ -5705,10 +5685,6 @@ digital_level_script_trigger_active_level Example: :py:attr:`my_session.script_triggers[ ... ].digital_level_script_trigger_active_level` - To set/get on all script_triggers, you can call the property directly on the :py:class:`nirfsg.Session`. - - Example: :py:attr:`my_session.digital_level_script_trigger_active_level` - The following table lists the characteristics of this property. +-----------------------+-------------------------------------+ @@ -5804,10 +5780,6 @@ digital_level_script_trigger_source Example: :py:attr:`my_session.script_triggers[ ... ].digital_level_script_trigger_source` - To set/get on all script_triggers, you can call the property directly on the :py:class:`nirfsg.Session`. - - Example: :py:attr:`my_session.digital_level_script_trigger_source` - The following table lists the characteristics of this property. +-----------------------+-----------------+ @@ -6475,10 +6447,6 @@ exported_marker_event_output_terminal Example: :py:attr:`my_session.markers[ ... ].exported_marker_event_output_terminal` - To set/get on all markers, you can call the property directly on the :py:class:`nirfsg.Session`. - - Example: :py:attr:`my_session.exported_marker_event_output_terminal` - The following table lists the characteristics of this property. +-----------------------+------------+ @@ -6756,10 +6724,6 @@ exported_script_trigger_output_terminal Example: :py:attr:`my_session.script_triggers[ ... ].exported_script_trigger_output_terminal` - To set/get on all script_triggers, you can call the property directly on the :py:class:`nirfsg.Session`. - - Example: :py:attr:`my_session.exported_script_trigger_output_terminal` - The following table lists the characteristics of this property. +-----------------------+-----------------+ @@ -9027,10 +8991,6 @@ marker_event_output_behavior Example: :py:attr:`my_session.markers[ ... ].marker_event_output_behavior` - To set/get on all markers, you can call the property directly on the :py:class:`nirfsg.Session`. - - Example: :py:attr:`my_session.marker_event_output_behavior` - The following table lists the characteristics of this property. +-----------------------+---------------------------------+ @@ -9074,10 +9034,6 @@ marker_event_pulse_width Example: :py:attr:`my_session.markers[ ... ].marker_event_pulse_width` - To set/get on all markers, you can call the property directly on the :py:class:`nirfsg.Session`. - - Example: :py:attr:`my_session.marker_event_pulse_width` - The following table lists the characteristics of this property. +-----------------------+------------+ @@ -9129,10 +9085,6 @@ marker_event_pulse_width_units Example: :py:attr:`my_session.markers[ ... ].marker_event_pulse_width_units` - To set/get on all markers, you can call the property directly on the :py:class:`nirfsg.Session`. - - Example: :py:attr:`my_session.marker_event_pulse_width_units` - The following table lists the characteristics of this property. +-----------------------+----------------------------------+ @@ -9186,10 +9138,6 @@ marker_event_terminal_name Example: :py:attr:`my_session.markers[ ... ].marker_event_terminal_name` - To set/get on all markers, you can call the property directly on the :py:class:`nirfsg.Session`. - - Example: :py:attr:`my_session.marker_event_terminal_name` - The following table lists the characteristics of this property. +-----------------------+-----------+ @@ -9241,10 +9189,6 @@ marker_event_toggle_initial_state Example: :py:attr:`my_session.markers[ ... ].marker_event_toggle_initial_state` - To set/get on all markers, you can call the property directly on the :py:class:`nirfsg.Session`. - - Example: :py:attr:`my_session.marker_event_toggle_initial_state` - The following table lists the characteristics of this property. +-----------------------+-------------------------------------+ @@ -10953,10 +10897,6 @@ script_trigger_terminal_name Example: :py:attr:`my_session.script_triggers[ ... ].script_trigger_terminal_name` - To set/get on all script_triggers, you can call the property directly on the :py:class:`nirfsg.Session`. - - Example: :py:attr:`my_session.script_trigger_terminal_name` - The following table lists the characteristics of this property. +-----------------------+-----------------+ @@ -11018,10 +10958,6 @@ script_trigger_type Example: :py:attr:`my_session.script_triggers[ ... ].script_trigger_type` - To set/get on all script_triggers, you can call the property directly on the :py:class:`nirfsg.Session`. - - Example: :py:attr:`my_session.script_trigger_type` - The following table lists the characteristics of this property. +-----------------------+----------------------+ @@ -12412,10 +12348,6 @@ waveform_iq_rate Example: :py:attr:`my_session.waveform[ ... ].waveform_iq_rate` - To set/get on all waveform, you can call the property directly on the :py:class:`nirfsg.Session`. - - Example: :py:attr:`my_session.waveform_iq_rate` - The following table lists the characteristics of this property. +-----------------------+------------+ @@ -12451,10 +12383,6 @@ waveform_papr Example: :py:attr:`my_session.waveform[ ... ].waveform_papr` - To set/get on all waveform, you can call the property directly on the :py:class:`nirfsg.Session`. - - Example: :py:attr:`my_session.waveform_papr` - The following table lists the characteristics of this property. +-----------------------+------------+ @@ -12518,10 +12446,6 @@ waveform_rf_blanking Example: :py:attr:`my_session.waveform[ ... ].waveform_rf_blanking` - To set/get on all waveform, you can call the property directly on the :py:class:`nirfsg.Session`. - - Example: :py:attr:`my_session.waveform_rf_blanking` - The following table lists the characteristics of this property. +-----------------------+------------------+ @@ -12559,10 +12483,6 @@ waveform_runtime_scaling Example: :py:attr:`my_session.waveform[ ... ].waveform_runtime_scaling` - To set/get on all waveform, you can call the property directly on the :py:class:`nirfsg.Session`. - - Example: :py:attr:`my_session.waveform_runtime_scaling` - The following table lists the characteristics of this property. +-----------------------+------------+ @@ -12600,10 +12520,6 @@ waveform_signal_bandwidth Example: :py:attr:`my_session.waveform[ ... ].waveform_signal_bandwidth` - To set/get on all waveform, you can call the property directly on the :py:class:`nirfsg.Session`. - - Example: :py:attr:`my_session.waveform_signal_bandwidth` - The following table lists the characteristics of this property. +-----------------------+------------+ @@ -12639,10 +12555,6 @@ waveform_waveform_size Example: :py:attr:`my_session.waveform[ ... ].waveform_waveform_size` - To set/get on all waveform, you can call the property directly on the :py:class:`nirfsg.Session`. - - Example: :py:attr:`my_session.waveform_waveform_size` - The following table lists the characteristics of this property. +-----------------------+-----------+ diff --git a/generated/nirfsg/nirfsg/session.py b/generated/nirfsg/nirfsg/session.py index 645ea429b..f55234580 100644 --- a/generated/nirfsg/nirfsg/session.py +++ b/generated/nirfsg/nirfsg/session.py @@ -5,7 +5,6 @@ from functools import wraps import nirfsg._attributes as _attributes -import nirfsg._converters as _converters import nirfsg._library_interpreter as _library_interpreter import nirfsg.enums as enums import nirfsg.errors as errors @@ -52,41 +51,877 @@ def __exit__(self, exc_type, exc_value, traceback): self._session.unlock() -class _RepeatedCapabilities(object): - def __init__(self, session, prefix, current_repeated_capability_list): - self._session = session - self._prefix = prefix - # We need at least one element. If we get an empty list, make the one element an empty string - self._current_repeated_capability_list = current_repeated_capability_list if len(current_repeated_capability_list) > 0 else [''] - # Now we know there is at lease one entry, so we look if it is an empty string or not - self._separator = '/' if len(self._current_repeated_capability_list[0]) > 0 else '' +class _RepeatedCapabilityAttributeOnlyBase(object): + def __init__(self, session, prefix): + object.__setattr__(self, '_session', session) + object.__setattr__(self, '_prefix', prefix) + object.__setattr__(self, '_repeated_capability', '') + + def _get_attribute_vi_real64(self, attribute): + value = self._session._interpreter.get_attribute_vi_real64(self._prefix + self._repeated_capability, attribute) + return value + + def _set_attribute_vi_real64(self, attribute, value): + self._session._interpreter.set_attribute_vi_real64(self._prefix + self._repeated_capability, attribute, value) + + def _get_attribute_vi_int32(self, attribute): + value = self._session._interpreter.get_attribute_vi_int32(self._prefix + self._repeated_capability, attribute) + return value + + def _set_attribute_vi_int32(self, attribute, value): + self._session._interpreter.set_attribute_vi_int32(self._prefix + self._repeated_capability, attribute, value) + + def _get_attribute_vi_string(self, attribute): + value = self._session._interpreter.get_attribute_vi_string(self._prefix + self._repeated_capability, attribute) + return value + + def _set_attribute_vi_string(self, attribute, value): + self._session._interpreter.set_attribute_vi_string(self._prefix + self._repeated_capability, attribute, value) + + +class _RepeatedCapabilityMarkers(_RepeatedCapabilityAttributeOnlyBase): + exported_marker_event_output_terminal = _attributes.AttributeEnum(_attributes.AttributeViString, enums.MarkerEventExportOutputTerm, 1150064) + '''Type: enums.MarkerEventExportOutputTerm + + Specifies the destination terminal for exporting the Marker Event. To set this property, the NI-RFSG device must be in the Configuration state. + + **Supported Devices:** PXIe-5644/5645/5646, PXI-5670/5671, PXIe-5672/5673/5673E, PXIe-5820/5830/5831/5832/5840/5841/5842/5860 + + **Related Topics** + + `Marker Events `_ + + `PFI Lines `_ + + `PXI Trigger Lines `_ + + **High-Level Methods**: + + - export_signal + + **Defined Values**: + + +-------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | Name | Value | Description | + +===========================================+=============+=================================================================================================================================+ + | MarkerEventExportOutputTerm.DO_NOT_EXPORT | | The signal is not exported. | + +-------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | MarkerEventExportOutputTerm.PFI0 | PFI0 | The signal is exported to the PFI 0 connector. For the PXIe-5841 with PXIe-5655, the signal is exported to the PXIe-5841 PFI 0. | + +-------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | MarkerEventExportOutputTerm.PFI1 | PFI1 | The signal is exported to the PFI 1 connector. | + +-------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | MarkerEventExportOutputTerm.PFI4 | PFI4 | The signal is exported to the PFI 4 connector. | + +-------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | MarkerEventExportOutputTerm.PFI5 | PFI5 | The signal is exported to the PFI 5 connector. | + +-------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | MarkerEventExportOutputTerm.PXI_TRIG0 | PXI_Trig0 | The trigger is received on PXI trigger line 0. | + +-------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | MarkerEventExportOutputTerm.PXI_TRIG1 | PXI_Trig1 | The trigger is received on PXI trigger line 1. | + +-------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | MarkerEventExportOutputTerm.PXI_TRIG2 | PXI_Trig2 | The trigger is received on PXI trigger line 2. | + +-------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | MarkerEventExportOutputTerm.PXI_TRIG3 | PXI_Trig3 | The trigger is received on PXI trigger line 3. | + +-------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | MarkerEventExportOutputTerm.PXI_TRIG4 | PXI_Trig4 | The trigger is received on PXI trigger line 4. | + +-------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | MarkerEventExportOutputTerm.PXI_TRIG5 | PXI_Trig5 | The trigger is received on PXI trigger line 5. | + +-------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | MarkerEventExportOutputTerm.PXI_TRIG6 | PXI_Trig6 | The trigger is received on PXI trigger line 6. | + +-------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | MarkerEventExportOutputTerm.PXIE_DSTARC | PXIe_DStarC | The signal is exported to the PXIe DStar C trigger line. This value is valid on only the PXIe-5820/5830/5831/5832/5840/5841. | + +-------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | MarkerEventExportOutputTerm.DIO0 | DIO/PFI0 | The trigger is received on PFI0 from the front panel DIO terminal. | + +-------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | MarkerEventExportOutputTerm.DIO1 | DIO/PFI1 | The trigger is received on PFI1 from the front panel DIO terminal. | + +-------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | MarkerEventExportOutputTerm.DIO2 | DIO/PFI2 | The trigger is received on PFI2 from the front panel DIO terminal. | + +-------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | MarkerEventExportOutputTerm.DIO3 | DIO/PFI3 | The trigger is received on PFI3 from the front panel DIO terminal. | + +-------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | MarkerEventExportOutputTerm.DIO4 | DIO/PFI4 | The trigger is received on PFI4 from the front panel DIO terminal. | + +-------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | MarkerEventExportOutputTerm.DIO5 | DIO/PFI5 | The trigger is received on PFI5 from the front panel DIO terminal. | + +-------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | MarkerEventExportOutputTerm.DIO6 | DIO/PFI6 | The trigger is received on PFI6 from the front panel DIO terminal. | + +-------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | MarkerEventExportOutputTerm.DIO7 | DIO/PFI7 | The trigger is received on PFI7 from the front panel DIO terminal. | + +-------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + + Note: + One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. + + Tip: + This property can be set/get on specific markers within your :py:class:`nirfsg.Session` instance. + Use Python index notation on the repeated capabilities container markers to specify a subset. + + Example: :py:attr:`my_session.markers[ ... ].exported_marker_event_output_terminal` + ''' + marker_event_output_behavior = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.MarkerEventOutputBehavior, 1150206) + '''Type: enums.MarkerEventOutputBehavior + + Specifies the output behavior for the Marker Event. To set this property, the NI-RFSG device must be in the Configuration state. + + **Default Value:** MarkerEventOutputBehavior.PULSE + + **Supported Devices:** PXIe-5820/5830/5831/5832/5840/5841/5842 + + **Related Topics** + + `Marker Events `_ + + **Defined Values**: + + +----------------------------------+----------------+-------------------------------------------------------+ + | Name | Value | Description | + +==================================+================+=======================================================+ + | MarkerEventOutputBehavior.PULSE | 23000 (0x59d8) | Specifies the Marker Event output behavior as pulse. | + +----------------------------------+----------------+-------------------------------------------------------+ + | MarkerEventOutputBehavior.TOGGLE | 23001 (0x59d9) | Specifies the Marker Event output behavior as toggle. | + +----------------------------------+----------------+-------------------------------------------------------+ + + Tip: + This property can be set/get on specific markers within your :py:class:`nirfsg.Session` instance. + Use Python index notation on the repeated capabilities container markers to specify a subset. + + Example: :py:attr:`my_session.markers[ ... ].marker_event_output_behavior` + ''' + marker_event_pulse_width = _attributes.AttributeViReal64(1150207) + '''Type: float + + Specifies the pulse width value for the Marker Event. Use the marker_event_pulse_width_units property to set the units for the pulse width value. This property is valid only when the marker_event_output_behavior property is set to MarkerEventOutputBehavior.PULSE. + + To set this property, the NI-RFSG device must be in the Configuration state. + + **Default Value:** 200 ns + + **Supported Devices:** PXIe-5820/5830/5831/5832/5840/5841/5842 + + **Related Topics** + + `Marker Events `_ + + Tip: + This property can be set/get on specific markers within your :py:class:`nirfsg.Session` instance. + Use Python index notation on the repeated capabilities container markers to specify a subset. + + Example: :py:attr:`my_session.markers[ ... ].marker_event_pulse_width` + ''' + marker_event_pulse_width_units = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.MarkerEventPulseWidthUnits, 1150208) + '''Type: enums.MarkerEventPulseWidthUnits + + Specifies the pulse width units for the Marker Event. This property is valid only when the marker_event_output_behavior property is set to MarkerEventOutputBehavior.PULSE. + + To set this property, the NI-RFSG device must be in the Configuration state. + + **Default Value:** MarkerEventPulseWidthUnits.SECONDS + + **Supported Devices:** PXIe-5820/5830/5831/5832/5840/5841/5842 + + **Related Topics** + + `Marker Events `_ + + **Defined Values**: + + +----------------------------------+----------------+-------------------------------------------------------+ + | Name | Value | Description | + +==================================+================+=======================================================+ + | MarkerEventOutputBehavior.PULSE | 23000 (0x59d8) | Specifies the Marker Event output behavior as pulse. | + +----------------------------------+----------------+-------------------------------------------------------+ + | MarkerEventOutputBehavior.TOGGLE | 23001 (0x59d9) | Specifies the Marker Event output behavior as toggle. | + +----------------------------------+----------------+-------------------------------------------------------+ + + Tip: + This property can be set/get on specific markers within your :py:class:`nirfsg.Session` instance. + Use Python index notation on the repeated capabilities container markers to specify a subset. + + Example: :py:attr:`my_session.markers[ ... ].marker_event_pulse_width_units` + ''' + marker_event_terminal_name = _attributes.AttributeViString(1150115) + '''Type: str + + Returns the name of the fully qualified signal name as a string. + + **Default Values**: + + PXI-5670/5671, PXIe-5672/5673/5673E: /*AWGName*/Marker *X* Event, where *AWGName* is the name of your associated AWG module in MAX and *X* is Marker Event 0 through 3. + + PXIe-5830/5831/5832: /*BasebandModule*/ao/0/Marker *X* Event, where *BasebandModule* is the name of the baseband module of your device in MAX and *X* is Marker Event 0 through 3. + + PXIe-5820/5840/5841: /*ModuleName*/ao/0/Marker *X* Event, where *ModuleName* is the name of your device in MAX and *X* is Marker Event 0 through 3. + + **Supported Devices:** PXI-5670/5671, PXIe-5672/5673/5673E, PXIe-5820/5830/5831/5832/5840/5841/5842 + + **Related Topics** + + `Events `_ + + `Syntax for Terminal Names `_ + + **High-Level Methods**: + + - GetTerminalName + + Tip: + This property can be set/get on specific markers within your :py:class:`nirfsg.Session` instance. + Use Python index notation on the repeated capabilities container markers to specify a subset. + + Example: :py:attr:`my_session.markers[ ... ].marker_event_terminal_name` + ''' + marker_event_toggle_initial_state = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.MarkerEventToggleInitialState, 1150209) + '''Type: enums.MarkerEventToggleInitialState + + Specifies the initial state for the Marker Event when the marker_event_output_behavior property is set to MarkerEventOutputBehavior.TOGGLE. + + To set this property, the NI-RFSG device must be in the Configuration state. + + **Default Value:** MarkerEventToggleInitialState.LOW + + **Supported Devices:** PXIe-5820/5830/5831/5832/5840/5841/5842 + + **Related Topics** + + `Marker Events `_ + + **Defined Values**: + + +------------------------------------+----------------+----------------------------------------------------------------------------------+ + | Name | Value | Description | + +====================================+================+==================================================================================+ + | MarkerEventToggleInitialState.HIGH | 21001 (0x5209) | Specifies the initial state of the Marker Event toggle behavior as digital high. | + +------------------------------------+----------------+----------------------------------------------------------------------------------+ + | MarkerEventToggleInitialState.LOW | 21000 (0x5208) | Specifies the initial state of the Marker Event toggle behavior as digital low. | + +------------------------------------+----------------+----------------------------------------------------------------------------------+ + + Tip: + This property can be set/get on specific markers within your :py:class:`nirfsg.Session` instance. + Use Python index notation on the repeated capabilities container markers to specify a subset. + + Example: :py:attr:`my_session.markers[ ... ].marker_event_toggle_initial_state` + ''' + def __init__(self, session): + super(_RepeatedCapabilityMarkers, self).__init__(session, 'marker') + + def __setattr__(self, key, value): + if key not in dir(self): + raise AttributeError("'{0}' object has no attribute '{1}'".format(type(self).__name__, key)) + object.__setattr__(self, key, value) + + def __getitem__(self, repeated_capability): + super(_RepeatedCapabilityMarkers, self).__setattr__('_repeated_capability', repeated_capability) + return self + + +class _RepeatedCapabilityScriptTriggers(_RepeatedCapabilityAttributeOnlyBase): + digital_edge_script_trigger_edge = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ScriptTrigDigEdgeEdge, 1150021) + '''Type: enums.ScriptTrigDigEdgeEdge + + Specifies the active edge for the Script Trigger. This property is used when the script_trigger_type property is set to digital edge. To set the digital_edge_script_trigger_edge property, the NI-RFSG device must be in the Configuration state. + + **Default Value:** ScriptTrigDigEdgeEdge.RISING + + **Supported Devices:** PXIe-5644/5645/5646, PXI-5670/5671, PXIe-5672/5673/5673E, PXIe-5820/5830/5831/5832/5840/5841/5842/5860 + + **Related Topics** + + `Script Trigger `_ + + `Digital Edge Trigger `_ + + **High-Level Methods**: + + - configure_digital_edge_script_trigger + + **Defined Values**: + + +-------------------------------+---------+-------------------------------------------------------------------------------+ + | Name | Value | Description | + +===============================+=========+===============================================================================+ + | ScriptTrigDigEdgeEdge.FALLING | 1 (0x1) | Asserts the trigger when the signal transitions from high level to low level. | + +-------------------------------+---------+-------------------------------------------------------------------------------+ + | ScriptTrigDigEdgeEdge.RISING | 0 (0x0) | Asserts the trigger when the signal transitions from low level to high level. | + +-------------------------------+---------+-------------------------------------------------------------------------------+ + + Note: + One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. + + Tip: + This property can be set/get on specific script_triggers within your :py:class:`nirfsg.Session` instance. + Use Python index notation on the repeated capabilities container script_triggers to specify a subset. + + Example: :py:attr:`my_session.script_triggers[ ... ].digital_edge_script_trigger_edge` + ''' + digital_edge_script_trigger_source = _attributes.AttributeEnum(_attributes.AttributeViString, enums.ScriptTrigDigEdgeSource, 1150020) + '''Type: enums.ScriptTrigDigEdgeSource + + Specifies the source terminal for the Script Trigger. This property is used when the script_trigger_type property is set to digital edge. To set this property, the NI-RFSG device must be in the Configuration state. + + **Supported Devices:** PXIe-5644/5645/5646, PXI-5670/5671, PXIe-5672/5673/5673E, PXIe-5820/5830/5831/5832/5840/5841/5842/5860 + + **Related Topics** + + `Script Trigger `_ + + `PFI Lines `_ + + `PXI Trigger Lines `_ + + **High-Level Methods**: + + - configure_digital_edge_script_trigger + + **Defined Values**: + + +---------------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | Name | Value | Description | + +=============================================+=============+=========================================================================================================================================+ + | ScriptTrigDigEdgeSource.PFI0 | PFI0 | The trigger is received on PFI 0. | + +---------------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigEdgeSource.PFI1 | PFI1 | The trigger is received on PFI 1. | + +---------------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigEdgeSource.PFI2 | PFI2 | The trigger is received on PFI 2. | + +---------------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigEdgeSource.PFI3 | PFI3 | The trigger is received on PFI 3. | + +---------------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigEdgeSource.PXI_STAR | PXI_Star | The trigger is received on the PXI star trigger line. This value is not valid for the PXIe-5644/5645/5646. | + +---------------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigEdgeSource.PXI_TRIG0 | PXI_Trig0 | The trigger is received on PXI trigger line 0. | + +---------------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigEdgeSource.PXI_TRIG1 | PXI_Trig1 | The trigger is received on PXI trigger line 1. | + +---------------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigEdgeSource.PXI_TRIG2 | PXI_Trig2 | The trigger is received on PXI trigger line 2. | + +---------------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigEdgeSource.PXI_TRIG3 | PXI_Trig3 | The trigger is received on PXI trigger line 3. | + +---------------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigEdgeSource.PXI_TRIG4 | PXI_Trig4 | The trigger is received on PXI trigger line 4. | + +---------------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigEdgeSource.PXI_TRIG5 | PXI_Trig5 | The trigger is received on PXI trigger line 5. | + +---------------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigEdgeSource.PXI_TRIG6 | PXI_Trig6 | The trigger is received on PXI trigger line 6. | + +---------------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigEdgeSource.PXI_TRIG7 | PXI_Trig7 | The trigger is received on PXI trigger line 7. | + +---------------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigEdgeSource.PXIE_DSTARB | PXIe_DStarB | The trigger is received on the PXIe DStar B trigger line. This value is valid on only the PXIe-5820/5830/5831/5832/5840/5841/5842/5860. | + +---------------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigEdgeSource.PULSE_IN | PulseIn | The trigger is received on the PULSE IN terminal. This value is valid on only the PXIe-5842. | + +---------------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigEdgeSource.DIO0 | DIO/PFI0 | The trigger is received on PFI0 from the front panel DIO terminal. | + +---------------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigEdgeSource.DIO1 | DIO/PFI1 | The trigger is received on PFI1 from the front panel DIO terminal. | + +---------------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigEdgeSource.DIO2 | DIO/PFI2 | The trigger is received on PFI2 from the front panel DIO terminal. | + +---------------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigEdgeSource.DIO3 | DIO/PFI3 | The trigger is received on PFI3 from the front panel DIO terminal. | + +---------------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigEdgeSource.DIO4 | DIO/PFI4 | The trigger is received on PFI4 from the front panel DIO terminal. | + +---------------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigEdgeSource.DIO5 | DIO/PFI5 | The trigger is received on PFI5 from the front panel DIO terminal. | + +---------------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigEdgeSource.DIO6 | DIO/PFI6 | The trigger is received on PFI6 from the front panel DIO terminal. | + +---------------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigEdgeSource.DIO7 | DIO/PFI7 | The trigger is received on PFI7 from the front panel DIO terminal. | + +---------------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigEdgeSource.SYNC_SCRIPT_TRIGGER | Sync_Script | The trigger is received on the Sync Script trigger line. This value is valid on only the PXIe-5644/5645/5646. | + +---------------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + + Note: + One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. + + Tip: + This property can be set/get on specific script_triggers within your :py:class:`nirfsg.Session` instance. + Use Python index notation on the repeated capabilities container script_triggers to specify a subset. + + Example: :py:attr:`my_session.script_triggers[ ... ].digital_edge_script_trigger_source` + ''' + digital_level_script_trigger_active_level = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ScriptTrigDigLevelActiveLevel, 1150055) + '''Type: enums.ScriptTrigDigLevelActiveLevel + + Specifies the active level for the Script Trigger. This property is used when the script_trigger_type property is set to ScriptTrigType.DIGITAL_LEVEL. + + **Default Value:** ScriptTrigDigLevelActiveLevel.HIGH + + **Supported Devices:** PXIe-5644/5645/5646, PXI-5670/5671, PXIe-5672/5673/5673E, PXIe-5820/5830/5831/5832/5840/5841/5842/5860 + + + + **Related Topics** + + `Script Trigger `_ + + `Digital Level Trigger `_ + + **Defined Values**: + + +------------------------------------+---------------+--------------------------------------------------+ + | Name | Value | Description | + +====================================+===============+==================================================+ + | ScriptTrigDigLevelActiveLevel.HIGH | 9000 (0x2328) | Trigger when the digital trigger signal is high. | + +------------------------------------+---------------+--------------------------------------------------+ + | ScriptTrigDigLevelActiveLevel.LOW | 9001 (0x2329) | Trigger when the digital trigger signal is low. | + +------------------------------------+---------------+--------------------------------------------------+ + + Tip: + This property can be set/get on specific script_triggers within your :py:class:`nirfsg.Session` instance. + Use Python index notation on the repeated capabilities container script_triggers to specify a subset. + + Example: :py:attr:`my_session.script_triggers[ ... ].digital_level_script_trigger_active_level` + ''' + digital_level_script_trigger_source = _attributes.AttributeEnum(_attributes.AttributeViString, enums.ScriptTrigDigLevelSource, 1150054) + '''Type: enums.ScriptTrigDigLevelSource + + Specifies the source terminal for the Script Trigger. This property is used when the script_trigger_type property is set to ScriptTrigType.DIGITAL_LEVEL. The digital_level_script_trigger_source property is not case-sensitive. + + To set the digital_level_script_trigger_source property, the NI-RFSG device must be in the Configuration state. + + **Supported Devices:** PXIe-5644/5645/5646, PXI-5670/5671, PXIe-5672/5673/5673E, PXIe-5820/5830/5831/5832/5840/5841/5842/5860 + + **Related Topics** + + `Script Trigger `_ + + `PFI Lines `_ + + `PXI Trigger Lines `_ + + **Defined Values**: + + +--------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | Name | Value | Description | + +======================================+=============+=========================================================================================================================================+ + | ScriptTrigDigLevelSource.PFI0 | PFI0 | The trigger is received on PFI 0. | + +--------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigLevelSource.PFI1 | PFI1 | The trigger is received on PFI 1. | + +--------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigLevelSource.PFI2 | PFI2 | The trigger is received on PFI 2. | + +--------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigLevelSource.PFI3 | PFI3 | The trigger is received on PFI 3. | + +--------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigLevelSource.PXI_STAR | PXI_Star | The trigger is received on the PXI star trigger line. This value is not valid for the PXIe-5644/5645/5646. | + +--------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigLevelSource.PXI_TRIG0 | PXI_Trig0 | The trigger is received on PXI trigger line 0. | + +--------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigLevelSource.PXI_TRIG1 | PXI_Trig1 | The trigger is received on PXI trigger line 1. | + +--------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigLevelSource.PXI_TRIG2 | PXI_Trig2 | The trigger is received on PXI trigger line 2. | + +--------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigLevelSource.PXI_TRIG3 | PXI_Trig3 | The trigger is received on PXI trigger line 3. | + +--------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigLevelSource.PXI_TRIG4 | PXI_Trig4 | The trigger is received on PXI trigger line 4. | + +--------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigLevelSource.PXI_TRIG5 | PXI_Trig5 | The trigger is received on PXI trigger line 5. | + +--------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigLevelSource.PXI_TRIG6 | PXI_Trig6 | The trigger is received on PXI trigger line 6. | + +--------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigLevelSource.PXI_TRIG7 | PXI_Trig7 | The trigger is received on PXI trigger line 7. | + +--------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigLevelSource.PXIE_DSTARB | PXIe_DStarB | The trigger is received on the PXIe DStar B trigger line. This value is valid on only the PXIe-5820/5830/5831/5832/5840/5841/5842/5860. | + +--------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigLevelSource.PULSE_IN | PulseIn | The trigger is received on the PULSE IN terminal. This value is valid on only the PXIe-5842. | + +--------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigLevelSource.DIO0 | DIO/PFI0 | The trigger is received on PFI0 from the front panel DIO terminal. | + +--------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigLevelSource.DIO1 | DIO/PFI1 | The trigger is received on PFI1 from the front panel DIO terminal. | + +--------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigLevelSource.DIO2 | DIO/PFI2 | The trigger is received on PFI2 from the front panel DIO terminal. | + +--------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigLevelSource.DIO3 | DIO/PFI3 | The trigger is received on PFI3 from the front panel DIO terminal. | + +--------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigLevelSource.DIO4 | DIO/PFI4 | The trigger is received on PFI4 from the front panel DIO terminal. | + +--------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigLevelSource.DIO5 | DIO/PFI5 | The trigger is received on PFI5 from the front panel DIO terminal. | + +--------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigLevelSource.DIO6 | DIO/PFI6 | The trigger is received on PFI6 from the front panel DIO terminal. | + +--------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigDigLevelSource.DIO7 | DIO/PFI7 | The trigger is received on PFI7 from the front panel DIO terminal. | + +--------------------------------------+-------------+-----------------------------------------------------------------------------------------------------------------------------------------+ + + Note: + One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. + + Tip: + This property can be set/get on specific script_triggers within your :py:class:`nirfsg.Session` instance. + Use Python index notation on the repeated capabilities container script_triggers to specify a subset. + + Example: :py:attr:`my_session.script_triggers[ ... ].digital_level_script_trigger_source` + ''' + exported_script_trigger_output_terminal = _attributes.AttributeEnum(_attributes.AttributeViString, enums.ScriptTrigExportOutputTerm, 1150022) + '''Type: enums.ScriptTrigExportOutputTerm + + Specifies the destination terminal for exporting the Script Trigger. To set this property, the NI-RFSG device must be in the Configuration state. + + **Supported Devices:** PXIe-5644/5645/5646, PXI-5670/5671, PXIe-5672/5673/5673E, PXIe-5820/5830/5831/5832/5840/5841/5842/5860 + + **Related Topics** + + `Script Trigger `_ —Refer to this topic for information about trigger delay. + + `PFI Lines `_ + + `PXI Trigger Lines `_ + + **High-Level Methods**: + + - export_signal + + **Defined Values**: + + +------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | Name | Value | Description | + +==========================================+=============+=================================================================================================================================+ + | ScriptTrigExportOutputTerm.DO_NOT_EXPORT | | The signal is not exported. | + +------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigExportOutputTerm.PFI0 | PFI0 | The signal is exported to the PFI 0 connector. For the PXIe-5841 with PXIe-5655, the signal is exported to the PXIe-5841 PFI 0. | + +------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigExportOutputTerm.PFI1 | PFI1 | The signal is exported to the PFI 1 connector. | + +------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigExportOutputTerm.PFI4 | PFI4 | The signal is exported to the PFI 4 connector. | + +------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigExportOutputTerm.PFI5 | PFI5 | The signal is exported to the PFI 5 connector. | + +------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigExportOutputTerm.PXI_TRIG0 | PXI_Trig0 | The trigger is received on PXI trigger line 0. | + +------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigExportOutputTerm.PXI_TRIG1 | PXI_Trig1 | The trigger is received on PXI trigger line 1. | + +------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigExportOutputTerm.PXI_TRIG2 | PXI_Trig2 | The trigger is received on PXI trigger line 2. | + +------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigExportOutputTerm.PXI_TRIG3 | PXI_Trig3 | The trigger is received on PXI trigger line 3. | + +------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigExportOutputTerm.PXI_TRIG4 | PXI_Trig4 | The trigger is received on PXI trigger line 4. | + +------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigExportOutputTerm.PXI_TRIG5 | PXI_Trig5 | The trigger is received on PXI trigger line 5. | + +------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigExportOutputTerm.PXI_TRIG6 | PXI_Trig6 | The trigger is received on PXI trigger line 6. | + +------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigExportOutputTerm.PXIE_DSTARC | PXIe_DStarC | The signal is exported to the PXIe DStar C trigger line. This value is valid on only the PXIe-5820/5830/5831/5832/5840/5841. | + +------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigExportOutputTerm.DIO0 | DIO/PFI0 | The trigger is received on PFI0 from the front panel DIO terminal. | + +------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigExportOutputTerm.DIO1 | DIO/PFI1 | The trigger is received on PFI1 from the front panel DIO terminal. | + +------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigExportOutputTerm.DIO2 | DIO/PFI2 | The trigger is received on PFI2 from the front panel DIO terminal. | + +------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigExportOutputTerm.DIO3 | DIO/PFI3 | The trigger is received on PFI3 from the front panel DIO terminal. | + +------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigExportOutputTerm.DIO4 | DIO/PFI4 | The trigger is received on PFI4 from the front panel DIO terminal. | + +------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigExportOutputTerm.DIO5 | DIO/PFI5 | The trigger is received on PFI5 from the front panel DIO terminal. | + +------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigExportOutputTerm.DIO6 | DIO/PFI6 | The trigger is received on PFI6 from the front panel DIO terminal. | + +------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigExportOutputTerm.DIO7 | DIO/PFI7 | The trigger is received on PFI7 from the front panel DIO terminal. | + +------------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + + Note: + One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. + + Tip: + This property can be set/get on specific script_triggers within your :py:class:`nirfsg.Session` instance. + Use Python index notation on the repeated capabilities container script_triggers to specify a subset. + + Example: :py:attr:`my_session.script_triggers[ ... ].exported_script_trigger_output_terminal` + ''' + script_trigger_terminal_name = _attributes.AttributeViString(1150116) + '''Type: str + + Returns the name of the fully qualified signal name as a string. + + **Default Values**: + + PXI-5670/5671, PXIe-5672/5673/5673E: /*AWGName*/ScriptTrigger *X*, where *AWGName* is the name of your associated AWG module in MAX and *X* is Script Trigger 0 through 3. + + PXIe-5830/5831/5832: /*BasebandModule*/ao/0/ScriptTrigger *X*, where *BasebandModule* is the name of the baseband module of your device in MAX and *X* is Script Trigger 0 through 3. + + PXIe-5820/5840/5841/5842: /*ModuleName*/ao/0/ScriptTrigger *X*, where *ModuleName* is the name of your device in MAX and *X* is Script Trigger 0 through 3. + + PXIe-5860: /*ModuleName*/ao/*ChannelNumber*/ScriptTrigger *X*, where *ModuleName* is the name of your device in MAX, *ChannelNumber* is the channel number (0 or 1), and *X* is Script Trigger 0 through 3. + + **Supported Devices:** PXI-5670/5671, PXIe-5672/5673/5673E, PXIe-5820/5830/5831/5832/5840/5841/5842/5860 + + **Related Topics** + + `Triggers `_ + + `Syntax for Terminal Names `_ + + **High-Level Methods**: + + - GetTerminalName + + Tip: + This property can be set/get on specific script_triggers within your :py:class:`nirfsg.Session` instance. + Use Python index notation on the repeated capabilities container script_triggers to specify a subset. + + Example: :py:attr:`my_session.script_triggers[ ... ].script_trigger_terminal_name` + ''' + script_trigger_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ScriptTrigType, 1150019) + '''Type: enums.ScriptTrigType + + Specifies the Script Trigger type. Depending upon the value of this property, more properties may be needed to fully configure the trigger. To set this property, the NI-RFSG device must be in the Configuration state. + + **Default Value:** ScriptTrigType.NONE + + **Supported Devices:** PXIe-5644/5645/5646, PXI-5670/5671, PXIe-5672/5673/5673E, PXIe-5820/5830/5831/5832/5840/5841/5842/5860 + + **Related Topics** + + `Script Trigger `_ + + `Trigger Types `_ + + **High-Level Methods**: + + - configure_digital_edge_script_trigger + + **Defined Values**: + + +------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | Value | Description | + +==============================+=======================================================================================================================================================================================================================================================================+ + | ScriptTrigType.NONE | No trigger is configured. Signal generation starts immediately. | + +------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigType.DIGITAL_EDGE | The data operation does not start until a digital edge is detected. The source of the digital edge is specified with the digital_edge_start_trigger_source property, and the active edge is specified with the digital_edge_start_trigger_edge property. | + +------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigType.DIGITAL_LEVEL | The data operation does not start until the digital level is detected. The source of the digital level is specified in the digital_level_script_trigger_source property, and the active level is specified in the digital_level_script_trigger_active_level property. | + +------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | ScriptTrigType.SOFTWARE | The data operation does not start until a software trigger occurs. You can create a software event by calling the send_software_edge_trigger method. | + +------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + + Note: + One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. + + Tip: + This property can be set/get on specific script_triggers within your :py:class:`nirfsg.Session` instance. + Use Python index notation on the repeated capabilities container script_triggers to specify a subset. + + Example: :py:attr:`my_session.script_triggers[ ... ].script_trigger_type` + ''' + def __init__(self, session): + super(_RepeatedCapabilityScriptTriggers, self).__init__(session, 'scripttrigger') + + def __setattr__(self, key, value): + if key not in dir(self): + raise AttributeError("'{0}' object has no attribute '{1}'".format(type(self).__name__, key)) + object.__setattr__(self, key, value) + + def __getitem__(self, repeated_capability): + super(_RepeatedCapabilityScriptTriggers, self).__setattr__('_repeated_capability', repeated_capability) + return self + + +class _RepeatedCapabilityWaveform(_RepeatedCapabilityAttributeOnlyBase): + waveform_iq_rate = _attributes.AttributeViReal64(1150263) + '''Type: float + + Specifies the I/Q rate of the waveform. To set this property, the NI-RFSG device must be in the Configuration state. + + **Supported Devices:** PXIe-5820/5830/5831/5832/5840/5841/5842/5860 + + **Related Topics** + + `Streaming `_ + + `Assigning Properties or Properties to a Waveform `_—Refer to this topic for more information about using this property to associate an I/Q rate with a waveform. + + `Digital Upconverter `_ + + Tip: + This property can be set/get on specific waveform within your :py:class:`nirfsg.Session` instance. + Use Python index notation on the repeated capabilities container waveform to specify a subset. + + Example: :py:attr:`my_session.waveform[ ... ].waveform_iq_rate` + ''' + waveform_papr = _attributes.AttributeViReal64(1150266) + '''Type: float + + Specifies the peak-to-average power ratio (PAPR). + + **Supported Devices:** PXIe-5820/5830/5831/5832/5840/5841/5842/5860 + + Tip: + This property can be set/get on specific waveform within your :py:class:`nirfsg.Session` instance. + Use Python index notation on the repeated capabilities container waveform to specify a subset. + + Example: :py:attr:`my_session.waveform[ ... ].waveform_papr` + ''' + waveform_rf_blanking = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.RFBlanking, 1150278) + '''Type: enums.RFBlanking + + **Defined Values**: + + Name (Value): Description + + RFBlanking.DISABLE (0): RF blanking is disabled. + + RFBlanking.ENABLE (1): RF blanking is enabled. + + **Default Value:** RFBlanking.DISABLE + + **Supported Devices:** PXIe-5820/5830/5831/5832/5840/5841/5842 + + **Related Topics** + + `Marker Events `_ + + Enables or disables RF blanking. + + +-----------------------------------------------------------------------------------+----------------------+-----------------------------------------------------------------------------------------------------------+ + | rf_blanking_source | waveform_rf_blanking | Behaviour | + +===================================================================================+======================+===========================================================================================================+ + | "" (empty string) | RFBlanking.DISABLE | No blanking performed. | + +-----------------------------------------------------------------------------------+----------------------+-----------------------------------------------------------------------------------------------------------+ + | "" (empty string) | RFBlanking.ENABLE | Blanking performed based on burst start and stop values and blanking source set to private marker. | + +-----------------------------------------------------------------------------------+----------------------+-----------------------------------------------------------------------------------------------------------+ + | NIRFSG_VAL_MARKER0, NIRFSG_VAL_MARKER1, NIRFSG_VAL_MARKER2, or NIRFSG_VAL_MARKER3 | RFBlanking.DISABLE | Blanking performed based on the marker locations for the marker that the user set in the blanking source. | + +-----------------------------------------------------------------------------------+----------------------+-----------------------------------------------------------------------------------------------------------+ + | NIRFSG_VAL_MARKER0, NIRFSG_VAL_MARKER1, NIRFSG_VAL_MARKER2, or NIRFSG_VAL_MARKER3 | RFBlanking.ENABLE | Error is shown. | + +-----------------------------------------------------------------------------------+----------------------+-----------------------------------------------------------------------------------------------------------+ + + Note: For PXIe-5830/5831/5832: The RF Blanking reserves a PXI trigger line. If you are calling any reset or `niRFSA_reset `_ on the same device, NI recommends calling it before committing blanking properties. Alternatively, you can call ResetWithOptions or `niRFSA_ResetWithOptions `_. Select **Routes** in the **steps to omit** parameter. + + Note: + One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. + + Tip: + This property can be set/get on specific waveform within your :py:class:`nirfsg.Session` instance. + Use Python index notation on the repeated capabilities container waveform to specify a subset. + + Example: :py:attr:`my_session.waveform[ ... ].waveform_rf_blanking` + ''' + waveform_runtime_scaling = _attributes.AttributeViReal64(1150265) + '''Type: float + + Specifies the waveform runtime scaling. The waveform runtime scaling is applied to the waveform data before any other signal processing. + + **Units**: dB + + **Supported Devices:** PXIe-5820/5830/5831/5832/5840/5841/5842/5860, PXIe-5841 with PXIe-5655 + + Tip: + This property can be set/get on specific waveform within your :py:class:`nirfsg.Session` instance. + Use Python index notation on the repeated capabilities container waveform to specify a subset. + + Example: :py:attr:`my_session.waveform[ ... ].waveform_runtime_scaling` + ''' + waveform_signal_bandwidth = _attributes.AttributeViReal64(1150264) + '''Type: float + + Specifies the bandwidth of the arbitrary signal. This value must be less than or equal to (0.8× iq_rate). + + **Units**: hertz (Hz) + + **Supported Devices:** PXIe-5820/5830/5831/5832/5840/5841/5842/5860 + + Tip: + This property can be set/get on specific waveform within your :py:class:`nirfsg.Session` instance. + Use Python index notation on the repeated capabilities container waveform to specify a subset. + + Example: :py:attr:`my_session.waveform[ ... ].waveform_signal_bandwidth` + ''' + waveform_waveform_size = _attributes.AttributeViInt32(1150297) + '''Type: int + + Specifies the size of the waveform specified by an active channel. + + **Supported Devices:** PXIe-5820/5830/5831/5832/5840/5841/5841 with PXIe-5655/5842/5860 + + Tip: + This property can be set/get on specific waveform within your :py:class:`nirfsg.Session` instance. + Use Python index notation on the repeated capabilities container waveform to specify a subset. + + Example: :py:attr:`my_session.waveform[ ... ].waveform_waveform_size` + ''' + def __init__(self, session): + super(_RepeatedCapabilityWaveform, self).__init__(session, 'waveform::') + + def __setattr__(self, key, value): + if key not in dir(self): + raise AttributeError("'{0}' object has no attribute '{1}'".format(type(self).__name__, key)) + object.__setattr__(self, key, value) def __getitem__(self, repeated_capability): - '''Set/get properties or call methods with a repeated capability (i.e. channels)''' - rep_caps_list = _converters.convert_repeated_capabilities(repeated_capability, self._prefix) - complete_rep_cap_list = [current_rep_cap + self._separator + rep_cap for current_rep_cap in self._current_repeated_capability_list for rep_cap in rep_caps_list] - - return _SessionBase( - repeated_capability_list=complete_rep_cap_list, - all_channels_in_session=self._session._all_channels_in_session, - interpreter=self._session._interpreter, - freeze_it=True - ) + super(_RepeatedCapabilityWaveform, self).__setattr__('_repeated_capability', repeated_capability) + return self + + +class _RepeatedCapabilityDeembeddingPort(_RepeatedCapabilityAttributeOnlyBase): + deembedding_compensation_gain = _attributes.AttributeViReal64(1150289) + '''Type: float + + Returns the de-embedding gain applied to compensate for the mismatch on the specified port. If de-embedding is enabled, NI-RFSG uses the returned compensation gain to remove the effects of the external network between the instrument and the DUT. + + **Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860 + + Tip: + This property can be set/get on specific deembedding_port within your :py:class:`nirfsg.Session` instance. + Use Python index notation on the repeated capabilities container deembedding_port to specify a subset. + + Example: :py:attr:`my_session.deembedding_port[ ... ].deembedding_compensation_gain` + ''' + deembedding_selected_table = _attributes.AttributeViString(1150253) + '''Type: str + + Selects the de-embedding table to apply to the measurements on the specified port. + + To use this property, you must use the channelName parameter of the _set_attribute_vi_string method to specify the name of the port to configure for de-embedding. + + If de-embedding is enabled, NI-RFSG uses the specified table to remove the effects of the external network between the instrument and the DUT. + + Use the create deembedding sparameter table array method to create tables. + + **Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860 + + Tip: + This property can be set/get on specific deembedding_port within your :py:class:`nirfsg.Session` instance. + Use Python index notation on the repeated capabilities container deembedding_port to specify a subset. + + Example: :py:attr:`my_session.deembedding_port[ ... ].deembedding_selected_table` + ''' + deembedding_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.DeembeddingTypeAttrVals, 1150252) + '''Type: enums.DeembeddingTypeAttrVals + + Specifies the type of de-embedding to apply to measurements on the specified port. + + To use this property, you must use the channelName parameter of the _set_attribute_vi_int32 method to specify the name of the port to configure for de-embedding. + + If you set this property to DeembeddingTypeAttrVals.DEEMBEDDING_TYPE_SCALAR or DeembeddingTypeAttrVals.DEEMBEDDING_TYPE_VECTOR, NI-RFSG adjusts the instrument settings and the returned data to remove the effects of the external network between the instrument and the DUT. + + **Default Value**: DeembeddingTypeAttrVals.DEEMBEDDING_TYPE_SCALAR + + **Valid Values for PXIe-5830/5832/5840/5841/5842/5860** : DeembeddingTypeAttrVals.DEEMBEDDING_TYPE_SCALAR or DeembeddingTypeAttrVals.DEEMBEDDING_TYPE_NONE + + **Valid Values for PXIe-5831** DeembeddingTypeAttrVals.DEEMBEDDING_TYPE_SCALAR, DeembeddingTypeAttrVals.DEEMBEDDING_TYPE_VECTOR, or DeembeddingTypeAttrVals.DEEMBEDDING_TYPE_NONE. DeembeddingTypeAttrVals.DEEMBEDDING_TYPE_VECTOR is only supported for TRX Ports in a Semiconductor Test System (STS). + + **Supported Devices**: PXIe-5830/5831/5832/5840/5841/5842/5860 + + **Defined Values**: + +-------------------------------------------------+----------------+------------------------------------------------------------------------+ + | Name | Value | Description | + +=================================================+================+========================================================================+ + | DeembeddingTypeAttrVals.DEEMBEDDING_TYPE_NONE | 25000 (0x61a8) | De-embedding is not applied to the measurement. | + +-------------------------------------------------+----------------+------------------------------------------------------------------------+ + | DeembeddingTypeAttrVals.DEEMBEDDING_TYPE_SCALAR | 25001 (0x61a9) | De-embeds the measurement using only the gain term. | + +-------------------------------------------------+----------------+------------------------------------------------------------------------+ + | DeembeddingTypeAttrVals.DEEMBEDDING_TYPE_VECTOR | 25002 (0x61aa) | De-embeds the measurement using the gain term and the reflection term. | + +-------------------------------------------------+----------------+------------------------------------------------------------------------+ -# This is a very simple context manager we can use when we need to set/get attributes -# or call functions from _SessionBase that require no channels. It is tied to the specific -# implementation of _SessionBase and how repeated capabilities are handled. -class _NoChannel(object): + Tip: + This property can be set/get on specific deembedding_port within your :py:class:`nirfsg.Session` instance. + Use Python index notation on the repeated capabilities container deembedding_port to specify a subset. + + Example: :py:attr:`my_session.deembedding_port[ ... ].deembedding_type` + ''' def __init__(self, session): - self._session = session + super(_RepeatedCapabilityDeembeddingPort, self).__init__(session, '') - def __enter__(self): - self._repeated_capability_cache = self._session._repeated_capability - self._session._repeated_capability = '' + def __setattr__(self, key, value): + if key not in dir(self): + raise AttributeError("'{0}' object has no attribute '{1}'".format(type(self).__name__, key)) + object.__setattr__(self, key, value) - def __exit__(self, exc_type, exc_value, traceback): - self._session._repeated_capability = self._repeated_capability_cache + def __getitem__(self, repeated_capability): + super(_RepeatedCapabilityDeembeddingPort, self).__setattr__('_repeated_capability', repeated_capability) + return self class _SessionBase(object): @@ -1318,15 +2153,56 @@ class _SessionBase(object): | Sync_Script | The trigger is received on the Sync Script trigger line. This value is valid on only the PXIe-5644/5645/5646. | +----------------+-----------------------------------------------------------------------------------------------------------------------------------------+ - Tip: - This property can be set/get on specific script_triggers within your :py:class:`nirfsg.Session` instance. - Use Python index notation on the repeated capabilities container script_triggers to specify a subset. + **Supported Devices**: PXIe-5820/5830/5831/5832/5840/5841/5842/5860 - Example: :py:attr:`my_session.script_triggers[ ... ].digital_edge_script_trigger_source` + **Related Topics** - To set/get on all script_triggers, you can call the property directly on the :py:class:`nirfsg.Session`. + `PXIe-5830 Frequency and Bandwidth Selection `_ + + `PXIe-5831/5832 Frequency and Bandwidth Selection `_ + + `PXIe-5841 Frequency and Bandwidth Selection `_ + ''' + device_temperature = _attributes.AttributeViReal64(1150017) + '''Type: float + + Returns the device temperature. If the NI-RFSG session is controlling multiple devices, this property returns the temperature of the primary NI RF device. The NI-RFSG session is opened using the primary RF device name. + + Serial signals between the sensor and the system control unit could modulate the signal being generated, thus causing phase spurs. After the device thoroughly warms up, its temperature varies only slightly (less than 1 degree Celsius) and slowly, and it is not necessary to constantly poll this temperature sensor. + + PXIe-5644/5645/5646, PXIe-5820/5840/5841: If you query this property during RF list mode, list steps may take longer to complete during list execution. + + PXIe-5830/5831/5832: To use this property, you must first set the channelName parameter of the _set_attribute_vi_real64 method to using the appropriate string for your instrument configuration. Setting the _set_attribute_vi_real64 method is not required for the PXIe-3621/3622. Refer to the following table to determine which strings are valid for your configuration. + + **Units**: degrees Celsius (°C) + + **Supported Devices:** PXI-5610, PXIe-5611, PXIe-5644/5645/5646, PXI/PXIe-5650/5651/5652, PXIe-5653/5654/5654 with PXIe-5696, PXI-5670/5671, PXIe-5672/5673/5673E, PXIe-5820/5830/5831/5832/5840/5841/5842/5860 + + **Related Topics** + + `Temperature Monitoring `_ + + `Thermal Shutdown `_ - Example: :py:attr:`my_session.digital_edge_script_trigger_source` + +----------------------------+--------------------------+-------------------------+ + | Hardware Module | TRX Port Type | Active Channel String | + +============================+==========================+=========================+ + | PXIe-3621/3622 | — | if or "" (empty string) | + +----------------------------+--------------------------+-------------------------+ + | PXIe-5820 | — | fpga | + +----------------------------+--------------------------+-------------------------+ + | First connected mmRH-5582 | DIRECT TRX PORTS Only | rf0 | + +----------------------------+--------------------------+-------------------------+ + | First connected mmRH-5582 | SWITCHED TRX PORTS [0-7] | rf0switch0 | + +----------------------------+--------------------------+-------------------------+ + | First connected mmRH-5582 | SWITCHED TRX PORTS [0-7] | rf0switch1 | + +----------------------------+--------------------------+-------------------------+ + | Second connected mmRH-5582 | DIRECT TRX PORTS Only | rf1 | + +----------------------------+--------------------------+-------------------------+ + | Second connected mmRH-5582 | SWITCHED TRX PORTS [0-7] | rf1switch0 | + +----------------------------+--------------------------+-------------------------+ + | Second connected mmRH-5582 | SWITCHED TRX PORTS [0-7] | rf1switch1 | + +----------------------------+--------------------------+-------------------------+ ''' digital_edge_start_trigger_edge = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.StartTrigDigEdgeEdge, 1250459) '''Type: enums.StartTrigDigEdgeEdge @@ -1475,6 +2351,8 @@ class _SessionBase(object): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. ''' + + digital_level_script_trigger_active_level = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ScriptTrigDigLevelActiveLevel, 1150055) '''Type: enums.ScriptTrigDigLevelActiveLevel @@ -1878,6 +2756,57 @@ class _SessionBase(object): - export_signal + **Defined Values**: + + +-----------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | Name | Value | Description | + +=========================================+=============+=================================================================================================================================+ + | DoneEventExportOutputTerm.DO_NOT_EXPORT | | The signal is not exported. | + +-----------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | DoneEventExportOutputTerm.PFI0 | PFI0 | The signal is exported to the PFI 0 connector. For the PXIe-5841 with PXIe-5655, the signal is exported to the PXIe-5841 PFI 0. | + +-----------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | DoneEventExportOutputTerm.PFI1 | PFI1 | The signal is exported to the PFI 1 connector. | + +-----------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | DoneEventExportOutputTerm.PFI4 | PFI4 | The signal is exported to the PFI 4 connector. | + +-----------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | DoneEventExportOutputTerm.PFI5 | PFI5 | The signal is exported to the PFI 5 connector. | + +-----------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | DoneEventExportOutputTerm.PXI_TRIG0 | PXI_Trig0 | The trigger is received on PXI trigger line 0. | + +-----------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | DoneEventExportOutputTerm.PXI_TRIG1 | PXI_Trig1 | The trigger is received on PXI trigger line 1. | + +-----------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | DoneEventExportOutputTerm.PXI_TRIG2 | PXI_Trig2 | The trigger is received on PXI trigger line 2. | + +-----------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | DoneEventExportOutputTerm.PXI_TRIG3 | PXI_Trig3 | The trigger is received on PXI trigger line 3. | + +-----------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | DoneEventExportOutputTerm.PXI_TRIG4 | PXI_Trig4 | The trigger is received on PXI trigger line 4. | + +-----------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | DoneEventExportOutputTerm.PXI_TRIG5 | PXI_Trig5 | The trigger is received on PXI trigger line 5. | + +-----------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | DoneEventExportOutputTerm.PXI_TRIG6 | PXI_Trig6 | The trigger is received on PXI trigger line 6. | + +-----------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | DoneEventExportOutputTerm.PXIE_DSTARC | PXIe_DStarC | The signal is exported to the PXIe DStar C trigger line. This value is valid on only the PXIe-5820/5830/5831/5832/5840/5841. | + +-----------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | DoneEventExportOutputTerm.DIO0 | DIO/PFI0 | The trigger is received on PFI0 from the front panel DIO terminal. | + +-----------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | DoneEventExportOutputTerm.DIO1 | DIO/PFI1 | The trigger is received on PFI1 from the front panel DIO terminal. | + +-----------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | DoneEventExportOutputTerm.DIO2 | DIO/PFI2 | The trigger is received on PFI2 from the front panel DIO terminal. | + +-----------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | DoneEventExportOutputTerm.DIO3 | DIO/PFI3 | The trigger is received on PFI3 from the front panel DIO terminal. | + +-----------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | DoneEventExportOutputTerm.DIO4 | DIO/PFI4 | The trigger is received on PFI4 from the front panel DIO terminal. | + +-----------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | DoneEventExportOutputTerm.DIO5 | DIO/PFI5 | The trigger is received on PFI5 from the front panel DIO terminal. | + +-----------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | DoneEventExportOutputTerm.DIO6 | DIO/PFI6 | The trigger is received on PFI6 from the front panel DIO terminal. | + +-----------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + | DoneEventExportOutputTerm.DIO7 | DIO/PFI7 | The trigger is received on PFI7 from the front panel DIO terminal. | + +-----------------------------------------+-------------+---------------------------------------------------------------------------------------------------------------------------------+ + + Note: + One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. +======= **Possible Values**: +---------------+---------------------------------------------------------------------------------------------------------------------------------+ @@ -2110,6 +3039,9 @@ class _SessionBase(object): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. ''' + exported_started_event_output_terminal = _attributes.AttributeEnum(_attributes.AttributeViString, enums.StartedEventExportOutputTerm, 1150065) + '''Type: enums.StartedEventExportOutputTerm +======= exported_script_trigger_output_terminal = _attributes.AttributeViString(1150022) '''Type: str @@ -3317,6 +4249,20 @@ class _SessionBase(object): | Secondary | Uses the PXIe-5831/5840 internal LO as the LO source. This value is valid only on the PXIe-5831 with PXIe-5653 and PXIe-5832 with PXIe-5653. | +------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + +---------------------------------+------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | Name | Value | Description | + +=================================+========================+==================================================================================================================================================================================================================================================================+ + | LoSource.AUTOMATIC_SG_SA_SHARED | Automatic_SG_SA_Shared | NI-RFSG internally makes the configuration to share the LO between NI-RFSA and NI-RFSG. This value is valid only on the PXIe-5820/5830/5831/5832/5840/5841/5842. | + +---------------------------------+------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | LoSource.LO_IN | LO_In | Uses an external LO as the LO source. Connect a signal to the LO IN connector on the device and use the upconverter_center_frequency property to specify the LO frequency. | + +---------------------------------+------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | LoSource.ONBOARD | Onboard | Uses an internal LO as the LO source. If you specify an internal LO source, the LO is generated inside the device itself. | + +---------------------------------+------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | LoSource.SG_SA_SHARED | SG_SA_Shared | Uses the same internal LO during NI-RFSA and NI-RFSG sessions. NI-RFSG selects an internal synthesizer and the synthesizer signal is switched to both the RF In and RF Out mixers. This value is valid only on the PXIe-5830/5831/5832/5841 with PXIe-5655/5842. | + +---------------------------------+------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | LoSource.SECONDARY | Secondary | Uses the PXIe-5831/5840 internal LO as the LO source. This value is valid only on the PXIe-5831 with PXIe-5653 and PXIe-5832 with PXIe-5653. | + +---------------------------------+------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +======= Note: For the PXIe-5841 with PXIe-5655, RF list mode is not supported when this property is set to NIRFSG_VAL_LO_SOURCE_SG_SA_SHARED_STR. Note: @@ -3474,42 +4420,33 @@ class _SessionBase(object): To set/get on all markers, you can call the property directly on the :py:class:`nirfsg.Session`. - Example: :py:attr:`my_session.marker_event_terminal_name` + Note: For the PXIe-5841 with PXIe-5655, RF list mode is not supported when this property is set to LoSource.SG_SA_SHARED. ''' - marker_event_toggle_initial_state = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.MarkerEventToggleInitialState, 1150209) - '''Type: enums.MarkerEventToggleInitialState - - Specifies the initial state for the Marker Event when the marker_event_output_behavior property is set to MarkerEventOutputBehavior.TOGGLE. - - To set this property, the NI-RFSG device must be in the Configuration state. + lo_temperature = _attributes.AttributeViReal64(1150075) + '''Type: float - **Default Value:** MarkerEventToggleInitialState.LOW + Returns the LO module temperature in degrees Celsius. - **Supported Devices:** PXIe-5820/5830/5831/5832/5840/5841/5842 + PXIe-5840/5841: If you query this property during RF list mode, list steps may take longer to complete during list execution. - **Related Topics** + **Units**: degrees Celsius (°C) - `Marker Events `_ + **Supported Devices:** PXIe-5673/5673E, PXIe-5840/5841/5842 + ''' + lo_vco_frequency_step_size = _attributes.AttributeViReal64(1150257) + '''Type: float - **Defined Values**: + Specifies the step size for tuning the internal voltage-controlled oscillator (VCO) used to generate the LO signal. - +------------------------------------+----------------+----------------------------------------------------------------------------------+ - | Name | Value | Description | - +====================================+================+==================================================================================+ - | MarkerEventToggleInitialState.HIGH | 21001 (0x5209) | Specifies the initial state of the Marker Event toggle behavior as digital high. | - +------------------------------------+----------------+----------------------------------------------------------------------------------+ - | MarkerEventToggleInitialState.LOW | 21000 (0x5208) | Specifies the initial state of the Marker Event toggle behavior as digital low. | - +------------------------------------+----------------+----------------------------------------------------------------------------------+ + **Valid Values**: - Tip: - This property can be set/get on specific markers within your :py:class:`nirfsg.Session` instance. - Use Python index notation on the repeated capabilities container markers to specify a subset. + LO1: 1 Hz to 50 MHz - Example: :py:attr:`my_session.markers[ ... ].marker_event_toggle_initial_state` + LO2: 1 Hz to 100 MHz - To set/get on all markers, you can call the property directly on the :py:class:`nirfsg.Session`. + **Default Value**: 1 MHz - Example: :py:attr:`my_session.marker_event_toggle_initial_state` + **Supported Devices**: PXIe-5830/5831/5832 ''' memory_size = _attributes.AttributeViInt64(1150061) '''Type: int @@ -4397,6 +5334,7 @@ class _SessionBase(object): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. ''' + script_trigger_terminal_name = _attributes.AttributeViString(1150116) '''Type: str @@ -5119,6 +6057,7 @@ class _SessionBase(object): Note: This property is read/write on the PXI-5610 and PXIe-5611 and is read-only on the PXIe-5644/5645/5646, PXI-5670/5671, PXIe-5672/5673/5673E, and PXIe-5820/5830/5831/5832/5840/5841/5842/5860. ''' + waveform_iq_rate = _attributes.AttributeViReal64(1150263) '''Type: float @@ -5388,10 +6327,10 @@ def __init__(self, repeated_capability_list, all_channels_in_session, interprete self._param_list = ', '.join(param_list) # Instantiate any repeated capability objects - self.markers = _RepeatedCapabilities(self, 'marker', repeated_capability_list) - self.script_triggers = _RepeatedCapabilities(self, 'scripttrigger', repeated_capability_list) - self.waveform = _RepeatedCapabilities(self, 'waveform::', repeated_capability_list) - self.deembedding_port = _RepeatedCapabilities(self, '', repeated_capability_list) + self.markers = _RepeatedCapabilityMarkers(self) + self.script_triggers = _RepeatedCapabilityScriptTriggers(self) + self.waveform = _RepeatedCapabilityWaveform(self) + self.deembedding_port = _RepeatedCapabilityDeembeddingPort(self) # Finally, set _is_frozen to True which is used to prevent clients from accidentally adding # members when trying to set a property with a typo. diff --git a/generated/nirfsg/nirfsg/unit_tests/test_nirfsg.py b/generated/nirfsg/nirfsg/unit_tests/test_nirfsg.py new file mode 100644 index 000000000..ca3405186 --- /dev/null +++ b/generated/nirfsg/nirfsg/unit_tests/test_nirfsg.py @@ -0,0 +1,55 @@ +import nirfsg + +from unittest.mock import MagicMock +from unittest.mock import patch + +import _mock_helper + +SESSION_NUM_FOR_TEST = 42 + + +class TestSession: + + class PatchedLibraryInterpreter(nirfsg._library_interpreter.LibraryInterpreter): + def __init__(self, encoding): + for f in dir(self): + if not f.startswith("_") and f not in {'get_session_handle', 'set_session_handle'}: + setattr(self, f, MagicMock(spec_set=getattr(self, f), side_effect=_mock_helper.MockFunctionCallError(f))) + + def setup_method(self, method): + self.patched_library_interpreter = self.PatchedLibraryInterpreter(None) + self.patched_library_interpreter_ctor = patch('nirfsg.session._library_interpreter.LibraryInterpreter', return_value=self.patched_library_interpreter) + self.patched_library_interpreter_ctor.start() + + # We don't actually call into the nitclk DLL, but we do need to mock the function since it is called + self.tclk_patched_library_singleton_get = patch('nitclk._library_interpreter._library_singleton.get', return_value=None) + self.tclk_patched_library_singleton_get.start() + + def interpreter_init(*args, **kwargs): + self.patched_library_interpreter._close_on_exit = True + return SESSION_NUM_FOR_TEST + + self.patched_library_interpreter.init_with_options.side_effect = interpreter_init + self.patched_library_interpreter.close.side_effect = [None] + + # Mock lock/unlock + self.patched_library_interpreter.lock.side_effect = lambda *args: None + self.patched_library_interpreter.unlock.side_effect = lambda *args: None + + def teardown_method(self, method): + self.patched_library_interpreter_ctor.stop() + + def test_attribute_get_for_repeated_capability_custom_object(self): + string = 'markerterminal' + self.patched_library_interpreter.get_attribute_vi_string.side_effect = [string] + with nirfsg.Session('dev1', id_query=False, reset_device=False) as session: + value = session.markers['0'].marker_event_terminal_name # noqa: F841 + # Verify that the repeated capability string is '0' + self.patched_library_interpreter.get_attribute_vi_string.assert_called_once_with('marker0', 1150115) + + def test_invalid_attribute_set_for_repeated_capability_custom_object(self): + with nirfsg.Session('dev1', id_query=False, reset_device=False) as session: + try: + session.deembedding_port['port0'].amplitude_settling = 2 + except AttributeError: + pass diff --git a/src/nifake/metadata/attributes.py b/src/nifake/metadata/attributes.py index 92c59e145..b78d82bb0 100644 --- a/src/nifake/metadata/attributes.py +++ b/src/nifake/metadata/attributes.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# This file is generated from NI-FAKE API metadata version 24.8.0f100 +# This file is generated from NI-FAKE API metadata version 25.5.0d9999 attributes = { 1000000: { 'access': 'read-write', diff --git a/src/nifake/metadata/config.py b/src/nifake/metadata/config.py index cad911ac9..0cc90b839 100644 --- a/src/nifake/metadata/config.py +++ b/src/nifake/metadata/config.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -# This file is generated from NI-FAKE API metadata version 24.8.0f100 +# This file is generated from NI-FAKE API metadata version 25.5.0d9999 config = { - 'api_version': '24.8.0f100', + 'api_version': '25.5.0d9999', 'c_function_prefix': 'niFake_', 'close_function': 'close', 'context_manager_name': { @@ -72,6 +72,9 @@ 'python_name': 'instruments' } ], + 'repeated_capability_object_type': { + 'python': 'session' + }, 'session_class_description': 'An NI-FAKE session to a fake MI driver whose sole purpose is to test nimi-python code generation', 'session_handle_parameter_name': 'vi', 'uses_nitclk': True diff --git a/src/nifake/metadata/enums.py b/src/nifake/metadata/enums.py index 97ebe3add..f3e05575a 100644 --- a/src/nifake/metadata/enums.py +++ b/src/nifake/metadata/enums.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# This file is generated from NI-FAKE API metadata version 24.8.0f100 +# This file is generated from NI-FAKE API metadata version 25.5.0d9999 enums = { 'AltColor': { 'values': [ diff --git a/src/nifake/metadata/functions.py b/src/nifake/metadata/functions.py index 24d8ebd8c..8f06bc400 100644 --- a/src/nifake/metadata/functions.py +++ b/src/nifake/metadata/functions.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# This file is generated from NI-FAKE API metadata version 24.8.0f100 +# This file is generated from NI-FAKE API metadata version 25.5.0d9999 functions = { 'Abort': { 'codegen_method': 'public', diff --git a/src/nirfsg/metadata/config.py b/src/nirfsg/metadata/config.py index a4b234007..62597d10c 100644 --- a/src/nirfsg/metadata/config.py +++ b/src/nirfsg/metadata/config.py @@ -39,6 +39,9 @@ } }, 'module_name': 'nirfsg', + 'repeated_capability_object_type': { + 'python': 'applicable-attributes-only' + }, 'repeated_capabilities': [ { 'prefix': 'marker', diff --git a/src/nirfsg/unit_tests/test_nirfsg.py b/src/nirfsg/unit_tests/test_nirfsg.py new file mode 100644 index 000000000..ca3405186 --- /dev/null +++ b/src/nirfsg/unit_tests/test_nirfsg.py @@ -0,0 +1,55 @@ +import nirfsg + +from unittest.mock import MagicMock +from unittest.mock import patch + +import _mock_helper + +SESSION_NUM_FOR_TEST = 42 + + +class TestSession: + + class PatchedLibraryInterpreter(nirfsg._library_interpreter.LibraryInterpreter): + def __init__(self, encoding): + for f in dir(self): + if not f.startswith("_") and f not in {'get_session_handle', 'set_session_handle'}: + setattr(self, f, MagicMock(spec_set=getattr(self, f), side_effect=_mock_helper.MockFunctionCallError(f))) + + def setup_method(self, method): + self.patched_library_interpreter = self.PatchedLibraryInterpreter(None) + self.patched_library_interpreter_ctor = patch('nirfsg.session._library_interpreter.LibraryInterpreter', return_value=self.patched_library_interpreter) + self.patched_library_interpreter_ctor.start() + + # We don't actually call into the nitclk DLL, but we do need to mock the function since it is called + self.tclk_patched_library_singleton_get = patch('nitclk._library_interpreter._library_singleton.get', return_value=None) + self.tclk_patched_library_singleton_get.start() + + def interpreter_init(*args, **kwargs): + self.patched_library_interpreter._close_on_exit = True + return SESSION_NUM_FOR_TEST + + self.patched_library_interpreter.init_with_options.side_effect = interpreter_init + self.patched_library_interpreter.close.side_effect = [None] + + # Mock lock/unlock + self.patched_library_interpreter.lock.side_effect = lambda *args: None + self.patched_library_interpreter.unlock.side_effect = lambda *args: None + + def teardown_method(self, method): + self.patched_library_interpreter_ctor.stop() + + def test_attribute_get_for_repeated_capability_custom_object(self): + string = 'markerterminal' + self.patched_library_interpreter.get_attribute_vi_string.side_effect = [string] + with nirfsg.Session('dev1', id_query=False, reset_device=False) as session: + value = session.markers['0'].marker_event_terminal_name # noqa: F841 + # Verify that the repeated capability string is '0' + self.patched_library_interpreter.get_attribute_vi_string.assert_called_once_with('marker0', 1150115) + + def test_invalid_attribute_set_for_repeated_capability_custom_object(self): + with nirfsg.Session('dev1', id_query=False, reset_device=False) as session: + try: + session.deembedding_port['port0'].amplitude_settling = 2 + except AttributeError: + pass diff --git a/tox-travis.ini b/tox-travis.ini index c7b847edd..f24d1a3e3 100644 --- a/tox-travis.ini +++ b/tox-travis.ini @@ -77,6 +77,10 @@ commands = test: coverage report test: coverage xml -o nimodinstunittest.xml test: coverage html --directory=generated/htmlcov/unit_tests/nimodinst + test: coverage run --rcfile=tools/coverage_unit_tests.rc --source nirfsg -m pytest generated/nirfsg/nirfsg {posargs} -s + test: coverage report + test: coverage xml -o nirfsgunittest.xml + test: coverage html --directory=generated/htmlcov/unit_tests/nirfsg test: coverage run --rcfile=tools/coverage_unit_tests.rc --source niscope -m pytest generated/niscope/niscope {posargs} -s test: coverage report test: coverage xml -o niscopeunittest.xml diff --git a/tox.ini b/tox.ini index 517c919d9..2ae6ba52c 100644 --- a/tox.ini +++ b/tox.ini @@ -77,6 +77,10 @@ commands = test: coverage report test: coverage xml -o nimodinstunittest.xml test: coverage html --directory=generated/htmlcov/unit_tests/nimodinst + test: coverage run --rcfile=tools/coverage_unit_tests.rc --source nirfsg -m pytest generated/nirfsg/nirfsg {posargs} -s + test: coverage report + test: coverage xml -o nirfsgunittest.xml + test: coverage html --directory=generated/htmlcov/unit_tests/nirfsg test: coverage run --rcfile=tools/coverage_unit_tests.rc --source niscope -m pytest generated/niscope/niscope {posargs} -s test: coverage report test: coverage xml -o niscopeunittest.xml