Commit a6f561ef authored by Samuel Jackson's avatar Samuel Jackson
Browse files

Refs #20441 Fix comments from code review

parent b1e0aade
......@@ -796,9 +796,8 @@ double Peak::getSigmaIntensity() const { return m_sigmaIntensity; }
/** Return the peak intensity divided by the error in the intensity */
double Peak::getIntensityOverSigma() const {
if (m_sigmaIntensity == 0)
return 0;
return m_intensity / m_sigmaIntensity;
const auto result = m_intensity / m_sigmaIntensity;
return (std::isinf(result)) ? 0.0 : result;
}
/** Set the integrated peak intensity
......
......@@ -572,14 +572,16 @@ public:
void test_get_intensity_over_sigma_empty_sigma() {
const int detectorId = 19999;
const double wavelength = 2;
const double intensity{0};
const double intensity{10};
const double sigma{0};
Peak p(inst, detectorId, wavelength);
p.setIntensity(intensity);
p.setSigmaIntensity(sigma);
TS_ASSERT_DELTA(p.getIntensityOverSigma(), 0, 1e-10);
const double expectedResult {0.0};
const double tolerance {1e-10};
TS_ASSERT_DELTA(p.getIntensityOverSigma(), expectedResult, tolerance);
}
void test_get_energy() {
......
......@@ -174,27 +174,28 @@ QPeaksTableModel::QPeaksTableModel(
},
[](const IPeak &peak) { return QVariant(peak.getRow()); },
[](const IPeak &peak) { return QVariant(peak.getCol()); },
[&v3dAsString](const IPeak &peak) {
return v3dAsString(peak.getQLabFrame());
[](const IPeak &peak) {
return QVariant(peak.getQLabFrame().norm());
},
[&v3dAsString](const IPeak &peak) {
return v3dAsString(peak.getQSampleFrame());
[](const IPeak &peak) {
return QVariant(peak.getQSampleFrame().norm());
},
};
const auto hklPrec = m_hklPrec;
// Mapping member functions of the Peak object to a column index with
// formatting for displaying data to the user
m_formattedValueLookup = {
[](const IPeak &peak) { return QString::number(peak.getRunNumber()); },
[](const IPeak &peak) { return QString::number(peak.getDetectorID()); },
[this](const IPeak &peak) {
return QString::number(peak.getH(), 'f', m_hklPrec);
[&hklPrec](const IPeak &peak) {
return QString::number(peak.getH(), 'f', hklPrec);
},
[this](const IPeak &peak) {
return QString::number(peak.getK(), 'f', m_hklPrec);
[&hklPrec](const IPeak &peak) {
return QString::number(peak.getK(), 'f', hklPrec);
},
[this](const IPeak &peak) {
return QString::number(peak.getL(), 'f', m_hklPrec);
[&hklPrec](const IPeak &peak) {
return QString::number(peak.getL(), 'f', hklPrec);
},
[](const IPeak &peak) {
return QString::number(peak.getWavelength(), 'f', 4);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment