Jump to content
  • 0

Analog Discovery 2 recording data to file


Stefano Stanzione

Question

Dear all,

 

I recently started using the Analog Discovery 2 and trying to setup a long measurement acquisition (e.g. 1 minute) with the scope at relatively high sampling rate (e.g. 1MHz). For this one has to play with scripting, since it is needed to do multiple acquisitions followed by data writing into a file. The acquisition seems to work, since I can for example print the data on the screen. So, data seems to be there. However, the function File(file_path/file_name.csv).write(Scope1.Channel1.data) does not give any error, while not creating the file. I would have expected an error if the file was not created. So, I am not even sure what went wrong. Could you give me some advise on how to solve this?

Also, is there a reference manual or a tutorial more detailed than the Help inside the Waveform tool?

Below my simple initial script for reference (just made by modifying an example):

 

Scope1.single();

print(Scope1.Channel1.data);   // This shows data on the screen. So, seems data is there...

 

File("C:\My_dir\acquisition.csv").write(Scope1.Channel1.data);    // This does not create the file in my directory.

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Try using the export function. It takes multiple parameters for the settings which you can read on waveforms manual but for the default settings you can do this for data:

Scope.Export("C:\My_dir\acquisition.csv")

and this for the scope screenshot:

Scope.Export("C:\My_dir\acquisition.png")

 

best,
Dante.

Link to comment
Share on other sites

  • 0

Hi @Stefano Stanzione

Saving large amount of data in text format requires a lot of space and it will be slow.
It may also exceed the Script tool capabilities like in your script the data is transformed to text in script.

For such huge amount of data better to use the Record to File option:
image.png.93275c43ec4ceb74ac7a2c608e09a1ca.png

To save the data in double (64bit float) use:
File("~/Desktop/acquisition.bin").writeDouble(Scope1.Channel1.data);

To save as text with the help of the application code:
Scope.Export("~/Desktop/acquisition.csv", "Channel 1", false, false, false, false);

image.thumb.png.38acb44e9443ada25718415ab5be7919.png

image.thumb.png.a4f8870849285a90fa4c262b239360c3.png

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...