# Exploring mutual information between IRIS spectral lines. II. Calculating
the most probable response in all spectral windows.

Brandon Panos11affiliation: University of Applied Sciences and Arts
Northwestern Switzerland, Bahnhofstrasse 6, 5210 Windisch, Switzerland
22affiliation: University of Geneva, CUI, 1205 Geneva, Switzerland , Lucia
Kleint11affiliation: University of Applied Sciences and Arts Northwestern
Switzerland, Bahnhofstrasse 6, 5210 Windisch, Switzerland 22affiliation:
University of Geneva, CUI, 1205 Geneva, Switzerland 33affiliation: Leibniz-
Institut für Sonnenphysik (KIS), Schöneckstrasse 6, D-79104 Freiburg, Germany.

###### Abstract

A three-dimensional picture of the solar atmosphere’s thermodynamics can be
obtained by jointly analyzing multiple spectral lines that span many formation
heights. In paper I, we found strong correlations between spectral shapes from
a variety of different ions during solar flares in comparison to the quiet
Sun. We extend these techniques to address the following questions: which
regions of the solar atmosphere are most connected during a solar flare, and
what are the most likely responses across several spectral windows based on
the observation of a single Mg II spectrum? Our models are derived from
several million IRIS spectra collected from 21 M- and X-class flares. We
applied this framework to archetypal Mg II flare spectra, and analyzed the
results from a multi-line perspective. We find that (1) the line correlations
from the photosphere to the transition region are highest in flare ribbons.
(2) Blue shifted reversals appear simultaneously in Mg II, C II and Si IV
during the impulsive phase, with Si IV displaying possible optical depth
effects. Fe II shows signs of strong emission, indicating deep early heating.
(3) The Mg II line appears to typically evolve a blue-shifted reversal that
later returns to line center and becomes single peaked within 1-3 minutes. The
widths of these single peaked profiles slowly erode with time. During the
later flare stages, strong red wing enhancements indicating coronal rain are
evident in Mg II, C II, and Si IV. Our framework is easily adaptable to any
multi-line data set, and enables comprehensive statistical analyses of the
atmospheric behavior in different spectral windows.

###### Subject headings:

Sun: flares; chromosphere — line: profiles — methods: data analysis;
statistical

##  1\. Introduction

Flares affect many heights throughout the solar atmosphere. According to the
standard flare model (e.g. Fletcher et al., 2011; Benz, 2008, and references
therein), they are initiated by the reconnection of field lines in the corona,
where magnetic energy is converted into kinetic energy through the
acceleration of particles, both towards the lower solar atmosphere and into
space. As the accelerated particles precipitate through denser atmospheric
layers towards the solar surface, they lose their energy via several
mechanisms, with a significant fraction of this energy being converted into
radiation, heat, and bulk particle motions. Many spectral lines respond to the
evolving atmosphere by changing their shapes, intensities, and Doppler shifts.

Although the intensity of certain lines may carry vital information about the
thermal structure of the atmosphere, (e.g. Leenaarts et al., 2013a; Gošić et
al., 2018), it is often the case that the majority of the atmospheric
variation is encoded within the line shapes themselves. For instance, the
width of optically thin lines such as O I 1355.6 Å are excellent diagnostics
of non-thermal chromospheric velocities (Lin & Carlsson, 2015). The ratios
between line pairs where at least one of the lines is either populated by, or
decays from a metastable state, can be used to derive electron density
estimates (e.g Munro et al., 1971; Flower & Nussbaumer, 1975; Gabriel & Mason,
1982), with additional uncertainties being mitigated when the lines come from
the same ion and have the same or little temperature dependence, such as the
IRIS observed O IV intersystem multiplets around 1400 Å. In some cases, even
after normalizing out the intensity information of the entire solar spectrum,
it is still possible to extract temperature information from the width of
particular lines or carefully selected line ratios (Heroux et al., 1972).

Analyzing the shape of a single spectral line in isolation can however be
misleading, since a degenerate number of thermodynamic conditions (changing
densities, temperatures, or velocities) can lead to the same spectral shape
(Rubio da Costa & Kleint, 2017). A promising approach to resolve these
ambiguities is to analyze multiple spectral lines with different formation
heights simultaneously, providing the complementary information necessary to
restrict the thermodynamic solution space, and reconstruct the behavior of the
solar atmosphere during flares, via multi-line inversions (e.g. Vissers et
al., 2020).

In addition to studying multiple line shapes simultaneously, there are strong
motivations for extending this practice to the study of multiple flares. At
present, the large majority of flaring literature is predicated on single
flare studies. Although particular flares are of interest, the development of
a general theoretical framework relies on the identification of commonalities,
both thermodynamic and topological in nature, across all flares (see for
example Panos et al., 2018; Sadykov et al., 2019).

In Paper I (Panos et al., 2020) of this two paper series, we combined the
above two guiding philosophies in a multi-line, multi-flare analysis that
investigated the correlations between spectral shapes from different ions,
both under quiet Sun and flaring conditions. The linear and non-linear
correlations were distilled into an information theoretic quantity introduced
by Shannon & Weaver (1949), called the mutual information (MI), and calculated
using two independent machine learning techniques. Both techniques returned
complementary results, showing significant enhancements in correlations for
flaring atmospheres in comparison to their quiet Sun counterparts. These
results were interpreted as a sign of strong three-dimensional couplings
within flaring atmospheres. While the result indicated the degree to which
certain spectral lines were correlated, the MI did not provide us with an
understanding of how these correlations were distributed amongst the
individual spectra.

In this second paper, we will introduce techniques that promote the analysis
of correlations on a spectrum-to-spectrum basis, allowing us to answer
questions such as: given an observed spectrum from one line, which spectral
shapes are most likely to be observed in another spectral window formed over a
different range of heights? This technique will be used to analyze a few key
Mg II flare spectra, with the aim of resolving some open questions about their
formation properties.

##  2\. Data

We used the same flare data set from Paper I, which consists of 21 large flare
observations by the IRIS satellite from the years 2014-2015. The list of flare
observations is repeated from Paper I in Table 1 for reference, and contains a
variety of observational modes, cadences, and slit orientations. The
restriction to large M- and X-class flares, with the IRIS slit positioned
directly over the flare ribbon, is advantageous for our analysis of correlated
flaring profiles. Each IRIS observation also covers several spectral windows,
which are explained in the next section. We manually selected the time range
of each observation to only include the flaring period. Since the
spectrograph’s field-of-view ($130\times 175~{}\text{arcsec}^{2}$) is
comparatively large with respect to an average active region, and because the
activity of the Sun dynamically changes over the course of an observation,
many non-flaring spectra are captured by the spectrograph. In-order to
restrict our study to spectra commonly observed outside of quiet Sun
conditions, we trained a variational autoencoder on Mg II quiet Sun profiles
and used the reconstruction error to dynamically filter quiet Sun components
(see section 2.1 of Paper I). This resulted in a primary data set consisting
of $4788392$ spectra $\times~{}5$ spectral regions, about 50 % of the original
data set. This filtering was done independently for each pixel along the slit
and each time step, meaning that a given pixel was considered only for the
time range during which the spectral shape did not look like a typical quiet
Sun spectrum.

In order to make the data machine learning compatible, a number of
preprocessing steps were taken in addition to the already pre-processed IRIS
level2 data: 1) Spectra with missing data and large negative values were
removed. 2) Likewise, overexposed spectra with more than 5 consecutive
wavelength points with the same intensity were removed. 3) The variety of
spectral resolutions across observations were homogenized by interpolating the
spectra onto a common wavelength grid, such that the number of wavelength
points are allowed to differ between lines but not within the same line. For
instance, spectra for the Mg II line were spline-interpolated onto a 240
wavelength grid, while all spectra across observations for Fe II were
interpolated to a fixed grid size of 100. In the machine learning context,
this step is vital and ensures that the features are of the same dimensions
and therefore carry the same precedence. 4) We finally normalized each
spectrum by its maximum value, which places the emphasis on spectral shape
rather than the otherwise dominant intensity.

The pipeline’s output returns several clean flaring data sets, one for each
spectral region. The analysis of this study was then performed on pairs of
data sets ($\mathcal{L}i|\mathcal{L}j$), where $\mathcal{L}i$ and
$\mathcal{L}j$ correspond to the data sets of spectral lines $i$ and $j$,
respectively. We note that Si IV is often overexposed during flares, and
therefore blindly dropping spectra across all ions would result in a sparse
data set. In order to mitigate this issue, we treated each pair of spectral
lines separately, so that if the $k$’th Si IV spectrum was overexposed, the
corresponding index in ($\mathcal{L}i$| Si IV), where $\mathcal{L}i$ refers to
any other spectral line, would be dropped, however, the spectra corresponding
to this index in (Mg II|C II) for instance, would be retained.

