Iterating through data from multiple channels


#1

Hello,

I need my script to process both main current and main energy data while running a test. I need to do this every 10 seconds and get only the last 10 seconds of data from these channels to perform the processing on. I am using these calls:

        local mc_count = project:get_channel_count(box, recording_id, "mc")
        local mc_data = project:get_channel_data(box, recording_id, "mc", prev_count, mc_count)

        local me_count = project:get_channel_count(box, recording_id, "me")
        local me_data = project:get_channel_data(box, recording_id, "me", prev_count, me_count)

prev_count is the count from the last time I made these calls.

Even using prev_count, I sometimes get data that is earlier than I wanted. I also have to then match up the mc data and me data based on timestamp, which is slow when the program is running.

Is there a better way to do this? Is there a way I can get data by timestamp (rather than index)? Is there a way I can get both me and mc data without having to manually match up the samples?

Thanks!


#2

Hi,

Right now, there is no lua API for getting data by timestamp but I will add this in the back-log.

To minimise the difference you could have get_channel_count for me directly after get_channel_count for mc and then both get_channel_data.

Best regards,
Björn