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