Efficient and Automated Inversions of Magnetically-Sensitive Forbidden Coronal Lines: CLEDB -- The Coronal Line Emission DataBase Magnetic Field Inversion Algorithm

We present CLEDB, a"single point inversion"algorithm for inferring magnetic parameters using I,Q,U, and V Stokes parameters of forbidden magnetic dipole lines formed in the solar corona. We select lines of interest and construct databases of Stokes parameters for combinations of plasma thermal and magnetic configurations. The size and complexity of such databases are drastically reduced by taking advantage of symmetries. Using wavelength-integrated line profiles, each of which might be decomposed beforehand into several line-of-sight components, we search for nearest matches to observed Stokes parameters computed for the elongation corresponding to the observed region. The method is intended to be applied to two or more lines observed simultaneously. The solutions initially yield magnetic orientation, thermal properties, and the spatial position of the emitting plasma in three dimensions. Multiple possible solutions for each observation are returned, including irreducible degeneracies, where usually sets of two solutions are compatible with the two input I,Q,U, and V measurements. In solving for the scattering geometry, this method avoids an additional degeneracy pointed out by Dima&Schad (2020). The magnetic field strength is separately derived from the simple ratio of observed to database Stokes V data, after the thermal properties and scattering geometry solutions have been determined.


Introduction
Our need to measure the magnetic field threading the solar corona has never been more urgent. Society depends on electrical infrastructure in space and on the ground to an unprecedented and ever-increasing degree. The greatest single source of electrical perturbations on the Earth is the Sun, as has been known for at least a century and a half. Variable high energy radiation, ejection of magnetized plasma, the interactions of streams in adjacent sectors of the solar wind, all these lead to potentially dangerous effects on a technologically-dependent society. These and other issues are discussed in a variety of monographs, white papers and reviews (e.g. Billings, 1966;Judge et al., 2001;Eddy, 2009;Judge, Habbal, and Landi, 2013;Casini, White, and Judge, 2017;Ji et al., 2020).
The urgency of finding a reliable method to measure coronal magnetic fields arises from the fortunate conjunction of three unique observational opportunities. The Daniel K. Inouye Solar Telescope (DKIST, formerly ATST, see Rimmele et al., 2003;Rimmele et al., 2020), the Parker Solar Probe (PSP, formerly Solar Probe Plus, see Kinnison et al., 2013) and the Solar Orbiter mission (SolO, Marsch et al., 2005;Marsden, Müller, and StCyr, 2013) are all now operational. While the PSP and SolO orbit the Sun beyond 9 solar radii (R ), sampling in-situ plasmas, neutral particles and magnetic fields, the 4 meter DKIST observatory will be able to measure components of magnetic fields at elongations y 1.5 R . Such a large aperture, coronagraphic telescope operating from the peak of Haleakala marks a huge step up from early feasibility efforts with far smaller telescopes (e.g. Evans Solar Facility, SOLARC, COMP; Lin, Penn, and Tomczyk, 2000;Lin, Kuhn, and Coulter, 2004;Tomczyk et al., 2008). We also eagerly anticipate synoptic measurements with UCOMP (Tomczyk and Landi, 2019) and the 1.5 meter aperture coronagraph (www2.hao.ucar.edu/cosmo/large-coronagraph) of the COSMO suite of instruments, currently under review by the community.
In the current work, we describe a numerical method for studying magnetic signatures imprinted in the polarized light from magnetic dipole (M1) lines emitted at visible and infrared wavelengths by the corona. These M1 lines are formed in the saturated Hanle effect regime and are optically thin across the corona. Concerns have been expressed regarding line-of-sight (LOS) confusion (e.g. Judge, Habbal, and Landi, 2013;Schad and Dima, 2020). Mathematically, null spaces exist where variations in vector magnetic fields have no effect on the emergent spectra. Contributions to the familiar observed Stokes parameters I, Q, U, and V come from different regions along the LOS.
Single-point algorithms, like the one presented here must be considered a first step until stereoscopic observations, involving spacecraft in orbits significantly away from the Earth-Sun line of the corona, become available. Alternatively the Sun's rotation might be used to try to probe the 3D coronal structure using stereoscopy (e.g. Kramar, Lin, and Tomczyk, 2016), assuming rigid coronal rotation over periods of days or longer. The corona may or may not comply with this assumption, and stationary structures which do comply may be of limited physical interest anyway.
Thus, our purpose is to present a method along with a python-based tool to allow coronal observers with DKIST and other telescope systems, to obtain a  Figure 1. Plane of sky and ecliptic plane geometry for coronal emitting structures. The blue dashed curve is the solar surface. The y-coordinate of the emitting plasma denotes the elongation. Panel (a) shows the geometry in the POS (x = 0). Points P and Q see identical photospheric radiation from the Sun centered at O. The reference direction for linear polarization in the local vertical of the Sun [l.v.s.] is assumed throughout to be along the z− axis. Panel (b) shows how points b 1 , b 2 , b 3 and b 4 along the vectors − → ob 1 , − → ob 2 , − → ob 3 , − → ob 4 experience the same value of cos 2 ϑ B , the angle between the local magnetic vector in the corona and the l.v.s.; the line joining the point to Sun center. At the angles traced along these dotted lines, and for the cones rotated about the l.v.s., solutions of the statistical equilibrium equations are the same as for the solid line, that is when the saturated Hanle regime assumption holds.
first estimate of properties of the emitting plasma including components of the vector magnetic field. Our primary simplification is to seek solutions for the emitting plasma assuming it is dominated by one location along the line-of-sight. For practical purposes, such "locations" make sense if they span LOS lengths smaller than, say, 0.1R . Naturally, without observations from a very different LOS in the solar system, the measurements represent differently-weighted averages of physical conditions along each LOS. These solutions inherently possess well-known ambiguities arising from specific symmetries associated with the line formation problem, as shown for example in Figure 1. Therefore, our inversion scheme allows one to identify, but not necessarily resolve, all ambiguities from a set of observed Stokes profiles, as revealed in Section 3. Section 4 provides a summary of the findings, and discusses multiple emission locations as suggested by multiple components in the emission lines, where solutions for each can, in principle, be obtained.

