1 Introduction

Solar flares, characterized by sudden releases of energy and radiation from the Sun’s surface on timescales of a few minutes to hours (Shibata and Yokoyama, 2002; Benz, 2008), are a key process to understand the Sun’s dynamic behavior and its influence on space weather. They are widely believed to result from a magnetic reconnection process (Shibata and Magara, 2011), which is still not fully understood. Over the last two decades, many space-based solar telescopes and missions such as the Solar and Heliospheric Observatory (SOHO: Domingo, Fleck, and Poland, 1995), Transition Region and Coronal Explorer (TRACE: Handy et al., 1999), Hinode (Kosugi et al., 2007), Solar Dynamics Observatory (SDO: Pesnell, Thompson, and Chamberlin, 2012), Interface Region Imaging Spectrograph (IRIS: De Pontieu et al., 2014), and Solar Orbiter (SolO: Müller et al., 2020) have been designed and launched to observe the Sun in various wavelengths with high spatial and temporal resolutions. The data collected by instruments onboard these satellites enhance our knowledge of solar processes and their impact on the solar system.

Recently, China successfully sent its first comprehensive and dedicated solar observatory – the Advanced Space-based Solar Observatory (ASO-S) into space (Gan et al., 2019; Gan, Feng, and Su, 2022; Gan et al., 2023). The Solar Disk Imager (SDI) is one of the scientific instruments carried by ASO-S, designed to capture images of the solar disk and the lower solar atmosphere (0 to 1.2 solar radii) in the Lyman-\(\alpha\) (Ly-\(\alpha \), 121.6 nm) passband (Li et al., 2019; Chen et al., 2019; Feng et al., 2019). The regular temporal cadence of SDI images is 60 s but could be up to 6 s in burst mode (Lu et al., 2020). As the volume of data generated by SDI continues to expand (≈ 80 GB of data per day), developing efficient and accurate algorithms for automatically detecting solar flares becomes increasingly necessary.

Several algorithms for automatically detecting flares from solar images have been proposed and implemented in recent decades. The flare detection tool of the Hinode/X-ray telescope (XRT) segments its X-ray images into a small number of macropixels and detects flares by thresholding the relative difference between an image and its reference image (the latter is calculated from a collection of the previous images) (Kano et al., 2008). Later on, analysis of the intensity changes in macropixels was also used for flare detection in EUV images (Grigis et al., 2010; Bonte et al., 2013). To obtain a more precise flare location, the Solar Demon flare detection algorithm utilizes a region-based paradigm, tracking intensity increases in the original image rather than the macropixels (Kraaikamp and Verbeeck, 2015). Moreover, neural networks (Fernandez Borda et al., 2002) and support vector machines (Qu et al., 2003) have also proven to have great prospects for automatically detecting solar flares.

While previous algorithms offer a systematic and rapid approach to identifying and characterizing solar flare events, there are still some problems. For example, the Hinode flare detection tool was designed to detect flares onboard, but there were difficulties in identifying flares that happen simultaneously or temporally close together since a new event cannot be detected until the end of the previous one is found. Moreover, many flares are generally not so intense at the beginning, which means that the start time of a flare is usually not well determined with a simple intensity threshold. Finally, because of the use of macropixels, some uncertainties are often involved in determining the flare location.

In this article, we describe our Automated Solar Flare Detection (ASFD), a software tool that automatically processes solar images from ASO-S/SDI, detects and tracks solar flares, and finally compiles an event catalog. In Section 2, we describe the input data used. In Section 3, we describe the detection algorithm. The detection results are presented in Section 4. Conclusions and discussion are provided in Section 5.

2 Input Data

