SolarEnergeticParticle
A Julia package for loading and analyzing Solar Energetic Particle (SEP) data from multiple space missions.
Tutorials
- Onset Analysis - CUSUM-based onset detection
- Velocity Dispersion Analysis (VDA) - Determine particle release times and path lengths
Mission support
In theory, any dataset available in CDAWeb is supported. The following missions are tested and verified.
SolarEnergeticParticle.DatasetInfo
SolarEnergeticParticle.cusum_onset_detection
SolarEnergeticParticle.find_onset
SolarEnergeticParticle.find_peak
SolarEnergeticParticle.select_channel
SolarEnergeticParticle.sigma_onset_detection
SolarEnergeticParticle.vda
API Reference
SolarEnergeticParticle.DatasetInfo
— TypeDatasetInfo
Structure containing metadata about a loaded dataset.
Fields
energy_channels::Dict{String, Vector{Float64}}
: Energy channel informationunits::Dict{String, String}
: Units for each data columninstrument::String
: Instrument namespacecraft::String
: Spacecraft namedata_level::String
: Data processing level (e.g., "L2")time_resolution::String
: Temporal resolution of the data
SolarEnergeticParticle.cusum_onset_detection
— Methodcusum_onset_detection(I, μ, σ; h = nothing, k = nothing, n = 2, N = nothing)
cusum_onset_detection(I, times, μ, σ; kw...)
Detect onset time using Poisson-CUSUM (Cumulative Sum) algorithm, where $I$ is the (intensity) time series, and $μ$ and $σ$ are the mean and standard deviation of the background, k
is the control parameter.
The CUSUM function $S$ for each timestamp for the standardized intensity $I_z = \frac{I-μ}{σ}$ was then calculated as follows:
\[S[i] = \max(0, I_z[i] - k + S[i-1])\]
where $S[0] = 0$. When $S$ exceeded the hastiness threshold $h$, a warning signal was given. After N
consecutive warning signals, an event was found and the first timestamp of these consecutive warning signals is identified as the onset time.
Note that:
- $μ$ and $σ$ are used to calculate the control parameter $k = \frac{n}{\ln(μ + n σ) - \ln(μ)}$ when
k
is not specified. - $n$ is a coefficient that was usually set to 2 and the control parameter $k$ was rounded to the nearest integer value when $k>1$.
- The hastiness threshold $h$ was set to 1 when $k <= 1$ and $h = 2$ otherwise (followed the practice introduced by Huttunen-Heikinmaa et al. 2005).
N
are suggested to correspond to 30 minutes of threshold-exceeding intensity.
SolarEnergeticParticle.find_onset
— Methodfind_onset(I, bg_timerange; method = :cusum, kwargs...)
Perform onset determination analysis on time series I
using background statistics from bg_timerange
.
Arguments
method
: Detection method (:cusum
or:sigma
, default::cusum
)kwargs...
: Additional parameters passed to the detection method
Returns
Named tuple with onset_time
, bg_timerange
, bg_mean
, and bg_std
.
See also: cusum_onset_detection
, sigma_onset_detection
SolarEnergeticParticle.find_peak
— Methodfind_peak(I)
Find the peak time and value of a time series I
.
SolarEnergeticParticle.select_channel
— Methodselect_channel(data, indices)
select_channel(data, predicate)
Select specific channels (columns) from data while preserving metadata structure, including labels.
Examples
# Select specific energy channels
I_low = select_channel(data.PH, 1:3) # First 3 channels
I_mid = select_channel(data.PH, [4, 6, 8]) # Specific channels
I_high = select_channel(data.PH, 10:15) # High energy range
# Select using predicates
I_odd = select_channel(data.PH, isodd) # Odd-numbered channels
I_subset = select_channel(data.PH, x -> x > 5) # Channels above 5
# Single channel for onset analysis
I_channel = select_channel(data.PH, 4) # Channel 4 only
SolarEnergeticParticle.sigma_onset_detection
— Methodsigma_onset_detection(I, μ, σ; n = 2, N = nothing)
sigma_onset_detection(I, times, μ, σ; n = 2, N = nothing)
Detect onset time using n-sigma threshold method when intensity I
exceeds μ + n*σ
for N
consecutive points.
Returns
Named tuple with time
and N
.
SolarEnergeticParticle.vda
— Methodvda(times, energies::AbstractArray{<:Energy}; particle = :proton, mass = nothing)
vda(fluxes, background_timerange; onset = (;), kw...)
Perform Velocity Dispersion Analysis (VDA) to determine solar particle release time $t₀$ and path length $s$ using onset times
across different energies
.
Principle
VDA is based on the fact that solar energetic particles of different energies travel at different speeds from the Sun to the observer. Higher energy particles arrive earlier than lower energy particles if they are released simultaneously from the source.
The relationship between onset time $t$ and inverse velocity $β⁻¹$ follows:
\[t = t₀ + \frac{s}{c} · β⁻¹\]
where: $t$ is the observed onset time, $β = v/c = \sqrt{1 - (\frac{1}{1 + E/mc^2})^2}$.
Linear regression of onset times versus β⁻¹ yields the release time (intercept) and path length (slope × c).
Arguments
onsets
: Onset times for different energy channelsenergies
: Particle energies (MeV) corresponding to onset timesmin_points=2
: Minimum number of onset points required for analysis
Returns
A named tuple with:
release_time
: Estimated particle release time at sourcepath_length_au
: Path length in AU
See also: find_onset