A stellar evolution interpolator based on the MESA tracks. More...
#include <MESAIO.h>
Public Member Functions | |
Interpolator () | |
Interpolator (const std::string &model_directory, unsigned num_threads, const std::vector< double > &smoothing=__default_smoothing, const std::vector< int > &nodes=__default_nodes, const std::vector< bool > &vs_log_age=__default_vs_log_age, const std::vector< bool > &log_quantity=__default_log_quantity) | |
Creates a stellar evolution interpolator based on evolution tracks computed with MESA. More... | |
Public Member Functions inherited from StellarEvolution::Interpolator | |
Interpolator () | |
Construct an object that can be set to interpolate between tabulated evolution tracks. More... | |
Interpolator (const std::valarray< double > &tabulated_masses, const std::valarray< double > &tabulated_feh, const std::list< std::valarray< double > > &tabulated_ages, const std::vector< std::list< std::valarray< double > > > &tabulated_quantities, const std::vector< double > &smoothing, const std::vector< int > &nodes, const std::vector< bool > &vs_log_age, const std::vector< bool > &log_quantity, unsigned num_threads) | |
Creates a fully functional stellar evolution interpolator. More... | |
void | create_from (const std::valarray< double > &tabulated_masses, const std::valarray< double > &tabulated_feh, const std::list< std::valarray< double > > &tabulated_ages, const std::vector< std::list< std::valarray< double > > > &tabulated_quantities, const std::vector< double > &smoothing, const std::vector< int > &nodes, const std::vector< bool > &vs_log_age, const std::vector< bool > &log_quantity, unsigned num_threads) |
Fully setup an object created by the default constructor. More... | |
virtual EvolvingStellarQuantity * | operator() (QuantityID quantity, double mass, double feh) const |
Return a single quantity interpolation to a given mass and [Fe/H]. More... | |
virtual double | core_formation_age () const |
The age at which the core begins to form in Gyr. More... | |
virtual void | save_state (const std::string &filename="../interp_state_data") const |
Serializes the interpolation state to file. More... | |
virtual void | load_state (const std::string &filename="../interp_state_data") |
Loads data from serialization. More... | |
void | delete_tracks () |
Free all evolution tracks, rendering all created quantities unuseable! More... | |
Static Public Member Functions | |
static double | default_smoothing (StellarEvolution::QuantityID quantity) |
The default smoothing argument used for a given quantity. More... | |
static const std::vector< double > & | default_smoothing () |
Return the default smoothing argument to pass to constructor. More... | |
static int | default_nodes (StellarEvolution::QuantityID quantity) |
The default interpolation nodes used for a given quantity. More... | |
static const std::vector< int > & | default_nodes () |
Return the default nodes argument to pass to constructor. More... | |
static bool | default_vs_log_age (StellarEvolution::QuantityID quantity) |
By default is the given quantity interpolated vs log(age)? More... | |
static const std::vector< bool > & | default_vs_log_age () |
Return the default vs_log_age argument to pass to constructor. More... | |
static bool | default_log_quantity (StellarEvolution::QuantityID quantity) |
By default is the log(given quantity) interpolated? More... | |
static const std::vector< bool > & | default_log_quantity () |
Return the default log_quantity argument to pass to constructor. More... | |
Private Member Functions | |
bool | parse_model_file_name (const std::string &filename) |
Parse the mass (in \(M_\odot\)) and [Fe/H] from a track filename. More... | |
void | sort_last_track_by_age () |
Sorts the quantities read from the last track by age. More... | |
void | read_model_file (const std::string &filename) |
Reads a single evolution track file. More... | |
void | log_current_age_ranges () const |
Output the current masses [Fe/H] and age ranges. More... | |
void | get_mass_feh_grid (std::valarray< double > &masses, std::valarray< double > &feh) |
Verify that the track masses and [Fe/H] form a grid and return the grid. More... | |
EvolutionIterator | begin () |
Returns an EvolutionIterator pointing to the beginning of all quantities. More... | |
EvolutionIterator | end () |
Returns an EvolutionIterator pointing to the end of all quantities. More... | |
void | move (EvolutionIterator &dest, EvolutionIterator &source) |
Moves source to right before destination. More... | |
void | sort_tracks () |
Sorts the data by mass and [Fe/H]. More... | |
Private Attributes | |
std::list< double > | __mass_list |
The masses of the available tracks in the order read. More... | |
std::list< double > | __feh_list |
The [Fe/H] values of the available tracks in the order read. More... | |
std::list< std::valarray< double > > | __track_ages |
The ages at which each track is tabulated. More... | |
std::vector< std::list< std::valarray< double > > > | __track_quantities |
A structure holding all interesting quantities from the MESA tracks except age. More... | |
Static Private Attributes | |
static const std::vector< QuantityID > | __column_to_quantity |
The value at the indexed from Column is the StellarEvolution::QuantityID to which this column is converted. More... | |
static const std::vector< double > | __default_smoothing |
The default amount of smoothing to use for each quantity. See StellarEvolution::Interpolator::create_from. More... | |
static const std::vector< int > | __default_nodes |
The default number of node to use for each quantity. See StellarEvolution::Interpolator::create_from. More... | |
static const std::vector< bool > | __default_vs_log_age |
The default selection of interpolation argument (age vs log(age) for each quantity. See StellarEvolution::Interpolator::create_from. More... | |
static const std::vector< bool > | __default_log_quantity |
The default selection of interpolation function (quantity vs log(quantity) for each quantity. See StellarEvolution::Interpolator::create_from. More... | |
|
inline |
StellarEvolution::MESA::Interpolator::Interpolator | ( | const std::string & | model_directory, |
unsigned | num_threads, | ||
const std::vector< double > & | smoothing = __default_smoothing , |
||
const std::vector< int > & | nodes = __default_nodes , |
||
const std::vector< bool > & | vs_log_age = __default_vs_log_age , |
||
const std::vector< bool > & | log_quantity = __default_log_quantity |
||
) |
Creates a stellar evolution interpolator based on evolution tracks computed with MESA.
model_directory | The directory containing the MESA evolution tracks |
num_threads | How many threads to use for simultaneous interpolation. |
smoothing | How much to smooth each stellar evolution quantity when fitting. Use NaN for no smoothing. See StellarEvolution::QuantityID for the order of the quantities. |
nodes | How many nodes to use when smoothing each stellar evolution quantity. Ignored if smooth_conv_inertia is NaN - no smoothing. |
Negative values result in using min(-nodes[i], number of tabulated ages for each track).
vs_log_age | Should interpolation be done vs. log(age) instead of age for each quantity? |
log_quantity | Should interpolation be done of log(quantity) instead of quantity for each quantity? |
Definition at line 535 of file MESAIO.cpp.
|
private |
Returns an EvolutionIterator pointing to the beginning of all quantities.
Definition at line 444 of file MESAIO.cpp.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
private |
Returns an EvolutionIterator pointing to the end of all quantities.
Definition at line 456 of file MESAIO.cpp.
|
private |
Verify that the track masses and [Fe/H] form a grid and return the grid.
masses | Output argument: the list of stellar masses in the grid (sorted and unique values only). |
feh | Output argument: the list of stellar [Fe/H] in the grid (sorted and unique values only). |
Definition at line 378 of file MESAIO.cpp.
|
private |
Output the current masses [Fe/H] and age ranges.
Definition at line 233 of file MESAIO.cpp.
|
private |
Moves source to right before destination.
Definition at line 468 of file MESAIO.cpp.
|
private |
Parse the mass (in \(M_\odot\)) and [Fe/H] from a track filename.
If the filaneme follows the expected pattern, add the parsed values to ::__mass_list and ::__feh_list respectively and return true. If the filename is not formatted as expected return false and leave ::__mass_list and ::__feh_list unchanged.
Definition at line 252 of file MESAIO.cpp.
|
private |
Reads a single evolution track file.
Definition at line 330 of file MESAIO.cpp.
|
private |
Sorts the quantities read from the last track by age.
Definition at line 296 of file MESAIO.cpp.
|
private |
Sorts the data by mass and [Fe/H].
Definition at line 494 of file MESAIO.cpp.
|
staticprivate |
|
staticprivate |
The default selection of interpolation function (quantity vs log(quantity) for each quantity. See StellarEvolution::Interpolator::create_from.
|
staticprivate |
The default number of node to use for each quantity. See StellarEvolution::Interpolator::create_from.
|
staticprivate |
The default amount of smoothing to use for each quantity. See StellarEvolution::Interpolator::create_from.
|
staticprivate |
The default selection of interpolation argument (age vs log(age) for each quantity. See StellarEvolution::Interpolator::create_from.
|
private |
|
private |
|
private |
|
private |
A structure holding all interesting quantities from the MESA tracks except age.
The innermost valarray is a particular parameter for a particular track as a function of age.
The middle list holds the same quantity for all tracks and is in the same order as __mass_list.
The outside array is indexed by quantity identified by StellarEvolution::QuantityID.