# MSG Fundamentals

This chapter expands on the Walkthroughs, by describing in detail how MSG evaluates stellar spectra and photometric colors. It also aims to clarify the variety of different concepts that are often lumped together under the name ‘spectrum’.

## Elemental Spectra

The radiation emitted by a small element of a star’s surface is most completely characterized by the specific intensity \(\intsy(\lambda; \vshat; \vx)\). This quantity is defined such that energy passing through the element into a solid angle \(\diff{\Omega}\) oriented along the unit direction vector \(\vshat\), and within wavelength interval \([\lambda, \lambda+\diff{\lambda}]\) and time interval \(\diff{t}\), is

Here, \(\diff{\area}\) is the area of the surface element, \(\vnhat\) is the unit surface normal vector, and \(\vx\) is a vector specifying the photospheric parameters of the element — for instance, its effective temperature \(T_{\rm eff}\) and gravity \(g\). Integrating this equation over all solid angles yields the net energy passing through the element in the wavelength and time intervals:

where the flux is introduced as

Typically the radiation field is axisymmetric around \(\vnhat\), and so \(\intsy\) depends on direction solely via the angle parameter \(\mu \equiv \vshat \cdot \vnhat\). Then, the flux simplifies to

(the lower bound on \(\mu\) is set to 0 rather than -1 under the assumption that there is no external radiation at the stellar surface).

Both \(\intsy\) and \(\flux\) can reasonably be dubbed a ‘spectrum’, as they each represent the distribution of electromagnetic energy with respect to wavelength. However, one should be careful to distinguish these elemental spectra from the observed spectrum of a star; this distinction is further clarified below.

Evaluating an elemental spectrum requires solution of the radiative transfer equation throughout the atmospheric layers composing the surface element. This is often far too computationally expensive to do on-the-fly. An alternative approach is to pre-calculate spectra across a multi-dimensional grid spanning a range of photospheric parameters, and then interpolate within this grid when an elemental spectrum is required for a specific \(\vx\). This is the fundamental purpose of MSG.

## Evaluating Elemental Spectra

To evaluate an elemental specific intensity spectrum, MSG models the dependence of \(\intsy\) on each of its three arguments as follows:

Wavelength dependence is represented using piecewise-constant functions.

Angle dependence is represented using limb-darkening laws.

Photospheric parameter dependence is represented using tensor surface interpolation.

The following subsections discuss these in greater detail.

### Wavelength Dependence

The \(\lambda\) dependence of the specific intensity is represented as a piecewise-constant function on a wavelength abscissa \(\lambda = \{\lambda_{1},\lambda_{2},\ldots,\lambda_{M}\}\):

