Analyzing while capturing

Hi I’m new to automation. I was wondering if there is a way to analyze data as it is being captured. Currently, I have this code:

with manager.start_capture(
            device_configuration=device_configuration,
            capture_configuration=capture_configuration) as capture:
    # add different trigger to stop capture
        time.sleep(5)
        capture.stop()
        # Add analyzers to the capture
        A1 = capture.add_analyzer('Async Serial', label=f'a1', settings={
            'Input Channel': 4,
            'Bit Rate (Bits/s)': 2000000,
            'Bits per Frame': '8 Bits per Transfer (Standard)',
            'Stop Bits': '1 Stop Bit (Standard)',
            'Parity Bit': 'No Parity Bit (Standard)',
            'Significant Bit': 'Least Significant Bit Sent First (Standard)',
            'Signal inversion': 'Non Inverted (Standard)',
            'Mode': 'Normal'
        })
        A2 = capture.add_analyzer('Async Serial', label=f'a2', settings={
            'Input Channel': 5,
            'Bit Rate (Bits/s)': 2000000,
            'Bits per Frame': '8 Bits per Transfer (Standard)',
            'Stop Bits': '1 Stop Bit (Standard)',
            'Parity Bit': 'No Parity Bit (Standard)',
            'Significant Bit': 'Least Significant Bit Sent First (Standard)',
            'Signal inversion': 'Non Inverted (Standard)',
            'Mode': 'Normal'
        })
        A3 = capture.add_analyzer('Async Serial', label=f'a3', settings={
            'Input Channel': 6,
            'Bit Rate (Bits/s)': 2000000,
            'Bits per Frame': '8 Bits per Transfer (Standard)',
            'Stop Bits': '1 Stop Bit (Standard)',
            'Parity Bit': 'No Parity Bit (Standard)',
            'Significant Bit': 'Least Significant Bit Sent First (Standard)',
            'Signal inversion': 'Non Inverted (Standard)',
            'Mode': 'Normal'
        })
        A4 = capture.add_analyzer('Async Serial', label=f'a4', settings={
            'Input Channel': 7,
            'Bit Rate (Bits/s)': 2000000,
            'Bits per Frame': '8 Bits per Transfer (Standard)',
            'Stop Bits': '1 Stop Bit (Standard)',
            'Parity Bit': 'No Parity Bit (Standard)',
            'Significant Bit': 'Least Significant Bit Sent First (Standard)',
            'Signal inversion': 'Non Inverted (Standard)',
            'Mode': 'Normal'
        })
# rest of code

Here, the capture stops, then analyzes each channel individually, but I’m trying to analyze the data as it is being collected. When I put capture.stop() after adding each analyzer, the code gets stuck on the first analyzer and never stops unless I manually click the stop in the gui. After I click stop, then the rest of the analyzers analyze one by one. Is there a way around this so that all 4 analyzers are analyzing at the same time as the capture is happening?

Also this makes me worried with having to trigger the stop. Would that mean I have to have a empty while loop running until the trigger happens to stop the capture?

@alyssac86 This is unfortunately not yet supported with our Automation API. I’ll bring this up with our software team however and we’ll take a look at your provided code in more detail.

With regards to your question below.

You are correct. The automation will continue running indefinitely until the trigger is found. You can add a timeout that calls the stop() function after a certain period of time has passed however.