Level 2 (Inverted SOT-SP Data)

SOT-SP Level 2 data are the output of a spectral-line inversion scheme. The Milne-Eddington gRid Linear Inversion Network (MERLIN) is a Milne-Eddington inversion code that is based on the least-squares fitting of the observed Stokes profiles using the Levenberg-Marquardt algorithm. MERLIN can use one or multiple spectral lines to retrieve the magnetic field vector, the line-of-sight velocity, the source function, the Doppler broadening as well as the contribution of macroturbulence and the stray-light factor. The MERLIN source code is publicly available from the Community Spectro-polarimetric Analysis Center (CSAC) at HAO. Some additional information on compiling and running MERLIN can be found in the section below.

Each Level 2 dataset is stored in a FITS file containing 42 extensions, one per inversion parameter or ancillary data product:

ExtensionQuantity
1Magnetic field strength
2Magnetic field inclination angle, in [0°, 180°]
3Magnetic field azimuth angle, in [0°, 180°]
4Doppler shift of 6301.5 Å line
5Doppler shift of 6302.5 Å line
6Doppler width
7Line strength
8Damping parameter
9Source function
10Source function gradient
11Macroturbulence
12Stray light fraction
13Stray light shift
14Magnetic field strength error
15Magnetic field inclination error
16Magnetic field azimuth error
17Doppler shift error of 6301.5 Å line
18Doppler shift error of 6302.5 Å line
19Doppler width error
20Line strength error
21Damping parameter error
22Source function error
23Source function gradient error
24Macroturbulence error
25Stray light fraction error
26Stray light shift error
27\( \chi^2 \) for Stokes \( I \)
28\( \chi^2 \) for Stokes \( Q \)
29\( \chi^2 \) for Stokes \( U \)
30\( \chi^2 \) for Stokes \( V \)
31Total \( \chi^2 \)
32Continuum intensity
33Original continuum intensity
34Polarization degree
35Magnitude of Stokes \( V \)
36Final status of inversion
37Number of iterations
38\( x \) coordinate (at each slit position)
39\( y \) coordinate (at each slit position)
40Observation time (at each slit position)
41Mechanical slit position
42Scattered light profile

Compiling and Running MERLIN

As mentioned above, the MERLIN source code is publicly available from the Community Spectro-polarimetric Analysis Center (CSAC) at HAO, and is distributed under GPLv3.

After downloading, uncompressing, and expanding and the archive file, you should have a directory structure as follows, according to the INSTALL file:

merlin
|--> client
|--> lib
|  |--> fico
|  |--> tinyxml
|  |--> initialization
|--> m4
|--> helpers

The INSTALL file indicates that MERLIN also requires the following libraries to be compiled and installed:

As mentioned in the INSTALL file, there is a configure script that will set up the compilation environment. One may need to set the CPPFLAGS and LDFLAGS environment variables to point to directories containing the include directories and library directories.

Once the configure script exits without any errors, the user can run make. If the compilation process successfully completes, a merlin executable will appear in the client directory. Running merlin without any arguments should show the help output:

MERLIN: -h -v -x [XML_INPUT_FILE_NAME] -d [DEBUG LEVEL] -p
where
-d [DEBUG LEVEL]: set program to debug mode. This flag is optional.Debug level can be 1 or .2
-x [XML_INPUT_FILE_NAME]: provides the name of an XML file with the instructions about the inversion.
-v: show program version in standard output and exits. This flag is optional.
-p: Dump both, the observed and the fitted profiles. This flag is optional.
-h: writes this help and exits.
Consult the manual for complete documentation.

If there is an error regarding dynanmically linked libraries, then one may need to set the LD_LIBRARY_PATH environment variable.

To use MERLIN to perform an inversion, one needs an input XML file and a corresponding FITS file containing the input spectrum. In this SOT-SP-specific example, we can use as input the first spectrum in a scan from June 5, 2015, SP3D20150605_122327.9C.fits, which can be downloaded from this link. The corresponding XML file, SP3D20150605_122327.9C.fits.xml, may be downloaded from this link. After updating the directories specified by the <INPUT> and <OUTPUT> keywords in the XML file, the inversion can be performed by specifying the name of the XML file via the -x switch:

merlin -x SP3D20150605_122327.9C.fits.xml

After a short wait, an output NetCDF file named SP3D20150605_122327.9C.fits.nc should appear.