{'fraction_non_alphanumeric': 0.027249454821276192, 'fraction_numerical': 0.009784772921209823, 'mean_word_length': 4.760978807078873, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Exploiting solar visible-range observations by inversion techniques: from flows in the solar subsurface to a flaring atmosphere

Observations of the Sun in the visible spectral range belong to standard measurements obtained by instruments both on the ground and in the space. Nowadays, both nearly continuous full-disc observations with medium resolution and dedicated campaigns of high spatial, spectral and/or temporal resolution constitute a holy grail for studies that can capture (both) the long- and short-term changes in the dynamics and energetics of the solar atmosphere. Observations of photospheric spectral lines allow us to estimate not only the intensity at small regions, but also various derived data products, such as the Doppler velocity and/or the components of the magnetic field vector. We show that these measurements contain not only direct information about the dynamics of solar plasmas at the surface of the Sun but also imprints of regions below and above it. Here, we discuss two examples: First, the local time-distance helioseismology as a tool for plasma dynamic diagnostics in the near subsurface and second, the determination of the solar atmosphere structure during flares. The methodology in both cases involves the technique of inverse modelling.


Introduction
The Sun is our closest star and as such it serves as a prototype for the whole class of such cosmic objects [1]. As compared to the other stars, the Sun is routinely observed from a luxurious proximity 24 hours a day, 7 days a week. The availability of the longterm near-continuous synoptic observations together with short-term high-resolution campaign observations consists a holy grail for highly detailed studies of the solar structure and dynamics. The theories and hypotheses based on the observations of the Sun serve as constraints for theories of stellar structure and evolution.
The Sun is an active and variable star with various phenomena observed in its atmosphere termed the solar activity. These phenomena exist due to the solar interior being interwoven with the magnetic field, which takes various forms. The origin of it is still being debated in the literature [2]. Overall, the solar magnetic field depicts cyclic behaviour on a large range of time scales from seconds to millennia [3]. There is a dynamo process running deep inside the Sun, possibly at the base of the convection zone, which recycles and strengthens the global magnetic field. Emergence of the magnetic flux tubes through the convection zone towards the surface and above forms complexes of strong magnetic field localisations, the active regions [4]. In active regions we typically find the most prominent phenomena of solar activitysunspots, prominences, and flares. All these processes are only partially understood, thus much of the on-going and future research is dedicated to them.
The proper understanding of the violent phenomena of solar activity, namely flares and coronal mass ejections, is necessary as these phenomena may in effect interfere with human technology, which is crucial for the quality of life as we know it [5]. There are many open questions and without answering those we will not be able to successfully predict the solar activity, which is one of the main goals of the solar research. For instance, triggers for flares may lie in the dynamics of the plasmas at the solar surface and below and the flaring processes may strongly depend on the parameters of the atmosphere above the surface. Visible-range observations may in principle bring important information about both solar interior and atmosphere.

Solar photosphere in the visible range
In the visible-range of electromagnetic radiation, the photosphere is the dominant source of solar radiation. The term photosphere is often replaced by "solar surface", but this is not very precise. Following a text-book definition, the photosphere describes the thin near-spherical shell where the visible and infrared solar continua originate [6]. Its width is several hundreds km and the lower boundary of the photosphere is defined at the optical depth unity (τ 500 = 1) -level at which the intensity at λ = 500 nm is approximately given by the continuum source function. The opacity is dominated by bound-free H − transitions. The formation height of the continuum radiation is wavelength dependent. For instance it is deeper in the near-infrared part of the spectrum, where free-free contributions of H − dominate.
The photosphere is only several hundreds kilometers thick. One of the definitions adopts a thickness of about 300 km, which corresponds to the scale over which the gas pressure decreases by an order of magnitude. Even though a realistic description of the vertical stratification of the photosphere have been achieved already by 1-D models [7], observations are very convincing in the fact that the evaluations of the structure of the photosphere needs to be considered in all three dimensions [8]. Already the observations in the visible continuum by amateur telescopes reveal the pattern of granulation, the distinct convection pattern that corresponds to the thermal dissipation scale [9]. The granular cells have a typical diameter of about 1 Mm and a life time of about 10 minutes. Both these parameters depict very wide statistical distributions. According to the current paradigm, the granules are the final products of the turbulent-convection cascade emerging from the bottom of the convection zone [10]. Other convection-like features are present and measured in the photosphere: the mesogranules, the supergranules and possibly the giant cells.
High-resolution observations reveal not only the granular cells, but also features of smaller size, such as magnetic bright points and other indications for the smallscale magnetic field [11]. In these magnetic-field concentrations the τ = 1 level lies even deeper, about 200 km as compared to the surrounding "quiet" photosphere. In these regions, the magnetic pressure contribution to hydrostatic balancing reduces the gas density. Such thin flux tubes form a magnetic network that is preferentially located at supergranular boundaries. Even larger magnetic field concentrations create anomalous granular patterns (flux-emergence regions, "plage" regions) and strong enough magnetic field inhibits the convection completely by creating pores and sunspots [12].
Thus the transition from the 1-D vertically stratified models towards a fully 3-D time-dependent solution of (magneto)hydrodynamical equations with realistic equation of state was eminent. And it was successful [13]. The physics behind the processes active in the quiet photosphere and closely below and above are believed to be understood quite well. That is demonstrated by the fact that the numerical simulations reproduce the observable photospheric properties remarkably well [9]. Detailed simulations reproduce even specialties such as elongated granules in the regions with emerging magnetic fields or particular flows around spots and pores [14,15].

Sub-surface dynamics
From the analyses of solar observations together with proper modelling based on the theory of stellar structure and evolution it turns out that the Sun is a main-sequence star with an effective temperature of 5778 ± 3 K, radius of (6.960 ± 0.001) × 10 8 m and a mass of (1.9889 ± 0.0003) × 10 30 kg [16]. Because of the action of gravity, such a star has a significant radial stratification, generally showing three main layers. The central region up to some 25% of radius is occupied by the core, where the physical conditions allow the thermonuclear fusion to run mostly by means of the proton-proton chain. This is the region where the solar luminosity, equivalent of almost 4×10 26 W, originates. The central temperature reaches 15.7 MK and the pressure of 2.5×10 16 Pa according to the state-of-the-art models [17].
At around 25% of solar radius the temperature of the ambient plasma decreases below the value of around 7 MK. The efficiency of the thermonuclear reactions is very low henceforth, however the state parameters of the plasma are such that the plasma is fully ionised and the opacity is very low for the high-energy photons originating from the proton-proton chain. Due to the temperature gradient the energy is transported towards the surface via radiation, photons diffuse by free-free radiative scattering. This layer is called the radiative zone.
At 71% of the solar radius [18,19] the mean plasma temperature decreases under ∼2 MK and recombination of ions starts to occur locally. The opacity rapidly increases due to the bound-free radiative absorption of photons by heavy elements. The energy transport via radiation is no longer possible. The convection sets in and begins to be the main energy transport agent until the surface, through the whole convection zone. The ever-changing granulation is a consequence of the convective overshoot from the convection zone underlying the photosphere. The convection zone is a principal layer, where the dynamo is seated somewhere and from where the flux tubes later forming sunspots and other phenomena rise up.
Studying the convection zone is not straightforward. The sub-surface of the Sun is optically thick, preventing us from directly observing the interior layers. Understanding the properties of the plasma in these regions has consequences for theories of convection, stability of sunspots, the dynamics of stratified convection, and others. Most of current knowledge about convection comes primarily from computational work, e.g. [20,21,22]. Helioseismic inversions of the sub-surface flows play an important role in constraining these theories.
The physics of convection in the low-viscosity, large-density and large-temperature gradient regime associated with the convection zone is not well known [23]. Most of the convection zone is moderately vertically stratified, but as the plasma approaches the photosphere, it undergoes a rapid expansion because of the steep near-surface density gradient. With the rapid decrease of temperature in the near-surface layers ionisation zones of several elements (e.g. helium and hydrogen) form, and the release of the latent heat by the recombination is thought to power the various scales of turbulent convection.

Oscillations
A powerful way of imaging the solar interior is via inferences gathered from studying the statistics of the acoustic and surface gravity waves detectable at the surface. Solar pressure and surface gravity modes are generated randomly by the vigorous turbulence in the upper convection zone. These oscillations are best observed in the solar photosphere by measuring Doppler shifts of photospheric absorption lines.
The spatio-temporal power spectrum of solar oscillations provides the best evidence for the existence of the resonant standing waves. These resonant modes form the structure of non-intersecting ridges in a k − ω diagram, where k stands for the wave number and ω = 2πν for the cyclic frequency of the waves. The position of the ridges is a very sensitive indicator of the internal structure of a star. An example of the k − ν diagram is in Fig. 1. One can see obvious signatures of resonant modes depicted by ridges of increased spectral power. A vast majority of the modes seen in the solar k − ω diagram belong to the group of p-modes, which are acoustic modes where the pressure is a restoring force. The pmodes propagate mostly in a convectively unstable layers, that is in the near-surface convection zone. The ridge positioned lowest on the k −ω diagram is a f -mode ridge. f -modes are surface gravity modes, similar to the oscillations of the free surface. Frequencies and wave numbers (which relate to the wavelengths) are examples of helioseismic observables.

Helioseismology
Changes in the internal structure of the Sun, including localised changes, induce shifts in frequencies of the modes. Forward modelling allows us to relate anomalies like flows, thermal hot/cold spots etc. to changes in helioseismic observables. It is not straightforward to infer the characteristics of these anomalies from observables. Sophisticated techniques of inverse modelling -or "inversions" in short -must be adopted.
The aim of helioseismic inversions is to reveal the structure of the subsurface flows (rotation, meridional circulation, convection), magnetic fields, and to measure deviations in the plasma state parameters (temperature, density, pressure) from a quiet Sun average.
Localised perturbations in the parameters of solar plasmas may be investigated using the approach of local helioseismology. The time-distance helioseismology [24], one of the local helioseismic methods, has proven to be very useful. In recent years, time-distance helioseismology has been used to determine near-surface flows [25,26,27,28], flows beneath sunspots [29,30,31,32,33,34] and flows in their vicinity [25], and to study the rotational gradient at the base of the convection zone [35], etc. Time-distance inversions (see a review [36] and a scheme in Fig. 2) are based on a concept of a perturbed travel time δτ, The observed travel time τ obs is measured from observations (usually from a series of intensity or Doppler-shift measurements of the photospheric lines) by means of a time-domain cross-correlation of the signal between two different points on the solar surface. The model travel time τ model is computed from the assumed background solar model. The background model is usually assumed to be vertically stratified with no magnetic fields and no plasma velocities, such as Model S [17].
The actual state of the solar interior at a certain point may depart from the background model, i.e., state quantities may be perturbed or flows may be present. The usual assumption used in a vast majority of helioseismic studies is that these perturbations of the plasma state are small compared to the background model. Thus we may assume a linear perturbation and solve the linearised equation of the wave propagation.
The perturbed travel time δτ can theoretically be computed from the model as where r indicates the horizontal position vector and z the vertical coordinate in a plane-parallel approximation of the 3-D position vector x = (r, z). Here K is a vector of sensitivity kernels which represents the linear sensitivity of the travel-time measurements to the perturbations δq [37,38]. The sensitivity kernels are defined by the background model and the level of approximation (ray approximation, Born approximation, etc.). The vector of perturbations may contain quantities such as flows, speed of sound, density, etc. Since the solar oscillations are excited by vigorous surface convection, in reality the measured travel time contains a large random-noise realisation component, which needs to be taken into account in further analyses. The goal of an inverse problem is to invert Eq. (2) to determine δq from the measurements of δτ. Such an inversion is usually not possible due to the presence of random noise.
In the Sun, a full spectrum of waves with different properties is excited. Individual modes propagate more-or-less independently throughout the solar interior, thus by measuring the travel times of different modes we obtain independent information about the nature of the solar interior. By filtering, it is possible to separate distinct modes of the waves and measure their travel times. Consequently, for each filtered wave mode there is a separate equation (2), therefore also the travel times may symbolically be written in the vector form as δτ. On the other hand, all these equations share the same vector of perturbers δq. In helioseismic inversions one combines all independently measured travel times to learn about the perturbers.
Helioseismic inversions are usually performed by using two principal methods: The regularised least squares (RLS) and optimally localised averaging (OLA). The RLS method [39] seeks to find the models of the solar interior, which provide the best least-squares fit to the measured travel-time maps, while regularising the solution (e.g., by requiring the smooth solution). The OLA method was developed for geoseismology [40,41]. Subtractive-OLA (SOLA) method [42], a form suitable for use in helioseismology, is based on explicitly constructed spatially confined averaging kernels by taking linear combination of sensitivity kernels, while simultaneously keeping the error magnification small. The resulting coefficients are then used to linearly combine the travel-time maps and obtain an estimate for structure and magnitude of solar plasma perturbations. A SOLA-type inversion is the principal method demonstrated here. The SOLA has been used in time-distance local helioseismology in the past [43,28], where the ability of SOLA inversions to reveal the structure of 3-D internal flows was demonstrated. An efficient approach to solve fully consistent SOLA inversions was has been also introduced [44].

The basic principle
Unlike the RLS approach, the SOLA methodology does not minimise the difference between the measured travel times and those modelled from the modified solar model. SOLA assumes that the inverted estimates of the quantities may be obtained using a linear combination of the travel-time maps, symbolically written for α-th component δq α of the vector δq as where w are the inversion weight functions. From an oversimplified point of view, SOLA performs the deconvolution of the travel-time maps. Taking into account a noise term (the measured travel times are noisy) and using Eqs. (2) and 3), we obtain where the object K is referred to as the (vector) averaging kernel. It is defined as and quantifies the level of spatial smearing of the real quantity δq.
In the SOLA method we search for the weights w so that the vector averaging kernel K resembles the target function T. The target function is an user-selected initial estimate for the averaging kernel which indicates the desired localisation in the Sun. An example of commonly used target function is a 3-D Gaussian with a peak at a chosen target depth z 0 .
In practise the SOLA cost function χ 2 SOLA is minimised, which can be written in a simplified form The first term ||K(x ) − T(x )|| 2 of the right-hand side of Eq. (6) then evaluates the misfit between the averaging kernel and a target function T.
The second term of Eq. (6) is the regularisation of the random-noise level in the inverted quantity, where Λ is the travel-time noise covariance matrix. The matrix Λ may be obtained either from the reference model or from the travel-time measurements.

