Commit ade8249f authored by Lynch, Vickie's avatar Lynch, Vickie
Browse files

Refs #21752 expose azimuthal angle and bank to python

parent bc6b60f4
......@@ -111,16 +111,17 @@ public:
Mantid::Kernel::V3D getDetectorPosition() const override;
Mantid::Kernel::V3D getDetectorPositionNoCheck() const override;
void setQSampleFrame(
const Mantid::Kernel::V3D &QSampleFrame,
boost::optional<double> detectorDistance = boost::none) override;
void
setQLabFrame(const Mantid::Kernel::V3D &QLabFrame,
boost::optional<double> detectorDistance = boost::none) override;
void setQSampleFrame(const Mantid::Kernel::V3D &QSampleFrame,
boost::optional<double> detectorDistance =
boost::none) override;
void setQLabFrame(const Mantid::Kernel::V3D &QLabFrame,
boost::optional<double> detectorDistance =
boost::none) override;
void setWavelength(double wavelength) override;
double getWavelength() const override;
double getScattering() const override;
double getAzimuthal() const override;
double getDSpacing() const override;
double getTOF() const override;
......
......@@ -423,6 +423,15 @@ double Peak::getScattering() const {
return detDir.angle(beamDir);
}
// -------------------------------------------------------------------------------------
/** Calculate the azimuthal angle of the peak */
double Peak::getAzimuthal() const {
// The detector is at 2 theta scattering angle
V3D detDir = detPos - samplePos;
return atan2(detDir.Y(), detDir.X());
}
// -------------------------------------------------------------------------------------
/** Calculate the d-spacing of the peak, in 1/Angstroms */
double Peak::getDSpacing() const {
......
......@@ -194,7 +194,8 @@ void PeakColumn::read(const size_t index, std::istringstream &in) {
double val;
try {
in >> val;
} catch (std::exception &e) {
}
catch (std::exception &e) {
g_log.error() << "Could not convert input to a number. " << e.what()
<< '\n';
return;
......@@ -293,6 +294,7 @@ const void *PeakColumn::void_pointer(size_t index) const {
&value); // Given a pointer it will return a pointer
} else if (m_name == "RunNumber") {
value = peak.getRunNumber();
return boost::get<int>(&value);
} else if (m_name == "PeakNumber") {
value = peak.getPeakNumber();
return boost::get<int>(&value);
......
......@@ -58,6 +58,7 @@ public:
virtual void setWavelength(double wavelength) = 0;
virtual double getWavelength() const = 0;
virtual double getScattering() const = 0;
virtual double getAzimuthal() const = 0;
virtual double getDSpacing() const = 0;
virtual double getTOF() const = 0;
......
......@@ -63,6 +63,8 @@ void export_IPeak() {
"Return the run number this peak was measured at")
.def("getPeakNumber", &IPeak::getPeakNumber, arg("self"),
"Return the peak number for this peak")
.def("getBankName", &IPeak::getBankName, arg("self"),
"Return the bank name for this peak")
.def("setRunNumber", &IPeak::setRunNumber,
(arg("self"), arg("run_number")),
"Set the run number that measured this peak")
......@@ -127,6 +129,8 @@ void export_IPeak() {
"Return the incident wavelength")
.def("getScattering", &IPeak::getScattering, arg("self"),
"Calculate the scattering angle of the peak")
.def("getAzimuthal", &IPeak::getAzimuthal, arg("self"),
"Calculate the azimuthal angle of the peak")
.def("getDSpacing", &IPeak::getDSpacing, arg("self"),
"Calculate the d-spacing of the peak, in 1/Angstroms")
.def("getTOF", &IPeak::getTOF, arg("self"),
......
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