Manual of the MEKSY package for SOT-SP& The description of the SOT-SP Level-2 data
MEKSY Team
Ver. 0.8-E

Contents
0 Change Log

21 Introduction
1.1 Prefare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.2 What is the Level-2 data? . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.3 Location of the Software Package . . . . . . . . . . . . . . . . . . . . . . .

33332 Setup
2.1 Setup the command path . . . . . . . . . . . . . . . . . . . . . . . . . . .

553 Display the Level-2 data on IDL
3.1 Start up the SSW-IDL included the MEKSY package . . . . . . . . . . . .
3.2 Read the SOT-SP Level-2 data . . . . . . . . . . . . . . . . . . . . . . . .
3.3 Convert to the MAP format of SSW-IDL . . . . . . . . . . . . . . . . . .
3.4 Display of the magnetic field vectors . . . . . . . . . . . . . . . . . . . . .

6667
7

4 Fitting on IDL using the MEKSY Procedures
4.1 Basic Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2 Parameters for the “sotsp fit” procedure . . . . . . . . . . . . . . . . . . .

999A Appendix
11
A.1 The parameter of the fitting. . . . . . . . . . . . . . . . . . . . . . . . . . 11
A.2 the status of the fitting . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121

Chapter 0

Change Log• Ver. 0.0, 2007. 1. 10. T. Yokoyama (Japanese Ver.)• Ver. 0.1, 2007. 1. 25. M. Shimojo (Japanese Ver.)• Ver. 0.2, 2007. 2. 2. Y. Katsukawa (Japanese Ver.)• Ver. 0.3, 2007. 2. 3. T. Yokoyma (Japanese Ver.)• Ver. 0.4, 2007. 2. 15. Y. Katsukawa (Japanese Ver.)• Ver. 0.5, 2007. 3. 5. T.Yokoyama (Japanese Ver.)• Ver. 0.6, 2013. 2. 13. M. Shimojo for SDAS and Translate to English• Ver. 0.7, 2018. 1. 28. M. Shimojo for ADC• Ver. 0.8, 2022. 7. 7. M. Shimojo remove the section for Grid2

Chapter 1

Introduction
1.1Prefare

The document described how to make Level-2 data from Level-1 data of SOT-SP andhow to analyze the Level-2 data.

1.2

What is the Level-2 data?

The SOT-SP Level-2 data is made from the Level-1 data by the following processes.
• Fitting of the Stokes ProfileBased on the Milne-Eddington model)• Resolving the 180 degree ambiguity of the azimuth angle
The SOT-SP Level1 data are the calibrated full-Stokes profiles.

1.3

Location of the Software Package

The MEKSY package is the software pacakge for deriving the magnetic field vectors fromthe full-stokes profiles of the Fe lines. The package includes the FORTRAN program
for the inversion process and the IDL procedures for the Front-End of the FORTRAN
program. In the open-use data analysis system, Astronomical Data Center/NAOJ, thereis the MEKSY software package at the following directory.
/solar/share/soft develop/sot/sp/sotsp inv
Under the MEKSY directory, there are the following directories for storing the components of the package.

3

bin/ Commands and Shellscripts
data/ data
idl/ Procedures of IDL
doc/ Documents
setup/ Configuration files for IDL
src/ Sources of the commands4

Chapter 2Setup
2.1

Setup the command path

To use the MEKSY package, you need to add the command path at your configuration
file of the shell. When you use “csh” or “tcsh”, please insert the following line in your“.cshrc” file.


set path = (/solar/share/soft develop/sot/sp/sotsp inv/bin ${path})


NoteIn the ADC system, the command path is already inserted in your configuration
file. You do not need the additional procedure to use the MEKSY package

5Chapter 3

Display the Level-2 data on IDL
3.1

Start up the SSW-IDL included the MEKSY package

In the ADC system, SSW-IDL can be started using the following command.
sagami$ SSWidl
The command is includes the setup procedure for the SOT-SP and MEKSY packages.

3.2

Read the SOT-SP Level-2 data

The format of the SOT-SP Level-2 data is the FITS format with the IMAGE extension.
The special IDL procedure for Level-2 data “sotsp read rst” is useful for reading thedata.


IDL> dir=’/solar/share/soft_develop/sot/sp/sotsp_inv/data/’
IDL> file=dir+’sprst.fits’
IDL> sotsp_read_rst,file,index,data,idata,coordinates,time,slitpos $IDL> ,par_type=par_type,par_unit=par_unit $IDL> ,ipar_type=ipar_type,ipar_unit=ipar_unit,straylight=straylight% READFITS: EOF encountered attempting to read extension 42
Note You can neglect the warning message ‘‘EOF encounterred ...’’.
After reading the data using “sotsp read rst”, there are “data” and “idata” in thememory.

6

IDL> help,data,idata
DATAFLOAT
IDATA
LONG

= Array[317, 512, 4]= Array[317, 512]

