Production-ready FTIR spectroscopy analysis tool for grease condition monitoring. Uses a deviation-focused approach that reports factual spectral differences (ΞX, ΞY) rather than quality scores.
β
Pure Deviation Analysis - Reports WHERE spectra differ (ΞX, ΞY metrics)
β
Multi-Metric Categorization - Combines correlation + ΞX + ΞY + ratio
β
Fast Performance - <1 second per sample
β
Baseline Compatibility - Detects formulation mismatches
β
AI Translation - Optional LLM for user-friendly language (NOT quality judgments)
β
PyQt6 GUI - Interactive desktop application
β
Batch Analysis - Process multiple samples efficiently
CSV Files β Deviation Analyzer β Multi-Metric Categorization β Optional LLM Translation
(ΞX, ΞY, correlation) (GOOD/CRITICAL/MISMATCH) (User-friendly summary)
-
FTIRDeviationAnalyzer (PRIMARY)
- Pure deviation metrics (ΞX, ΞY)
- Multi-metric categorization
- No quality judgments
- Always reliable (<1s)
-
FTIRPeakAnalyzer (LEGACY)
- Peak detection
- Quality recommendations
- Kept for backward compatibility
# Clone repository
git clone https://github.com/JinLeeGG/YCP_Grease_Analyzer.git
cd YCP_Grease_Analyzer
# Install dependencies
pip install -r requirements.txtpython app.py- Load Baseline - Click "Select Baseline CSV"
- Load Samples - Click "Select Sample CSV(s)" (multiple files OK)
- View Results - Analysis runs automatically
- Export - Save graphs and reports
| Category | Meaning | Action |
|---|---|---|
| β GOOD | Minimal deviations | Continue operation |
| Minor deviations | Monitor trends | |
| β CRITICAL | Significant deviations | Investigate cause |
| π¨ OUTLIER | Major differences | Check for contamination |
| β‘ BASELINE_MISMATCH | Different formulation | Verify baseline selection |
ΞY (Vertical Deviation)
- Intensity difference at same wavenumber
- Thresholds: <0.03A (OK), 0.05-0.10A (major), >0.10A (critical)
ΞX (Horizontal Shift)
- Peak position change
- Thresholds: <5cmβ»ΒΉ (OK), 5-10cmβ»ΒΉ (minor), >10cmβ»ΒΉ (major)
ΞX:ΞY Ratio
-
100: Shift-dominant (chemical change)
- <20: Intensity-dominant (degradation/concentration)
- 20-100: Both types of deviation
Correlation (r)
- β₯0.97: Excellent similarity
- 0.85-0.97: Good to moderate
- <0.85: Poor (possible mismatch)
YCP_Grease_Analyzer/
βββ app.py # Main PyQt6 GUI application
βββ requirements.txt # Python dependencies
βββ modules/
β βββ ftir_deviation_analyzer.py # PRIMARY: Deviation analysis
β βββ ftir_peak_analyzer.py # LEGACY: Peak detection
β βββ llm_analyzer.py # LLM integration (optional)
β βββ csv_processor.py # CSV data handling
β βββ graph_generator.py # Matplotlib plotting
β βββ peak_detector.py # Legacy peak detection
βββ utils/
β βββ config.py # Configuration settings
β βββ validators.py # Data validation
βββ GUI/
β βββ Analyzer_main.ui # Main window UI
β βββ path.ui # Path selection dialog
βββ docs/
β βββ FINAL_SYSTEM_SUMMARY.md # Complete system documentation
β βββ (other documentation)
βββ tests/
βββ test_csv_loader.py
βββ test_llm.py
# In modules/ftir_deviation_analyzer.py
config = DeviationConfig()
# Vertical deviation (ΞY)
config.delta_y_critical = 0.10 # A (absorbance units)
config.delta_y_major = 0.05
config.delta_y_minor = 0.03
# Horizontal shift (ΞX)
config.delta_x_major = 10.0 # cmβ»ΒΉ
config.delta_x_minor = 5.0
# Correlation thresholds
config.correlation_excellent = 0.97
config.correlation_good = 0.95# In utils/config.py
LLM_CONFIG = {
"enabled": True,
"model": "llava:7b-v1.6", # Ollama model
"timeout": 30
}To use LLM features:
# Install Ollama
winget install Ollama.Ollama
# Pull model
ollama pull llava:7b-v1.6| Region | Wavenumber (cmβ»ΒΉ) | Chemical Feature | Purpose |
|---|---|---|---|
| Carbonyl Oxidation | 1650-1800 | C=O stretch | Primary oxidation marker |
| Water Contamination | 3200-3600 | O-H stretch | Water ingress |
| Additives/Glycol | 1000-1300 | C-O stretch | Additive changes |
| C-H Stretch | 2850-2950 | C-H bonds | Base oil reference |
| Metric | Value | Notes |
|---|---|---|
| Analysis time | <1s | Deviation analyzer |
| With LLM | 5-15s | Optional enhancement |
| Accuracy | High | Statistical thresholds |
| Reliability | 100% | No external dependencies for core analysis |
Problem: Too many false positives
- Solution: Increase deviation thresholds in
DeviationConfig
Problem: BASELINE_MISMATCH errors
- Solution: Verify you're comparing the same grease type
Problem: LLM not working
- Solution: LLM is optional - system works without it
- Check Ollama installation:
ollama --version
Problem: Slow performance
- Solution: Disable LLM for batch processing
- Check data file size (should be <10K points)
- FINAL_SYSTEM_SUMMARY.md - Complete system overview
- OPTIMIZATION_CHANGELOG.md - Implementation history
- QUICK_START_NEW_SYSTEM.md - Quick reference guide
"The deviation analyzer does the math; AI makes it human-friendly"
- System reports FACTS (ΞX, ΞY, correlation)
- AI translates to plain language (optional)
- You make decisions based on facts + your expertise
- β Smart BASELINE_MISMATCH detection - Distinguishes different formulations from contamination
- β Degradation pattern recognition - Identifies oxidation + water signature
- β Systematic vs localized deviation analysis - Better context-aware decisions
- β Actionable warnings - "Use baseline from same grease family"
- π See IMPROVED_CATEGORIZATION_SUMMARY.md for details
- β Pure deviation metrics (ΞX, ΞY)
- β Multi-metric categorization
- β ΞX now triggers alerts
- β ΞX:ΞY ratio diagnostic
- β Baseline mismatch detection
- Peak-based analysis
- Quality recommendations
- Still available for compatibility
See LICENSE file for details.
- Development: YCP Lab
- System Design: Based on FTIR spectroscopy best practices
- AI Integration: Claude Sonnet 4.5 consultation
- FTIR Spectroscopy Principles
- Grease Analysis Standards
- PyQt6 Documentation
Last Updated: November 9, 2025
Version: 2.1 - Improved Categorization Logic