The cross-talk
The third term β α K β (r ) 2 in Eq. (6) is related to the cross-talk and regularises the non-diagonal components (that is all components except for the inverted α-th) of the averaging kernel. The meaning of the cross-talk is illustrated by Eq. (4). There, the inverted estimate of the α-th component is composed not only from the appropriate δq α smoothed with the respective averaging kernel K α , but also from the "irrelevant" perturbers δq β for β α smoothed with their respective averaging kernels K β . The physical meaning of the averaging kernel is demonstrated in Figs. 3 and 4. According to Eq. (4) the inverted quantity (v inv x in this case) is obtained by cross-correlation of the averaging-kernel vector and vector δq of the real physical quantities. For each position x 0 = (r 0 , z 0 ), the weighted average of real quantity δq β is computed where the weights equal to K β . The final v inv x is then a sum of the noise term and individual weighted averages for all βs (columns one to four in Fig. 3). In the case of v x inversion in Fig. 4 one can see that v inv x is mostly given by real v x averaged over around 15 Mm in horizontal and 4 Mm in vertical direction (see contours in Fig. 4). The other contributions are small because K y , K s , v z , and δc s are small, thus products of K β δq β are small for these off-diagonal components (cf. individual contributions in Fig. 3).
To complete the discussion of the terms in the inversion cost function we add that χ 2 other contains additional terms such as the regularisation of the weights or the constraint on the normalisation of the averaging kernel. User-given trade-off parameters µ and ν balance the terms in the cost function.
The framework seems to be well established, but some unknowns remain that need to be cleared out. For instance, the inverse problem is cast in a set of algebraic equations with a system matrix that is ill-posed and usually nearly singular. The numerical errors from calling the mathematical pseudo-inverse of the system matrix may propagate throughout the rest of the computations. The consistency of the numerical implementation must be evaluated carefully.

