Python api csv duration not matching

with automation.Manager.connect(port=10430) as manager:                                  
     device_config = automation.LogicDeviceConfiguration(enabled_analog_channels=[0],analog_sample_rate=3_125_000)
     capture_config = automation.CaptureConfiguration(capture_mode=automation.TimedCaptureMode(duration_seconds=0.00025))
     with manager.start_capture(device_id='F4241',device_configuration=device_config,capture_configuration=capture_config) as capture:
             capture.wait()
             output_dir = os.path.join(os.getcwd(), f'output-{datetime.now().strftime("%Y-%m-%d_%H-%M-%S")}')
             os.makedirs(output_dir)
             capture.export_raw_data_csv(directory=output_dir, analog_channels=[0])

Hi, I am trying to capture 250uS at 3.125MS/s analog signal using the python api on the logic pro 16. I’m following the getting started guide and using the demo device to export a csv but the csv has 218449 entries and the time data goes up to 69.92ms. Also there seems to be multiple amplitude data points per time. Is there a minimum amount of time you must record? I am trying to keep the file size small.

I saw there is a 100ms minimum in the gui so I tried changing TimedCaptureMode(duration_seconds=0.1) but it is still giving me too many samples. The new csv was 436905 samples * 1/3125000 = 0.1398096 seconds

@alexander.toy96 139 ms is approximately our minimum capture length, which is what you’ve noted. The software says 100 ms for simplicity, but due to how our software chunks recordings in memory, it equates to around 139 ms.

There is a workaround however. In the software, you can set a “trim” value of 250 us, meaning the software will keep the last 250 us of your capture and will discard the rest. I’ve provided an image of where that setting is in the UI below.

you can set this in your automation script via trim_data_seconds.

1 Like