# fiber-optic-sensing-system/mpg-foss architecture

> Architecture diagram of the GitHub repository fiber-optic-sensing-system/mpg-foss, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fiber-optic-sensing-system/mpg-foss
- Repository: https://github.com/fiber-optic-sensing-system/mpg-foss

## Overview

mpg-foss is a command-line tool for collecting fiber-optic interrogator (Gator) measurements and saving parsed sensor data as CSV. The main workflow is command dispatch, USB acquisition or simulated packets, packet parsing and sensor-value extraction, then optional CSV output; users can also clean prior output. The README documents plotting and wavelength/strain conversion capabilities, but the sampled plotting source is only a stub, so those capabilities are shown without inferred runtime links. Relationships reflect the excerpts and README; unsampled MATLAB implementations were not inspected.

Main entry points: [`modules/gator-data-to-csv.py`](https://github.com/fiber-optic-sensing-system/mpg-foss/blob/main/modules/gator-data-to-csv.py) (Gator collector), [`foss_start.py`](https://github.com/fiber-optic-sensing-system/mpg-foss/blob/main/foss_start.py) (Command router), [`foss.py`](https://github.com/fiber-optic-sensing-system/mpg-foss/blob/main/foss.py) (CLI launcher), [`modules/cleanup.py`](https://github.com/fiber-optic-sensing-system/mpg-foss/blob/main/modules/cleanup.py) (Output cleanup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Command entry"]
  node_launcher["CLI launcher<br/>[foss.py]"]
  node_command_router["Command router<br/>[foss_start.py]"]
end

subgraph group_collection["Gator collection"]
  node_collector["Gator collector"]
  node_packet_decoder["Packet parsing<br/>[fosmodule.py]"]
  node_packet_sim["Packet simulator<br/>[fosmodule.py]"]
end

subgraph group_outputs["Data outputs"]
  node_csv_export["CSV export"]
  node_output_files[("CSV output files")]
  node_cleanup["Output cleanup<br/>[cleanup.py]"]
  node_plotting["Measurement plots"]
  node_graphical_stub["Plotting stub<br/>[graphical-tools.py]"]
end

node_user(("Engineer"))
node_gator{{"Gator device"}}

node_user -->|"runs command"| node_launcher
node_launcher -->|"starts router"| node_command_router
node_command_router -->|"launches collection"| node_collector
node_collector -->|"reads USB data"| node_gator
node_collector -->|"parses packets"| node_packet_decoder
node_collector -->|"creates simulated packets"| node_packet_sim
node_collector -->|"prepares sensor rows"| node_csv_export
node_csv_export -->|"writes CSV"| node_output_files
node_command_router -->|"launches cleanup"| node_cleanup
node_cleanup -->|"removes CSV files"| node_output_files

click node_launcher "https://github.com/fiber-optic-sensing-system/mpg-foss/blob/main/foss.py"
click node_command_router "https://github.com/fiber-optic-sensing-system/mpg-foss/blob/main/foss_start.py"
click node_collector "https://github.com/fiber-optic-sensing-system/mpg-foss/blob/main/modules/gator-data-to-csv.py"
click node_packet_decoder "https://github.com/fiber-optic-sensing-system/mpg-foss/blob/main/modules/fosmodule.py"
click node_packet_sim "https://github.com/fiber-optic-sensing-system/mpg-foss/blob/main/modules/fosmodule.py"
click node_csv_export "https://github.com/fiber-optic-sensing-system/mpg-foss/blob/main/modules/gator-data-to-csv.py"
click node_output_files "https://github.com/fiber-optic-sensing-system/mpg-foss/tree/main/data/out"
click node_cleanup "https://github.com/fiber-optic-sensing-system/mpg-foss/blob/main/modules/cleanup.py"
click node_plotting "https://github.com/fiber-optic-sensing-system/mpg-foss/tree/main/matlab"
click node_graphical_stub "https://github.com/fiber-optic-sensing-system/mpg-foss/blob/main/modules/graphical-tools.py"

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_launcher,node_command_router toneBlue
class node_collector,node_packet_decoder,node_packet_sim toneAmber
class node_csv_export,node_output_files,node_cleanup,node_plotting,node_graphical_stub toneMint
class node_user,node_gator toneIndigo
```

## Components

### Command entry

- [CLI launcher](https://github.com/fiber-optic-sensing-system/mpg-foss/blob/main/foss.py): `foss.py`
- [Command router](https://github.com/fiber-optic-sensing-system/mpg-foss/blob/main/foss_start.py): `foss_start.py`

### Gator collection

- [Gator collector](https://github.com/fiber-optic-sensing-system/mpg-foss/blob/main/modules/gator-data-to-csv.py): `modules/gator-data-to-csv.py`
- [Packet parsing](https://github.com/fiber-optic-sensing-system/mpg-foss/blob/main/modules/fosmodule.py): `modules/fosmodule.py`
- [Packet simulator](https://github.com/fiber-optic-sensing-system/mpg-foss/blob/main/modules/fosmodule.py): `modules/fosmodule.py`

### Data outputs

- [CSV export](https://github.com/fiber-optic-sensing-system/mpg-foss/blob/main/modules/gator-data-to-csv.py): `modules/gator-data-to-csv.py`
- [CSV output files](https://github.com/fiber-optic-sensing-system/mpg-foss/tree/main/data/out): `data/out`
- [Output cleanup](https://github.com/fiber-optic-sensing-system/mpg-foss/blob/main/modules/cleanup.py): `modules/cleanup.py`
- [Measurement plots](https://github.com/fiber-optic-sensing-system/mpg-foss/tree/main/matlab): `matlab`
- [Plotting stub](https://github.com/fiber-optic-sensing-system/mpg-foss/blob/main/modules/graphical-tools.py): `modules/graphical-tools.py`

### Other components

- **Engineer**
- **Gator device**

## Connections

- Engineer → CLI launcher: runs command (evidence: `README.md`)
- CLI launcher → Command router: starts router (evidence: `foss.py`)
- Command router → Gator collector: launches collection (evidence: `foss_start.py`)
- Gator collector → Gator device: reads USB data (evidence: `modules/gator-data-to-csv.py`)
- Gator collector → Packet parsing: parses packets (evidence: `modules/gator-data-to-csv.py`)
- Gator collector → Packet simulator: creates simulated packets (evidence: `modules/gator-data-to-csv.py`)
- Gator collector → CSV export: prepares sensor rows (evidence: `modules/gator-data-to-csv.py`)
- CSV export → CSV output files: writes CSV (evidence: `modules/gator-data-to-csv.py`)
- Command router → Output cleanup: launches cleanup (evidence: `foss_start.py`)
- Output cleanup → CSV output files: removes CSV files (evidence: `modules/cleanup.py`)