Interpretation of the inversion
The description above gives an indication that there are three different quantities that are needed to be determined in order to interpret the time-distance inversion results properly.
• Inverted map δq inv α , which gives the inverted estimates for the physical quantity δq α at positions r 0 and at target depth z 0 . • Noise level σ α gives the root-mean-square value of the random-noise component in the inverted map. The particular noise-component realisation in the inversion is not known and is an inseparable part of the inverted map. • Vector averaging kernel K, defined by Eq. (5), gives an important information about the smearing of the inverted quantity. It also gives the real depth sensitivity (whereas the value of z 0 is the target depth which only serves as a parameter). In Fig. 5 one can see the depth dependence of averaging kernels of four inversions with different target depths z 0 = (0.5, 2, 4, 6) Mm. A careful reader can see that the peak sensitivity of these kernels is different from their indicated target depths.
The averaging kernel also contains information about the presence of the sidelobes. Sidelobes are places with non-negligible values of the averaging kernel which are at larger distances from the central point. Such an averaging kernel is not well localised (see an example in Fig. 6). Thus, the inverted estimate in a given point is spoiled by the properties of plasma which is far away and which possibly has different properties. The off-diagonal components for α β indicate the leakage of unwanted perturbations to the inverted map, the cross-talk. Ideally these cross-talk components of the averaging kernel should be negligible, so that the inverted map is not polluted by the cross-talk.

