Unfolding overlapped slitless imaging spectrometer data for extended sources

Slitless spectrometers can provide simultaneous imaging and spectral data over an extended field of view, thereby allowing rapid data acquisition for extended sources. In some instances, when the object is greatly extended or the spectral dispersion is too small, there may be locations in the focal plane where contributions from emission lines at different wavelengths contribute. It is then desirable to unfold the overlapped regions in order to isolate the contributions from the individual wavelengths. In this paper, we describe a method for such an unfolding, using an inversion technique developed for an extreme ultraviolet imaging spectrometer and coronagraph named the COronal Spectroscopic Imager in the EUV (COSIE). The COSIE spectrometer wavelength range (18.6 - 20.5 nm) contains a number of strong coronal emission lines and several density sensitive lines. We focus on optimizing the unfolding process to retrieve emission measure maps at constant temperature, maps of spectrally pure intensity in the Fe XII and Fe XIII lines and density maps based on both Fe XII and Fe XIII diagnostics.


INTRODUCTION
The ability to unfold spatial and spectral signals from an objective grating slitless spectroheliograph opens new windows into coronal spectroscopy. Such instruments allow for simultaneous high spectral resolution observations across the entire field of view with a single exposure. In the data from these instruments, sometimes called overlappograms, spatial and spectral information is convolved in the dispersive direction, making the interpretation of the data difficult.
There is a long history of objective grating spectroscopy in solar physics. The Naval Research Laboratory (NRL) overlappograms from the NRL S-082A spectroheliograph on Skylab (Tousey et al. 1973) opened up the coronal EUV window for spectroscopic analysis, and demonstrated the richness of the spectral signatures for different solar features. More recently the Res-K instrument of the Russian KRONOS-I mission (Zhitnik et al. 1998) identified 51 lines in the spectral region of 18.0 nm to 21.0 nm. Res-K was optimized to provide high separation of the spectral lines at the expense of spatial resolution in the dispersive direction. Their spectrograph images had a factor of 10 difference in the spatial resolution in the dispersive direction compared with the cross-dispersive direction. Kankelborg and collaborators (Kankelborg & Thomas 2001) designed, built, and flew the Multi-Order Solar EUV Spectrograph (MOSES), a novel objective grating telescope that simultaneously captures three spectral orders of the strong He II 30.4 nm line. In their design the spatial information is captured in the zero order and the spectral information in the plus and minus one orders. Doppler shifts are easily detected in this design as the spectral displacements for the plus and minus one orders are in opposite directions. Also, the Extreme-ultraviolet Imaging Spectrometer (EIS; Culhane et al. 2007) is a scanning slit spectrometer that is currently operating on the Hinode satellite, but has two slot positions (40 and 266 wide) that can produce overlappogram data.
Many methods of interpreting these data sets have been attempted. For example, Fox et al. (2010) performed a detailed analysis of a single explosive event observed in the MOSES data, fitting the intensity in the zero and first order and interpreting displacements in the first order as bulk flows and increased width in the first order as Doppler broadening. Courrier & Kankelborg (2018) uses Fourier Local Correlation Tracking to cross correlate the multiple image pairs observed by MOSES so that the displacements can be interpreted as velocity. Additionally, Harra et al. (2017) used intensities from an EUV imager to predict the spatial distribution of the emission in the EIS slot data so that additional displacement in the dispersive direction could be interpreted as a bulk flows or non-thermal velocities during the early stages of a flare eruption.
A new instrument that makes use of objective grating spectroscopy is currently being proposed as a NASA Mission of Opportunity. It is called the "COronal Spectroscopic Imager in the EUV: COSIE". COSIE is a compact instrument that combines a wide field broadband EUV imager with an objective grating imaging spectrograph. COSIE is optimized for high throughput spatial imaging out to 3R and high throughput spectroscopy. COSIE data will capture global evolution and identify transient events that are difficult to capture with slit spectrographs. The COSIE wavelength range is similar to Res-K (18.6-20.5 nm), but for COSIE there is only a factor of three difference in spatial resolution between the spatial and dispersive directions (3.1"/pixel vs. 9.3"/pixel).
In this paper we apply unfolding methods developed for the MUlti-slit Solar Explorer (MUSE) mission (Cheung et al. 2019 in preparation) to the COSIE data sets. The success of the approach for two substantially different instrumental setups is an indication of the robustness of the underlying method. From the unfolded spectra we can measure at each pixel (with sufficient signal) the emission measure distribution (i.e. the electron temperature of the plasma), spectrally pure intensities in the strong lines in the wavelength range, the electron density using line ratios from Fe XII & XIII, and a spectrum along each line of sight. We focus on the ability to unfold the data for a quiescent Sun that includes active regions and coronal holes. We defer discussion of dynamic events and regions with strong velocities to a subsequent paper. In Section 2, we describe the COSIE instrument. In Section 3, we describe the unfolding method. We validate this method using a 3D magnetohydrodynamic simulation in Section 4. In Section 5, we demonstrate this method using a data set derived from EUV images. In Section 6, we provide our conclusions and discuss how this technique can also be applied to other instruments and data sets.