Table 1Flare observations # |  Class |  Date |  Time Obs Start |  OBSID
---|---|---|---|---
1 |  M1.0 |  2014-06-12 |  11:09 |  3863605329
2 |  M1.0 |  2014-11-07 |  09:37 |  3860602088
3 |  M1.1 |  2014-06-12 |  18:44 |  3863605329
4 |  M1.1 |  2014-09-06 |  11:23 |  3820259253
5 |  M1.1 |  2015-08-21 |  16:01 |  3660104044
6 |  M1.3 |  2014-10-26 |  18:52 |  3864111353
7 |  M1.4 |  2015-03-12 |  05:45 |  3860107053
8 |  M1.8 |  2015-03-11 |  04:46 |  3860259280
9 |  M2.3 |  2014-11-09 |  15:17 |  3860258971
10 |  M2.9 |  2015-08-27 |  05:37 |  3860605380
11 |  M3.4 |  2014-10-27 |  20:56 |  3864111353
12 |  M3.9 |  2014-06-11 |  18:19 |  3863605329
13 |  M6.5 |  2015-06-22 |  17:00 |  3660100039
14 |  M7.3 |  2014-04-18 |  12:33 |  3820259153
15 |  M8.7 |  2014-10-21 |  18:10 |  3860261353
16 |  X1.0 |  2014-03-29 |  14:09 |  3860258481
17 |  X1.6 |  2014-09-10 |  11:28 |  3860259453
18 |  X1.6 |  2014-10-22 |  08:18 |  3860261381
19 |  X2.0 |  2014-10-27 |  14:04 |  3860354980
20 |  X2.1 |  2015-03-11 |  15:19 |  3860107071
21 |  X3.1 |  2014-10-24 |  20:52 |  3860111353
|  |  |  |
Figure 1.— Overview of the spectral windows used for the analysis in this
paper. All images and spectra were scaled to the power of 0.3 for better
contrast. Different spectral shapes are visible along the slit (vertical
axis), in particular, upflows of different velocities in Fe XXI and strong
emission at the location of the flare ribbons, which also partially show
asymmetries towards the red wavelengths (downflows). A movie showing the
evolution of these flare spectra is available online.

###  2.1. Spectral lines

In this section, we present an overview of some of the most important IRIS
spectral lines, whose couplings we will investigate during the course of this
paper. Figure 1 shows an example of the selected spectral windows and the many
different spectral shapes that can occur during the course of a solar flare.
The different spectral windows are showcased to the right of the solar image
(SJI 1400), and are collected by IRIS’ spectrograph whose slit can be seen as
a black vertical line in the left most image. The aim of this research is to
predict the most statistically likely responses within the Fe II, C II, Fe XXI
and Si IV spectral windows, given only the Mg II spectra in blue. These
methods are not confined to this particular arrangement, and can be applied
with any spectral window as a basis.

Mg II: The Mg II h&k resonant doublets are amongst the strongest lines in the
solar UV spectrum, with wings that follow the temperature structure of the
photosphere and peaks that form in the mid-chromosphere. On account of the
high relative abundance of magnesium (Asplund et al., 2009), the core
formation height extends into the upper chromosphere, where radiative de-
excitation exceeds collisional de-excitation by a factor of four (Leenaarts et
al., 2013b), resulting in a loss of temperature sensitivity in the source
function and ubiquitous quiet Sun central reversals.

Since the lines are strongly scattering and form in a relatively low density
environment, the velocity field remains unconfused in the frame of the atom,
and partial frequency distribution (PRD) becomes important (Rutten & Milkey,
1979). Including PRD effects into radiative transfer codes ordinarily results
in lower inner wing intensities and higher peak intensities with cores that
are relatively well approximated by complete redistribution (CRD) (Leenaarts
et al., 2013b). The intensity ratios of the Mg II h&k lines can be used as an
opacity diagnostic, with a k/h-ratio of 2:1 and 1:1 indicating optically thin
and thick line formation, respectively. The Mg II h&k lines provide excellent
upper and mid chromospheric diagnostics of temperatures and velocities
(Leenaarts et al., 2013a). During solar flares, spectral profiles are greatly
enhanced and broadened, with significant Doppler shifts resulting in a
multitude of spectral shapes (Kerr et al., 2015; Rubio da Costa et al., 2016;
Panos et al., 2018; Tei et al., 2018; Tian & Chen, 2018). The increased
densities allow the line cores to re-couple to the Planck function and serves
as one possible mechanism for the formation of single peaked spectra. Kerr et
al. (2019a) showed that PRD effects are still important even in the presence
of increased collisional rates from enhanced densities. Furthermore, the
assumption of statistical equilibrium appears to hold for strong flares (Kerr
et al., 2019b). The Mg II k-line also has a companion of triplets at 2791.60,
2798.75 and 2798.82 Å, with the two mixed subordinate lines in the red wing
going into emission during flares. Zhu et al. (2019) found that during solar
flares, the formation height of the subordinate lines move from the lower to
the upper chromosphere, and should therefore not be used as upper photospheric
diagnostics.

C II: So far the C II lines have only been modeled for the quiet Sun (Kowalski
et al., 2019), and not the flaring atmosphere. The C II multiplet consists of
two strong resonant lines at 1334.53 Å and 1335.71 Å, with a weak blend at
1335.66 Å. Together they represent the strongest lines within the IRIS FUV1
passband, and one of the few optically thick lines that form around the base
of the transition region (Rathore & Carlsson, 2015). The C II lines share many
characteristics with Mg II h&k, offering equivalent, if not slightly degraded
diagnostics, which are nevertheless complementary. For the case of the quiet
Sun, ionization equilibrium is controlled for low temperatures via
photoionization and radiative recombination (C I/C II) and by collisional
ionization and dielectronic recombination for higher temperatures (C II/C III)
. Horizontal scattering effects are also important for the line core
intensity. Depending on how much matter is at temperatures between 14 – 50kK,
the C II line cores can form just above or below the formation height of Mg
II, and are well modeled by CRD (Rathore & Carlsson, 2015). Similar to Mg II,
3D scattering effects play an important role within the line cores, which
makes the formation properties strictly non-local (Rathore & Carlsson, 2015).
The line ratios can be used as a complementary, but much weaker diagnostic of
opacity than magnesium, with ratios other than 1.8 indicating optically thick
emission, while ratios precisely at 1.8 remain ambiguous. The main distinction
from Mg II is that C II has a narrower formation range and contains more
optically thin emission.

Si IV: The Si IV resonance lines at 1393.75 and 1402.77 Å are some of the
strongest lines in IRIS’ FUV channel, and provide insight into the structure
and dynamics of the transition region. They form outside of statistical
equilibrium (Olluri et al., 2015; Martínez-Sykora et al., 2016) and are often
assumed to be optically thin, although this assumption may not always be valid
for flaring atmospheres. Significant deviations from the optically thin line
ration of 2 (the ratio of the resonant lines spontaneous radiative decay
rates) have been noted both in observations (e.g., Bartoe & Brueckner, 1975;
Brannon et al., 2015) and simulations (Kerr et al., 2019c). The ratio between
the Si IV and spin-forbidden O IV lines have been suggested as a potential
diagnostic tool for probing high density regimes, ($N_{e}\sim
10^{13}\text{cm}^{-3}$), synonymous with flaring atmospheres, however, several
issues regarding differences in peak formation temperatures, and ambiguities
in the fractional ion abundances bring into question the validity of these
results (Judge, 2015). Additionally, some Si IV lines are blended with the O
IV lines, which become particularly problematic for very large Si IV emissions
during flares.