Solar flare detection here is performed on SDI Ly-\(\alpha \) (121.6 Å) images, which correspond to the most intense emission in the ultraviolet (UV) part of the solar electromagnetic spectrum. In the Sun, Ly-\(\alpha \) emission occurs primarily in the chromosphere and transition region of the solar atmosphere when an electron of a hydrogen atom transitions from a higher energy level to the \(n=1\) (ground) energy level. Therefore, observations of the Sun in Ly-\(\alpha \) are crucial for studying the outer layers of the solar atmosphere and understanding various processes, such as heating mechanisms and dynamics in the chromosphere. Currently, ongoing space-based observatories equipped with instruments capable of detecting solar Ly-\(\alpha \) emissions include the Extreme Ultraviolet Sensor (EUVS) on the GOES series satellites, the Large Yield RAdiometer (LYRA) on the PRoject for OnBoard Autonomy 2 (PROBA2), the Extreme ultraviolet Variability Experiment (EVE) on the Solar Dynamics Observatory (SDO), the Extreme Ultraviolet Imager (EUI) on Solar Orbiter and the Solar Disk Imager (SDI) on ASO-S. EUVS, LYRA, and EVE provide only disk-integrated solar irradiance, while EUI is designed to take partial field-of-view (FOV) Ly-\(\alpha \) images of the solar disk, making it difficult to detect solar flares. SDI provides Ly-\(\alpha \) images of the Sun with a spatial resolution of around 9.5′′ in two observation modes, i.e., routine mode and burst mode. In the routine mode, SDI takes full-FOV images of the Sun with a temporal cadence of 1 minute and can be automatically shifted to the burst mode once a local emission enhancement is detected. As soon as the burst mode is initiated, solar images are taken at a higher temporal resolution (6 seconds), but only data in a cutout window of \(1024\times1024\) pixels around the flaring region are transmitted to the ground. Meanwhile, full-FOV images are still collected at a temporal cadence of around 1 minute. In this work, only the full-FOV images of the Sun are used as input by our detection tool.

3 Detection Tool

Similar to previous algorithms, the algorithm behind ASFD also takes advantage of the intensity changes in local macropixels. It consists of four basic modules: the first is data preprocessing, which optimizes the input images for flare detection; the second calculates a feature map on which the detection is performed; the third makes an initial detection by searching for pixels with significant intensity enhancements and refine the detection result once an event is detected; the fourth tracks the detected event until the end threshold is met.

3.1 Data Preprocessing

Solar telescopes working in outer space are vulnerable to the bombardment of cosmic rays or energetic particle flows, especially when the satellites travel through the South Atlantic Anomaly (SAA). This could lead to isolated and sudden brightenings on the observed image, which are sometimes misidentified as solar flares. The raw images are first passed through a median filter to avoid this, suppressing sharp noise features based on the ranking statistics theory. Secondly, to improve the computing efficiency as well as to further suppress the background noise, the input images are segmented into a small number (\(32\times32\)) of macropixels by applying a rebinning operation. Figure 1 shows the preprocessing of an input SDI image. In this figure, the left panel shows the SDI image processed with the median filter; the right panel shows the corresponding macropixel image generated through a rebinning operation.

Figure 1
figure 1

Left: The raw SDI image processed with the median filter. Right: The corresponding macropixel image generated with a rebinning operation.

3.2 The Feature Map

The detection of a solar flare is performed on a feature image, which is actually a map (hereafter \(\gamma -map\)) that represents the local intensity changes between an image and its previous reference image. It can be calculated using the following equation:

$$ \gamma _{n}(i,j) = \frac{[F_{n}(i,j)-F_{ref}(i,j)]^{2}}{F_{ref}(i,j)+c} $$
(1)

where \(F_{n}(i,j)\) represents an image to be examined, \(F_{ref}(i, j)\) represents its reference image generated from the median of a running collection of previous images, \(c\) is a supplement constant to avoid a zero denominator, and \(i\) and \(j\) are macropixel coordinates ranging from 0 to 31 along horizontal and vertical directions, respectively. Note that the intensity changes between an image and its reference are squared to enhance the flaring signals, which helps improve the sensitivity of the algorithm to weak flare events.

3.3 Detection

Flare detection is a three-stage process. The first stage is to find the over-threshold pixels where \(\gamma _{n}(i,j )\) exceeds the pre-defined threshold value \(\gamma _{1}\). Note that images with a large number of over-threshold pixels are possibly caused by cosmic rays or particle storms rather than a solar flare. To avoid this, we set an upper limit of the over-threshold pixels (\(NP_{max}\)), meaning that only images with the number of over-threshold pixels less than \(NP_{max}\) are considered in our detection. Once the over-threshold pixels are identified, the second stage clusters them into different groups using morphological dilation. Each group potentially contains a flare. After clustering, we label each group as an ongoing flare, and the flare location is estimated as the intensity-weighted centroid of the group. To avoid a flare from being repeatedly labeled, the third stage is to compare each of the newly labeled flares with those flares found previously but still ongoing. If the location of a flare is found inside 0.1 solar radii of any of the ongoing flares labeled previously, then the flare is considered the same flare, and its label will be dropped. Otherwise, it is considered as a new event. In this way, we are able to detect events that happen temporally close together from different disk locations.

