2222#include < boost/python/pure_virtual.hpp>
2323#undef B0
2424
25+ #include " helpers.hpp" // assignCrystVector helper for numpy/sequence inputs
26+
2527#include < iostream>
2628
2729#include < ObjCryst/ObjCryst/ReflectionProfile.h>
@@ -72,6 +74,16 @@ namespace
7274 }
7375 };
7476
77+ // Accept python sequences/ndarrays for x and forward to the C++ API.
78+ CrystVector_REAL _GetProfile (
79+ const ReflectionProfile &rp, bp::object x, const REAL xcenter,
80+ const REAL h, const REAL k, const REAL l)
81+ {
82+ CrystVector_REAL cvx;
83+ assignCrystVector (cvx, x);
84+ return rp.GetProfile (cvx, xcenter, h, k, l);
85+ }
86+
7587} // namespace
7688
7789void wrap_reflectionprofile ()
@@ -83,9 +95,13 @@ void wrap_reflectionprofile()
8395 return_value_policy<manage_new_object>())
8496 .def (
8597 " GetProfile" ,
86- pure_virtual ((CrystVector_REAL (ReflectionProfile::*)(const CrystVector_REAL &, REAL, REAL, REAL, REAL) const ) & ReflectionProfile::GetProfile),
98+ pure_virtual ((CrystVector_REAL (ReflectionProfile::*)(const CrystVector_REAL &, REAL, REAL, REAL, REAL) const ) & ReflectionProfile::GetProfile),
8799 (bp::arg (" x" ), bp::arg (" xcenter" ), bp::arg (" h" ),
88100 bp::arg (" k" ), bp::arg (" l" )))
101+ .def (
102+ " GetProfile" , &_GetProfile,
103+ (bp::arg (" x" ), bp::arg (" xcenter" ), bp::arg (" h" ), bp::arg (" k" ),
104+ bp::arg (" l" )))
89105 .def (" GetFullProfileWidth" ,
90106 pure_virtual ((REAL (ReflectionProfile::*)(const REAL, const REAL, const REAL, const REAL, const REAL) const ) & ReflectionProfile::GetFullProfileWidth),
91107 (bp::arg (" relativeIntensity" ), bp::arg (" xcenter" ),
0 commit comments