Skip to content

Commit f81923a

Browse files
authored
nifgen repeated capability documentation and test updates (#1681)
* Update attributes.py * Update config.py * Update enums.py * Update functions.py * Add rep_cap tests to test_system_nifgen.py. * Add codegen changes from nifgen metadata changes. * Test Fixes * Single-channel session caused test_channels_rep_cap failure. * After fixing attribute name, Driver claimed requested terminal name was invalid in test_data_markers_rep_cap test. * Update CHANGELOG.md Documented nifgen repeated capability changes in changelog. * Update test_system_nifgen.py Replaced verbose strings in rep_cap tests with integers to be more pythonic. * Update test_system_nifgen.py Replacing another verbose string that I missed in the last commit. * Update test_system_nifgen.py Replace '0-1' channels string with an iterable to be more pythonic. * Update test_system_nifgen.py Change test_data_markers_rep_cap to use a simulated 5421 (supports data marker events) instead of a 5433 (does not support data marker events). * Revert previous change Reviewer's request to avoid usage of DAQmx device simulation.
1 parent 5be94c6 commit f81923a

File tree

10 files changed

+733
-107
lines changed

10 files changed

+733
-107
lines changed

CHANGELOG.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,16 @@ All notable changes to this project will be documented in this file.
4646
* #### Changed
4747
* #### Removed
4848
* ### `nifgen` (NI-FGEN)
49-
* #### Added
49+
* #### Added
50+
* `data_markers` repeated capability support - [#1668](https://github.com/ni/nimi-python/issues/1668)
5051
* #### Changed
52+
* Addressed [#1627](https://github.com/ni/nimi-python/issues/1627) for attributes supporting the following repeated capabilities
53+
* `channels`
54+
* `markers`
55+
* `data_markers`
56+
* `script_triggers`
57+
* Corrected multiple mistakes in repeated capability info of attribute metadata
58+
* alters API behavior (repeated capability access of attributes) and documentation
5159
* #### Removed
5260
* ### `nimodinst` (NI-ModInst)
5361
* #### Added

docs/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
# General information about the project.
5757
project = 'NI Modular Instruments Python API'
58-
copyright = '2017-2021, National Instruments'
58+
copyright = '2017-2022, National Instruments'
5959
author = 'National Instruments'
6060

6161
# The version info for the project you're documenting, acts as replacement for

docs/nifgen/class.rst

+333-63
Large diffs are not rendered by default.

docs/nifgen/rep_caps.rst

+26
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,30 @@ markers
8787
passes a string of :python:`'Marker0, Marker1, Marker2'` to the set attribute function.
8888

8989

90+
data_markers
91+
------------
92+
93+
.. py:attribute:: nifgen.Session.data_markers[]
94+
95+
If no prefix is added to the items in the parameter, the correct prefix will be added when
96+
the driver function call is made.
97+
98+
.. code:: python
99+
100+
session.data_markers['0-2'].channel_enabled = True
101+
102+
passes a string of :python:`'DataMarker0, DataMarker1, DataMarker2'` to the set attribute function.
103+
104+
If an invalid repeated capability is passed to the driver, the driver will return an error.
105+
106+
You can also explicitly use the prefix as part of the parameter, but it must be the correct prefix
107+
for the specific repeated capability.
108+
109+
.. code:: python
110+
111+
session.data_markers['DataMarker0-DataMarker2'].channel_enabled = True
112+
113+
passes a string of :python:`'DataMarker0, DataMarker1, DataMarker2'` to the set attribute function.
114+
115+
90116

generated/nifgen/nifgen/session.py

+240-19
Large diffs are not rendered by default.

src/nifgen/metadata/attributes.py

+74-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# This file is generated from NI-FGEN API metadata version 20.7.0d242
2+
# This file is generated from NI-FGEN API metadata version 21.5.0d106
33
attributes = {
44
1050005: {
55
'access': 'read-write',
@@ -183,6 +183,9 @@
183183
'enum': 'TriggerMode',
184184
'lv_property': 'Triggers:Trigger Mode',
185185
'name': 'TRIGGER_MODE',
186+
'supported_rep_caps': [
187+
'channels'
188+
],
186189
'type': 'ViInt32'
187190
},
188191
1150110: {
@@ -529,7 +532,9 @@
529532
'enum': 'ScriptTriggerType',
530533
'lv_property': 'Triggers:Script:Trigger Type',
531534
'name': 'SCRIPT_TRIGGER_TYPE',
532-
'repeated_capability_type': 'script_triggers',
535+
'supported_rep_caps': [
536+
'script_triggers'
537+
],
533538
'type': 'ViInt32'
534539
},
535540
1150291: {
@@ -539,7 +544,9 @@
539544
},
540545
'lv_property': 'Triggers:Script:Digital Edge:Source',
541546
'name': 'DIGITAL_EDGE_SCRIPT_TRIGGER_SOURCE',
542-
'repeated_capability_type': 'script_triggers',
547+
'supported_rep_caps': [
548+
'script_triggers'
549+
],
543550
'type': 'ViString'
544551
},
545552
1150292: {
@@ -550,7 +557,9 @@
550557
'enum': 'ScriptTriggerDigitalEdgeEdge',
551558
'lv_property': 'Triggers:Script:Digital Edge:Edge',
552559
'name': 'DIGITAL_EDGE_SCRIPT_TRIGGER_EDGE',
553-
'repeated_capability_type': 'script_triggers',
560+
'supported_rep_caps': [
561+
'script_triggers'
562+
],
554563
'type': 'ViInt32'
555564
},
556565
1150295: {
@@ -560,7 +569,9 @@
560569
},
561570
'lv_property': 'Triggers:Script:Output Terminal',
562571
'name': 'EXPORTED_SCRIPT_TRIGGER_OUTPUT_TERMINAL',
563-
'repeated_capability_type': 'script_triggers',
572+
'supported_rep_caps': [
573+
'script_triggers'
574+
],
564575
'type': 'ViString'
565576
},
566577
1150310: {
@@ -579,7 +590,9 @@
579590
},
580591
'lv_property': 'Events:Marker:Output Terminal',
581592
'name': 'MARKER_EVENT_OUTPUT_TERMINAL',
582-
'repeated_capability_type': 'markers',
593+
'supported_rep_caps': [
594+
'markers'
595+
],
583596
'type': 'ViString'
584597
},
585598
1150314: {
@@ -670,7 +683,6 @@
670683
},
671684
'lv_property': 'Arbitrary Waveform:Arbitrary Waveform Mode:Marker Position',
672685
'name': 'ARB_MARKER_POSITION',
673-
'repeated_capability_type': 'markers',
674686
'type': 'ViInt32'
675687
},
676688
1150328: {
@@ -699,7 +711,9 @@
699711
},
700712
'lv_property': 'Events:Data Marker:Data Bit Number',
701713
'name': 'DATA_MARKER_EVENT_DATA_BIT_NUMBER',
702-
'repeated_capability_type': 'markers',
714+
'supported_rep_caps': [
715+
'data_markers'
716+
],
703717
'type': 'ViInt32'
704718
},
705719
1150338: {
@@ -710,7 +724,9 @@
710724
'enum': 'DataMarkerEventLevelPolarity',
711725
'lv_property': 'Events:Data Marker:Level:Active Level',
712726
'name': 'DATA_MARKER_EVENT_LEVEL_POLARITY',
713-
'repeated_capability_type': 'markers',
727+
'supported_rep_caps': [
728+
'data_markers'
729+
],
714730
'type': 'ViInt32'
715731
},
716732
1150339: {
@@ -720,7 +736,9 @@
720736
},
721737
'lv_property': 'Events:Data Marker:Output Terminal',
722738
'name': 'DATA_MARKER_EVENT_OUTPUT_TERMINAL',
723-
'repeated_capability_type': 'markers',
739+
'supported_rep_caps': [
740+
'data_markers'
741+
],
724742
'type': 'ViString'
725743
},
726744
1150344: {
@@ -749,6 +767,9 @@
749767
'enum': 'TerminalConfiguration',
750768
'lv_property': 'Output:Terminal Configuration',
751769
'name': 'TERMINAL_CONFIGURATION',
770+
'supported_rep_caps': [
771+
'channels'
772+
],
752773
'type': 'ViInt32'
753774
},
754775
1150366: {
@@ -758,6 +779,9 @@
758779
},
759780
'lv_property': 'Output:Common Mode Offset',
760781
'name': 'COMMON_MODE_OFFSET',
782+
'supported_rep_caps': [
783+
'channels'
784+
],
761785
'type': 'ViReal64'
762786
},
763787
1150367: {
@@ -788,6 +812,9 @@
788812
},
789813
'lv_property': 'Output:Channel Delay',
790814
'name': 'CHANNEL_DELAY',
815+
'supported_rep_caps': [
816+
'channels'
817+
],
791818
'type': 'ViReal64'
792819
},
793820
1150373: {
@@ -931,6 +958,9 @@
931958
},
932959
'lv_property': 'Output:Output Enabled',
933960
'name': 'OUTPUT_ENABLED',
961+
'supported_rep_caps': [
962+
'channels'
963+
],
934964
'type': 'ViBoolean'
935965
},
936966
1250004: {
@@ -940,6 +970,9 @@
940970
},
941971
'lv_property': 'Output:Output Impedance',
942972
'name': 'OUTPUT_IMPEDANCE',
973+
'supported_rep_caps': [
974+
'channels'
975+
],
943976
'type': 'ViReal64'
944977
},
945978
1250101: {
@@ -950,6 +983,9 @@
950983
'enum': 'Waveform',
951984
'lv_property': 'Standard Function:Waveform',
952985
'name': 'FUNC_WAVEFORM',
986+
'supported_rep_caps': [
987+
'channels'
988+
],
953989
'type': 'ViInt32'
954990
},
955991
1250102: {
@@ -960,6 +996,9 @@
960996
},
961997
'lv_property': 'Standard Function:Amplitude',
962998
'name': 'FUNC_AMPLITUDE',
999+
'supported_rep_caps': [
1000+
'channels'
1001+
],
9631002
'type': 'ViReal64'
9641003
},
9651004
1250103: {
@@ -969,6 +1008,9 @@
9691008
},
9701009
'lv_property': 'Standard Function:DC Offset',
9711010
'name': 'FUNC_DC_OFFSET',
1011+
'supported_rep_caps': [
1012+
'channels'
1013+
],
9721014
'type': 'ViReal64'
9731015
},
9741016
1250104: {
@@ -979,6 +1021,9 @@
9791021
},
9801022
'lv_property': 'Standard Function:Standard Function Mode:Frequency',
9811023
'name': 'FUNC_FREQUENCY',
1024+
'supported_rep_caps': [
1025+
'channels'
1026+
],
9821027
'type': 'ViReal64'
9831028
},
9841029
1250105: {
@@ -989,6 +1034,9 @@
9891034
},
9901035
'lv_property': 'Standard Function:Start Phase',
9911036
'name': 'FUNC_START_PHASE',
1037+
'supported_rep_caps': [
1038+
'channels'
1039+
],
9921040
'type': 'ViReal64'
9931041
},
9941042
1250106: {
@@ -999,15 +1047,21 @@
9991047
},
10001048
'lv_property': 'Standard Function:Duty Cycle High',
10011049
'name': 'FUNC_DUTY_CYCLE_HIGH',
1050+
'supported_rep_caps': [
1051+
'channels'
1052+
],
10021053
'type': 'ViReal64'
10031054
},
10041055
1250201: {
10051056
'access': 'read-write',
10061057
'documentation': {
1007-
'description': '\nSelects which arbitrary waveform the signal generator produces. You can create multiple arbitrary waveforms using one of the following niFgen Create Waveform functions:\nniFgen_CreateWaveformF64\nniFgen_CreateWaveformI16\nniFgen_CreateWaveformFromFileI16\nniFgen_CreateWaveformFromFileF64\nniFgen_CreateWaveformFromFileHWS\nThese functions return a handle that you can use to identify the particular waveform. To configure the signal generator to produce a particular waveform, set this attribute to the waveform handle.\nUse this attribute only when NIFGEN_ATTR_OUTPUT_MODE is set to NIFGEN_VAL_OUTPUT_ARB.\n'
1058+
'description': '\nSelects which arbitrary waveform the signal generator produces. You can create multiple arbitrary waveforms using one of the following niFgen Create Waveform functions:\nniFgen_CreateWaveformF64\nniFgen_CreateWaveformI16\nniFgen_CreateWaveformFromFileI16\nniFgen_CreateWaveformFromFileF64\nThese functions return a handle that you can use to identify the particular waveform. To configure the signal generator to produce a particular waveform, set this attribute to the waveform handle.\nUse this attribute only when NIFGEN_ATTR_OUTPUT_MODE is set to NIFGEN_VAL_OUTPUT_ARB.\n'
10081059
},
10091060
'lv_property': 'Arbitrary Waveform:Arbitrary Waveform Mode:Arbitrary Waveform Handle',
10101061
'name': 'ARB_WAVEFORM_HANDLE',
1062+
'supported_rep_caps': [
1063+
'channels'
1064+
],
10111065
'type': 'ViInt32'
10121066
},
10131067
1250202: {
@@ -1017,6 +1071,9 @@
10171071
},
10181072
'lv_property': 'Arbitrary Waveform:Gain',
10191073
'name': 'ARB_GAIN',
1074+
'supported_rep_caps': [
1075+
'channels'
1076+
],
10201077
'type': 'ViReal64'
10211078
},
10221079
1250203: {
@@ -1026,6 +1083,9 @@
10261083
},
10271084
'lv_property': 'Arbitrary Waveform:Offset',
10281085
'name': 'ARB_OFFSET',
1086+
'supported_rep_caps': [
1087+
'channels'
1088+
],
10291089
'type': 'ViReal64'
10301090
},
10311091
1250204: {
@@ -1080,6 +1140,9 @@
10801140
},
10811141
'lv_property': 'Arbitrary Waveform:Arbitrary Sequence Mode:Arbitrary Sequence Handle',
10821142
'name': 'ARB_SEQUENCE_HANDLE',
1143+
'supported_rep_caps': [
1144+
'channels'
1145+
],
10831146
'type': 'ViInt32'
10841147
},
10851148
1250212: {

src/nifgen/metadata/config.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
2-
# This file is generated from NI-FGEN API metadata version 20.0.0d5
2+
# This file is generated from NI-FGEN API metadata version 21.5.0d106
33
config = {
4-
'api_version': '20.0.0d5',
4+
'api_version': '21.5.0d106',
55
'c_function_prefix': 'niFgen_',
66
'close_function': 'close',
77
'context_manager_name': {
@@ -49,6 +49,10 @@
4949
{
5050
'prefix': 'Marker',
5151
'python_name': 'markers'
52+
},
53+
{
54+
'prefix': 'DataMarker',
55+
'python_name': 'data_markers'
5256
}
5357
],
5458
'session_class_description': 'An NI-FGEN session to a National Instruments Signal Generator.',

src/nifgen/metadata/enums.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# This file is generated from NI-FGEN API metadata version 20.0.0d5
2+
# This file is generated from NI-FGEN API metadata version 21.5.0d106
33
enums = {
44
'AnalogPath': {
55
'values': [

0 commit comments

Comments
 (0)