The art of Stokes inversions Instituto de Astrofísica de Andalucía (CSIC), Spain
Outline What are inversions? How do they work? Milne-Eddington inversions Accounting for asymmetric Stokes profiles Be careful with the choice of model atmosphere! Available codes Tips and tricks Running SIR Control file Input files Tools for visualization and manipulation SIR exercises
What is an inversion? In a broad sense, any inference of the physical conditions of the solar atmosphere based on the interpretation of observed Stokes profiles Weak-field approximation, center-of-gravity method... Forward modeling PCA, artificial neural networks Least-squares fitting What we want: vector magnetic field, gas temperature, gas velocity,... What to expect: a model atmosphere capable of reproducing the observations. nothing else!
Radiative transfer equation The Stokes parameters obey the RTE (Unno 1956; Rachkovsky 1962) η I,Q,U,V and ρ Q,U,V depend on a (B, γ, χ, v LOS, T, P e, v mic ) This means that Four Stokes parameters needed to understand just one of them Proper interpretations of the Stokes vector require a good knowledge of the atmosphere (a)
Least-square inversions The complete line transfer problem has to be solved Self-consistent inferences least-square inversions INITIAL MODEL ATMOSPHERE SPECTRAL SYNTHESIS PERTURBED MODEL ATMOSPHERE Nonlinear, least-squares fit OBSERVED AND SYNTHETIC PROFILES FINAL MODEL ATMOSPHERE No simplifying assumptions Full Stokes vector fitted Complex model atmospheres All atmospheric parameters inferred at the same time
How do they work? Inversion driven by χ 2 -minimization 2 (a) = 1 N free 4X j=1 NX i=1 w 2 ij 2 j 2nd order Levenberg-Marquardt algorithm r 2 (a)+a( 2 ) a =0 I obs j ( i ) I syn j ( i, a) 2 Matrix A needs to be inverted to find A has large dimension A is quasi-singular a. Two problems: Two solutions: Atmosphere perturbed in coarse grid (fewer free parameters) Modified SVD method (Ruiz Cobo & del Toro Iniesta 1992)
Inversions based on ME atmospheres ME atmosphere: Source function is linear with optical depth Absorption matrix does not vary with optical depth Nine free parameters Analytical Stokes profiles Very fast inversion Smooth maps of physical quantities Results are reasonably accurate and easy to interpret
ME inversions of high-spatial resolution profiles MHD simulations (Vögler et al. 2005) Fe I 630.1 and 630.2 nm profiles degraded to Hinode/SP resolution and pixel size
ME inversions of high-spatial resolution profiles MHD simulations (Vögler et al. 2005) + ME inv Profiles reasonably well fitted ME results are some kind of average of physical parameters along the LOS ME inv
ME inversions of high-spatial resolution profiles MHD simulations (Vögler et al. 2005) Magnetic field strength Field inclination Inferred field strength Inferred field inclination Atmospheric parameters from MHD simulation at log τ = -2 Maps of inferred B and γ similar to real ones! Orozco Suárez et al. 2007, ApJ, 662, L31
Inversions based on ME atmospheres ME atmosphere: Source function is linear with optical depth Absorption matrix does not vary with optical depth Nine free parameters Analytical Stokes profiles Very fast inversion Smooth maps of physical quantities Results are easy to interpret Simplistic treatment of line formation No thermal information. No height variations Cannot account for asymmetric Stokes profiles
Asymmetric Stokes profiles Continuum intensity Stokes V at Δλ = -3.8 pm + + TESOS+VIP, Sep 2006 KIS/IAA Visible Imaging Polarimeter + TESOS + KAOS VTT, Observatorio del Teide Spatial resolution: 0.4" Quiet Sun at center, Fe I 630.15 and 630.25 nm
The origin of asymmetries Amplitude asymmetry/ Multi-lobed Stokes profiles Different magnetic atmospheres coexisting in resolution element Area asymmetry Gradients/discontinuities of B and v LOS along LOS Auer & Heasley (1978) RF of Stokes V to B Cabrera Solana et al. (2005) The area asymmetry gives information on the height variation of atmospheric parameters
Accounting for asymmetries Inversion codes capable of dealing with asymmetries Are based on numerical solution of RTE Provide reliable thermal information Can use fewer free parameters than ME codes Infer stratifications of physical parameters with depth
Accounting for asymmetries
Accounting for asymmetries
Be careful with the choice of atmospheric model! The results change if the physical model is changed Too simplistic models; often they cannot describe the real atmosphere BUT: we get information about the magnetic structure of the atmosphere! Magnetic flux tubes in facular regions B [kg] I/I QS 2.5 2.0 1.5 1.0 0.5 0.0-5 -4-3 -2-1 0 1 2 log tau 1.0 0.9 0.8 0.7 0.6 0.5-400 -200 0 200 400 Lambda [ma] V/I QS 0.10 0.05 0.00-0.05 Flux tube model Fe I 630.2 nm -0.10-400 -200 0 200 400 Lambda [ma] Luis R. Bellot Rubio
Be careful with the choice of atmospheric model! The results change if the physical model is changed Too simplistic models; often they cannot describe the real atmosphere BUT: we get information about the magnetic structure of the atmosphere! Magnetic flux tubes in facular regions B [kg] I/I QS 2.5 2.0 1.5 1.0 0.5 0.0-5 -4-3 -2-1 0 1 2 log tau 1.0 0.9 0.8 0.7 0.6 0.5-400 -200 0 200 400 Lambda [ma] V/I QS 0.10 0.05 0.00-0.05 Flux tube model Best-fit 1C model Fe I 630.2 nm -0.10-400 -200 0 200 400 Lambda [ma] Luis R. Bellot Rubio
Be careful with the choice of atmospheric model! The results change if the physical model is changed Too simplistic models; often they cannot describe the real atmosphere BUT: we get information about the magnetic structure of the atmosphere! EXERCISE 3 Facular profiles from ASP B [kg] I/I QS 2.5 2.0 1.5 1.0 0.5 0.0-5 -4-3 -2-1 0 1 2 log tau 1.0 0.9 0.8 0.7 0.6 0.5-400 -200 0 200 400 Lambda [ma] V/I QS 0.10 0.05 0.00-0.05 Flux tube model Best-fit 1C model Fe I 630.2 nm -0.10-400 -200 0 200 400 Lambda [ma] Luis R. Bellot Rubio
Available codes for inversions with gradients SIR Ruiz Cobo & del Toro Iniesta (1992) 1C & 2C atmospheres, arbitrary stratifications, any photospheric line SIR/FT Bellot Rubio et al. (1996) Flux tube model, arbitrary stratifications, any photospheric line SIR/NLTE Socas-Navarro et al. (1998) NLTE line transfer, arbitrary stratifications SIR/GAUS Bellot Rubio (2003) Uncombed penumbral model, arbitrary stratifications SIR/JUMP Bellot Rubio (in preparation) Canopy-like atmospheres SPINOR Frutiger & Solanki (2001) 1C & 2C atmospheres, arbitrary stratifications, any photospheric line, molecular lines, flux tube model, uncombed model NICOLE Socas-Navarro et al. (2015) 1C & 2C, NLTE, arbitrary stratifications STiC de la Cruz Rodríguez et al. NLTE, based on RH, arbitrary stratifications, (in preparation) photospheric/chromospheric/tr lines
Tips and tricks First of all, look at the profiles Try a ME-like inversion, it usually works Use 1C inversion with height-independent magnetic/dynamic parameters If the V profiles are very asymmetric, fit only I, Q, and U Examine the fits: are they reasonably good? Identify Pixels with bad fits and/or large asymmetries Regions where interesting physical processes occur Run SIR inversions on these pixels Which model are you going to use? 1C model, 2C model, flux tube model, uncombed model? Use ME results as initialization Give more weight to the strangest Stokes parameter Do it simple! See if linear stratifications (2 nodes) are sufficient If not, increase the number of nodes gradually Ask yourself if the retrieved model atmosphere makes sense!!
1C SIR inversion of Hinode/SP data + + EXERCISE 2
Tips and tricks First of all, look at the profiles Try a ME-like inversion, it usually works If the V profiles are very asymmetric, fit only I, Q, and U Examine the fits: are they reasonably good? Identify Pixels with bad fits and/or large asymmetries Regions where interesting physical processes occur Run more complex inversions on these pixels Which model are you going to use? 1C model, 2C model, flux tube model, uncombed model? Use ME results as initialization (with f=1?) Give more weight to the strangest Stokes parameter Do it simple! See if linear stratifications (2 nodes) are sufficient If not, increase the number of nodes gradually Ask yourself if the retrieved model atmosphere makes sense!!
Tips and tricks First of all, look at the profiles Try a ME-like inversion, it usually works If the V profiles are very asymmetric, fit only I, Q, and U Examine the fits: are they reasonably good? Identify Pixels with bad fits and/or large asymmetries Regions where interesting physical processes occur Run more complex inversions on these pixels Which model are you going to use? 1C model, 2C model, flux tube model, uncombed model? Use results from ME-like inversion as initialization Give more weight to the strangest Stokes parameter Keep it simple! See if linear stratifications (2 nodes) are sufficient Ask yourself if the retrieved model atmosphere makes sense!! Experts are always around: ask them for advice!
The SIR inversion code Stokes Inversion based on Response functions (Ruiz Cobo & del Toro Iniesta 1992) Plane-parallel geometry Local thermodynamical equilibrium Neutral, singly and doubly ionized species Arbitrary stratifications of the atmospheric parameters 1C or 2C model atmospheres Parallel version available: SIR_parallel (ask me!)
Installing SIR Download code from https://github.com/basilioruiz/sir-code Compile with cd [path]/code make fc=gfortran sir.x ; make fc=gfortran modelador3.x Copy binaries sir.x and modelador3.x to /usr/local/bin or make soft links with cd /usr/local/bin sudo ln s [path]/code/sir.x ; sudo ln s [path]/code/modelador3.x Copy IDL tools to folder in the IDL path. Copy file scales to ~/bin cp [path]/idl/* your_idl_folder mkdir ~/bin ; cp [path]/idl/scales ~/bin
SIR is controlled by a control file: [ ].trol Running SIR: input files Number of cycles: 0: Synthesis mode >0: Inversion mode 1: Compute response functions d at every depth 2: Compute response functions d at the nodes
SIR is controlled by a control file: [ ].trol Running SIR: input files Stokes profile file: [ ].per Line index Δλ [ma] I/I qs Q/I qs U/I qs V/I qs read_profile.pro write_profile.pro
SIR is controlled by a control file: [ ].trol Running SIR: input files Stray light file Same format as Stokes profile file. Contains the stray light contamination, assumed to be unpolarized (so that Q=U=V=0)
Stray-light considerations Stray-light in 1C inversions: I obs = (1-α) I 1 + α I stray Accounts for both stray light and/or magnetic filling factor Stray-light in 2C inversions: It is NOT equivalent to a magnetic filling factor SIR has two free parameters: α and f I obs = (1-α) [f I 1 + (1-f) I 2 ] + α I stray Global vs local stray-light profile Classical treatment: global stray-light profile (average over FOV) Orozco Suárez et al. (2007): local stray-light profile accounts for telescope diffraction Deconvolution of instrumental PSF (only space-based obs!)
SIR is controlled by a control file: [ ].trol Running SIR: input files PSF file: [ ].psf Contains two columns 1. Wavelength in ma with respect to center of the line 2. Spectral PSF of the instrument
SIR is controlled by a control file: [ ].trol Running SIR: input files Wavelength grid file: [ ].grid Necessary only in synthesis mode and when blends are to be computed
SIR is controlled by a control file: [ ].trol Running SIR: input files Atomic parameter file Line index Ion λ E χ log gf transition collisional parameters
SIR is controlled by a control file: [ ].trol Running SIR: input files Macroturbulence (km/s) Fillig factor (f) Stray light factor (α) MODEL FILE: [ ].mod read_model.pro write_model.pro modelador3.x log τ T P e v mic B v LOS γ ϕ z [km] P g ρ
SIR is controlled by a control file: [ ].trol Running SIR: input files
Concept of nodes Keeping the number of free parameters small: Atmospheric parameters perturbed in coarse grid (nodes) Full stratifications in finer grid by cubic spline interpolation
Approaching the solution gradually The real SUN Synthetic observations Luis Bellot Basilio Rubio Ruiz Cobo
Approaching the solution gradually Initial guess model Luis Bellot Basilio Rubio Ruiz Cobo
Approaching the solution gradually Luis Bellot Basilio Rubio Ruiz Cobo
Approaching the solution gradually Luis Bellot Basilio Rubio Ruiz Cobo
SIR is controlled by a control file: [ ].trol Running SIR: input files Number of nodes Each column corresponds to a cycle Assume we have 2 cycles with Nodes for T: 2,3 Nodes for B: 1 In the first cycle, 2 nodes for T and 1 for B will be used. In the second cycle, 3 for T and 1 for B will be used 0 nodes in electron pressure implies HE If nodes = -1, the perturbation for the other atmosphere is taken (only 2C inversions) If Automatic selection of nodes is for instance 0,0,1, SIR will use the specified number of nodes in the first and second cycles, but in the third it will use less nodes than those specified Number of nodes * means any value (only for automatic selection)
SIR is controlled by a control file: [ ].trol Running SIR: input files Other inversion settings
Executing the inversion Copy the executable sir.x to /usr/local/bin or make a soft link with cd /usr/local/bin sudo ln s [path]/sir.x echo sir.trol sir.x
Visualizing SIR results: graphics.pro [path]/idl/graphics.pro Model atmospheres Stokes profiles
Visualizing SIR results: sirgui.py https://github.com/rcenteno/sir_gui Stokes profiles and model atmospheres
IDL procedures to read/write SIR files - read_profile,.per, index, wave, SI, SQ, SU, SV - write_profile,.per, index, wave, SI, SQ, SU, SV - read_model,.mod, log(τ c ), T, Pe, mic, B, γ, φ, z, Pg, ρ, Vmac, filling, stray - write_model,.mod, log(τ c ), T, Pe, mic, B, γ, φ, z, Pg, ρ, Vmac, filling, stray - read_rf,.rh, RF_SI, RF_SQ, RF_SU, RF_SV, ntau, nlam - read_rf_nomag,.rh, RF_SI, ntau, nlam - Pe_PgT, T, Pg, Pe, µ, ρ, γ ad, κ, ne, nh, nh+, ion.deg, α, δ, c v, c p, c s
Manipulating model atmospheres: modelador3.x
SIR exercises Download exercises from https://github.com/luis-bellot/sir-course or from the school website https://www2.hao.ucar.edu/spectropolarimetry/slides
Exercise 1 Spectral synthesis and inversion of synthetic profiles Use HSRA model to synthesize Stokes profiles with 1. constant B, inclination and v LOS (e.g., 1 kg, 60 º, 2 km/s) 2. constant v LOS, gradients of B and inclination 3. gradients of B, inclination and v LOS Invert profiles from (3), starting from initial guess model with flat stratifications of B, v LOS, and inclination (modify hsra.mod) 1 node in B, vlos, inclination 2 nodes in B, v LOS and inclination read_model, hsra.mod,tau,t,pe,mic,b,v, gamma,phi,zeta,pg,rho,mac,ff,stray v=2e5+0.*tau b=1000.+200.*tau write_model, hsra-grad.mod, tau,t,pe,mic,b,v, gamma,phi,zeta,pg,rho,mac,ff,stray
Exercise 2 Inversion of profiles from dark-cored penumbral filament Hinode/SP observations with SNR~1000, no telluric lines, two lines Fe I 630.1 and 630.2 nm Strong, symmetric signals 1. What kind of model would you use to invert them? 2. Can the fit be improved with more nodes in T? (use 2 cycles!) 3. What happens with 2 nodes in B and v LOS? 4. What happens with 10 nodes in B and v LOS? If no instrumental PSF is available, use macroturbulence to mimick its effect (i.e, invert v mac ) Use more weight for Q, U and V to force better fits to those parameters A worse equivalent SNR does not necessarily mean a worse fit (i.e., a lower chi 2 ) Beware of models with too much freedom. Always check uncertainties!
Exercise 3 Inversion of facular profiles in quiet Sun HAO/ASP observations, averaged over facular region, SNR~10000, but poor spatial resolution Two lines Fe I 630.1 and 630.2 nm (plus telluric lines!) Strong signals, large Stokes V area and amplitude asymmetries 1. What kind of model would you try to invert them? 2. Use two cycles, increasing number of nodes in 2nd cycle 3. Invert stray-light fraction, micro- and macro-turbulence Use large negative number (<-1) in profiles to ignore blends in Stokes I during inversion We invert Stokes I and V only, so vertical fields should be assumed Use instrumental PSF and macroturbulence at the same time (asp.psf) Use stray light profile (straylight.per) Use weights of 10 and 100 for Stokes V
Exercise 4 Inversion of quiet-sun internetwork profiles Hinode/SP observations at disk center from 0.16 x 0.16 pixel, integrated for 6 min, SNR~10 5, still high spatial resolution Two lines Fe I 630.1 and 630.2 nm Extremely weak signals, but linear polarization clearly seen. Large asymmetries. 1. What kind of model would you try to invert them? 2. Use three cycles with increasing number of nodes 3. Invert stray-light fraction and microturbulence (flat stratification) 4. Interpret resulting model No need for macroturbulence when high-resolution data are inverted using telescope PSF, so set it to zero (or better to 0.01 km/s) Use following weights: 1,4,4,4
Exercise 5 Inversion of sunspot penumbral profiles near PIL Hinode/SP observations with SNR~1000, no telluric lines, two lines Fe I 630.1 and 630.2 nm Strong signals, but Stokes V profile with three lobes... 1. What kind of model would you use to invert them? Onecomponent model with opposite magnetic polarities along LOS? Two-component model? 2. Try both! 3. Interpret the results Inversion of these profiles will not be easy. Do your best! Give more weight to Stokes V to force better fits. Increase weight with cycle If everything fails, use superpowers (aka automatic selection of nodes...)
Exercise 6 Internetwork profiles with very weak Q, U signals Simulated Hinode obs, SNR~1000, Fe I 630.1 and 630.2 nm Synthesize Stokes profiles from 2 component model 1. magnetic atmosphere: B=200 G, γ = 30 º, az=30 º, ff=0.05, v=1 km/s 2. non-magnetic atmosphere: hsra.mod with ff=0.95 3. Save profiles. Then add noise at the level of 10-3 using add_noise,filename,1e-3. Save noisy profiles Invert noise-free, then noisy profiles. Use simple 2C model, freezing 2nd component to hsra.mod. Interpret resulting field inclinations and field strengths for different realizations of the noise at the 10-3 level Use 2C models for synthesis and inversion Beware of noisy linear polarization profiles... Find ways to minimize the problem!
Exercise 7 Inversion of CRISP profiles from sunspot penumbrae SST/CRISP observations with SNR~500, sequential spectral sampling of Fe I 617.3 nm (30 wavelengths in ~30 s) Strongly Doppler-shifted polarization profiles 1. What kind of model would you use to invert them? 2. Use stray-light contamination 3. Start with profile obs_10d_75.per, then obs_10d_71.per 4. You are on your own! I have not inverted these profiles yet... Example of Stokes profiles observed with a Fabry-Pérot interferometer Extremely high spatial resolution, but modest spectral resolution (~50 ma at 617 nm) Sequential sampling of line means first and last wavelengths are observed ~30 s apart