COSIE DESCRIPTION
The COSIE optical system consists of a planar feed optic, spherical focus mirror, and 2k x 2k backside thinned CCD detector. Light at a steep incident angle is collected by the feed optic, directed to the focus mirror, and focused onto the detector through a hole in the feed optic. The conversion from coronagraph to spectrograph is performed by flipping the feed optic, which has a mirror on one side and a diffraction grating on the other. Figure 1 shows the light paths for the coronagraph and spectrograph channels. The passband of the instrument, defined by the reflectances of the optical surfaces and the transmissions of the filters, is nominally 18.6-20.5 nm. The off-disk coronagraph sensitivity is hundreds of times larger than the Geostationary Operational Environmental Satellite (GOES) Solar UltraViolet Imager (SUVI) and Solar Dynamics Observatory (SDO) Atmospheric Imaging Assembly (AIA) 19.3 nm channels . To simultaneously image both the extended corona and the disk, a partially absorbing filter is placed in the focal plane to effectively reduce the on-disk emission in the EUV by ≈200 times, allowing for 1 s exposures that include both the on and off disk coronal features. Taking into account the grating efficiency, the intensities of the individual spectral lines and the area of the grating, plus the lack of an absorbing disk in the overlappogram image, the expected exposure time for the spectrograph is also on the order of 1 s. The effective areas of the coronagraph (including the absorbing filter) and spectrograph are given in Figure 2. In the spectrograph, the spectral dispersion is 9.3 × 10 −4 nm/pixel and the spatial pixel size is 9.3 and 3.1 in the dispersive and cross-dispersive dimensions, respectively. In the coronagraph, the spatial resolution is 3.1 with a field of view of 6.6 × 6.6 R • .  Examples of the COSIE-C and COSIE-S data products are shown in Figure 3. The N-S axis of the Sun will be oriented along the dispersion direction in COSIE-S in order to reduce overlap from multiple active regions if there are several on the disk. The field of view extends out to 3R and we expect there to be significant signal in the outer corona in the EUV (see Del Zanna et al. 2018 for a detailed discussion.) In this paper, we focus on the inner corona where we expect the spectroheliogram signal to be strong. Table 1 gives the strongest lines in the COSIE-S wavelength range for each species, the temperature of maximum emissivity, and the expected signal in the COSIE-S spectroheliogram in photons s −1 line −1 3.1 pixel −1 for three representative cases: the quiet Sun, an active region and a flare. To obtain the line intensities we used three corresponding emission measure files as available in the CHIANTI v.8 (Del Zanna et al. 2015) database, noting that such estimates are approximate. The strongest and brightest lines are Fe XII 19.5119 nm and Fe XIII 20.2044 nm, but there are lines from all Fe species from VIII-XIII in the COSIE-S wavelength range. These provide the basis for the expected temperature sensitivity of COSIE (primarily 5.65 ≤ Log T ≤ 6.25). Outside of this temperature range on the low end is the O V 19.2906 nm line formed at Log T = 5.35. Additionally, there are several weaker Ca lines that can provide temperature information from 6.55 ≤ Log T ≤ 6.75 for active regions. The Ca XVII 19.28 and Fe XXIV 19.204 nm resonance lines, the hottest in the band, become very bright during solar flares and provide information on hotter plasma. Note that the CHIANTI flare emission measure was obtained from a relatively large solar flare, a GOES class M2, during peak emission. For such large flares, short exposure times would be required to avoid saturation. This wavelength range also includes several density sensitive lines from Fe XII and Fe XIII; we include two of these in Table 1. See Young et al. (2007) and the review of Del Zanna & Mason (2018) for additional spectral lines and diagnostics available in this wavelength range.

