Skip to main content

Your first capture

Connect, open a demo device, capture, count the edges, close. No hardware needed: the program runs against se254, a demo device every server offers.

Make sure a server is running first: either the ScanaStudio application, or the scanastudio-server binary it installs, run on its own. Both are covered under Installation.

from ikalogic_scanastudio import ScanaStudio, Trigger

with ScanaStudio.connect() as server:
print(server.info)

for device in server.devices():
print(" ", device)

workspace = server.create("se254")
print(f"\nopened {workspace.device_name} "
f"with {len(workspace.channels)} channels")

last = workspace.capture.run(
samples=1_000_000,
sample_rate=25_000_000,
trigger=Trigger.immediate(),
)
seconds = workspace.capture.seconds(last)
print(f"captured {last} samples ({seconds:.3f} s) "
f"at {workspace.capture.sample_rate} S/s")

edges = sum(1 for _ in workspace.data.transitions(channel=0))
print(f"channel 0 holds {edges} transitions")

workspace.close()

Run it:

python first_capture.py

What it prints​

On the se254 demo device:

ScanaStudio 6.0.13 (1a909ee), protocol 8
se254 — SE254 (demo) (demo)
sp209 — SP209 (demo) (demo)
sp209i — SP209I (demo) (demo)
sp259 — SP259 (demo) (demo)
sp259i — SP259I (demo) (demo)
sp1018 — SP1018 (demo) (demo)
sp1036 — SP1036 (demo) (demo)
sp1054 — SP1054 (demo) (demo)

opened SE254 (demo) with 4 channels
captured 1000000 samples (0.040 s) at 25000000 S/s
channel 0 holds 191 transitions

The transition count changes on every run, since a demo device generates a new pseudo-random signal each time.

What just happened​

  1. connect() connected to the server at ws://127.0.0.1:4911 and checked that both sides speak the same protocol version.
  2. devices() listed what the server can open: your hardware, plus the demo devices.
  3. create("se254") created a workspace: a session that owns the device, the capture, and everything attached to it.
  4. capture.run() armed the acquisition and waited for it. It returns the index of the last sample captured.
  5. transitions(0) read the edges on channel 0. Bulk data is only transferred when you read it.
  6. close() ended the workspace on the server.
A demo device generates noise

se254 produces pseudo-random signals, not protocol traffic. It exercises the whole path (capture, decode, measure, export), which makes it useful for writing and testing a script, but it will not show you a real I²C address.

Closing the connection is not closing the workspace

workspace.close() ends the session on the server. Disconnecting does not: the capture keeps running and you can attach to it later. See Headless datalogger.

Next​