Fe II: The literature for the weak lower chromospheric Fe II 2814.445 Å line
is very sparse, but has recently received some attention as a potential
flaring diagnostic (Kowalski et al., 2019). Furthermore, the line never
saturates in IRIS observations (Graham et al., 2020), offering continual
diagnostic coverage even over the brightest flare kernels. Kowalski et al.
(2017) showed that a 5F11 high energy beam model produces two flare regions, a
stationary and condensation layer moving at approximately 20-55 km s-1. This
model helps explain the observed red wing asymmetry over bright flare kernels
and flare footpoints. These enhanced red wing components are endemic to
chromospheric lines in general during the impulsive flare phase, and are a
direct signature of strong chromospheric condensation first modeled by Fisher
et al. (1985). Since the Fe II line is optically thinner than most
chromospheric flare lines (but thicker than the NUV continuum emission), the
hope is that Fe II can be used to restrain flare induced velocity fields at
large column mass, however, at present, there are several notable
discrepancies between models and observations, some of which pertain to
intensity ratios, and others with regards to the temporal evolution of the red
wing Fe II components. High cadence IRIS observations from Graham et al.
(2020) have highlighted several of these temporal disagreements. The
observations always appear more gradual than their simulated counterparts,
which show immediately comparable core and red wing intensity enhancement at
beam onset (within a few seconds for the red wing), accompanied by a rapidly
diminishing red wing enhancement towards its stationary position within about
10 seconds. The observations on the other hand show that the onset of the red
wing enhancement is gradual, taking about $30$ s to be comparable in intensity
to the rest wavelength component, and that a similar length of time (rather
than the simulated $10$s) is required for the satellite to relax back to its
stationary position.

Fe XXI: Other than the often very weak Fe XII line, the 10 MK coronal Fe XXI
1354.08 Å forbidden line is the only coronal line in IRIS’ diagnostics. It is
blended primarily with the strong C I 1354.288 Å line, which is present even
outside of flaring regions, as well as a few less significant narrow Fe II
line blends. Despite the low emissivity of Fe XXI, it is clearly observed
during solar flares in locations that exceed temperatures of 10 MK, these
include the energy release site, flare ribbons and post flare loops. The Fe
XXI line usually first appears in flare ribbons, strongly blue-shifted with
upflow velocities in excess of 200 km $\text{s}^{-1}$, in agreement with
models of chromospheric evaporation, and decays to quasi-stationary within
about 10 minutes (Innes et al., 2003; Graham & Cauzzi, 2015; Young et al.,
2015). Downflows appear subsequently, at velocities below a few tens km
$\text{s}^{-1}$ (Battaglia et al., 2015; Tian et al., 2014). Although Fe XXI
has provided crucial model constraints for chromospheric evaporation, the
physical mechanism responsible for the nonthermal >100 km $\text{s}^{-1}$
widths at flare footpoints remains elusive. A recent study by Polito et al.
(2019) used hydrodynamic models to dismiss the most popular explanation of
sub-resolution plasma flows at different velocities, showing that an
additional physical mechanism, such as plasma turbulence or very large ion
temperatures is necessary for a complete explanation. A speculative dismissal
of the superposition scenario was already put forward several decades earlier
by Antonucci et al. (1986), who noted that it would be unlikely for up- and
down-flowing material to exactly balance each other to produce the archetypal
symmetric Fe XXI profile commonly observed. This line is still actively
challenging our understanding of energy transport within solar flares.

##  3\. Point-wise correlation measures

In this section, we refresh some of the concepts encountered in the first
paper, and introduce a new quantity called the Point-Mutual-Information or
PMI, which allows us to investigate the correlation between lines on a
spectrum-to-spectrum basis. We then explain how the PMI can be extracted from
the numerical method discussed in the first paper, and use the results to
confirm the hypothesis that spectra located directly over the flare ribbons
contribute most to the inter-line correlations.

###  3.1. Mutual and Pointwise information

In Paper I of this series, we discussed the use of Mutual Information (MI) as
a measure for the correlation between the shapes of different spectral lines.
This quantity was given by

$\text{MI}(\mathcal{L}1;\mathcal{L}2)=\sum_{x\in\mathcal{L}1}\sum_{y\in\mathcal{L}2}p(x,y)\log\frac{p(x,y)}{p(x)p(y)},$
(1)

and can be calculated using either a categorical method involving the k-means
algorithm of MacQueen (1967), or a numeric method using a neural network
called a Mutual Information Neural Estimator (MINE) (Belghazi et al., 2018).
The variables $x$ and $y$ represent spectra from lines $\mathcal{L}1$ and
$\mathcal{L}2$, with the term $p(x,y)$ called the joint probability
distribution, describing the chance of observing two specific types of spectra
simultaneously, while the marginal probabilities $p(x)$ and $p(y)$ tell us how
frequent each spectral type is. In-order to measure the joint and product of
the marginal probabilities, we either sample spectra for both lines
$\mathcal{L}1$ and $\mathcal{L}2$ from the same pixel, or in the latter case,
from different pixels. In practice, $x$ and $y$ are not the actual spectra,
but a set of reduced and highly relevant features, automatically derived by a
neural network. These features could be a combination of quantities such as
line widths, Doppler shifts and asymmetries. To calculate the correlation
between any two spectral lines, say Mg II and C II, one has to perform the
following procedure: 1) reformulate Eq.(1) to make it amenable to variational
maximization techniques, 2) obtain a large reservoir of both Mg II and C II
spectra (in our case several million), 3) derive the salient features of each
line to serve as inputs $x$ and $y$, 4) calculate the joint and marginal
probabilities by sampling spectra from the same and different pixels
respectively. As it turns out, back propagation function approximators such as
the MINE-network, allow us to automatically estimate the aforementioned
probabilities and features while simultaneously solving an optimization
problem (for an extensive description of this method please refer to Paper I).
This results in a single value whose magnitude describes the degree to which
both lines are correlated. If this value is high, then there is a good
possibility that we could predict the shape of a C II spectrum, just by
knowing the shape of the Mg II spectrum within the same pixel. On the other
hand, because Eq.(1) is an aggregate of many pairs of spectra, a low MI does
not necessarily rule out the possibility of the existence of a small subset of
strongly correlated spectra.

Figure 2.— Collection of synthetic data to test the convergence properties of
PMI from our trained model $T_{\theta}$. Each of the 4 panels represents a
different group found by k-means. The group centroids are displayed in black,
while each groups members are overplotted in color. The number of spectra from
each group as well as their pixel alignments can be seen in the lower colored
bars. For example: There are 500 Mg1 type spectra connected with 400 C1
spectra, as well as 200 Mg2 type spectra connected with 300 C2 spectra.
Controlling the ratio of groups and the connections between them allows us to
calculate the true PMI between each spectrum, which in turn provides us with a
benchmark for testing the convergence properties of our model.

To address this uncertainty, instead of deriving the aggregate MI, the summand

$\text{PMI}(x;y)\triangleq\log\frac{p(x,y)}{p(x)p(y)},$ (2)

of Eq.(1), called the Pointwise-Mutual-Information (PMI), allows us to
understand how the correlations are distributed among the individual spectra,
and which spectral shapes are responsible for the largest contribution to the
MI. The PMI is the ratio of the probability that two spectra from different
lines occur simultaneously $p(x,y)$, with what we would expect from chance
$p(x)p(y)$. As an example: Imagine that we have a photospheric line Fe II, and
a transition region line Si IV. If 90% of the spectra from the photospheric
line are indistinguishable absorption profiles and only 10% of the profiles
are in emission, then the fact that a specific type of profile shape from the
Si IV line always appears with the photospheric absorption profiles is not
statistically significant, because random chance would dictate this to be the
case. On the other hand, if the same transition region spectra always occur
with photospheric spectra in emission (but never with those in absorption),
regardless of their 10% sparsity, then the confidence that the spectral shapes
are correlated is statistically more significant. This common sense deduction
is precisely what PMI captures. The range of allowed values is given by the
interval

$-\infty<\text{PMI}(x;y)\leq\min[-\log p(x),-\log p(y)],$ (3)

with larger positive numbers corresponding to stronger correlations. We
speculate that the resultant hypothesis function of a carefully trained and
converged MINE-network should be able not only to optimize over large
aggregates of spectra, but also on a spectrum-to-spectrum basis.

Figure 3.— Convergence of PMI between spectra from group Mg1 and C1 (blue
curve) and Mg2 and C2 (orange curve). The curves were constructed by
calculating the PMI between the centroids (not the raw spectra) in Figure 2,
at each instance of the models training. For example: At Epoch 10, the PMI is
underestimated in both cases because the model has only been able to update
its internal parameters 10 times, leading to a suboptimal model. The
horizontal orange and blue lines represent the true PMI calculated from the
ratios given in Figure 2. We see that the estimated PMIs quickly converge to
their true values. Importantly, this is true when using centroids instead of
raw data.

