# enze-yi/bfm-tool architecture

> Architecture diagram of the GitHub repository enze-yi/bfm-tool, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/enze-yi/bfm-tool
- Repository: https://github.com/enze-yi/bfm-tool

## Overview

BFM Tool captures Wi-Fi beamforming feedback, reconstructs the feedback matrix, and saves packet data for MATLAB analysis of the BFM ratio. The main workflow runs from captured packets through tshark and the Python capture program to `.mat` output and MATLAB analysis. The Python excerpt shows packet parsing, decompression, and saving; the MATLAB stage and ratio calculation are documented in the README but its source was not sampled, so internal MATLAB relationships are not expanded.

Main entry points: [`BFM_capture.py`](https://github.com/enze-yi/bfm-tool/blob/main/BFM_capture.py) (Packet ingestion), [`readBFM.m`](https://github.com/enze-yi/bfm-tool/blob/main/readBFM.m) (MATLAB analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Packet capture"]
  node_tshark["tshark capture"]
end

subgraph group_processing["BFM processing"]
  node_ingest["Packet ingestion<br/>[BFM_capture.py]"]
  node_extract["Report extraction<br/>[BFM_capture.py]"]
  node_decompress["Matrix reconstruction<br/>[BFM_capture.py]"]
  node_matfiles[("BFM .mat files<br/>[BFM_capture.py]")]
end

subgraph group_analysis["Data analysis"]
  node_matlab["MATLAB analysis<br/>[readBFM.m]"]
  node_ratio["BFM ratio<br/>[readBFM.m]"]
end

node_wifi(("Wi-Fi traffic"))

node_wifi -->|"captures packets"| node_tshark
node_tshark -->|"pipes fields"| node_ingest
node_ingest -->|"calls"| node_extract
node_ingest -->|"calls"| node_decompress
node_ingest -->|"writes"| node_matfiles
node_matfiles -->|"loads for parsing"| node_matlab
node_matlab -->|"calculates"| node_ratio

click node_ingest "https://github.com/enze-yi/bfm-tool/blob/main/BFM_capture.py"
click node_extract "https://github.com/enze-yi/bfm-tool/blob/main/BFM_capture.py"
click node_decompress "https://github.com/enze-yi/bfm-tool/blob/main/BFM_capture.py"
click node_matfiles "https://github.com/enze-yi/bfm-tool/blob/main/BFM_capture.py"
click node_matlab "https://github.com/enze-yi/bfm-tool/blob/main/readBFM.m"
click node_ratio "https://github.com/enze-yi/bfm-tool/blob/main/readBFM.m"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_tshark toneBlue
class node_ingest,node_extract,node_decompress,node_matfiles toneAmber
class node_matlab,node_ratio toneMint
class node_wifi toneIndigo
```

## Components

### Packet capture

- **tshark capture**

### BFM processing

- [Packet ingestion](https://github.com/enze-yi/bfm-tool/blob/main/BFM_capture.py): `BFM_capture.py`
- [Report extraction](https://github.com/enze-yi/bfm-tool/blob/main/BFM_capture.py): `BFM_capture.py`
- [Matrix reconstruction](https://github.com/enze-yi/bfm-tool/blob/main/BFM_capture.py): `BFM_capture.py`
- [BFM .mat files](https://github.com/enze-yi/bfm-tool/blob/main/BFM_capture.py): `BFM_capture.py`

### Data analysis

- [MATLAB analysis](https://github.com/enze-yi/bfm-tool/blob/main/readBFM.m): `readBFM.m`
- [BFM ratio](https://github.com/enze-yi/bfm-tool/blob/main/readBFM.m): `readBFM.m`

### Other components

- **Wi-Fi traffic**

## Connections

- Wi-Fi traffic → tshark capture: captures packets (evidence: `README.md`)
- tshark capture → Packet ingestion: pipes fields (evidence: `README.md`)
- Packet ingestion → Report extraction: calls (evidence: `BFM_capture.py`)
- Packet ingestion → Matrix reconstruction: calls (evidence: `BFM_capture.py`)
- Packet ingestion → BFM .mat files: writes (evidence: `BFM_capture.py`)
- BFM .mat files → MATLAB analysis: loads for parsing (evidence: `README.md`)
- MATLAB analysis → BFM ratio: calculates (evidence: `README.md`)
