I working on an application that allows continuous streaming of data.
Due to certain reasons, I cannot use the ShiftScreen functionality: My producer process (the AD2 device) captures the available samples from the device and then they are sent to the consumer process. For this, I used the sample AnalogIn_Record_Wave_Mono.py as a basis.
Note: This behavior has only been seen on demo devices yet. Since I'm in Homeoffice right now, I do not have physical access to our Analog Discovery to verify if it is an issue with the API or the Demo Implementation. However, even if it is an issue with the demo device this is crucial, for debugging reasons, I also need to not require physical hardware.
The first thing I noticed is that the API call differs from the WafeForm API Documentation. The Code suggests, that a -1 passed to the function
# AnalogIn_Record_Wave_Mono.py, Line 79:
dwf.FDwfAnalogInRecordLengthSet(hdwf, c_double(-1))# -1 infinite record length
however, the documentation clearly says that a zero must be passed to set the record length to infinite:
Quote
FDwfAnalogInRecordLengthSet(HDWF hdwf, double sLegth):
Description: Sets the Record length in seconds. With length of zero, the record will run indefinitely.
Parameters:
- hdwf – Interface handle.
- sLegth – Record length to set expressed in seconds.
Secondly, the passed -1 seems to work with physical hardware (like the AD2). The same parameter seems to be accepted also by the Demo devices, however, using this line with the Demo device and reading the available samples raises a ValueError:
# AnalogIn_Record_Wave_Mono.py, Line 140
rgSamples =(c_int16*cAvailable.value)()# ---------------------------------------------------#Traceback(most recent call last):File"C:\...\py\AnalogIn_Record_Wave_Mono.py", line 140,in<module>
rgSamples =(c_int16*cAvailable.value)()ValueError:Array length must be >=0,not-2146675454
Passing a zero, the data captures are corrupted but are not recognized by the drive as currupted.
Question
agentsmith
I working on an application that allows continuous streaming of data.
Due to certain reasons, I cannot use the ShiftScreen functionality: My producer process (the AD2 device) captures the available samples from the device and then they are sent to the consumer process. For this, I used the sample AnalogIn_Record_Wave_Mono.py as a basis.
Note: This behavior has only been seen on demo devices yet. Since I'm in Homeoffice right now, I do not have physical access to our Analog Discovery to verify if it is an issue with the API or the Demo Implementation. However, even if it is an issue with the demo device this is crucial, for debugging reasons, I also need to not require physical hardware.
dwf.FDwfAnalogInRecordLengthSet(hdwf, c_double(10)) # 10 seconds
dwf.FDwfAnalogInRecordLengthSet(hdwf, c_double(0)) # 10 seconds
I have attached my example file as well. How do I cope with this issue (Point 2/Point3)?
Kind regards,
Chris
AnalogIn_Record_Wave_Mono.py
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now