From 0a5e06985f5d692340858d54cb9fc188f0033407 Mon Sep 17 00:00:00 2001 From: danielmaclaren Date: Mon, 7 Sep 2026 15:37:56 +0100 Subject: [PATCH] handle header section of file when passing calibration limits --- utilitiesApp/src/find_calibration_range_impl.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/utilitiesApp/src/find_calibration_range_impl.cpp b/utilitiesApp/src/find_calibration_range_impl.cpp index 34d3e31..52d6793 100644 --- a/utilitiesApp/src/find_calibration_range_impl.cpp +++ b/utilitiesApp/src/find_calibration_range_impl.cpp @@ -70,8 +70,19 @@ long find_calibration_range_impl(aSubRecord *prec) { return 1; } - // Get highest and lowest values in the first column of the calibration file - double low_limit = std::stod(lines[0][0]); + // Get highest and lowest values in the first column of the calibration file + // skip over lines which start with '#' as they are the header. + int first_value = 0; + for (auto& line : lines) { + if (line[0].rfind("#", 0) == 0) { + first_value++; + } + else { + break; + } + } + + double low_limit = std::stod(lines[first_value][0]); double high_limit = std::stod(lines[lines.size() - 1][0]); // Check the types of output values