Skip to content

Commit 456b9b7

Browse files
vnktshr21vnktshr21
andauthored
Adding and removing few methods and few more fixes in RFSG (#2121)
* multiple changes and fixes * addressed few review comments * disabled few enums and corrected units in few * more enum cleanup * orientation correction in test --------- Co-authored-by: vnktshr21 <[email protected]>
1 parent 37ea6ef commit 456b9b7

File tree

13 files changed

+1823
-3858
lines changed

13 files changed

+1823
-3858
lines changed

docs/nirfsg/class.rst

Lines changed: 709 additions & 1208 deletions
Large diffs are not rendered by default.

docs/nirfsg/enums.rst

Lines changed: 113 additions & 350 deletions
Large diffs are not rendered by default.

docs/nirfsg/rep_caps.rst

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,17 @@ script_triggers
7575
passes a string of :python:`'scripttrigger0, scripttrigger1, scripttrigger2'` to the set attribute function.
7676

7777

78-
waveform
79-
--------
78+
waveforms
79+
---------
8080

81-
.. py:attribute:: nirfsg.Session.waveform[]
81+
.. py:attribute:: nirfsg.Session.waveforms[]
8282
8383
If no prefix is added to the items in the parameter, the correct prefix will be added when
8484
the driver function call is made.
8585

8686
.. code:: python
8787
88-
session.waveform['0-2'].channel_enabled = True
88+
session.waveforms['0-2'].channel_enabled = True
8989
9090
passes a string of :python:`'waveform::0, waveform::1, waveform::2'` to the set attribute function.
9191

@@ -96,21 +96,47 @@ waveform
9696

9797
.. code:: python
9898
99-
session.waveform['waveform::0-waveform::2'].channel_enabled = True
99+
session.waveforms['waveform::0-waveform::2'].channel_enabled = True
100100
101101
passes a string of :python:`'waveform::0, waveform::1, waveform::2'` to the set attribute function.
102102

103103

104-
deembedding_port
105-
----------------
104+
ports
105+
-----
106106

107-
.. py:attribute:: nirfsg.Session.deembedding_port[]
107+
.. py:attribute:: nirfsg.Session.ports[]
108108
109109
.. code:: python
110110
111-
session.deembedding_port['0-2'].channel_enabled = True
111+
session.ports['0-2'].channel_enabled = True
112112
113113
passes a string of :python:`'0, 1, 2'` to the set attribute function.
114114

115115

116+
lo_channels
117+
-----------
118+
119+
.. py:attribute:: nirfsg.Session.lo_channels[]
120+
121+
If no prefix is added to the items in the parameter, the correct prefix will be added when
122+
the driver function call is made.
123+
124+
.. code:: python
125+
126+
session.lo_channels['0-2'].channel_enabled = True
127+
128+
passes a string of :python:`'LO0, LO1, LO2'` to the set attribute function.
129+
130+
If an invalid repeated capability is passed to the driver, the driver will return an error.
131+
132+
You can also explicitly use the prefix as part of the parameter, but it must be the correct prefix
133+
for the specific repeated capability.
134+
135+
.. code:: python
136+
137+
session.lo_channels['LO0-LO2'].channel_enabled = True
138+
139+
passes a string of :python:`'LO0, LO1, LO2'` to the set attribute function.
140+
141+
116142

generated/nirfsg/nirfsg/_library.py

Lines changed: 9 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,9 @@ def __init__(self, ctypes_library):
4444
self.niRFSG_ConfigureDigitalEdgeStartTrigger_cfunc = None
4545
self.niRFSG_ConfigureDigitalLevelScriptTrigger_cfunc = None
4646
self.niRFSG_ConfigureDigitalModulationUserDefinedWaveform_cfunc = None
47-
self.niRFSG_ConfigureGenerationMode_cfunc = None
48-
self.niRFSG_ConfigureOutputEnabled_cfunc = None
49-
self.niRFSG_ConfigureP2PEndpointFullnessStartTrigger_cfunc = None
50-
self.niRFSG_ConfigurePowerLevelType_cfunc = None
5147
self.niRFSG_ConfigurePxiChassisClk10_cfunc = None
5248
self.niRFSG_ConfigureRF_cfunc = None
5349
self.niRFSG_ConfigureRefClock_cfunc = None
54-
self.niRFSG_ConfigureSignalBandwidth_cfunc = None
5550
self.niRFSG_ConfigureSoftwareScriptTrigger_cfunc = None
5651
self.niRFSG_ConfigureSoftwareStartTrigger_cfunc = None
5752
self.niRFSG_CreateDeembeddingSparameterTableS2PFile_cfunc = None
@@ -77,7 +72,6 @@ def __init__(self, ctypes_library):
7772
self.niRFSG_GetMaxSettablePower_cfunc = None
7873
self.niRFSG_GetSelfCalibrationDateAndTime_cfunc = None
7974
self.niRFSG_GetSelfCalibrationTemperature_cfunc = None
80-
self.niRFSG_GetStreamEndpointHandle_cfunc = None
8175
self.niRFSG_GetTerminalName_cfunc = None
8276
self.niRFSG_GetWaveformBurstStartLocations_cfunc = None
8377
self.niRFSG_GetWaveformBurstStopLocations_cfunc = None
@@ -93,6 +87,7 @@ def __init__(self, ctypes_library):
9387
self.niRFSG_ResetAttribute_cfunc = None
9488
self.niRFSG_ResetDevice_cfunc = None
9589
self.niRFSG_ResetWithDefaults_cfunc = None
90+
self.niRFSG_ResetWithOptions_cfunc = None
9691
self.niRFSG_RevisionQuery_cfunc = None
9792
self.niRFSG_SaveConfigurationsToFile_cfunc = None
9893
self.niRFSG_SelectArbWaveform_cfunc = None
@@ -115,7 +110,6 @@ def __init__(self, ctypes_library):
115110
self.niRFSG_WriteArbWaveformComplexF32_cfunc = None
116111
self.niRFSG_WriteArbWaveformComplexF64_cfunc = None
117112
self.niRFSG_WriteArbWaveformComplexI16_cfunc = None
118-
self.niRFSG_WriteP2PEndpointI16_cfunc = None
119113
self.niRFSG_WriteScript_cfunc = None
120114
self.niRFSG_close_cfunc = None
121115
self.niRFSG_reset_cfunc = None
@@ -319,38 +313,6 @@ def niRFSG_ConfigureDigitalModulationUserDefinedWaveform(self, vi, number_of_sam
319313
self.niRFSG_ConfigureDigitalModulationUserDefinedWaveform_cfunc.restype = ViStatus # noqa: F405
320314
return self.niRFSG_ConfigureDigitalModulationUserDefinedWaveform_cfunc(vi, number_of_samples, user_defined_waveform)
321315

322-
def niRFSG_ConfigureGenerationMode(self, vi, generation_mode): # noqa: N802
323-
with self._func_lock:
324-
if self.niRFSG_ConfigureGenerationMode_cfunc is None:
325-
self.niRFSG_ConfigureGenerationMode_cfunc = self._get_library_function('niRFSG_ConfigureGenerationMode')
326-
self.niRFSG_ConfigureGenerationMode_cfunc.argtypes = [ViSession, ViInt32] # noqa: F405
327-
self.niRFSG_ConfigureGenerationMode_cfunc.restype = ViStatus # noqa: F405
328-
return self.niRFSG_ConfigureGenerationMode_cfunc(vi, generation_mode)
329-
330-
def niRFSG_ConfigureOutputEnabled(self, vi, output_enabled): # noqa: N802
331-
with self._func_lock:
332-
if self.niRFSG_ConfigureOutputEnabled_cfunc is None:
333-
self.niRFSG_ConfigureOutputEnabled_cfunc = self._get_library_function('niRFSG_ConfigureOutputEnabled')
334-
self.niRFSG_ConfigureOutputEnabled_cfunc.argtypes = [ViSession, ViBoolean] # noqa: F405
335-
self.niRFSG_ConfigureOutputEnabled_cfunc.restype = ViStatus # noqa: F405
336-
return self.niRFSG_ConfigureOutputEnabled_cfunc(vi, output_enabled)
337-
338-
def niRFSG_ConfigureP2PEndpointFullnessStartTrigger(self, vi, p2p_endpoint_fullness_level): # noqa: N802
339-
with self._func_lock:
340-
if self.niRFSG_ConfigureP2PEndpointFullnessStartTrigger_cfunc is None:
341-
self.niRFSG_ConfigureP2PEndpointFullnessStartTrigger_cfunc = self._get_library_function('niRFSG_ConfigureP2PEndpointFullnessStartTrigger')
342-
self.niRFSG_ConfigureP2PEndpointFullnessStartTrigger_cfunc.argtypes = [ViSession, ViInt64] # noqa: F405
343-
self.niRFSG_ConfigureP2PEndpointFullnessStartTrigger_cfunc.restype = ViStatus # noqa: F405
344-
return self.niRFSG_ConfigureP2PEndpointFullnessStartTrigger_cfunc(vi, p2p_endpoint_fullness_level)
345-
346-
def niRFSG_ConfigurePowerLevelType(self, vi, power_level_type): # noqa: N802
347-
with self._func_lock:
348-
if self.niRFSG_ConfigurePowerLevelType_cfunc is None:
349-
self.niRFSG_ConfigurePowerLevelType_cfunc = self._get_library_function('niRFSG_ConfigurePowerLevelType')
350-
self.niRFSG_ConfigurePowerLevelType_cfunc.argtypes = [ViSession, ViInt32] # noqa: F405
351-
self.niRFSG_ConfigurePowerLevelType_cfunc.restype = ViStatus # noqa: F405
352-
return self.niRFSG_ConfigurePowerLevelType_cfunc(vi, power_level_type)
353-
354316
def niRFSG_ConfigurePxiChassisClk10(self, vi, pxi_clk10_source): # noqa: N802
355317
with self._func_lock:
356318
if self.niRFSG_ConfigurePxiChassisClk10_cfunc is None:
@@ -375,14 +337,6 @@ def niRFSG_ConfigureRefClock(self, vi, ref_clock_source, ref_clock_rate): # noq
375337
self.niRFSG_ConfigureRefClock_cfunc.restype = ViStatus # noqa: F405
376338
return self.niRFSG_ConfigureRefClock_cfunc(vi, ref_clock_source, ref_clock_rate)
377339

378-
def niRFSG_ConfigureSignalBandwidth(self, vi, signal_bandwidth): # noqa: N802
379-
with self._func_lock:
380-
if self.niRFSG_ConfigureSignalBandwidth_cfunc is None:
381-
self.niRFSG_ConfigureSignalBandwidth_cfunc = self._get_library_function('niRFSG_ConfigureSignalBandwidth')
382-
self.niRFSG_ConfigureSignalBandwidth_cfunc.argtypes = [ViSession, ViReal64] # noqa: F405
383-
self.niRFSG_ConfigureSignalBandwidth_cfunc.restype = ViStatus # noqa: F405
384-
return self.niRFSG_ConfigureSignalBandwidth_cfunc(vi, signal_bandwidth)
385-
386340
def niRFSG_ConfigureSoftwareScriptTrigger(self, vi, trigger_id): # noqa: N802
387341
with self._func_lock:
388342
if self.niRFSG_ConfigureSoftwareScriptTrigger_cfunc is None:
@@ -583,14 +537,6 @@ def niRFSG_GetSelfCalibrationTemperature(self, vi, module, temperature): # noqa
583537
self.niRFSG_GetSelfCalibrationTemperature_cfunc.restype = ViStatus # noqa: F405
584538
return self.niRFSG_GetSelfCalibrationTemperature_cfunc(vi, module, temperature)
585539

586-
def niRFSG_GetStreamEndpointHandle(self, vi, stream_endpoint, reader_handle): # noqa: N802
587-
with self._func_lock:
588-
if self.niRFSG_GetStreamEndpointHandle_cfunc is None:
589-
self.niRFSG_GetStreamEndpointHandle_cfunc = self._get_library_function('niRFSG_GetStreamEndpointHandle')
590-
self.niRFSG_GetStreamEndpointHandle_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViUInt32)] # noqa: F405
591-
self.niRFSG_GetStreamEndpointHandle_cfunc.restype = ViStatus # noqa: F405
592-
return self.niRFSG_GetStreamEndpointHandle_cfunc(vi, stream_endpoint, reader_handle)
593-
594540
def niRFSG_GetTerminalName(self, vi, signal, signal_identifier, buffer_size, terminal_name): # noqa: N802
595541
with self._func_lock:
596542
if self.niRFSG_GetTerminalName_cfunc is None:
@@ -711,6 +657,14 @@ def niRFSG_ResetWithDefaults(self, vi): # noqa: N802
711657
self.niRFSG_ResetWithDefaults_cfunc.restype = ViStatus # noqa: F405
712658
return self.niRFSG_ResetWithDefaults_cfunc(vi)
713659

