Below, we show example code specifying the proper parameters for export_data2()
, which is used for exporting data via Socket API (our automation utility). This function comes from a 3rd party Python Wrapper for Socket API, which we recommend using for automating our software.
Note: For exporting data, please use export_data2().
Currently, export_data()
is deprecated due to an update that increased the number of export options.
The following sample arguments are taken directly from the export options available in the Logic software's data export window (Options -> Export data).
time_span=None
will export all time
digital_channels=None, analog_channels=None
will export all channels
delimiter = 'comma' | 'tab'
timestamp = 'time_stamp' | 'sample_number'
display_base = 'bin' | 'dec' | 'hex' | 'ascii' | 'separate'
analog_format = 'voltage' | 'adc'
The code for all available argument options can be found in the saleae.py library file.
s.export_data2("/Users/UserName/Desktop/my_file.csv", digital_channels=[2, 3], analog_channels=None, time_span=[0, 0.1], format='csv', column_headers=False, delimiter='comma', timestamp='time_stamp', display_base='separate', rows_per_change=True)
s.export_data2("/Users/UserName/Desktop/my_file.csv", digital_channels=None, analog_channels=[2,3], time_span=[0, 0.1], format='csv', column_headers=True, delimiter='comma', analog_format='voltage')
s.export_data2("/Users/UserName/Desktop/my_file.mat", digital_channels=[2, 3], analog_channels=None, time_span=[0, 0.1], format='matlab')
s.export_data2("/Users/UserName/Desktop/my_file.mat", digital_channels=[2, 3], analog_channels=[2,3], time_span=[0, 0.1], format='matlab', analog_format='voltage')
Note: Either digital_channels
or analog_channels
must be set to 'None'
. Binary export does not work when digital and analog channels are combined in a single export.
s.export_data2("/Users/UserName/Desktop/my_file.bin", digital_channels=[2, 3], analog_channels=None, time_span=[0, 0.1], format='binary', each_sample=True, no_shift=True, word_size=16)
s.export_data2("/Users/UserName/Desktop/my_file.bin", digital_channels=None, analog_channels=[2,3], time_span=[0, 0.1], format='binary', analog_format='adc')
Note: Only digital channels can support VCD exports.
s.export_data2("/Users/UserName/Desktop/my_file.vcd", digital_channels=[2, 3], analog_channels=None, time_span=[0, 0.1], format='vcd')
Below, we show example code specifying the proper parameters for export_data2
, which is used for exporting data via Socket API (our automation utility). This function comes from our list of supported socket commands. This is a more direct approach when automating the Logic software.
Note: For exporting data, please use export_data2
since currently, export_data
is deprecated due to an update that increased the number of export options.
The general format of the command is as follows:
export_data2,<file location>,ALL_CHANNELS | SPECIFIC_CHANNELS,[DIGITAL_ONLY | ANALOG_ONLY | ANALOG_AND_DIGITAL],<channel index> ANALOG | DIGITAL, ..., <channel index> ANALOG | DIGITAL,ALL_TIME | TIME_SPAN, <(double)start>, <(double)end>BINARY, <binary settings> | CSV, <csv settings> | VCD | MATLAB, <matlab settings>
Note: Only digital channels can support VCD exports. Using ALL_CHANNELS
will only work if there are no analog channels enabled. Otherwise, it will throw an error. Due to this, it is recommended to use SPECIFIC_CHANNELS
instead.
export_data2, /Users/UserName/Desktop/my_file.vcd, SPECIFIC_CHANNELS, 0 DIGITAL, ALL_TIME, VCD
export_data2, /Users/UserName/Desktop/my_file.vcd, SPECIFIC_CHANNELS, 0 DIGITAL, 1 DIGITAL, 2 DIGITAL, 3 DIGITAL, ALL_TIME, VCD
export_data2, /Users/UserName/Desktop/my_file.vcd, SPECIFIC_CHANNELS, 0 DIGITAL, 1 DIGITAL, 2 DIGITAL, 3 DIGITAL, TIME_SPAN, 0, 0.1, VCD
export_data2, /Users/UserName/Desktop/my_file.csv, SPECIFIC_CHANNELS, 0 DIGITAL, 1 DIGITAL, 2 DIGITAL, 3 DIGITAL, ALL_TIME, CSV, HEADERS, COMMA, SAMPLE_NUMBER, SEPARATE, ROW_PER_CHANGE