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 subintervals. Each subinterval 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 subinterval, MSG requires that all \(2^{N}\) vertices (corners) of the subinterval have a spectral (or photometric) data associated with them. If this isn’t the case, the subinterval cannot be used for interpolation, and is considered a void.
The Hydrostatic Limit
Most spectral synthesis codes require that the underlying model atmosphere be in hydrostatic equilibrium — that is, 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
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 hydrostatic limit (9) 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 specgrid_t%adjust()
(Fortran),
adjust_specgrid_x_vec()
(C), and
pymsg.SpecGrid.adjust_x()
(Python). 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
# Load the SpecGrid
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 atmosphere parametets
x = {'Teff': 15000., 'log(g)': 2.3}
# Attemt an interpolation
lam = np.array([3000., 4000., 5000.])
try:
flux = specgrid.flux(x, lam)
except LookupError:
# Adjust parameters
dx = {'Teff': 0., 'log(g)': 1.0}
x = specgrid.adjust_x(x, dx)
# Attempt again
flux = specgrid.flux(x,lam)