# pmk-probing-solutions-germany/pmk-probes architecture

> Architecture diagram of the GitHub repository pmk-probing-solutions-germany/pmk-probes, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-10-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pmk-probing-solutions-germany/pmk-probes
- Repository: https://github.com/pmk-probing-solutions-germany/pmk-probes

## Overview

##### Project Type and Purpose
- Type: A Python SDK/library for controlling PMK active oscilloscope probes and their power supplies.
- Purpose: Expose a high-level API so clients can configure and read metadata from probes over serial/IP, abstracting away low-level hardware details.

##### Top-Level Components
- pmk_probes (the library)
- Data Structures (`_data_structures.py`)
- Devices/Domain
– Probes (`probes.py`)
– Power Supplies (`power_supplies.py`)
- Hardware Abstraction (`_hardware_interfaces.py`)
- Errors (`_errors.py`)
- Auxiliary (`_devices.py`)
- External Dependencies
- pyserial (for serial COM)
- stdlib / ip sockets (for network-attached supplies)
- External Systems
- Physical power supply hardware (PS03)
- Physical probe head (e.g., BumbleBee2kV)
- Oscilloscope (consumer of probe output)

##### Relationships & Data Flows
- User Application (leftmost) calls into pmk_probes API:
– Instantiates a PowerSupply object (e.g., PS03) using COM port or IP.
– Instantiates a Probe object (e.g., BumbleBee2kV) passing the supply and channel.
– Reads/writes properties (`attenuation`, `serial_number`, etc.)
- The Probe/PowerSupply object uses Hardware Interface layer to send/receive commands:
– SerialInterface (pyserial) or TcpInterface → physical device.
- Device responds → raw bytes → parsed into DataStructure/metadata → returned to user.
- Errors bubble up via custom error classes.

##### Architectural Patterns & Design Principles
- Layered Architecture—separate domain logic from hardware I/O.
- Dependency Injection—Probe accepts a PowerSupply instance.
- Single Responsibility—each module focuses on one concern (e.g., errors vs hardware I/O vs domain).
- Abstraction over concrete transports (serial vs TCP).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Top-level User Application
    UserApp["User Application"]:::app

    %% API Layer
    PublicAPI["Public API\n(pmk_probes/__init__.py)"]:::api
    click PublicAPI "https://github.com/pmk-probing-solutions-germany/pmk-probes/blob/master/pmk_probes/__init__.py"

    %% Domain Layer
    DataStructures["Data Structures\n(_data_structures.py)"]:::domain
    click DataStructures "https://github.com/pmk-probing-solutions-germany/pmk-probes/blob/master/pmk_probes/_data_structures.py"
    Probes["Probe Classes\n(probes.py)"]:::domain
    click Probes "https://github.com/pmk-probing-solutions-germany/pmk-probes/blob/master/pmk_probes/probes.py"
    PowerSupplies["Power Supply Classes\n(power_supplies.py)"]:::domain
    click PowerSupplies "https://github.com/pmk-probing-solutions-germany/pmk-probes/blob/master/pmk_probes/power_supplies.py"
    Errors["Error Handling\n(_errors.py)"]:::domain
    click Errors "https://github.com/pmk-probing-solutions-germany/pmk-probes/blob/master/pmk_probes/_errors.py"
    DevicesReg["Device Registry\n(_devices.py)"]:::domain
    click DevicesReg "https://github.com/pmk-probing-solutions-germany/pmk-probes/blob/master/pmk_probes/_devices.py"

    %% Infrastructure Layer
    HardwareInterfaces["Hardware Interfaces\n(_hardware_interfaces.py)\nPython ≥3.10\npyserial"]:::infra
    click HardwareInterfaces "https://github.com/pmk-probing-solutions-germany/pmk-probes/blob/master/pmk_probes/_hardware_interfaces.py"
    Pyserial["pyserial"]:::thirdparty
    Stdlib["stdlib / IP sockets"]:::thirdparty

    %% External Systems
    PS03["Physical Power Supply\n(PS03)"]:::hardware
    ProbeHead["Physical Probe Head\n(BumbleBee2kV)"]:::hardware
    Oscilloscope["Oscilloscope"]:::hardware

    %% Test Suite
    TestDs["Test DataStructures\n(tests/test_data_structures.py)"]:::test
    click TestDs "https://github.com/pmk-probing-solutions-germany/pmk-probes/blob/master/tests/test_data_structures.py"
    TestProbes["Test Probes\n(tests/test_probes.py)"]:::test
    click TestProbes "https://github.com/pmk-probing-solutions-germany/pmk-probes/blob/master/tests/test_probes.py"
    TestPS["Test PowerSupplies\n(tests/test_power_supplies.py)"]:::test
    click TestPS "https://github.com/pmk-probing-solutions-germany/pmk-probes/blob/master/tests/test_power_supplies.py"

    %% Connections
    UserApp -->|calls| PublicAPI

    PublicAPI -->|uses| Probes
    PublicAPI -->|uses| PowerSupplies
    PublicAPI -->|imports| DataStructures
    PublicAPI -->|imports| Errors
    PublicAPI -->|imports| DevicesReg

    Probes -->|injects supply| PowerSupplies
    Probes -->|uses| HardwareInterfaces
    PowerSupplies -->|uses| HardwareInterfaces

    HardwareInterfaces -->|via serial| Pyserial
    HardwareInterfaces -->|via TCP| Stdlib

    Pyserial -->|communicates| PS03
    Stdlib -->|communicates| PS03

    Probes -->|reads signal| ProbeHead
    ProbeHead -->|output| Oscilloscope

    TestDs -->|validates| DataStructures
    TestProbes -->|validates| Probes
    TestPS -->|validates| PowerSupplies

    %% Styles
    classDef app fill:#f0f8ff,stroke:#333,stroke-width:1px;
    classDef api fill:#d0f0c0,stroke:#333,stroke-width:1px;
    classDef domain fill:#cfe2f3,stroke:#333,stroke-width:1px;
    classDef infra fill:#ffe4b5,stroke:#333,stroke-width:1px;
    classDef thirdparty fill:#fff59d,stroke:#333,stroke-width:1px;
    classDef hardware fill:#c8e6c9,stroke:#333,stroke-width:1px;
    classDef test fill:#e0e0e0,stroke:#333,stroke-width:1px;
```
