Function closeAge

Function Documentation

vector<bool> closeAge(vector<double> ageSel, vector<double> age)

Identifies which ages in a library match a set of target selection ages.

  • This function creates a boolean mask for a vector of ages. If no specific target ages are provided (only the bounds), all ages are selected. Otherwise, it finds the closest match in the library for each target age, provided the match is within a tolerance (1e6yr) and falls within the specified [agemin, agemax] range.

  • ageSel[0] is the minimum allowed age (agemin).

  • ageSel[1] is the maximum allowed age (agemax).

  • ageSel[2…n] are the specific target ages to select.

Note

If agemax <= 0, the upper bound check is ignored.

Note

The matching tolerance is strictly hardcoded at 1e6yr.

Parameters:
  • ageSel – A vector where:

  • age – The library of available ages to be filtered.

Returns:

std::vector<bool> A mask of the same size as the ‘age’ parameter. True if the age is selected, False otherwise.