Skip to main content

A Python lib for Solar Feature Tracking

Project description

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. Local Maxima Detection: Identify peaks separated by a user-defined minimum distance. Usually the angular resolution of the instrument.
  3. Euclidean Distance Transform (EDT): Compute the shortest distance from each non-zero pixel to the background.
  4. Watershed Segmentation: Use local maxima 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 the first-order derivative of barycenter positions.
  • 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 =  # Low ntensity threshold[Gauss] (float) (used for basin contours)
h_thr =  #Intensity threshold[Gauss] (float) (used to estimate centroids)
m_size =  #Minimum size in pixels (int)
dx =  #Km (pixel size of the instrument) (float)
dt = #seconds (temporal cadence of the instrument) (float)
min_dist = # minimum required distance between two local maxima. (int)
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, min_dist, 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

solar_ft-2.5.0.tar.gz (38.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

solar_ft-2.5.0-py3-none-any.whl (36.3 kB view details)

Uploaded Python 3

File details

Details for the file solar_ft-2.5.0.tar.gz.

File metadata

  • Download URL: solar_ft-2.5.0.tar.gz
  • Upload date:
  • Size: 38.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for solar_ft-2.5.0.tar.gz
Algorithm Hash digest
SHA256 e424f5478d46fa7b1f9f64e86aa1ccafb7358a18f20a36ba0320a0c20c97c9bb
MD5 62f13e13af5cfbc4773325be1003f8f0
BLAKE2b-256 431806057590eea9b92b3d987504eacdd92c0c07646a6737e5abd2e1274f2078

See more details on using hashes here.

File details

Details for the file solar_ft-2.5.0-py3-none-any.whl.

File metadata

  • Download URL: solar_ft-2.5.0-py3-none-any.whl
  • Upload date:
  • Size: 36.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for solar_ft-2.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8146682246173fb01da3c0aac377b376d36f6e6ddb9e0f1c64280d3c5c6c4014
MD5 52e632170e1a961dbc25a2e17703c5ba
BLAKE2b-256 92c10acb88ef2a9077ecc294c9bb90c14ef0a6e4790442c89316909436f42ba7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page