Function read_ages_from_file
Defined in File SEDLib.h
Function Documentation
-
vector<double> read_ages_from_file(string filename, double agemin, double agemax)
Reads galaxy ages from a file and returns them in a vector.
This function creates a vector where the first two elements are agemin and agemax. If a valid filename is provided, it parses the file line-by-line, skipping comments (lines starting with #), and converts the values from Gyr to years.
Note
Ages in the file are assumed to be in Gyr and are converted to years.
Warning
If the file cannot be opened, an error is printed to cerr but the function returns the vector containing only agemin and agemax.
- Parameters:
filename – Name of the file to read. Use “none” to skip file reading.
agemin – Minimum age boundary (stored at index 0).
agemax – Maximum age boundary (stored at index 1).
- Returns:
std::vector<double> A vector containing [agemin, agemax, age1*1e9, age2*1e9, …].