{"id":24936808,"url":"https://github.com/franckalbinet/soilspectfm","last_synced_at":"2026-02-09T08:36:58.401Z","repository":{"id":273875410,"uuid":"921165970","full_name":"franckalbinet/soilspectfm","owner":"franckalbinet","description":"Provides Scikit-Learn compatible transforms for spectroscopic data preprocessing.","archived":false,"fork":false,"pushed_at":"2025-01-24T09:55:11.000Z","size":9032,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-21T06:29:21.310Z","etag":null,"topics":["data-science","soil-science","soil-spectroscopy"],"latest_commit_sha":null,"homepage":"http://fr.anckalbi.net/soilspectfm/","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/franckalbinet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2025-01-23T13:15:44.000Z","updated_at":"2025-02-13T20:56:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"bf79a690-287f-4620-9c64-a57ce185c1f2","html_url":"https://github.com/franckalbinet/soilspectfm","commit_stats":null,"previous_names":["franckalbinet/soilspectfm"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/franckalbinet/soilspectfm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franckalbinet%2Fsoilspectfm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franckalbinet%2Fsoilspectfm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franckalbinet%2Fsoilspectfm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franckalbinet%2Fsoilspectfm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/franckalbinet","download_url":"https://codeload.github.com/franckalbinet/soilspectfm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franckalbinet%2Fsoilspectfm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29260117,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-09T04:11:57.159Z","status":"ssl_error","status_checked_at":"2026-02-09T04:11:56.117Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["data-science","soil-science","soil-spectroscopy"],"created_at":"2025-02-02T16:57:18.865Z","updated_at":"2026-02-09T08:36:58.369Z","avatar_url":"https://github.com/franckalbinet.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SoilSpecTfm\n\n\n\u003c!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --\u003e\n\n\u003e Spectral Processing Tools for Soil Spectroscopy\n\nBy translating specialized soil spectroscopy methods into the\n[`scikit-learn`](https://scikit-learn.org/stable/) framework,\n`SoilSpecTfm` and\n[`SoilSpecData`](https://fr.anckalbi.net/soilspecdata/) connect this\nniche domain with Python’s vast machine learning ecosystem, making\nadvanced ML/DL tools accessible to soil scientists.\n\nImplemented transforms developed so far include:\n\n- **Baseline corrections**:\n\n  - [x]\n    [`SNV`](https://franckalbinet.github.io/soilspectfm/core.html#snv):\n    Standard Normal Variate\n  - [x]\n    [`MSC`](https://franckalbinet.github.io/soilspectfm/core.html#msc):\n    Multiplicative Scatter Correction\n  - [ ] `Detrend`: Detrend the spectrum (planned)\n  - [ ] `ALS`: Asymmetric Least Squares detrend the spectrum (planned)\n\n- **Derivatives**:\n\n  - [x]\n    [`TakeDerivative`](https://franckalbinet.github.io/soilspectfm/core.html#takederivative):\n    Take derivative (1st, 2nd, etc.) of the spectrum and apply\n    Savitzky-Golay smoothing\n  - [ ] `GapSegmentDerivative`: (planned)\n\n- **Smoothing**:\n\n  - [x]\n    [`WaveletDenoise`](https://franckalbinet.github.io/soilspectfm/core.html#waveletdenoise):\n    Wavelet denoising\n  - [x]\n    [`SavGolSmooth`](https://franckalbinet.github.io/soilspectfm/core.html#savgolsmooth):\n    Savitzky-Golay smoothing\n\n- **Other transformations**:\n\n  - [x]\n    [`ToAbsorbance`](https://franckalbinet.github.io/soilspectfm/core.html#toabsorbance):\n    Transform the spectrum to absorbance\n  - [x]\n    [`Resample`](https://franckalbinet.github.io/soilspectfm/core.html#resample):\n    Resample the spectrum to a new wavenumber range\n  - [x]\n    [`Trim`](https://franckalbinet.github.io/soilspectfm/core.html#trim):\n    Trim the spectrum to a specific wavenumber range\n\n**Key Features**:\n\n- Seamless integration with scikit-learn’s machine learning ecosystem\n- Complement with [SoilSpecData](https://fr.anckalbi.net/soilspecdata/)\n  package for soil spectroscopy workflows\n- Pipeline-ready transformers with consistent API\n\nAll transformers follow scikit-learn conventions:\n\n- Implement fit/transform interface\n- Support get_params/set_params for GridSearchCV\n- Provide detailed documentation and examples\n\n## Installation\n\n``` bash\npip install soilspectfm\n```\n\n## Quick Start\n\n``` python\nfrom soilspectfm.core import (SNV, \n                              TakeDerivative, \n                              ToAbsorbance, \n                              Resample, \n                              WaveletDenoise)\n\nfrom sklearn.pipeline import Pipeline\n```\n\n### Loading OSSL dataset\n\nLet’s use OSSL dataset as an example using\n[SoilSpecData](https://fr.anckalbi.net/soilspecdata/) package.\n\n``` python\nfrom soilspecdata.datasets.ossl import get_ossl\n```\n\n``` python\nossl = get_ossl()\nmir_data = ossl.get_mir()\n```\n\n### Preprocessing pipeline\n\nTransforms are fully compatible with\n[scikit-learn](https://scikit-learn.org/stable/) and can be used in a\npipeline as follows:\n\n``` python\npipe = Pipeline([\n    ('snv', SNV()), # Standard Normal Variate transformation\n    ('denoise', WaveletDenoise()), # Wavelet denoising\n    ('deriv', TakeDerivative(window_length=11, polyorder=2, deriv=1)) # First derivative\n])\n\nX_tfm = pipe.fit_transform(mir_data.spectra)\n```\n\n### Quick visualization\n\n``` python\nfrom soilspectfm.visualization import plot_spectra\nfrom matplotlib import pyplot as plt\n```\n\n``` python\nfig, (ax1, ax2) = plt.subplots(2, 1, figsize=(15, 7))\n\nax1 = plot_spectra(\n    mir_data.spectra, \n    mir_data.wavenumbers,\n    ax=ax1,\n    ascending=False,\n    color='black',\n    alpha=0.6,\n    lw=0.5,\n    xlabel='Wavenumber (cm$^{-1}$)',\n    title='Raw Spectra'\n)\n\nax2 = plot_spectra(\n    X_tfm,\n    mir_data.wavenumbers,\n    ax=ax2,\n    ascending=False,\n    color='steelblue',\n    alpha=0.6,\n    lw=0.5,\n    xlabel='Wavenumber (cm$^{-1}$)',\n    title='SNV + Derivative (1st order) Transformed Spectra'\n)\n\nplt.tight_layout()\n```\n\n![](index_files/figure-commonmark/cell-7-output-1.png)\n\n## Dependencies\n\n- fastcore\n- numpy\n- scipy\n- scikit-learn\n- matplotlib\n\n## Further references\n\n- https://orange-spectroscopy.readthedocs.io/en/latest/widgets/preprocess-spectra.html\n\n## Contributing\n\n### Developer guide\n\nIf you are new to using `nbdev` here are some useful pointers to get you\nstarted.\n\nInstall spectfm in Development mode:\n\n``` sh\n# make sure spectfm package is installed in development mode\n$ pip install -e .\n\n# make changes under nbs/ directory\n# ...\n\n# compile to have changes apply to spectfm\n$ nbdev_prepare\n```\n\n## License\n\nThis project is licensed under the Apache2 License - see the LICENSE\nfile for details.\n\n## Support\n\nFor questions and support, please [open an\nissue](https://github.com/franckalbinet/spectfm/issues) on GitHub.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffranckalbinet%2Fsoilspectfm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffranckalbinet%2Fsoilspectfm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffranckalbinet%2Fsoilspectfm/lists"}