Lessons learnt from the validation
One way to check the consistency of the inversion modelling is a validation using known inputs. These known inputs may come from the realistic simulation of solar convection. Such a validation then gives limits that could be expected from the inversions of the real-Sun observables [45]. The inversions for the horizontal flow components (v x and v y ) are well-posed in the near-surface layers. The results of the inversion are in a great agreement with the known flows which come from a simulation of the convection zone. In Fig. 3 one can see individual contributions to the inverted v inv x . From the left, first five columns correspond to individual terms in Eq. (4), the sixth column is a sum of individual contributions (left-hand side of Eq. (4)) and the right-most box shows an ideal answer of our inversion (noiseless smearing of the real quantity by the inversion target function). In the first row, minimisation of the cross-talk was not applied, while in the second row, it was applied. The differences in corresponding columns are negligible. Thus, horizontal flow is a strong perturber and possible contributions from the remaining weak perturbers (the vertical flow and the soundspeed perturbations) are negligible even when the cross-talk is not minimised.
With the travel times averaged over 24 hours or so, it is possible to invert for the horizontal flow snapshot on supergranular scales roughly in the upper 5 Mm of the convection zone. An example of the averaging kernel of such an inversion is shown in Fig. 4. For deeper inversions different approaches must be taken. One should either increase the level of averaging (by increasing the extent of the averaging kernel) or invert for a statistical representation. In the latter case the ensemble averaging over a set of representatives of the same kind (e.g. set of individual supergranules) is a suitable approach [46,47].
For the successful inversion for the vertical flow component (v z ) it is essential to minimise the cross-talk, otherwise the results are significantly distorted by the leakage mainly from the horizontal components of the flow; the inverted vertical flow is almost in anticorrelation with the expected output [48,49], see Fig. 7. The leakage from the sound-speed perturbations is acceptably small. For the travel times averaged over 24 hours or so it is not possible to invert for the flow snapshot deeper than around 1 Mm. In Fig. 6 there is the averaging kernel for v z inversion at 4.0 Mm depth. It is evident that the averaging kernel is localised around 1 Mm below the surface, not around targeted 4 Mm (compare to equivalent averaging kernel for the horizontal flow component in Fig. 4). The depth sensitivity of several inversions is nicely seen in Fig. 5, where horizontal integrals of averaging kernels for v z inversions in different depths are plotted. Even though the target depth is changing from 0.5 Mm to 6.0 Mm, the depth sensitivity of the inversion is nearly the same. Attempts to perform deeper inversions lead either to a noise level much larger that the signal, or to a strong departure from the target function (as in this case) [50]. Attempt to invert for the snapshot of the vertical flow on supergranular scales with a signal-to-noise ratio larger than one naturally converges towards the shallow "surface" inversion. The realistic perturbation of the speed of sound is also a weak perturber. Thus the cross-talk minimisation is essential. Unlike in the case of the vertical flow, in the case of the sound-speed perturbations the cross-talk is positively correlated. Thus the cross-talk "helps" to "measure" δc s . Such an approach leads to an overestimation of the magnitude of the sound-speed variations by almost a factor of two in the nearsurface layers. Such an inversion, however, is not the inversion for δc s . An example of inverted sound-speed perturbation in near-surface layers is plotted in Fig. 8. The first row shows the inverted maps with and without cross-talk minimisation (similar to the fourth column in Fig. 3). In the second row there are, from left to right, individual contribution to inverted result with the cross-talk minimisation (similar to the fourth column in the bottom row in Fig. 3) and the ideal answer.
By using the local helioseismology, one can learn about the dynamics of the solar subsurface. The knowledge of this dynamics is important for assessment of the evolution of the magnetic field. Unfortunately, helioseismic inversions do not seem  We demonstrate that if cross-talk is not addressed, horizontal components will leak into the inverted v z and cause a bias. Obviously, inferred estimate is then in the anticorrelation with the expectations.
to help in constraining the subsurface structure of the magnetic field in the active regions due to a very strong interaction of various kinds of waves in the magnetised plasma [34].

