diff --git a/Examples/specular/FootprintCorrection.py b/Examples/specular/FootprintCorrection.py index 69322862e7362aa80ad4d93bb7db69523173125e..384733675f6f179f3df15e6f67cdab0a6e7a7878 100755 --- a/Examples/specular/FootprintCorrection.py +++ b/Examples/specular/FootprintCorrection.py @@ -14,7 +14,7 @@ def simulate(footprint, title): n = bp.simargs['n'] scan = ba.AlphaScan(n, 0.6*deg/n, 0.6*deg) scan.setWavelength(1.54*angstrom) - scan.setFootprintFactor(footprint) + scan.setFootprint(footprint) simulation = ba.SpecularSimulation(scan, sample) result = simulation.simulate() diff --git a/Examples/specular/VsGenx.py b/Examples/specular/VsGenx.py index c34c927ccb571808c12929bc3540e294b0e31a86..bc6c9fe240e8826cb76b7fab78deba27e522c754 100755 --- a/Examples/specular/VsGenx.py +++ b/Examples/specular/VsGenx.py @@ -41,7 +41,7 @@ def get_simulation(sample, **kwargs): scan = ba.AlphaScan(n, 2*deg/n, 2*deg) scan.setWavelength(1.54*angstrom) - scan.setFootprintFactor(footprint) + scan.setFootprint(footprint) scan.setAngleDistribution(alpha_distr) return ba.SpecularSimulation(scan, sample) @@ -64,4 +64,4 @@ if __name__ == '__main__': bp.plot_simulation_result(result) plt.legend(['GenX', 'BornAgain'], loc='upper right') - bp.show_or_export() \ No newline at end of file + bp.show_or_export() diff --git a/GUI/Model/Device/InstrumentItems.cpp b/GUI/Model/Device/InstrumentItems.cpp index c03ebf42eb0d4e782a1cf1e715c64d67ea9f99cb..bb2e3088ddc2ac48b3340df5093a6409cc850669 100644 --- a/GUI/Model/Device/InstrumentItems.cpp +++ b/GUI/Model/Device/InstrumentItems.cpp @@ -291,7 +291,7 @@ std::unique_ptr<IBeamScan> ScanningItem::createScan() const FootprintItemCatalog::CatalogedType* const footprint_item = scanItem()->footprintSelection().currentItem(); - result->setFootprintFactor(footprint_item->createFootprint().get()); + result->setFootprint(footprint_item->createFootprint().get()); { const auto* it = dynamic_cast<const BeamWavelengthItem*>(scanItem()->wavelengthItem()); diff --git a/Sim/Export/SimulationToPython.cpp b/Sim/Export/SimulationToPython.cpp index 8ed6a19783826d28f486e3edf197dea68cfa7e86..cd552f8eeb64280b7d8fadf17464ff63bed33de7 100644 --- a/Sim/Export/SimulationToPython.cpp +++ b/Sim/Export/SimulationToPython.cpp @@ -89,7 +89,7 @@ std::string defineAlphaScan(const AlphaScan& scan) if (const IFootprintFactor* fp = scan.footprint()) { result << defineFootprintFactor(*fp); - result << indent() << "scan.setFootprintFactor(footprint)\n"; + result << indent() << "scan.setFootprint(footprint)\n"; } if (const IDistribution1D* d = scan.angleDistribution()) { result << indent() << "distribution = " << Py::Fmt2::printDistribution(*d); diff --git a/Sim/Scan/AlphaScan.cpp b/Sim/Scan/AlphaScan.cpp index 305d3526b16f3ce955f5f67083521afd5eff1928..ebe43ef8c9dc7afae242bdf5b114563003f31753 100644 --- a/Sim/Scan/AlphaScan.cpp +++ b/Sim/Scan/AlphaScan.cpp @@ -57,7 +57,7 @@ AlphaScan* AlphaScan::clone() const { auto* result = new AlphaScan(*m_axis); result->setIntensity(intensity()); - result->setFootprintFactor(m_footprint.get()); + result->setFootprint(m_footprint.get()); if (m_lambda_distrib) result->m_lambda_distrib.reset(m_lambda_distrib->clone()); @@ -80,8 +80,6 @@ std::vector<const INode*> AlphaScan::nodeChildren() const std::vector<const INode*> result; for (const INode* n : IBeamScan::nodeChildren()) result << n; - if (m_footprint) - result << m_footprint.get(); if (m_lambda_distrib) result << m_lambda_distrib.get(); if (m_alpha_distrib) @@ -116,11 +114,6 @@ std::vector<SpecularElement> AlphaScan::generateElements() const return result; } -void AlphaScan::setFootprintFactor(const IFootprintFactor* f_factor) -{ - m_footprint.reset(f_factor ? f_factor->clone() : nullptr); -} - void AlphaScan::setWavelength(double lambda) { if (m_lambda_distrib) diff --git a/Sim/Scan/AlphaScan.h b/Sim/Scan/AlphaScan.h index 709097e92006318f2a69612ac8f9c4e0718b7b63..eea935e79aea500e424d0af9b789fc585d53389d 100644 --- a/Sim/Scan/AlphaScan.h +++ b/Sim/Scan/AlphaScan.h @@ -33,10 +33,6 @@ public: std::vector<const INode*> nodeChildren() const override; // TODO: unify the following fct calls: either pointer or reference argument for all! - - //! Sets footprint correction factor - void setFootprintFactor(const IFootprintFactor* f_factor); - void setWavelengthDistribution(const IDistribution1D& distr); void setAngleDistribution(const IDistribution1D& distr); @@ -63,8 +59,6 @@ public: private: void checkInitialization(); - std::unique_ptr<const IFootprintFactor> m_footprint; - std::unique_ptr<const IDistribution1D> m_lambda_distrib; std::unique_ptr<const IDistribution1D> m_alpha_distrib; #endif // SWIG diff --git a/Sim/Scan/IBeamScan.cpp b/Sim/Scan/IBeamScan.cpp index e6ac4e6ffa6c4331a2c22b592986695fc7d98ca4..78da4a1caa8f3540b26013deddef48d17dab2453 100644 --- a/Sim/Scan/IBeamScan.cpp +++ b/Sim/Scan/IBeamScan.cpp @@ -30,6 +30,8 @@ IBeamScan::~IBeamScan() = default; std::vector<const INode*> IBeamScan::nodeChildren() const { std::vector<const INode*> result; + if (m_footprint) + result << m_footprint.get(); if (m_polAnalyzer) result << m_polAnalyzer.get(); return result; diff --git a/Tests/SimFactory/MakeSimulations.cpp b/Tests/SimFactory/MakeSimulations.cpp index a7a27e55de2c427334d1b5456f43c4f88a2fcbf4..d5cd4bb740a4d086141ab748255134d1e3c4e5af 100644 --- a/Tests/SimFactory/MakeSimulations.cpp +++ b/Tests/SimFactory/MakeSimulations.cpp @@ -375,7 +375,7 @@ test::makeSimulation::SpecularWithGaussianBeam(const MultiLayer& sample) auto gaussian_ff = std::make_unique<FootprintGauss>(1.0); AlphaScan scan(FixedBinAxis("axis", number_of_bins, min_angle, max_angle)); scan.setWavelength(wavelength); - scan.setFootprintFactor(gaussian_ff.get()); + scan.setFootprint(gaussian_ff.get()); return std::make_unique<SpecularSimulation>(scan, sample); } @@ -390,7 +390,7 @@ test::makeSimulation::SpecularWithSquareBeam(const MultiLayer& sample) auto square_ff = std::make_unique<FootprintSquare>(1.0); AlphaScan scan(FixedBinAxis("axis", number_of_bins, min_angle, max_angle)); scan.setWavelength(wavelength); - scan.setFootprintFactor(square_ff.get()); + scan.setFootprint(square_ff.get()); return std::make_unique<SpecularSimulation>(scan, sample); } diff --git a/auto/Wrap/libBornAgainSim.py b/auto/Wrap/libBornAgainSim.py index a1f9f8e9a0608f9fcb365b4e6853902b2c8f146e..bd1508c750b5b0a374418fbfbe0da3e3a97e69a6 100644 --- a/auto/Wrap/libBornAgainSim.py +++ b/auto/Wrap/libBornAgainSim.py @@ -2588,10 +2588,6 @@ class AlphaScan(IBeamScan): r"""nodeChildren(AlphaScan self) -> swig_dummy_type_const_inode_vector""" return _libBornAgainSim.AlphaScan_nodeChildren(self) - def setFootprintFactor(self, f_factor): - r"""setFootprintFactor(AlphaScan self, IFootprintFactor const * f_factor)""" - return _libBornAgainSim.AlphaScan_setFootprintFactor(self, f_factor) - def setWavelengthDistribution(self, distr): r"""setWavelengthDistribution(AlphaScan self, IDistribution1D const & distr)""" return _libBornAgainSim.AlphaScan_setWavelengthDistribution(self, distr) diff --git a/auto/Wrap/libBornAgainSim_wrap.cpp b/auto/Wrap/libBornAgainSim_wrap.cpp index 864fbc6ef9a29289c6bf41bfff29bb59cc241c7f..6cc360af35de4318c05e3e996d9f6bf484ad1e40 100644 --- a/auto/Wrap/libBornAgainSim_wrap.cpp +++ b/auto/Wrap/libBornAgainSim_wrap.cpp @@ -32348,35 +32348,6 @@ fail: } -SWIGINTERN PyObject *_wrap_AlphaScan_setFootprintFactor(PyObject *self, PyObject *args) { - PyObject *resultobj = 0; - AlphaScan *arg1 = (AlphaScan *) 0 ; - IFootprintFactor *arg2 = (IFootprintFactor *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "AlphaScan_setFootprintFactor", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_AlphaScan, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "AlphaScan_setFootprintFactor" "', argument " "1"" of type '" "AlphaScan *""'"); - } - arg1 = reinterpret_cast< AlphaScan * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_IFootprintFactor, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "AlphaScan_setFootprintFactor" "', argument " "2"" of type '" "IFootprintFactor const *""'"); - } - arg2 = reinterpret_cast< IFootprintFactor * >(argp2); - (arg1)->setFootprintFactor((IFootprintFactor const *)arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - SWIGINTERN PyObject *_wrap_AlphaScan_setWavelengthDistribution(PyObject *self, PyObject *args) { PyObject *resultobj = 0; AlphaScan *arg1 = (AlphaScan *) 0 ; @@ -36688,7 +36659,6 @@ static PyMethodDef SwigMethods[] = { { "AlphaScan_clone", _wrap_AlphaScan_clone, METH_O, "AlphaScan_clone(AlphaScan self) -> AlphaScan"}, { "AlphaScan_className", _wrap_AlphaScan_className, METH_O, "AlphaScan_className(AlphaScan self) -> std::string"}, { "AlphaScan_nodeChildren", _wrap_AlphaScan_nodeChildren, METH_O, "AlphaScan_nodeChildren(AlphaScan self) -> swig_dummy_type_const_inode_vector"}, - { "AlphaScan_setFootprintFactor", _wrap_AlphaScan_setFootprintFactor, METH_VARARGS, "AlphaScan_setFootprintFactor(AlphaScan self, IFootprintFactor const * f_factor)"}, { "AlphaScan_setWavelengthDistribution", _wrap_AlphaScan_setWavelengthDistribution, METH_VARARGS, "AlphaScan_setWavelengthDistribution(AlphaScan self, IDistribution1D const & distr)"}, { "AlphaScan_setAngleDistribution", _wrap_AlphaScan_setAngleDistribution, METH_VARARGS, "AlphaScan_setAngleDistribution(AlphaScan self, IDistribution1D const & distr)"}, { "AlphaScan_setWavelength", _wrap_AlphaScan_setWavelength, METH_VARARGS, "AlphaScan_setWavelength(AlphaScan self, double _lambda)"},