Figure 4.— Evolution of spectral correlations between Mg II and Fe II during
an M6.5-class flare (#13 in Table 1). The upper 6 panels show the PMI
associated with spectral pairs emanating from single raster sweeps. The color
code splits the PMI into: Blue ($\text{PMI}\leq 0$), Orange ($0<\text{PMI}<1$)
and Yellow ($\text{PMI}\geq 1$). The lower panel shows the GOES curve and
derivative, with the accumulated MI scores of each SJI indicated by the
vertical lines. We see that the MI is strongly correlated with the GOES
derivative, and that the largest contributions to the MI are over the most
energetic regions, i.e., the flare ribbons, meaning that Mg II and Fe II are
correlated most strongly in flare ribbons.

To test this, we constructed an artificial data set consisting of 700 Mg II
and C II spectra respectively, as seen in Figure 2. Each line has two distinct
types of spectral shapes labeled: Mg1, Mg2, C1 and C2. Note that there is a
black profile in each of the four panels. This is referred to as the group
centroid, and is taken to be the average of all the (orange or blue) profiles
within the particular group. The colored bars on the bottom of the figure
indicate whether the spectral shapes occur together or not. For instance, 500
spectra from the Mg1 group occur simultaneously with 400 spectra from group
C1, similarly, 200 Mg2 spectra occur with 200 spectra from C2. This synthetic
data set allows us to calculate the theoretical PMI of both (Mg1|C1) in blue,
and (Mg2|C2) in orange, which can then be used as a benchmark. The convergence
of the MINE-network for both cases can be seen in Figure 3. The theoretical
PMI’s derived from the artificial data set are indicated as horizontal lines
color coded with the same scheme. The orange and blue curves represent the
MINE-networks estimation of the PMI’s between (Mg1|C1) and (Mg2|C2)
respectively at each point of its 50 epoch training cycle. After 20 epochs,
the network has converged on the theoretical values, with slight fluctuations
persisting for the PMI between (Mg1|C1) in blue. We conclude that the PMI can
safely be derived from the resulting hypothesis function of a carefully
trained MINE-network.

###  3.2. Single pixel correlations using PMI

In Paper I, we postulated that the MI was concentrated over the flare ribbon.
This argument was based on two observations: Firstly, that the maximum MI of
all tested line-pairs coincided precisely with the peak of the GOES flux
derivative, and secondly, that the MI of all line-pairs increased when
sampling spectra only from the strict flare condition, rather than from the
weak flare condition. The strict flare condition was designed to accept pixels
that were related to Mg II spectra which were drastically different from their
quiet Sun counterparts. This difference was quantified using a variational
autoencoder, see Paper I for details. It is still however an assumption that
the spectra that differ most from quiet Sun profiles, in terms of shape, are
confined exclusively to the flare ribbon. It might be the case that the
spatial region which contributes the most to the MI is located just off of the
ribbon.

The ability to estimate the PMI between individual spectra allows us to
directly test the hypothesis that the MI saturates directly over the flare
ribbon. In Figure 4, we calculated the PMI of each IRIS pixel in flare number
13 of Table 1 for the (Mg II|Fe II) line-pair. We then projected the results
onto the corresponding slit jaw images (SJI) in terms of a color coding
scheme, with blue indicating a $\text{PMI}\leq 0$, orange corresponding to
$0<\text{PMI}<1$, and yellow with a $\text{PMI}\geq 1$. The lower panel
indicates the GOES curve and derivative, with vertical lines labeled A through
F specifying the times when the 6 different SJI images shown above were taken.
This result indicates an explicit relationship between the lower and upper
atmosphere that is induced either by large amounts of focused heating or bulk
velocity flows. The spectral lines of Mg II and Fe II have maximum
correlations directly over the flare ribbon, and during the impulsive phase,
where energy deposition is at a maximum. This confirms that flare atmospheres
are much more vertically coupled than quiet Sun atmospheres.

##  4\. Conditional probability

Including Paper I, so far we have calculated the total correlations (MI)
between spectral shapes from different lines formed over different atmospheric
heights, finding that some lines are more strongly coupled than other in
flaring atmospheres. We then extended the methods to calculate the
correlations on a spectrum-to-spectrum level (PMI). We discovered that most of
the correlations appear directly over the flare ribbons. In what follows, we
further develop these methods to determine the actual spectral shapes, so that
we can address the question: given a Mg II spectrum associated with the flare
ribbons, what type of spectra occur co-spatially and co-temporally in C II, Si
IV, Fe II, and Fe XXI, and with what probabilities? To answer this question,
we need to calculate the conditional probabilities (CPs) between pairs of
spectra. In this section, we develop a simple method based on the k-means
clustering algorithm, which will allow us to quickly derive the CPs with a
minimal set of assumptions.

Figure 5.— An example of two different Fe XXI spectral types. The upper panel
shows a few thousand spectra and their variance away from the average spectral
profile indicated as a white dashed line. The entire collection of spectra
forms a spectral "type". In this particular case, the distinctive quality of
this group is that the Fe XXI and blended C I emissions appear clearly
distinct from one another. Similarly, the lower panel shows a different
spectral type, where the C I blend is entirely consumed by the Fe XXI
emission. Grouping spectra into similar shapes, regardless of their small
variances, allows us to ignore irrelevant details, and perform statistical
studies which were previously not possible.

###  4.1. Deriving Conditional probabilities

At high enough resolution, each spectrum is unique, therefore, it makes little
sense to talk about a statistical study. In order to speak intuitively about a
spectrum and its inter-line correlations, we have to introduce a degree of
vagueness into its definition, so that when we talk about a spectral "type",
we refer not to a precise spectrum, but rather to a collection of spectra with
similar, but non-identical profile shapes, that nevertheless have some notable
features in common. Ideally, all spectra that belong to a specific spectral
type have a similar shape.

The k-means algorithm (MacQueen, 1967) is an ideal tool for automatically
clustering spectra into groups of similar shapes. For a relevant and detailed
explanation of the algorithm, see Panos et al. (2018). Figure 5 shows two
different Fe XXI spectral types, with each group containing non-identical, but
nevertheless similarly shaped profiles. Representing large amounts of slightly
varying spectra as the same spectrum is an example of a vector quantization,
and in the literature, the terms: type, group and label are often used
interchangeably. A vector quantization can be thought of as a generalized form
of data binning, where some information is sacrificed in order to gain
purchase on the statistics of the problem. In this case, the small variations
within each group are ignored.

We used k-means to classify the spectra into 1000 spectral types for each of
the 5 analyzed lines over the entire data set of 21 large flares. This
resulted in $x_{i},i\in{1000}$ groups for Mg II, $y_{j},j\in 1000$ groups for
C II and so on. It is important to keep in mind that within any $x_{i}$ group,
there are a large number of non-identical, but similar shaped spectra. This
inter-group-variance implies that the derived CPs depend strongly on the
number of spectral types, however, this variance becomes insignificant when
selecting a large number of groups. The CP-distributions can then be derived
via a simple counting scheme demonstrated in Figure 6.

This figure shows a hypothetical example that uses 10 spectral types for both
$x$ and $y$ instead of the 1000 groups used on the actual data. In this
example, $x$ and y could refer to Mg II and C II spectra respectively. The
left panel of Figure 6 is a diagrammatic realization of how many times a
spectrum from one Mg II group appears simultaneously with spectra from a C II
group. For example, spectra from group $x_{1}$ occur once within the same IRIS
pixel as spectra from groups $y_{1},y_{2}$ and $y_{5}$. Therefore, the
conditional probabilities are
$p(y_{1}|x_{1})=p(y_{2}|x_{1})=p(y_{5}|x_{1})=0.33$, with all other
conditional probabilities being zero. The middle panel highlights the
connections for the more complicated case of fixed $x_{6}$. The Mg II spectra
in this group appear to be connected to a variety of different C II groups
with different frequencies. For instance, $x_{6}$ occurs with $y_{6}$ four
times while only once with spectra from group $y_{1}$. The frequencies of
connections (CPs) are displayed on the vertical axis in the panel on the
right, with the highest conditional probability indicated in red as
$p(y_{6}|x_{6})=0.2$ and only occurring once. Note that we have chosen to
normalize the CPs by the maximum value $0.2$, derived from 4 occurrences of a
total 20 connections. The lowest conditional probability on the other hand is
$0.05$, and is realized four times by single connections between $x_{6}$ and
$y_{1},y_{4},y_{5}$ and $y_{10}$, leading to the normalized probability of
0.25 in the figure. Note that for this particular case, the connections in the
middle panel as well as the probability density of the right panel is depicted
in dark blue. We will adopt an identical normalization and color scheme when
calculating the CP-distributions for real data.

On a technical side note, the high number of spectral types means that some
distinct groups share similar looking spectra. In order to properly estimate
the CPs, these groups were manually merged, leading to fewer than 1000 Mg II
spectral types in the end.

Figure 6.— Example of how to derive conditional probabilities to answer
questions such as: given a certain Mg II spectral type $x_{i}$, what is the
probability of observing a specific type of C II spectra $y_{j}$? The above
figure shows 10 hypothetical spectral types for Mg II and C II represented in
the left panel as grey and white circles respectively. Each spectral type
contains thousands of similar but non-identical spectra. A particular CP-
distribution can be calculated by counting the relative number of connections
between a fixed grey node and the corresponding white nodes. The number of
connections from one node to another represent the number of times spectra of
type $x_{i}$ occur with spectra of type $y_{j}$ within the same IRIS pixel. In
the middle panel, we have highlighted the connections for spectral type
$x_{6}$, which may represent Mg II spectra with large red wing enhancements.
Most of the connections go to $y_{6}$, which most likely also contains C II
spectral shapes indicating downflows. The connections from $x_{6}$ to the
other groups are weighted according to the total number of connections,
allowing us to calculate the normalized CP-distributions seen in the right
panel. The same color scheme is used when calculating the CP-distributions for
a real fixed Mg II spectral type in section 5.

Figure 7.— Each of the 6 color-coded panels shows a particular Mg II spectral
type and their most statistically likely responses over the remaining 4
spectral lines within the sub panels. We have provided the following naming
convention for each category: Strong-Ribbon-Front (upper left) and Weak-
Ribbon-Front (upper right), Broad-Single-Peaked (middle left) and Narrow-
Single-Peaked (middle right), Downflow (bottom left) and Downflow-Extended-
Shoulder (bottom right). The line cores are indicated by vertical dashed
lines, and the color bars represent the normalized conditional probabilities
of each profile, with redder profiles being more statistically likely than
bluer profiles. From the upper left panel, it is clear that reversals with a
peak asymmetry occur simultaneously in Mg II, C II and Si IV. Additionally, Fe
II is very likely to be in emission during the impulsive phase, indicating
strong heating of the lower atmosphere. Fe XXI appears with a delay, going
from blueshifted to stationary as can be seen from the top-left to bottom-
right. Figure 8.— Temporal occurrence of the different flare spectra (single-
pixel). Each panel shows a different Mg II spectrogram covering both the
k-core and red wing subordinate line, with the rest wavelengths indicated by
black and white horizontal dashed lines respectively, and each time step
normalized separately to one. The flare number, raster step position, and
pixel are indicated in the lower right hand side of each panel. A white stripe
in the lower left coroner shows the length of a minute interval. The colored
squares at the top of each plot assign the spectra directly below them into
one of the 6 spectral types in Figure 7. Spectra belonging to white groups
were not analyzed here. The cyan and green spectral types consistently flag
the impulsive phase at the beginning of each flare sequence, and consist of a
blue shifted central reversal indicated in the first middle panel by a blue
arrow, while downflows (red colors) appear at later stages.

Figure 9.— Temporal occurrence of the different flare spectra (all-pixels).
The histograms depict color-coded types of spectra, from ribbon front (cyan,
green), to single-peaked (yellow, orange) and downflows (red shades). The GOES
X-ray flux is shown in the background and the red vertical lines indicate the
start and end times of the IRIS observation, which does not necessarily
coincide with the manually selected analysis range. The sequence seen in
Figure 8 appear to be true for the majority of flare related pixels. The
larger overlap between spectral types is due to the gradual unfolding of the
flare ribbons, something that a single pixel analysis is not affected by. It
is evident that all spectral types analyzed here are correlated to flares, and
that downflows appear during later flare phases.

##  5\. Application to Mg II Spectra

In this section, we apply the above method to derive the CPs of 6 archetypal
Mg II flare spectra, and analyze the responses in the remaining spectral
windows. The results can be seen in Figure 7, where each of the six panels
correspond to a different Mg II spectral type: Ribbon-Front-Spectra (cyan and
green), Single-Peaked-Spectra (yellow and orange), Downflows (pink and red).
The most likely spectral responses for each Mg II type can be seen within the
sub-panels. Redder spectra are more likely than spectra in blue shades. As an
interpretive example, if we observe a Mg II spectrum that looks similar to the
profiles shown in the upper cyan panel, then it is almost guaranteed that C II
has a large peak asymmetry, and that Fe II is most likely in emission.

A single panel typically contains thousands of spectra, we therefore created a
compression scheme that merged similar spectra together for the figure while
still retaining any important variances from less probable profiles. The CPs
were updated according to the average score of the merged spectra.

###  5.1. Temporal behavior of the spectra

In addition to analyzing the CP-distributions of Figure 7, analyzing the
temporal ordering of the spectra in relation to the impulsive phase, allows us
to interpret the spectral types within the context of the evolution of a
flare. We therefore marked the locations of each spectral type on Mg II
spectrograms taken from all of our 21 flares.

A few examples that cover both the Mg II k-core and red wing subordinate line
can be seen in Figure 8, with the rest wavelengths indicated by dashed black
and white horizontal lines, and the flare number, raster step (with the count
starting at 0), and pixel along the slit denoted in the lower right hand
corner of each panel. The colored squares located above each spectrum indicate
which spectral type it belongs to. For instance, the spectra in the upper
panel directly below the cyan and green squares at about the 100th raster mark
belong to the Ribbon-Front type spectra of Figure 7. Because the observations
raster step is an ambiguous measure of time, we have included a reference for
the length of a minute represented in the lower left hand corner of each panel
by a solid white stripe.

Figure 8 shows that there is a weak mixing in the time domain, so that the
spectral types are not consistently ordered in relation to the impulsive burst
picked up by the cyan and green spectra. This can be seen in both the middle
left and lower right spectrogram, where orange types appear briefly as the
first spectra in the sequence. Additionally, orange and yellow types can
flicker between one another, while downflows seem to be confined to the end of
the flare sequence, but need not be visible in every case. This mixing must be
taken into account when interpreting the CP-distributions of Figure 7.

Despite the weak mixing, there are some general characteristics that can be
extracted. As the flare ribbons deposit their energy, the Mg II spectra
develop central reversals which often appear blue shifted. This blue shift is
most notable in the two central panels of Figure 8, where the dark section in
the middle of the spectrogram (reversal) is biased towards smaller wavelengths
(see blue arrow). Flare 12 was confined between two sunspots, which may
explain the oscillatory behavior of the reversal, since each strand would
deposit pulses of non-thermal electrons as the reconnection site propagates
upwards. During the time interval of the burst, we see that the triplet line
also goes into emission on account of a shared formation height with the core
during the early flare heating phases. Most panels also show a strong peak
asymmetry for the cyan and green profiles, with an enhanced
$2\text{k}\text{r}$ peak. After the initial shock, the Ribbon-Front-Spectra
relax back to line center and become Single-Peaked (yellow and orange) before
developing extensive red wing emissions from coronal rain. Other authors have
noted similar line behavior over hard X-ray footpoints (Liu et al., 2015).
Importantly, the Ribbon-Front-Spectra typically have a lifetime of 1-3 minutes
and can evolve from single peaked spectra. Therefore, the reversal is not a
consequence of a typical quiet Sun profile being recoupled to the Planck
function, but rather the result of dynamical motions. More studies should be
undertaken to accurately measure the relaxation time of the central reversal.

This typical sequential behavior can be seen at larger scales in Figure 9,
where we show the normalized temporal occurrence of each spectral type for two
flares, taken not just with respect to a single pixel, but aggregated over all
pixels. The black line denotes the GOES X-ray flux (1-8 Å) and the red
vertical lines indicate the start and end times of the IRIS observations, of
which we only analyzed a duration around the flare. Again, we see that the
Ribbon-Front spectra (cyan, green) are located mostly within the impulsive
phase, followed by single peaked spectra (yellow, orange) and then during the
gradual phase we see many downflow counts. Because the ribbon unfolds over
time, each sequence is initiated with a slight delay time to the previous
sequence, explaining why there is more overlap between the spectral types than
in Figure 8.

Although the majority of Ribbon-Front-Spectra occur in the impulsive phase,
there are many instances, which can be seen here, where similar spectral
shapes appear during the gradual phase, often in locations corresponding to
clear downflows within the 1400 SJI of IRIS. Although these late phase spectra
are grouped together with the Ribbon-Front spectra, they often appear with
much lower intensities and smaller triplet emission.

The results from the above sequence plots urge cation when interpreting the
CP-distributions of Figure 7, since we might be conflating line responses from
different parts of the flare sequence within the same panel.

###  5.2. Ribbon-Front-Spectra

The Ribbon-Front-Spectra of Figure 7 come in two flavors: A Strong variant in
the upper left cyan panel, and a Weak variant in the upper right green panel.
These spectral types were found at the moving edges of flare ribbons (Xu et
al., 2016; Rubio da Costa et al., 2016), and are now recognized as a common
feature during the impulsive phase of many flares (Panos et al., 2018). This
is now doubly confirmed by Figure 8. They have very broad non-thermal widths,
asymmetric peaks, and slightly blue shifted central reversals, whose formation
properties are still under debate.

####  5.2.1 Formation properties of the blue-shifted-reversal

The blue-shifted reversals may result from a superposition of unresolved
downflows at different heights (Rubio da Costa & Kleint, 2017), but simple
non-LTE cloud models have also reproduced the observed peak asymmetries with
upflows (Tei et al., 2018). The simplicity of these cloud models unfortunately
do not allow us to determine the likelihood for the upflow scenario.
Simulations have demonstrated a possible third mechanism based on a PRD effect
(Kerr et al., 2019a). In this third model, the blue and red peak, which
outline the central reversal arise from two different processes. The enhanced
$2\text{r}$ peaks may be constructed out of red Doppler-shifted photons due to
a dense downward propagating condensate triggered by the reconnection event.
This condensate would naturally displace the maximum opacity into the red,
allowing the bluer photons that constitute the $2\text{v}$ peaks to have
longer mean free paths. In combination with a red shifted absorption profile,
coherent scattering from PRD may allow the blue photons to remain in their
optically thinner tracks, without being reabsorbed and emitted at redder
frequencies. This interplay between a red shifted absorption profile and
coherent PRD scattering, may thin the atmosphere for bluer wavelengths, and
free enough photons to form the observed $2\text{v}$ peak. It appears that
PRD, at least for the Mg II lines, could be important for the blue peak
formation, which is observed to be a combination of both optically thick and
thin line emission (Kerr et al., 2019a).

Our results in Figure 7 show that these types of spectral profiles are not
unique to Mg II, but also simultaneously appear in both C II and Si IV. PRD
effects are not considered to be important for both of these lines within the
current modeling literature (e.g., Rathore & Carlsson, 2015; Kerr et al.,
2019c). It may therefore be the case that under the extreme circumstances of a
flaring atmosphere, the correct modeling of these lines also requires the
inclusion of PRD effects, however, we find this difficult to believe, since if
anything, the density rich flaring atmosphere should increase the photon
destruction probability $\epsilon=C/A_{ij}$, leading to a reduction of
coherence in the laboratory frame. Alternatively, the larger mean free paths
$\tau$ of Si IV may not require the additional action of coherent scattering
via PRD to unlock and free blue photons, and a simple displacement of the
absorption profile from line center might suffice. Considering that we find
very similar spectral shapes with blue-shifted reversals during later phases
of flares where plasma is seen to fall towards the solar surface, downflows at
least seem to be a more likely explanation of the reversals than upflows.

Figure 10.— Velocity distribution of the central reversals for all ribbon
front spectra corresponding to the cyan and green groups. The minima of the
reversals were located below the resolution limit by interpolating a small
window around the core and fitting the reversal with a higher order
polynomial. Negative values represent blue wavelength shifts, while positive
value correspond to red shifts. We find that the majority of Ribbon-Front
spectra have a central minimum that is blue shifted with a large spread.

####  5.2.2 Velocity statistics of the reversal

The distribution relating to the position of the blue shifted reversal for the
collection of all cyan and green Ribbon-Front-Spectra can be seen in Figure
10. The locations of the reversals were calculated below the resolution limit
by interpolating the profiles onto a fine grid around the core, and fitting
the reversals with a high order polynomial. The broad distribution encompasses
values obtained from modeling efforts (Rubio da Costa & Kleint, 2017; Kerr et
al., 2019a), and results from the fact that the position of the central
reversal evolves in time. We also note that this distribution may be biased to
both high and low absolute values. In the former case, since the automatic
exposure control of IRIS can only react with a small delay, some of the
brightest spectra often saturate the detector, leading to the possibility of
the strongest blueshifted reversals being excluded in our statistics. On the
other hand, shallow central reversals run the risk of being mislabeled into
other groups.

####  5.2.3 Information from other spectral windows during the ribbon front
phase

The Si IV line is often assumed to form under optically thin conditions,
although this is probably a safe assumption for the quiet Sun, a number of
flare observations have hinted at optical depth effects (e.g Tian et al.,
2015; Li et al., 2017; Warren et al., 2016). Furthermore, modeling efforts
that include accurate charge exchange processes (Kerr et al., 2019c) show that
a substantially larger fraction of Si IV is found at lower temperatures than
what is normally predicted by ionization-equilibrium, leading in some cases to
optically thick line formation. The complex asymmetric Si IV line profiles
associated with the Strong-Ribbon-Front panel of Figure 7 contribute to the
growing body of evidence for momentary optically thick Si IV line formation in
flares. We note that a direct opacity measure can be obtained using the
1394/1403 line ratio, however, the 1394 Å line is only available for two of
our observations (flare 4 and 14 in Table 1), and unfortunately is always
overexposed for Strong-Ribbon-Front pixels.

We also note that the coronal Fe XXI line is not visible during the initial
stages of the flare, but can become visible together with some weak ribbon
flare spectra. This is in agreement with Graham & Cauzzi (2015), who observed
a delay time of more than a minute between the signatures of chromospheric
condensation and coronal upflow.

Fe II being in emission, especially during the strong ribbon front profiles
shows that energy is most likely deposited in the low atmosphere, leading to a
different temperature gradient. Although the intensity information has been
normalized out of the spectra, the emission in the most probable Fe II spectra
corresponding to the Strong-Ribbon case, must be far greater than the
surrounding continuum emission, which in contrast appears to be flat. Such
strong line emission is commonly seen in IRIS flares (e.g., Kleint et al.,
2016, 2017) and can exceed the Balmer continuum significantly (Heinzel &
Kleint, 2014). This leads us to believe that for some high energy cases, where
the accelerated electron energies exceed $50~{}\text{keV}$, the lower
stationary layers may be heated at a faster rate than the downward moving
condensational layer (Kowalski et al., 2019).

For readers interested in these profile types, we suggest the observation
covering Flare 12 of Table 1. This flare is confined between two sunspots, and
as a result, the energy from consecutive reconnections is deposited within a
small region of plasma, providing sustained Ribbon-Front-Spectra within the
same pixels. This surplus of energy also results in the emission of other
metallic lines which appear as spikes along the Mg II profiles.

###  5.3. Single-Peaked-Spectra

After the passing of a flare ribbon, the chromosphere is compressed and
heated. The enhanced temperatures and densities result in the formation of
Single-Peaked Mg II spectral types as seen in both the yellow and orange upper
panels of Figure 7. The enhanced densities may lead to thermalization lengths
that are comparative or typically smaller than the length scales defining
local temperature variations, which in turn leads to a temperature sensitivity
in the source function of the cores $S(n_{e},T_{e})$, allowing them to rise
with the electron temperature instead of fall off with radial height. Other
explanations include a superposition of plasma moving in opposite directions
(Rubio da Costa & Kleint, 2017), or strongly enhanced Stark broadening (Zhu et
al., 2019).

The yellow spectral types often occur after the Ribbon-Front-Spectra as seen
in Figure 8. Because they typically evolve from ribbon profiles, they are
extremely broad due to the enhanced thermal motions. Mg II has redshifted
cores, indicating bulk atmospheric downflows. The C II and Si IV windows are
still in downflow and retain many of the same features as before, but lack the
reversals associated with the Ribbon-Front spectra. Interestingly, Fe XXI
finally appears with some examples of large upflows and becoming mostly
stationary, in agreement with the example shown by Battaglia et al. (2015) who
found blueshifts near footpoints and low velocities in the loops afterwards.
The Fe II line is still mostly in emission, with a few pixels showing
absorption.

Due to the similarity between the yellow and orange spectral types discussed
above, it is hard to impose a strict time ordering, however, in general,
yellow spectral types are followed by orange spectral types that have smaller
widths and equally intense triplet emission. Notably, in the middle right
panel of Figure 7, Si IV still shows strong downflows but has developed a
prominent stationary component, while Fe XXI shows no signs of upflow
profiles, but remains in emission at line center. Finally, Fe II appears
either in emission and absorption.

###  5.4. Downflows

During the gradual phase we observe a large variety of spectral types
associated with downflows, two of which can be seen in the bottom panels of
Figure 7, with a slightly less extended red wing in the bottom left panel that
tends to appear before spectra with substantially extended red wings as seen
in the bottom right panel. The fact that the majority of these spectral types
occur during the gradual phase as seen in Figure 8 and Figure 9, imply that
they are mostly associated with coronal rain. When cool condensing material
cascades back down the flare loops, the single peaked spectral types that came
before, develop a red wing enhancement, which is mirrored both in C II and Si
IV. The velocities are relatively similar at $\approx 100$ km s-1 in all
spectral lines and supersonic, similar to previous IRIS coronal rain
observations (e.g., Kleint et al., 2014; Lacatus et al., 2017). Fe XXI still
appears in emission and stationary, while Fe II can be either in emission or
absorption. When Mg II displays extremely broad and intense red wing emission
(red group), Fe II appears almost exclusively in absorption, possibly
indicating that the lower chromosphere has finally dissipated its energy and
cooled.

Figure 11.— Large downflows occur both during the gradual phase as coronal
rain and sometimes during the impulsive phase due to chromospheric
condensation. The left panel shows a 1400-SJI of flare 17 as the upper portion
of IRIS’s spectrograph captures down flowing material during the gradual flare
phase as indicated by the red highlighted pixels along the slit. The spectra
associated with these pixels have been plotted in the upper left two inserts.
The first insert shows spectra that have been grouped into the bottom left
spectral type of Figure 7, while the second insert is associated with the
extended shoulder downflows (bottom right of Figure 7). Similar spectral
shapes can be seen in the right panel during the impulsive phase of flare 16.
The GOES X-ray curve for each flare is schematically plotted in blue at the
bottom of both panels, with an arrow indicating the approximate time each SJI
was rendered.

We analyzed the integrated line ratios for both the core and red wing
components of the h&k-lines by fitting two Gaussian’s to each line. We found
that on average, the red component is more optically thin than the core, but
is still far from the optically thin ratio of 2. We found that the optical
depths of these components were independent of raster, meaning opacity within
the components do not depend on time. We will investigate the optical
thickness of the ratios in more detail in a further study, including the
seemingly more pronounced red component of Si IV.

Although the large majority of these spectral types can be associated with
coronal rain and occur during the gradual flare phase, very similar-looking
spectra can also occur during the impulsive phase due to chromospheric
condensation (e.g., Brannon, 2016; Tian & Chen, 2018). Figure 11 shows the
location of Mg II spectra with large red wing enhancements during the gradual
phase of flare 17 and the impulsive phase of flare 16. The spectra in the
upper left-hand corner of each panel have been automatically found by our
algorithm at the red locations indicated along the slit. The two inserts of
spectra in both images are associated with the bottom two spectral types of
Figure 7. Although the spectra from both flares are similar, there appear to
be some subtle differences. The red wing triplet emission is significantly
enhanced in relation to the core for the coronal rain, while the peaks of the
line cores are broader for the case of the condensation, possibly due to the
increased turbulence and energy from the non-thermal electrons. Additionally,
the right insert for the coronal rain shows a distinct red wing shoulder,
indicating a superposition between a stationary component at line-center and a
downflowing component, contrary to the right insert for the condensation,
which appears to show spectra with a flatter red wing runoff.

##  6\. Conclusion and outlook

A trained Mutual Information Neural Estimator can be used to calculate a tight
lower bound on the degree to which any two lines within a single IRIS pixel
are correlated. High correlations imply the possibility of correctly guessing
the shape of line $\mathcal{L}1$ from the shape of $\mathcal{L}2$.
Additionally, the $k$-means clustering algorithm can be used to calculate
simple probability distributions by grouping similar but non-identical spectra
together, and counting the number of co-occurrences of each spectral type
within the same pixel. These simple models can then be used to plot the most
and least likely responses of line $\mathcal{L}1$ given a particular spectral
type from $\mathcal{L}2$. These models are based on a minimal set of
assumptions, namely that the number of spectral types is sufficient to capture
the large variety of spectral shapes encountered during a solar flare. The
methods developed here are not limited to the windows or observations
encountered in this paper, and can be readily applied to any number of
spectral lines and instruments. For instance, one could analyze particular
responses to O IV instead of Mg II, provided there are enough IRIS
observations available to build reliable probability distributions. We used
these methods to analyze a set of typical Mg II flare spectra and their
accompanying responses over 4 different spectral windows, finding the
following results:

  * •

The correlations between line shapes are maximized over the flare ribbons,
meaning that in these highly energetic regions of the atmosphere, it is
possible to predict the emission of a particular ion based on the emission
from a different ion.

  * •

The blue-shifted reversal in Mg II associated with Ribbon-Front-Spectra also
typically co-occur both in C II and Si IV, although less often. This reversal
is likely due to downflows and coherent scattering may not be necessary for
its formation, especially in lines with less optical depth than Mg II.

  * •

Si IV appears to show optical depth effects during the impulsive phase at the
edge of flare ribbons.

  * •

C II and Si IV appear to be in downflow for the entirety of each flare
observation, with prominent downflows even in Fe II during the initial stages
of the flare.

  * •

The emission of the Fe II line indicates deep atmospheric heating which
gradually decrease over the duration of the flare.

  * •

Fe XXI only goes into emission once the flare ribbons have passed over a
particular region, showing a delay time between downflows in the chromosphere
and large coronal upflows, as also found by Graham & Cauzzi (2015). Fe XXI is
then seen to be in emission and stationary for the remaining flare time.

  * •

Our analysis shows that in general, Mg II spectra located over flare ribbons
typically develop a blue shifted reversal which initially migrates away from
line center before returning to its rest wavelengths. These spectra are
accompanied by strong triplet-line emission, and transition into single peaked
shapes while still retaining the large widths associated with the Ribbon-
Front-Spectra. The line widths slowly erode over time, while the triplet
emission remains strong , but declines in the gradual flare phase. During the
gradual phase, strong red-enhancements indicating coronal rain are prominent.

  * •

The ratios associated with the downflowing spectra indicate optically thick
line formation both for the core and red wing component. The line ratios
appear to be invariant in time.

It is important to keep in mind that these results are based on statistics
derived from hundreds of millions of IRIS spectra, and that the relationships
between different spectral lines shown here, represent the aggregate behaviour
of 21 large solar flares. Our method is well-suited to analyze large data sets
efficiently and could in the future be very useful for the analysis of DKIST
observations, which are expected to exceed Petabytes of data per year (Rimmele
et al., 2020). By analyzing overview images, such as Figure 7, one can
immediately determine the applicability of such multi-line analyses, as each
panel represents the only possible set of cotemporal responses, independently
of the sample size.

The MINE-network indicates that it should be possible (for instance in the
case of (Mg II|C II)) to accurately reconstruct spectral data from one line
based on the information of another. These methods represent a first
approximation to achieving this goal, and would be greatly enhanced via the
use of a continuous generative model which takes into account the temporal
domain. The ability to predict missing data could be particularly beneficial
if two instruments ran at different cadences, or in the case of overexposure.

For the derivation of all mutual information quantities, we used the deep
learning library PyTorch (Paszke et al., 2019), as well as the Scikit-Learn
module for all implementations of the $k$-means algorithm (Pedregosa et al.,
2011). The pre-processing was accomplished with IRISreader, a library
specifically developed for handling large volumes of IRIS data (Huwyler,
2018). We would like to thank the Swiss National Science Foundation for
funding this research under grant number 407540_167158 and a PRIMA grant, as
well as LMSAL and NASA for allowing us to download all the IRIS data from
their servers. IRIS is a NASA small explorer mission developed and operated by
LMSAL with mission operations executed at NASA Ames Research center and major
contributions to downlink communications funded by ESA and the Norwegian Space
Centre. We thank S. Voloshynovskiy, S. Krucker, D. Ulmann, C. Huwyler, and M.
Melchior for discussions.

## References

  * Antonucci et al. (1986) Antonucci, E., Rosner, R., & Tsinganos, K. 1986, ApJ, 301, 975
  * Asplund et al. (2009) Asplund, M., Grevesse, N., Sauval, A. J., & Scott, P. 2009, Annual Review of Astronomy and Astrophysics, 47, 481
  * Bartoe & Brueckner (1975) Bartoe, J.-D. F., & Brueckner, G. E. 1975, J. Opt. Soc. Am., 65, 13
  * Battaglia et al. (2015) Battaglia, M., Kleint, L., Krucker, S., & Graham, D. 2015, ApJ, 813, 113
  * Belghazi et al. (2018) Belghazi, M. I., Baratin, A., Rajeshwar, S., et al. 2018, in Proceedings of Machine Learning Research, Vol. 80, Proceedings of the 35th International Conference on Machine Learning, ed. J. Dy & A. Krause (Stockholmsmässan, Stockholm Sweden: PMLR), 531–540
  * Benz (2008) Benz, A. O. 2008, Living Reviews in Solar Physics, 5, 1
  * Brannon (2016) Brannon, S. R. 2016, ApJ, 833, 101
  * Brannon et al. (2015) Brannon, S. R., Longcope, D. W., & Qiu, J. 2015, The Astrophysical Journal, 810, 4
  * Fisher et al. (1985) Fisher, G. H., Canfield, R. C., & McClymont, A. N. 1985, ApJ, 289, 434
  * Fletcher et al. (2011) Fletcher, L., Dennis, B. R., Hudson, H. S., et al. 2011, Space Science Reviews, 159, 19–106
  * Flower & Nussbaumer (1975) Flower, D. R., & Nussbaumer, H. 1975, A&A, 45, 145
  * Gabriel & Mason (1982) Gabriel, A. H., & Mason, H. E. 1982, in Applied Atomic Collision Physics, Volume 1: Atmospheric Physics and Chemistry, Vol. 1, 345–397
  * Gošić et al. (2018) Gošić, M., de la Cruz Rodríguez, J., De Pontieu, B., et al. 2018, ApJ, 857, 48
  * Graham & Cauzzi (2015) Graham, D. R., & Cauzzi, G. 2015, ApJ, 807, L22
  * Graham et al. (2020) Graham, D. R., Cauzzi, G., Zangrilli, L., et al. 2020, ApJ, 895, 6
  * Heinzel & Kleint (2014) Heinzel, P., & Kleint, L. 2014, ApJ, 794, L23
  * Heroux et al. (1972) Heroux, L., Cohen, M., & Malinovsky, M. 1972, Sol. Phys., 23, 369
  * Huwyler (2018) Huwyler, C. 2018, IRISreader, https://github.com/i4Ds/IRISreader
  * Innes et al. (2003) Innes, D. E., McKenzie, D. E., & Wang, T. 2003, Sol. Phys., 217, 267
  * Judge (2015) Judge, P. G. 2015, The Astrophysical Journal, 808, 116
  * Kerr et al. (2019a) Kerr, G. S., Allred, J. C., & Carlsson, M. 2019a, The Astrophysical Journal, 883, 57
  * Kerr et al. (2019b) Kerr, G. S., Carlsson, M., & Allred, J. C. 2019b, The Astrophysical Journal, 885, 119
  * Kerr et al. (2019c) Kerr, G. S., Carlsson, M., Allred, J. C., Young, P. R., & Daw, A. N. 2019c, The Astrophysical Journal, 871, 23
  * Kerr et al. (2015) Kerr, G. S., Simões, P. J. A., Qiu, J., & Fletcher, L. 2015, A&A, 582, A50
  * Kleint et al. (2016) Kleint, L., Heinzel, P., Judge, P., & Krucker, S. 2016, ApJ, 816, 88
  * Kleint et al. (2017) Kleint, L., Heinzel, P., & Krucker, S. 2017, ApJ, 837, 160
  * Kleint et al. (2014) Kleint, L., Antolin, P., Tian, H., et al. 2014, ApJ, 789, L42
  * Kowalski et al. (2017) Kowalski, A. F., Allred, J. C., Daw, A., Cauzzi, G., & Carlsson, M. 2017, ApJ, 836, 12
  * Kowalski et al. (2019) Kowalski, A. F., Butler, E., Daw, A. N., et al. 2019, The Astrophysical Journal, 878, 135
  * Lacatus et al. (2017) Lacatus, D. A., Judge, P. G., & Donea, A. 2017, ApJ, 842, 15
  * Leenaarts et al. (2013a) Leenaarts, J., Pereira, T. M. D., Carlsson, M., Uitenbroek, H., & De Pontieu, B. 2013a, The Astrophysical Journal, 772, 90
  * Leenaarts et al. (2013b) Leenaarts, J., Pereira, T. M. D., Carlsson, M., Uitenbroek, H., & Pontieu, B. D. 2013b, The Astrophysical Journal, 772, 89
  * Li et al. (2017) Li, Y., Kelly, M., Ding, M. D., et al. 2017, The Astrophysical Journal, 848, 118
  * Lin & Carlsson (2015) Lin, H.-H., & Carlsson, M. 2015, ApJ, 813, 34
  * Liu et al. (2015) Liu, W., Heinzel, P., Kleint, L., & Kašparová, J. 2015, Sol. Phys., 290, 3525
  * MacQueen (1967) MacQueen, J. 1967, in Proceedings of the Fifth Berkeley Symposium on Mathematical Statistics and Probability, Volume 1: Statistics (Berkeley, Calif.: University of California Press), 281–297
  * Martínez-Sykora et al. (2016) Martínez-Sykora, J., De Pontieu, B., Hansteen, V. H., & Gudiksen, B. 2016, ApJ, 817, 46
  * Munro et al. (1971) Munro, R. H., Dupree, A. K., & Withbroe, G. L. 1971, Sol. Phys., 19, 347
  * Olluri et al. (2015) Olluri, K., Gudiksen, B. V., Hansteen, V. H., & Pontieu, B. D. 2015, The Astrophysical Journal, 802, 5
  * Panos et al. (2018) Panos, B., Kleint, L., Huwyler, C., et al. 2018, The Astrophysical Journal, 861, 62
  * Panos et al. (2020) Panos, B., Kleint, L., & Voloshynovskiy, S. 2020, The Astrophysical Journal, submitted
  * Paszke et al. (2019) Paszke, A., Gross, S., Massa, F., et al. 2019, in Advances in Neural Information Processing Systems 32, ed. H. Wallach, H. Larochelle, A. Beygelzimer, F. d’Alché Buc, E. Fox, & R. Garnett (Curran Associates, Inc.), 8026–8037
  * Pedregosa et al. (2011) Pedregosa, F., Varoquaux, G., Gramfort, A., et al. 2011, Journal of Machine Learning Research, 12, 2825
  * Polito et al. (2019) Polito, V., Testa, P., & Pontieu, B. D. 2019, The Astrophysical Journal, 879, L17
  * Rathore & Carlsson (2015) Rathore, B., & Carlsson, M. 2015, The Astrophysical Journal, 811, 80
  * Rimmele et al. (2020) Rimmele, T. R., Warner, M., Keil, S. L., & et al. 2020, Sol. Phys., 295
  * Rubio da Costa & Kleint (2017) Rubio da Costa, F., & Kleint, L. 2017, The Astrophysical Journal, 842, 82
  * Rubio da Costa et al. (2016) Rubio da Costa, F., Kleint, L., Petrosian, V., Liu, W., & Allred, J. C. 2016, ApJ, 827, 38
  * Rutten & Milkey (1979) Rutten, R. J., & Milkey, R. W. 1979, ApJ, 231, 277
  * Sadykov et al. (2019) Sadykov, V. M., Kosovichev, A. G., Sharykin, I. N., & Kerr, G. S. 2019, The Astrophysical Journal, 871, 2
  * Shannon & Weaver (1949) Shannon, C. E., & Weaver, W. 1949, The mathematical theory of communication
  * Tei et al. (2018) Tei, A., Sakaue, T., Okamoto, T. J., et al. 2018, Publications of the Astronomical Society of Japan, 70, 100
  * Tian & Chen (2018) Tian, H., & Chen, N.-H. 2018, The Astrophysical Journal, 856, 34
  * Tian et al. (2014) Tian, H., Li, G., Reeves, K. K., et al. 2014, The Astrophysical Journal, 797, L14
  * Tian et al. (2015) Tian, H., Young, P. R., Reeves, K. K., et al. 2015, The Astrophysical Journal, 811, 139
  * Vissers et al. (2020) Vissers, G. J. M., Danilovic, S., de la Cruz Rodriguez, J., et al. 2020, arXiv e-prints, arXiv:2009.01537
  * Warren et al. (2016) Warren, H. P., Reep, J. W., Crump, N. A., & Simões, P. J. A. 2016, The Astrophysical Journal, 829, 35
  * Xu et al. (2016) Xu, Y., Cao, W., Ding, M., et al. 2016, The Astrophysical Journal, 819, 89
  * Young et al. (2015) Young, P. R., Tian, H., & Jaeggli, S. 2015, ApJ, 799, 218
  * Zhu et al. (2019) Zhu, Y., Kowalski, A. F., Tian, H., et al. 2019, The Astrophysical Journal, 879, 19