Information about the higher atmosphere
The coupling between the solar sub-surface and the structures of the magnetised atmosphere is striking [51]. For instance, a particular flow topology may contribute in triggering the solar flares. In a sudden eruption of a quiet-Sun filament followed by a solar flare found that the zonal shear flow possibly contributed to triggering the filament eruption and the consequent flare ignition [52,53].
The upper atmospheric layers have a very low density and it is difficult to speak about them in term of the spherical shells. The chromosphere is a warped and highly dynamic surface that is thin around kilogauss concentrations of the magnetic field and thick in regions where acoustic shocks appear in otherwise cool internetwork gas. Higher up the chromospheric fibrils are structured by the magnetic field that extend from the network and from plage regions. The chromosphere is very dynamic, where we find evidence for magnetic reconnections, Alfvén waves, magnetically guided converted acoustic waves and many more which form the chromospheric structures. The chromosphere loses much of the energy by radiation in strong resonance lines of hydrogen, helium, calcium and magnesium.
These higher layers do not contribute much in the visible range to the total solar irradiance, because the photosphere overshines them. However, locally there are phenomena, which may outshine even the background photosphere.

White-light flares
Solar flares are widely believed to be a consequence of reconnection of the coronal magnetic field in a peculiar configuration. The magnetic energy stored in the entangled coronal loops is released suddenly during the flare and a large portion of the flare energy is radiated away in a wide range of wavelengths emerging from the intensively heated flare atmosphere.
In the visible range of wavelengths the usual line emission is often accompanied by enhancement of continuum radiation and such flares are called white-light flares (WLF, [54,55]). There are various mechanisms proposed for enhancement of the optical continuum: hydrogen bound-free and free-free transitions, Thomson scattering, and H − emission. Futhermore, each mechanism may dominate in different atmospheric layers spanning from the photosphere through the temperature minimum region to the chromosphere, and all require an increase in temperature and electron density in those layers.  However, it is still debated how these layers are heated (see Fig. 9). Several processes have been proposed: electron and/or proton bombardment, XEUV heating, Alfvén wave dissipation, etc. [56]. Moreover, it has been shown that the photosphere and the chromosphere can be radiatively coupled via photospheric heating by H − absorption of the hydrogen Balmer continuum, which originates in the chromosphere. This backwarming then can lead to increased photospheric (H − ) radiation [57].
To disentangle the contributions to the visible-light continuum, specific observations and dedicated models are needed. Combining flare observations of several photospheric and chromospheric lines together with visible-light continuum and non-LTE modelling, i.e. allowing departures from local thermodynamical equillibrium (LTE), a semi-empirical model of a WLF was constructed [58]. Recently, using off-limb flare observations in the SDO/HMI pseudo-continuum and non-LTE RHD approach [59], the presence of the hydrogen Paschen continuum originating in the chromosphere was reported. Other HMI off-limb sources related to a flare were found to be of two kinds (chromospheric and coronal), and interpreted as free-bound continuum (and possible line emission) and Thomson scattering, respectively [60,61]. Furthermore, the hydrogen Balmer continuum was observed during flares by IRIS [62,63,64]. Additionally, near-infrared emission at 1.56µm was detected during several X-class WLFs [65,66]. In an undisturbed solar atmosphere this emission is considered to originate at the opacity minimum located below τ 500 = 1.