(for brevity, the dependence of \(\intsy\) on \(\mu\) and \(\vx\) has been suppressed). Mapping intensity data onto a new abscissa \(\lambda' = \{\lambda'_{1},\lambda'_{2},\ldots\,\lambda'_{M'}\}\) is performed conservatively, according to the expression

Beyond its simplicity, the advantage of this approach (as compared to higher-order interpolations) is that the equivalent width of line profiles is preserved.

### Angle Dependence

The \(\mu\) dependence of the specific intensity is represented using limb-darkening laws. Most familiar is the linear law

where \(\intsy(1)\) represents the normally emergent (\(\mu=1\)) intensity and \(c\) is the linear limb-darkening coefficient (as before, the dependence of the intensity on other parameters has been suppressed). An improved characterization involves additional \(\mu\)-dependent terms on the right-hand side; for instance, the four-coefficient law devised by Claret (2000) is

where there are now four limb-darkening coefficients \(c_{k}\).

The advantage of using limb-darkening laws is the ease with which other useful quantities can be calculated. For instance, the flux (3) can be evaluated analytically, as can any of the Eddington (1926) intensity moments (or E-moments, as MSG terms them):

MSG supports the following limb-darkening laws:

- CONST
Constant law, where \(I_{\lambda}\) has no dependence on \(\mu\) whatsoever. This is discussed further below.

- LINEAR
Linear law given in equation (4) above.

- SQRT
Square-root law introduced by Diaz-Cordoves & Gimenez (1992).

- QUAD
Quadratic law introduced by Wade & Rucinski (1985).

- CLARET
Four-coefficient law introduced by Claret (2000) and given in equation (5) above.

The choice of law is made during grid construction (see the Grid Tools appendix for more details). The coefficients appearing in the limb-darkening laws (e.g., \(c\) and \(c_{k}\)) are typically determined from least-squares fits to tabulations of the specific intensity. In cases where these tabulations include flux but not specific intensity data, the CONST law is used; the angle-independent specific intensity is determined so that it produces the correct flux when evaluated using equation (3).

### Photospheric Parameter Dependence

The photospheric parameter dependence of the specific intensity is represented using cubic Hermite tensor product interpolation. The appendices provide a (relatively) gentle introduction to tensor product interpolation. The short version is that the intensity is modeled via piecewise-cubic functions of each component of \(\vx\), constructed to be continuous and smooth at the join between each piecewise region. The derivatives at these joins are estimated using second-order finite difference approximations involving neighboring points (or first-order at grid boundaries).

Grids often contain holes and/or ragged boundaries (the latter typically arising near the edge of the region of the \(\Teff-g\) plane corresponding to super-Eddington luminosity). When an interpolation tries to access such missing data, MSG either switches to a lower-order scheme, or (if there simply aren’t sufficient data to interpolate) signals an exception (see the Exception Handling chapter for further details).

## Observed Spectra

Suppose we observe a star from Earth, at a distance \(d\) along unit direction vector \(\vdhat\). The energy measured by a detector of area \(\areao\), within the usual wavelength and time intervals, is

(here and subsequently the superscript \(^{\obs}\) should be read as ‘observed’), where the observed flux is introduced as

The integral here is similar to that in equation (2), but \(\vshat\) has been replaced by \(-\vdhat\), the solid angle element \(\diff{\Omega}\) has been replaced by \(\diff{\area}/d^{2}\), and the bounds of the integral are limited to the parts of the stellar surface that are visible from Earth.

However, for stars that are spherical and have photospheric parameters that don’t vary across their surface, further simplifications can be made. Let \(\theta\) and \(\phi\) be the colatitude and azimuth angles in a spherical coordinate system centered on the star and with polar axis antiparallel to \(\vdhat\). Then, the observed flux becomes

where \(R\) is the stellar radius. Assuming an axisymmetric radiation field, this further reduces to

With the substitution \(\mu = \cos\theta\) (replacing a spatial coordinate \(\theta\) with a directional one \(\mu\)) the result pops out that

Don’t be fooled by the apparent triviality of this result: it means that we need only the elemental flux spectrum, and not the specific intensity, to calculate the observed spectrum of a star. This is why many spectral grids in the literature include flux spectra instead of specific intensity spectra.

However, remember that equation (7) applies only for spherically symmetric and fixed-\(\vx\) stars. In more complex situations, for instance when a star is rotationally oblate, spotted, pulsating or even eclipsed, evaluation of \(\fluxo\) must proceed via the visible-disk integration appearing in equation (6), which requires the specific intensity.

## Photometric Colors

To evaluate a photometric color, MSG convolves stellar spectra with an appropriate passband response function \(S'(\lambda)\). This function represents the combined sensitivity of the optical pathway, filter and detector. The passband-averaged specific intensity is defined as

meaning that \(S'(\lambda)\) is interpreted as an energy response function (see appendix A of Bessell & Murphy, 2012 for a discussion of the relationship between \(S'\) and the corresponding photon response function \(S\)). The passband-averaged observed flux follows from equation (6) as

and the apparent magnitude of the star is

where the normalizing flux \(\fluxz\) is set by the zero-point of the photometric system.

The convolution in (8) can be performed before or after the interpolations discussed above:

the ‘before’ option performs the convolution as a pre-processing step using the

**specgrid_to_photgrid**tool to create a*photgrid*file from a*specgrid*file (as discussed in the Importing Data section). This is computationally more efficient, but requires a separate*photgrid*file to be created for each passband.the ‘after’ option loads data from a

*specgrid*file, but performs the convolution on-the-fly after each spectrum is interpolated. This is computationally less efficient, but incurs no storage requirements beyond the*specgrid*file.