Skip to content

Installation

WaLSAlib requires Python 3.10 or newer. Python 3.12 is a practical starting point for the notebook and ML workflows; optional dependency availability also depends on Python version and platform. The base package includes LineFit, SoFT tracking, and classical SoFTg segmentation. Optional workflows have additional dependencies.

Create an environment

Use a virtual environment to keep WaLSAlib and its dependencies together.

python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
py -3.12 -m venv .venv
.venv\Scripts\Activate.ps1
pip install --upgrade pip

Install from PyPI

pip install WaLSAlib

Check your Python environment

The commands on these pages assume the environment is activated. If pip installs into a different Python environment, use python -m pip install WaLSAlib to select the interpreter explicitly. In notebooks, select the kernel belonging to the environment where you installed the package.

Additional workflow dependencies

Additional dependencies support SoFT’s scientific helpers, SoFTg’s neural-network and annotation workflows, and integration with WaLSAtools. Install the extras needed for your workflow, keeping quotes around bracketed package names in shell commands.

Dependency extra Install command Additional dependencies for
soft-extras pip install 'WaLSAlib[soft-extras]' SunPy, empirical mode decomposition (EMD), and interactive SoFT helpers
softg pip install 'WaLSAlib[softg]' SoFTg neural-network workflows: PyTorch, Lightning, OpenCV, and supporting libraries
softg-gui pip install 'WaLSAlib[softg-gui]' Desktop annotation tool; requires a graphical desktop
walsatools pip install 'WaLSAlib[walsatools]' Companion wave-analysis package

Combine extras when needed, for example pip install 'WaLSAlib[softg,walsatools]'.

SoFTg’s classical segmentation is included in the base installation. Its neural-network workflows require the softg extra and compatible weights for prediction. PyTorch hardware acceleration depends on the platform and installed build.

Install from a source checkout

git clone https://github.com/WaLSAteam/WaLSAlib.git
cd WaLSAlib
pip install .

For editable development, use pip install -e '.[test,build]'. An editable installation imports from that checkout; updating a different clone does not change it. Bundled SoFT and SoFTg sources require no Git submodule step.

Verify the installation

Start Python in your activated environment:

import WaLSAlib
from importlib.metadata import version
from WaLSAlib import LineFit, SoFT, SoFTg

print(version("WaLSAlib"))
print(WaLSAlib.__file__)
print(callable(LineFit))
print(callable(SoFT.detection))
print(callable(SoFTg.segment_solar_granules))

The final three lines should print True. LineFit is a callable; SoFT and SoFTg are namespaces containing related routines. Accessing the detection and classical segmentation routines also checks their base dependencies.

Run the repository examples

The notebooks and their input data are in the source repository; installing the package from PyPI does not download them. With your Python environment activated, run the complete sequence below from a directory where you want to keep a checkout:

git clone https://github.com/WaLSAteam/WaLSAlib.git
cd WaLSAlib
pip install '.[walsatools]' jupyterlab
cd examples/LineFit_Frontiers
python -m jupyterlab

If you already have a checkout, open a terminal in its root folder and start at the pip install line. The root folder contains both pyproject.toml and examples/.

The . in .[walsatools] means the current directory. Running that command from your home directory (~) will fail unless the package source is there. jupyterlab installs the notebook interface; python -m jupyterlab starts it using the active environment.

Open Figure2.ipynb to start with spectral fitting. It reads the supplied synthetic_nuv_testbed.fits and uses its spectra, wavelength axis, reference wavelengths, and known centres. Review the notebook’s configuration and output paths before running it.

The spectral fitting example displays its saved figure and source. Follow the Frontiers overview for subsequent notebooks, or the SoFT tracking example for tracking.

Before using observations, check data and units and the relevant module guide. For reproducible work, retain the exact package version, environment, parameters, inputs, and any model checkpoint.