UNFOLDING METHOD
To invert the spectrometer and coronagraph data, we follow the spectral decomposition method described in the companion paper by Cheung et al. (2019). Their paper describes a general framework for performing spectral decomposition and inversion on single slit (e.g. Hinode/EIS), multi-slit (e.g. the proposed MUSE mission), and instruments like COSIE using a sparse inversion technique similar to Cheung et al. (2015). We first cast the problem as a set of linear equations, namely where y obs is an array that contains the COSIE S+C observational data, x is an array of emission measures and M is a matrix that describes how the emission measure maps into the detector for both the COSIE S+C channels. We describe M for COSIE in Appendix A. When Cheung et al. (2015) applied a sparse inversion method to AIA data, the emission measure distribution was only a function of temperature and the data matrix was the intensity in each AIA channel in a single pixel. The returned emission measure distribution represented the emission measure along a single line of sight. For COSIE-S, however, the emission measure along a single line of sight in COSIE-C maps onto multiple detector pixels in the spectral direction. We treat each CCD row (along the dispersion direction) as an independent inversion problem. Hence, the emission measure distribution, x, must at least be a distribution of both temperature and lines of sight that contribute to that row of COSIE-S data in the spectral direction. We solve for the emission measure distribution as a function of temperature (and perhaps other parameters) for all lines of sight that contribute to a single row of COSIE S+C data simultaneously. The COSIE-S channel has density sensitive spectral lines in the wavelength range, particularly from Fe XII and Fe XIII, and the COSIE resolution will be sensitive to strong (> 50 km s−1) bulk flows. Hence, the emission measure distribution as a function of density and velocity can also be considered. a Density-sensitive line NOTE-The final three columns give the signal in the COSIE-S channel for three standard Chianti differential emission measures assuming a density of 10 9 cm −3 in ph s −1 line −1 3.1 pixel −1 .
After establishing M , we use the LASSOLARS routine to find the best solution for the emission measure distribution for a given row of COSIE S+C data. It is a Least Angle Regression (LARS, Efron et al. 2004) implementation of the LASSO selection method (Tibshirani 1996). The routine is available in the Python scikit-learn package (Pedregosa et al. 2011), we call it through an IDL-to-Python bridge. The underlying algorithm performs L1 regularization, i.e. it looks for a solution x # such that where ||y obs − M x|| 2 2 denotes the squared L2 norm of (y obs − M x), this is a standard least squares expression. ||x|| 1 is the L1 norm of x and the penalty that is applied to the solution. α is a hyperparameter that controls the degree of the penalty. In the case of α = 0, the solution will be a standard least-squares fit. For α > 0, the L1 penalty term in Equation 2 will get bigger the more different emission measures are required for the solution. In other words, it encourages sparse solutions. As negative emission measure solutions are not physical, we only allow positive solutions.
To validate the approach and determine the optimal resolutions and ranges for the inversion, we apply this method to simulated COSIE data sets. Unfortunately, there is not a single data set available that can be used to fully explore the all parameters. First we apply this method to data derived from a magnetohydrodynamic (MHD) model of the Sun; this is discussed in Section 4. For the model, the temperature and density distribution are known along every line of sight. Using this simulation, we determine the optimal spatial and temperature resolution of the inversion and demonstrate the method of determining the densities from the inverted line ratios. The MHD model has a limited temperature range of plasma. To explore how to incorporate different temperature ranges, we also apply this method to data derived from a full Sun emission measure calculation from AIA; this is discussed in Section 5. For the AIA model, the temperature distribution is known for every line of sight and there is emission at a broader range of temperatures than in the MHD model, but there is no density information. We use the optimized spatial and temperature resolution derived in Section 4 and explore how using different temperature ranges in the inversion alters the results.
One issue in solving the set of linear equations in Equation 1 comes from redundant rows in the matrix M , meaning when emission measure with different temperatures, densities, or line-of-sight (LOS) positions produce the same signature in the COSIE instrument. For instance, the COSIE-S has a nominal spatial resolution of 9.3 in the spectral direction, though the thermal width of the spectral lines can degrade the spatial resolution even further. If we define, then, two matrix rows for lines of sight that are only 1 apart, the resulting emission measure would produce essentially the same signal in COSIE-S. Similarly, defining a row of M for a temperature or density where COSIE has little sensitivity returns no additional information and slows down the process for solving Equation 1. The first step, then, is to determine the appropriate ranges and resolutions of the lines of sight, temperatures, and densities.
We determine these best parameters piecemeal, meaning we first consider the best spatial and temperature resolution, then include density for those values only. There are other parameters that can impact how well the set of equations can be solved that are beyond the inherent limitations of the instrument, such as the constant density or pressure we use if we are not solving for density or the elemental abundances in the emitting plasma. Below we make several different assumptions with regards to the pressure and density and defer discussion of the potential impact of the abundances to Section 6.
In this section, we use a three-dimensional MHD model of the solar atmosphere, developed by Predictive Science, Inc and described briefly below. The model solution has temperature, plasma density, magnetic field strength and velocity defined at every point in the volume around the Sun. None of the velocities are large enough to be resolved by COSIE-S, so for now we ignore the potential impact of the velocity on our inversion. We revisit this choice in Section 6.