Here \(\gamma _{1}\) is a good indicator of the occurrence of a flare. It directly relates to the number and the intensity levels of the flares we will detect (higher \(\gamma _{1}\), meaning to filter out events with small intensity changes). However, it usually fails to determine the true start of a flare since many flares are generally not so intense at the beginning. One example of these can be seen in Figure 2, which shows the time profile of the emission from the flare on 20 May 2023. The vertical dashed line indicates the time when the gamma value reaches \(\gamma _{1}\), and the vertical solid line indicates the true start time of the flare. It can be seen that the start time of the flare estimated via \(\gamma _{1}\) is significantly later than the true start of the flare. This could cause systematical underestimations when calculating flare quantities such as flare duration and energy.

Figure 2
figure 2

Time profile of the emission from the flare on 20 May 2023, locally integrated from the flaring region in SDI images. The solid vertical line marks the true start time of the flare identified by our software tool, and the dashed line shows the reference start time determined by \(\gamma _{1}\).

To obtain the true start time of a flare, the start time found according to \(\gamma _{1}\) is considered a reference start time. Once a reference start time is found, the true start time of the flare is estimated by tracking the flaring region (macropixels inside 0.1 solar radii of the flare) backward to the earliest time when the gamma value drops below a threshold value \(\gamma _{2}\). This time is considered the flare true start time, and \(\gamma _{2}\) is defined as the flare true start threshold, which can be estimated according to the maximum gamma value observed during the non-flare period.

Finally, to locate the flare more accurately, once a flare is detected, its initial position (x0, y0) is first roughly estimated from the macropixel image, then a circular cutout centered on (x0, y0) from the corresponding original image is created. The cutout image subtracted from its previous image is used to calculate the centroid position of the flare by applying a two-dimensional Gaussian (plus a constant) fitting function.

3.4 Tracking

Once a flare or several flares is/are detected and labeled as an ongoing event or ongoing events, our detection tool starts to track each of them separately until the end criteria are met. Meanwhile, the time profile of each flare is recorded. The flare end time is determined by images taken after the flare peak (after-peak images), so the end criteria include:

1. The time of the reference image is after the flare peak time.

2. The gamma value of the flare region drops below a threshold value \(\gamma _{3}\).

The flare peak is defined as the maximum flux observed during the flare. \(\gamma _{3}\) is defined as the end threshold of a flare. To avoid the same flare event from being repeatedly detected, \(\gamma _{3}\) is required to be less than \(\gamma _{1}\). Once the end criteria are met, the time of the reference image is defined as the end time of the flare. Similar to \(\gamma _{2}\), \(\gamma _{3}\) is estimated by observing the non-flare gamma values after a flare. Considering that the background variation after a flare is generally larger than the variation before the flare, \(\gamma _{3}\) is usually set to be slightly higher than \(\gamma 2\).

3.5 Output

Once a sequence of solar images is given, ASFD will iterate through each image, identifying a set of events that occurred on the solar disk. For each event, summary information, including the occurring date, start time, peak time, end time, duration, position, and significance of the event, is recorded in a human-readable “txt” file, as shown in Table 1. Here, the significance of an event (\(E_{\mathrm{signif}}\)) is defined as the maximum intensity increase relative to a pre-event background,

$$ E_{\mathrm{signif}} = \frac{I_{\mathrm{max}}-I_{\mathrm{bkg}}}{I_{\mathrm{bkg}}} $$
(2)

where \(I_{\mathrm{max}}\) represents the maximum intensity observed during the event, and \(I_{\mathrm{bkg}}\) represents the pre-event background intensity. It gives a general idea of the strength and importance of an event.

Table 1 Event list generated from ASO-S/SDI images with ASFD.

Along with the “txt” file, for each event, our software tool also outputs a “png” image, showing a snapshot of the event around its peak time, and an “mp4” movie, showing the whole evolution of the event. In Figure 3, we show the snapshot image of the flare on 3 May 2023. The top panel displays the time profile of the Ly-\(\alpha \) emission from the flare, showing how the flare evolves (the flare start, peak, and end times are marked with red, green, and blue vertical lines, respectively). The panel includes detailed textual information about the flare in the upper-left corner. The bottom left panel displays the full-FOV image of the Sun, showing the flare location relative to the whole solar disk, and the bottom right panel displays a zoomed-in view of the flare region, providing a closer look at the flare. This combination allows us to understand the event in temporal and spatial dimensions.

Figure 3
figure 3

