From 1564647c4785a26bf77afdf9de5b7b53e7545b58 Mon Sep 17 00:00:00 2001 From: Aaron Brewster Date: Wed, 8 Apr 2020 15:00:33 -0700 Subject: [PATCH] Need an additional constructor to make pickling work. --- model/boost_python/beam.cc | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/model/boost_python/beam.cc b/model/boost_python/beam.cc index 0d0d12717..6e60c200d 100644 --- a/model/boost_python/beam.cc +++ b/model/boost_python/beam.cc @@ -99,7 +99,7 @@ namespace dxtbx { namespace model { namespace boost_python { return beam; } - static Beam *make_beam_w_all(vec3 sample_to_source, + static Beam *make_beam_w_most(vec3 sample_to_source, double wavelength, double divergence, double sigma_divergence, @@ -131,6 +131,23 @@ namespace dxtbx { namespace model { namespace boost_python { return beam; } + static Beam *make_beam_w_all(vec3 sample_to_source, + double wavelength, + double divergence, + double sigma_divergence, + vec3 polarization_normal, + double polarization_fraction, + double flux, + double transmission, + scitbx::af::shared spectrum_energies, + scitbx::af::shared spectrum_weights, + bool deg) { + Beam *beam = make_beam_w_most(sample_to_source, wavelength, divergence, sigma_divergence, + polarization_normal, polarization_fraction, flux, transmission, deg); + beam->set_spectrum(spectrum_energies, spectrum_weights); + return beam; + } + static double get_divergence(const Beam &beam, bool deg) { double divergence = beam.get_divergence(); return deg ? rad_as_deg(divergence) : divergence; @@ -310,6 +327,18 @@ namespace dxtbx { namespace model { namespace boost_python { default_call_policies(), (arg("s0"), arg("divergence"), arg("sigma_divergence"), arg("deg") = true))) .def("__init__", + make_constructor(&make_beam_w_most, + default_call_policies(), + (arg("direction"), + arg("wavelength"), + arg("divergence"), + arg("sigma_divergence"), + arg("polarization_normal"), + arg("polarization_fraction"), + arg("flux"), + arg("transmission"), + arg("deg") = true))) + .def("__init__", make_constructor(&make_beam_w_all, default_call_policies(), (arg("direction"), @@ -320,6 +349,8 @@ namespace dxtbx { namespace model { namespace boost_python { arg("polarization_fraction"), arg("flux"), arg("transmission"), + arg("spectrum_energies"), + arg("spectrum_weights"), arg("deg") = true))) .def("__str__", &beam_to_string) .def("get_spectrum_energies",