Spectral lines and their inversion
It is the goal of solar spectroscopy to determine reliably various physical parameters in the solar atmosphere. Spectral profiles of polarized light, i.e., the four Stokes profiles I, Q, U, and V, contain a lot of information about the conditions in the line-forming region. In the solar photosphere, the shape of polarized light profiles of magnetically sensitive lines is typically governed by Zeeman effect. Thus observations of such lines allow us to determine also the properties of the magnetic field, a physical parameter that plays an important role in many processes of solar activity.
To obtain estimates of the physical parameters in the solar photosphere, one of the fundamental steps is to solve the radiative transfer equation (RTE) for polarized light dI dτ = K(I − S), (8) where I = [I, Q, U, V] T is the Stokes vector of polarized light, S is the source function, and K is the so-called propagation matrix. In the solar photosphere, which is sufficiently dense and collisional rates are high enough, we can assume LTE. This implies that the source function is not a source of polarized light and is used in a form S = [B ν (T), 0, 0, 0] T , where B ν represents the Planck function. Propagation matrix K contains absorption, dichroism, and dispersion coefficients that are dependent on the physical parameters of the atmosphere. The formal solution of Eq. (8) can be written in the form where I(0) is the outgoing intensity of polarized light, τ is the optical depth, and O is the evolution operator. It can be shown that the evolution operator must fulfill the following equation [67]: Eq. (10) is the reason why there is no general analytical solution of RTE for polarized light. Solution in the form of attenuation exponential is valid only in specific cases because the matrices do not commute in general. The specific case is called Milne-Eddington (ME) atmosphere and it fulfills two necessary conditions. First, the propagation matrix K is independent on optical depth, i.e., the physical parameters defining the matrix elements are constant with optical depth. Second, the source function depends linearly on optical depth. As the temperature determines the shape of the source function via the Planck function, the assumption of the linear dependence of source function on the optical depth determines the temperature stratification, which is not realistic. If more realistic and thus more complicated models of atmosphere are used, the RTE is solved numerically. For any given model atmosphere the RTE (8) is solved and the resulting intensities of polarized light are hereafter denoted as I syn . The goal is to estimate a model atmosphere that produces I syn as similar as possible to the observed intensities of polarized light I obs , i.e., to minimize the cost function where the internal sum is performed over M wavelength samples indicated by index i, the external sum is performed over individual Stokes profiles, and the value of ν corresponds to the number of degrees of freedom, that is the difference between the number of observables and the number of free parameters of the model. There are two principal methods to minimise χ 2 . First, compute I syn from a huge grid of atmospheric models and search for the best match with the I obs within the grid. Examples how to do it quickly using the method of the principal component analysis were published [68,69]. Second, use a model atmosphere and alter the physical parameters of the model until the χ 2 is minimized.
The second method is widely used for spectral lines formed in the solar photosphere, because of the LTE conditions be computed in a reasonable time even if RTE (8) is solved numerically. Apart from the LTE assumption, the inversion codes also assume that the model atmosphere is in a hydrostatic equilibrium. Although this assumption is only rarely fulfilled in solar atmosphere, it does not influence directly the resulting values of free parameters of the inversion (magnetic field strength, inclination and azimuth, line-of-sight velocity). The assumption of hydrostatic equilibrium allows us to compute the pressure from the temperature stratification directly. The pressure is further used to derive parameters like density and electron pressure that is a necessary parameter for the line synthesis in the SIR code (Stokes Inversion based on Response functions). These parameters influence the opacity of the atmosphere and thus the height scale of the obtained model atmosphere, but the Stokes profiles of photospheric lines are typically not sensitive to these physical parameters.
For huge datasets and automatic data reduction, the inversion methods usually assume Milne-Eddington atmosphere, the synthesis of Stokes profiles is computed analytically, and therefore these codes are very fast. Spectropolarimetric observations from satellites are automatically inverted using ME codes, e.g., VFISV code designed for SDO/HMI data [70] or MERLIN code1 used to Hinode/SOT data. The disadvantage of ME codes is a very simplified model atmosphere that cannot produce asymmetric Stokes profiles. However, with increasing spatial resolution of the telescopes, the asymmetries of the Stokes profiles are commonly observed and more complicated atmospheric models have to be assumed to explain them.
A very powerful method of spectral-line inversion was introduced in [71]. This inversion code SIR (Stokes Inversion based on Response functions) allows for realistic temperature stratification and also the magnetic field vector and the macroscopic line-of-sight velocity can change with height in the atmosphere. The methodology is very flexible so it allows to invert many spectral-line profiles at once, thereby improving the resulting inverted estimates of the physical parameters.
The method is based on the concept of response functions, which come from the linearisation of the RTE (8). The response function R(λ, τ), where λ is the wavelength and τ is the optical depth, describes a linear relation between the atmospheric parameters and the emergent intensity.
where δI represents the modification of the emergent Stokes spectrum I which is caused by the perturbation δx in a single physical parameter for simplicity. Vector R is a vector of response functions corresponding to the Stokes-vector components and tells us how the observed spectrum responds to the modifications of the physical conditions in the model. Response functions behave the same way as partial derivatives of the spectrum with respect to the physical quantities. Within linear approximation, response functions give the sensitivities of the emerging Stokes profiles to perturbations of plasma parameters in the given model atmosphere. Example of response function of the Stokes I profile to the temperature perturbation in a model atmosphere corresponding to the sunspot umbra is shown in Fig. 10. Here one can see the sensitivity of the pair of iron lines to temperature at different atmospheric levels.
In an iterative process the atmosphere is modified in such a way that the cost function (11) is minimized. In a linear approximation the cost function of the altered atmospheric model χ 2 (x + δx) can be approximated by the Taylor series of the cost function of the original atmospheric model χ 2 (x) Fig. 10 Response function of the Stokes I profile to the temperature perturbations for the pair of neutral Fe lines around 630 nm. It illustrates that the continuum intensity is determined by temperature around log τ = 0 and the line wings and cores are more sensitive to temperature changes at higher atmospheric layers.
where ∇ χ 2 are partial derivatives of the cost function and can be derived from the response functions, H is so-called curvature matrix containing the second partial derivatives of χ 2 , i.e., The elements of the curvature matrix are non-trivial functionals of the response functions. The inversion code SIR [71] uses the Marquardt algorithm to minimize the cost function. Following Eq. (13), the goal is to solve the equation i.e., the model atmosphere condensed in the vector x is altered in a way that its modification δx fulfills the equation Note that the change of the atmospheric model is in the code further controlled by an additional parameter, with its value based on the evolution of the cost function during the iterative process of the spectral line fitting. In each iteration the response functions need to be calculated again to ensure that the final solution in the last step fits well to the linear approximation from the previous step. The problem of radiative transfer of polarised light and the spectral line inversions is described in detail in [72]. The inversion code SIR is widely used by the community but there are other inversion codes that allow for stratification of plasma parameters with height in the atmosphere and are also based on linearisation of the RTE (8), see e.g. [73,74].