Description of the Model
To ensure reasonably realistic values and spatial variation of temperature and density in the solar corona, we use a highresolution calculation by the 3D Magnetohydrodynamic Algorithm outside a Sphere (MAS) code (e.g. Mikić et al. 1999;Lionello et al. 2009;Downs et al. 2013;Caplan et al. 2017), which was used to predict the structure of the global corona during the 21 August 2017 total solar eclipse. Described in detail by Mikić et al. (2018), this calculation employed high-fidelity magnetic field observations at the inner boundary, a new Wave-Turbulence-Driven (WTD) coronal heating model (Downs et al. 2016), and a method to energize large-scale magnetic flux-systems in the low corona. Forward modeled observables, including SDO/AIA EUV images, temperature maps from DEM inversions, and broadband visible light images, compared favorably with observations, making this an ideal model to use here. The minimum and maximum temperatures of the simulation range from 0.01 to 3 MK. However, the transition region is artificially broadened to resolve the self-regulation of mass and energy in the low corona (T c = 0.35 MK, see Lionello et al. 2009;Mikić et al. 2013), and we only use temperatures above 0.4 MK in this analysis.
Based on the COSIE-C resolution and FOV, we first define a grid of lines of sight in a square that is ± 3 solar radii from sun center at a resolution of 3.1 . We then extract the emission measure along each line of sight as a function of both density and temperature. We fold this emission measure distribution through the COSIE response matrix and generate the simulated COSIE S+C detector images row by row. Recall that along a CCD row in the spectral dispersion direction, COSIE-C has a spatial resolution of 3.1 per pixel and COSIE-S has a spatial resolution of 9.3 per pixel.
The nominal COSIE exposure time will be 1 second, so we multiply by this exposure time and then get photons pixel −1 . We add Poisson noise to each pixel and then average 20 noisy frames (approximately one minute of observations) together to mimic the expected data. Figure 4 shows these images for the central portion of the detector.

4.2.
Determining the optimal spatial and temperature resolution First, we consider only an inversion to determine the temperature distribution of the emission measure. We calculate M for constant pressures of 10 15 and 10 16 K cm −3 and constant densities of 10 8 and 10 9 cm −3 . As input, we use the COSIE data simulated from Predictive Science Model (see Figure 4). Note that this data includes density dependence in spectral lines even though we ignore the density dependence in this initial inversion.
We perform inversions with a temperature resolution of ∆ Log T of 0.1 and 0.2. The temperature range is limited to 5.8 < Log T < 6.4 for all of the inversions. We perform the inversions with three different spatial resolutions, ∆s of 9.3 , 18.6 , and 27.9 . For all of the inversions we limit the contributing FOV to ±1.2 solar radii. This implies that the code only has the option to put emission measure in spatial bins that are ∆s wide that extend to ±1.2R in the spectral (N-S) direction. The inversion code is run on each row of data independently so the final emission measure map will have a resolution of ∆s×3.1 . Also, there is no limit on the spatial rows that can be calculated, meaning the inversion can be run on rows at distances in the E-W direction larger than 1.2R if there is adequate signal at those distances. In this test case, we compute the inversion for 1000 rows of the CCD, which is equivalent to ±1.6R in the solar E-W direction. A description of the parameters used in this initial inversions and a summary of the results are given in Table 2. For each set of parameters, we predict the inverted COSIE-S and -C data. We calculate the reduced χ 2 by comparing the original full resolution COSIE-S data with the inverted COSIE-S data. This is also given in Table 2. Note that the number of degrees of freedom (DoF) are different for each row of Table 2. The larger the DoF, the smaller the normalization factor when calculating the reduced χ 2 . For instance, the ratio of the normalization factor between T15 (with 9.3 spatial resolution) and T16 (with 18.6 spatial resolution) is a factor of 3.8, meaning if the inverted data was, in all other ways, equivalent between the two, the reduced χ 2 for T15 would be 3.8 times the reduced χ 2 for T16. The difference in the χ 2 values between these two inversions is roughly a factor of 40, indicating that the inversion itself is worse in the T15 case.
The lowest values of χ 2 are associated with inversions completed with a constant density of 10 8 cm −3 (see runs T12 -T17). This likely reflects that the densities in the model are close to 10 8 cm −3 , particularly at the temperatures where there are the density sensitive lines in the COSIE wavelength range. When comparing these 6 runs, the ones with a spatial resolution of 9.3 (T12 and T15) have a higher χ 2 . For this reason, we discard this resolution and focus on the 18.6 and 27.9 resolutions (T13, T14, T16, T17). The χ 2 for these four inversions are essentially identical and ∼ 1. In the interest of maintaining the highest spatial and temperature resolution possible, we choose to continue with a temperature resolution of ∆ Log T = 0.1 and a spatial resolution of 18.6 .
Note these optimal resolutions are highly dependent on the COSIE instrument design. Nominally COSIE-S has 9.3 spatial resolution in the spectral direction, but because spectral lines are thermally broadened, this degrades the spatial resolution in the spectral direction further. The COSIE wavelength range contains spectral lines from Fe VIII -XIII, which provides excellent temperature discrimination in this temperature range.