Emission Coefficients in Statistical Equilibrium
We adopt the formalism and notation of Casini and Judge (1999), that expands upon earlier work on loosely related topics (e.g. Sahal-Brechot, 1977;Landi Degl'Innocenti, Bommier, and Sahal-Brechot, 1991;Landi Degl'Innocenti, 1982). We must solve for the magnetic substate populations of the radiating ions assuming statistical equilibrium (SE). The problem is cast into the framework of spherical tensors to take advantage of geometrical symmetries (see Chapter 3 in Landi Degl' Innocenti and Landolfi, 2004). Magnetic Dipole (M1) coronal lines form under regimes where Zeeman frequency splittings are of order of the classical Larmor frequency ν L , hν L = µ 0 ·B and are far smaller than the Doppler widths ∆ν D , and where the Einstein -A coefficients A JJ0 are, in turn ν L . The first inequality permits an accurate Taylor expansion of line profiles in terms of the small quantity δ = ν L /∆ν D 1 (Casini and Judge, 1999). The second defines the "strong-field limit of the Hanle effect" in which coherences between magnetic sub-states of the decaying level are negligible in the magneticfield reference frame. From the solutions to the SE equations, the emission coefficients for the Stokes vector (S 0 , S 1 , S 2 , S 3 ) T ≡ (I, Q, U, V ) T are then (see Equations 35a-35c in Casini and Judge (1999)): where the M1 transition occurs from level with angular momentum J to J 0 , and where When integrated along a specific LOS, the expressions for the emission coefficient ε (i) i (ν,k), with units of erg cm −3 sr −1 s −1 , yield the emergent Stokes vectors from the corona. JJ0 is the usual coefficient for the frequency-integrated isotropic emission only from the line, ignoring stimulated emission, where the D JJ0 and E JJ0 coefficients are dimensionless parameters associated with the polarizability of the two atomic levels.
The superscripts on ε i are the leading orders in the Taylor expansion of the line profile with dx ∝ δ = ν L /∆ν D 1. Second order terms in δ are negligible for weak coronal fields and broad line profiles. Lastly, here it is assumed that the photospheric radiation is spectrally flat across the corona line profiles (Casini and Judge, 1999).

Physical Interpretation
These equations are readily understood physically. The leading order in the IQU Stokes signals is zero, for Stokes V it is one. IQ and U arise from a combination of thermal emission and scattering of photospheric radiation, both include the populations N J and the atomic alignment σ 2 0 (J). Both quantify local solutions to the SE equations, entirely equivalent to solving for populations of magnetic sub-states (House, 1977;Sahal-Brechot, 1977). Alignment is generated entirely by the anisotropic irradiation of ions by the underlying solar photospheric radiation. Information on the magnetic field in IQU is contained implicitly in σ 2 0 (J) and is independent of magnetic field strength, as corresponding to the mathematical statement of the strong field limit. In contrast, Stokes V for the M1 lines is formed entirely through the Zeeman effect, modified by the alignment factor (Casini and Judge, 1999). When the atomic alignment factor is zero, the expression for Stokes V reduces to the well-known "magnetograph formula" of the Zeeman effect, to first order. The leading terms for QU in the Zeeman effect are only second order in δ leading them to be considered negligible in coronal cases due to small B magnitudes. Together with the first order term in V they form the basis of most solar "vector polarimeters" (e.g. Lites, 2000).
The coefficients D JJ0 , E JJ0 are properties fixed by quantum numbers J and J 0 of the two atomic levels. f D JJ0 is fixed by J and J 0 , but E JJ0 also depends on each level's "Landé g-factor" that are used to build "effective Landé factors" of the transition,ḡ J,J0 . The Landé g-factors also depends on quantum numbers other than J, J 0 , like the mixing of atomic states and orbital and spin angular momenta. These can be measured or may be computed using an atomic structure calculation. See, for example, new calculations of special relevance to this work by Schiffmann et al. (2021).
The Taylor expansion of ε i (ν,k) with frequency has leading orders o = 1 when i = 3 and o = 0 otherwise (Casini and Judge, 1999).
The terms N J and σ 2 0 (J), the population and alignment of level with total angular momentum J, are solutions to SEs. These solutions, which are linear combinations of the populations of magnetic substates of level J (e.g., Sahal-Brechot, 1977), depend both on the scattering geometry, the magnetic unit vector b, and the plasma temperature and density. The atomic alignment σ 2 0 (J) is created by the bright, anisotropic photospheric cone of radiation seen by the coronal ions, and destroyed by collisions with plasma particles having isotropic distributions. This "atomic polarization" is modified by the magnetic field as the ion's magnetic moment precesses around the local B-field. The appearance of σ 2 0 (J) in the SE equations underlying Equations 1-3 show that linearly polarized light in the corona originates from atomic polarization, and also that the intensity and Zeeman-induced circular polarization are modified by it.

Scattering Geometry
Finally, the spherical tensors T K 0 (i,k) define the geometry of the scattering of solar radiation for Stokes component i from the coronal plasma. The tensors play no role in the SE calculations, as is readily appreciated, in that the SE states cannot depend on the observer. Figure 1(b) shows instead how the solutions depend on ϑ B , the angle between the local magnetic field and the radius vector r to the local vertical of the Sun (l.v.s).  Figure 2. A simplified view of the CLEDB module scheme. Three modules each focus on: the database generation via CLEDB BUILD; the CLEDB PREPINV data pre-processing; and the CLEDB PROC data analysis and inversion. The CLEDB BUILD module requires the execution of precompiled Fortran binaries of the CLE code due to computation speed requirements. Ideally, databases are only generated once per system based on user requirements. The other two modules are based on Python. The data analysis is split into two branches with different output products based on wether 1-line or 2-line Stokes IQUV data is ingested. An in-depth module description can be found in the documentation linked in the data availability section.

CLEDB, a Database Approach for "Single-Point
The Coronal Line Emission DataBase (CLEDB) inversion algorithm is created to harness all available information in polarization measurements of the corona to infer local plasma properties and vector magnetic fields. A non-commercial open-source python-based code package of CLEDB, designed for both personal computer jobs and SLURM (Simple Linux Utility for Resource Management) enabled research computing jobs, is freely available online. More information about the code, package, and method documentation along with persistent links are found in the data availability section. The algorithm uses the equations and framework described in Section 2 together with symmetries and line profile properties to extract magnetic and thermal information from measured Stokes parameters through a search of a database of computed Stokes parameters.
A single emission line does not contain sufficient information for a full inversion. This will become clear below, but see Plowman (2014), Dima and Schad   Figure 1 1 2 arctan(U/Q) CJ99 fig. 5 * As observed from Earth, the LOS and x-axis are almost parallel. For example an elongation y 2 + z 2 of 2R the angle between the LOS andk is only has 0.0093 radians (0.5 o ). Any errors introduced with this assumption are minor compared with the other observational and theoretical challenges presented by the problem at hand.
(2020), and Judge, Casini, and Paraschiv (2021) for detailed discussions. Therefore, the CLEDB approach is primarily designed for two or more coronal lines. A secondary code branch will be used to derive basic thermal parameters and LOS magnetic fields only, when Stokes observations of 1-line are provided instead of 2-line using analytical approximations incrementally developed by Casini and Judge (1999), Plowman (2014) and Dima and Schad (2020).
In the CLEDB 2-line configuration, solutions that are deemed a good fit, currently by using a reduced χ 2 metric, are returned along with database model magnetic, geometric and thermal parameters as acceptable solutions to the inverse problem.
The algorithm seeks thermal and magnetic conditions from a single point along the LOS. This is a gross oversimplification in general, but it is well known that coronal images frequently reveal discrete structures, such as in polar plumes or more especially in loops over magnetically active regions. These are the regions of great interest for space weather disturbances at the Earth (Ji et al., 2020). However, in cases such as the quiet Sun, the emission is distributed diffusely and our method will represent some poorly-defined average of quantities along the LOS. We explore this assumption below. In essence, we replace the integrals of equations 1-3 over the LOS with a 1-point quadrature using a length scale . For convenience, we choose = 1 and use henceforth, which is the emergent Stokes parameter of the emission line for a path length of 1 cm alongk. Even with this simplification, there is always some ambiguity in the solutions owing to inherent symmetries. Our algorithm therefore returns all such solutions deemed to be compatible with the data. Table 2. 2-line CLEDB solution output products compared with synthetic observations. The CLEDB solutions are degenerate to 180 • with respect to the LOS angle components. The CLE atmosphere parameters provide the ground-truth reference values. These are averaged along the LOS. H and D refer, respectively, to the coronal height above the limb and the LOS depth in units of R . The electron density is given in log 10 cm −3 , magnetic angles in degrees, and magnetic field components in G.
Index  Table 1 define various angles in terms of a Cartesian reference frame with its origin at the center of the Sun. The axesx,ŷ,ẑ point along the Sun center-observer line, the E-W direction and S-N direction relative to the Sun's rotational axis in the plane-of-the-sky. We adopt the reference direction for linear polarization to be along the z-axis (vertical). This corresponds to the direction of a linear polarizer measuring 1 2 (I + Q) (see p. 19 of Landi Degl' Innocenti and Landolfi, 2004).
Two unit vectorsr andb specify the direction of the center of the cone of photospheric radiation and magnetic field, and a thirdk specifies the LOS 1 .
We define two reference frames, the "solar" frame and the "observer" frame. All angles in the solar frame are specified as Greek lowercase letters. Two more angles are defined in uppercase, defined relative to the observer. Θ B is the angle between the LOS vectork andb. The angle Φ B follows from our adoption of a reference direction parallel to theẑ-axis. With this geometry, for each line with measurable Q and U . Figure 3. The scattering geometry of point P is shown in the observer's frame with projections of the magnetic field components in the same frame. The LOS through Sun center lies along unit vectork, which is parallel to the x-axis. We assume that the LOS through the corona are parallel tok. Φ B (= π − γ B in CJ99) is defined by arctanbz/by if we take the reference direction for linear polarization along the z-axis. The unit vectors of interest are marked with red arrows.

