Commit 850d4a1e authored by Samuel Jackson's avatar Samuel Jackson
Browse files

Rename method getEnergy -> getEnergyTransfer

parent 3efe08ae
......@@ -126,7 +126,7 @@ public:
double getInitialEnergy() const override;
double getFinalEnergy() const override;
double getEnergy() const override;
double getEnergyTransfer() const override;
void setInitialEnergy(double m_initialEnergy) override;
void setFinalEnergy(double m_finalEnergy) override;
......
......@@ -714,7 +714,7 @@ double Peak::getFinalEnergy() const { return m_finalEnergy; }
double Peak::getInitialEnergy() const { return m_initialEnergy; }
/** Get the difference between the initial and final neutron energy */
double Peak::getEnergy() const { return getInitialEnergy() - getFinalEnergy(); }
double Peak::getEnergyTransfer() const { return getInitialEnergy() - getFinalEnergy(); }
//----------------------------------------------------------------------------------------------
/** Get the H index of the peak */
......
......@@ -63,7 +63,7 @@ public:
virtual double getInitialEnergy() const = 0;
virtual double getFinalEnergy() const = 0;
virtual double getEnergy() const = 0;
virtual double getEnergyTransfer() const = 0;
virtual void setInitialEnergy(double m_InitialEnergy) = 0;
virtual void setFinalEnergy(double m_FinalEnergy) = 0;
......
......@@ -128,8 +128,9 @@ void export_IPeak() {
"Get the initial (incident) neutron energy")
.def("getFinalEnergy", &IPeak::getFinalEnergy, arg("self"),
"Get the final neutron energy")
.def("getEnergy", &IPeak::getEnergy, arg("self"),
"Get the initial neutron energy minus the final neutron energy")
.def("getEnergyTransfer", &IPeak::getEnergyTransfer, arg("self"),
"Get the initial neutron energy minus the final neutron energy."
"\n\n.. versionadded:: 3.12.0")
.def("setInitialEnergy", &IPeak::setInitialEnergy,
(arg("self"), arg("initial_energy")),
"Set the initial (incident) neutron energy")
......@@ -141,7 +142,7 @@ void export_IPeak() {
"Return the error on the integrated peak intensity")
.def("getIntensityOverSigma", &IPeak::getIntensityOverSigma, arg("self"),
"Return the error on the integrated peak intensity divided by the "
"error in intensity")
"error in intensity.\n\n.. versionadded:: 3.12.0")
.def("setIntensity", &IPeak::setIntensity,
(arg("self"), arg("intensity")), "Set the integrated peak intensity")
.def("setSigmaIntensity", &IPeak::setSigmaIntensity,
......
......@@ -98,7 +98,7 @@ class IPeakTest(unittest.TestCase):
det_id = 101
expected_scattering_angle = 2.878973314094696
self._peak.setDetectorID(det_id)
self.assertEqual(self._peak.getScattering(), expected_scattering_angle)
self.assertAlmostEqual(self._peak.getScattering(), expected_scattering_angle)
def test_get_tof(self):
det_id = 101
......@@ -131,7 +131,7 @@ class IPeakTest(unittest.TestCase):
final_energy = 10.0
self._peak.setFinalEnergy(final_energy)
self._peak.setInitialEnergy(initial_energy)
self.assertAlmostEqual(self._peak.getEnergy(), initial_energy - final_energy)
self.assertAlmostEqual(self._peak.getEnergyTransfer(), initial_energy - final_energy)
def test_set_intensity(self):
intensity = 10.0
......@@ -166,7 +166,7 @@ class IPeakTest(unittest.TestCase):
det_id = 101
expected_det_pos = np.array([0.061999, 0.0135, -0.236032])
self._peak.setDetectorID(det_id)
npt.assert_almost_equal(self._peak.getDetPos(), expected_det_pos, self._tolerance)
npt.assert_allclose(self._peak.getDetPos(), expected_det_pos, atol=self._tolerance)
def test_get_l1(self):
det_id = 101
......
......@@ -89,7 +89,7 @@ public:
/// Label for wavelength column
static const QString WAVELENGTH;
/// Label for change in energy column
static const QString ENERGY;
static const QString ENERGY_TRANSFER;
/// Label for initial energy column
static const QString INITIAL_ENERGY;
/// Label for final energy column
......@@ -134,7 +134,7 @@ private:
/// Index for wavelength column
static const int COL_WAVELENGTH;
/// Index for change in energy column
static const int COL_ENERGY;
static const int COL_ENERGY_TRANSFER;
/// Index for initial energy column
static const int COL_INITIAL_ENERGY;
/// Index for final energy column
......
......@@ -35,7 +35,7 @@ void PeaksTableColumnsDialog::setVisibleColumns(const std::set<QString> &cols) {
ui->cb_wavelength->setChecked(isChecked);
isChecked =
bool(m_origVisible.find(QPeaksTableModel::ENERGY) != m_origVisible.end());
bool(m_origVisible.find(QPeaksTableModel::ENERGY_TRANSFER) != m_origVisible.end());
ui->cb_deltaE->setChecked(isChecked);
isChecked = bool(m_origVisible.find(QPeaksTableModel::INITIAL_ENERGY) !=
......@@ -110,7 +110,7 @@ std::set<QString> PeaksTableColumnsDialog::getVisibleColumns() {
updateChecked(result, QPeaksTableModel::DETID, ui->cb_detID->isChecked());
updateChecked(result, QPeaksTableModel::WAVELENGTH,
ui->cb_wavelength->isChecked());
updateChecked(result, QPeaksTableModel::ENERGY, ui->cb_deltaE->isChecked());
updateChecked(result, QPeaksTableModel::ENERGY_TRANSFER, ui->cb_deltaE->isChecked());
updateChecked(result, QPeaksTableModel::INITIAL_ENERGY,
ui->cb_ei->isChecked());
updateChecked(result, QPeaksTableModel::FINAL_ENERGY, ui->cb_ef->isChecked());
......
......@@ -48,7 +48,7 @@ const QString QPeaksTableModel::H = "h";
const QString QPeaksTableModel::K = "k";
const QString QPeaksTableModel::L = "l";
const QString QPeaksTableModel::WAVELENGTH("Wavelength");
const QString QPeaksTableModel::ENERGY("delta E");
const QString QPeaksTableModel::ENERGY_TRANSFER("delta E");
const QString QPeaksTableModel::INITIAL_ENERGY("E_i");
const QString QPeaksTableModel::FINAL_ENERGY("E_f");
const QString QPeaksTableModel::TOF("TOF");
......@@ -71,7 +71,7 @@ const int QPeaksTableModel::COL_L(4);
const int QPeaksTableModel::COL_WAVELENGTH(5);
const int QPeaksTableModel::COL_INITIAL_ENERGY(6);
const int QPeaksTableModel::COL_FINAL_ENERGY(7);
const int QPeaksTableModel::COL_ENERGY(8);
const int QPeaksTableModel::COL_ENERGY_TRANSFER(8);
const int QPeaksTableModel::COL_TOF(9);
const int QPeaksTableModel::COL_DSPACING(10);
const int QPeaksTableModel::COL_INT(11);
......@@ -104,7 +104,7 @@ int QPeaksTableModel::numCharacters(const int column) const {
return 3 + m_hklPrec;
else if (column == COL_WAVELENGTH)
return 6;
else if (column == COL_ENERGY)
else if (column == COL_ENERGY_TRANSFER)
return 6;
else if (column == COL_INITIAL_ENERGY)
return 6;
......@@ -151,7 +151,7 @@ QPeaksTableModel::QPeaksTableModel(
{5, WAVELENGTH},
{6, INITIAL_ENERGY},
{7, FINAL_ENERGY},
{8, ENERGY},
{8, ENERGY_TRANSFER},
{9, TOF},
{10, DSPACING},
{11, INT},
......@@ -179,7 +179,7 @@ QPeaksTableModel::QPeaksTableModel(
[](const IPeak &peak) { return QVariant(peak.getWavelength()); },
[](const IPeak &peak) { return QVariant(peak.getInitialEnergy()); },
[](const IPeak &peak) { return QVariant(peak.getFinalEnergy()); },
[](const IPeak &peak) { return QVariant(peak.getEnergy()); },
[](const IPeak &peak) { return QVariant(peak.getEnergyTransfer()); },
[](const IPeak &peak) { return QVariant(peak.getTOF()); },
[](const IPeak &peak) { return QVariant(peak.getDSpacing()); },
[](const IPeak &peak) { return QVariant(peak.getIntensity()); },
......@@ -219,7 +219,7 @@ QPeaksTableModel::QPeaksTableModel(
return QString::number(peak.getFinalEnergy(), 'f', 4);
},
[](const IPeak &peak) {
return QString::number(peak.getEnergy(), 'f', 4);
return QString::number(peak.getEnergyTransfer(), 'f', 4);
},
[](const IPeak &peak) { return QString::number(peak.getTOF(), 'f', 1); },
[](const IPeak &peak) {
......@@ -371,7 +371,7 @@ std::vector<int> QPeaksTableModel::defaultHideCols() {
else
showEnergy = true;
if (!showEnergy)
result.push_back(COL_ENERGY);
result.push_back(COL_ENERGY_TRANSFER);
}
} catch (Mantid::Kernel::Exception::NotFoundError &) {
// Unable to fetch instrument info, so continue without it.
......
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