Skip to content
Snippets Groups Projects
README.md 2.8 KiB
Newer Older
BARTHES Nicolas's avatar
BARTHES Nicolas committed
# NIRS_Workflow

## Getting started
DIANE's avatar
DIANE committed
This package aims to provide a workflow for users who want to perform chemical analyses and predict characteristics using the NIRS technique.
BARTHES Nicolas's avatar
BARTHES Nicolas committed

The process includes:
DIANE Abderrahim's avatar
DIANE Abderrahim committed
- sample selection - you can upload all your NIRS spectra and it'll help select the samples to analyse chemically.
BARTHES Nicolas's avatar
BARTHES Nicolas committed
- model creation - PLS regression is used to create prediction models with spectra and related chemical analysis.
DIANE Abderrahim's avatar
DIANE Abderrahim committed
More algorithms had been added like LWPLR from Jchemo (https://github.com/mlesnoff/Jchemo.jl), PLSR with wavelength selection, etc.
BARTHES Nicolas's avatar
BARTHES Nicolas committed
- predictions - the models are used to predict chemical values for unknown samples. We provide information for confidence in the predicted values depending on the samples and the model used.

If one wants to use data stored in a SQL database, the config file is in the config/ folder.
BARTHES Nicolas's avatar
BARTHES Nicolas committed
The SQL script to create the database is in this same folder.
BARTHES Nicolas's avatar
BARTHES Nicolas committed
## Installation
Nicolas Barthes's avatar
Nicolas Barthes committed
This package is written in python. You can clone the repository: git clone https://src.koda.cnrs.fr/CEFE/PACE/nirs_workflow.git
BARTHES Nicolas's avatar
BARTHES Nicolas committed

Nicolas Barthes's avatar
Nicolas Barthes committed
Then install the requirements: pip install -r requirements.txt  
(OPTIONNAL) To use Locally weighted PLS Regression as the creation model algorithm, you will need to install Jchemo.jl (https://github.com/mlesnoff/Jchemo.jl), a Julia package.  
First, install Julia (https://julialang.org/). _Tested versions are 1.10.2 and 1.10.4 (https://julialang.org/downloads/oldreleases/)_.  
Then from the CLI: python
> python   
'>>> import julia  
'>>> julia.install()  
'>>> from julia import Pkg  
'>>> Pkg.add([Pkg.PackageSpec(name="Jchemo", version="0.4.0"), Pkg.PackageSpec(name="Pandas", version="1.6.1"), Pkg.PackageSpec(name="DataFrames", version="1.6.1"), ])
 
_The Manifest.toml file is also available. Instead of the Pkg.add() previous line, you can duplicate our full Julia environment with:_  
> '>>> Pkg.instantiate()
Nicolas Barthes's avatar
Nicolas Barthes committed

DIANE's avatar
DIANE committed
To check if Jchemo is installed without errors:
Nicolas Barthes's avatar
Nicolas Barthes committed
> '>>> Pkg.status()
BARTHES Nicolas's avatar
BARTHES Nicolas committed

Nicolas Barthes's avatar
Nicolas Barthes committed
You can then run (CLI): streamlit run ./app.py from within your src/ folder.
BARTHES Nicolas's avatar
BARTHES Nicolas committed

Nicolas Barthes's avatar
Nicolas Barthes committed
The app will open in your default browser.
BARTHES Nicolas's avatar
BARTHES Nicolas committed

DIANE Abderrahim's avatar
DIANE Abderrahim committed
Ensure you run the app in a browser that is compatible with WebGL (Web Graphics Library).

BARTHES Nicolas's avatar
BARTHES Nicolas committed
_If you encounter an "import pyodbcImportError: libodbc.so.2" error on linux OS, please, install __unixodbc__ with apt install unixodbc from the CLI._

BARTHES Nicolas's avatar
BARTHES Nicolas committed
The web app allows you to process sample selection, model creation and predictions with a simple interface or the advanced one.
BARTHES Nicolas's avatar
BARTHES Nicolas committed

## Documentation
The doc is generated with mkDoc and Python DocStrings.
From CLI, run 
> mkdocs serve
BARTHES Nicolas's avatar
BARTHES Nicolas committed

BARTHES Nicolas's avatar
BARTHES Nicolas committed
## Authors and acknowledgment
Contributors:
- Nicolas Barthes (CNRS)
BARTHES Nicolas's avatar
BARTHES Nicolas committed
- Abderrahim Diane (Montpellier University)
- Mouhcine Maimouni 
- Rémy Beugnon 
- Alexandre Granier (IRD)
- Vincent Nègre (CNRS)

We would like to thank Matthieu Lesnoff (CIRAD) for discussions and the Jchemo Toolbox.
BARTHES Nicolas's avatar
BARTHES Nicolas committed

## License
DIANE's avatar
DIANE committed
CC BY