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¶
via PyPi¶
With extensions¶
For the jupyter
support, the following command can be used:
For the graph visualization, the following command can be used:
For all extensions, the following command can be used:
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:
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:
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
:
or via conda
:
or using the poetry shell
:
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 for both amd64 aka x86_64 or arm64 and used via:
or just via:
To include the home directory of the host system, the following command can be used:
or via:
see also: spectrafit
About cosign
The cosign
is a tool for signing and verifying container images as part of the sigstore project.The cosign
can be used to sign the SpectraFit
container image. The cosign
can be installed via:
# install cosign for macOS and Linux
brew install cosign
# install cosign via go
go install github.com/sigstore/cosign/v2/cmd/cosign@latest
To verify the SpectraFit container image, SpectraFit's public key is required and can be found under: github.com/Anselmoo/spectrafit/blob/main/cosign.pub. You can save the public key to a file named cosign.pub:
cat cosign.pub
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE/6fPQhwVsFvcfGtSFBIwdHbTxkF3
KaNOdpXBpmyrM/y1TM5YgTYl5mVq7km/LPukbXslcrVX1dT5H+FUP6+onQ==
-----END PUBLIC KEY-----
cosign verify --key cosign.pub ghcr.io/anselmoo/spectrafit:latest
# or export to json
cosign verify --key cosign.pub ghcr.io/anselmoo/spectrafit:latest > cosign_verify.json
and the output can be saved to a file named cosign_verify.json
.