Skip to main content
WaLSAlib




WaLSAlib – WaLSA Library of Auxiliary Routines

DOI

WaLSAlib is a companion repository to WaLSAtools, collecting practical workflow routines developed within the WaLSA Team to prepare analysis-ready products and time series for wave/oscillation studies (and related diagnostics). The focus here is on upstream and auxiliary steps that often sit between calibrated observations and the actual wave analysis.

WaLSAlib and its LineFit module are introduced in Jafarzadeh et al. (2026), Frontiers in Astronomy and Space Sciences.

Scope and philosophy

Many routines in WaLSAlib are motivated by (and initially developed for) Solar Physics use cases — e.g., spectroscopy/spectro-polarimetry and time-series imaging — although they may be useful more broadly.

Included modules

  • LineFit: adaptive multi-line spectral fitting, line-core intensities, and LOS velocities.
  • SoFT: solar feature detection, association, and tabulation, maintained independently at mib-unitn/SoFT.
  • SoFTg: classical granule segmentation and optional UNet++ training/inference, maintained independently at mib-unitn/SoFTg.

SoFT and SoFTg are bundled with WaLSAlib. See upstream components for source versions and maintenance instructions.

Relationship to WaLSAtools

  • WaLSAlib: spectral fitting, magnetic feature tracking, and granule segmentation
  • WaLSAtools: wave and oscillation analysis methods (FFT/Welch, wavelets, cross-spectra, significance, etc.)

Installation

Python 3.10 or newer is required. Install the package with:

pip install WaLSAlib

To install from a source checkout:

pip install .
# For development:
pip install -e '.[test,build]'

The base installation includes LineFit, SoFT tracking, and classical SoFTg segmentation.

Quick start

from WaLSAlib import LineFit, SoFT, SoFTg

Spectral line fitting

LineFit accepts a spectrum or a sequence of spectra, a wavelength axis, rest wavelengths, and line labels:

velocity, intensity = LineFit(
    spectra,
    wavelengths=wavelengths,
    refwavelength=rest_wavelengths,
    element=line_labels,
)

Wavelengths are expressed in nm and velocities in km/s. linefit is also available as an alias for LineFit. See the LineFit examples for data preparation, fitting, and analysis workflows.

Solar feature tracking

For a two-dimensional magnetogram, specify a detection threshold in the image's intensity units:

labels = SoFT.detection(magnetogram, l_thr=20, sign="pos")
labels = SoFT.identification(labels, min_size=4)

SoFT.track_all(...) runs detection, association, and tabulation on a FITS sequence. Supply a dedicated working directory containing 00-data/, with a trailing path separator. Each run replaces the contents of 01-mask/, 02-id/, and 03-assoc/. Optional SunPy and EMD analysis functions are available through SoFT.extras.

Granule segmentation

For a two-dimensional continuum image, specify the plate scale in km per pixel:

granules, seeds, skeleton = SoFTg.segment_solar_granules(
    continuum_image, plate_scale=50
)

The UNet++ workflows use user-supplied training data and model checkpoints. Install the softg extra to access SoFTg.model, SoFTg.predict, and SoFTg.train:

python -m WaLSAlib._vendor.softg.train --help
python -m WaLSAlib._vendor.softg.predict --help

Contributing

See CONTRIBUTING.md for development and validation requirements, and the release guide for publishing instructions.

Citation

The primary reference for WaLSAlib and LineFit is:

Jafarzadeh, S., Jess, D. B., Stangalini, M., et al. (2026). Frontiers in Astronomy and Space Sciences, 13, 1843842. doi:10.3389/fspas.2026.1843842.

Please cite this paper when using WaLSAlib or LineFit in research. The software archive is available on Zenodo.

For analyses using SoFT, also cite Berretti et al. (2025). For SoFTg, cite Berretti et al. (2026); see the upstream project for bibliographic details.

License

WaLSAlib code is licensed under Apache-2.0 (see LICENSE). SoFT and SoFTg are licensed under GPLv3. The combined distribution must be redistributed in compliance with GPLv3, while retaining the Apache notices for the native code. The SPDX expression Apache-2.0 AND GPL-3.0-only records both sets of obligations; it is not a choice of licenses. See THIRD_PARTY_NOTICES.md for provenance and adaptation details.

Metadata

Release files for WaLSAlib 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for WaLSAlib 1.1.0
File Size Uploaded Provenance Actions
walsalib-1.1.0.tar.gz 151.5 kB With provenance Details for walsalib-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for WaLSAlib 1.1.0
File Interpreter ABI Platform Actions
walsalib-1.1.0-py3-none-any.whl Python 3 none any Details for walsalib-1.1.0-py3-none-any.whl

Total release size: 251.3 kB

Release files / walsalib-1.1.0.tar.gz

Download URL walsalib-1.1.0.tar.gz
Size 151.5 kB
Tags Source
SHA-256 checksum
How to use checksums
218f2daf7d9cd51759759a25d86095994a13d63cf87eb3d818893c51db46e06c
BLAKE2b-256 checksum
How to use checksums
72083f1411215fa25adab6fe1e214db39dbc536ae11bb517347f05039c458e4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / walsalib-1.1.0-py3-none-any.whl

Download URL walsalib-1.1.0-py3-none-any.whl
Size 99.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
154f846cd26fdb809a7bb3b200ac127679518b129f7bedc4a5c733870e230296
BLAKE2b-256 checksum
How to use checksums
a53e1b9c2c84f76e2819b87f91683c59f44ae942ebdfadd14df159f72ca17214
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Security for WaLSAlib 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for walsalib-1.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page