diff --git a/Base/Axis/FixedBinAxis.cpp b/Base/Axis/FixedBinAxis.cpp index 03e66721fff7e71bb42c2530d17d5b5c44b619ac..a543f9d88de91c1d06612a910734666514b5d21c 100644 --- a/Base/Axis/FixedBinAxis.cpp +++ b/Base/Axis/FixedBinAxis.cpp @@ -127,3 +127,14 @@ bool FixedBinAxis::equals(const IAxis& other) const } return false; } + +//... In global namespace. + +FixedBinAxis FixedScanAxis(const std::string& name, size_t nbins, double scan_start, + double scan_end) +{ + if (nbins < 2) + throw std::runtime_error("Cannot create scan axis with less than two points"); + const double delta = (scan_end - scan_start) / (nbins - 1); + return FixedBinAxis(name, nbins, scan_start - delta / 2, scan_end + delta / 2); +} diff --git a/Base/Axis/FixedBinAxis.h b/Base/Axis/FixedBinAxis.h index fee2450d8ddb1feb3a816b90c1f4babd0ca119f3..9e880092b428a04723bc7b1a0d5b4bd2edf38b43 100644 --- a/Base/Axis/FixedBinAxis.h +++ b/Base/Axis/FixedBinAxis.h @@ -29,6 +29,7 @@ public: //! @param end upper edge of last bin FixedBinAxis(const std::string& name, size_t nbins, double start, double end); ~FixedBinAxis() override = default; + FixedBinAxis(FixedBinAxis&&) = default; FixedBinAxis* clone() const override; @@ -61,4 +62,10 @@ private: double m_end; }; +#ifndef SWIG +//! Returns a FixedBinAxis determined by first and last point in scan. +FixedBinAxis FixedScanAxis(const std::string& name, size_t nbins, double scan_start, + double scan_end); +#endif + #endif // BORNAGAIN_BASE_AXIS_FIXEDBINAXIS_H diff --git a/Base/Axis/IAxis.h b/Base/Axis/IAxis.h index cb914425fc15af904d9dd2682fca351919121be4..376c51ad3de2e4d4db9d079ca94404f017421609 100644 --- a/Base/Axis/IAxis.h +++ b/Base/Axis/IAxis.h @@ -30,6 +30,7 @@ public: { } IAxis(const IAxis&) = delete; + IAxis(IAxis&&) = default; virtual ~IAxis(); virtual IAxis* clone() const = 0; diff --git a/Examples/specular/AlternatingLayers1.py b/Examples/specular/AlternatingLayers1.py index b25da0888d52673db1689fe9add428a7ebc01171..b1d80228e15805b4a70bfbb9d326b4efcee48485 100755 --- a/Examples/specular/AlternatingLayers1.py +++ b/Examples/specular/AlternatingLayers1.py @@ -42,7 +42,7 @@ def get_simulation(sample): A standard specular simulation setup. """ n = bp.simargs['n'] - scan = ba.AlphaScan(1.54*angstrom, n, 0, 2*deg) + scan = ba.AlphaScan(1.54*angstrom, n, 2*deg/n, 2*deg) return ba.SpecularSimulation(scan, sample) diff --git a/Examples/specular/AlternatingLayers2.py b/Examples/specular/AlternatingLayers2.py index acac1dfc64d237698f274876cfa04c6efefa9b0c..33ae38aaea26530eeba4e00cd12c1381694dbc52 100755 --- a/Examples/specular/AlternatingLayers2.py +++ b/Examples/specular/AlternatingLayers2.py @@ -18,7 +18,7 @@ def get_simulation(sample): A standard specular simulation setup. """ n = bp.simargs['n'] - scan = ba.AlphaScan(1.54*angstrom, n, 0, 2*deg) + scan = ba.AlphaScan(1.54*angstrom, n, 2*deg/n, 2*deg) return ba.SpecularSimulation(scan, sample) diff --git a/Examples/specular/BasicPolarizedReflectometry.py b/Examples/specular/BasicPolarizedReflectometry.py index 2db335867adf997af007a92a3895bfa44072b53e..efffb17411742c6393870aeb37e6ce96c0ca8418 100755 --- a/Examples/specular/BasicPolarizedReflectometry.py +++ b/Examples/specular/BasicPolarizedReflectometry.py @@ -38,7 +38,7 @@ def get_sample(): def simulate(sample, polarizer_dir, analyzer_dir, title): n = bp.simargs['n'] - scan = ba.AlphaScan(1.54*angstrom, n, 0, 5*deg) + scan = ba.AlphaScan(1.54*angstrom, n, 5*deg/n, 5*deg) scan.setPolarization(polarizer_dir) scan.setAnalyzer(analyzer_dir, 1, 0.5) diff --git a/Examples/specular/BeamAngularDivergence.py b/Examples/specular/BeamAngularDivergence.py index 557fcc62be80823b0ba95ee22cfb5637755beb9f..9c132e36628ffd790d2c7cb1ce7d7000e81cbe89 100755 --- a/Examples/specular/BeamAngularDivergence.py +++ b/Examples/specular/BeamAngularDivergence.py @@ -10,8 +10,6 @@ from bornagain import angstrom, ba_plot as bp, deg, std_samples # input parameters wavelength = 1.54*angstrom -alpha_i_min = 0 # min incident angle, deg -alpha_i_max = 2*deg # max incident angle, rad beam_sample_ratio = 0.01 # beam-to-sample size ratio # convolution parameters @@ -47,7 +45,7 @@ def get_simulation(sample, **kwargs): footprint = ba.FootprintSquare(beam_sample_ratio) alpha_distr = ba.RangedDistributionGaussian(n_points, n_sig) - scan = ba.AlphaScan(wavelength, n, alpha_i_min, alpha_i_max) + scan = ba.AlphaScan(wavelength, n, 2*deg/n, 2*deg) scan.setFootprintFactor(footprint) scan.setAbsoluteAngularResolution(alpha_distr, d_ang) diff --git a/Examples/specular/BeamFullDivergence.py b/Examples/specular/BeamFullDivergence.py index cd09f06fd02d2914f16b156ca1eb145971db8857..02a0f2ee36e01e74b447b654538ae24d346ed25c 100755 --- a/Examples/specular/BeamFullDivergence.py +++ b/Examples/specular/BeamFullDivergence.py @@ -8,8 +8,6 @@ from bornagain import angstrom, ba_plot as bp, deg, std_samples # input parameters wavelength = 1.54*angstrom -alpha_i_min = 0 # min incident angle, deg -alpha_i_max = 2*deg # max incident angle, rad # convolution parameters d_wl = 0.01*wavelength # spread width for wavelength @@ -31,7 +29,7 @@ def get_simulation(sample): alpha_distr = ba.RangedDistributionGaussian(n_points, n_sig) wavelength_distr = ba.RangedDistributionGaussian(n_points, n_sig) - scan = ba.AlphaScan(wavelength, n, alpha_i_min, alpha_i_max) + scan = ba.AlphaScan(wavelength, n, 2*deg/n, 2*deg) scan.setAbsoluteAngularResolution(alpha_distr, d_ang) scan.setAbsoluteWavelengthResolution(wavelength_distr, d_wl) diff --git a/Examples/specular/FootprintCorrection.py b/Examples/specular/FootprintCorrection.py index 52693f891a0920428dc3b09e6acd493cfbd5bd6e..c3064ca283f328f11143293f0ae95d160d7427ab 100755 --- a/Examples/specular/FootprintCorrection.py +++ b/Examples/specular/FootprintCorrection.py @@ -12,7 +12,7 @@ sample = std_samples.alternating_layers() def simulate(footprint, title): n = bp.simargs['n'] - scan = ba.AlphaScan(1.54*angstrom, n, 0, 0.6*deg) + scan = ba.AlphaScan(1.54*angstrom, n, 0.6*deg/n, 0.6*deg) scan.setFootprintFactor(footprint) simulation = ba.SpecularSimulation(scan, sample) diff --git a/Examples/specular/PolarizedNoAnalyzer.py b/Examples/specular/PolarizedNoAnalyzer.py index 67440fb8906e4b7f0b2fd596d7c21d0176534252..063e5593150a293dca3aef8eebeb75578cdd53c3 100755 --- a/Examples/specular/PolarizedNoAnalyzer.py +++ b/Examples/specular/PolarizedNoAnalyzer.py @@ -49,7 +49,7 @@ def run_simulation(polarizer_dir=R3(0, 1, 0), analyzer_dir=None): sample = get_sample() n = bp.simargs['n'] - scan = ba.AlphaScan(1.54*angstrom, n, 0, 5*deg) + scan = ba.AlphaScan(1.54*angstrom, n, 5*deg/n, 5*deg) # adding polarizer and analyzer operator scan.setPolarization(polarizer_dir) diff --git a/Examples/specular/PolarizedSpinFlip.py b/Examples/specular/PolarizedSpinFlip.py index 4ebf1fb885eb5803ec314503155297d6a93eab7b..0168506e2d03cb4865803b47e63877085bd77c45 100755 --- a/Examples/specular/PolarizedSpinFlip.py +++ b/Examples/specular/PolarizedSpinFlip.py @@ -42,7 +42,7 @@ def run_simulation(sample, """ Runs simulation and returns its result. """ - scan = ba.AlphaScan(1.54*angstrom, 500, 0, 5*deg) + scan = ba.AlphaScan(1.54*angstrom, 500, 5*deg/500, 5*deg) scan.setPolarization(polarizer_dir) scan.setAnalyzer(analyzer_dir, 1, 0.5) diff --git a/Examples/specular/RoughnessModel.py b/Examples/specular/RoughnessModel.py index 84d4830d4a35bf131d0b31e38a6501b69298b034..82bf33b5f6692eeb935a8eb0423db0f85ec58c0a 100755 --- a/Examples/specular/RoughnessModel.py +++ b/Examples/specular/RoughnessModel.py @@ -48,7 +48,7 @@ def get_simulation(sample): Defines and returns a specular simulation. """ n = bp.simargs['n'] - scan = ba.AlphaScan(1.54*angstrom, n, 0, 2*deg) + scan = ba.AlphaScan(1.54*angstrom, n, 2*deg/n, 2*deg) return ba.SpecularSimulation(scan, sample) diff --git a/Examples/specular/SpecularSimulationWithRoughness.py b/Examples/specular/SpecularSimulationWithRoughness.py index 41c24d2f3cd60a125c93ea351ec39fee1b2cac9b..ac39131696e9408e3a6bcdca57aad23b8ee5a6fb 100755 --- a/Examples/specular/SpecularSimulationWithRoughness.py +++ b/Examples/specular/SpecularSimulationWithRoughness.py @@ -36,7 +36,7 @@ def get_sample(): def get_simulation(sample): n = bp.simargs['n'] - scan = ba.AlphaScan(1.54*angstrom, n, 0, 2*deg) + scan = ba.AlphaScan(1.54*angstrom, n, 2*deg/n, 2*deg) return ba.SpecularSimulation(scan, sample) diff --git a/Sim/Scan/AlphaScan.cpp b/Sim/Scan/AlphaScan.cpp index 23272bdb7511b8c2b97e187e22ada718b466251e..8065de85caf89745e0c2b2a2afea98a67173c851 100644 --- a/Sim/Scan/AlphaScan.cpp +++ b/Sim/Scan/AlphaScan.cpp @@ -24,9 +24,9 @@ #include "Sim/Scan/ScanResolution.h" #include <algorithm> -AlphaScan::AlphaScan(double wavelength, const IAxis& inc_angle) - : ISpecularScan(inc_angle.size(), wavelength) - , m_alpha_axis(inc_angle.clone()) +AlphaScan::AlphaScan(double wavelength, const IAxis& alpha_axis) + : ISpecularScan(alpha_axis.size(), wavelength) + , m_alpha_axis(alpha_axis.clone()) , m_lambda_distrib(scanEmptyResolution()) , m_alpha_distrib(scanEmptyResolution()) { @@ -35,7 +35,8 @@ AlphaScan::AlphaScan(double wavelength, const IAxis& inc_angle) AlphaScan::AlphaScan(double wavelength, int nbins, double alpha_i_min, double alpha_i_max) : ISpecularScan(nbins, wavelength) - , m_alpha_axis(std::make_unique<FixedBinAxis>("inc_angles", nbins, alpha_i_min, alpha_i_max)) + , m_alpha_axis( + std::make_unique<FixedBinAxis>(FixedScanAxis("alpha_i", nbins, alpha_i_min, alpha_i_max))) , m_lambda_distrib(scanEmptyResolution()) , m_alpha_distrib(scanEmptyResolution()) { diff --git a/Sim/Scan/AlphaScan.h b/Sim/Scan/AlphaScan.h index 5d5bad413b2e79eb533629e8c2e1bcbee47688fb..e251c1f3821f226006d973ed32d7cc3b033f35d9 100644 --- a/Sim/Scan/AlphaScan.h +++ b/Sim/Scan/AlphaScan.h @@ -26,13 +26,13 @@ class IScanResolution; //! Features footprint correction. class AlphaScan : public ISpecularScan { public: - AlphaScan(double wl, const IAxis& inc_angle); + AlphaScan(double wavelength, const IAxis& alpha_axis); //! Sets angle-defined specular scan. The first parameter is always a wavelength in nm. //! Second parameter is either a numpy array of incident angles in radians or an IAxis object //! with angle values. Alternatively an axis can be defined in-place, then //! the second passed parameter is the number of bins, third - minimum on-axis angle value, //! fourth - maximum on-axis angle value. - AlphaScan(double wl, int nbins, double alpha_i_min, double alpha_i_max); + AlphaScan(double wavelength, int nbins, double alpha_i_min, double alpha_i_max); ~AlphaScan() override; AlphaScan* clone() const override; diff --git a/Sim/Scan/QzScan.cpp b/Sim/Scan/QzScan.cpp index 2839c751d93f0b95d26718a75de7aa996133ae82..94d4760ce52ec3cb64afa9647cf8dc117e3666ad 100644 --- a/Sim/Scan/QzScan.cpp +++ b/Sim/Scan/QzScan.cpp @@ -50,7 +50,7 @@ QzScan::QzScan(const IAxis& qs_nm) } QzScan::QzScan(int nbins, double qz_min, double qz_max) - : QzScan(new FixedBinAxis("qs", nbins, qz_min, qz_max)) + : QzScan(new FixedBinAxis(FixedScanAxis("qs", nbins, qz_min, qz_max))) { } diff --git a/Tests/ReferenceData/ExamplesMini/specular/AlternatingLayers.int.gz b/Tests/ReferenceData/ExamplesMini/specular/AlternatingLayers.int.gz index 442fc98d738b580824568be280a58e72343370cc..c979e996a3ffd895015bd3058c4ba2629abe4d86 100644 Binary files a/Tests/ReferenceData/ExamplesMini/specular/AlternatingLayers.int.gz and b/Tests/ReferenceData/ExamplesMini/specular/AlternatingLayers.int.gz differ diff --git a/Tests/ReferenceData/ExamplesMini/specular/AlternatingLayers1.int.gz b/Tests/ReferenceData/ExamplesMini/specular/AlternatingLayers1.int.gz index 442fc98d738b580824568be280a58e72343370cc..c979e996a3ffd895015bd3058c4ba2629abe4d86 100644 Binary files a/Tests/ReferenceData/ExamplesMini/specular/AlternatingLayers1.int.gz and b/Tests/ReferenceData/ExamplesMini/specular/AlternatingLayers1.int.gz differ diff --git a/Tests/ReferenceData/ExamplesMini/specular/AlternatingLayers2.int.gz b/Tests/ReferenceData/ExamplesMini/specular/AlternatingLayers2.int.gz index 442fc98d738b580824568be280a58e72343370cc..c979e996a3ffd895015bd3058c4ba2629abe4d86 100644 Binary files a/Tests/ReferenceData/ExamplesMini/specular/AlternatingLayers2.int.gz and b/Tests/ReferenceData/ExamplesMini/specular/AlternatingLayers2.int.gz differ diff --git a/Tests/ReferenceData/ExamplesMini/specular/BasicPolarizedReflectometry.0.int.gz b/Tests/ReferenceData/ExamplesMini/specular/BasicPolarizedReflectometry.0.int.gz index 7d158f2cd612b0e8c0db4939c4142c5a0b382b8b..ca5941f822ba3d3c7e57b3da212e251a9647b896 100644 Binary files a/Tests/ReferenceData/ExamplesMini/specular/BasicPolarizedReflectometry.0.int.gz and b/Tests/ReferenceData/ExamplesMini/specular/BasicPolarizedReflectometry.0.int.gz differ diff --git a/Tests/ReferenceData/ExamplesMini/specular/BasicPolarizedReflectometry.1.int.gz b/Tests/ReferenceData/ExamplesMini/specular/BasicPolarizedReflectometry.1.int.gz index 835cdb0139eb1adf2ee47efb09777a6a4f32002b..1dafd46ee41385c94f9180cd69b8e5db6938de32 100644 Binary files a/Tests/ReferenceData/ExamplesMini/specular/BasicPolarizedReflectometry.1.int.gz and b/Tests/ReferenceData/ExamplesMini/specular/BasicPolarizedReflectometry.1.int.gz differ diff --git a/Tests/ReferenceData/ExamplesMini/specular/BeamAngularDivergence.int.gz b/Tests/ReferenceData/ExamplesMini/specular/BeamAngularDivergence.int.gz index b5210d50b65906577078964fa5e20d1516c075f2..09b027717ba144fba0d62b5dcb1f4b298632b610 100644 Binary files a/Tests/ReferenceData/ExamplesMini/specular/BeamAngularDivergence.int.gz and b/Tests/ReferenceData/ExamplesMini/specular/BeamAngularDivergence.int.gz differ diff --git a/Tests/ReferenceData/ExamplesMini/specular/BeamFullDivergence.int.gz b/Tests/ReferenceData/ExamplesMini/specular/BeamFullDivergence.int.gz index fc4589705fd407f6a6f2fb36561f529a5430646d..825739cc11a57edf8421b59a60a96d81a763fab9 100644 Binary files a/Tests/ReferenceData/ExamplesMini/specular/BeamFullDivergence.int.gz and b/Tests/ReferenceData/ExamplesMini/specular/BeamFullDivergence.int.gz differ diff --git a/Tests/ReferenceData/ExamplesMini/specular/FootprintCorrection.0.int.gz b/Tests/ReferenceData/ExamplesMini/specular/FootprintCorrection.0.int.gz index a3f3a59a15c9b6766ac81f82dd85ec4cbd9720b1..205e85df0e904bcc0c7167b5ea08dc81a9535fdc 100644 Binary files a/Tests/ReferenceData/ExamplesMini/specular/FootprintCorrection.0.int.gz and b/Tests/ReferenceData/ExamplesMini/specular/FootprintCorrection.0.int.gz differ diff --git a/Tests/ReferenceData/ExamplesMini/specular/FootprintCorrection.1.int.gz b/Tests/ReferenceData/ExamplesMini/specular/FootprintCorrection.1.int.gz index d761a3ce48f6c659fe48424f3713006b61e0f075..32b638e6cefe53e3ba06c0dc8c0bf6690de1a08e 100644 Binary files a/Tests/ReferenceData/ExamplesMini/specular/FootprintCorrection.1.int.gz and b/Tests/ReferenceData/ExamplesMini/specular/FootprintCorrection.1.int.gz differ diff --git a/Tests/ReferenceData/ExamplesMini/specular/RoughnessModel.0.int.gz b/Tests/ReferenceData/ExamplesMini/specular/RoughnessModel.0.int.gz index 9f7e9245de30f6026c5c93aa3fd656e6e8fcbe62..d43f41e46839d2df2dca7a64a9fe72718a19d4d7 100644 Binary files a/Tests/ReferenceData/ExamplesMini/specular/RoughnessModel.0.int.gz and b/Tests/ReferenceData/ExamplesMini/specular/RoughnessModel.0.int.gz differ diff --git a/Tests/ReferenceData/ExamplesMini/specular/RoughnessModel.1.int.gz b/Tests/ReferenceData/ExamplesMini/specular/RoughnessModel.1.int.gz index 8a57149bcbb79687e5c7ac68a3b4143e5163bad8..9c9ff5aaaeea13a559da402bd984d270bd4eb253 100644 Binary files a/Tests/ReferenceData/ExamplesMini/specular/RoughnessModel.1.int.gz and b/Tests/ReferenceData/ExamplesMini/specular/RoughnessModel.1.int.gz differ diff --git a/Tests/ReferenceData/ExamplesMini/specular/SpecularSimulationWithRoughness.int.gz b/Tests/ReferenceData/ExamplesMini/specular/SpecularSimulationWithRoughness.int.gz index 8a57149bcbb79687e5c7ac68a3b4143e5163bad8..9c9ff5aaaeea13a559da402bd984d270bd4eb253 100644 Binary files a/Tests/ReferenceData/ExamplesMini/specular/SpecularSimulationWithRoughness.int.gz and b/Tests/ReferenceData/ExamplesMini/specular/SpecularSimulationWithRoughness.int.gz differ diff --git a/Tests/Unit/Sim/SpecularScanTest.cpp b/Tests/Unit/Sim/SpecularScanTest.cpp index 24428442777fdf1a624af8ed1465280367998b36..77b1f7942eb4c75015ffbd40fd2fbccb2378ebf3 100644 --- a/Tests/Unit/Sim/SpecularScanTest.cpp +++ b/Tests/Unit/Sim/SpecularScanTest.cpp @@ -27,28 +27,6 @@ TEST(SpecularScanTest, AngularScanInit) check(scan3, fixed_axis); } -TEST(SpecularScanTest, QScanInit) -{ - auto check = [](const QzScan& scan, const IAxis& axis) { - EXPECT_EQ(axis, *scan.coordinateAxis()); - EXPECT_EQ(scan.nSteps(), axis.size()); - }; - - const PointwiseAxis pointwise_axis("qs", std::vector<double>{0.1, 0.2, 0.3}); - QzScan scan(pointwise_axis); - check(scan, pointwise_axis); - - QzScan scan2(std::vector<double>{0.1, 0.2, 0.3}); - check(scan, pointwise_axis); - - const FixedBinAxis fixed_axis("qs", 3, 0.1, 0.3); - QzScan scan3(fixed_axis); - check(scan3, fixed_axis); - - QzScan scan4(3, 0.1, 0.3); - check(scan4, fixed_axis); -} - TEST(SpecularScanTest, AngularScanClone) { AlphaScan scan(0.1, 3, 0.1, 0.3); diff --git a/Wrap/Python/std_simulations.py b/Wrap/Python/std_simulations.py index 3a5a0a9e6a843f1170c1a70c26035905687ad6cb..8ca399b6d606e576342ba787bd380dcbb8e3e479 100644 --- a/Wrap/Python/std_simulations.py +++ b/Wrap/Python/std_simulations.py @@ -9,7 +9,7 @@ def specular(sample, scan_size): """ Returns a standard specular simulation. """ - scan = ba.AlphaScan(1.54*angstrom, scan_size, 0, 2*deg) + scan = ba.AlphaScan(1.54*angstrom, scan_size, 2*deg/scan_size, 2*deg) return ba.SpecularSimulation(scan, sample) diff --git a/auto/Wrap/libBornAgainBase.py b/auto/Wrap/libBornAgainBase.py index 620c2cdfb281944bb9e03f766d393b65adc9671b..a00485c698ad5e0f56aee269d8e57f9caf379dea 100644 --- a/auto/Wrap/libBornAgainBase.py +++ b/auto/Wrap/libBornAgainBase.py @@ -2020,12 +2020,15 @@ class FixedBinAxis(IAxis): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr - - def __init__(self, name, nbins, start, end): - r"""__init__(FixedBinAxis self, std::string const & name, size_t nbins, double start, double end) -> FixedBinAxis""" - _libBornAgainBase.FixedBinAxis_swiginit(self, _libBornAgainBase.new_FixedBinAxis(name, nbins, start, end)) __swig_destroy__ = _libBornAgainBase.delete_FixedBinAxis + def __init__(self, *args): + r""" + __init__(FixedBinAxis self, std::string const & name, size_t nbins, double start, double end) -> FixedBinAxis + __init__(FixedBinAxis self, FixedBinAxis arg2) -> FixedBinAxis + """ + _libBornAgainBase.FixedBinAxis_swiginit(self, _libBornAgainBase.new_FixedBinAxis(*args)) + def clone(self): r"""clone(FixedBinAxis self) -> FixedBinAxis""" return _libBornAgainBase.FixedBinAxis_clone(self) diff --git a/auto/Wrap/libBornAgainBase_wrap.cpp b/auto/Wrap/libBornAgainBase_wrap.cpp index 3f1f837a1b9075076ad7dbc09639e46b4c9b4b17..e2aad77e7d678f5a24d054f2e5f3d4584988a685 100644 --- a/auto/Wrap/libBornAgainBase_wrap.cpp +++ b/auto/Wrap/libBornAgainBase_wrap.cpp @@ -7020,6 +7020,9 @@ SWIGINTERNINLINE PyObject* } SWIGINTERN double VariableBinAxis___getitem__(VariableBinAxis *self,unsigned int i){ return (*(self))[i]; } + +#include <memory> + SWIGINTERN double FixedBinAxis___getitem__(FixedBinAxis *self,unsigned int i){ return (*(self))[i]; } @@ -26553,7 +26556,7 @@ SWIGINTERN PyObject *CustomBinAxis_swiginit(PyObject *SWIGUNUSEDPARM(self), PyOb return SWIG_Python_InitShadowInstance(args); } -SWIGINTERN PyObject *_wrap_new_FixedBinAxis(PyObject *self, PyObject *args) { +SWIGINTERN PyObject *_wrap_new_FixedBinAxis__SWIG_0(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) { PyObject *resultobj = 0; std::string *arg1 = 0 ; size_t arg2 ; @@ -26566,10 +26569,9 @@ SWIGINTERN PyObject *_wrap_new_FixedBinAxis(PyObject *self, PyObject *args) { int ecode3 = 0 ; double val4 ; int ecode4 = 0 ; - PyObject *swig_obj[4] ; FixedBinAxis *result = 0 ; - if (!SWIG_Python_UnpackTuple(args, "new_FixedBinAxis", 4, 4, swig_obj)) SWIG_fail; + if ((nobjs < 4) || (nobjs > 4)) SWIG_fail; { std::string *ptr = (std::string *)0; res1 = SWIG_AsPtr_std_string(swig_obj[0], &ptr); @@ -26628,6 +26630,89 @@ fail: } +SWIGINTERN PyObject *_wrap_new_FixedBinAxis__SWIG_1(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + FixedBinAxis *arg1 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + std::unique_ptr< FixedBinAxis > rvrdeleter1 ; + FixedBinAxis *result = 0 ; + + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_FixedBinAxis, SWIG_POINTER_RELEASE | 0 ); + if (!SWIG_IsOK(res1)) { + if (res1 == SWIG_ERROR_RELEASE_NOT_OWNED) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_FixedBinAxis" "', cannot release ownership as memory is not owned for argument " "1"" of type '" "FixedBinAxis &&""'"); + } else { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_FixedBinAxis" "', argument " "1"" of type '" "FixedBinAxis &&""'"); + } + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_FixedBinAxis" "', argument " "1"" of type '" "FixedBinAxis &&""'"); + } + arg1 = reinterpret_cast< FixedBinAxis * >(argp1); + rvrdeleter1.reset(arg1); + result = (FixedBinAxis *)new FixedBinAxis((FixedBinAxis &&)*arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_FixedBinAxis, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_FixedBinAxis(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[5] = { + 0 + }; + + if (!(argc = SWIG_Python_UnpackTuple(args, "new_FixedBinAxis", 0, 4, argv))) SWIG_fail; + --argc; + if (argc == 1) { + int _v = 0; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_FixedBinAxis, SWIG_POINTER_NO_NULL); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_FixedBinAxis__SWIG_1(self, argc, argv); + } + } + if (argc == 4) { + int _v = 0; + int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0)); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_size_t(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_double(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_double(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_FixedBinAxis__SWIG_0(self, argc, argv); + } + } + } + } + } + +fail: + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_FixedBinAxis'.\n" + " Possible C/C++ prototypes are:\n" + " FixedBinAxis::FixedBinAxis(std::string const &,size_t,double,double)\n" + " FixedBinAxis::FixedBinAxis(FixedBinAxis &&)\n"); + return 0; +} + + SWIGINTERN PyObject *_wrap_FixedBinAxis_clone(PyObject *self, PyObject *args) { PyObject *resultobj = 0; FixedBinAxis *arg1 = (FixedBinAxis *) 0 ; @@ -29681,8 +29766,11 @@ static PyMethodDef SwigMethods[] = { { "CustomBinAxis_clip", _wrap_CustomBinAxis_clip, METH_VARARGS, "CustomBinAxis_clip(CustomBinAxis self, double lower, double upper)"}, { "CustomBinAxis_swigregister", CustomBinAxis_swigregister, METH_O, NULL}, { "CustomBinAxis_swiginit", CustomBinAxis_swiginit, METH_VARARGS, NULL}, - { "new_FixedBinAxis", _wrap_new_FixedBinAxis, METH_VARARGS, "new_FixedBinAxis(std::string const & name, size_t nbins, double start, double end) -> FixedBinAxis"}, { "delete_FixedBinAxis", _wrap_delete_FixedBinAxis, METH_O, "delete_FixedBinAxis(FixedBinAxis self)"}, + { "new_FixedBinAxis", _wrap_new_FixedBinAxis, METH_VARARGS, "\n" + "FixedBinAxis(std::string const & name, size_t nbins, double start, double end)\n" + "new_FixedBinAxis(FixedBinAxis arg1) -> FixedBinAxis\n" + ""}, { "FixedBinAxis_clone", _wrap_FixedBinAxis_clone, METH_O, "FixedBinAxis_clone(FixedBinAxis self) -> FixedBinAxis"}, { "FixedBinAxis_size", _wrap_FixedBinAxis_size, METH_O, "FixedBinAxis_size(FixedBinAxis self) -> size_t"}, { "FixedBinAxis_bin", _wrap_FixedBinAxis_bin, METH_VARARGS, "FixedBinAxis_bin(FixedBinAxis self, size_t index) -> Bin1D"}, diff --git a/auto/Wrap/libBornAgainSim.py b/auto/Wrap/libBornAgainSim.py index e71cea962b4cdeae24b6c495bc9d4206e06d003a..6fb494eb980f2140ddae8be078450677daa673c8 100644 --- a/auto/Wrap/libBornAgainSim.py +++ b/auto/Wrap/libBornAgainSim.py @@ -2554,8 +2554,8 @@ class AlphaScan(ISpecularScan): def __init__(self, *args): r""" - __init__(AlphaScan self, double wl, IAxis inc_angle) -> AlphaScan - __init__(AlphaScan self, double wl, int nbins, double alpha_i_min, double alpha_i_max) -> AlphaScan + __init__(AlphaScan self, double wavelength, IAxis alpha_axis) -> AlphaScan + __init__(AlphaScan self, double wavelength, int nbins, double alpha_i_min, double alpha_i_max) -> AlphaScan """ _libBornAgainSim.AlphaScan_swiginit(self, _libBornAgainSim.new_AlphaScan(*args)) __swig_destroy__ = _libBornAgainSim.delete_AlphaScan diff --git a/auto/Wrap/libBornAgainSim_wrap.cpp b/auto/Wrap/libBornAgainSim_wrap.cpp index ae048b0389346778b94a9e82a22e0fbc24db2ae6..7c201088f40174d51830059094774ce21452cec8 100644 --- a/auto/Wrap/libBornAgainSim_wrap.cpp +++ b/auto/Wrap/libBornAgainSim_wrap.cpp @@ -36862,8 +36862,8 @@ static PyMethodDef SwigMethods[] = { { "ISpecularScan_setAnalyzer", _wrap_ISpecularScan_setAnalyzer, METH_VARARGS, "ISpecularScan_setAnalyzer(ISpecularScan self, R3 direction, double efficiency, double total_transmission)"}, { "ISpecularScan_swigregister", ISpecularScan_swigregister, METH_O, NULL}, { "new_AlphaScan", _wrap_new_AlphaScan, METH_VARARGS, "\n" - "AlphaScan(double wl, IAxis inc_angle)\n" - "new_AlphaScan(double wl, int nbins, double alpha_i_min, double alpha_i_max) -> AlphaScan\n" + "AlphaScan(double wavelength, IAxis alpha_axis)\n" + "new_AlphaScan(double wavelength, int nbins, double alpha_i_min, double alpha_i_max) -> AlphaScan\n" ""}, { "delete_AlphaScan", _wrap_delete_AlphaScan, METH_O, "delete_AlphaScan(AlphaScan self)"}, { "AlphaScan_clone", _wrap_AlphaScan_clone, METH_O, "AlphaScan_clone(AlphaScan self) -> AlphaScan"},