“data” is the flowing array and includes the magnetic field strength, azimuth angle,....
“idata” includes the status of the fitting. The axises of “data” are indicates;
1st axis: the direction of the SOT-SP scanning(Basically, it is equal to the East-West direction of the Sun)
2nd axis the direction of the y-axis of the SOT-SP CCD(Basically, it is equal to the North-South direction of the Sun)
3rd axis the parameters of the fitting.
“sotsp read rst” has the option “read level”. You can select the parameters that areread into the memory by the option. The option has three levels.
• 0 (default): Magnetic Field Strength, Inclination Angle, Azimuth Angle, Ratio ofScatter Light and Status of Fitting• 1: Default + Doppler Velocity 6301.5Å & 6302.5Å), Doppler Width, Ration ofOpacities between Line and Continuum, Ratio of Damping Width to Doppler
Width, Source Function, Gradient of Source Function, Width of Macro Turbulent, Doppler Shift of the stray light, Strength of Continuum, Polarization Degree• 2: All data in the Level-2 data file

3.3

Convert to the MAP format of SSW-IDL

The data of Level-2 can be converted to the MAP format of SSW-IDL using the followingcommand.


IDL> sotsp_index2map,index,data,map,par_type,par_unit $IDL>,idata,imap,ipar_type,ipar_unit
3.4



Display of the magnetic field vectors

You can display the magnetic field vectors on the map of the normal component of themagnetic field strength using the following commands.

7

IDL> sotsp_mkmag3map,map[0],map[1],map[2],mapbx,mapby,mapbz
IDL> plot_map,mapbz
IDL> plot_vmap,/over,mapbx,mapby $IDL>,limit=100,scale=0.002,iskip=10,jskip=10 $IDL>,/sample,index_size=1000
“plot vmap” has the options; “limit” option: the minimum field strength for display,“scale”: the size of the arrows, “iskup” & “skip”: the interval of the arrows, “sample”:
display the reference arrow, “inidex size”: the size of the reference arrow.

8Chapter 4

Fitting on IDL using the MEKSY
Procedures
In the chapter, the procedure of the fitting on IDL is described. Although the commandsof the fitting are written by FORTRAN, you can execute the FORTRAN commands
from IDL using the MEKSY IDL procedures. Hence, you do not need to consider theFORTRAN programs.

4.1

Basic Procedure

The basic procedure on IDL for the fitting is as follows. The input parameter is only
the filenames of the Level-1 data.


IDL> files_prof=findfile(’./SP3D*.fits’)
IDL> sotsp_invprep,files_prof,outfile_stray=file_stray ; Pre-Process
IDL> sotsp_fit, files_prof, nproc=1,IDL> outfiles_fitparams=file_level1_5, /show_message ; Fitting
IDL> sotsp_write_rst,file_level1_5,$
IDL> files_prof,file_stray,outfile=file_level2 ; Post-Process
IDL> sotsp_mkql,file_level2 ; Making the Quick Look Images(PNG)
4.2

Parameters for the “sotsp fit” procedure

When the parameters of “sotsp fits” are changed from the default value, you can use thefollowing options.

9

IDL> sotsp_fit,files_prof,verbose=1,i_slit1=3,i_slit2=5, $IDL> /flag_output_syn_profIt is an example of using the options of “sots fits” IDL procedure. The set of theoptions indicates• verbose = 1 : message level = 1• i slit1=3, i slit2=5: execute the fitting from slit #3 to slit #5.
• /flag output syn prof: output the stokes profiles that are the result of the fitting.
The other examples of the options are;

IDL> sotsp_fit,/norun, ...
; make the inputs file for the FORTRAN programs but do not run.
10

Appendix AAppendix
A.1

The parameter of the fitting.

Note1: Zero of the inclination indicates the direction from Sun to the observer.
Note2: Zero of the azimuth indicate the right of the image (the west of the Sun).


fieldstrength:
magnetic field strength (Gauss)
inclination:
inclination degree
azimuth:azimuth degreelinestrength:
ratio of the opacity between line and continuum
dopplerwidth:
doppler width (mA)damping:ratio of damping width to doppler width
dopplervelocity: doppler velocity (km/s)
sourcefunct:source function
sourcegrad:gradient of the source function
macroturbulence: macro turbulence (km/s)
strayfraction:
ratio of stray lightstrayshift:doppler shift of stray light (mA)

At the pixels that have weak polarization, only following parameters are used andthe other parameters are set to zero.

11





A.2



linestrength:
ratio of the opacity between line and continuum
dopplerwidth:
doppler width (mA)damping:ratio of damping width to doppler width
dopplervelocity: doppler velocity (km/s)
sourcefunct:source function
sourcegrad:gradient of the source function
macroturbulence: macro turbulence (km/s)

the status of the fitting

0: success of fitting
1: fitting is not executed by the mask that is made by users.
2: fail of fitting
3: anomalous of the profile, or fail of the initial guess
4: anomalous of the profile, or fail of the initial guess
5: not enough the photons to the fitting
10: success of fitting (for weak polarized pixel only)
12: fail of fitting (for weak polarized pixel only)12