Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions news/93.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
**Added:**

* Exposed ``Radiation.GetLinearPolarRate()``, ``Radiation.SetLinearPolarRate()``,
``Radiation.GetClockWavelength()``, and ``Radiation.GetClockRadiation()`` via
Python bindings. Closes `#38 <https://github.com/diffpy/pyobjcryst/issues/38>`_.
``Radiation.GetClockLinearPolarRate()`` is also bound and will be available once
`diffpy/libobjcryst` picks up `vincefn/objcryst PR #79
<https://github.com/vincefn/objcryst/pull/79>`_, which adds the dedicated
polarisation clock and fixes the polarisation-correction recalculation trigger.

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
11 changes: 11 additions & 0 deletions src/extensions/radiation_ext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <iostream>

#include <ObjCryst/ObjCryst/ScatteringData.h>
#include <ObjCryst/version.h>

namespace bp = boost::python;
using namespace boost::python;
Expand Down Expand Up @@ -51,5 +52,15 @@ void wrap_radiation()
(bp::arg("XRayTubeElementName"), bp::arg("alpha2Alpha2ratio")=0.5))
.def("GetXRayTubeDeltaLambda", & Radiation::GetXRayTubeDeltaLambda)
.def("GetXRayTubeAlpha2Alpha1Ratio", & Radiation::GetXRayTubeAlpha2Alpha1Ratio)
.def("GetLinearPolarRate", &Radiation::GetLinearPolarRate)
.def("SetLinearPolarRate", &Radiation::SetLinearPolarRate)
.def("GetClockWavelength", &Radiation::GetClockWavelength,
return_value_policy<copy_const_reference>())
.def("GetClockRadiation", &Radiation::GetClockRadiation,
return_value_policy<copy_const_reference>())
#if LIBOBJCRYST_VERSION >= 2026002000000LL
.def("GetClockLinearPolarRate", &Radiation::GetClockLinearPolarRate,
return_value_policy<copy_const_reference>())
#endif
;
}
11 changes: 11 additions & 0 deletions tests/test_radiation.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ def testType(self):
)
return

def testLinearPolarRate(self):
"""Test getting and setting linear polarisation rate."""
r = Radiation()
# Default for X-ray should be 0
self.assertAlmostEqual(r.GetLinearPolarRate(), 0.0)
r.SetLinearPolarRate(0.95)
self.assertAlmostEqual(r.GetLinearPolarRate(), 0.95)
r.SetLinearPolarRate(0.0)
self.assertAlmostEqual(r.GetLinearPolarRate(), 0.0)
return


if __name__ == "__main__":
unittest.main()
Loading