You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Problems detecting ADC Overloads using Python and RSA API #1
I am using Python and the RSA API to control the RSA306B. I've written the following two functions in order to query the ADC overload status. If I understand correctly, the DEVICE_GetEventStatus API call when the event_id argument is set to zero, queries whether an overload event has occurred. The IQBLK_GetIQAcqInfo call returns the relevant overload status and associated timestamp information.
In order to detect the overload, I injected a CW into the RSA and increased the power until I expected to see an overload (I determined what this level should be by using the SignalVu software), yet my software failed to detect the overload event. I have scaled down and attached my code hoping that you can help me trouble shoot what I may be doing wrong. Thanks in advance!
You are using the function correctly, but don't think it is in the right place in your code. According to the API documentation, DEVICE_GetEventStatus() must be called while the RSA is in the Run state since the device status is not updated while the RSA is in the Stop state. Even then I found that the command should be used directly prior to grabbing acquisition data (e.g. SPECTRUM_GetTrace(), IQBLK_GetIQData(), DPX_GetFrameBuffer(), etc.). It did not consistently update if I used it right after calling DEVICE_Run() or SPECTRUM_AcquireTrace(), only when used right before the XXX_GetXXX() functions.
Try this out and let me know if that fixes the issue!
Example below from rsa_api_full_example.py in the acquire_spectrum function:
def acquire_spectrum(specSet):
ready = c_bool(False)
traceArray = c_float * specSet.traceLength
traceData = traceArray()
outTracePoints = c_int(0)
traceSelector = SpectrumTraces.SpectrumTrace1
rsa.DEVICE_Run()
rsa.SPECTRUM_AcquireTrace()
while not ready.value:
rsa.SPECTRUM_WaitForDataReady(c_int(100), byref(ready))
# Put it here!
print(query_device_status())
rsa.SPECTRUM_GetTrace(traceSelector, specSet.traceLength, byref(traceData),
byref(outTracePoints))
rsa.DEVICE_Stop()
return np.array(traceData)
Hi Morgan:
I didn't add that because I think the documentation states that if the device is not in a run state, the call below will put it in a run state. I will add that in and see what happens, thanks!
Heather
rsa.IQBLK_AcquireIQData()
________________________________
From: Morgan Allison <notifications@github.com>
Sent: Monday, June 19, 2017 10:32:38 AM
To: tkzilla/rsa_api_python_36
Cc: Ottke, Heather; Author
Subject: Re: [tkzilla/rsa_api_python_36] Problems detecting ADC Overloads using Python and RSA API (#1)
You are using the function correctly, but don't think it is in the right place in your code. According to the API documentation, DEVICE_GetEventStatus() must be called while the RSA is in the Run state since the device status is not updated while the RSA is in the Stop state. Even then I found that the command should be used directly prior to grabbing acquisition data (e.g. SPECTRUM_GetTrace(), IQBLK_GetIQData(), DPX_GetFrameBuffer(), etc.). It did not consistently update if I used it right after calling DEVICE_Run() or SPECTRUM_AcquireTrace(), only when used right before the XXX_GetXXX() functions.
Try this out and let me know if that fixes the issue!
Example below from rsa_api_full_example.py in the acquire_spectrum function:
def acquire_spectrum(specSet):
ready = c_bool(False)
traceArray = c_float * specSet.traceLength
traceData = traceArray()
outTracePoints = c_int(0)
traceSelector = SpectrumTraces.SpectrumTrace1
rsa.DEVICE_Run()
rsa.SPECTRUM_AcquireTrace()
while not ready.value:
rsa.SPECTRUM_WaitForDataReady(c_int(100), byref(ready))
# Put it here!
print(query_device_status())
rsa.SPECTRUM_GetTrace(traceSelector, specSet.traceLength, byref(traceData),
byref(outTracePoints))
rsa.DEVICE_Stop()
return np.array(traceData)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#1 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AJ-3fio0enPOFYrcxCbINFM-2One2Rnkks5sFqKmgaJpZM4N9BAw>.
Again you're correct that IQBLK_AcquireIQData() puts the instrument in the Run state. I believe the timing of the query_device_status() may not be quite right. Where are you putting query_device_status() in the acquisition section of your code?
Activity
tkzilla commentedon Jun 19, 2017
You are using the function correctly, but don't think it is in the right place in your code. According to the API documentation, DEVICE_GetEventStatus() must be called while the RSA is in the Run state since the device status is not updated while the RSA is in the Stop state. Even then I found that the command should be used directly prior to grabbing acquisition data (e.g. SPECTRUM_GetTrace(), IQBLK_GetIQData(), DPX_GetFrameBuffer(), etc.). It did not consistently update if I used it right after calling DEVICE_Run() or SPECTRUM_AcquireTrace(), only when used right before the XXX_GetXXX() functions.
Try this out and let me know if that fixes the issue!
Example below from rsa_api_full_example.py in the acquire_spectrum function:
heatherottke commentedon Jun 20, 2017
tkzilla commentedon Jun 20, 2017
Again you're correct that IQBLK_AcquireIQData() puts the instrument in the Run state. I believe the timing of the query_device_status() may not be quite right. Where are you putting query_device_status() in the acquisition section of your code?