Grid Voids
This chapter explains the causes and workarounds for ‘voids’ —
regions of the photospheric parameter space spanned by a grid where MSG
is unable to perform an interpolation. Attempts to interpolate in a
void result in a STAT_UNAVAILABLE_DATA status code (Fortran and C),
or a LookupError exception (Python).
Causes of Voids
MSG’s Tensor Product Interpolation algorithm divides an \(N\)-dimensional grid into cells. Each cell is an \(N\)-dimensional hyperrectangle; in one dimension, this is a line segment, in two a rectangle, and so on. To perform an interpolation in a given cell, MSG requires that all \(2^{N}\) vertices (corners) of the cell have a spectral (or photometric) data associated with them. If this isn’t the case, the cell cannot be used for interpolation, and is considered a void.
The Eddington Limit
Most spectral synthesis codes require that the underlying model atmosphere remains in hydrostatic equilibrium. This in turn requires that the outward radiative acceleration in the atmosphere,
be less than the inward gravitational acceleration \(g\). Here, \(F\) is the bolometric flux, \(c\) is the speed of light, and
is the flux-weighted mean of the opacity \(\kappa\). Recall that the effective temperature \(\Teff\) is defined in terms of the bolometric flux by
where \(\sigma\) is the Stefan-Boltzmann constant. The condition for hydrostatic equilibrium can then be expressed as
where
is the so-called Eddington factor. Violation of this inequality is a principal reason why grids lack data (and therefore have voids) at the high-\(\Teff\), low-\(g\) region of photospheric parameter space.
Convergence Limits
Although the Eddington limit (10) places a hard lower bound on the surface gravity at a given effective temperature, in practice the actual lower bound is somewhat larger. This is because spectral synthesis codes tend to have difficulty converging to solutions that are close to the limit.
Convergence can also prove difficult in extreme parts of photospheric parameters space — for instance, at the highest or lowest metallicities. In some cases the resulting voids can be filled in with manual intervention (e.g., by tweaking numerical parameters of the synthesis code); but often this would be too time consuming, and the end-users of the grid (us!) have to cope as best we can.
Parameter Adjustment
One approach to mitigating the impact of voids is to adjust photospheric parameters until they fall within a defined part of the grid. Typically, one hopes that the adjustment has only a small effect on the resulting interpolated spectrum.
MSG provides routines to help with this adjustment; for spectral
grids, these are pymsg.SpecGrid.adjust_x() (Python),
specgrid_t%adjust() (Fortran), and
adjust_specgrid_x_vec() (C). These all accept a starting set
of photospheric parameters and a direction to adjust in. The following
Python code, which uses the demo grid, demonstrates how one might
handle grid voids by adjusting parameters in the direction of
increasing \(g\).
# Import standard modules
import os
import numpy as np
import astropy.constants as con
import astropy.units as unt
import matplotlib.pyplot as plt
# Import pymsg
import pymsg
# Create the SpecGrid object
MSG_DIR = os.environ['MSG_DIR']
GRID_DIR = os.path.join(MSG_DIR, 'data', 'grids')
specgrid_file_name = os.path.join(GRID_DIR, 'sg-demo.h5')
specgrid = pymsg.SpecGrid(specgrid_file_name)
# Set up photospheric parametets
x = {'Teff': 15000., 'log(g)': 2.3}
# Attemt an interpolation
lam = np.array([3000., 4000., 5000.])
try:
flux = specgrid.flux(x, 0., lam)
except LookupError:
# Adjust parameters
dx = {'Teff': 0., 'log(g)': 1.0}
x = specgrid.adjust_x(x, dx)
# Attempt again
flux = specgrid.flux(x, 0., lam)