Snapshot image of the flare on 3 May 2023. Top: A time profile of the emission from the flare region, showing how the flare evolves over time. Bottom left: Full-FOV image of the Sun, showing the flare location relative to the whole solar disk. Bottom right: Zoomed-in view of the flare region.

4 Results

The ASFD is tested using SDI full-FOV observations and compared with the GOES soft X-ray flare list for the same period. Since the launch of the ASO-S mission (8 October 2022), SDI has undergone an extended in-orbit testing phase due to the need for precise calibration, optimization of algorithms, and unexpected issues about spatial resolution, which makes the observations that suit flare detections intermittent and very limited. For this test, we used a one-month dataset obtained in February 2023, when the Sun was relatively active (51 M-class and above flares were observed), and SDI was conducting continuous scientific observations.

Before the test, it is important to know that the output of ASFD is significantly affected by the choice of the parameter values of the tool. For example, a larger \(\gamma _{1}\) would cause more small-scale events to be filtered out, and \(\gamma _{2}\)/\(\gamma _{3}\) directly determine the accuracy of the start/end times of the events. For this test, parameter values are chosen to maximize the number of solar events associated with significant Ly-\(\alpha \) emission enhancements. Table 2 lists values of the main parameters used in the detection.

Table 2 The main parameter values used in our software tool.

4.1 Event List and Visual Inspection

For the observations in February 2023, the ASFD finds a total number of 226 events. After checking the snapshot images and the corresponding movies of each event, we found that only one event was misidentified (due to a data gap in the observations), and all the others (225 events) are related to active phenomena. Among the 225 events, 91% (204/225) are solar flare events, 5% (12/225) are associated with prominence or filament eruptions, and 4% (9/225) are related to solar jets or other solar activity. For each detected event, characteristics such as the start/end times and the position are found to be well determined. Figure 4 shows flares that occurred temporally close together from different solar disk locations but were successfully separated by ASFD. Figure 5 shows a double-ribbon flare in L-y\(\alpha \) on 11 February 2023, characterized by the appearance of two distinct, parallel ribbons of enhanced brightness on the solar surface. Figure 6 shows an example of Ly-\(\alpha \) emission enhancement associated with an eruptive prominence on 9 February 2023. This prominence was observed above the solar limb and evolved into a fast coronal mass ejection (CME) in its later phase.

Figure 4
figure 4

Two Ly-\(\alpha \) flares occurred temporally close together on 5 February 2023 but were successfully identified by our software tool. Left: The locations of the two flares on the solar disk (marked with red boxes). Right: Time profiles of the emission from the two flare regions. The red, dark green, and blue lines indicate the start, peak, and end times of the flares, respectively, as identified by ASFD.

Figure 5
figure 5

Left: SDI full solar disk image, showing a double-ribbon Ly-\(\alpha \) flare on 11 February 2023. Right: Zoomed-in view of this flare.

Figure 6
figure 6

Similar to Figure 5, but for an eruptive solar prominence in Ly-\(\alpha \), captured by SDI on 9 February 2023.

4.2 Comparison with GOES X-ray Flare List

To further validate the output of ASFD, we compare our event list (as described in Section 4.1) with the X-ray flare list detected by GOES. Figure 7 shows a typical one-day detection of ASFD, along with the time profile of GOES X-ray flux on 11 February 2023. For most of the X-ray flares on this day, especially those M-class and above flares, ASFD shows highly consistent detection results with the GOES X-ray flare list. Due to our spatial resolution, ASFD can identify and distinguish events that happened temporally close together (see Figure 4 for an example).

Figure 7
figure 7

SDI Ly-\(\alpha \) flare detections (red histogram: the height of a rectangle represents the number of Ly-\(\alpha \) flares detected) with GOES soft X-ray flux (black lightcurve) for observations on 11 February 2023 (from top to bottom). The grey shade areas indicate the time periods of Ly-\(\alpha \) emission enhancements.

For the whole month of February 2023, the NOAA solar X-ray flare list from the GOES satellite has reported 255 flares from C1 and above. After excluding events with missing SDI observations, it leaves a total number of 181 flare events for comparison, i.e., 145 C-class flares, 34 M-class flares, and 2 X-class flares. Because of the large number of events, a manual comparison between the event lists is difficult, so an automated method was established and implemented. It involves looking at the starting and ending times of the GOES flares as well as the peak time of the Ly-\(\alpha \) flares. If the peak time of a Ly-\(\alpha \) flare falls in between the starting and ending times of a GOES flare, then the flare is thought to have a Ly-\(\alpha \) correspondence.