Symmetries to Minimize Numerical Work
Frequency-dependent line profiles are not required because we know a priori that, under the single-point contribution assumption, the profiles for I, Q, U are identical, namely the zeroth-order term in the Taylor expansion. The leading order in the V profile is the first order term ∝ dI/dν. Therefore we need only create a database of quantities ε (i) (ν,k) appropriately integrated over frequency, The integration for an observed set of Stokes O i follows the same formalism, when subtracting λ c continuum emission and setting any Doppler shifts to zero. The integral for V requires weights of opposite sign at either side of the line center. If two or more components are identifiable in the I(ν,k) profiles, for example by multiple fits of Gaussian profiles, the components can be extracted beforehand, and searches made for each component. Even with these simplifications, minimal implementations of a search algorithm would generate databases of impractically large sizes. A 3D Cartesian grid built around a quadrant around the solar disk (Figure 3), would demand computation of the S i parameters at each of, say, 50 × 50 × 50 "voxels". Each such voxel requires a grid of magnetic vectors B = (B x , B y , B z ) T , the LOS components of velocity field v x , temperature T , density n e , elemental abundance A, and a spectroscopic turbulence representing unresolved non-thermal motions v T . With over 10 5 voxels, the number of database entries would exceed N C ≥ 10 13 , using just 10 values for each of the magnetic and thermodynamic variables listed above. But the database size can be dramatically reduced based upon the following arguments: 1. Observations are subject to the geometrical rotation of the Q and U profiles using equations 9 and 10. All QU data can be rotated around the x-axis by the azimuth angle −α, as shown in Figure 1(a). Database searches can then be limited to those LOS within the z = 0 plane instead of the entire 3D volume; e.g. point Q is different from point P in Figure 1(a) only by the α-rotation of the Q and U Stokes profiles. Afterwards, matching magnetic vectors are simply rotated back by +α. The I and V Stokes parameters are invariant to rotations about the LOS (x-axis). 2. We need only to search along the LOS x-direction using n y separately stored database files for each observation with an observed elongation y closest to the computed CLEDB height y 0 , minimizing CPU and memory requirements. 3. We suggest adopting line pairs from a single ion, eliminating the need to account for relative abundances and differential temperatures along each LOS. However, it is possible to use different ions, even of different elements, although this is not advisable for reasons that will become clear below. (see Judge, Casini, and Paraschiv (2021) for detailed discussions.) 4. We can compute the Stokes parameters and store them for a single field strength B = |B|. We then compute the ratio between the computed and the observed values of circular polarization. This simplification results from the strong field limit of the Hanle effect. In other words, CLEDB will solve for the geometry, thermal, and magnetic orientation, and afterwards scale the magnetic field strength using Zeeman diagnostics (equation 3).
Thus, in this example, the CLEDB scheme's database will encompass N C ≈ 10 6 entries for each of the n y database computed elongations, as shown in Table 3. The numbers quoted in this example are not absolute and represent just a starting point. In CLEDB the database parameter configuration is a user editable feature when building databases within the CLEDB BUILD module. The first simplification is equivalent to a rotation of our choice of reference direction for linear polarization. The Q and U parameters fed to the search algorithm are simply Q α = Q cos 2α − U sin 2α, (9) U α = Q sin 2α + U cos 2α.
(10)  The preference for lines belonging to single ions described in Point 3 is not a serious restriction, because ions of the np 2 and np 4 iso-electronic sequences with n = 2 and n = 3, such as Fe XIII, possess two M1 lines in the 3 P ground terms whose dependencies of ε i (ν,k) on electron temperature are essentially identical, determined by collisional ionization equilibrium. The Fe XIII 1.0747 µm and 1.0798 µm line pair has served as the primary target for previous instruments (Querfeld, 1977;Tomczyk et al., 2008), and remains a prime candidate for new observations with DKIST. Point 4 entails the significant benefit of finding solutions which depend on higher signal wavelength-integrated Stokes profiles (equation 8), rather than noisier differences, of Stokes V profiles (cf. Equation 11 of Dima and Schad, 2020). We note that the accuracy of database vs. observation scaling is dependent on LOS effects that are not currently fully quantified, as can be seen in the χ 2 values of Table 2 that indicate overfitting.
The search over angles can then be further restricted. We use the ratio U α /Q α to estimate the azimuth angle Φ B modulo π/2 for every M1 line (see Figure 1). In the database we adopt grids for the magnetic field vector in spherical coordinates at the point P for angles φ and θ in Table 3. For each Φ B , the φ and θ angles are related by their definitions by: Ultimately we are left only to search a 4-dimensional discretized hyperspace for each elongation y, to identify matching values of n e , x, φ, andθ(φ) remembering that B is scaled afterwards, as discussed above. Hereθ(φ) includes only values of θ compatible with equation 11. In our Table 2 example of CLEDB sorting, we simply presort the 10 values of θ in the numerical grid that are most compatible with Equation 11. We see that solutions are degenerate in pairs of two in terms of supplementary Φ B and complementary Θ B angles. The number of presortedθ solutions is configurable via Table 3. Example of numerical discretization for each database file at elongation y 0 . quantity number range log 10 ne/n † 0 (r) (electron density) nn e = 15 −2 → +2 x-axis (LOS, units R ) nx = 100 −2.5 → 2.5 φ n φ = 180 0 → 2π θ n θ = 90 0 → π θ nθ ≈ 10 0 → π N = nn e nxn φ n θ 24.3 million N = nn e nxn φ nθ 2.7 million Size of each database file of 2 lines, each with 388 MB 4 Stokes parameters stored as 32 bit integers The N and N represent the sizes of databases as computed with either n θ or nθ. These correspond respectively to all database orientations and to the subset compatible with equation 11. Each of the two discretization options can be user-selected via CLEDB control parameters.
CLEDB controlling parameters. Interpolation is of course possible, but it is not currently implemented due to the yet unknown effects of potential uncertainties. Yet more computational savings are made noting that the electron densities n e are strong functions of r because of stratification and solar wind expansion. Thus, we can reasonably seek solutions of a fixed analytical form for n e (r) as shown in Table 3. The function n 0 (r) = 3 · 10 8 · exp − r − 1 h + 10 8 · (0.036r −3/2 + 1.55r −6 ), has r in units of R , and scale height h = 0.0718R (≡ 50 Mm), where the second term is the formula of Baumbach (Allen, 1973). The grid-sizes that we have used for testing, and we consider a reasonable starting point are given in Table 3. The resulting density is given by a smaller array of say 15 discretized values centered on the base n o electron density, which span orders of magnitude of -2 to 2 in logscale. We used the reduced χ 2 metric as a goodness of fit, with Stokes 'observations' S i taken from values on the database grid. Then we write χ 2 as the sum of where O i and σ i are for the observed Stokes I, Q, U parameters, and O 3 and σ 3 correspond to Stokes V . Here σ 2 is a variance associated with noise, not to be confused with the alignment σ 2 0 (J) which always is specified by J. The distribution of noise in O i is normal with standard deviation σ i . The rms noise is added to σ i as a function of the number of photons detected in the line. We normalize the set of 8 Stokes parameters with respect to the Stokes I parameter corresponding to the strongest line in the set, in order to bypass the need for absolute intensity calibrations. Here, d = 4 n line −1 is the number of independent data points. The number of free parameters in the model is p = 4. With d = 7 for two lines, the factor (d − p) −1 in Equation 13 is 1 3 , and the sum would be over two lines. The reasoning behind separating the first three and last Stokes parameters in Equations 13 and 14 comes from the strong-field limit of the Hanle effect. As already described, the first three Stokes parameters IQU depend only on the direction (e.g. unit vectorb), and not the magnitude B of the magnetic field. On the other hand, Stokes V parameters scale only with the magnitude B of the magnetic field. Thus, the χ 2 sorting needs to be separated into its two components, as shown in Equations 13-14. We store in the database Stokes vectors S i computed only with B = 1 G. The first 3 Stokes parameters, are determined by minimization of Equation 13 yielding acceptable values ofb, along with the smallest normed differences in integrated Stokes V , as given by a database search. Once the directionb is known, the contribution of Stokes V to χ 2 in Equation 14 is identically zero only when which is the analytical solution for B because S 3 = B · S 3 , where B = 1. Equation 15 then yields the magnetic field strength compatible with all the observed and computed Stokes parameters, without reference to the values σ 3 for each line. The value of V used for estimating B can be taken either from the strongest line or the weighted mean of a number of observed lines via a CLEDB configuration parameter. This procedure justifies argument number 4 listed above.
To sum up, the number of calculations needed becomes of the order of 10 6 when using the discretization example in Table 3, so that searches become fully tractable even on desktop computers. Figures 2 and 4 show the overview and detailed CLEDB scheme as flowcharts.