660+
def niRFSG_ResetWithOptions(self, vi, steps_to_omit): # noqa: N802
661+
with self._func_lock:
662+
if self.niRFSG_ResetWithOptions_cfunc is None:
663+
self.niRFSG_ResetWithOptions_cfunc = self._get_library_function('niRFSG_ResetWithOptions')
664+
self.niRFSG_ResetWithOptions_cfunc.argtypes = [ViSession, ViUInt64] # noqa: F405
665+
self.niRFSG_ResetWithOptions_cfunc.restype = ViStatus # noqa: F405
666+
return self.niRFSG_ResetWithOptions_cfunc(vi, steps_to_omit)
667+
714668
def niRFSG_RevisionQuery(self, vi, instrument_driver_revision, firmware_revision): # noqa: N802
715669
with self._func_lock:
716670
if self.niRFSG_RevisionQuery_cfunc is None:
@@ -887,14 +841,6 @@ def niRFSG_WriteArbWaveformComplexI16(self, vi, waveform_name, number_of_samples
887841
self.niRFSG_WriteArbWaveformComplexI16_cfunc.restype = ViStatus # noqa: F405
888842
return self.niRFSG_WriteArbWaveformComplexI16_cfunc(vi, waveform_name, number_of_samples, waveform_data_array)
889843

890-
def niRFSG_WriteP2PEndpointI16(self, vi, stream_endpoint, number_of_samples, endpoint_data): # noqa: N802
891-
with self._func_lock:
892-
if self.niRFSG_WriteP2PEndpointI16_cfunc is None:
893-
self.niRFSG_WriteP2PEndpointI16_cfunc = self._get_library_function('niRFSG_WriteP2PEndpointI16')
894-
self.niRFSG_WriteP2PEndpointI16_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViInt16)] # noqa: F405
895-
self.niRFSG_WriteP2PEndpointI16_cfunc.restype = ViStatus # noqa: F405
896-
return self.niRFSG_WriteP2PEndpointI16_cfunc(vi, stream_endpoint, number_of_samples, endpoint_data)
897-
898844
def niRFSG_WriteScript(self, vi, script): # noqa: N802
899845
with self._func_lock:
900846
if self.niRFSG_WriteScript_cfunc is None:

