Hi,
I’ve noticed with “export_raw_data_csv” function sometimes the data is cut off when there are four channels of data being exported. Strangely enough the capture file gets saved correctly but the csv doesn’t match. I can open the capture and re export it and everything gets exported as expected. Unfortunately this solution doesn’t work when trying to automate testing.
I’ve only noticed this with multiple channels.
Here’s the code I’m using to export the data:
def save_capture(self, filepath, name):
self.capture.export_raw_data_csv(directory=str(filepath), analog_channels=self.analog_channels, digital_channels=self.digital_channels)
shutil.move(str(filepath)+'/digital.csv',str(filepath)+'/'+name+'.csv')
self.capture.save_capture(str(filepath)+'/'+name+'.sal')
Heres an example of the saved capture and the output raw csv:
multi.txt (176 Bytes)
multi.sal (3.6 KB)
@cwilliamson It looks like a race condition is occurring in your automation script. Are you calling wait() before exporting your raw data like in the example script below?
https://saleae.github.io/logic2-automation/getting_started.html
Hi Tim, thanks for the response.
It shouldn’t be an issue as I’m running it in manual capture mode and using the stop() function. Whats also strange is the exported sal file is all good. I ran it around 300 times and it only fails about 6 times which isn’t bad but would be nice to figure out what is causing it.
@cwilliamson Hmm… thanks for confirming that. Calling the stop() function should be enough.
It certainly sounds like an edge case since it only fails 6 out of 300 times. I’m now wondering if calling shutil.move
right after exporting the raw data might have something to do with that edge case. Is it convenient to remove that the shutil.move
command to test that theory out?
Also, would you mind sharing your entire Python script file? If it contains confidential information, we can move this conversation over email via the link below if you prefer.
https://contact.saleae.com/hc/en-us/requests/new
Was the cause of this issue ever determined? We are using the automation tools (Logic2-automation 1.0.7) and I saw something similar. We are calling stop_capture() without passing the bool, using the default = True. We have been using this for a while without seeing the issue, but I had a few instances the other day. My capture and csv are attached. Opening the .sal file and exporting gives the expected data.
capture.sal (3.9 KB)
digital.txt (148 Bytes)
@ken_van_den_heuvel We hadn’t heard back from the original poster, and therefore, the cause of the issue was never confirmed.
I’ll take a closer look at the files you sent over with the team here and we’ll share our findings once we get a chance to do so.
Hi Tim. Have you had a chance to look at the files? Another member of our team saw the issue as well. We will likely add a delay before stopping the capture to try to work around this issue. Then, if the .csv and .sal don’t match, hopefully it is just a difference near the end, but captures the data we are looking for.
@ken_van_den_heuvel Sorry for not having followed up with you on this! This has been on the queue, and I was planning to meet with the software team on this topic, however, some folks from the team have been out of office during the past week or so.
I just realized that you hadn’t sent over your Python script (i.e. .py file). Could you send that over to us?
Please also let us know if adding a delay helps. This will give us a clue that the issue is very likely a race condition on your end.
Hi Tim. I realized my original comment referenced some of our Python code. I don’t know if I can share all of our code, but for the following sequence, is a delay needed after the stop? This could explain why the .csv doesn’t have all of the data that the .sal has.
- stop()
- export_raw_data_csv()
- save_capture()
I did review several of our test results and the .csv and .sal do differ quite often, but only by about 30ms. I put a 250ms sleep after the stop() and this solved the problem.