I am wondering how I can increase the total recording time of the `scope` module in the SDK. I am trying to record and plot the output of a component and require a 30 second recording of scope data.
Currently the SDK defaults to 0.5s.
What I am doing is:
def test(device_data):
scope.open(device_data)
dwf.FDwfAnalogInRecordLengthSet(hdwf,30)
dwf.FDwfAnalogInTriggerPositionSet(hdwf,c_double(-0.01))# set up triggering on scope channel 1# scope.trigger(device_data, enable=True, source=scope.trigger_source.analog, channel=1, level=3.3)
sleep(1)# wait 1 second# record data with the scopeon channel 1
buffer = scope.record(device_data, channel=1)# limit displayed data size
length = len(buffer)if length >10000:
length =10000
buffer = buffer[0:length]# generate buffer for time moments
time =[]for index in range(len(buffer)):
time.append(index *1e03/ scope.data.sampling_frequency)# convert time to ms# Plot settings
plt.grid(True)
plt.yticks([i *0.1for i in range(0,41)])
plt.ylim(0,4)
plt.xlabel("time [ms]")
plt.ylabel("voltage [V]")#Plot Data
plt.plot(time, buffer)
plt.show()
scope.close(device_data)
SDK documentation and other forum examples showed the use of `FDwfAnalogInRecordLengthSet`, however this has not changed the time of recording. I also tried increasing the buffer size but no luck and removing the `if length > 10000` buffer check. What have I missed here? I found that setting `scope.trigger` waits until the threshold has been reached to start, but again this just records 0.5s worth of data when I need the full 30s.
Question
gabagool
Device: Analog Discovery 3
Hi,
I am wondering how I can increase the total recording time of the `scope` module in the SDK. I am trying to record and plot the output of a component and require a 30 second recording of scope data.
Currently the SDK defaults to 0.5s.
What I am doing is:
SDK documentation and other forum examples showed the use of `FDwfAnalogInRecordLengthSet`, however this has not changed the time of recording. I also tried increasing the buffer size but no luck and removing the `if length > 10000` buffer check. What have I missed here? I found that setting `scope.trigger` waits until the threshold has been reached to start, but again this just records 0.5s worth of data when I need the full 30s.
Edited by gabagoolLink to comment
Share on other sites
1 answer 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