{"id":24435423,"url":"https://github.com/bamescience/hmfa-spectra","last_synced_at":"2026-01-27T00:39:02.900Z","repository":{"id":263030859,"uuid":"889126287","full_name":"BAMeScience/HMFA-Spectra","owner":"BAMeScience","description":"Indirect Hard Modeling (IHM) for Spectral Component Identification","archived":false,"fork":false,"pushed_at":"2024-11-15T17:08:36.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-29T23:10:04.617Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BAMeScience.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-15T16:56:52.000Z","updated_at":"2024-12-18T20:01:49.000Z","dependencies_parsed_at":"2024-11-15T18:20:31.018Z","dependency_job_id":"d9dc9fc1-689c-4cdd-8b45-5168b8ed88b3","html_url":"https://github.com/BAMeScience/HMFA-Spectra","commit_stats":null,"previous_names":["bamescience/hmfa-spectra"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/BAMeScience/HMFA-Spectra","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BAMeScience%2FHMFA-Spectra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BAMeScience%2FHMFA-Spectra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BAMeScience%2FHMFA-Spectra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BAMeScience%2FHMFA-Spectra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BAMeScience","download_url":"https://codeload.github.com/BAMeScience/HMFA-Spectra/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BAMeScience%2FHMFA-Spectra/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28794012,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T21:49:50.245Z","status":"ssl_error","status_checked_at":"2026-01-26T21:48:29.455Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-20T17:20:10.241Z","updated_at":"2026-01-27T00:39:02.882Z","avatar_url":"https://github.com/BAMeScience.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Indirect Hard Modeling (IHM) for Spectral Component Identification\n\nThis 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.\n\n---\n\n## Overview of the Method\n\nThe IHM approach models a spectral mixture matrix by:\n1. **Finding a representative spectrum** (x_input) from a subset of mixture spectra (Step 1).\n2. **Fitting Voigt profiles** to the peaks in x_input, capturing nonlinear effects like peak shifts and variations (Step 2).\n3. **Constructing a weight matrix** representing contributions of the fitted peaks across all mixture spectra (Step 3).\n4. **Correlation-based analysis** to identify distinctive and shared peaks, allowing classification of peaks into pure components (Step 4).\n5. **Delta matrix optimization** to allocate shared peaks to their corresponding components, ensuring a coherent representation of the spectral data (Step 5).\n6. **Pure spectrum reconstruction** using the optimized delta matrix to obtain individual pure spectra (Step 6).\n\n---\n\n## Code Structure and Workflow\n\n### Step 1: Input Data\n- **Spectral Matrix**: Provide your mixed spectral data in `spectal_matrix`. The matrix should have dimensions corresponding to the number of spectra and wavelength points.\n- **Wavelength Vector**: Ensure `wl` matches the wavelength points of your spectral matrix.\n\n### Step 2: Finding x_input\n- The code identifies a representative spectrum by averaging a subset of spectra with the lowest correlation errors.\n\n### Step 3: Voigt Peak Fitting\n- Fits Voigt profiles to the representative spectrum (x_input) to extract peak parameters.\n- Outputs:\n  - **Voigt Parameters**: Saved to `Voig_parameters_X_input`.\n  - **Reconstructed Spectrum**: Visualized alongside the mean spectrum.\n\n### Step 4: Weight Matrix Calculation\n- Constructs the weight matrix W by fitting the Voigt parameters to all spectra in the dataset.\n- Outputs:\n  - **Weight Matrix**: Saved to `WeightsMatrix`.\n\n### Step 5: Correlation Analysis\n- Constructs a peak-to-peak correlation matrix to classify peaks as:\n  - **Distinctive Peaks**: Unique to individual components.\n  - **Shared Peaks**: Common across multiple components.\n- Determines the number of components (K) and identifies correlated groups of peaks.\n\n### Step 6: Delta Matrix Optimization\n- Optimizes the delta matrix to allocate shared peaks to pure components using constrained optimization.\n\n### Step 7: Pure Spectrum Reconstruction\n- Reconstructs the pure spectra using the optimized delta matrix.\n- Outputs:\n  - **Reconstructed Spectra**: Visualized alongside the original mean spectrum.\n\n---\n\n## Usage Instructions\n\n1. **Prepare Input Data**:\n   - Replace `spectal_matrix` with your spectral data.\n   - Provide the corresponding wavelength vector `wl`.\n\n2. **Run the Code**:\n   - Set `run_fitting = True` to perform new peak fitting. If previously run, set it to `False` to reuse saved results.\n   - Set `Only_SharedPeaks = True` to optimize shared peaks only, if required.\n---\n\n## References\n\n- **Kriesten, E., et al. (2008)**: \"Identification of Unknown Pure Component Spectra by Indirect Hard Modeling\".  \n  [DOI:10.1016/j.chemolab.2008.05.002](https://doi.org/10.1016/j.chemolab.2008.05.002)\n\n---","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbamescience%2Fhmfa-spectra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbamescience%2Fhmfa-spectra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbamescience%2Fhmfa-spectra/lists"}