# Codes

An important part of the activity of the group deals with the development of radiative transfer and magneto-hydrodynamics computer programs for the simulation of these physical processes in stellar atmospheres.

For the moment, the following ones are available to the astrophysical community.

### Hazel

**HAZEL (Ha**nle and **Ze**eman **L**ight) is a computer program for the synthesis and inversion of Stokes profiles resulting from the joint action of atomic level polarization and the Hanle and Zeeman effects. More information here.

### Bayes-ME

**Bayes-ME** is a computer program for carrying out Bayesian inference from observed Stokes parameters. It is able to recover the thermodynamical and magnetic properties of the plasma using a Milne-Eddington approximation. More important, it samples the full posterior distribution function, so that statistically relevant error bars can be obtained. Additionally, prior information can be introduced straightforwardly. More information here.

### BayesClumpy

**BayesClumpy** is a computer program that carries out Bayesian inference of the parameters of clumpy dusty torus models from observations of the spectral energy distributions (SED). It uses a fast synthesis algorithm based on machine learning tools that learn the database of models. More information here.

### Bayesian weak-field inference

Here you can find routines to calculate the posterior distributions for the magnetic field strength in case the weak-field approximation holds. The theory is described in Asensio Ramos (2011).

### Flux tube

This set of IDL routines creates a magneto-static structure of a flux tube size following the method of Pneuman et al. (1986). The equations for magnetostatic equilibrium are written in cylindrical coordinates. All the variables are expanded in a power series in the horizontal radial coordinate r. The series is truncated after the second order in r. After some manipulations with the equations, one single equation is obtained for the vertical stratification of the magnetic field strength at the flux tube axis (for details, see Pneuman et al. 1986). This equation is solved numerically using an iterative interpolation scheme by fluxtubes2.pro. Once the magnetic field at the axis is obtained, all of the other variables are calculated from analytical expressions. The free parameters of the model are: magnetic field strength and flux tube radius at the base of photosphere and filling factor. The latter parameter allows us to produce a smooth merging of flux tubes at some chromospheric height. These parameters can be adjusted directly in the routine. More information in Khomenko, E., Collados, M., & Felipe, T. 2008, Sol. Phys., 251, 589

### Sunspot

In order to understand the influence of magnetic fields on the propagation properties of waves, as derived from different local helioseismology techniques, forward modeling of waves is required. Such calculations need a model in magnetohydrostatic equilibrium as an initial atmosphere through which to propagate oscillations. We provide a set of the IDL routines to create a magneto-static sunspot model in equilibrium from the sub-photospheric to chromospheric layers for a wide range of parameters. The method combines the advantages of self-similar solutions and current-distributed models. A set of models already calculated by this method are also provided. The steps are described in main.pro. The parameters of the magneto-static equilibrium model can be adjusted directly in this routine. More information in Khomenko, E., & Collados, M. 2008, ApJ, 689, 1379

### Molpop-CEP

Molpop-CEP is a code for exact solution of the radiative transfer problem in multi-level atomic systems. The novel contribution of the code is that the radiative transfer equation is analytically integrated so that the final problem is reduced to the solution of a non-linear algebraic system of equations in the level populations. The radiative transfer is solved using the Coupled Escape Probability formalism presented by Elitzur & Asensio Ramos (2006) and summarized in the last chapter of the manual present below. The current version of the code is limited to plane-parallel slabs with arbitrary spatial variations of the physical conditions. More information here.