Including density in the inversion
Next, we include density in the inversion, but we do not allow density to be a free parameter for all lines of sight or temperature bins. Instead we allow density to be a free parameter only for lines of sight that have greater than a specific signal in the coronagraph. We investigate how changing this cutoff impacts the inversion. Along all other lines of sight, where the coronagraph intensity is less than this cut off, we use the constant density assumption with Log n = 10 8 cm −3 . We also apply a similar criterion for temperature. We only allow for density to be a free parameter for the 6.1 ≤ Log T ≤ 6.3 temperature bins. For all other temperature bins, we use the constant density assumption. The results of the parameter study are summarized in Table 3.
Ideally, we would use the solution associated with the fewest restrictions, meaning the lowest signal in the coronagraph or Run D0 in Table 3. However, the χ 2 associated with the full Sun inversion is high (12.4). This is because for some rows of the inversion, we do not find an acceptable solution with this signal cutoff. These failed rows dominate the χ 2 . Fortunately, for those rows, we can simply use the solution from a different run that finds an acceptable solution. Hence we combine the inversions from all the runs into a final solution by evaluating each row of the inversion individually.
To explain, we show the χ 2 associated with three individual rows of the inversion in Figure 5. The Run Number plotted on the x-axis corresponds to the Run Number given in Table 3. The horizontal dashed line shows the minimum χ 2 for all runs for that specific row times 1.5. We assume any solution that falls below this χ 2 value is acceptable. We select the solution with the most free parameters (lowest run number) that meet this criterion for that row and store the emission measure distribution as a function of line of sight, temperature and density for that row in a master array. For the example row shown in the top plot, there is a high χ 2 for Run D0, but a low χ 2 for Run D1. For this row in the combined solution, we use the solution from D1. For the middle example row, all the runs have the same χ 2 so we use the solution from D0. For the bottom example row, the D0 solution has the lowest χ 2 , so we use it in the combined solution.
In this way, row by row, we build up the best estimate of the emission measure distribution for the entire field of view. The final column of Table 3 gives the number of rows of data that come from each run number. The majority or rows come from Run D0 and D1. Note the combined solution has a normalized χ 2 of 0.8. The resulting best spectrometer and coronagraph image associated with the combined data set is shown in the top panels of Figure 6. The bottom panels show a difference image between these data and the input data from the simulations shown in Figure 4.

Comparing true and inverted data
In the above subsections, we describe selecting the best parameters for the inversion. We made the selection of the best parameters based only on comparing the input and inverted spectrometer data. This is identical to how we would treat real observations as well, we would only have access to the observations to perform and evaluate the inversions. In this subsection, NOTE-All calculations are made for a spatial range of ± 1.2 solar radii, a LOS resolution of 18.6 , a temperature range of 5.8 ≤ Log T ≤ 6.4, and a temperature resolution of ∆ Log T = 0.1. The density is only allowed to vary in LOS positions where the signal in COSIE-C is greater than the value in the second column and in the temperature bins 6.1 ≤ Log T ≤ 6.3. For all other LOS positions and temperature bins, we assume a constant density at 10 8 cm −3 . The final column gives the number of rows from each of the individual runs that go into the combined solution. The final row is the χ 2 associated with a combined data set.
we compare the resulting temperature-emission measure maps, spectrally pure intensities, density maps, and spectra with those of the truth data. Figure 7 shows the true emission measure map as a function of temperature from the Predictive Science model in the first and third columns and the inverted emission measure map in the second and fourth columns. Agreement is particularly good at temperatures that are well covered by strong lines given in Table 1.
Next we calculate the spectrally pure line intensities in the strong Fe XII and XIII lines given in Table 1, including two density sensitive lines. These comparisons are shown in Figure 8. The images show the intensity maps for the true and inverted spectral lines. The line plots show histograms of percentage error for all the pixels where more than 30 photons s −1 pixel −1 are expected. The average and standard deviation of the percentage errors are given in the histogram plots. We calculate the standard deviation of the percentage error and find that for the Fe XII 19.5 nm line, the standard deviation is 15%, for the Fe XII 18.6 nm line, the standard deviation is 35%. For the Fe XIII 20.2 nm line, the standard deviation is 21%, and for the Fe XIII 20.3 nm line, the standard deviation is 30%.
We use the Fe XII and XIII line ratios to calculate the densities. We use the intensities from the true ratios and the inverted ratios. Full sun maps of the true and inverted ratios and the densities derived from them are shown in Figure 9. In these maps, we have masked the ratios and the densities where the intensity in the density sensitive line (Fe XII 18.6 nm or Fe XIII 20.3 nm) is less than 10 photons s −1 line −1 .

[Figures with different mask levels are available in the on-line version of this article.]
In Figures 11 and 12, we show the ratios and densities in the area around the on-disk active region. In these images, we applied a mask of 1 photon s −1 line −1 in the density sensitive lines. In some pixels at the edges of the active region, the ratio and density in the inverted data differ significantly from the ratio and density of the true data. In these regions, the line intensity is small. The plots on the right hand side of the figures show the error of the log of the density as a function of the intensity in the density sensitive line and the cumulative distribution of the error in the log density for different values of intensity. We show that the error depends on the intensity in the density sensitive line, but in general less than 0.2.
Finally, we extract the full spectra along a single line of sight and compare the true to the inverted spectra. A comparison of an active region, quiet sun, and limb spectra is shown in Figure 13.

