# anqi-ally/final-year-project-f1 architecture

> Architecture diagram of the GitHub repository anqi-ally/final-year-project-f1, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/anqi-ally/final-year-project-f1
- Repository: https://github.com/anqi-ally/final-year-project-f1

## Overview

This is a laboratory ultrasonic scanning and imaging workflow. An operator runs a scan script, which coordinates motion and waveform acquisition; the resulting per-position CSV waveforms are stored under scan folders and later processed into A-, B-, or C-mode visualizations and signal-derived feature maps. The graph includes configuration and motion-control layers as well as the documented analysis branches. Some plot scripts are represented by their distinct capabilities; unsampled implementation details and links are omitted where evidence is limited.

Main entry points: [`data`](https://github.com/anqi-ally/final-year-project-f1/tree/main/data) (Waveform CSVs), [`Code/B scan.py`](https://github.com/anqi-ally/final-year-project-f1/blob/main/Code/B%20scan.py) (B-scan runner), [`Code/Oscilloscope.py`](https://github.com/anqi-ally/final-year-project-f1/blob/main/Code/Oscilloscope.py) (Oscilloscope capture), [`Code/A scan.py`](https://github.com/anqi-ally/final-year-project-f1/blob/main/Code/A%20scan.py) (A-scan runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_acquisition["Scan acquisition"]
  node_single_scan["A-scan runner<br/>[A scan.py]"]
  node_raster_scan["B-scan runner<br/>[B scan.py]"]
  node_configuration["Device and scan settings<br/>[Setup.py]"]
end

subgraph group_hardware["Hardware control"]
  node_motion_helpers["Motion commands<br/>[rig_function.py]"]
  node_stage{{"Motion stage"}}
  node_signal_helpers["Waveform generation<br/>[Signal_function.py]"]
  node_signal_generator{{"Signal generator"}}
  node_scope_capture["Oscilloscope capture<br/>[Oscilloscope.py]"]
  node_oscilloscope{{"Oscilloscope"}}
end

subgraph group_analysis["Signal analysis"]
  node_bmode_volume["B-mode cross-sections<br/>[b_mode.py]"]
  node_cmode_maps["C-mode feature maps<br/>[c_mode.py]"]
  node_amode_views["A-mode plots"]
  node_filtered_views["Filtered waveform plot"]
  node_wave_selection["Waveform selection<br/>[select_wave.py]"]
  node_time_selection["Time selection<br/>[selectedtime.py]"]
  node_small_selection["Small signal view<br/>[selectsmall.py]"]
  node_individual_view["Position waveform grid<br/>[individual.py]"]
end

subgraph group_datasets["Scan datasets"]
  node_data_paths["Data directory setup<br/>[const.py]"]
  node_waveform_data["Waveform CSVs"]
end

node_operator(("Operator"))

node_operator -->|"runs"| node_single_scan
node_operator -->|"runs"| node_raster_scan
node_single_scan -->|"loads settings"| node_configuration
node_single_scan -->|"calls"| node_motion_helpers
node_raster_scan -->|"loads settings"| node_configuration
node_raster_scan -->|"calls"| node_motion_helpers
node_raster_scan -->|"triggers bursts"| node_signal_helpers
node_raster_scan -->|"acquires waveforms"| node_scope_capture
node_motion_helpers -->|"sends TCP commands"| node_stage
node_signal_helpers -->|"configures and triggers"| node_signal_generator
node_scope_capture -->|"reads waveform"| node_oscilloscope
node_scope_capture -->|"can trigger burst"| node_signal_helpers
node_scope_capture -->|"uses data directory"| node_data_paths
node_scope_capture -->|"writes CSVs"| node_waveform_data
node_raster_scan -->|"stores scan results"| node_waveform_data
node_waveform_data -->|"reads waveforms"| node_bmode_volume
node_bmode_volume -->|"reads scan settings"| node_configuration
node_waveform_data -->|"reads waveforms"| node_cmode_maps
node_waveform_data -.->|"plots waveforms"| node_amode_views
node_waveform_data -.->|"plots filtered data"| node_filtered_views
node_waveform_data -.->|"selects signals"| node_wave_selection
node_waveform_data -.->|"selects time range"| node_time_selection
node_waveform_data -.->|"views signals"| node_small_selection
node_waveform_data -->|"reads CSVs"| node_individual_view

click node_single_scan "https://github.com/anqi-ally/final-year-project-f1/blob/main/Code/A%20scan.py"
click node_raster_scan "https://github.com/anqi-ally/final-year-project-f1/blob/main/Code/B%20scan.py"
click node_configuration "https://github.com/anqi-ally/final-year-project-f1/blob/main/Code/Setup.py"
click node_motion_helpers "https://github.com/anqi-ally/final-year-project-f1/blob/main/Code/rig_function.py"
click node_signal_helpers "https://github.com/anqi-ally/final-year-project-f1/blob/main/Code/Signal_function.py"
click node_scope_capture "https://github.com/anqi-ally/final-year-project-f1/blob/main/Code/Oscilloscope.py"
click node_data_paths "https://github.com/anqi-ally/final-year-project-f1/blob/main/Code/const.py"
click node_waveform_data "https://github.com/anqi-ally/final-year-project-f1/tree/main/data"
click node_bmode_volume "https://github.com/anqi-ally/final-year-project-f1/blob/main/Plot/b_mode.py"
click node_cmode_maps "https://github.com/anqi-ally/final-year-project-f1/blob/main/Plot/c_mode.py"
click node_amode_views "https://github.com/anqi-ally/final-year-project-f1/blob/main/Plot/plot_Amode_row_col.py"
click node_filtered_views "https://github.com/anqi-ally/final-year-project-f1/blob/main/Plot/plotAmode_filtered.py"
click node_wave_selection "https://github.com/anqi-ally/final-year-project-f1/blob/main/Plot/select_wave.py"
click node_time_selection "https://github.com/anqi-ally/final-year-project-f1/blob/main/Plot/selectedtime.py"
click node_small_selection "https://github.com/anqi-ally/final-year-project-f1/blob/main/Plot/selectsmall.py"
click node_individual_view "https://github.com/anqi-ally/final-year-project-f1/blob/main/Check/individual.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_single_scan,node_raster_scan,node_configuration toneBlue
class node_motion_helpers,node_stage,node_signal_helpers,node_signal_generator,node_scope_capture,node_oscilloscope toneAmber
class node_bmode_volume,node_cmode_maps,node_amode_views,node_filtered_views,node_wave_selection,node_time_selection,node_small_selection,node_individual_view toneMint
class node_data_paths,node_waveform_data toneRose
class node_operator toneIndigo
```

## Components

### Scan acquisition

- [A-scan runner](https://github.com/anqi-ally/final-year-project-f1/blob/main/Code/A%20scan.py): `Code/A scan.py`
- [B-scan runner](https://github.com/anqi-ally/final-year-project-f1/blob/main/Code/B%20scan.py): `Code/B scan.py`
- [Device and scan settings](https://github.com/anqi-ally/final-year-project-f1/blob/main/Code/Setup.py): `Code/Setup.py`

### Hardware control

- [Motion commands](https://github.com/anqi-ally/final-year-project-f1/blob/main/Code/rig_function.py): `Code/rig_function.py`
- **Motion stage**
- [Waveform generation](https://github.com/anqi-ally/final-year-project-f1/blob/main/Code/Signal_function.py): `Code/Signal_function.py`
- **Signal generator**
- [Oscilloscope capture](https://github.com/anqi-ally/final-year-project-f1/blob/main/Code/Oscilloscope.py): `Code/Oscilloscope.py`
- **Oscilloscope**

### Signal analysis

- [B-mode cross-sections](https://github.com/anqi-ally/final-year-project-f1/blob/main/Plot/b_mode.py): `Plot/b_mode.py`
- [C-mode feature maps](https://github.com/anqi-ally/final-year-project-f1/blob/main/Plot/c_mode.py): `Plot/c_mode.py`
- [A-mode plots](https://github.com/anqi-ally/final-year-project-f1/blob/main/Plot/plot_Amode_row_col.py): `Plot/plot_Amode_row_col.py`
- [Filtered waveform plot](https://github.com/anqi-ally/final-year-project-f1/blob/main/Plot/plotAmode_filtered.py): `Plot/plotAmode_filtered.py`
- [Waveform selection](https://github.com/anqi-ally/final-year-project-f1/blob/main/Plot/select_wave.py): `Plot/select_wave.py`
- [Time selection](https://github.com/anqi-ally/final-year-project-f1/blob/main/Plot/selectedtime.py): `Plot/selectedtime.py`
- [Small signal view](https://github.com/anqi-ally/final-year-project-f1/blob/main/Plot/selectsmall.py): `Plot/selectsmall.py`
- [Position waveform grid](https://github.com/anqi-ally/final-year-project-f1/blob/main/Check/individual.py): `Check/individual.py`

### Scan datasets

- [Data directory setup](https://github.com/anqi-ally/final-year-project-f1/blob/main/Code/const.py): `Code/const.py`
- [Waveform CSVs](https://github.com/anqi-ally/final-year-project-f1/tree/main/data): `data`

### Other components

- **Operator**

## Connections

- Operator → A-scan runner: runs (evidence: `README.md`)
- Operator → B-scan runner: runs (evidence: `README.md`)
- A-scan runner → Device and scan settings: loads settings (evidence: `Code/A scan.py`)
- A-scan runner → Motion commands: calls (evidence: `Code/A scan.py`)
- B-scan runner → Device and scan settings: loads settings (evidence: `Code/B scan.py`)
- B-scan runner → Motion commands: calls (evidence: `Code/B scan.py`)
- B-scan runner → Waveform generation: triggers bursts (evidence: `Code/B scan.py`)
- B-scan runner → Oscilloscope capture: acquires waveforms (evidence: `Code/B scan.py`)
- Motion commands → Motion stage: sends TCP commands (evidence: `README.md`)
- Waveform generation → Signal generator: configures and triggers (evidence: `Code/Signal_function.py`)
- Oscilloscope capture → Oscilloscope: reads waveform (evidence: `Code/Oscilloscope.py`)
- Oscilloscope capture → Waveform generation: can trigger burst (evidence: `Code/Oscilloscope.py`)
- Oscilloscope capture → Data directory setup: uses data directory (evidence: `Code/Oscilloscope.py`)
- Oscilloscope capture → Waveform CSVs: writes CSVs (evidence: `Code/Oscilloscope.py`)
- B-scan runner → Waveform CSVs: stores scan results (evidence: `README.md`)
- Waveform CSVs → B-mode cross-sections: reads waveforms (evidence: `README.md`)
- B-mode cross-sections → Device and scan settings: reads scan settings (evidence: `Plot/b_mode.py`)
- Waveform CSVs → C-mode feature maps: reads waveforms (evidence: `README.md`)
- Waveform CSVs → A-mode plots: plots waveforms
- Waveform CSVs → Filtered waveform plot: plots filtered data
- Waveform CSVs → Waveform selection: selects signals
- Waveform CSVs → Time selection: selects time range
- Waveform CSVs → Small signal view: views signals
- Waveform CSVs → Position waveform grid: reads CSVs (evidence: `Check/individual.py`)
