A modern Python application for analyzing FTIR (Fourier Transform Infrared) spectroscopy data with an intuitive PyQt6 GUI interface. This tool processes FTIR spectral data from Jasco .jws files, providing visualization, baseline correction, and correlation analysis capabilities.
- File Processing: Direct conversion of Jasco .jws files to custom YLK (JSON) format
- Modern GUI: Clean PyQt6 interface with tabbed layout and embedded matplotlib plots
- Spectral Visualization: Real-time plotting with toggle between raw and baseline-corrected data
- Baseline Correction: Interactive baseline creation with live preview and parameter adjustment
- Correlation Analysis: Pearson correlation matrix computation between multiple spectra
- Data Management: Organized file lists with drag-and-drop selection
- Recent Files: Persistent history of recently opened folders
- Export Capabilities: PNG export functionality for visualizations
This project uses uv for fast, reliable Python package management. Install uv first:
macOS and Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh
Windows:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Alternative installation methods:
# Via pip
pip install uv
# Via Homebrew (macOS)
brew install uv
# Via pipx
pipx install uv
- Python: 3.12 or higher
- Operating System: Windows, macOS, or Linux
- Memory: 4GB RAM minimum, 8GB recommended
- Storage: 100MB for installation plus space for your FTIR data
-
Clone the repository:
git clone https://github.com/your-username/ftir-tools.git cd ftir-tools
-
Install dependencies:
uv sync
This will automatically create a virtual environment and install all required packages.
-
Run the application:
uv run python main.py
-
Launch the application:
uv run python main.py
-
Open a folder containing .jws files:
- Go to
File → Open Folder
or use the recent folders menu - Select a folder containing your FTIR .jws files
- Go to
-
Select spectra for analysis:
- Double-click files in the "All Files" list to add them to "Selected for Analysis"
- Selected files will automatically appear in the plot
-
View and analyze data:
- Use the "Toggle Data Display" button to switch between raw and baseline-corrected views
- Right-click on selected files to create custom baselines
- Access correlation analysis from the Tools menu
The application automatically converts .jws files to .ylk format (JSON-based) for faster processing:
- Input: Jasco .jws files from your selected folder
- Processing: Files are converted and stored in a
converted_ylk/
subfolder - Output: Self-contained .ylk files with raw data, baseline, and metadata
- Right-click on a file in the "Selected for Analysis" list
- Choose "Create Baseline"
- A new tab opens with interactive baseline creation tools
- Adjust parameters and see live preview
- Save the baseline back to the .ylk file
The custom YLK format stores all spectral information in JSON:
{
"name": "spectrum_name",
"range": [min_wavenumber, max_wavenumber],
"raw_data": {
"x": [wavenumber_array],
"y": [absorbance_array]
},
"baseline": {
"x": [wavenumber_array],
"y": [baseline_array]
},
"metadata": {
"created": "timestamp",
"source_file": "original_jws_filename",
"baseline_params": {...}
}
}
ftir-tools/
├── main.py # Main application entry point and FTIRAnalyzer class
├── modules/ # Core functionality modules
│ ├── baseline.py # Baseline correction algorithms
│ ├── data_processing.py # Data preprocessing and analysis
│ ├── file_converter.py # JWS to YLK conversion
│ └── plotting.py # Matplotlib integration and visualization
├── pyproject.toml # Project configuration and dependencies
├── uv.lock # Locked dependency versions
└── README.md # This file
- PyQt6 (>=6.5.0) - Modern cross-platform GUI framework
- matplotlib (>=3.8.5) - Scientific plotting and visualization
- pandas (>=2.2.1) - Data manipulation and analysis
- scikit-learn (>=1.5.1) - Machine learning utilities
- scipy - Signal processing and statistical functions
- jws2txt (>=1.0.0) - Jasco file format conversion utility
# Run with specific Python version
uv run --python 3.12 python main.py
# Run in development mode with debugging
uv run python main.py --debug
The modular architecture allows for easy extension:
- Modify
modules/data_processing.py
for custom preprocessing - Add new baseline algorithms to
modules/baseline.py
- Extend file format support in
modules/file_converter.py
-
"No module named 'PyQt6'"
uv sync # Reinstall dependencies
-
JWS file conversion fails
- Ensure
jws2txt
is properly installed - Check file permissions and format validity
- Ensure
-
Application won't start
uv run --python 3.12 python main.py # Specify Python version
- Close unused baseline tabs to free memory
- Process files in smaller batches for large datasets
- Use the YLK format for faster subsequent loading
- Fork the repository
- Create a feature branch (
git checkout -b feature/new-feature
) - Make your changes
- Run tests and ensure code quality
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: Report bugs and feature requests via GitHub Issues
- Documentation: Check the
CLAUDE.md
file for detailed technical documentation - Community: Contribute to discussions and improvements
- Built with PyQt6 for cross-platform compatibility
- Uses matplotlib for high-quality scientific visualization
- Supports Jasco .jws file format for FTIR spectroscopy data
- This README was generated with the assistance of AI
如果您需要進一步的指導,例如如何在 GitHub 上建立儲存庫或上傳此檔案,請提供更多細節,我將提供詳細步驟說明。