Resetting of the normalization choice without communication
The following method checks the value of the fraction num/den
which is used as a normalization factor for the intensity data.
If the value of this fraction is not a number, then the choice is set back to eNorm::NONE
and the value 1 is returned.
This is on the first look fine, but the changed choice is from a combobox on the GUI. This should be communicated to the user in a direct way (MessageBox or similar way). There is a good chance that is just overlooked when this is not properly communicated. In case it is detected by the user then it is still easy to wrongly identify it as an software bug.
double Sequence::normFactor() const
{
double num = 1, den = 1; // numerator, denominator
switch ((eNorm)gSession->params.howtoNormalize.val()) {
case eNorm::MONITOR:
num = gSession->activeClusters.grandAvgMonitorCount.yield();
den = avgMonitorCount();
break;
case eNorm::DELTA_MONITOR:
num = gSession->activeClusters.grandAvgDeltaMonitorCount.yield();
den = avgDeltaMonitorCount();
break;
case eNorm::TIME:
num = gSession->activeClusters.grandAvgTime.yield();
den = avgTime();
break;
case eNorm::DELTA_TIME:
num = gSession->activeClusters.grandAvgDeltaTime.yield();
den = avgDeltaTime();
break;
case eNorm::NONE: break;
}
double ret = float((num > 0 && den > 0) ? num / den : Q_QNAN);
if (qIsNaN(ret)) {
gSession->params.howtoNormalize.setVal((int)eNorm::NONE);
ret = 1;
std::cerr << "Bad normalisation value.\n normalization reset to 'None'." << std::endl;
}
return ret;
}