Atmosphere in the flare
The SIR code [71] is designed to invert spectral lines for situations where non-LTE effects are not important, thus its use is usually limited to the investigation of the structure of the magnetised photosphere. However, there are case studies, including the example below [75], where some information about the upper atmospheric levels may also be inferred. In the following we describe a special application of SIR code to spectropolarimetric measurements of photospheric lines obtained during a solar flare.
The Solar Optical Telescope (SOT, [76]) aboard the Hinode satellite [77] has provided observations in broad-band filters as well as spectropolarimetry of a pair of photospheric Fe I lines. Its continuum broad-band filters have been used to detect and analyse WLF emission [78]. Here, we focus on spectropolarimetric data. The spectropolarimeter attached to the SOT has been measuring the Stokes profiles of the Fe I 630.15 and 630.25 nm lines since 2006. Analyses of these data have given us great insight into the structure of the magnetic field in the solar photosphere, both in quiet-Sun and active regions. In all cases, these Fe I lines were observed in absorption on the solar disk. This is caused by a temperature decrease with height, and thus a decrease in the source function in the layers of the solar photosphere where these lines are formed. Only in the case of observations at the extreme solar limb, were these lines detected in emission [79].
In September 2017 the raster scan of Hinode spectropolarimeter (SP) crossed a WLF ribbon and captured a unique set of emission profiles that allow us to study in detail the response of the solar photosphere to an X9.3-class flare (SOL2017-09-06T11:53, see also [80]). Continuum intensity maps of Hinode rasters are shown in Fig. 11 and the blue contour indicates a region where the intensity enhancement is caused by the WLF ribbon and not by the evolution of the sunspot fine structure. Fig. 11 Continuum intensity maps reconstructed from the two Hinode raster scans. The left map was scanned between 11:57 UT and 12:04 UT and captured a WLF ribbon; the middle map was scanned between 12:19 UT and 12:42 UT. On the right is the intensity difference between these two scans. The blue contour indicates the region where we ascribe the intensity difference to the WLF. The arrow points to a pixel where we observed the Stokes profiles displayed in Figs. 12 and 14. The labels I 1 and I 2 correspond to the continuum intensities observed during the first and second Hinode/SP scan, respectively. The above mentioned code SIR was used to determine the physical properties of the solar photosphere. To account for the complex emission profiles observed in the flare ribbon, the temperature was allowed to change at several (five) optical depths τ.
As shown in Fig. 12, the inversion code explains the flare intensity difference by enhanced temperatures at all optical depths, i.e. predicts also the heating of the solar photosphere around log τ = 0, where the photospheric continuum forms. For the pixel shown in Fig. 12, the continuum enhancement of 0.3I c QS (continuum intensity of the surrounding quiet Sun) is achieved by an increase in temperature at log τ = 0 by 840 K compared to the post-WLF phase.
Such an increase in temperature at the deepest photospheric layers is unlikely for several reasons. First, the minimum of temperature stratification in any of the investigated pixels is not below log τ = −0.5. Second, the observed emission profiles are never in pure emission. There is always a slight decrease in intensity in the far wings of the Fe I 630.15 nm and 630.25 nm lines that indicates the temperature decrease above log τ = 0. Furthermore, if the temperature increase below the solar surface is real, the heating will have to be of a specific type, e.g. increase with depth because the atmospheric density significantly rises at those layers.
The assumption that the flare atmosphere is probably not altered significantly around log τ = 0 is further supported by the semiempirical flare models F1, F2, F3, F1 * [81,57] and the FLA and FLB models for WLF [58]. These coincide with the quiet-Sun model C of [82] at heights z < 0 km, i.e. at log τ > 0 [57, Fig. 1]. Also, models of continuum emission in a sunspot atmosphere heated by non-thermal electron beams [83] indicate that the temperature below z = 0 km increases not more than by 100 K for one of the strongest beam heating they used. Little or no photospheric heating was observed also in other models [84,85].
Moreover, the observations of off-limb visible continuum sources during a M7.7 and a M1.7 flare were recently analysed [59]. Using analytical formulae and detailed radiation-hydrodynamical simulations, the authors conclude that the dominant source of the off-limb visible continuum radiation is the Paschen recombination continuum and there are also smaller contributions by Thomson scattering and by the hydrogen free-free emission, see Fig. 13. Futhermore, both HMI observations and numerical simulations show, see Fig. 1 in [59] and Fig. 13, respectively, that the continuum radiation from these sources is located in the solar chromosphere, i.e. well above the line-forming region of the Fe I 630.15 nm and 630.25 nm lines. In the studied cases of M-class flares, the off-limb continuum intensity was around 0.1I c QS . Naturally, the inversion code SIR cannot account for such potential sources of chromospheric continuum emission as it is applied to a photospheric line. Instead, SIR compensates for the continuum rise by increasing the temperature around the photospheric continuum-formation layer. To investigate whether such a contribution of continuum intensity from the solar chromosphere is realistic, a set of inversions was performed on the Stokes profiles observed in the region encircled by the blue contour in Fig. 11. In order to mimic such a chromospheric optically-thin contribution, the Stokes I intensity was artificially decreased by a flat continuum, where for each pixel the observed WLF continuum was decreased to the continuum intensity observed in the post-WLF phase (the step of the decrease was 0.01I c QS ). This fine step of decreasing the I c QS was used to find the best match of temperature stratifications for the flare and post-WLF phases at each pixel, and does not necessarily mean a matching continuum intensity. Also, it is assumed that the continuum contribution from the chromosphere is unpolarised, i.e. the Paschen continuum; therefore, the Stokes Q, U, and V profiles remained the same.  [59]. Courtesy of P. Heinzel. In Fig. 14 the results of these inversions are displayed for the pixel shown in Fig. 12, where the red and blue lines are identical in these plots. It is clear that the inversion code SIR can also reliably fit Stokes profiles when the Stokes I profile is artificially decreased by a flat continuum. Examples of such decreased Stokes I profiles are shown in the left plot in Fig. 14; the corresponding temperature stratifications are shown in the right plot. The other physical parameters of the model atmosphere (such as magnetic field structure) are not affected significantly by the modification of the Stokes I profile.  Fig. 14, the best match is displayed by olive lines, and the temperature stratifications match within their uncertainties in the range of optical depths from log τ = 0.7 to −0.7. This is the range of optical depths where most of the photospheric continuum forms.
As implied before, the reduction of the Stokes I profile by a flat continuum is optimised to achieve the match of the temperature value at log τ = 0 for the flare and post-WLF phases. This does not necessarily mean that the continuum intensity would be the same for the reduced Stokes I profile and the profile observed during the post-WLF phase. In the case of the pixel shown in Fig. 14, a discrepancy of 0.02I c QS is found between the continuum intensity of the olive-coloured emission profile and the blue post-WLF profile. This is caused by a small contribution to the continuum intensity from the upper layer of the solar photosphere that is heated during the flare phase. This is clearly seen in Fig. 15, where the response functions of the two compared Stokes I profiles to the changes in their respective temperature stratifications are shown. The difference between these response functions (shown in the right panel of Fig. 15) indicates that in the case of the emission profile, the photospheric continuum also forms in higher photospheric layers, mostly between log τ = −1 and −2.
The spectral-line inversions of the photospheric line thus allowed us to infer some information about the higher levels of the atmosphere. First of all, it is clear that the flare modifies the atmosphere significantly. Second, from the presented modelling of the photosphere it turned out that there very likely is a layer in the chromosphere or above, where a spectral continuum contribution forms during the flare event.  Fig. 14 (middle panel, in blue). Their difference is shown in the right panel.