generated/nirfsg/nirfsg/_library_interpreter.py

Lines changed: 10 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def configure_deembedding_table_interpolation_spline(self, port, table_name): #
243243

244244
def configure_digital_edge_script_trigger(self, trigger_id, source, edge): # noqa: N802
245245
vi_ctype = _visatype.ViSession(self._vi) # case S110
246-
trigger_id_ctype = ctypes.create_string_buffer(trigger_id.encode(self._encoding)) # case C020
246+
trigger_id_ctype = ctypes.create_string_buffer(trigger_id.encode(self._encoding)) # case C010
247247
source_ctype = ctypes.create_string_buffer(source.encode(self._encoding)) # case C020
248248
edge_ctype = _visatype.ViInt32(edge.value) # case S130
249249
error_code = self._library.niRFSG_ConfigureDigitalEdgeScriptTrigger(vi_ctype, trigger_id_ctype, source_ctype, edge_ctype)
@@ -275,34 +275,6 @@ def configure_digital_modulation_user_defined_waveform(self, number_of_samples,
275275
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
276276
return
277277

278-
def configure_generation_mode(self, generation_mode): # noqa: N802
279-
vi_ctype = _visatype.ViSession(self._vi) # case S110
280-
generation_mode_ctype = _visatype.ViInt32(generation_mode.value) # case S130
281-
error_code = self._library.niRFSG_ConfigureGenerationMode(vi_ctype, generation_mode_ctype)
282-
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
283-
return
284-
285-
def configure_output_enabled(self, output_enabled): # noqa: N802
286-
vi_ctype = _visatype.ViSession(self._vi) # case S110
287-
output_enabled_ctype = _visatype.ViBoolean(output_enabled) # case S150
288-
error_code = self._library.niRFSG_ConfigureOutputEnabled(vi_ctype, output_enabled_ctype)
289-
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
290-
return
291-
292-
def configure_p2p_endpoint_fullness_start_trigger(self, p2p_endpoint_fullness_level): # noqa: N802
293-
vi_ctype = _visatype.ViSession(self._vi) # case S110
294-
p2p_endpoint_fullness_level_ctype = _visatype.ViInt64(p2p_endpoint_fullness_level) # case S150
295-
error_code = self._library.niRFSG_ConfigureP2PEndpointFullnessStartTrigger(vi_ctype, p2p_endpoint_fullness_level_ctype)
296-
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
297-
return
298-
299-
def configure_power_level_type(self, power_level_type): # noqa: N802
300-
vi_ctype = _visatype.ViSession(self._vi) # case S110
301-
power_level_type_ctype = _visatype.ViInt32(power_level_type.value) # case S130
302-
error_code = self._library.niRFSG_ConfigurePowerLevelType(vi_ctype, power_level_type_ctype)
303-
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
304-
return
305-
306278
def configure_pxi_chassis_clk10(self, pxi_clk10_source): # noqa: N802
307279
vi_ctype = _visatype.ViSession(self._vi) # case S110
308280
pxi_clk10_source_ctype = ctypes.create_string_buffer(pxi_clk10_source.encode(self._encoding)) # case C020
@@ -326,16 +298,9 @@ def configure_ref_clock(self, ref_clock_source, ref_clock_rate): # noqa: N802
326298
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
327299
return
328300

329-
def configure_signal_bandwidth(self, signal_bandwidth): # noqa: N802
330-
vi_ctype = _visatype.ViSession(self._vi) # case S110
331-
signal_bandwidth_ctype = _visatype.ViReal64(signal_bandwidth) # case S150
332-
error_code = self._library.niRFSG_ConfigureSignalBandwidth(vi_ctype, signal_bandwidth_ctype)
333-
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
334-
return
335-
336301
def configure_software_script_trigger(self, trigger_id): # noqa: N802
337302
vi_ctype = _visatype.ViSession(self._vi) # case S110
338-
trigger_id_ctype = ctypes.create_string_buffer(trigger_id.encode(self._encoding)) # case C020
303+
trigger_id_ctype = ctypes.create_string_buffer(trigger_id.encode(self._encoding)) # case C010
339304
error_code = self._library.niRFSG_ConfigureSoftwareScriptTrigger(vi_ctype, trigger_id_ctype)
340305
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
341306
return
@@ -378,7 +343,7 @@ def disable(self): # noqa: N802
378343

379344
def disable_script_trigger(self, trigger_id): # noqa: N802
380345
vi_ctype = _visatype.ViSession(self._vi) # case S110
381-
trigger_id_ctype = ctypes.create_string_buffer(trigger_id.encode(self._encoding)) # case C020
346+
trigger_id_ctype = ctypes.create_string_buffer(trigger_id.encode(self._encoding)) # case C010
382347
error_code = self._library.niRFSG_DisableScriptTrigger(vi_ctype, trigger_id_ctype)
383348
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
384349
return
@@ -565,14 +530,6 @@ def get_self_calibration_temperature(self, module): # noqa: N802
565530
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
566531
return float(temperature_ctype.value)
567532

568-
def get_stream_endpoint_handle(self, stream_endpoint): # noqa: N802
569-
vi_ctype = _visatype.ViSession(self._vi) # case S110
570-
stream_endpoint_ctype = ctypes.create_string_buffer(stream_endpoint.encode(self._encoding)) # case C020
571-
reader_handle_ctype = _visatype.ViUInt32() # case S220
572-
error_code = self._library.niRFSG_GetStreamEndpointHandle(vi_ctype, stream_endpoint_ctype, None if reader_handle_ctype is None else (ctypes.pointer(reader_handle_ctype)))
573-
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
574-
return int(reader_handle_ctype.value)
575-
576533
def get_terminal_name(self, signal, signal_identifier): # noqa: N802
577534
vi_ctype = _visatype.ViSession(self._vi) # case S110
578535
signal_ctype = _visatype.ViInt32(signal.value) # case S130
@@ -713,6 +670,13 @@ def reset_with_defaults(self): # noqa: N802
713670
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
714671
return
715672

673+
def reset_with_options(self, steps_to_omit): # noqa: N802
674+
vi_ctype = _visatype.ViSession(self._vi) # case S110
675+
steps_to_omit_ctype = _visatype.ViUInt64(steps_to_omit.value) # case S130
676+
error_code = self._library.niRFSG_ResetWithOptions(vi_ctype, steps_to_omit_ctype)
677+
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
678+
return
679+
716680
def revision_query(self): # noqa: N802
717681
vi_ctype = _visatype.ViSession(self._vi) # case S110
718682
instrument_driver_revision_ctype = (_visatype.ViChar * 256)() # case C070
@@ -901,16 +865,6 @@ def write_arb_waveform_complex_i16(self, waveform_name, waveform_data_array): #
901865
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
902866
return
903867

904-
def write_p2p_endpoint_i16(self, stream_endpoint, number_of_samples, endpoint_data): # noqa: N802
905-
vi_ctype = _visatype.ViSession(self._vi) # case S110
906-
stream_endpoint_ctype = ctypes.create_string_buffer(stream_endpoint.encode(self._encoding)) # case C020
907-
number_of_samples_ctype = _visatype.ViInt32(0 if endpoint_data is None else len(endpoint_data)) # case S160
908-
endpoint_data_array = _convert_to_array(value=endpoint_data, array_type="h") # case B550
909-
endpoint_data_ctype = _get_ctypes_pointer_for_buffer(value=endpoint_data_array, library_type=_visatype.ViInt16) # case B550
910-
error_code = self._library.niRFSG_WriteP2PEndpointI16(vi_ctype, stream_endpoint_ctype, number_of_samples_ctype, endpoint_data_ctype)
911-
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
912-
return
913-
914868
def write_script(self, script): # noqa: N802
915869
vi_ctype = _visatype.ViSession(self._vi) # case S110
916870
script_ctype = ctypes.create_string_buffer(script.encode(self._encoding)) # case C020

0 commit comments

Comments
 (0)