An autonomous, open-source pipeline designed to process raw FTIR (Fourier-Transform Infrared) spectra and identify unknown polymers. This tool eliminates manual spectral formatting and utilizes three independent analytical engines to cross-reference and verify chemical identities.
- Auto-Formatting Engine: Drop in raw CSVs from any spectrometer. The system automatically handles unit detection (converting nm/μm to cm⁻¹), Transmittance-to-Absorbance conversion, and aligns the data to a standard 4000–400 cm⁻¹ grid.
- Smart ATR Correction: Automatically detects skewed ATR (Attenuated Total Reflectance) data using high/low peak ratios and applies Kramers-Kronig mathematical depth corrections.
- Advanced Baseline Flattening: Utilizes Asymmetric Least Squares (ALS) to stretch a mathematical floor beneath the data, flattening wandering baselines to exactly 0 without distorting structural peaks.
- Random Forest AI: A machine-learning classification model trained on flattened data matrices to find hyper-specific chemical rules and predict polymer identities with confidence percentages.
- Cosine Curve Fitter: A geometric similarity search that treats the entire 3,600-point spectrum as a mathematical shape, finding the tightest physical fit against a "Golden Standard" library.
- Rule-Based Peak Matcher: An Expert System that extracts the top peaks using continuous wavelet transforms and scores them against a proprietary functional group database (
polymer_peaks_db.csv) factoring in exact wavenumbers, relative heights, and peak widths.
The pipeline is wrapped in a local, purely offline Streamlit web dashboard featuring 4 distinct tabs:
- Live Testing: Drop an unknown sample and watch all three engines fire simultaneously.
- Batch Training: Drop folders of raw historical data (
Old_Raw_Data) to clean, catalog, and instantly re-train the AI on your lab's specific optics. - Historical Comparison: Overlay and compare Transmittance (%) curves of known polymers directly from memory.
- Deep Dive Peak Matcher: Isolate pure chemical peaks and exact functional group matches without AI bias.
-
Clone the Repository: bash git clone https://github.com/YOUR_USERNAME/FTIR-AI-Engine.git cd FTIR-AI-Engine
-
Install the Dependencies: Ensure you have Python 3.8+ installed, then run: pip install -r requirements.txt
-
Launch the Engine: bash python -m streamlit run app.py