Summary
In the two examples we demonstrated that the visible-range electromagnetic radiation originating in the thin layer of the solar photosphere actually may contain also information about the adjacent layers of both the solar interior and the solar atmosphere. This information must however be sought out by using sophisticated methods. In the two examples we showed the main methodology was that of the mathematical inversion.
The framework of the two is very similar. Both methods rely on existence of functions having a meaning of Fréchet derivatives of the functional with respect to the free parameters of the model. In the case of local-helioseismology inversions these functions are termed sensitivity kernels, in the case of spectral-line inversion they are called response functions. Their meaning is very much the same. They represent a linear response of the perturbation in the free parameters of the model (flow and speed of sound in case of local helioseismology, atmospheric stratification in the case of spectral-line inversions) in the observables (travel times of the waves in the case of local helioseismology, the Stokes vector in the case of the spectral-line inversion).
Both problems end up with construction of the cost function which is minimised with respect to the free parameters of the model. The exact mathematical method how this is solved is different. Whereas the local helioseismology relies on performing the matrix inversion and thus the resulting model modifications are valid strictly only in a linear regime, in the case of spectral-line inversions the process is iterative, where the linear relation is considered in each iteration separately. Thus, in the end many linear iterative step may lead to a final change of the starting model which is far beyond the linear approximation from the initial model.
It is very difficult in both cases to ensure that the obtained solution is the correct one. In the case of inversions for local helioseismology, the solution may be influenced by a choice of the trade-off parameters. Thanks to the fact that the output of the inversion is not only the inverted estimate of the free parameter, but also the localisation (averaging) kernel and the estimate of the noise level, all these three quantities should allow for a proper interpretation of the results regardless of the choice of the trade-off parameters. A proper selection of their values is far beyond the scope of this review and belongs to the "art of helioseismology". In the case of the spectral-line inversion, the goodness of the fit is described purely by the χ 2 value, from which the uncertainties of the estimates of the free parameters may be evaluated. It is not possible to ensure that the iterative process reaches the global minimum. It is thus important to select a proper starting atmospheric model which helps the convergence process. A selection of the best starting model is very peculiar and might also be termed with a word "art" and is influence also by the experience of the user knowing the code and its behaviour.