This repository implements the Indirect Hard Modeling (IHM) method as described in the paper "Identification of Unknown Pure Component Spectra by Indirect Hard Modeling" by Kriesten et al., 2008. The code extracts pure spectra from a given spectral mixture matrix using a combination of peak fitting, correlation analysis, and optimization techniques.
The IHM approach models a spectral mixture matrix by:
- Finding a representative spectrum (x_input) from a subset of mixture spectra (Step 1).
- Fitting Voigt profiles to the peaks in x_input, capturing nonlinear effects like peak shifts and variations (Step 2).
- Constructing a weight matrix representing contributions of the fitted peaks across all mixture spectra (Step 3).
- Correlation-based analysis to identify distinctive and shared peaks, allowing classification of peaks into pure components (Step 4).
- Delta matrix optimization to allocate shared peaks to their corresponding components, ensuring a coherent representation of the spectral data (Step 5).
- Pure spectrum reconstruction using the optimized delta matrix to obtain individual pure spectra (Step 6).
- Spectral Matrix: Provide your mixed spectral data in
spectal_matrix
. The matrix should have dimensions corresponding to the number of spectra and wavelength points. - Wavelength Vector: Ensure
wl
matches the wavelength points of your spectral matrix.
- The code identifies a representative spectrum by averaging a subset of spectra with the lowest correlation errors.
- Fits Voigt profiles to the representative spectrum (x_input) to extract peak parameters.
- Outputs:
- Voigt Parameters: Saved to
Voig_parameters_X_input
. - Reconstructed Spectrum: Visualized alongside the mean spectrum.
- Voigt Parameters: Saved to
- Constructs the weight matrix W by fitting the Voigt parameters to all spectra in the dataset.
- Outputs:
- Weight Matrix: Saved to
WeightsMatrix
.
- Weight Matrix: Saved to
- Constructs a peak-to-peak correlation matrix to classify peaks as:
- Distinctive Peaks: Unique to individual components.
- Shared Peaks: Common across multiple components.
- Determines the number of components (K) and identifies correlated groups of peaks.
- Optimizes the delta matrix to allocate shared peaks to pure components using constrained optimization.
- Reconstructs the pure spectra using the optimized delta matrix.
- Outputs:
- Reconstructed Spectra: Visualized alongside the original mean spectrum.
-
Prepare Input Data:
- Replace
spectal_matrix
with your spectral data. - Provide the corresponding wavelength vector
wl
.
- Replace
-
Run the Code:
- Set
run_fitting = True
to perform new peak fitting. If previously run, set it toFalse
to reuse saved results. - Set
Only_SharedPeaks = True
to optimize shared peaks only, if required.
- Set
- Kriesten, E., et al. (2008): "Identification of Unknown Pure Component Spectra by Indirect Hard Modeling".
DOI:10.1016/j.chemolab.2008.05.002