Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
franckalbinet committed Jan 23, 2025
1 parent a5242e6 commit 1345cf1
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 75 deletions.
101 changes: 57 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,14 @@

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

> A Python package providing scikit-learn compatible transforms for
> spectroscopic data preprocessing.
> Spectral Processing Tools for Soil Spectroscopy
It’s designed to work seamlessly with both MIR (Mid-Infrared) and VISNIR
(Visible-Near Infrared) spectral data.

**WORK IN PROGRESS**

## Installation

``` bash
pip install soilspectfm
```

## Quick Start

``` python
from soilspectfm.core import (SNV,
TakeDerivative,
ToAbsorbance,
Resample,
WaveletDenoise)

from sklearn.pipeline import Pipeline
```

### Loading OSSL dataset

Let’s use OSSL dataset as an example using
[SoilSpecData](https://fr.anckalbi.net/soilspecdata/) package.

``` python
from soilspecdata.datasets.ossl import get_ossl
```

``` python
ossl = get_ossl()
mir_data = ossl.get_mir()
```

### Preprocessing pipeline
By translating specialized soil spectroscopy methods into the
[`scikit-learn`](https://scikit-learn.org/stable/) framework,
`SoilSpecTfm` and
[`SoilSpecData`](https://fr.anckalbi.net/soilspecdata/) connect this
niche domain with Python’s vast machine learning ecosystem, making
advanced ML/DL tools accessible to soil scientists.

Implemented transforms developed so far include:

Expand All @@ -55,17 +22,16 @@ Implemented transforms developed so far include:
- [x]
[`MSC`](https://franckalbinet.github.io/soilspectfm/core.html#msc):
Multiplicative Scatter Correction
- [ ] `Detrend`: Detrend the spectrum (coming soon …)
- [ ] `ALS`: Asymmetric Least Squares detrend the spectrum (coming
soon …)
- [ ] `Detrend`: Detrend the spectrum (planned)
- [ ] `ALS`: Asymmetric Least Squares detrend the spectrum (planned)

- **Derivatives**:

- [x]
[`TakeDerivative`](https://franckalbinet.github.io/soilspectfm/core.html#takederivative):
Take derivative (1st, 2nd, etc.) of the spectrum and apply
Savitzky-Golay smoothing
- [ ] `GapSegmentDerivative`: (coming soon …)
- [ ] `GapSegmentDerivative`: (planned)

- **Smoothing**:

Expand All @@ -85,6 +51,53 @@ Implemented transforms developed so far include:
[`Resample`](https://franckalbinet.github.io/soilspectfm/core.html#resample):
Resample the spectrum to a new wavenumber range

**Key Features**:

- Seamless integration with scikit-learn’s machine learning ecosystem
- Complement with [SoilSpecData](https://fr.anckalbi.net/soilspecdata/)
package for soil spectroscopy workflows
- Pipeline-ready transformers with consistent API

All transformers follow scikit-learn conventions:

- Implement fit/transform interface
- Support get_params/set_params for GridSearchCV
- Provide detailed documentation and examples

## Installation

``` bash
pip install soilspectfm
```

## Quick Start

``` python
from soilspectfm.core import (SNV,
TakeDerivative,
ToAbsorbance,
Resample,
WaveletDenoise)

from sklearn.pipeline import Pipeline
```

### Loading OSSL dataset

Let’s use OSSL dataset as an example using
[SoilSpecData](https://fr.anckalbi.net/soilspecdata/) package.

``` python
from soilspecdata.datasets.ossl import get_ossl
```

``` python
ossl = get_ossl()
mir_data = ossl.get_mir()
```

### Preprocessing pipeline

Transforms are fully compatible with
[scikit-learn](https://scikit-learn.org/stable/) and can be used in a
pipeline as follows:
Expand Down
72 changes: 41 additions & 31 deletions nbs/index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,59 @@
"metadata": {},
"source": [
"\n",
"> A Python package providing scikit-learn compatible transforms for spectroscopic data preprocessing. "
"> Spectral Processing Tools for Soil Spectroscopy"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"It's designed to work seamlessly with both MIR (Mid-Infrared) and VISNIR (Visible-Near Infrared) spectral data."
"By translating specialized soil spectroscopy methods into the [`scikit-learn`](https://scikit-learn.org/stable/) framework, `SoilSpecTfm` and [`SoilSpecData`](https://fr.anckalbi.net/soilspecdata/) connect this niche domain with Python's vast machine learning ecosystem, making advanced ML/DL tools accessible to soil scientists."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**WORK IN PROGRESS**"
"Implemented transforms developed so far include:\n",
"\n",
"- **Baseline corrections**:\n",
" \n",
" - [x] `SNV`: Standard Normal Variate\n",
" - [x] `MSC`: Multiplicative Scatter Correction\n",
" - [ ] `Detrend`: Detrend the spectrum (planned)\n",
" - [ ] `ALS`: Asymmetric Least Squares detrend the spectrum (planned)\n",
"\n",
"- **Derivatives**:\n",
" \n",
" - [x] `TakeDerivative`: Take derivative (1st, 2nd, etc.) of the spectrum and apply Savitzky-Golay smoothing\n",
" - [ ] `GapSegmentDerivative`: (planned)\n",
"\n",
"- **Smoothing**:\n",
" - [x] `WaveletDenoise`: Wavelet denoising\n",
" - [x] `SavGolSmooth`: Savitzky-Golay smoothing\n",
" \n",
"\n",
"- **Other transformations**:\n",
" - [x] `ToAbsorbance`: Transform the spectrum to absorbance\n",
" - [x] `Resample`: Resample the spectrum to a new wavenumber range\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Key Features**:\n",
"\n",
"- Seamless integration with scikit-learn's machine learning ecosystem\n",
"- Complement with [SoilSpecData](https://fr.anckalbi.net/soilspecdata/) package for soil spectroscopy workflows\n",
"- Pipeline-ready transformers with consistent API\n",
"\n",
"All 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"
]
},
{
Expand Down Expand Up @@ -111,34 +149,6 @@
"### Preprocessing pipeline"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Implemented transforms developed so far include:\n",
"\n",
"- **Baseline corrections**:\n",
" \n",
" - [x] `SNV`: Standard Normal Variate\n",
" - [x] `MSC`: Multiplicative Scatter Correction\n",
" - [ ] `Detrend`: Detrend the spectrum (coming soon ...)\n",
" - [ ] `ALS`: Asymmetric Least Squares detrend the spectrum (coming soon ...)\n",
"\n",
"- **Derivatives**:\n",
" \n",
" - [x] `TakeDerivative`: Take derivative (1st, 2nd, etc.) of the spectrum and apply Savitzky-Golay smoothing\n",
" - [ ] `GapSegmentDerivative`: (coming soon ...)\n",
"\n",
"- **Smoothing**:\n",
" - [x] `WaveletDenoise`: Wavelet denoising\n",
" - [x] `SavGolSmooth`: Savitzky-Golay smoothing\n",
" \n",
"\n",
"- **Other transformations**:\n",
" - [x] `ToAbsorbance`: Transform the spectrum to absorbance\n",
" - [x] `Resample`: Resample the spectrum to a new wavenumber range\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
1 change: 1 addition & 0 deletions nbs/sidebar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ website:
contents:
- 00_core.ipynb
- 01_visualization.ipynb
- 02_utils.ipynb

0 comments on commit 1345cf1

Please sign in to comment.