Our analysis yields the following results. For the 181 C-class and above flares detected by GOES, 116 out of them were found to have corresponding Ly-\(\alpha \) enhancements. For the 36 M-class and above flares, 29 of them have corresponding Ly-\(\alpha \) emission enhancements. As can be seen, some soft X-ray flares are not accompanied by Ly-\(\alpha \) emission enhancements. The lack of Ly-\(\alpha \) emission is possibly due to the center-to-limb variation (CLV) as suggested by Milligan et al. (2020), according to which the flares closer to the solar limb tend to have weaker Ly-\(\alpha \) emission (optically thick). On the other hand, the soft X-ray emission is not affected by this effect due to its optically thin characteristic. To verify this, we examined the location of the seven M-class and above flares not accompanied by Ly-\(\alpha \) emission enhancements and found that six are located close to the solar limb (one event close to the disk center). According to a statistical study by Jing et al. (2020), most of the Ly-\(\alpha \) emission enhancements tend to have a nonthermal origin (nonthermal electron beam heating), which means that those thermal-dominated flares, even located close to the disk center, could also produce weak Ly-\(\alpha \) emission. Further studies regarding the CLV effect and the thermal/nonthermal nature of Ly-\(\alpha \) flares will be presented in a future work.

Finally, we also detect Ly-\(\alpha \) flare events that are not registered as GOES soft X-ray flares, here referred to as non-GOES events. These non-GOES events are possibly because our detections are based on the local intensity changes (thus more sensitive to small-scale events) while GOES monitors the disk-integrated solar flux.

5 Conclusions and Discussion

In this article, we described our algorithm for automatically detecting solar flares in Ly-\(\alpha \) images obtained by ASO-S/SDI. It is designed to detect and track not only a single event but also events that happened simultaneously or temporally close together. The algorithm steps mainly involve data preprocessing, feature calculation, detection, tracking, parameter extracting, and finally, an event catalog compiling. For each detected event, statistics, such as start, peak, and end times, location, and others, are generated, along with a snapshot image and a movie. This kind of information greatly helps in scientific analysis and practical applications in space weather forecasting.

Compared with previous algorithms, our algorithm has obvious advantages in determining the start and end times of a flare event. This is mainly attributed to the use of a triple-threshold scheme, with the first (global) threshold (\(\gamma _{1}\)) to determine the occurrence of a flare and the second and third (local) thresholds to determine the real start and end times of the flare. By increasing \(\gamma _{1}\), our algorithm can filter out small-scale events. Additionally, we also set an upper limit to exclude detections with an unusually high number of hits in one image, which makes our algorithm rarely affected by satellite jitter and particle noise during the South Atlantic Anomaly (SAA) region. We also introduce the significance parameter, defined as the contrast between the flare peak intensity and its previous background intensity, giving a general indication of the significance of an event.

We examined the capabilities of our software tool with a test dataset obtained in February 2023 and found that only one event was misidentified. Among the detected events, 91% are solar flare events, and 9% are related to solar prominences or filaments, solar jets, or other solar active phenomena. We compared our results with the GOES X-ray flare list and found that our software tool detected 64% of GOES C-class and above flares (116 out of 181) and 81% of GOES M-class and above flares (29 out of 36). The missing of Ly-\(\alpha \) emission enhancements is possibly due to the CLV effect as proposed by Milligan et al. (2020) or the nonthermal characteristic of Ly-\(\alpha \) flares (Jing et al., 2020), which will be further studied in a future work. We also detected some events that are not registered as GOES flares. These non-GOES events are possibly due to the low signal-to-noise ratio in the disk-integrated X-ray flux.

With our software tool, we are able to produce large catalogs with reproducible and quantifiable results without requiring much computational power and show how interesting solar dynamic regions are detected. In the future, we are actively progressing towards the development of our tool to perform near-real-time detections. This means that as soon as the data from the ASO-S/SDI instrument becomes available, our software tool will automatically retrieve them, apply the detection algorithm, and publish the results daily via our online catalog.

Finally, the use of Ly-\(\alpha \) images, while informative, presents challenges in solar flare detection due to the inclusion of various solar phenomena such as eruptive solar filaments or prominences and solar jets. In the future, we plan to apply our software tool to SDO/AIA 9.4 nm images, which show only very hot flaring regions on the Sun, resulting in high contrast and thus easier detection of flares.