##// END OF EJS Templates
Updates AMDA result parser to accept NaN values...
Alexandre Leroux -
r496:10850ea661a6
parent child
Show More
@@ -93,15 +93,23 QPair<QVector<double>, QVector<double> > readResults(QTextStream &stream)
93 bool valueOk;
93 bool valueOk;
94 auto value = lineData.at(1).toDouble(&valueOk);
94 auto value = lineData.at(1).toDouble(&valueOk);
95
95
96 // Adds result only if x and value are valid
96 // Adds result only if x is valid. Then, if value is invalid, it is set to NaN
97 if (!std::isnan(x) && !std::isnan(value) && valueOk) {
97 if (!std::isnan(x)) {
98 xData.push_back(x);
98 xData.push_back(x);
99
100 if (!valueOk) {
101 qCWarning(LOG_AmdaResultParser())
102 << QObject::tr(
103 "Value from line %1 is invalid and will be converted to NaN")
104 .arg(line);
105 value = std::numeric_limits<double>::quiet_NaN();
106 }
107
99 valuesData.push_back(value);
108 valuesData.push_back(value);
100 }
109 }
101 else {
110 else {
102 qCWarning(LOG_AmdaResultParser())
111 qCWarning(LOG_AmdaResultParser())
103 << QObject::tr(
112 << QObject::tr("Can't retrieve results from line %1: x is invalid")
104 "Can't retrieve results from line %1: x and/or value are invalid")
105 .arg(line);
113 .arg(line);
106 }
114 }
107 }
115 }
General Comments 0
You need to be logged in to leave comments. Login now