# jray-lin/spectralab architecture

> Architecture diagram of the GitHub repository jray-lin/spectralab, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jray-lin/spectralab
- Repository: https://github.com/jray-lin/spectralab

## Overview

FTIR Tools is a PyQt6 desktop application for turning Jasco .jws spectra into YLK data, then viewing, correcting, comparing, and exporting spectra. The principal workflow is to open a folder, select spectra, inspect raw or corrected plots, and optionally create and save baselines or run correlation analysis. The graph combines shown imports and calls with README-documented capabilities; some UI and processing wiring is documented but not visible in the sampled excerpts, so those links are marked unverified.

Main entry points: [`main.py`](https://github.com/jray-lin/spectralab/blob/master/main.py) (Main analyzer), [`modules/gui_components.py`](https://github.com/jray-lin/spectralab/blob/master/modules/gui_components.py) (Baseline editor), [`modules/dialogs.py`](https://github.com/jray-lin/spectralab/blob/master/modules/dialogs.py) (Application dialogs), [`modules/file_converter.py`](https://github.com/jray-lin/spectralab/blob/master/modules/file_converter.py) (YLK files)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application UI"]
  node_analyzer["Main analyzer<br/>[main.py]"]
  node_file_ui["File selection<br/>[main.py]"]
  node_folder_history["Recent folders<br/>[main.py]"]
end

subgraph group_spectra["Spectral workflow"]
  node_converter["JWS converter<br/>[file_converter.py]"]
  node_ylk_store[("YLK files<br/>[file_converter.py]")]
end

subgraph group_analysis["Analysis and display"]
  node_data_processing["Data processing<br/>[data_processing.py]"]
  node_correlation["Correlation analysis<br/>[data_processing.py]"]
  node_baseline_ui["Baseline editor<br/>[gui_components.py]"]
  node_baseline_algorithms["Baseline algorithms<br/>[baseline.py]"]
  node_plot["Spectrum plotting<br/>[plotting.py]"]
end

subgraph group_support["Reference and export"]
  node_ui_helpers["Plot and export helpers<br/>[ui_helpers.py]"]
  node_dialogs["Application dialogs<br/>[dialogs.py]"]
  node_reference_table["Absorption reference<br/>[reference_data.py]"]
  node_version_info["Version information<br/>[version.py]"]
end

node_user(("Spectroscopy user"))

node_user -->|"uses"| node_analyzer
node_analyzer -->|"offers selection"| node_file_ui
node_file_ui -->|"selects recent"| node_folder_history
node_analyzer -->|"invokes conversion"| node_converter
node_converter -->|"writes and reads"| node_ylk_store
node_analyzer -.->|"loads spectra"| node_ylk_store
node_analyzer -->|"uses processing"| node_data_processing
node_analyzer -.->|"requests correlations"| node_correlation
node_analyzer -.->|"opens editor"| node_baseline_ui
node_baseline_ui -->|"calculates baseline"| node_baseline_algorithms
node_baseline_ui -.->|"saves baseline"| node_ylk_store
node_analyzer -.->|"renders spectra"| node_plot
node_analyzer -->|"delegates exports"| node_ui_helpers
node_analyzer -->|"opens reference"| node_dialogs
node_dialogs -->|"creates tab"| node_reference_table
node_dialogs -->|"gets app details"| node_version_info

click node_analyzer "https://github.com/jray-lin/spectralab/blob/master/main.py"
click node_file_ui "https://github.com/jray-lin/spectralab/blob/master/main.py"
click node_folder_history "https://github.com/jray-lin/spectralab/blob/master/main.py"
click node_converter "https://github.com/jray-lin/spectralab/blob/master/modules/file_converter.py"
click node_ylk_store "https://github.com/jray-lin/spectralab/blob/master/modules/file_converter.py"
click node_data_processing "https://github.com/jray-lin/spectralab/blob/master/modules/data_processing.py"
click node_correlation "https://github.com/jray-lin/spectralab/blob/master/modules/data_processing.py"
click node_baseline_ui "https://github.com/jray-lin/spectralab/blob/master/modules/gui_components.py"
click node_baseline_algorithms "https://github.com/jray-lin/spectralab/blob/master/modules/baseline.py"
click node_plot "https://github.com/jray-lin/spectralab/blob/master/modules/plotting.py"
click node_ui_helpers "https://github.com/jray-lin/spectralab/blob/master/modules/ui_helpers.py"
click node_dialogs "https://github.com/jray-lin/spectralab/blob/master/modules/dialogs.py"
click node_reference_table "https://github.com/jray-lin/spectralab/blob/master/modules/reference_data.py"
click node_version_info "https://github.com/jray-lin/spectralab/blob/master/modules/version.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_analyzer,node_file_ui,node_folder_history,node_user toneBlue
class node_converter,node_ylk_store toneAmber
class node_data_processing,node_correlation,node_baseline_ui,node_baseline_algorithms,node_plot toneMint
class node_ui_helpers,node_dialogs,node_reference_table,node_version_info toneRose
```

## Components

### Application UI

- [Main analyzer](https://github.com/jray-lin/spectralab/blob/master/main.py): `main.py`
- [File selection](https://github.com/jray-lin/spectralab/blob/master/main.py): `main.py`
- [Recent folders](https://github.com/jray-lin/spectralab/blob/master/main.py): `main.py`

### Spectral workflow

- [JWS converter](https://github.com/jray-lin/spectralab/blob/master/modules/file_converter.py): `modules/file_converter.py`
- [YLK files](https://github.com/jray-lin/spectralab/blob/master/modules/file_converter.py): `modules/file_converter.py`

### Analysis and display

- [Data processing](https://github.com/jray-lin/spectralab/blob/master/modules/data_processing.py): `modules/data_processing.py`
- [Correlation analysis](https://github.com/jray-lin/spectralab/blob/master/modules/data_processing.py): `modules/data_processing.py`
- [Baseline editor](https://github.com/jray-lin/spectralab/blob/master/modules/gui_components.py): `modules/gui_components.py`
- [Baseline algorithms](https://github.com/jray-lin/spectralab/blob/master/modules/baseline.py): `modules/baseline.py`
- [Spectrum plotting](https://github.com/jray-lin/spectralab/blob/master/modules/plotting.py): `modules/plotting.py`

### Reference and export

- [Plot and export helpers](https://github.com/jray-lin/spectralab/blob/master/modules/ui_helpers.py): `modules/ui_helpers.py`
- [Application dialogs](https://github.com/jray-lin/spectralab/blob/master/modules/dialogs.py): `modules/dialogs.py`
- [Absorption reference](https://github.com/jray-lin/spectralab/blob/master/modules/reference_data.py): `modules/reference_data.py`
- [Version information](https://github.com/jray-lin/spectralab/blob/master/modules/version.py): `modules/version.py`

### Other components

- **Spectroscopy user**

## Connections

- Spectroscopy user → Main analyzer: uses (evidence: `README.md`)
- Main analyzer → File selection: offers selection (evidence: `README.md`)
- File selection → Recent folders: selects recent (evidence: `README.md`)
- Main analyzer → JWS converter: invokes conversion (evidence: `main.py`)
- JWS converter → YLK files: writes and reads (evidence: `modules/file_converter.py`)
- Main analyzer → YLK files: loads spectra (evidence: `main.py`)
- Main analyzer → Data processing: uses processing (evidence: `main.py`)
- Main analyzer → Correlation analysis: requests correlations (evidence: `README.md`)
- Main analyzer → Baseline editor: opens editor (evidence: `README.md`)
- Baseline editor → Baseline algorithms: calculates baseline (evidence: `modules/gui_components.py`)
- Baseline editor → YLK files: saves baseline (evidence: `modules/gui_components.py`)
- Main analyzer → Spectrum plotting: renders spectra (evidence: `README.md`)
- Main analyzer → Plot and export helpers: delegates exports (evidence: `main.py`)
- Main analyzer → Application dialogs: opens reference (evidence: `main.py`)
- Application dialogs → Absorption reference: creates tab (evidence: `modules/dialogs.py`)
- Application dialogs → Version information: gets app details (evidence: `modules/dialogs.py`)
