==== 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.freq'' is updated automatically and shared across consecutive binary frames. * **''has_sweep_data(msg)''**: a new helper method that returns ''True'' for both binary amplitude frames (EMI mode) and JSON ''values'' messages (impedance mode), replacing the manual ''"values" in msg'' check used in v4. * **''repetition'' flag**: ''self.repetition'' is set to ''True'' when 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 generic ''set_value()''. * **Parallel multi-detector measurement**: an additional example demonstrates simultaneous PK + QP + AV acquisition using three concurrent WebSocket connections and ''asyncio.gather''. The {{ :public:emscope:api_v5.py |}} and {{ :public:emscope:api_example_v5.py |}} files are provided. The {{ :public:emscope: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 [[public:emscope:websocket_api|WebSocket API]] documentation. ---- ===== Legacy APIs ===== ==== Software ≤ 3.13 ==== The {{ :public:emscope:api.py |}} and {{ :public:emscope: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 {{ :public:emscope:api_v4.py |}} and {{ :public:emscope:api_example_v4.py |}} files are provided. Required libraries: **websockets**, **matplotlib**. Python **3.8 or later** is required.