Installation
SpectraFit
can be currently only installed directly from the GitHub repository. It is important that poetry is installed first, because the setup.py
is not explicitly defined, because it is indirectly available in the pyproject.toml
file.
via GitHub¶
pip install git+https://github.com/Anselmoo/SpectraFit.git
via PyPi¶
pip install spectrafit
With extensions¶
For the jupyter
support, the following command can be used:
pip install spectrafit[jupyter-dash]
For the graph visualization, the following command can be used:
pip install spectrafit[graph]
For all extensions, the following command can be used:
pip install spectrafit[all]
via Environment¶
To keep the system environment clean, the installation is done via the:
PIPX allows to install and run packages in a isolated environment.
Installation:
# install pipx for macOS
brew install pipx
# install pipx for Linux or Windows
pip install pipx
pipx install --upgrade pipx
# install spectrafit for python 3.7
pipx install spectrafit --python python3.7
# install spectrafit for python 3.8
pipx install spectrafit --python python3.8
# install spectrafit for python 3.9
pipx install spectrafit --python python3.9
spectrafit --help
Conda is a package manager for Python. It is a tool for installing and managing packages, environments, and virtualenvs. SpectraFit
is available as conda-forge.
Example:
conda install -c conda-forge spectrafit
spectrafit --help
For include the jupyter
support, the following command can be used:
conda install -c conda-forge spectrafit-jupyter
# To test
python -c "from spectrafit.plugins.notebook import SpectraFitNotebook"
For include the graph
support, the following command can be used:
conda install -c conda-forge spectrafit-graph
# To test
python -c "from spectrafit.plugins.graph import SpectraFitGraph"
all
support, the following command can be used: conda install -c conda-forge spectrafit-all
# To test
python -c "from spectrafit.plugins.notebook import SpectraFitNotebook"
python -c "from spectrafit.plugins.graph import SpectraFitGraph"
Extended documentation about the installation of SpectraFit
via conda can be found here. In general, the following command can be useful for working with conda:
conda config --add channels conda-forge
conda config --set channel_priority strict
For installing SpectraFit
via Poetry, first SpectraFit
has to be downloaded or cloned from the GitHub repository. Optionally, the SpectraFit
repo has to be unpacked. Next, poetry
has to be installed via pip
:
pip install poetry
or via conda
:
conda install -c conda-forge poetry
poetry install -E jupyter
poetry run spectrafit --help
or using the poetry shell
:
poetry shell
spectrafit --help
Result:
usage: spectrafit [-h] [-o OUTFILE] [-i INPUT] [-ov] [-e0 ENERGY_START]
[-e1 ENERGY_STOP] [-s SMOOTH] [-sh SHIFT] [-c COLUMN COLUMN]
[-sep { ,,,;,:,|, ,s+}] [-dec {.,,}] [-hd HEADER]
[-g {0,1,2}] [-auto] [-np] [-v] [-vb {0,1,2}]
infile
Fast Fitting Program for ascii txt files.
...
Plugins¶
The SpectraFit
package is designed to be extended by plugins. Currently available plugins are:
- Input-File-Converter (built-in)
- Jupyter-Notebook-Interface (
pip install spectrafit[jupyter]
) - Elastic-Line-Alignment (in progress)
via Docker¶
About Docker-Image
Since version 0.12.0, the SpectraFit
package is available as a Docker-Image. The Docker-Image is based on an modified Jupyter-Scipy-Image and contains the SpectraFit
package and the Jupyter-Notebook interface.
The Docker-Image can be installed and used via:
docker pull ghcr.io/anselmoo/spectrafit:latest
docker run -it -p 8888:8888 spectrafit:latest
or just via:
docker run -it -p 8888:8888 ghcr.io/anselmoo/spectrafit:latest
To include the home directory of the host system, the following command can be used:
docker run -it -p 8888:8888 -v $HOME:/home/user/work spectrafit:latest
or via:
docker run -it -p 8888:8888 -v $HOME:/home/user/work ghcr.io/anselmoo/spectrafit:latest