Template Class SpecsynLibNoWind
Defined in File SpecsynLibNoWind.hpp
Inheritance Relationships
Base Type
public specsyn::SpecsynLib< Policy >(Template Class SpecsynLib)
Class Documentation
-
template<OOBPolicy Policy>
class SpecsynLibNoWind : public specsyn::SpecsynLib<Policy> A SpecsynLib specialization for stars without optically thick winds.
Covers spectral libraries – like BOSZ and TLUSTY – whose spectra sit on a (FeH, logg, Teff) tensor grid, one HDF5 file per library, following the conventions of data/tools/spectra/fetch_bosz.py and data/tools/spectra/fetch_tlusty.py: groups named spectra_feh<feh>… holding one dataset per (Teff, logg) pair actually present, plus a top-level wavelengths group. dim1_, dim2_, dim3_ (inherited from SpecsynLib) hold FeH, logg, and log(Teff) respectively, aliased here as FeH_, logg_, and logTeff_ for readability. Interpolating in log(Teff) rather than Teff itself matches SpecsynLibWR, even though the archives this class reads from (e.g. BOSZ, TLUSTY) store Teff directly – see the constructor’s own log10 conversion.
This is the counterpart to SpecsynLibWR, which instead covers Wolf-Rayet spectral libraries – stars with optically thick winds – parameterized by fundamentally different variables (stellar temperature and transformed radius, rather than Teff and logg).
- Template Parameters:
Policy – See SpecsynLib.
Public Functions
-
SpecsynLibNoWind(const std::string &spectraName, double fehMin, double fehMax, double afe, double cfe, double microTurb, double r, const std::string ®istryName, double wlMin, double wlMax, std::size_t nWl, const io::SimControls &controls)
Construct a SpecsynLibNoWind from a spectral library on disk.
) as a flag to fall back on the library’s own native wavelength grid
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.- Parameters:
spectraName – Name of the spectral model
fehMin – Minimum [Fe/H] value
fehMax – Maximum [Fe/H] value
afe – Value of [alpha/Fe]
cfe – Value of [C/Fe]
microTurb – Microturbulent velocity, in km/s; if NaN (the default), uses this library’s own micro_default value from the registry instead, since a sensible default microturbulence is library-specific (e.g. hot, massive OB stars are conventionally modeled with substantially more microturbulence than cooler, lower-mass stars) rather than a single constant that fits every library equally well
r – Spectral resolution
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 Specsyn’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.
-
virtual auto spec(const Specsyn::StarData &props, double feh) const -> std::vector<double> override
Compute a star’s spectrum by trilinear interpolation on the library grid.
Derives the star’s log(Teff) and log(g) from props (via Specsyn::getSAandLogg for the latter) and checks that (feh, logg, log(Teff)) falls within the grid built by the constructor, then delegates the actual trilinear interpolation to SpecsynLib::spec(double, double, double) – which also confirms every one of the 8 neighboring grid points has an actual spectrum, since interpolating across an unpopulated point would be meaningless – and finally 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; needed because it is not carried by props itself
- 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 (FeH, 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(). Mirrors SpecsynLibWD::specForce() exactly, extended to this class’s extra feh axis: finds the (up to four) (feh, logTeff) grid-index corners bracketing this star’s own (feh, 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. Corners with a populated log(g) value contribute their own single grid point’s spectrum, weighted by the ordinary (feh, logTeff) bilinear weight and renormalized by the sum of weights actually used – exactly the OOBPolicy::coerce
renormalization pattern SpecsynLib::spec(double, double,
double) uses for a partially-populated interpolation cell – so this reduces to returning a single corner’s own spectrum unscaled when only one corner has any populated log(g) value, and to a proper (feh, logTeff)-weighted blend when more than one does.
- 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; needed because it is not carried by props itself
- Throws:
std::runtime_error – if feh or log(Teff) themselves fall entirely outside FeH_/logTeff_’s own range (so not even a bracketing (feh, logTeff) corner exists to search), or if none of the (up to four) bracketing (feh, logTeff) corners 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 SpecsynLibWR’s) to derive a global (logTeffMin, logTeffMax) clamp – see its tClamp constructor argument.
-
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 library’s own logg_ range to derive a global (loggMin, loggMax) clamp – see its tClamp constructor argument. SpecsynLibWR has no equivalent, since Wolf-Rayet atmospheres aren’t parameterized by logg at all.
-
inline virtual auto fehMin() const -> double override
The minimum [Fe/H] this library has real spectral data for.
- Returns:
FeH_.front() – see Specsyn::fehMin()’s own comment for why this override exists
-
inline virtual auto fehMax() const -> double override
The maximum [Fe/H] this library has real spectral data for.
- Returns:
FeH_.back() – see Specsyn::fehMin()’s own comment for why this override exists
-
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