Template Class SpecsynLibWD

Inheritance Relationships

Base Type

Class Documentation

template<OOBPolicy Policy>
class SpecsynLibWD : public specsyn::SpecsynLib2D<Policy>

A SpecsynLib2D specialization for white dwarf (and similarly log(g)/Teff-only) atmosphere grids.

Covers spectral libraries – like the Tremblay et al. pure- hydrogen (DA) white dwarf grids fetched by data/tools/spectra/fetch_tremblay.py, or the Rauch et al. NLTE hot star grid fetched by data/tools/spectra/fetch_rauch.py – whose spectra are parameterized by (log(g), Teff) alone, with no [Fe/H]/[alpha/Fe]/[C/Fe] axis at all, stored as four flat top-level HDF5 datasets: “wl”, “logg”, “log_Teff”, and “flux”. “flux” may be either a filled (n_logg, n_logTeff, n_wl) tensor (Tremblay’s grids, already a full rectangular grid as distributed) or a (n_models, n_wl) array alongside per-model “logg”/”log_Teff” values that don’t together form a filled grid (Rauch’s grid, missing some (log g, Teff) combinations at its hottest Teff values) – the constructor detects which from “flux“‘s own rank and dispatches to readFilledTensorGrid or readSparseGrid accordingly (see SpecsynLibWD.cpp). Either way this differs from the one-group-per-[Fe/H] layout SpecsynLibNoWind reads. dim2_, dim3_ (inherited from SpecsynLib, via SpecsynLib2D) hold log(g) and log(Teff) respectively, aliased here as logg_ and logTeff_ for readability – mirroring SpecsynLibNoWind’s identical FeH_/logg_/logTeff_ aliasing exactly. dim1_ is left empty (see SpecsynLib2D’s own comment): this class has no first axis at all, not even a degenerate one populated with a single placeholder value.

Template Parameters:

Policy – See SpecsynLib.

Public Functions

SpecsynLibWD(const std::string &spectraName, const std::string &registryName, double wlMin, double wlMax, std::size_t nWl, const io::SimControls &controls)

Construct a SpecsynLibWD from a white dwarf atmosphere grid on disk.

) as a flag to fall back on the library’s own native wavelength grid

Unlike SpecsynLibNoWind/SpecsynLibWR, this constructor takes no [Fe/H]/[alpha/Fe]/[C/Fe]/microturbulence/resolution arguments at all: white dwarf atmospheres here have none of those axes, and the registry’s “file” entry names the one and only HDF5 file this model reads from directly (no per-[Fe/H] group filtering, unlike findMatchingSpectra).

If nWl is nonzero, resamples onto nWl points log-spaced from wlMin to wlMax (via SpecsynLib::resample) after reading the library’s own native wavelength grid; if wlMin is 0 there (nWl alone was requested, without an explicit range), wlMin/ wlMax instead fall back to the front/back of that just-read native grid, keeping the caller’s requested point count. If nWl is 0, wl() simply returns the native grid as read from disk, unresampled. Mirrors SpecsynLibNoWind’s own identical resampling logic exactly.

