Skip to content

he80/FTIR-AI-Engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

🔬 FTIR Polymer Classification AI Pipeline

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.

✨ Core Features

  • 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.

🧠 The 3 Analytical Engines

  1. 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.
  2. 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.
  3. 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.

🖥️ User Interface (Streamlit)

The pipeline is wrapped in a local, purely offline Streamlit web dashboard featuring 4 distinct tabs:

  1. Live Testing: Drop an unknown sample and watch all three engines fire simultaneously.
  2. 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.
  3. Historical Comparison: Overlay and compare Transmittance (%) curves of known polymers directly from memory.
  4. Deep Dive Peak Matcher: Isolate pure chemical peaks and exact functional group matches without AI bias.

⚙️ Installation & Setup

  1. Clone the Repository: bash git clone https://github.com/YOUR_USERNAME/FTIR-AI-Engine.git cd FTIR-AI-Engine

  2. Install the Dependencies: Ensure you have Python 3.8+ installed, then run: pip install -r requirements.txt

  3. Launch the Engine: bash python -m streamlit run app.py

About

An open-source, AI-powered FTIR spectroscopy pipeline for polymer engineers. Automatically cleans raw spectral data, applies optical physics corrections, and identifies plastics using Random Forest Machine Learning, Cosine Curve Fitting, and Rule-Based Peak Matching.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors