Skip to main content

SoFT logo

ascl:2508.008 PyPI - Version DOI

Small-scale magnetic elements are vital in the energetic balance of the Sun’s atmosphere. These structures cover the entire solar surface and understanding their dynamics can address longstanding questions such as coronal heating and solar wind acceleration. SoFT: Solar Feature Tracking is a novel feature tracking routine built in Python, designed for reliable detection and fast associations.

Detection and Identification: The Watershed Algorithm

The detection phase in SoFT involves:

  1. Threshold Masking: Mask out pixels below a given threshold to reduce the impact of noise.
  2. Euclidean Distance Transform (EDT): Compute the shortest distance from each non-zero pixel to the background.
  3. Seed Placement: In coarse mode (separation=False), one seed per connected component at its distance-transform maximum. In fine mode (separation=True), seeds are spaced adaptively based on the component's own EDT, allowing touching features to be split automatically.
  4. Watershed Segmentation: Use seeds as markers and segment the image based on the EDT gradient field.

Association

Features are matched across frames:

  1. Forward Check: Examine the overlap between feature M in frame n (M(n)) and all features in frame n+1 occupying the same pixels.
  2. Backward Check: Verify the overlap between feature M in frame n+1 and features in frame n.
  3. Matching: If M(n) and M(n+1) select each other, they are successfully matched.

To enable parallel processing, frames are paired and condensed into cubes. This reverse bisection condensation continues iteratively until one cube remains with all features properly associated.

Tabulation

After association, the physical properties of magnetic structures are estimated and compiled:

  • Barycenters: Calculated by averaging pixel coordinates weighted by intensity for sub-pixel accuracy.
  • Area: Determined by counting pixels within the feature's contour.
  • Magnetic Flux: Summed from pixel intensities.
  • Velocity: Derived from central finite differences of barycenter positions (edge-clamped).
  • and many other

Further details regarding the SoFT tracking code and its performance can be found in Berretti et al. 2025.

Installation

Clone the repository and install the required dependencies:

git clone https://github.com/mib-unitn/SoFT.git
cd SoFT
pip install .

or

pip install solar_ft

Usage

If you plan to use SoFT in your research or publications, please make sure to cite the corresponding paper: Berretti et al. 2025.

import soft.soft as st
import os

#Set the path to the data
datapath = "path/to/data/"  # Path to the folder containing the "00-data" directory, which should include all the frames in single .fits files.
cores = os.cpu_count() # Sets the number of cores to be used. It will always be selected the minimum between the number of cores available and the number of frames in the data.


#Set the parameters for the detection and identification
l_thr =  # Intensity threshold[Gauss] (float) (used for basin contours)
m_size =  #Minimum size in pixels (int)
dx =  #Km (pixel size of the instrument) (float)
dt = #seconds (temporal cadence of the instrument) (float)
sign = "both" # Can be "positive", "negative" or "both, defines the polarity of the features to be tracked (str)
separation = True  # If True, the detection method selected is "fine", if False, the detection method selected is "coarse". Check the paper for more details on the detection methods (bool)
verbose=False #If True, the code will print a more detailed output of the tracking process (bool)
doppler=False # If True, SoFT will also estimate the line-of-sight velocity within the detected features from separate dopplergram files in the 00b-data folder (bool)


st.track_all(datapath, cores, l_thr, m_size, dx, dt, sign, separation, verbose, doppler)

M. Berretti wishes to acknowledge that SoFT could also be interpreted as "So' Francesco Totti" and it's totally ok with it.

Metadata

Release files for solar-ft 3.0.2

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

Source distribution (sdist)

Source distribution for solar-ft 3.0.2
File Size Uploaded
solar_ft-3.0.2.tar.gz 35.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for solar-ft 3.0.2
File Interpreter ABI Platform
solar_ft-3.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 69.3 kB

Release files / solar_ft-3.0.2.tar.gz

Download URL solar_ft-3.0.2.tar.gz
Size 35.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6e43b65ae7bc99da059c4292a6378668b84a1dad99592d52cdbb5203015ce4c9
BLAKE2b-256 checksum
How to use checksums
b25bcbf4329828b38c108171f76ac433203bdd789cc5a3608ed90098644ffb43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Release files / solar_ft-3.0.2-py3-none-any.whl

Download URL solar_ft-3.0.2-py3-none-any.whl
Size 33.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e52539525f495793e1dca08aea7b7a9108e73a513f4e787938d4404dd00e08f
BLAKE2b-256 checksum
How to use checksums
8770fd887fbdf5aa7a3e07553170b35ee31d5007a53a81034eefa35bba96a597
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Release history Release notifications | RSS feed

3.2.1

2 release files

3.2.0

2 release files

3.1.8

2 release files

3.1.7

2 release files

3.1.6

2 release files

3.1.5

2 release files

This release

3.0.2 This release

2 release files

3.0.1

2 release files

2.6.0

2 release files

2.5.5

2 release files

2.5.2

2 release files

2.5.1

2 release files

2.5.0

2 release files

2.2.1

2 release files

2.2

2 release files

2.1.0

2 release files

2.0.1

2 release files

2.0

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

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