Performance
In some initial tests using Python, solutions are obtained in 0.2 sec. for the parameters listed in Table 3, using a fairly current off-the-shelf laptop like a 64-bit Macbook Pro with a 2.3 GHz Quad-Core Intel Core i7, with 16GB RAM. By compressing database files storage to 32 bit integers, we halve the disk space required, while incurring about 2 sec. of overhead each time the data are read and decompressed. There is therefore a small advantage in finding all observations matching a given database value of y 0 before searching for solutions. CLEDB implements such a pre-search in its CLEDB PREPINV module, where for any measured cluster of y-heights, CLEDB searches and selects the nearest y 0 database position. Also marked is an estimate of the counts accumulated by a CRYO-NIRSP like instrument on DKIST in 1 second over a 0.5" × 0.5" region. A brightness of 20 millionths of the solar disk brightness, over the line profile was assumed as typical of the lower corona following Judge (1998). For a 10 second integration time, CLEDB would yield just four solutions compatible with such data, when considering the above defined χ 2 limit.
Characteristics of the typical performance are shown in Figures 5 and 6, applied to the Fe XIII line pair at 1.0747 µm and 1.0798 µm. Figure 5 shows the derived physical parameters for a search of synthetic Stokes parameters drawn randomly from the database in the upper panel. The rms uncertainties assigned to the synthetic observations are for photon-counting noise associated with a total of 6 million counts in the brightest (1.0747 µm) line. The lower panel shows the corresponding differences between the observed and computed Stokes parameters for these solutions. Figure 6 shows how the number of acceptable solutions varies with the noise levels. As anticipated, sufficient counts must be accumulated to constrain the plasma and magnetic properties of coronal plasma using forbidden coronal lines. Unanticipated is the result that ≈ 10 7 counts are required to arrive at the minimally ambiguous set of solutions. There is no benefit to accumulating more counts except that the magnitude of B can be better constrained using Equation 15. Also shown are estimates of the counts that might be accumulated with a DKIST CRYO-NIRSP like instrument in 1 second for a 0.5" × 0.5" region. Assuming that the instrument can achieve photon-limited noise, a factor of 30 more counts should be easily achievable with longer integrations and spatial binning. It remains to be seen what the nature of the noise of the instrument might be to affect the estimates given here.  Figure 7. The figure shows values of χ 2 (top), the fitted value of LOS coordinate x (middle) and the electron density (bottom) matched to emergent spectra of two sources of emission in the two Fe XIII M1 emission lines. These two sources have different positions along the LOS, and densities. Thus they violate the basic single-source assumption of the algorithm. This illustrates the kind of errors made when two sources contribute to the emission from one pixel. One source is held fixed at x = −2 (large star symbol) and the other placed at ten different positions with x-coordinates between -2.0 and 0.0 R (smaller star symbols joined by the solid black line, plotted both for x and electron density as simple scalar examples). The χ 2 values increase almost monotonically with the x-coordinate of the second source. The returned x-coordinates are different from the mean source position (between x = −2 and the small starred line). As the second point is moved from -2.0 to 0.0 in x, the algorithm returns a density increasing almost monotonically, following a weighted average of the densities of the two sources.

