How to rename the logic channel names via automation API?

I am using the Logic 2 Automation API (logic2-automation Python package) to run automated captures from a test script called via NI TestStand.

My setup:

  • Device: Logic Pro 16
  • Software: Logic 2
  • Python package: logic2-automation
  • OS: Windows 10

What I am doing:

I start a capture programmatically using:
import saleae.automation as saleae_automation

capture = logic.start_capture(
device_configuration=saleae_automation.LogicDeviceConfiguration(
enabled_analog_channels=[0, 1, 2, 5, 6, 7],
enabled_digital_channels=[3, 4],
analog_sample_rate=6_250,
digital_sample_rate=6_250_000,
digital_threshold_volts=1.2,
glitch_filters=,
),
capture_configuration=saleae_automation.CaptureConfiguration(
capture_mode=saleae_automation.TimedCaptureMode(
duration_seconds=10.0
)
)
)
capture.wait()
capture.save_capture(filepath=“C:\captures\capture_cycle_00001.sal”)
capture.close()

The problem:

When I open the saved .sal file in Logic 2, the channel names show as generic labels:

But I want them to show as:

What I already tried:

  1. Renaming channels manually in the Logic 2 UI — the names show correctly in the live UI session but when start_capture() is called via automation it opens a new blank session that ignores the UI channel names.

  2. Tried capture.rename_channel() — this method does not exist in the logic2-automation API and throws AttributeError: 'Capture' object has no attribute 'rename_channel'.

  3. Tried loading a template .sal file with logic.load_capture() before starting the capture — but start_capture() still opens a new blank session ignoring the template.

My question:

Is there any way to:

  1. Set or rename channel names via the automation API before or after capture?
  2. Or load a device configuration that includes channel names so they persist into automated captures?
  3. Or any other workaround to get correct channel names in .sal files saved via automation?

We need the channel names to be correct so engineers can open any .sal file and immediately identify the signals without manually renaming 8 channels each time.

Any help appreciated. Thank you!


Environment:
Logic 2 version : latestlogic2-automation : latest (pip install logic2-automation)Python : 3.10.11OS : Windows 10Device : Logic Pro 16

Does this script work for you:

?

Note: this was developed for classic Logic 8/16 [Pro] analyzers, and hasn’t been tested on new Logic MSO, especially for >16 channels (I don’t have >16 digital channel capability myself to test it).