APPLYING THE UNFOLDING METHOD TO AN AIA DATA SET
In the previous section, we determined the best parameters for the inversion using an MHD model. Due to the temperature limitations of the model, we were unable to evaluate the impact of having broader range of temperatures in the solar emitting  Table 3 for three example rows of the inversion. The horizontal dashed line shows 1.5 times the minimum χ 2 . We assume any value of χ 2 less than this value is acceptable and choose acceptable solution with the most free parameters (the lowest run value) for that row. plasma would have on the inversion. In this section, we apply the unfolding method to COSIE data simulated from a full-Sun emission map derived from AIA data that spans a larger range of temperatures. We focus on how changing the range of temperatures of the inversion impacts the results.

A description of the data
We prepared a full sun emission measure distribution as a function of position and over the range log T = 4.5 − 7.5 [EMD(x, y, T )]. We started with publicly available processed AIA observations ("Level-1 data") of the Sun on 2015-Dec-28 around 13:15 UTC. To minimize the effect of uncertainties in the solar coronal relative abundances (see e.g. O'Dwyer et al. 2010;Del Zanna et al. 2011), we restricted the dataset to the six EUV channels that are dominated by Fe lines (9.4 nm, 13.1 nm, 17.1 nm, 19.3 nm, 21.1 nm, and 33.5 nm). To reduce the number of pixels to solve, and to increase the signal-to-noise ratios, we rebinned the data to a platescale of 4.8 arcseconds. The data were then deconvolved with the standard point spread functions matched to the level of resolution.
For each pixel, we generated a set of EMDs of different temperature combinations, using the AIA effective areas distributed through SolarSoft together with a CHIANTI atomic model with a constant pressure of 10 15 cm −3 K −1 and the Feldman (1992) coronal abundances. For many pixels, we were able to generate a set of EMDs that perfectly reconstructed the AIA data values. Where perfect solutions were not possible (due to errors in the measurements, instrument model, and/or atomic model), we generated sets of EMDs that reconstructed the AIA data to within χ 2 < 2.0. To create a single representative EMD for each pixel, we eliminated members with higher emission measure weighted temperatures (i.e., < T > EM ), and then took the mean EMD of the remaining members.
At this point, we had an EMD map of the AIA observations, binned to a platescale of 4.8 arcseconds. This map was then centrally embedded into a larger array corresponding to the larger field of view of COSIE-C. The extra pixels were initially set  Figure 6. The spectrometer and coronagraph data (top panels) associated with the best inversion scaled to the 0.5 power. The difference between these data and the input data in Figure 4 are shown in the bottom panels.
to zero. However, we wished to extend the corona beyond the AIA field of view in order to test the sensitivity of COSIE. In addition, the performance of the unfolding might be affected by the overlapping effects of an extensive off-limb corona. To create an extended corona, the off-limb AIA corona between about 1.14 and 1.21 R was partitioned into 14 annuli. This radial range was chosen to reduce the predominance of low-lying bright features, as well as avoiding the vignetted corners of the AIA field of view. A line fit was made to the radial dropoff in log(EMD). The corona beyond the AIA field of view was then filled in with random samples from the annular selected region, scaled to the radial dropoff function. Because the selected annular region did not completely exclude coherent bright structures, the sampling produced values that appear discontinuous with the diffuse corona at the edge of the AIA field of view, but the levels are properly understood as sampling both diffuse and bright, structured off-limb corona. Thereby, in some statistical sense, the artificial halo represents the extension of both the diffuse corona and bright structures (e.g., helmet streamers). For the particular analyses reported in this paper, in a final step the map was rescaled to the nominal COSIE-C platescale of 3.1 arcseconds.
Unfortunately, there remained unrealistic hot components in the EMD above Log T of 6.7 where the data are poorly constrained by the AIA data. When calculating the COSIE intensities from the EMD over the entire temperature range, significant Ca XVII and Fe XXIV were present at levels that would be associated with a solar flare, instead of an active region (see expected values in Table 1). To calculate the COSIE S+C data for this inversion, then, we use only the portion of the EMD maps below Log T = 6.7. Figure 7. The true emission measure distribution in different Log T bins 5.8-6.4 is shown in the first and third columns, the inverted EM distribution in the same temperature bins is shown in the second and fourth columns.
The COSIE S+C data derived from this data set is shown in Figure 14. Because there is no density information in the emission measure maps, the COSIE data was calculated assuming a constant pressure of 10 15 cm −3 K −1 . To unfold the AIA data, we use the line of sight and temperature resolution found in Section 4, namely 18.6 and 0.1. We consider inversions at both constant pressure and constant density and ignore density in the inversion. Details of the parameter space study are given in Table 4. We first use the temperature range used in Section 4, 5.8≤ Log T ≤ 6.4. Those are runs A0-A3.   Figure 9. The full sun ratio of the Fe XII and XIII lines from truth data and from inverted data, as well as the density determined from the ratio. A mask has been applied to the inverted ratios, and all densities setting the values to 0 if the density sensitive line is less than 10 photons s −1 line −1 . This image is available with other mask levels electronically. The on disk active region is shown in Figures 11 and 12 Figure 10. Same as Figure 9 but with mask level of 1 photon s −1 line −1 . In the paper, this will be included in electronic version only.

Determining the best temperature range
In these runs, the lowest χ 2 is associated with a constant pressure of 10 15 cm −3 K −1 or a constant density of 10 9 cm −3 . It is unsurprising that both these solutions have low χ 2 given that the data were calculated with a constant pressure assumption at 10 15 cm −3 K −1 and most of the density sensitivity in the wavelength range is at Log T = 6.2, which would be consistent with a constant density of Log n = 8.8.
Next, we run the inversion over a larger temperature range for the constant pressure of 10 15 cm −3 K −1 . The parameters used in the inversion and the χ 2 of the solutions are given in Table 4 as Runs A4-A7, with the temperature ranges considered in the second column. First we consider extending the temperature range to lower temperatures (Run A4 and A5). Recall that the COSIE wavelength range includes an O V and O VI line formed at Log T 5.35 and 5.45, respectively (see Table 1), so we first expand the temperature range down to Log T = 5.3 (Run A4). However the count rates in the O lines are expected to be weak  Figure 11. Fe XII active region density map for the on disk active region with 1 photon s −1 line −1 mask. The true ratio and density is shown in the top panels, the inverted are shown in the bottom panels. The two plots on the right compare the true and inverted densities. The top plot shows the error in the log of the density as a function of the intensity in the Fe XII 18.6 nm line. The bottom plot shows the cumulative distribution of the errors in the log of the density. The red curve is all pixels with intensity larger than 5 photon s −1 line −1 , the green is 40 photons s −1 line −1 , and the blue 100 photons s −1 line −1 in the density sensitive line. except in a solar flare and there are no additional diagnostics between the O lines and the Fe VIII line formed at Log T = 5.65. In Run A5, we expand the minimum temperature range to Log T = 5.6, which would include the temperature of peak emissivity for the stronger Fe VIII spectral line. Next we increase the maximum temperature considered in the inversion. Again, there are few spectral lines in the COSIE wavelength range that can constrain the emission measure distribution above 6.3. The Ar XIV and Ca XIV, XV and XVII lines are expected to be weak. In Runs A6-A7, we increase the maximum temperature to Log T = 6.6 and 6.8, respectively. AR QS Limb Figure 13. An example of active region, quiet sun, and limb spectra. Final article will only include active region, the other two will be available on-line only.
Our study finds that increasing the temperature range does not improve the normalized χ 2 . This could be due to two reasons. Because there are more free parameters, the normalization factor for the χ 2 gets smaller. Also there could be rows that do not converge to acceptable solutions. Regardless, it does not appear that increasing the temperature range improves the agreement with the data. We proceed, then, with the same temperature range used in Section 4. Figure 15 shows the inverted spectrometer and coronagraph images (top panels) and the difference between the inverted and true data shown in Figure 14 in the bottom panels for Run A0 (temperature range of 5.8≤ Log T ≤ 6.4). Note that the truth  data includes emission measure at higher and lower temperatures than considered in the inversion. Spectral lines emitted at those higher or lower temperatures would not be present in the inverted data. Finally, we compare the truth and inverted emission measure maps in Figure 16 and Fe XII and XIII intensities in Figure 17.

DISCUSSION AND CONCLUSIONS
In this paper, we have demonstrated an unfolding technique for data acquired with a slitless spectrometer and imager. We have used simulated data from the proposed COSIE instrument to optimize this technique for emission measure maps at constant temperature, maps of spectrally pure intensity in the Fe XII and Fe XIII lines and density maps based on both Fe XII and Fe XIII diagnostics. For this instrument, we found that we could invert the data with a spatial resolution in the dispersive direction of 18.6 (two times worse than the nominal spatial resolution of the spectrometer), while maintaining the 3.1 resolution in the cross-dispersive direction. The optimal temperature resolution was found to be ∆ Log T = 0.1 over a temperature range of 5.8 ≤ Log T ≤ 6.4 for a quiescent, non-flaring Sun. These parameters are closely coupled with the instrument design. One can imagine a different design that would have better or worse spatial resolution, and, if using different EUV passbands, would have sensitivity to different temperature ranges.
The forward and inversion modelling we have used for the MHD model and the AIA dataset has been very useful to test the methods but is far from the real case. To further test and refine the modelling, we plan to work on real spectra obtained from Hinode EIS. Regarding the present models, they are largely independent of the quality of the underlying atomic data. The reliability of the present modelling for real COSIE-S data will instead of course depend not just on the accuracy but also on the completeness of the atomic data. Over the past 10 years, a series of detailed papers (see the references in Del Zanna & Mason 2018) have shown new atomic data calculations and new spectral lines identifications. These data have been benchmarked against the high-resolution Hinode EIS spectra, which observed the COSIE-S wavelength range. This implies that for the COSIE wavelength range, the atomic data, as made available with CHIANTI version 8 (Del Zanna et al. 2015), are fairly complete and very accurate. In particular, the Fe XII and Fe XIII density diagnostics available to COSIE-S are excellent ones. We are therefore confident that the present modelling will be able to provide reliable information on temperatures and densities across the whole Sun, on-disk and off-limb with unprecedented temporal cadence. The benchmark of the atomic data against the high-quality Hinode EIS spectra has also indicated that several transitions, even at such high resolution, are blended in very different ways, depending on what is observed. However, in most cases there is sufficient information in these wavelengths to deblend the lines. UNFOLDING IMAGING SPECTROMETER DATA Figure 16. The true emission measure distribution in different Log T bins 5.8-6.4 is shown in the first and third columns, the inverted EM distribution in the same temperature bins is shown in the second and fourth columns.
As all the strongest COSIE-S lines for any solar conditions (e.g. quiet Sun, coronal holes, active regions, bright points, flares) are from Fe, the present modelling (together with the derived temperatures and densities) is largely independent of the choice of chemical abundances. However, we note that the Fe abundance does vary from solar region to region, so derived quantities such as emission measures should be treated with caution within any science analysis. As reviewed in Del Zanna & Mason (2018), there is now considerable evidence that in the cores of active regions the Fe abundance is about a factor of 3.2 higher Figure 17. A comparison of the true and predicted Fe XII (top) and Fe XIII (bottom) lines. Intensity maps are scaled to the 0.5 power. The histograms reflect the percentage errors for all pixels with greater than 30 photons s −1 line −1 . The average and standard deviation of the percentage error is given in each line plot. than its photospheric value. On the other hand, active region loops of about 1 MK have a range of values, while Fe has nearly photospheric abundances in coronal holes and most likely also in the quiet solar corona.
In this paper, we have focused on a quiescent, non-flaring Sun. COSIE is not sensitive to the magnitude of the velocities in the MHD simulation (< 50 km s −1 ) and there is of course no velocity information in the AIA dataset. In our next paper, we will use an MHD simulation of a CME eruption with much larger velocities to investigate the sensitivity of COSIE in the velocity parameter space.
One of the key aspects of the success of this inversion method is that we are able to couple the spectrometer data with the spectrally-integrated image data. The image data is able to constrain the spatial distribution of the emission, while the spectrometer data constrained the temperature and density distribution of the emission. Without the image data, we would have been far less successful.
Finally, we plan on applying this technique to other modern data sets that include data from slitless spectrometers, such as MOSES (Kankelborg & Thomas 2001;Fox et al. 2010). Applying it to other data sets implies defining M for that instrument and performing a similar parameter space and sensitivity study that is included in this paper for COSIE. For instance, MOSES is tuned to observe the He II 30.4 nm line, with contributions from a few higher temperature lines in the passband. In that case, we would expect to not be able to constrain the emission measure as a function of temperature, but instead focus on the velocity distribution of the emission measure.

APPENDIX A. DEFINING M FOR COSIE
M is the matrix that maps the emission measure (EM = n 2 dz) along a specific line-of-sight (LOS) to the Sun into detector pixels. In the COSIE spectroheliogram, emission measure along a single LOS maps into multiple pixels across the detector, while for the coronagraph, emission measure along a single LOS maps into a single pixel. In this section we describe how we define and calculate M .
The COSIE detector has 2k detector pixels, n det , across a row, so y obs is then a [2 * n det ] vector where the first n det is the spectrometer data and the second n det is the coronagraph data. The emission measure matrix, x, must be defined at whatever temperature, density, velocity, and spatial locations that contribute to the spectrometer and coronagraph data; we currently call the total number of free parameters in emission measure n em and revisit shortly how these values are determined. Finally, the matrix M is [n em × 2 * n det ], where M ij describes how the emission measure with a specific line of sight, temperature, density and velocity, EM j , maps into detector pixel i.
Each row of M is the thermally-broadened isothermal, isodense spectrum generated with spectral line emissivities from CHI-ANTI version 8 Del Zanna et al. (2015) and folded with the COSIE-S+C effective areas and mapped to the appropriate detector positions for line of sight location. Figure 18 shows rows of M for several different conditions. The top panel shows how an emission measure of 10 27 cm −5 from a LOS to sun center with Log T = 6.2 and log n = 9.0 maps into the detector for the spectrometer (left) and coronagraph (right). The expected intensity as a function of detector position is given in units of photons s −1 pixel −1 . For the spectrometer, the wavelength array on the x-axis corresponds to the Sun center location. For the spectrometer, the response is a spectrum that contains several spectral lines, the strongest line is the Fe XII line is at 19.5 nm. For the coronagraph, the signal is confined to a single coronagraph pixel. These two responses together (S+C) constitutes one row of M . Another row of M might describe how EM from a LOS along the east limb with the same temperature and density maps into the detector, this is shown in the middle panels of Figure 18. It is essentially the same spectrum as the top panel shifted to the left. Another row of M is how EM from Sun center with Log T = 5.8 and Log n = 8.0 maps into the detector, this is shown at the bottom panels of Figure 18. Since this spectrum is at a different temperature, a different set of spectral lines is predicted.