Parameters:
  • spectraName – Name of the spectral model

  • registryName – Name of the spectral library registry file

  • wlMin – Minimum wavelength of the output grid, in Angstrom; if 0 (the default), used together with wlMax and nWl below (see

  • wlMax – Maximum wavelength of the output grid, in Angstrom; see wlMin

  • nWl – Number of points in the output grid; if 0 (the default), used as a flag to fall back on the library’s own native wavelength grid – see

  • controls – Simulation controls; forwarded unchanged to SpecsynLib2D’s own constructor – see its comment. Has no default of its own (unlike every parameter above): a reference bound to a temporary default-constructed SimControls would dangle the moment this constructor returned, since this class stores it live rather than copying out of it.

Throws:

std::runtime_error – if spectraName is not found in the registry, or its HDF5 file cannot be read, or its “flux” dataset’s shape does not match its “wl”/”logg”/ “log_Teff” datasets’ own sizes

virtual auto spec(const Specsyn::StarData &props, double feh) const -> std::vector<double> override

Compute a star’s spectrum by bilinear interpolation on the library grid.

Derives the star’s log(Teff) directly from props and checks it against logTeff_’s own range; then derives log(g) (and surface area) via Specsyn::getSAandLogg and checks that against logg_’s own range. If both checks pass, delegates the actual bilinear interpolation to SpecsynLib2D::spec(double, double) and scales the result by the star’s surface area to convert specific flux at the surface into specific luminosity.

Parameters:
  • props – Stellar properties, as produced by evaluating the Interpolator1D returned by Tracks2D::getIsochrone at this star’s mass

  • feh – [Fe/H] value of the star; unused, since this library has no [Fe/H] axis at all – present only because the Specsyn base class’s own spec() signature requires it

Throws:

std::runtime_error – if the star falls outside this library’s grid and Policy is OOBPolicy::raise

Returns:

The star’s spectrum, evaluated on the wavelength grid returned by wl(), in units of erg/s/Angstrom; a size-0 vector if the star falls outside this library’s (logg, Teff) grid and Policy is OOBPolicy::silent

virtual auto specForce(const Specsyn::StarData &props, double feh) const -> std::vector<double> override

Compute a star’s spectrum, forcing a result by moving log(g) to the nearest populated grid value if needed.

Overrides Specsyn::specForce() – see its own comment for when SpecsynLibChained calls this rather than spec(). Finds the (up to two) logTeff_ grid values bracketing this star’s own log(Teff); at each, searches every logg_ value for whichever is both populated and closest to this star’s own log(g) (derived via Specsyn::getSAandLogg), regardless of how far out of logg_’s own range that log(g) is. If only one bracketing logTeff column has any populated log(g) value at all, returns that single grid point’s own spectrum (scaled by surface area); if both do, linearly interpolates the two (independently log(g)-snapped) spectra in log(Teff), using the ordinary bracket weight for each – mirroring the renormalized-weight pattern SpecsynLib2D::spec(double, double)’s own OOBPolicy::coerce handling uses for a partially-populated interpolation cell.

Parameters:
  • props – Stellar properties, as produced by evaluating the Interpolator1D returned by Tracks2D::getIsochrone at this star’s mass

  • feh – [Fe/H] value of the star; unused, since this library has no [Fe/H] axis at all – present only because Specsyn’s own specForce() signature requires it

Throws:

std::runtime_error – if log(Teff) itself falls entirely outside logg_/logTeff_’s own range (so not even a bracketing logTeff column exists to search), or if neither bracketing logTeff column has any populated log(g) value at all

Returns:

The star’s spectrum, evaluated on the wavelength grid returned by wl(), in units of erg/s/Angstrom – never a size-0 vector

inline auto logTeff() const -> const std::vector<double>&

This library’s log10(effective temperature) grid points.

Exposed for SpecsynLibChained’s benefit, which needs to scan every chained library’s own logTeff_ range (alongside SpecsynLibNoWind’s and SpecsynLibWR’s) to derive a global (logTeffMin, logTeffMax) clamp – see its tClamp constructor argument. Mirrors SpecsynLibNoWind’s identical logTeff() exactly.

inline auto logg() const -> const std::vector<double>&

This library’s log(g) grid points.

Exposed for SpecsynLibChained’s benefit, which needs to scan every chained SpecsynLibNoWind/SpecsynLibWD library’s own logg_ range to derive a global (loggMin, loggMax) clamp – see its tClamp constructor argument. Mirrors SpecsynLibNoWind’s identical logg() exactly.

inline virtual auto loggMin() const -> double override

The minimum log(g) this library has real spectral data for.

Returns:

logg_.front() – see Specsyn::loggMin()’s own comment for why this override exists

inline virtual auto loggMax() const -> double override

The maximum log(g) this library has real spectral data for.

Returns:

logg_.back() – see Specsyn::loggMin()’s own comment for why this override exists