-
RE: How to get MaxHold spectrum data from RSA306B with RSA_API?
It's months later, but I wanted to say thank you Afonso, your advice put me on the right track and I was able to connect to the Spectrum analyzer and program it.
With OpenChoice Instrument Manager I could see the device with the name GPIB8::1::INSTR as you mentioned, and as long as I had SignalVU-PC open on my laptop and connected to the spectrum analyzer I was able to connect with my python program using the following code:import pyvisa # 1.13.0 is installed from pyvisa.resources import USBInstrument
rm = pyvisa.ResourceManager() list_instruments = rm.list_resources()
<find the index of GPIB8::1::INSTR in list_instruments>
spectrum_analyzer: USBInstrument = rm.open_resource(list_instruments[index])
Thanks again for your help!
-
RE: How to get MaxHold spectrum data from RSA306B with RSA_API?
<p>Hi Afonso, </p> <p>Thanks for the reply, I hadn’t realized that the api access data direct from the ADC. </p> <p>I actually started by trying the SignalVu route as I would love to use SCPI commands, however I’ve been unable to connect to the device via python using pyvisa or NI visa. Using tekvisa is a extremely undesirable last option as we need to run this on computers that have existing NI programs that require use of the NI visa driver, and it doesn’t seem to be possible to have both nivisa and tekvisa installed at the same time. </p> <p>Attempts to connect to the device that I’ve tried so far:</p> <ul> <li>Locating it via VISA Interactive Control - either the spectrum RSA306B isn’t showing up on the device list, or it’s not possible to open comms with it (visa error “the resource is valid, but VISA cannot currently access it”)</li> <li>Locating it via Tektronix’s OpenChoice Instrument Manager - I can see a GPIB “instrument” with *IDN “TEKTRONIX,SignalVu-PC,8acd6a6, FV:4.1.0022.0”, but I believe this is the SignalVu software and not the spectrum analyser itself. If I try to update the search criteria, “USB” is set to “off” with no way I can see to turn it on.</li> </ul> <p>Do you have any suggestions on how I can connect to and send SCPI commands to the RSA306B? The SignalVu manual seems to require either an Ethernet connection or comms over a GPIB port, neither of which is possible with this device. Any suggestions would be greatly appreciated!</p> -
RE: How to get MaxHold spectrum data from RSA306B with RSA_API?
<p>Here is the code for the "SPECTRUM" commands approach:</p> <p style="margin-left:36px;"><span style="font-size:9.8pt;"><span style="font-family:"JetBrains Mono";"><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">theDll = ctypes.util.find_library(</span></span><span style="background:#2b2b2b;"><span style="color:#d1dacc;">"C:</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">\\</span></span><span style="background:#2b2b2b;"><span style="color:#d1dacc;">Tektronix</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">\\</span></span><span style="background:#2b2b2b;"><span style="color:#d1dacc;">RSA_API</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">\\</span></span><span style="background:#2b2b2b;"><span style="color:#d1dacc;">lib</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">\\</span></span><span style="background:#2b2b2b;"><span style="color:#d1dacc;">x64</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">\\</span></span><span style="background:#2b2b2b;"><span style="color:#d1dacc;">RSA_API.dll"</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">)<br> rsa = ctypes.cdll.LoadLibrary(theDll)<br> search_connect(rsa)<br> specSet = config_spectrum(rsa)</span></span><br> <span style="background:#2b2b2b;"><span style="color:#d2d9e1;">trace = acquire_spectrum(rsa</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">specSet</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">measurement_time)<br> freq = create_frequency_array(specSet)</span></span></span></span></p> <p style="margin-left:36px;"><span style="font-size:9.8pt;"><span style="font-family:"JetBrains Mono";"><span style="background:#2b2b2b;"><span style="color:#eed3bc;">def </span></span><span style="background:#2b2b2b;"><span style="color:#ffcf83;">config_spectrum</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">(rsa</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">center_frequency=</span></span><span style="background:#2b2b2b;"><span style="color:#cadbe7;">15e6</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">reference_level=-</span></span><span style="background:#2b2b2b;"><span style="color:#cadbe7;">20</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">frequency_span=</span></span><span style="background:#2b2b2b;"><span style="color:#cadbe7;">30e6</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">res_bandwidth=</span></span><span style="background:#2b2b2b;"><span style="color:#cadbe7;">10e3</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">):<br>     rsa.SPECTRUM_SetEnable(c_bool(</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">True</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">))</span></span></span></span></p> <p style="margin-left:36px;"><span style="font-size:9.8pt;"><span style="font-family:"JetBrains Mono";"><span style="color:#d2d9e1;"><span style="background:#2b2b2b;">rsa.CONFIG_SetCenterFreq(c_double(center_frequency))<br>     rsa.CONFIG_SetReferenceLevel(c_double(reference_level))</span></span></span></span></p> <p style="margin-left:36px;"><span style="font-size:9.8pt;"><span style="font-family:"JetBrains Mono";"><span style="color:#d2d9e1;"><span style="background:#2b2b2b;">rsa.SPECTRUM_SetDefault()<br>     specSet = RSA_API.Spectrum_Settings()<br>     rsa.SPECTRUM_GetSettings(byref(specSet))</span></span></span></span></p> <p style="margin-left:36px;"><span style="font-size:9.8pt;"><span style="font-family:"JetBrains Mono";"><span style="color:#d2d9e1;"><span style="background:#2b2b2b;">specSet.window = RSA_API.SpectrumWindows.SpectrumWindow_Kaiser<br>     specSet.verticalUnit = RSA_API.SpectrumVerticalUnits.SpectrumVerticalUnit_dBm<br>     specSet.span = frequency_span<br>     specSet.rbw = res_bandwidth</span></span></span></span></p> <p style="margin-left:36px;"><span style="font-size:9.8pt;"><span style="font-family:"JetBrains Mono";"><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">rsa.SPECTRUM_SetSettings(specSet)<br>     rsa.SPECTRUM_GetSettings(byref(specSet))<br>     rsa.SPECTRUM_SetTraceType(RSA_API.SpectrumTraces.SpectrumTrace1</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, True, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">RSA_API.SpectrumDetectors.SpectrumDetector_PosPeak)</span></span></span></span></p> <p style="margin-left:36px;"><span style="font-size:9.8pt;"><span style="font-family:"JetBrains Mono";"><span style="background:#2b2b2b;"><span style="color:#eed3bc;">def </span></span><span style="background:#2b2b2b;"><span style="color:#ffcf83;">acquire_spectrum</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">(rsa</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">specSet</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">measurement_time):<br>     ready = c_bool(</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">False</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">)<br>     traceArray = c_float * specSet.traceLength<br>     traceData = traceArray()<br>     outTracePoints = c_int(</span></span><span style="background:#2b2b2b;"><span style="color:#cadbe7;">0</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">)<br>     traceSelector = RSA_API.SpectrumTraces.SpectrumTrace1</span></span></span></span></p> <p style="margin-left:36px;"><span style="font-size:9.8pt;"><span style="font-family:"JetBrains Mono";"><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">rsa.DEVICE_Run()<br>     time.sleep(measurement_time)<br>     rsa.SPECTRUM_AcquireTrace()<br>     </span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">while not </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">ready.value:<br>         rsa.SPECTRUM_WaitForDataReady(c_int(</span></span><span style="background:#2b2b2b;"><span style="color:#cadbe7;">100</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">)</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">byref(ready))<br>     rsa.SPECTRUM_GetTrace(traceSelector</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">specSet.traceLength</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">byref(traceData)</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">,<br>                           </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">byref(outTracePoints))<br>     rsa.DEVICE_Stop()<br>     </span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">return </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">np.array(traceData)</span></span></span></span></p> <p>And here is the code for the "DPX" approach:</p> <p style="margin-left:36px;"><span style="font-size:9.8pt;"><span style="font-family:"JetBrains Mono";"><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">freq = config_DPX(rsa)<br> fb = acquire_dpx_frame(rsa</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">measurement_time)<br> trace = extract_dpx_spectrum(fb)</span></span></span></span></p> <p style="margin-left:36px;"><span style="font-size:9.8pt;"><span style="font-family:"JetBrains Mono";"><span style="background:#2b2b2b;"><span style="color:#eed3bc;">def </span></span><span style="background:#2b2b2b;"><span style="color:#ffcf83;">config_DPX</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">(rsa</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">center_frequency=</span></span><span style="background:#2b2b2b;"><span style="color:#cadbe7;">15e6</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">reference_level=-</span></span><span style="background:#2b2b2b;"><span style="color:#cadbe7;">20</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">frequency_span=</span></span><span style="background:#2b2b2b;"><span style="color:#cadbe7;">30e6</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">res_bandwidth=</span></span><span style="background:#2b2b2b;"><span style="color:#cadbe7;">10e3</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">):<br>     </span></span><span style="background:#2b2b2b;"><span style="font-style:italic;"><span style="color:#cadcc6;">"""<br>     </span></span></span><a href="https://forum.tek.com/viewtopic.php?f=588&t=139112"><span style="background:#2b2b2b;"><span style="font-style:italic;"><span style="color:#cadcc6;">https://forum.tek.com/viewtopic.php?f=588&t=139112</span></span></span></a><br> <span style="background:#2b2b2b;"><span style="font-style:italic;"><span style="color:#cadcc6;">    """<br>     </span></span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">yTop = reference_level<br>     yBottom = yTop - </span></span><span style="background:#2b2b2b;"><span style="color:#cadbe7;">100<br>     </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">yUnit = RSA_API.VerticalUnitType.VerticalUnit_dBm</span></span></span></span></p> <p style="margin-left:36px;"><span style="font-size:9.8pt;"><span style="font-family:"JetBrains Mono";"><span style="color:#d2d9e1;"><span style="background:#2b2b2b;">dpxSet = RSA_API.DPX_SettingStruct()<br>     rsa.CONFIG_SetCenterFreq(c_double(center_frequency))<br>     rsa.CONFIG_SetReferenceLevel(c_double(reference_level))</span></span></span></span></p> <p style="margin-left:36px;"><span style="font-size:9.8pt;"><span style="font-family:"JetBrains Mono";"><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">rsa.DPX_SetEnable(c_bool(</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">True</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">))<br>     rsa.DPX_SetParameters(c_double(frequency_span)</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">c_double(res_bandwidth)</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">c_int(</span></span><span style="background:#2b2b2b;"><span style="color:#cadbe7;">801</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">)</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">c_int(</span></span><span style="background:#2b2b2b;"><span style="color:#cadbe7;">1</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">)</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">,<br>                           </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">yUnit</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">c_double(yTop)</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">c_double(yBottom)</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">c_bool(</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">False</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">)</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">,<br>                           </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">c_double(</span></span><span style="background:#2b2b2b;"><span style="color:#cadbe7;">1.0</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">)</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">c_bool(</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">False</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">))<br>     rsa.DPX_SetSogramParameters(c_double(</span></span><span style="background:#2b2b2b;"><span style="color:#cadbe7;">1e-3</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">)</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">c_double(</span></span><span style="background:#2b2b2b;"><span style="color:#cadbe7;">1e-3</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">)</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">,<br>                                 </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">c_double(reference_level)</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">c_double(reference_level - </span></span><span style="background:#2b2b2b;"><span style="color:#cadbe7;">100</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">))<br>     rsa.DPX_Configure(c_bool(</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">True</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">)</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">c_bool(</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">True</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">))</span></span></span></span></p> <p style="margin-left:36px;"><span style="font-size:9.8pt;"><span style="font-family:"JetBrains Mono";"><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">rsa.DPX_SetSpectrumTraceType(RSA_API.SpectrumTraces.SpectrumTrace1</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">RSA_API.TraceType.TraceTypeMaxHold)</span></span></span></span></p> <p style="margin-left:36px;"><span style="font-size:9.8pt;"><span style="font-family:"JetBrains Mono";"><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">rsa.DPX_GetSettings(byref(dpxSet))<br>     dpxFreq = np.linspace((center_frequency - frequency_span / </span></span><span style="background:#2b2b2b;"><span style="color:#cadbe7;">2</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">)</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">(center_frequency + frequency_span / </span></span><span style="background:#2b2b2b;"><span style="color:#cadbe7;">2</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">)</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">dpxSet.bitmapWidth)<br>     </span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">return </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">dpxFreq</span></span></span></span></p> <p style="margin-left:36px;"><span style="font-size:9.8pt;"><span style="font-family:"JetBrains Mono";"><span style="background:#2b2b2b;"><span style="color:#eed3bc;">def </span></span><span style="background:#2b2b2b;"><span style="color:#ffcf83;">acquire_dpx_frame</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">(rsa</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">measurement_time):<br>     frameAvailable = c_bool(</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">False</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">)<br>     ready = c_bool(</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">False</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">)<br>     fb = RSA_API.DPX_FrameBuffer()</span></span></span></span></p> <p style="margin-left:36px;"><span style="font-size:9.8pt;"><span style="font-family:"JetBrains Mono";"><span style="color:#d2d9e1;"><span style="background:#2b2b2b;">rsa.DEVICE_Run()<br>     rsa.DPX_Reset()<br>     time.sleep(measurement_time)</span></span></span></span></p> <p style="margin-left:36px;"><span style="font-size:9.8pt;"><span style="font-family:"JetBrains Mono";"><span style="background:#2b2b2b;"><span style="color:#eed3bc;">while not </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">frameAvailable.value:<br>         rsa.DPX_IsFrameBufferAvailable(byref(frameAvailable))<br>         </span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">while not </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">ready.value:<br>             rsa.DPX_WaitForDataReady(c_int(</span></span><span style="background:#2b2b2b;"><span style="color:#cadbe7;">100</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">)</span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">, </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">byref(ready))<br>     rsa.DPX_GetFrameBuffer(byref(fb))<br>     rsa.DPX_FinishFrameBuffer()<br>     rsa.DEVICE_Stop()<br>     </span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">return </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">fb</span></span></span></span></p> <p style="margin-left:36px;"><span style="font-size:9.8pt;"><span style="font-family:"JetBrains Mono";"><span style="background:#2b2b2b;"><span style="color:#eed3bc;">def </span></span><span style="background:#2b2b2b;"><span style="color:#ffcf83;">extract_dpx_spectrum</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">(fb):<br>     </span></span><span style="background:#2b2b2b;"><span style="color:#d8d8d8;"># When converting a ctypes pointer to a numpy array, we need to<br>     # explicitly specify its length to dereference it correctly<br>     </span></span><span style="background:#2b2b2b;"><span style="color:#d8d8da;">dpxBitmap </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">= np.array(fb.spectrumBitmap[:fb.spectrumBitmapSize])</span></span></span></span></p> <p style="margin-left:36px;"><span style="font-size:9.8pt;"><span style="font-family:"JetBrains Mono";"><span style="background:#2b2b2b;"><span style="color:#d8d8d8;"># Grab trace data and convert from W to dBm<br>     # </span></span><a href="http://www.rapidtables.com/convert/power/Watt_to_dBm.htm"><span style="background:#2b2b2b;"><span style="color:#d8d8d8;">http://www.rapidtables.com/convert/power/Watt_to_dBm.htm</span></span></a><br> <span style="background:#2b2b2b;"><span style="color:#d8d8d8;">    # Note: fb.spectrumTraces is a pointer to a pointer, so we need to<br>     # go through an additional dereferencing step<br>     </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">raw_trace = np.array(fb.spectrumTraces[</span></span><span style="background:#2b2b2b;"><span style="color:#cadbe7;">0</span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">][:fb.spectrumTraceLength])  </span></span><span style="background:#2b2b2b;"><span style="color:#d8d8d8;"># 0 indicates trace 1<br>     </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">trace = </span></span><span style="background:#2b2b2b;"><span style="color:#cadbe7;">10 </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">* np.log10(</span></span><span style="background:#2b2b2b;"><span style="color:#cadbe7;">1000 </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">* raw_trace) + </span></span><span style="background:#2b2b2b;"><span style="color:#cadbe7;">30<br>     </span></span><span style="background:#2b2b2b;"><span style="color:#eed3bc;">return </span></span><span style="background:#2b2b2b;"><span style="color:#d2d9e1;">trace</span></span></span></span></p> <p style="margin-left:36px;"></p> -
RE: How to get MaxHold spectrum data from RSA306B with RSA_API?
<p>Attachments: Figure of nice signalvu trace, figure of "SPECTRUM" command data (without maxhold and with trying to set maxhold using the dpx command for it*), figure of "DPX" command data (right shape wrong values).</p> <p></p> <p>* Added this line to the end of the config_spectrum function as it seems to be the only way to set maxhold on. Didn't seem to have any effect.:</p> <pre style="background-color:#2b2b2b;color:#a9b7c6;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">rsa.DPX_SetSpectrumTraceType(RSA_API.SpectrumTraces.SpectrumTrace1<span style="color:#cc7832;">, </span>RSA_API.TraceType.TraceTypeMaxHold) </pre> -
How to get MaxHold spectrum data from RSA306B with RSA_API?
I am trying to collect spectrum data from an RSA306B.<br> <br> Using the signalvu program the data trace looks good: clear shape and max values around -30 dBm. How do I get this data trace via the RSA_API though? I tried two approaches without success: <ol> <li>Using "SPECTRUM" commands - there doesn't seem to be a way to set maxhold on.</li> <li>Using "DPX" commands - data is the right shape but wrong values.</li> </ol>