diff --git a/Device/IO/ReadReflectometry.cpp b/Device/IO/ReadReflectometry.cpp index 8fddee96208a62f29574d2d5332d1a910ec09a90..45ec3edacfe175a2f65de4efac1338d6fde12f11 100644 --- a/Device/IO/ReadReflectometry.cpp +++ b/Device/IO/ReadReflectometry.cpp @@ -36,7 +36,10 @@ Datafield* ReadReflectometry::readDatafield(std::istream& inStream) // #bamigration +++ this works only if separator is space or tab; it does not // work e.g. with comma or semicolon std::vector<double> rowVec = DataUtils::Format::parse_doubles(line); - vecVec.push_back(rowVec); + + // take only non-negative Q values + if (rowVec[0] >= 0.0) + vecVec.push_back(rowVec); } catch (...) { // #bamigration +++ This eats useful errors away... continue; } diff --git a/GUI/View/Loaders/QREDataLoader.cpp b/GUI/View/Loaders/QREDataLoader.cpp index de599b0ee8bda6b65406f0783fac78ea89eb2a52..52865ed6b6ad4f97a2fba0b55edce3401d2c010d 100644 --- a/GUI/View/Loaders/QREDataLoader.cpp +++ b/GUI/View/Loaders/QREDataLoader.cpp @@ -501,6 +501,11 @@ void QREDataLoader::calculateFromParseResult() const continue; } + if (q < 0.0) { + m_importResult.addError(lineNr, ErrorDefinition::QLessZero, q); + continue; + } + if (r > 1.0 && !m_importSettings.allowValuesGreaterOne) { m_importResult.addError(lineNr, ErrorDefinition::RGreaterOne, r); continue; @@ -761,6 +766,10 @@ QString QREDataLoader::ErrorDefinition::toString() const return QString("The value %1 for R is less than 0 - line is discarded") .arg(std::get<double>(data)); + case QLessZero: + return QString("The value %1 for Q is less than 0 - line is discarded") + .arg(std::get<double>(data)); + default: return "Unspecified error"; } diff --git a/GUI/View/Loaders/QREDataLoader.h b/GUI/View/Loaders/QREDataLoader.h index d034d9d2b57be8ecb0a153ae37d63a00ac4f2a3b..b729501448306ff72476790131c7cad83cf61cf5 100644 --- a/GUI/View/Loaders/QREDataLoader.h +++ b/GUI/View/Loaders/QREDataLoader.h @@ -88,7 +88,8 @@ private: columnDoesNotContainValidNumber = 1, duplicateQ = 2, RGreaterOne = 3, - RLessZero = 4 + RLessZero = 4, + QLessZero = 5 }; ErrorDefinition(Type t = none, int d = 0);