Discussion
The CLEDB algorithm is centered on a straightforward least-squares match of observed and computed I, Q, and U Stokes parameters, which determine the magnetic field unit vectorb. This is combined with magnetic field strength B given algebraically by the ratio of observed to computed V parameters (Equation 15). The algorithm uses line profiles integrated over frequency, which may include multiple components separated perhaps using multiple Gaussian fits. An arbitrary number of two or more M1 coronal emission lines, each formed in the strong-field limit of the Hanle effect (Casini and Judge, 1999;Sahal-Brechot, 1977), can be used for a full vector solution, while a LOS magnetic approximation is available for one line. However, the physics dictates that the use of lines of the same ion minimizes potentially damaging systematic errors.
The algorithm delivers the closest solutions to those in computed databases, including all solutions acceptable with the χ 2 -statistic for each measured component. Natural symmetries imply that at least two solutions are found for each component, even in the limit of negligible noise. To achieve this limit, one test calculation ( Figure 5) required > 6 million counts integrated along the line profile. We also estimated that the CRYO-NIRSP instrument at the new DKIST observatory can achieve this with a combination of exposures as short as a few seconds, with modest spatial binning.
In Figure 7 we show the results of a numerical experiment in which we force the algorithm to return solutions from a situation from a scenario entirely incompatible with a single source. Two sources of equal intensity are placed, one at x = −2 in units of R , the other at ten points between x = −2 and 0. A total of 3 × 10 6 counts were assumed to be accumulated in Stokes I. To avoid confusion, we kept the magnetic field vector identical, seeking only to explore the ability of the algorithm to recognize through χ 2 values that there is no single match in the database. While this is a simple case, it is in one sense a "worst case" scenario in that the two sources are equally bright along the x-direction. As expected, the algorithm shows successes and failures. The solutions at x = 2 have the smallest χ 2 , which increase almost monotonically with increasing source separation. This is good news, as the algorithm not only recovers the correct solution when the sources are in the same location, but also χ 2 increases significantly when the sources are separate. Thus, the χ 2 can show that there is indeed sufficient information in the spectra in order to reveal a poor fit. The other good news is the expected increase in mean electron density as the second source approaches x = 0.
However, the middle panel shows that the x-coordinates returned do not follow anything approaching a linear trend. The line shows the position of a single source found at the same coordinates as the second source from above. If the algorithm were linear in its response to the x-coordinate, then we would expect the points plotted to follow a line starting from (-2,-2) with half the slope shown. Clearly, the algorithm is sufficiently non-linear to disallow the possibility of finding centers of emission along the LOS if two or more sources exist with the same or similar brightness. This is just as expected from the discussion in section 3.3 of Judge, Casini, and Paraschiv (2021).
We finish by making some general observations. Our earlier work (Judge, Casini, and Paraschiv, 2021) clarifies how the present algorithm resolves earlier problems by solving for the scattering geometry as well as the thermal and magnetic parameters of the emitting plasma. The companion paper of this work (Paraschiv and Judge, 2022) will focus on benchmarking CLEDB on synthetic data, while waiting for the first full Stokes coronal observations to become available.
First, these inversions are far less dependent on the signal-to-noise ratios of the very weak Zeeman-induced Stokes V profiles, a result contrasting with the earlier methods examined (Plowman, 2014;Dima and Schad, 2020). While our solutions depend linearly on the ratio of observed to computed V values (Equation 15), the earlier solutions depend on the observed differences between measured V values (see Equation 11 in Dima and Schad, 2020 and Equation 7 in Judge, Casini, and Paraschiv, 2021, which have correspondingly larger propagated uncertainties. This is good news because the V signals are small, being first order in the small parameter ν L /∆ν D . Secondly, it is clear that once applied, any user of this scheme is left to see which of the various solutions might make best sense when the pixel-to-pixel variations are taken into account, or if other constraints are available (e.g. independent knowledge of the geometry of the emitting plasma). This research area should be explored in the future, and may be ripe for application of machine-learning techniques.
Thirdly, using lines from the same ions in fact have advantages. We gain accuracy by using such ions without worrying about unknown factors such as temperatures, ionization fractions and abundances, and with this methodology we need not worry about the special degeneracies identified by Dima and Schad (2020).
Lastly, we note that because of the physical separation underlying Equations 13-14, any independent knowledge of B LOS or |B| can be easily included in a CLEDB implementation. One example might be the use of oscillation data once the density is solved for from just IQU observations, in order to determine the value of |B| from the observed oscillation phase speeds (see Tomczyk et al., 2007;Yang et al., 2020).