Table of Contents
Current API v5 — Software ≥ 4.1
An updated API client is available for EMScope software version 4.1 and later. It extends the v4 interface with several protocol and usability improvements:
- Binary amplitude frames: measurement data is now transmitted as binary WebSocket frames (
[flags : uint8][padding : 3 bytes][float32 values …]) instead of JSON, reducing overhead on high-frequency sweeps. The client decodes them transparently. - Cached frequency axis: the server sends the frequency array only when the RBW or display range changes — not on every sweep.
self.freqis updated automatically and shared across consecutive binary frames. has_sweep_data(msg): a new helper method that returnsTruefor both binary amplitude frames (EMI mode) and JSONvaluesmessages (impedance mode), replacing the manual“values” in msgcheck used in v4.repetitionflag:self.repetitionis set toTruewhen a quasi-peak repeat sweep was triggered (200 Hz / 9 kHz bands only).- Convenience setters: dedicated methods (
set_detector_type(),set_measure_channel(),set_display_range(),set_amp_units(), etc.) alongside the genericset_value(). - Parallel multi-detector measurement: an additional example demonstrates simultaneous PK + QP + AV acquisition using three concurrent WebSocket connections and
asyncio.gather.
The api_v5.py and api_example_v5.py files are provided. The api_example_v5_multi_detector.py file demonstrates simultaneous PK + QP + AV measurement using parallel connections.
Required libraries: websockets, matplotlib. Python 3.8 or later is required.
For a detailed description of the underlying WebSocket protocol, refer to the WebSocket API documentation.
Legacy APIs
Software ≤ 3.13
The api.py and api_example.py files are provided for use with EMScope software versions 3.13 and earlier.
Required libraries: websockets, json. The matplotlib library is used in the example script.
API v4 — Software = 4.0
A fully redesigned API client is available for EMScope software version 4.0. It introduces a cleaner interface, automatic RBW and display range management, robust session handling, and transparent keepalive ping/pong support.
The api_v4.py and api_example_v4.py files are provided.
Required libraries: websockets, matplotlib. Python 3.8 or later is required.
