diff --git a/Core/Basics/ICloneable.h b/Core/Basics/ICloneable.h index 8e352bebf09a872064de704c52dd56891ce28407..615842a57cfaf9095b4860aaea92d4d1fd7e777d 100644 --- a/Core/Basics/ICloneable.h +++ b/Core/Basics/ICloneable.h @@ -20,16 +20,17 @@ #include "WinDllMacros.h" //! Mix-in for objects that must not be copied, except by cloning. -//! @ingroup tools_internal //! //! The base class INoncopyable disables the copy constructor and the operator= //! in all its child classes. //! Child classes of ICloneable should provide clone(). +//! @ingroup tools_internal + class BA_CORE_API_ ICloneable : public INoncopyable { public: - virtual ICloneable* clone() const = 0; + virtual ICloneable* clone() const=0; virtual void transferToCPP() {} //!< Used for Python overriding of clone }; diff --git a/Core/Basics/INoncopyable.h b/Core/Basics/INoncopyable.h index f31bfd851021d4f8ef729be107fa242264943500..b31d7a858c55347bb566aaae307393f5b2b3272f 100644 --- a/Core/Basics/INoncopyable.h +++ b/Core/Basics/INoncopyable.h @@ -19,11 +19,12 @@ #include "WinDllMacros.h" //! Mix-in for objects that must not be copied. -//! @ingroup tools_internal //! //! This virtual base class disables the copy constructor and the operator= //! in all its child classes. +//! @ingroup tools_internal + class BA_CORE_API_ INoncopyable { public: diff --git a/Core/DecoratedFormFactor/FormFactorDecoratorDebyeWaller.cpp b/Core/DecoratedFormFactor/FormFactorDecoratorDebyeWaller.cpp index 40527761dc1cdc7ff2d66a9d315a2de4cc7d94e0..9e08c9830a78ab970a19977f5da5b03557309f66 100644 --- a/Core/DecoratedFormFactor/FormFactorDecoratorDebyeWaller.cpp +++ b/Core/DecoratedFormFactor/FormFactorDecoratorDebyeWaller.cpp @@ -30,20 +30,33 @@ FormFactorDecoratorDebyeWaller::FormFactorDecoratorDebyeWaller( } FormFactorDecoratorDebyeWaller::FormFactorDecoratorDebyeWaller( - const IFormFactor & form_factor, double dw_factor) - : IFormFactorDecorator(form_factor), - m_h_dw_factor(dw_factor), m_r_dw_factor(dw_factor) + const IFormFactor & form_factor, double dw_factor) + : IFormFactorDecorator(form_factor), + m_h_dw_factor(dw_factor), m_r_dw_factor(dw_factor) { - setName(BornAgain::FormFactorDecoratorDebyeWallerType); - registerParameter(BornAgain::HeightDWFactor, &m_h_dw_factor).setPositive(); - registerParameter(BornAgain::RadiusDWFactor, &m_r_dw_factor).setPositive(); + setName(BornAgain::FormFactorDecoratorDebyeWallerType); + registerParameter(BornAgain::HeightDWFactor, &m_h_dw_factor).setPositive(); + registerParameter(BornAgain::RadiusDWFactor, &m_r_dw_factor).setPositive(); } complex_t FormFactorDecoratorDebyeWaller::evaluate(const WavevectorInfo& wavevectors) const +{ + double dw = getDWFactor(wavevectors); + return dw * mp_form_factor->evaluate(wavevectors); +} + +Eigen::Matrix2cd FormFactorDecoratorDebyeWaller::evaluatePol( + const WavevectorInfo &wavevectors) const +{ + double dw = getDWFactor(wavevectors); + return dw * mp_form_factor->evaluatePol(wavevectors); +} + +double FormFactorDecoratorDebyeWaller::getDWFactor(const WavevectorInfo& wavevectors) const { cvector_t q = wavevectors.getQ(); double qr2 = std::norm(q.x()) + std::norm(q.y()); double qz2 = std::norm(q.z()); double dw = std::exp(-qz2 * m_h_dw_factor - qr2 * m_r_dw_factor); - return dw * mp_form_factor->evaluate(wavevectors); + return dw; } diff --git a/Core/DecoratedFormFactor/FormFactorDecoratorDebyeWaller.h b/Core/DecoratedFormFactor/FormFactorDecoratorDebyeWaller.h index 9d867c7363ddc08d701f74758c99156a994d51c4..6098742171103a2dc4f2ffd892712d2f4f9588b9 100644 --- a/Core/DecoratedFormFactor/FormFactorDecoratorDebyeWaller.h +++ b/Core/DecoratedFormFactor/FormFactorDecoratorDebyeWaller.h @@ -29,18 +29,22 @@ public: double dw_r_factor); //! Isotropic Debye-Waller factor. - FormFactorDecoratorDebyeWaller(const IFormFactor& form_factor, double dw_factor); + FormFactorDecoratorDebyeWaller(const IFormFactor& form_factor, double dw_factor); - FormFactorDecoratorDebyeWaller* clone() const final { + FormFactorDecoratorDebyeWaller* clone() const override final { return new FormFactorDecoratorDebyeWaller(*mp_form_factor, m_h_dw_factor, m_r_dw_factor); } - void accept(ISampleVisitor* visitor) const final { visitor->visit(this); } + void accept(ISampleVisitor* visitor) const override final { visitor->visit(this); } - complex_t evaluate(const WavevectorInfo& wavevectors) const final; + complex_t evaluate(const WavevectorInfo& wavevectors) const override final; +#ifndef SWIG + Eigen::Matrix2cd evaluatePol(const WavevectorInfo& wavevectors) const override final; +#endif private: double m_h_dw_factor; //!< the Debye-Waller factor in the z-direction double m_r_dw_factor; //!< the Debye-Waller factor in the radial direction + double getDWFactor(const WavevectorInfo& wavevectors) const; }; #endif // FORMFACTORDECORATORDEBYEWALLER_H diff --git a/Core/DecoratedFormFactor/FormFactorDecoratorFactor.cpp b/Core/DecoratedFormFactor/FormFactorDecoratorFactor.cpp index cb2dfa9275359f5b53b2854b36aee253df150d62..6300e153dc24ef975195730e01565bac9014c390 100644 --- a/Core/DecoratedFormFactor/FormFactorDecoratorFactor.cpp +++ b/Core/DecoratedFormFactor/FormFactorDecoratorFactor.cpp @@ -27,3 +27,8 @@ complex_t FormFactorDecoratorFactor::evaluate(const WavevectorInfo& wavevectors) { return m_factor * mp_form_factor->evaluate(wavevectors); } + +Eigen::Matrix2cd FormFactorDecoratorFactor::evaluatePol(const WavevectorInfo &wavevectors) const +{ + return m_factor * mp_form_factor->evaluatePol(wavevectors); +} diff --git a/Core/DecoratedFormFactor/FormFactorDecoratorFactor.h b/Core/DecoratedFormFactor/FormFactorDecoratorFactor.h index d01e742b17cce24e261ae62f1ed816c03ef6ea6b..98a57d67362e299739fc0a47b1135a3009bd5532 100644 --- a/Core/DecoratedFormFactor/FormFactorDecoratorFactor.h +++ b/Core/DecoratedFormFactor/FormFactorDecoratorFactor.h @@ -26,12 +26,15 @@ class BA_CORE_API_ FormFactorDecoratorFactor : public IFormFactorDecorator { public: FormFactorDecoratorFactor(const IFormFactor& form_factor, const complex_t factor); - virtual FormFactorDecoratorFactor* clone() const { + FormFactorDecoratorFactor* clone() const override { return new FormFactorDecoratorFactor(*mp_form_factor, m_factor); } - virtual void accept(ISampleVisitor* visitor) const { visitor->visit(this); } + void accept(ISampleVisitor* visitor) const override { visitor->visit(this); } - virtual complex_t evaluate(const WavevectorInfo& wavevectors) const; + complex_t evaluate(const WavevectorInfo& wavevectors) const override; +#ifndef SWIG + Eigen::Matrix2cd evaluatePol(const WavevectorInfo& wavevectors) const override; +#endif protected: complex_t m_factor; diff --git a/Core/DecoratedFormFactor/FormFactorDecoratorMaterial.h b/Core/DecoratedFormFactor/FormFactorDecoratorMaterial.h index a619d0852cafd23e289e2f98e3273003a5afff7c..845b40fa4dcd6d44a8f5184f91d188dae8836682 100644 --- a/Core/DecoratedFormFactor/FormFactorDecoratorMaterial.h +++ b/Core/DecoratedFormFactor/FormFactorDecoratorMaterial.h @@ -30,23 +30,23 @@ class BA_CORE_API_ FormFactorDecoratorMaterial : public FormFactorDecoratorFacto public: FormFactorDecoratorMaterial(const IFormFactor& form_factor); - ~FormFactorDecoratorMaterial() final; + ~FormFactorDecoratorMaterial() override final; - FormFactorDecoratorMaterial* clone() const final; + FormFactorDecoratorMaterial* clone() const override final; - void accept(ISampleVisitor* visitor) const final { visitor->visit(this); } + void accept(ISampleVisitor* visitor) const override final { visitor->visit(this); } //! Sets the material of the scatterer void setMaterial(const IMaterial& material); //! Sets the ambient material - void setAmbientMaterial(const IMaterial& material); + void setAmbientMaterial(const IMaterial& material) override; complex_t getAmbientRefractiveIndex() const; #ifndef SWIG //! Returns scattering amplitude for matrix interactions - Eigen::Matrix2cd evaluatePol(const WavevectorInfo& wavevectors) const final; + Eigen::Matrix2cd evaluatePol(const WavevectorInfo& wavevectors) const override final; #endif private: diff --git a/Core/DecoratedFormFactor/FormFactorDecoratorPositionFactor.h b/Core/DecoratedFormFactor/FormFactorDecoratorPositionFactor.h index 1e8fa15d2b1552585d645a444c80c168fd4b082f..455cc273124ea46f61b9cfdc6a28acda3e67b221 100644 --- a/Core/DecoratedFormFactor/FormFactorDecoratorPositionFactor.h +++ b/Core/DecoratedFormFactor/FormFactorDecoratorPositionFactor.h @@ -27,15 +27,14 @@ class BA_CORE_API_ FormFactorDecoratorPositionFactor : public IFormFactorDecorat public: FormFactorDecoratorPositionFactor(const IFormFactor& form_factor, const kvector_t& position); - FormFactorDecoratorPositionFactor* clone() const final{ + FormFactorDecoratorPositionFactor* clone() const override final { return new FormFactorDecoratorPositionFactor(*mp_form_factor, m_position); } - void accept(ISampleVisitor* visitor) const final { visitor->visit(this); } - - complex_t evaluate(const WavevectorInfo& wavevectors) const final; + void accept(ISampleVisitor* visitor) const override final { visitor->visit(this); } + complex_t evaluate(const WavevectorInfo& wavevectors) const override final; #ifndef SWIG - Eigen::Matrix2cd evaluatePol(const WavevectorInfo& wavevectors) const final; + Eigen::Matrix2cd evaluatePol(const WavevectorInfo& wavevectors) const override final; #endif private: diff --git a/Core/DecoratedFormFactor/FormFactorDecoratorRotation.cpp b/Core/DecoratedFormFactor/FormFactorDecoratorRotation.cpp index 927b3eb00e30b40692950d5432897c61098d6997..768d7fe8cd2a1e99b3258ca37224b7ad38dade38 100644 --- a/Core/DecoratedFormFactor/FormFactorDecoratorRotation.cpp +++ b/Core/DecoratedFormFactor/FormFactorDecoratorRotation.cpp @@ -27,19 +27,36 @@ FormFactorDecoratorRotation::FormFactorDecoratorRotation( m_transform = rotation.getTransform3D(); } -// TODO: can we avoid the conversion from IRotation to Transform3D and back? - FormFactorDecoratorRotation* FormFactorDecoratorRotation::clone() const { - std::unique_ptr<IRotation> P_rotation(IRotation::createRotation(m_transform)); - return new FormFactorDecoratorRotation(*mp_form_factor, *P_rotation); + return new FormFactorDecoratorRotation(*mp_form_factor, m_transform); } complex_t FormFactorDecoratorRotation::evaluate(const WavevectorInfo& wavevectors) const +{ + WavevectorInfo rotated_wavevectors = rotate_wavevectors(wavevectors); + return mp_form_factor->evaluate(rotated_wavevectors); +} + +Eigen::Matrix2cd FormFactorDecoratorRotation::evaluatePol(const WavevectorInfo &wavevectors) const +{ + WavevectorInfo rotated_wavevectors = rotate_wavevectors(wavevectors); + return mp_form_factor->evaluatePol(rotated_wavevectors); +} + +FormFactorDecoratorRotation::FormFactorDecoratorRotation(const IFormFactor &form_factor, + const Transform3D &transform) + : IFormFactorDecorator(form_factor) +{ + setName(BornAgain::FormFactorDecoratorRotationType); + m_transform = transform; +} + +WavevectorInfo FormFactorDecoratorRotation::rotate_wavevectors( + const WavevectorInfo& wavevectors) const { cvector_t rotated_ki = m_transform.transformedInverse(wavevectors.getKi()); cvector_t rotated_kf = m_transform.transformedInverse(wavevectors.getKf()); double wavelength = wavevectors.getWavelength(); - WavevectorInfo rotated_wavevectors(rotated_ki, rotated_kf, wavelength); - return mp_form_factor->evaluate(rotated_wavevectors); + return WavevectorInfo(rotated_ki, rotated_kf, wavelength); } diff --git a/Core/DecoratedFormFactor/FormFactorDecoratorRotation.h b/Core/DecoratedFormFactor/FormFactorDecoratorRotation.h index 68797eab999a762471f214dffec47965ec73c3e4..5c810be023ab46f3de695dde59249cadcbf0aa3c 100644 --- a/Core/DecoratedFormFactor/FormFactorDecoratorRotation.h +++ b/Core/DecoratedFormFactor/FormFactorDecoratorRotation.h @@ -29,14 +29,20 @@ public: //! Constructor, setting form factor and rotation. FormFactorDecoratorRotation(const IFormFactor &form_factor, const IRotation &rotation); - FormFactorDecoratorRotation *clone() const final; + FormFactorDecoratorRotation *clone() const override final; - void accept(ISampleVisitor *visitor) const final { visitor->visit(this); } + void accept(ISampleVisitor *visitor) const override final { visitor->visit(this); } - complex_t evaluate(const WavevectorInfo& wavevectors) const final; + complex_t evaluate(const WavevectorInfo& wavevectors) const override final; +#ifndef SWIG + Eigen::Matrix2cd evaluatePol(const WavevectorInfo& wavevectors) const override final; +#endif -protected: +private: Transform3D m_transform; + //! Private constructor for cloning. + FormFactorDecoratorRotation(const IFormFactor &form_factor, const Transform3D &transform); + WavevectorInfo rotate_wavevectors(const WavevectorInfo& wavevectors) const; }; #endif // FORMFACTORDECORATORROTATION_H diff --git a/Core/DecoratedFormFactor/IFormFactorDecorator.h b/Core/DecoratedFormFactor/IFormFactorDecorator.h index 3328d5ccdfc009c318ff9be3dc2a52b6752f1e18..954c6f49fb290a720c4c96203dedb09d046652d2 100644 --- a/Core/DecoratedFormFactor/IFormFactorDecorator.h +++ b/Core/DecoratedFormFactor/IFormFactorDecorator.h @@ -29,19 +29,18 @@ class BA_CORE_API_ IFormFactorDecorator : public IFormFactor { public: - IFormFactorDecorator() =delete; IFormFactorDecorator(const IFormFactor& form_factor) : mp_form_factor(form_factor.clone()) {} - virtual ~IFormFactorDecorator() { delete mp_form_factor; } - virtual IFormFactorDecorator* clone() const =0; - virtual void accept(ISampleVisitor* visitor) const =0; + ~IFormFactorDecorator() override { delete mp_form_factor; } + IFormFactorDecorator* clone() const override=0; + void accept(ISampleVisitor* visitor) const override=0; - virtual void setAmbientMaterial(const IMaterial &material) { - mp_form_factor->setAmbientMaterial(material); } + void setAmbientMaterial(const IMaterial &material) override { + mp_form_factor->setAmbientMaterial(material); } - virtual double getVolume() const { + double getVolume() const override { return mp_form_factor->getVolume(); } - virtual double getRadialExtension() const { + double getRadialExtension() const override { return mp_form_factor->getRadialExtension(); } protected: diff --git a/Core/HardParticle/FormFactorAnisoPyramid.h b/Core/HardParticle/FormFactorAnisoPyramid.h index 4b088db09cb563da577789aa257d7f24e6b17377..56a1f7c77dde7177e373d7b584efb3c26799eadb 100644 --- a/Core/HardParticle/FormFactorAnisoPyramid.h +++ b/Core/HardParticle/FormFactorAnisoPyramid.h @@ -26,18 +26,20 @@ class BA_CORE_API_ FormFactorAnisoPyramid : public FormFactorPolyhedron public: FormFactorAnisoPyramid(double length, double width, double height, double alpha); - FormFactorAnisoPyramid* clone() const final { + FormFactorAnisoPyramid* clone() const override final { return new FormFactorAnisoPyramid(m_length, m_width, m_height, m_alpha); } - void accept(ISampleVisitor* visitor) const final { visitor->visit(this); } + void accept(ISampleVisitor* visitor) const override final { visitor->visit(this); } double getLength() const { return m_length; } double getWidth() const { return m_width; } double getHeight() const { return m_height; } double getAlpha() const { return m_alpha; } +protected: + void onChange() override final; + private: static const PolyhedralTopology topology; - void onChange() final; double m_length; double m_width; diff --git a/Core/HardParticle/FormFactorBox.h b/Core/HardParticle/FormFactorBox.h index 4b1b2a43ab7939e4090fcdc3bc135d56db473e3d..aa82a3e1eece820934ec5ab7ee5563432fca7e84 100644 --- a/Core/HardParticle/FormFactorBox.h +++ b/Core/HardParticle/FormFactorBox.h @@ -26,17 +26,18 @@ class BA_CORE_API_ FormFactorBox : public IFormFactorBorn public: FormFactorBox( double length, double width, double height); - FormFactorBox* clone() const { return new FormFactorBox(m_length, m_width, m_height); } + FormFactorBox* clone() const override final { + return new FormFactorBox(m_length, m_width, m_height); } - void accept(ISampleVisitor* visitor) const final { visitor->visit(this); } + void accept(ISampleVisitor* visitor) const override final { visitor->visit(this); } double getLength() const { return m_length; } double getHeight() const { return m_height; } double getWidth() const { return m_width; } - double getRadialExtension() const final { return m_length/2.0; } + double getRadialExtension() const override final { return m_length/2.0; } - complex_t evaluate_for_q(const cvector_t q) const final; + complex_t evaluate_for_q(const cvector_t q) const override final; private: double m_length; diff --git a/Core/HardParticle/FormFactorCone.h b/Core/HardParticle/FormFactorCone.h index 18645537181c476afa74834ba686e6103a66e46c..660f03a1e3e105c5d51c7996be8f73df2734784b 100644 --- a/Core/HardParticle/FormFactorCone.h +++ b/Core/HardParticle/FormFactorCone.h @@ -29,18 +29,18 @@ class BA_CORE_API_ FormFactorCone : public IFormFactorBorn { public: FormFactorCone(double radius, double height, double alpha); - virtual ~FormFactorCone() {} - FormFactorCone* clone() const { return new FormFactorCone(m_radius, m_height, m_alpha); } - void accept(ISampleVisitor* visitor) const final { visitor->visit(this); } + FormFactorCone* clone() const override final { + return new FormFactorCone(m_radius, m_height, m_alpha); } + void accept(ISampleVisitor* visitor) const override final { visitor->visit(this); } double getHeight() const { return m_height; } double getAlpha() const { return m_alpha; } double getRadius() const { return m_radius; } - double getRadialExtension() const final { return m_radius; } + double getRadialExtension() const override final { return m_radius; } - complex_t evaluate_for_q (const cvector_t q) const final; + complex_t evaluate_for_q (const cvector_t q) const override final; private: complex_t Integrand(double Z) const; diff --git a/Core/HardParticle/FormFactorCone6.h b/Core/HardParticle/FormFactorCone6.h index c183a4dc848f7e6383bb6b29dfb3138126a17e43..d5b08462581daaaab00ca8fc583523d5b91948ed 100644 --- a/Core/HardParticle/FormFactorCone6.h +++ b/Core/HardParticle/FormFactorCone6.h @@ -26,17 +26,19 @@ class BA_CORE_API_ FormFactorCone6 : public FormFactorPolyhedron public: FormFactorCone6(double base_edge, double height, double alpha); - virtual FormFactorCone6* clone() const { + FormFactorCone6* clone() const override final { return new FormFactorCone6(m_base_edge, m_height, m_alpha); } - virtual void accept(ISampleVisitor *visitor) const { visitor->visit(this); } + void accept(ISampleVisitor *visitor) const override final { visitor->visit(this); } double getBaseEdge() const { return m_base_edge; } double getHeight() const { return m_height; } double getAlpha() const { return m_alpha; } +protected: + void onChange() override final; + private: static const PolyhedralTopology topology; - void onChange() final; double m_base_edge; double m_height; double m_alpha; diff --git a/Core/HardParticle/FormFactorCuboctahedron.h b/Core/HardParticle/FormFactorCuboctahedron.h index eb3a31c7484377163cda83240e473678d8dede64..f5d690652cca475e9b0cbe5e950159ab53b844d9 100644 --- a/Core/HardParticle/FormFactorCuboctahedron.h +++ b/Core/HardParticle/FormFactorCuboctahedron.h @@ -26,18 +26,20 @@ class BA_CORE_API_ FormFactorCuboctahedron : public FormFactorPolyhedron public: FormFactorCuboctahedron(double length, double height, double height_ratio, double alpha); - FormFactorCuboctahedron *clone() const final { + FormFactorCuboctahedron *clone() const override final { return new FormFactorCuboctahedron(m_length, m_height, m_height_ratio, m_alpha); } - void accept(ISampleVisitor *visitor) const final { visitor->visit(this); } + void accept(ISampleVisitor *visitor) const override final { visitor->visit(this); } double getLength() const { return m_length; } double getHeight() const { return m_height; } double getHeightRatio() const { return m_height_ratio; } double getAlpha() const { return m_alpha; } +protected: + void onChange() override final; + private: static const PolyhedralTopology topology; - void onChange() final; double m_length; double m_height; diff --git a/Core/HardParticle/FormFactorCylinder.h b/Core/HardParticle/FormFactorCylinder.h index 0193f611342cbd48667dd91fe8c6f9858de05eb3..482e516610cf3f2a9b61be3fb297cb59becc1093 100644 --- a/Core/HardParticle/FormFactorCylinder.h +++ b/Core/HardParticle/FormFactorCylinder.h @@ -25,17 +25,17 @@ class BA_CORE_API_ FormFactorCylinder : public IFormFactorBorn { public: FormFactorCylinder(double radius, double height); - virtual ~FormFactorCylinder() {} - FormFactorCylinder* clone() const { return new FormFactorCylinder(m_radius, m_height); } - void accept(ISampleVisitor* visitor) const final { visitor->visit(this); } + FormFactorCylinder* clone() const override final { + return new FormFactorCylinder(m_radius, m_height); } + void accept(ISampleVisitor* visitor) const override final { visitor->visit(this); } double getHeight() const { return m_height; } double getRadius() const { return m_radius; } - double getRadialExtension() const final { return m_radius; } + double getRadialExtension() const override final { return m_radius; } - complex_t evaluate_for_q(const cvector_t q) const final; + complex_t evaluate_for_q(const cvector_t q) const override final; private: double m_radius; diff --git a/Core/HardParticle/FormFactorDodecahedron.h b/Core/HardParticle/FormFactorDodecahedron.h index 0525080c220ef79fb8c9ba8fd02486681bcea0c6..df88a1235715ce561c846321ae5ca093f67aa9f0 100644 --- a/Core/HardParticle/FormFactorDodecahedron.h +++ b/Core/HardParticle/FormFactorDodecahedron.h @@ -28,14 +28,17 @@ public: //! @param edge length FormFactorDodecahedron(double edge); - FormFactorDodecahedron *clone() const final { return new FormFactorDodecahedron(m_edge); } - void accept(ISampleVisitor *visitor) const final { visitor->visit(this); } + FormFactorDodecahedron *clone() const override final { + return new FormFactorDodecahedron(m_edge); } + void accept(ISampleVisitor *visitor) const override final { visitor->visit(this); } double getEdge() const { return m_edge; } +protected: + void onChange() override final; + private: static const PolyhedralTopology topology; - void onChange() final; double m_edge; }; diff --git a/Core/HardParticle/FormFactorEllipsoidalCylinder.h b/Core/HardParticle/FormFactorEllipsoidalCylinder.h index b8c7085004fd79f0b8aff3ef6c1eed7b80ad2f16..7e24803359dd5746487bc767696a324c76c9146a 100644 --- a/Core/HardParticle/FormFactorEllipsoidalCylinder.h +++ b/Core/HardParticle/FormFactorEllipsoidalCylinder.h @@ -26,17 +26,17 @@ class BA_CORE_API_ FormFactorEllipsoidalCylinder : public IFormFactorBorn public: FormFactorEllipsoidalCylinder(double radius_x, double radius_y, double height); - FormFactorEllipsoidalCylinder* clone() const { + FormFactorEllipsoidalCylinder* clone() const override final { return new FormFactorEllipsoidalCylinder(m_radius_x, m_radius_y, m_height); } - void accept(ISampleVisitor* visitor) const final { visitor->visit(this); } + void accept(ISampleVisitor* visitor) const override final { visitor->visit(this); } double getRadiusX() const { return m_radius_x; } double getRadiusY() const { return m_radius_y; } double getHeight() const { return m_height; } - double getRadialExtension() const final; + double getRadialExtension() const override final; - complex_t evaluate_for_q(const cvector_t q) const final; + complex_t evaluate_for_q(const cvector_t q) const override final; private: double m_radius_x; diff --git a/Core/HardParticle/FormFactorFullSphere.h b/Core/HardParticle/FormFactorFullSphere.h index f67a8a90262a4d6aeb931ecbed9b830bfa93495a..b8484d998aee36a86ede9e1e03192a749041e934 100644 --- a/Core/HardParticle/FormFactorFullSphere.h +++ b/Core/HardParticle/FormFactorFullSphere.h @@ -26,14 +26,15 @@ class BA_CORE_API_ FormFactorFullSphere : public IFormFactorBorn public: FormFactorFullSphere(double radius); - FormFactorFullSphere* clone() const{ return new FormFactorFullSphere(m_radius); } - void accept(ISampleVisitor* visitor) const final { visitor->visit(this); } + FormFactorFullSphere* clone() const override final { + return new FormFactorFullSphere(m_radius); } + void accept(ISampleVisitor* visitor) const override final { visitor->visit(this); } double getRadius() const { return m_radius; } - double getRadialExtension() const final { return m_radius; } + double getRadialExtension() const override final { return m_radius; } - complex_t evaluate_for_q(const cvector_t q) const final; + complex_t evaluate_for_q(const cvector_t q) const override final; private: double m_radius; diff --git a/Core/HardParticle/FormFactorFullSpheroid.h b/Core/HardParticle/FormFactorFullSpheroid.h index fae208f94ef7642d74c8d833e453e0f90fc914b4..45130d5004cbdf2f2bd928dec7be98800ca10f68 100644 --- a/Core/HardParticle/FormFactorFullSpheroid.h +++ b/Core/HardParticle/FormFactorFullSpheroid.h @@ -27,15 +27,16 @@ class BA_CORE_API_ FormFactorFullSpheroid : public IFormFactorBorn public: FormFactorFullSpheroid(double radius, double height); - FormFactorFullSpheroid* clone() const { return new FormFactorFullSpheroid(m_radius, m_height); } - void accept(ISampleVisitor* visitor) const final { visitor->visit(this); } + FormFactorFullSpheroid* clone() const override final { + return new FormFactorFullSpheroid(m_radius, m_height); } + void accept(ISampleVisitor* visitor) const override final { visitor->visit(this); } double getHeight() const { return m_height; } double getRadius() const { return m_radius; } - double getRadialExtension() const final { return m_radius; } + double getRadialExtension() const override final { return m_radius; } - complex_t evaluate_for_q(const cvector_t q) const final; + complex_t evaluate_for_q(const cvector_t q) const override final; private: complex_t Integrand(double Z) const; diff --git a/Core/HardParticle/FormFactorHemiEllipsoid.h b/Core/HardParticle/FormFactorHemiEllipsoid.h index aac1fb313c8e490dfbf9efe40e7b71ba2825ebc4..732b77e56218182c547d1eea13702fd16e4fc327 100644 --- a/Core/HardParticle/FormFactorHemiEllipsoid.h +++ b/Core/HardParticle/FormFactorHemiEllipsoid.h @@ -29,17 +29,17 @@ public: FormFactorHemiEllipsoid(double radius_x, double radius_y, double height); virtual ~FormFactorHemiEllipsoid() {} - FormFactorHemiEllipsoid* clone() const { + FormFactorHemiEllipsoid* clone() const override final { return new FormFactorHemiEllipsoid(m_radius_x, m_radius_y, m_height); } - void accept(ISampleVisitor *visitor) const final { visitor->visit(this); } + void accept(ISampleVisitor *visitor) const override final { visitor->visit(this); } double getHeight() const { return m_height; } double getRadiusX() const { return m_radius_x; } double getRadiusY() const { return m_radius_y; } - double getRadialExtension() const final; + double getRadialExtension() const override final; - complex_t evaluate_for_q (const cvector_t q) const final; + complex_t evaluate_for_q (const cvector_t q) const override final; private: complex_t Integrand(double Z) const; diff --git a/Core/HardParticle/FormFactorIcosahedron.h b/Core/HardParticle/FormFactorIcosahedron.h index cfc44d2f1c32e57c27fb4a2accb62ceb0fbd0390..2e3272b81182d549103ee5fa05a8b22db49b6d0b 100644 --- a/Core/HardParticle/FormFactorIcosahedron.h +++ b/Core/HardParticle/FormFactorIcosahedron.h @@ -26,14 +26,17 @@ class BA_CORE_API_ FormFactorIcosahedron : public FormFactorPolyhedron public: FormFactorIcosahedron(double edge); - FormFactorIcosahedron *clone() const final { return new FormFactorIcosahedron(m_edge); } - void accept(ISampleVisitor *visitor) const final { visitor->visit(this); } + FormFactorIcosahedron *clone() const override final { + return new FormFactorIcosahedron(m_edge); } + void accept(ISampleVisitor *visitor) const override final { visitor->visit(this); } double getEdge() const { return m_edge; } +protected: + void onChange() override final; + private: static const PolyhedralTopology topology; - void onChange() final; double m_edge; }; diff --git a/Core/HardParticle/FormFactorLongBoxGauss.h b/Core/HardParticle/FormFactorLongBoxGauss.h index c46033f348a8cfb1e2b8f3f5790a69d593afe842..7756ed0089126b10f7c3e760c0e275abdadcf339 100644 --- a/Core/HardParticle/FormFactorLongBoxGauss.h +++ b/Core/HardParticle/FormFactorLongBoxGauss.h @@ -30,16 +30,16 @@ public: //! @param height of Box FormFactorLongBoxGauss( double length, double width, double height); - FormFactorLongBoxGauss *clone() const { + FormFactorLongBoxGauss *clone() const override final { return new FormFactorLongBoxGauss(m_length, m_width, m_height); } - void accept(ISampleVisitor *visitor) const final { visitor->visit(this); } + void accept(ISampleVisitor *visitor) const override final { visitor->visit(this); } double getLength() const { return m_length; } double getHeight() const { return m_height; } double getWidth() const { return m_width; } - double getRadialExtension() const final{ return m_length/2.0; } + double getRadialExtension() const override final{ return m_length/2.0; } - complex_t evaluate_for_q(const cvector_t q) const final; + complex_t evaluate_for_q(const cvector_t q) const override final; private: double m_length; diff --git a/Core/HardParticle/FormFactorLongBoxLorentz.h b/Core/HardParticle/FormFactorLongBoxLorentz.h index 14ec255fd99ce8ad4a32cbd3d95a33d82c4cdc53..8cc5aa8568a5705166e65c8f4b82e126b1efefa2 100644 --- a/Core/HardParticle/FormFactorLongBoxLorentz.h +++ b/Core/HardParticle/FormFactorLongBoxLorentz.h @@ -30,17 +30,17 @@ public: //! @param height of Box FormFactorLongBoxLorentz( double length, double width, double height); - FormFactorLongBoxLorentz* clone() const { + FormFactorLongBoxLorentz* clone() const override final { return new FormFactorLongBoxLorentz(m_length, m_width, m_height); } - void accept(ISampleVisitor *visitor) const final { visitor->visit(this); } + void accept(ISampleVisitor *visitor) const override final { visitor->visit(this); } double getLength() const { return m_length; } double getHeight() const { return m_height; } double getWidth() const { return m_width; } - double getRadialExtension() const final { return m_length/2.0; } + double getRadialExtension() const override final { return m_length/2.0; } - complex_t evaluate_for_q(const cvector_t q) const final; + complex_t evaluate_for_q(const cvector_t q) const override final; private: double m_length; diff --git a/Core/HardParticle/FormFactorLongRipple1Gauss.h b/Core/HardParticle/FormFactorLongRipple1Gauss.h index 389566f9ea304e6c4e859b88f6727fe88553f7dd..020d70df520f3870e5a7a38d6988e7f344f5d741 100644 --- a/Core/HardParticle/FormFactorLongRipple1Gauss.h +++ b/Core/HardParticle/FormFactorLongRipple1Gauss.h @@ -30,25 +30,22 @@ public: //! @param width of cosine cross section //! @param height of cosine cross section FormFactorLongRipple1Gauss(double length, double width, double height); - virtual ~FormFactorLongRipple1Gauss() {} - FormFactorLongRipple1Gauss* clone() const { + FormFactorLongRipple1Gauss* clone() const override final { return new FormFactorLongRipple1Gauss(m_length, m_width, m_height); } - void accept(ISampleVisitor* visitor) const final { visitor->visit(this); } + void accept(ISampleVisitor* visitor) const override final { visitor->visit(this); } double getHeight() const { return m_height; } double getWidth() const { return m_width; } double getLength() const { return m_length; } - double getRadialExtension() const final; + double getRadialExtension() const override final; - complex_t evaluate_for_q(const cvector_t q) const final; - -protected: - virtual bool check_initialization() const; + complex_t evaluate_for_q(const cvector_t q) const override final; private: complex_t Integrand(double Z) const; + bool check_initialization() const; double m_length; double m_width; diff --git a/Core/HardParticle/FormFactorLongRipple1Lorentz.h b/Core/HardParticle/FormFactorLongRipple1Lorentz.h index da7a2fabd0d08e2c86902eaeadd14d52728f93b7..c4bdf0ba666dee908aa49a3af315b2dd0d4e8368 100644 --- a/Core/HardParticle/FormFactorLongRipple1Lorentz.h +++ b/Core/HardParticle/FormFactorLongRipple1Lorentz.h @@ -30,25 +30,22 @@ public: //! @param width of cosine cross section //! @param height of cosine cross section FormFactorLongRipple1Lorentz(double length, double width, double height); - virtual ~FormFactorLongRipple1Lorentz() {} - FormFactorLongRipple1Lorentz* clone() const { + FormFactorLongRipple1Lorentz* clone() const override final { return new FormFactorLongRipple1Lorentz(m_length, m_width, m_height); } - void accept(ISampleVisitor* visitor) const final { visitor->visit(this); } + void accept(ISampleVisitor* visitor) const override final { visitor->visit(this); } - double getRadialExtension() const final; + double getRadialExtension() const override final; double getHeight() const { return m_height; } double getWidth() const { return m_width; } double getLength() const { return m_length; } - complex_t evaluate_for_q(const cvector_t q) const final; - -protected: - virtual bool check_initialization() const; + complex_t evaluate_for_q(const cvector_t q) const override final; private: complex_t Integrand(double Z) const; + bool check_initialization() const; double m_length; double m_width; diff --git a/Core/HardParticle/FormFactorLongRipple2Gauss.h b/Core/HardParticle/FormFactorLongRipple2Gauss.h index f6f82d72c3e28aa3194b80382cd5b985a7518446..13acd7b898095f24fc82cd108f3b14008520735a 100644 --- a/Core/HardParticle/FormFactorLongRipple2Gauss.h +++ b/Core/HardParticle/FormFactorLongRipple2Gauss.h @@ -31,25 +31,23 @@ public: //! @param asymmetry length of triangular cross section FormFactorLongRipple2Gauss(double length, double width, double height, double asymmetry); - virtual ~FormFactorLongRipple2Gauss() {} - FormFactorLongRipple2Gauss* clone() const { + FormFactorLongRipple2Gauss* clone() const override final { return new FormFactorLongRipple2Gauss(m_length, m_width, m_height, m_d); } - void accept(ISampleVisitor* visitor) const final { visitor->visit(this); } + void accept(ISampleVisitor* visitor) const override final { visitor->visit(this); } double getHeight() const { return m_height; } double getWidth() const { return m_width; } double getLength() const { return m_length; } double getAsymmetry() const { return m_d; } - double getRadialExtension() const final; + double getRadialExtension() const override final; - complex_t evaluate_for_q(const cvector_t q) const final; - -protected: - virtual bool check_initialization() const; + complex_t evaluate_for_q(const cvector_t q) const override final; private: + bool check_initialization() const; + double m_width; double m_height; double m_length; diff --git a/Core/HardParticle/FormFactorLongRipple2Lorentz.h b/Core/HardParticle/FormFactorLongRipple2Lorentz.h index 72986eed8ebfdc0f8989e3d5b6e9ac60c71be910..05810989bb956c603c67ef739205e462e1baf636 100644 --- a/Core/HardParticle/FormFactorLongRipple2Lorentz.h +++ b/Core/HardParticle/FormFactorLongRipple2Lorentz.h @@ -25,20 +25,19 @@ class BA_CORE_API_ FormFactorLongRipple2Lorentz : public IFormFactorBorn { public: FormFactorLongRipple2Lorentz(double length, double width, double height, double asymmetry); - virtual ~FormFactorLongRipple2Lorentz() {} - FormFactorLongRipple2Lorentz *clone() const { + FormFactorLongRipple2Lorentz *clone() const override final { return new FormFactorLongRipple2Lorentz(m_length, m_width, m_height, m_d); } - void accept(ISampleVisitor *visitor) const final { visitor->visit(this); } + void accept(ISampleVisitor *visitor) const override final { visitor->visit(this); } double getHeight() const { return m_height; } double getWidth() const { return m_width; } double getLength() const { return m_length; } double getAsymmetry() const { return m_d; } - double getRadialExtension() const final; + double getRadialExtension() const override final; - complex_t evaluate_for_q(const cvector_t q) const final; + complex_t evaluate_for_q(const cvector_t q) const override final; private: void check_parameters() const; diff --git a/Core/HardParticle/FormFactorPolyhedron.h b/Core/HardParticle/FormFactorPolyhedron.h index 81934b96cf5d72cb1b2e937d19f709704e97b9ca..41be20c322d1b568934b1fddb5dbea4c05f202f0 100644 --- a/Core/HardParticle/FormFactorPolyhedron.h +++ b/Core/HardParticle/FormFactorPolyhedron.h @@ -105,12 +105,11 @@ public: FormFactorPolyhedron() {} - virtual void onChange() = 0; - complex_t evaluate_for_q(const cvector_t q) const final; + complex_t evaluate_for_q(const cvector_t q) const override final; complex_t evaluate_centered(const cvector_t q) const; - double getVolume() const final { return m_volume; } - double getRadialExtension() const final { return m_radius; } + double getVolume() const override final { return m_volume; } + double getRadialExtension() const override final { return m_radius; } void assert_platonic() const; protected: @@ -136,10 +135,10 @@ class BA_CORE_API_ FormFactorPolygonalPrism : public IFormFactorBorn { public: FormFactorPolygonalPrism(const double height) : m_height(height) {} - complex_t evaluate_for_q(const cvector_t q) const final; + complex_t evaluate_for_q(const cvector_t q) const override final; double getVolume() const; double getHeight() const { return m_height; } - double getRadialExtension() const final { return std::sqrt(m_base->area()); } + double getRadialExtension() const override final { return std::sqrt(m_base->area()); } protected: std::unique_ptr<PolyhedralFace> m_base; @@ -154,9 +153,9 @@ class FormFactorPolygonalSurface : public IFormFactorBorn { public: FormFactorPolygonalSurface() {} - complex_t evaluate_for_q(const cvector_t q) const final; - double getVolume() const { return 0; } - double getRadialExtension() const final { return std::sqrt(m_base->area()); } + complex_t evaluate_for_q(const cvector_t q) const override final; + double getVolume() const override { return 0; } + double getRadialExtension() const override final { return std::sqrt(m_base->area()); } protected: std::unique_ptr<PolyhedralFace> m_base; diff --git a/Core/HardParticle/FormFactorPrism3.h b/Core/HardParticle/FormFactorPrism3.h index fd706978148052ca6f15e03ee07f2ea3acb55da2..b119ce69417933ac38238bb14f83a4151e9fd4ce 100644 --- a/Core/HardParticle/FormFactorPrism3.h +++ b/Core/HardParticle/FormFactorPrism3.h @@ -25,13 +25,16 @@ class BA_CORE_API_ FormFactorPrism3 : public FormFactorPolygonalPrism public: FormFactorPrism3(const double base_edge, const double height); - virtual FormFactorPrism3 *clone() const { return new FormFactorPrism3(m_base_edge, m_height); } - virtual void accept(ISampleVisitor *visitor) const { visitor->visit(this); } + FormFactorPrism3 *clone() const override final { + return new FormFactorPrism3(m_base_edge, m_height); } + void accept(ISampleVisitor *visitor) const override final { visitor->visit(this); } double getBaseEdge() const { return m_base_edge; } +protected: + void onChange() override final; + private: - void onChange() final; double m_base_edge; }; diff --git a/Core/HardParticle/FormFactorPrism6.h b/Core/HardParticle/FormFactorPrism6.h index 24b02269b9de4d367b37fd011835dd8edf2ac896..b46071a05b8a7bbee5d96b0f8cf14ed8d39b4e83 100644 --- a/Core/HardParticle/FormFactorPrism6.h +++ b/Core/HardParticle/FormFactorPrism6.h @@ -25,14 +25,16 @@ class BA_CORE_API_ FormFactorPrism6 : public FormFactorPolygonalPrism public: FormFactorPrism6(const double base_edge, const double height); - virtual FormFactorPrism6 *clone() const { + FormFactorPrism6 *clone() const override final { return new FormFactorPrism6(m_base_edge, m_height); } - virtual void accept(ISampleVisitor *visitor) const { visitor->visit(this); } + void accept(ISampleVisitor *visitor) const override final { visitor->visit(this); } - virtual double getBaseEdge() const { return m_base_edge; } + double getBaseEdge() const { return m_base_edge; } + +protected: + void onChange() override final; private: - void onChange() final; double m_base_edge; }; diff --git a/Core/HardParticle/FormFactorPyramid.h b/Core/HardParticle/FormFactorPyramid.h index bed38befdd8d81bca3b7e903f3e0e33c5c4601df..9ece0f1947ab032ff42617fe055f904ec41a4272 100644 --- a/Core/HardParticle/FormFactorPyramid.h +++ b/Core/HardParticle/FormFactorPyramid.h @@ -26,17 +26,19 @@ class BA_CORE_API_ FormFactorPyramid : public FormFactorPolyhedron public: FormFactorPyramid(double base_edge, double height, double alpha); - FormFactorPyramid* clone() const final { + FormFactorPyramid* clone() const override final { return new FormFactorPyramid(m_base_edge, m_height, m_alpha); } - void accept(ISampleVisitor *visitor) const final { visitor->visit(this); } + void accept(ISampleVisitor *visitor) const override final { visitor->visit(this); } double getHeight() const { return m_height; } double getBaseEdge() const { return m_base_edge; } double getAlpha() const { return m_alpha; } +protected: + void onChange() override final; + private: static const PolyhedralTopology topology; - void onChange() final; double m_base_edge; double m_height; diff --git a/Core/HardParticle/FormFactorRipple1.h b/Core/HardParticle/FormFactorRipple1.h index a42b99606c13176ee8cbf95b47240aa5d54c51fe..bcfc54dc3c8887d50910282d7c14eed4cae1a015 100644 --- a/Core/HardParticle/FormFactorRipple1.h +++ b/Core/HardParticle/FormFactorRipple1.h @@ -30,24 +30,22 @@ public: //! @param width of cosine cross section //! @param height of cosine cross section FormFactorRipple1(double length, double width, double height); - virtual ~FormFactorRipple1() {} - FormFactorRipple1* clone() const { return new FormFactorRipple1(m_length, m_width, m_height); } - void accept(ISampleVisitor* visitor) const final { visitor->visit(this); } + FormFactorRipple1* clone() const override final { + return new FormFactorRipple1(m_length, m_width, m_height); } + void accept(ISampleVisitor* visitor) const override final { visitor->visit(this); } double getLength() const { return m_length; } double getHeight() const { return m_height; } double getWidth() const { return m_width; } - double getRadialExtension() const final; + double getRadialExtension() const override final; - complex_t evaluate_for_q(const cvector_t q) const final; - -protected: - virtual bool check_initialization() const; + complex_t evaluate_for_q(const cvector_t q) const override final; private: complex_t Integrand(double u) const; + bool check_initialization() const; double m_length; double m_width; diff --git a/Core/HardParticle/FormFactorRipple2.cpp b/Core/HardParticle/FormFactorRipple2.cpp index 06ee2d6430ddbdd425374aa3a318f038f185a541..72a9e61c8b8308f673784fc7467225a8f4dcf649 100644 --- a/Core/HardParticle/FormFactorRipple2.cpp +++ b/Core/HardParticle/FormFactorRipple2.cpp @@ -30,36 +30,6 @@ FormFactorRipple2::FormFactorRipple2(double length, double width, double height, registerParameter(BornAgain::AsymmetryLength, &m_d).setUnit("nm"); } -bool FormFactorRipple2::check_initialization() const -{ - bool result(true); - std::string message; - if(-1*m_width > 2.*m_d) { - result = false; - message = std::string("Check for '-1*width <= 2.*asymmetry' failed."); - } - if(m_width < 2.*m_d) { - result = false; - message = std::string("Check for 'width >= 2.*asymmetry' failed."); - } - if(m_height <=0) { - result = false; - message = std::string("Check for 'height > 0' failed."); - } - - if(!result) { - std::ostringstream ostr; - ostr << "FormFactorRipple2() -> Error in class initialization with parameters "; - ostr << " width:" << m_width; - ostr << " height:" << m_height; - ostr << " length:" << m_length; - ostr << " asymmetry:" << m_d << "\n\n"; - ostr << message; - throw Exceptions::ClassInitializationException(ostr.str()); - } - return result; -} - double FormFactorRipple2::getRadialExtension() const { return ( m_width + m_length ) / 4.0; @@ -95,3 +65,33 @@ complex_t FormFactorRipple2::evaluate_for_q(const cvector_t q) const } return factor * result; } + +bool FormFactorRipple2::check_initialization() const +{ + bool result(true); + std::string message; + if(-1*m_width > 2.*m_d) { + result = false; + message = std::string("Check for '-1*width <= 2.*asymmetry' failed."); + } + if(m_width < 2.*m_d) { + result = false; + message = std::string("Check for 'width >= 2.*asymmetry' failed."); + } + if(m_height <=0) { + result = false; + message = std::string("Check for 'height > 0' failed."); + } + + if(!result) { + std::ostringstream ostr; + ostr << "FormFactorRipple2() -> Error in class initialization with parameters "; + ostr << " width:" << m_width; + ostr << " height:" << m_height; + ostr << " length:" << m_length; + ostr << " asymmetry:" << m_d << "\n\n"; + ostr << message; + throw Exceptions::ClassInitializationException(ostr.str()); + } + return result; +} diff --git a/Core/HardParticle/FormFactorRipple2.h b/Core/HardParticle/FormFactorRipple2.h index 3c6a022b0c3b3e451bead61ebafcb7fb34ae9c2c..98314f1636fab3763e8c2675e411bbcd44b42fdc 100644 --- a/Core/HardParticle/FormFactorRipple2.h +++ b/Core/HardParticle/FormFactorRipple2.h @@ -31,25 +31,21 @@ public: //! @param asymmetry length of triangular cross section FormFactorRipple2(double length, double width, double height, double asymmetry); - virtual ~FormFactorRipple2() { } - - FormFactorRipple2 *clone() const{ + FormFactorRipple2 *clone() const override final { return new FormFactorRipple2(m_length, m_width, m_height, m_d); } - void accept(ISampleVisitor *visitor) const final { visitor->visit(this); } + void accept(ISampleVisitor *visitor) const override final { visitor->visit(this); } double getHeight() const { return m_height; } double getWidth() const { return m_width; } double getLength() const { return m_length; } double getAsymmetry() const { return m_d; } - double getRadialExtension() const final; - - complex_t evaluate_for_q(const cvector_t q) const final; + double getRadialExtension() const override final; -protected: - virtual bool check_initialization() const; + complex_t evaluate_for_q(const cvector_t q) const override final; private: + bool check_initialization() const; double m_length; double m_width; double m_height; diff --git a/Core/HardParticle/FormFactorTetrahedron.h b/Core/HardParticle/FormFactorTetrahedron.h index c8887742bdc0b90240c32f42244ca459584cdea7..51215d6ecb848bf5486d804d8b2dbb32f92d5d5b 100644 --- a/Core/HardParticle/FormFactorTetrahedron.h +++ b/Core/HardParticle/FormFactorTetrahedron.h @@ -26,17 +26,19 @@ class BA_CORE_API_ FormFactorTetrahedron : public FormFactorPolyhedron public: FormFactorTetrahedron(double base_edge, double height, double alpha); - virtual FormFactorTetrahedron *clone() const { + FormFactorTetrahedron *clone() const override final { return new FormFactorTetrahedron(m_base_edge, m_height, m_alpha); } - virtual void accept(ISampleVisitor *visitor) const { visitor->visit(this); } + void accept(ISampleVisitor *visitor) const override final { visitor->visit(this); } double getBaseEdge() const { return m_base_edge; } double getHeight() const { return m_height; } double getAlpha() const { return m_alpha; } +protected: + void onChange() override final; + private: static const PolyhedralTopology topology; - void onChange() final; double m_base_edge; double m_height; double m_alpha; diff --git a/Core/HardParticle/FormFactorTriangle.h b/Core/HardParticle/FormFactorTriangle.h index e3b2fd1257849a3ddcc369ab6199626a8583c907..a84ce2ddfed0a6f0e8188631f0d8051135ae2776 100644 --- a/Core/HardParticle/FormFactorTriangle.h +++ b/Core/HardParticle/FormFactorTriangle.h @@ -24,13 +24,15 @@ class BA_CORE_API_ FormFactorTriangle : public FormFactorPolygonalSurface public: FormFactorTriangle(const double base_edge); - virtual FormFactorTriangle* clone() const { return new FormFactorTriangle(m_base_edge); } - virtual void accept(ISampleVisitor* visitor) const { visitor->visit(this); } + FormFactorTriangle* clone() const override final { return new FormFactorTriangle(m_base_edge); } + void accept(ISampleVisitor* visitor) const override final { visitor->visit(this); } double getBaseEdge() const { return m_base_edge; } +protected: + void onChange() override final; + private: - void onChange() final; double m_base_edge; }; diff --git a/Core/HardParticle/FormFactorTrivial.h b/Core/HardParticle/FormFactorTrivial.h index 2d1216f9084fb62866412b122070f26c20956cd8..8a31f7917b22527aab6b3091a8ba490e2ec3a915 100644 --- a/Core/HardParticle/FormFactorTrivial.h +++ b/Core/HardParticle/FormFactorTrivial.h @@ -26,13 +26,13 @@ class BA_CORE_API_ FormFactorTrivial : public IFormFactorBorn public: FormFactorTrivial(); - FormFactorTrivial* clone() const { return new FormFactorTrivial(); } + FormFactorTrivial* clone() const override final { return new FormFactorTrivial(); } - void accept(ISampleVisitor* visitor) const final { visitor->visit(this); } + void accept(ISampleVisitor* visitor) const override final { visitor->visit(this); } - double getRadialExtension() const final { return 0; } + double getRadialExtension() const override final { return 0; } - complex_t evaluate_for_q(const cvector_t) const final { return 1; } + complex_t evaluate_for_q(const cvector_t) const override final { return 1; } }; #endif // FORMFACTORTRIVIAL_H diff --git a/Core/HardParticle/FormFactorTruncatedCube.h b/Core/HardParticle/FormFactorTruncatedCube.h index 99319c0ca87c9bfb38a28cf60cf52afb1b8891a1..a5048daf63543ca95f477ceee16144a862625a01 100644 --- a/Core/HardParticle/FormFactorTruncatedCube.h +++ b/Core/HardParticle/FormFactorTruncatedCube.h @@ -26,16 +26,18 @@ class BA_CORE_API_ FormFactorTruncatedCube : public FormFactorPolyhedron public: FormFactorTruncatedCube(double length, double removed_length); - FormFactorTruncatedCube*clone() const final { + FormFactorTruncatedCube*clone() const override final { return new FormFactorTruncatedCube(m_length, m_removed_length); } - void accept(ISampleVisitor*visitor) const final { visitor->visit(this); } + void accept(ISampleVisitor*visitor) const override final { visitor->visit(this); } double getLength() const { return m_length; } double getRemovedLength() const { return m_removed_length; } +protected: + void onChange() override final; + private: static const PolyhedralTopology topology; - void onChange() final; double m_length; double m_removed_length; }; diff --git a/Core/HardParticle/FormFactorTruncatedSphere.cpp b/Core/HardParticle/FormFactorTruncatedSphere.cpp index 97e5dad665dd6b6c3c9235bc6fd0d10fbdf173c5..9937f791467607beaf5e14ca4033d579c1954f01 100644 --- a/Core/HardParticle/FormFactorTruncatedSphere.cpp +++ b/Core/HardParticle/FormFactorTruncatedSphere.cpp @@ -34,8 +34,6 @@ FormFactorTruncatedSphere::FormFactorTruncatedSphere(double radius, double heigh mP_integrator = make_integrator_complex(this, &FormFactorTruncatedSphere::Integrand); } -FormFactorTruncatedSphere::~FormFactorTruncatedSphere() {} - bool FormFactorTruncatedSphere::check_initialization() const { bool result(true); diff --git a/Core/HardParticle/FormFactorTruncatedSphere.h b/Core/HardParticle/FormFactorTruncatedSphere.h index f34aac4f94daa249d253836c9e42887e44a02108..658fe2e4e51935e43cea5521d144b692590f95d8 100644 --- a/Core/HardParticle/FormFactorTruncatedSphere.h +++ b/Core/HardParticle/FormFactorTruncatedSphere.h @@ -26,22 +26,20 @@ class BA_CORE_API_ FormFactorTruncatedSphere : public IFormFactorBorn { public: FormFactorTruncatedSphere(double radius, double height); - virtual ~FormFactorTruncatedSphere(); - FormFactorTruncatedSphere *clone() const { + FormFactorTruncatedSphere *clone() const override final { return new FormFactorTruncatedSphere(m_radius, m_height); } - void accept(ISampleVisitor *visitor) const final { visitor->visit(this); } + void accept(ISampleVisitor *visitor) const override final { visitor->visit(this); } double getHeight() const { return m_height; } double getRadius() const { return m_radius; } - double getRadialExtension() const final { return m_radius; } + double getRadialExtension() const override final { return m_radius; } -protected: - virtual bool check_initialization() const; - virtual complex_t evaluate_for_q(const cvector_t q) const; + complex_t evaluate_for_q(const cvector_t q) const override final; private: + bool check_initialization() const; complex_t Integrand(double Z) const; double m_radius; diff --git a/Core/HardParticle/FormFactorTruncatedSpheroid.h b/Core/HardParticle/FormFactorTruncatedSpheroid.h index 5654a1d2cd828b8b613f1400e3fc3e492f25e32a..bf03b07d5d67d882c71c2bed757d2e5197ed5914 100644 --- a/Core/HardParticle/FormFactorTruncatedSpheroid.h +++ b/Core/HardParticle/FormFactorTruncatedSpheroid.h @@ -27,25 +27,21 @@ class BA_CORE_API_ FormFactorTruncatedSpheroid : public IFormFactorBorn { public: FormFactorTruncatedSpheroid(double radius, double height, double height_flattening); - virtual ~FormFactorTruncatedSpheroid() {} - FormFactorTruncatedSpheroid* clone() const { + FormFactorTruncatedSpheroid* clone() const override final { return new FormFactorTruncatedSpheroid(m_radius, m_height, m_height_flattening); } - void accept(ISampleVisitor* visitor) const final { visitor->visit(this); } + void accept(ISampleVisitor* visitor) const override final { visitor->visit(this); } double getRadius() const { return m_radius; } double getHeight() const { return m_height; } double getHeightFlattening() const { return m_height_flattening; } - double getRadialExtension() const final { return m_radius; } + double getRadialExtension() const override final { return m_radius; } - complex_t evaluate_for_q(const cvector_t q) const final; - -protected: - virtual bool check_initialization() const; + complex_t evaluate_for_q(const cvector_t q) const override final; private: - + bool check_initialization() const; complex_t Integrand(double Z) const; double m_radius; diff --git a/Core/Multilayer/FormFactorDWBA.cpp b/Core/Multilayer/FormFactorDWBA.cpp index 0a69a46d818dc7c02c7623ea76ecda89e9410439..f0ca0046af77f40ef9fec83f271a94d8ce9d1567 100644 --- a/Core/Multilayer/FormFactorDWBA.cpp +++ b/Core/Multilayer/FormFactorDWBA.cpp @@ -19,13 +19,16 @@ #include "WavevectorInfo.h" FormFactorDWBA::FormFactorDWBA(const IFormFactor& form_factor) - : IFormFactorDecorator(form_factor) + : mp_form_factor(form_factor.clone()) , mp_in_coeffs(0) , mp_out_coeffs(0) { setName(BornAgain::FormFactorDWBAType); } +FormFactorDWBA::~FormFactorDWBA() +{} + FormFactorDWBA* FormFactorDWBA::clone() const { FormFactorDWBA* result = new FormFactorDWBA(*mp_form_factor); @@ -33,13 +36,6 @@ FormFactorDWBA* FormFactorDWBA::clone() const return result; } -void FormFactorDWBA::setSpecularInfo(const ILayerRTCoefficients* p_in_coeffs, - const ILayerRTCoefficients* p_out_coeffs) -{ - mp_in_coeffs = p_in_coeffs; - mp_out_coeffs = p_out_coeffs; -} - complex_t FormFactorDWBA::evaluate(const WavevectorInfo& wavevectors) const { // Retrieve the two different incoming wavevectors in the layer @@ -76,3 +72,10 @@ complex_t FormFactorDWBA::evaluate(const WavevectorInfo& wavevectors) const return term_S + term_RS + term_SR + term_RSR; } + +void FormFactorDWBA::setSpecularInfo(const ILayerRTCoefficients* p_in_coeffs, + const ILayerRTCoefficients* p_out_coeffs) +{ + mp_in_coeffs = p_in_coeffs; + mp_out_coeffs = p_out_coeffs; +} diff --git a/Core/Multilayer/FormFactorDWBA.h b/Core/Multilayer/FormFactorDWBA.h index 5788d3824df33b2648fb87ea08bd360735257913..d08a3d36da7c786bdc4a1fe97195e49fdab3bd24 100644 --- a/Core/Multilayer/FormFactorDWBA.h +++ b/Core/Multilayer/FormFactorDWBA.h @@ -16,32 +16,43 @@ #ifndef FORMFACTORDWBA_H #define FORMFACTORDWBA_H -#include "IFormFactorDecorator.h" +#include "IFormFactor.h" class ILayerRTCoefficients; -//! Evaluates the coherent sum of the four DWBA terms in a scalar IFormFactorDecorator. +//! Evaluates the coherent sum of the four DWBA terms in a scalar IFormFactor. //! @ingroup formfactors_internal -class BA_CORE_API_ FormFactorDWBA: public IFormFactorDecorator +class FormFactorDWBA final : public IFormFactor { public: FormFactorDWBA(const IFormFactor& form_factor); - ~FormFactorDWBA() final {} + ~FormFactorDWBA() override; - FormFactorDWBA* clone() const final; + FormFactorDWBA* clone() const override; - void accept(ISampleVisitor* visitor) const final { visitor->visit(this); } + void accept(ISampleVisitor* visitor) const override { visitor->visit(this); } + + //! Calculates and returns a form factor calculation in DWBA + complex_t evaluate(const WavevectorInfo& wavevectors) const override; + + //! Returns the total volume of the particle of this form factor's shape + double getVolume() const override { return mp_form_factor->getVolume(); } + + //! Returns the (approximate in some cases) radial size of the particle of this + //! form factor's shape. This is used for SSCA calculations + double getRadialExtension() const override { return mp_form_factor->getRadialExtension(); } //! Sets reflection/transmission info for scalar DWBA simulation void setSpecularInfo (const ILayerRTCoefficients* p_in_coeffs, - const ILayerRTCoefficients* p_out_coeffs); - - complex_t evaluate(const WavevectorInfo& wavevectors) const final; + const ILayerRTCoefficients* p_out_coeffs) override; friend class TestPolarizedDWBATerms; private: + //! The form factor for BA + IFormFactor* mp_form_factor; + const ILayerRTCoefficients* mp_in_coeffs; //!< not owned by this const ILayerRTCoefficients* mp_out_coeffs; //!< not owned by this }; diff --git a/Core/Multilayer/FormFactorDWBAPol.cpp b/Core/Multilayer/FormFactorDWBAPol.cpp index 2eca58af66f42be51dc714c90fcc55cf1bdb2a72..64d99fadda69001cede681358fb29fe3b56a5fcc 100644 --- a/Core/Multilayer/FormFactorDWBAPol.cpp +++ b/Core/Multilayer/FormFactorDWBAPol.cpp @@ -50,13 +50,6 @@ complex_t FormFactorDWBAPol::evaluate(const WavevectorInfo&) const "FormFactorDWBAPol::evaluate: should never be called for matrix interactions"); } -void FormFactorDWBAPol::setSpecularInfo(const ILayerRTCoefficients* p_in_coeffs, - const ILayerRTCoefficients* p_out_coeffs) -{ - mp_in_coeffs = p_in_coeffs; - mp_out_coeffs = p_out_coeffs; -} - Eigen::Matrix2cd FormFactorDWBAPol::evaluatePol(const WavevectorInfo& wavevectors) const { // the required wavevectors inside the layer for @@ -207,3 +200,10 @@ Eigen::Matrix2cd FormFactorDWBAPol::evaluatePol(const WavevectorInfo& wavevector M21_S + M21_RS + M21_SR + M21_RSR + M22_S + M22_RS + M22_SR + M22_RSR; } + +void FormFactorDWBAPol::setSpecularInfo(const ILayerRTCoefficients* p_in_coeffs, + const ILayerRTCoefficients* p_out_coeffs) +{ + mp_in_coeffs = p_in_coeffs; + mp_out_coeffs = p_out_coeffs; +} diff --git a/Core/Multilayer/FormFactorDWBAPol.h b/Core/Multilayer/FormFactorDWBAPol.h index ddfec3218df3db99aec16307683c2640872d7a4a..285e56dc91e4ab286f2facd65760460bde62f961 100644 --- a/Core/Multilayer/FormFactorDWBAPol.h +++ b/Core/Multilayer/FormFactorDWBAPol.h @@ -21,44 +21,44 @@ class ILayerRTCoefficients; //! Evaluates the coherent sum of the 16 matrix DWBA terms in a polarized IFormFactor. + //! @ingroup formfactors_internal -class BA_CORE_API_ FormFactorDWBAPol : public IFormFactor +class FormFactorDWBAPol final : public IFormFactor { public: - FormFactorDWBAPol() = delete; FormFactorDWBAPol(const IFormFactor& form_factor); - virtual ~FormFactorDWBAPol(); + ~FormFactorDWBAPol() override; - FormFactorDWBAPol* clone() const final; + FormFactorDWBAPol* clone() const override; - void accept(ISampleVisitor* visitor) const final { visitor->visit(this); } + void accept(ISampleVisitor* visitor) const override { visitor->visit(this); } //! Throws not-implemented exception - complex_t evaluate(const WavevectorInfo& wavevectors) const final; + complex_t evaluate(const WavevectorInfo& wavevectors) const override; //! Calculates and returns a polarized form factor calculation in DWBA - Eigen::Matrix2cd evaluatePol(const WavevectorInfo& wavevectors) const final; + Eigen::Matrix2cd evaluatePol(const WavevectorInfo& wavevectors) const override; //! Returns the total volume of the particle of this form factor's shape - double getVolume() const final { return mp_form_factor->getVolume(); } + double getVolume() const override { return mp_form_factor->getVolume(); } //! Returns the (approximate in some cases) radial size of the particle of this //! form factor's shape. This is used for SSCA calculations - double getRadialExtension() const final { return mp_form_factor->getRadialExtension(); } + double getRadialExtension() const override { return mp_form_factor->getRadialExtension(); } //! Sets reflection/transmission info for scalar DWBA simulation void setSpecularInfo(const ILayerRTCoefficients* p_in_coeffs, - const ILayerRTCoefficients* p_out_coeffs); + const ILayerRTCoefficients* p_out_coeffs) override; friend class TestPolarizedDWBATerms; -protected: - //! The matrix form factor for BA +private: + //! The form factor for BA IFormFactor* mp_form_factor; - const ILayerRTCoefficients* mp_in_coeffs; - const ILayerRTCoefficients* mp_out_coeffs; + const ILayerRTCoefficients* mp_in_coeffs; //!< not owned by this + const ILayerRTCoefficients* mp_out_coeffs; //!< not owned by this }; #endif // FORMFACTORDWBAPOL_H diff --git a/Core/Parametrization/IParameterized.h b/Core/Parametrization/IParameterized.h index 20484d86c57b2eb5dc36249a65e66334c04f8e2d..4f06154f8302bc7a592c3b1ce80ae4dcff7e33eb 100644 --- a/Core/Parametrization/IParameterized.h +++ b/Core/Parametrization/IParameterized.h @@ -30,7 +30,7 @@ class BA_CORE_API_ IParameterized : public INamed public: IParameterized(const std::string& name=""); IParameterized(const IParameterized& other); - virtual ~IParameterized(); + ~IParameterized() override; IParameterized operator=(const IParameterized& other) = delete; diff --git a/Core/Particle/FormFactorCrystal.h b/Core/Particle/FormFactorCrystal.h index c270d27d548298a49aae4c2a72779ca8f9c80569..21415301a45cf24fce1ee92ca1fb974f6a599166 100644 --- a/Core/Particle/FormFactorCrystal.h +++ b/Core/Particle/FormFactorCrystal.h @@ -27,19 +27,20 @@ class BA_CORE_API_ FormFactorCrystal : public IFormFactor public: FormFactorCrystal(const Lattice& lattice, const IFormFactor& basis_form_factor, const IFormFactor& meso_form_factor); - ~FormFactorCrystal() final; + ~FormFactorCrystal() override final; - FormFactorCrystal* clone() const final { + FormFactorCrystal* clone() const override final { return new FormFactorCrystal(m_lattice, *mp_basis_form_factor, *mp_meso_form_factor); } - void accept(ISampleVisitor* visitor) const final { visitor->visit(this); } + void accept(ISampleVisitor* visitor) const override final { visitor->visit(this); } - double getVolume() const final { return mp_meso_form_factor->getVolume(); } - double getRadialExtension() const final { return mp_meso_form_factor->getRadialExtension(); } + double getVolume() const override final { return mp_meso_form_factor->getVolume(); } + double getRadialExtension() const override final { + return mp_meso_form_factor->getRadialExtension(); } - complex_t evaluate(const WavevectorInfo& wavevectors) const final; + complex_t evaluate(const WavevectorInfo& wavevectors) const override final; #ifndef SWIG - Eigen::Matrix2cd evaluatePol(const WavevectorInfo& wavevectors) const final; + Eigen::Matrix2cd evaluatePol(const WavevectorInfo& wavevectors) const override final; #endif private: diff --git a/Core/Particle/FormFactorWeighted.h b/Core/Particle/FormFactorWeighted.h index 5d895191e5b802b995a05cc1b046618aff86cebf..4aa02e212824bf1297595142a6f59586da5e6595 100644 --- a/Core/Particle/FormFactorWeighted.h +++ b/Core/Particle/FormFactorWeighted.h @@ -18,34 +18,35 @@ #include "IFormFactor.h" -//! Coherent sum of different scalar IFormFactor's with different weights, at the same position. +//! Coherent sum of different scalar IFormFactor's with different weights. //! //! Used by ParticleComposition and ParticleCoreShell. -//! If particles are at different positions, then consider FormFactorDecoratorMultiPositionFactor -//! (restore from commit 0500a26de76). +//! If same particles are at different positions, then consider +//! FormFactorDecoratorMultiPositionFactor (restore from commit 0500a26de76). + //! @ingroup formfactors_internal class BA_CORE_API_ FormFactorWeighted : public IFormFactor { public: FormFactorWeighted(); - ~FormFactorWeighted() final; + ~FormFactorWeighted() override final; - FormFactorWeighted* clone() const final; + FormFactorWeighted* clone() const override final; - void accept(ISampleVisitor* visitor) const final { visitor->visit(this); } + void accept(ISampleVisitor* visitor) const override final { visitor->visit(this); } - double getRadialExtension() const final; + double getRadialExtension() const override final; void addFormFactor(const IFormFactor& form_factor, double weight=1.0); - void setAmbientMaterial(const IMaterial& material) final; + void setAmbientMaterial(const IMaterial& material) override final; - complex_t evaluate(const WavevectorInfo& wavevectors) const final; + complex_t evaluate(const WavevectorInfo& wavevectors) const override final; #ifndef SWIG //! Calculates and returns a polarized form factor calculation in DWBA - Eigen::Matrix2cd evaluatePol(const WavevectorInfo& wavevectors) const final; + Eigen::Matrix2cd evaluatePol(const WavevectorInfo& wavevectors) const override final; #endif protected: diff --git a/Core/Scattering/IFormFactor.cpp b/Core/Scattering/IFormFactor.cpp index 72e48ffa55c7c1ba61e88aea3a5779454a5a3b4f..491ecf2c1f1f6cfe89457e09db26049ccc289a93 100644 --- a/Core/Scattering/IFormFactor.cpp +++ b/Core/Scattering/IFormFactor.cpp @@ -19,14 +19,12 @@ IFormFactor::~IFormFactor() {} -#ifndef SWIG Eigen::Matrix2cd IFormFactor::evaluatePol(const WavevectorInfo&) const { // Throws to prevent unanticipated behaviour throw Exceptions::NotImplementedException( "IFormFactor::evaluatePol: is not implemented by default"); } -#endif double IFormFactor::getVolume() const { diff --git a/Core/Scattering/IFormFactor.h b/Core/Scattering/IFormFactor.h index 2fddc05f5975954b74c5c972f97a2f62a718278d..8530520cdb8d82f2b074044d0220ca5874c48b39 100644 --- a/Core/Scattering/IFormFactor.h +++ b/Core/Scattering/IFormFactor.h @@ -31,7 +31,7 @@ class WavevectorInfo; //! If it only depends on the scattering vector q=ki-kf, then it is a IBornFormFactor. //! //! Other children besides IBornFormFactor are IFormFactorDecorator, FormFactorWeighted, -//! FormFactorDWBAPol, FormFactorCrystal. +//! FormFactorDWBA, FormFactorDWBAPol and FormFactorCrystal. //! @ingroup formfactors_internal @@ -39,15 +39,15 @@ class BA_CORE_API_ IFormFactor : public ISample { public: IFormFactor() {} - virtual ~IFormFactor(); - virtual IFormFactor* clone() const=0; - virtual void accept(ISampleVisitor* visitor) const =0; + ~IFormFactor() override; + IFormFactor* clone() const override=0; + void accept(ISampleVisitor* visitor) const override=0; //! Passes the refractive index of the ambient material in which this particle is embedded. virtual void setAmbientMaterial(const IMaterial&) {} //! Returns scattering amplitude for complex wavevectors ki, kf. - virtual complex_t evaluate(const WavevectorInfo& wavevectors) const =0; + virtual complex_t evaluate(const WavevectorInfo& wavevectors) const=0; #ifndef SWIG //! Returns scattering amplitude for matrix interactions @@ -59,7 +59,7 @@ public: //! Returns the (approximate in some cases) radial size of the particle of this //! form factor's shape. This is used for SSCA calculations - virtual double getRadialExtension() const =0; + virtual double getRadialExtension() const=0; //! Sets reflection/transmission info virtual void setSpecularInfo(const ILayerRTCoefficients*, const ILayerRTCoefficients*) {} diff --git a/Core/Scattering/IFormFactorBorn.cpp b/Core/Scattering/IFormFactorBorn.cpp index 56c579ced79a7421495ab0c40f69cf5f33e647f3..a42f0300020e5e6e1348f2084e4e07fbaaba4fa3 100644 --- a/Core/Scattering/IFormFactorBorn.cpp +++ b/Core/Scattering/IFormFactorBorn.cpp @@ -23,19 +23,12 @@ complex_t IFormFactorBorn::evaluate(const WavevectorInfo& wavevectors) const return evaluate_for_q(wavevectors.getQ()); } -Eigen::Matrix2cd IFormFactorBorn::evaluatePol(const WavevectorInfo& wavevectors) const +Eigen::Matrix2cd IFormFactorBorn::evaluatePol(const WavevectorInfo &wavevectors) const { - return evaluate(wavevectors) * Eigen::Matrix2cd::Identity(); + return evaluate_for_q_pol(wavevectors.getQ()); } -complex_t IFormFactorBorn::evaluate_for_q(const cvector_t) const +Eigen::Matrix2cd IFormFactorBorn::evaluate_for_q_pol(const cvector_t q) const { - throw Exceptions::NotImplementedException( - "Bug: erroneous call of IFormFactorBorn::evaluate_for_q. "); -} - -double IFormFactorBorn::getRadialExtension() const -{ - throw Exceptions::NotImplementedException( - "Bug: erroneous call of IFormFactorBorn::evaluate_for_q. "); + return evaluate_for_q(q) * Eigen::Matrix2cd::Identity(); } diff --git a/Core/Scattering/IFormFactorBorn.h b/Core/Scattering/IFormFactorBorn.h index 633c72a2d19313993b2750b0c65c34c05f063fc5..41ff178f9848ca6909d17bad18222cf39e5a324c 100644 --- a/Core/Scattering/IFormFactorBorn.h +++ b/Core/Scattering/IFormFactorBorn.h @@ -19,39 +19,40 @@ #include "IFormFactor.h" #include "Vectors3D.h" -//! Base class for Born form factors. +//! Pure virtual base class for Born form factors. +//! //! In contrast to the generic IFormFactor, a Born form factor does not depend //! on the incoming and outgoing wave vectors ki and kf, except through their //! difference, the scattering vector q=ki-kf. -//! -//! NOTE: These class should be pure virtual; -//! the functions evaluate and evaluatePol should be declared final; -//! the functions clone, accept, evaluate_for_q, getRadialExtension should be =0 -//! instead of having trivial implementations. -//! HOWEVER, this seems to conflict with the inclusion of this class in Wrap/swig/directors.i, -//! which in turn seems to be necessary for CustomFormFactor.py to work. -//! + //! @ingroup formfactors_internal class BA_CORE_API_ IFormFactorBorn : public IFormFactor { public: IFormFactorBorn() {} - virtual ~IFormFactorBorn() {} + ~IFormFactorBorn() override {} - virtual IFormFactorBorn* clone() const { return new IFormFactorBorn(); } - virtual void accept(ISampleVisitor* visitor) const { visitor->visit(this); } + IFormFactorBorn* clone() const override=0; + + complex_t evaluate(const WavevectorInfo& wavevectors) const override; - virtual complex_t evaluate(const WavevectorInfo& wavevectors) const; #ifndef SWIG - virtual Eigen::Matrix2cd evaluatePol(const WavevectorInfo& wavevectors) const; + Eigen::Matrix2cd evaluatePol(const WavevectorInfo& wavevectors) const override; #endif //! Returns scattering amplitude for complex scattering wavevector q=k_i-k_f. - virtual complex_t evaluate_for_q(const cvector_t q) const; + //! This method is public only for convenience of plotting form factors in Python. + virtual complex_t evaluate_for_q(const cvector_t q) const=0; - virtual double getRadialExtension() const; - }; +protected: +#ifndef SWIG + //! Returns scattering amplitude for complex scattering wavevector q=k_i-k_f in case + //! of matrix interactions. Default implementation calls evaluate_for_q(q) and + //! multiplies with the unit matrix. + virtual Eigen::Matrix2cd evaluate_for_q_pol(const cvector_t q) const; +#endif +}; #ifdef POLYHEDRAL_DIAGNOSTIC //! Information about the latest form factor evaluation. Not thread-safe. diff --git a/Core/Scattering/ISample.h b/Core/Scattering/ISample.h index 4cc2a33b28201de97aa800b20c24cd01eef799b1..a40ce97cb473aaafc06886e9921aa36b79c21658 100644 --- a/Core/Scattering/ISample.h +++ b/Core/Scattering/ISample.h @@ -32,14 +32,14 @@ class IMaterial; //! for iterating through a tree (getMaterial, containedMaterials, containedSubclasses, ..). //! The functions getChildren and size, completely trivial here, become meaningful //! through their overloads in ICompositeSample. -//! + //! @ingroup samples_internal class BA_CORE_API_ ISample : public ICloneable, public IParameterized { public: //! Returns a clone of this ISample object. - virtual ISample* clone() const=0; + ISample* clone() const override=0; //! Returns a clone with inverted magnetic fields. virtual ISample* cloneInvertB() const; diff --git a/Core/SoftParticle/FormFactorGauss.h b/Core/SoftParticle/FormFactorGauss.h index cdc5803ab5f68a86ed6f9dbe2af33efc9d30a980..5b948bd32dd42d43824cb4215f69d6d4bce206bb 100644 --- a/Core/SoftParticle/FormFactorGauss.h +++ b/Core/SoftParticle/FormFactorGauss.h @@ -27,15 +27,16 @@ public: FormFactorGauss(double volume); FormFactorGauss(double width, double height); - FormFactorGauss* clone() const final { return new FormFactorGauss(m_width, m_height); } - void accept(ISampleVisitor* visitor) const final { visitor->visit(this); } + FormFactorGauss* clone() const override final { + return new FormFactorGauss(m_width, m_height); } + void accept(ISampleVisitor* visitor) const override final { visitor->visit(this); } double getWidth() const { return m_width; } double getHeight() const { return m_height; } - double getRadialExtension() const final { return m_width; } + double getRadialExtension() const override final { return m_width; } - complex_t evaluate_for_q(const cvector_t q) const final; + complex_t evaluate_for_q(const cvector_t q) const override final; private: double m_width; diff --git a/Core/SoftParticle/FormFactorLorentz.h b/Core/SoftParticle/FormFactorLorentz.h index 71deb786d95aead6e5f671aad7831509f248e49d..cd45c71167790d396b853fc2f6173c8e2184191a 100644 --- a/Core/SoftParticle/FormFactorLorentz.h +++ b/Core/SoftParticle/FormFactorLorentz.h @@ -27,15 +27,16 @@ public: FormFactorLorentz(double volume); FormFactorLorentz(double width, double height); - FormFactorLorentz* clone() const final { return new FormFactorLorentz(m_width, m_height); } - void accept(ISampleVisitor* visitor) const final { visitor->visit(this); } + FormFactorLorentz* clone() const override final { + return new FormFactorLorentz(m_width, m_height); } + void accept(ISampleVisitor* visitor) const override final { visitor->visit(this); } double getWidth() const { return m_width; } double getHeight() const { return m_height; } - double getRadialExtension() const final; + double getRadialExtension() const override final; - complex_t evaluate_for_q(const cvector_t q) const final; + complex_t evaluate_for_q(const cvector_t q) const override final; private: double m_width; diff --git a/Core/SoftParticle/FormFactorSphereGaussianRadius.cpp b/Core/SoftParticle/FormFactorSphereGaussianRadius.cpp index dd87bb7580b674b436d6389019404948c001dffd..3b54d77d24349eafadd73b57631f7a870e3e3da0 100644 --- a/Core/SoftParticle/FormFactorSphereGaussianRadius.cpp +++ b/Core/SoftParticle/FormFactorSphereGaussianRadius.cpp @@ -24,25 +24,19 @@ FormFactorSphereGaussianRadius::FormFactorSphereGaussianRadius(double mean, doub : m_mean(mean) , m_sigma(sigma) , m_mean_r3(0.0) -, p_ff_sphere(0) { setName(FormFactorSphereGaussianRadiusType); m_mean_r3 = calculateMeanR3(); - p_ff_sphere = new FormFactorFullSphere(m_mean_r3); + P_ff_sphere.reset(new FormFactorFullSphere(m_mean_r3)); registerParameter(BornAgain::MeanRadius, &m_mean).setUnit("nm").setNonnegative(); registerParameter(BornAgain::SigmaRadius, &m_sigma).setUnit("nm").setNonnegative(); } -FormFactorSphereGaussianRadius::~FormFactorSphereGaussianRadius() -{ - delete p_ff_sphere; -} - complex_t FormFactorSphereGaussianRadius::evaluate_for_q(const cvector_t q) const { double q2 = std::norm(q.x()) + std::norm(q.y()) + std::norm(q.z()); double dw = std::exp(-q2*m_sigma*m_sigma/2.0); - return dw*p_ff_sphere->evaluate_for_q(q); + return dw*P_ff_sphere->evaluate_for_q(q); } double FormFactorSphereGaussianRadius::calculateMeanR3() const diff --git a/Core/SoftParticle/FormFactorSphereGaussianRadius.h b/Core/SoftParticle/FormFactorSphereGaussianRadius.h index c47afb146b9a4a02b295c4e4f18fb696ba0da0f2..86c9d7c61032febcd78f4c041fefce66e786b0d6 100644 --- a/Core/SoftParticle/FormFactorSphereGaussianRadius.h +++ b/Core/SoftParticle/FormFactorSphereGaussianRadius.h @@ -17,6 +17,7 @@ #define FORMFACTORSPHEREGAUSSIANRADIUS_H #include "FormFactorFullSphere.h" +#include <memory> //! A sphere with gaussian radius distribution. //! @ingroup softParticle @@ -25,16 +26,15 @@ class BA_CORE_API_ FormFactorSphereGaussianRadius : public IFormFactorBorn { public: FormFactorSphereGaussianRadius(double mean, double sigma); - virtual ~FormFactorSphereGaussianRadius(); - FormFactorSphereGaussianRadius* clone() const final { + FormFactorSphereGaussianRadius* clone() const override final { return new FormFactorSphereGaussianRadius(m_mean, m_sigma); } - void accept(ISampleVisitor* visitor) const final { visitor->visit(this); } + void accept(ISampleVisitor* visitor) const override final { visitor->visit(this); } - double getRadialExtension() const final { return m_mean; } + double getRadialExtension() const override final { return m_mean; } - complex_t evaluate_for_q(const cvector_t q) const final; + complex_t evaluate_for_q(const cvector_t q) const override final; private: double calculateMeanR3() const; @@ -42,7 +42,7 @@ private: double m_mean; //!< This is the mean radius double m_sigma; double m_mean_r3; //!< This is the radius that gives the mean volume - FormFactorFullSphere* p_ff_sphere; + std::unique_ptr<FormFactorFullSphere> P_ff_sphere; }; #endif // FORMFACTORSPHEREGAUSSIANRADIUS_H diff --git a/Core/SoftParticle/FormFactorSphereLogNormalRadius.cpp b/Core/SoftParticle/FormFactorSphereLogNormalRadius.cpp index 00400127c7f525a79267280a86f714a63c49687d..71529a0c62365fffc011d2f16f34ade101d81732 100644 --- a/Core/SoftParticle/FormFactorSphereLogNormalRadius.cpp +++ b/Core/SoftParticle/FormFactorSphereLogNormalRadius.cpp @@ -23,17 +23,16 @@ FormFactorSphereLogNormalRadius::FormFactorSphereLogNormalRadius( : m_mean(mean) , m_scale_param(scale_param) , m_n_samples(n_samples) - , mp_distribution(0) { setName(BornAgain::FormFactorSphereLogNormalRadiusType); - mp_distribution = new DistributionLogNormal(mean, scale_param); + mP_distribution.reset(new DistributionLogNormal(mean, scale_param)); registerParameter(BornAgain::MeanRadius, &m_mean).setUnit("nm").setNonnegative(); registerParameter(BornAgain::ScaleParameter, &m_scale_param); - if (!mp_distribution) return; + if (!mP_distribution) return; // Init vectors: m_form_factors.clear(); m_probabilities.clear(); - std::vector<ParameterSample> samples = mp_distribution->generateSamples(m_n_samples); + std::vector<ParameterSample> samples = mP_distribution->generateSamples(m_n_samples); for (size_t i=0; i<samples.size(); ++i) { double radius = samples[i].value; m_form_factors.push_back(new FormFactorFullSphere(radius)); @@ -41,11 +40,6 @@ FormFactorSphereLogNormalRadius::FormFactorSphereLogNormalRadius( } } -FormFactorSphereLogNormalRadius::~FormFactorSphereLogNormalRadius() -{ - delete mp_distribution; -} - complex_t FormFactorSphereLogNormalRadius::evaluate_for_q(const cvector_t q) const { if (m_form_factors.size()<1) diff --git a/Core/SoftParticle/FormFactorSphereLogNormalRadius.h b/Core/SoftParticle/FormFactorSphereLogNormalRadius.h index 493bd337651223aaf3ca18c042801f7f9834ea3e..23bcbce35f400135b95e0b891f632d3fbe324bd1 100644 --- a/Core/SoftParticle/FormFactorSphereLogNormalRadius.h +++ b/Core/SoftParticle/FormFactorSphereLogNormalRadius.h @@ -18,8 +18,8 @@ #include "FormFactorFullSphere.h" #include "SafePointerVector.h" - -class DistributionLogNormal; +#include "Distributions.h" +#include <memory> //! A sphere with log normal radius distribution. //! @ingroup softParticle @@ -28,22 +28,21 @@ class BA_CORE_API_ FormFactorSphereLogNormalRadius : public IFormFactorBorn { public: FormFactorSphereLogNormalRadius(double mean, double scale_param, size_t n_samples); - ~FormFactorSphereLogNormalRadius() final; - FormFactorSphereLogNormalRadius* clone() const final { + FormFactorSphereLogNormalRadius* clone() const override final { return new FormFactorSphereLogNormalRadius(m_mean, m_scale_param, m_n_samples); } - void accept(ISampleVisitor* visitor) const final { visitor->visit(this); } + void accept(ISampleVisitor* visitor) const override final { visitor->visit(this); } - double getRadialExtension() const final { return m_mean; } + double getRadialExtension() const override final { return m_mean; } - complex_t evaluate_for_q(const cvector_t q) const final; + complex_t evaluate_for_q(const cvector_t q) const override final; private: double m_mean; double m_scale_param; size_t m_n_samples; - DistributionLogNormal* mp_distribution; + std::unique_ptr<DistributionLogNormal> mP_distribution; SafePointerVector<IFormFactorBorn> m_form_factors; std::vector<double> m_probabilities; diff --git a/Core/SoftParticle/FormFactorSphereUniformRadius.h b/Core/SoftParticle/FormFactorSphereUniformRadius.h index 0a4dd96ec1f7380f77ba88fd5c31fbdf2c4c667a..49adb5ee876e134b2d8ca5f7e78523073c0736b4 100644 --- a/Core/SoftParticle/FormFactorSphereUniformRadius.h +++ b/Core/SoftParticle/FormFactorSphereUniformRadius.h @@ -26,13 +26,13 @@ class BA_CORE_API_ FormFactorSphereUniformRadius : public IFormFactorBorn public: FormFactorSphereUniformRadius(double mean, double full_width); - FormFactorSphereUniformRadius* clone() const final { + FormFactorSphereUniformRadius* clone() const override final { return new FormFactorSphereUniformRadius(m_mean, m_full_width); } - void accept(ISampleVisitor* visitor) const final { visitor->visit(this); } + void accept(ISampleVisitor* visitor) const override final { visitor->visit(this); } - double getRadialExtension() const final { return m_mean; } + double getRadialExtension() const override final { return m_mean; } - complex_t evaluate_for_q(const cvector_t q) const final; + complex_t evaluate_for_q(const cvector_t q) const override final; private: bool checkParameters() const; diff --git a/Doc/UserManual/Assemblies.tex b/Doc/UserManual/Assemblies.tex index 3b04fe2a0430781d1261529f99922b8f310404bb..dbc9276c37b0f79ba9a32d6f32fe2f85ae3db0bd 100644 --- a/Doc/UserManual/Assemblies.tex +++ b/Doc/UserManual/Assemblies.tex @@ -422,7 +422,7 @@ of its shape function $S(\r)=\chi(\r)/\tilde\chi$, For hard-shell particles %the shape function $S(\r)$ only takes the values 0 and~1 so that the form factor becomes -the \textit{shape transform} +the \E{shape transform} \index{Shape transform}% \begin{equation}\label{EFFhardshell} F(\q)=\int_V {\rm d}^3r\, {\rm e}^{i\q\r}, diff --git a/Doc/UserManual/BornAgainManual.tex b/Doc/UserManual/BornAgainManual.tex index 4506bf4bc6efe78d04edf63d145f79bd4c53a81c..14b73ad9aa9eaa398941add8c8eaa8bcb4312986 100644 --- a/Doc/UserManual/BornAgainManual.tex +++ b/Doc/UserManual/BornAgainManual.tex @@ -45,7 +45,6 @@ Walter Van Herck, Joachim Wuttke} \include{Introduction} -\include{OnlineDocs} \include{SAS} \include{GisasFoundations} \include{PolarizedScattering} @@ -56,9 +55,15 @@ Walter Van Herck, Joachim Wuttke} %void \include{Roughness} %void \include{Experiment} +\include{ThreeAPIs} +\include{Usage} +%\include{Fitting} +%\include{IntensityData} + +\include{FormFactors} + \appendix %\addtocontents{toc}{\protect\setcounter{tocdepth}{1}} \include{Proofs} -\include{FormFactors} \otherchapter{Bibliography} \bibliographystyle{switch} diff --git a/Doc/UserManual/Fitting.tex b/Doc/UserManual/Fitting.tex new file mode 100644 index 0000000000000000000000000000000000000000..ef09e0cf9674c7612be593c9d19dad2048b218e3 --- /dev/null +++ b/Doc/UserManual/Fitting.tex @@ -0,0 +1,555 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Fitting} \label{sec:Fitting} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \index{Fitting|(} + +In addition to the simulation of grazing incidence +X-ray and neutron scattering by +multilayered samples, \BornAgain\ also offers the option to +fit the numerical model to reference data by modifying a selection of +sample parameters from the numerical model. This aspect +of the software is discussed in the current chapter. + +%\cref{sec:FittingGentleIntroducion} gives a short introduction to the +%basic concepts of data fitting. Users familiar with fitting can +%directly proceed to \cref{sec:FittingImplementation}, which details the +%implementation of fittings in +%\BornAgain\ . +\cref{sec:FittingImplementation} details the +implementation of fittings in \BornAgain. +Python fitting examples with detailed +explanations of every fitting step are given in \cref{sec:FittingExamples}. Advanced fitting techniques, including fine tuning of minimization +algorithms, simultaneous fits of different data sets, parameters +correlation, are covered in +\cref{sec:FittingAdvanced}. \cref{sec:FittingRightAnswers} contains some practical advice, which might +help the user to get right answers from \BornAgain\ fitting. + + +\subsubsection{Implementation in BornAgain} \label{sec:FittingImplementation} + +Fitting in \BornAgain\ deals with estimating the optimum parameters +in the numerical model by minimizing the difference between +numerical and reference data. +%using $\chi^2$ or maximum likelihood methods. +The features include + +\begin{itemize} +\item a variety of multidimensional minimization algorithms and strategies. +\item the choice over possible fitting parameters, their properties and correlations. +\item the full control on objective function calculations, including applications of different normalizations and assignments of different masks and weights to different areas of reference data. +\item the possibility to fit simultaneously an arbitrary number of data sets. +\end{itemize} + +Figure ~\ref{fig:minimization_workflow} shows the general work flow of a typical fitting procedure. +\begin{figure}[htbp] +\centering + \resizebox{0.99\textwidth}{!}{% + \includegraphics{fig/drawing/minimization_workflow.pdf}} +\caption{ +Fitting work flow. +} +\label{fig:minimization_workflow} +\end{figure} + +Before running the fitting the user is required to prepare some data and to +configure the fitting kernel of \BornAgain\ . The required stages are + +\begin{itemize} +\item Preparing the sample and the simulation description (multilayer, beam, detector parameters). +\item Choosing the fitting parameters. +\item Loading the reference data. +\item Defining the minimization settings. +\end{itemize} + +The class \Code{FitSuite} contains the main functionalities to be used for the fit +and serves as the main interface between the user and the fitting work flow. +The later involves iterations during which + +\begin{itemize} +\item The minimizer makes an assumption about the optimal sample parameters. +\item These parameters are propagated to the sample. +\item The simulation is performed for the given state of the sample. +\item The simulated data (intensities) are propagated to the $\chi^2$ module. +\item The later calculates $\chi^2$ using the simulated and reference data. +\item The value of $\chi^2$ is propagated to the minimizer, which makes new assumptions about optimal sample parameters. +\end{itemize} + +The iteration process is going on under the control of the selected minimization +algorithm, without any intervention from the +user. It stops +\begin{itemize} +\item when the maximum number of iteration steps has been exceeded, +\item when the function's minimum has been reached within the tolerance window, +\item if the minimizer could not improve the values of the parameters. +\end{itemize} + +After the control is returned, fitting results can be retrieved. +They consist in the best $\chi^2$ value found, the corresponding +optimal sample parameters and the intensity map simulated with this set of parameters. + +%Details of \Code{FitSuite} class implementation and description of each interface are given in \cref{sec:FitSuiteClass}. +The following parts of this section will detail each of +the main stages necessary to run a fitting procedure. + + +\subsubsection{Preparing the sample and the simulation description} + +This step is similar for any simulation using \BornAgain\ (see \cref{sec:Simulation}). It consists in first characterizing the geometry of the system: the particles +(shapes, sizes, refractive +indices), the different layers (thickness, +order, refractive index, a possible roughness of the interface), the +interference between the particles and the way they are distributed in +the layers (buried particles or particles sitting on top of a +layer). +Then we specify the parameters of the input beam and of the +output detector. + + +%=============================================================================== +\subsubsection{Choice of parameters to be fitted} +%=============================================================================== + +In principle, every parameter used in the construction of the sample +can be used as a fitting parameter. For example, the particles' +heights, radii or the layer's roughness or thickness could be selected +using the +parameter pool mechanism. +This mechanism is explained in detail in +\cref{sec:WorkingWithSampleParameters} and it is therefore recommended +to read it before proceeding any further. + +The user specifies selected sample parameters as fit parameters using \Code{FitSuite} +and its \Code{addFitParameter} method +\begin{lstlisting}[language=shell, style=commandline] +fit_suite = FitSuite() +fit_suite.addFitParameter(<name>, <initial value>, <step>, <limits>) +\end{lstlisting} +where \Code{<name>} corresponds to the parameter name in the sample's parameter pool. +By using wildcards in the parameter name, a group of sample parameters, corresponding to the given +pattern, can be associated with a single fitting parameter and +fitted simultaneously to get a common optimal value (see \cref{sec:WorkingWithSampleParameters}). + +The second parameter \Code <initial value> correspond to the initial value of +the fitting parameter, while the third one +is responsible to the initial iteration steps size. +The last parameter \Code{<AttLimits>} corresponds to +the boundaries imposed on parameter value. It can be +\begin{itemize} +\item \Code{limitless()} by default, +\item \Code{fixed()}, +\item \Code{lowerLimited(<min\_value>)}, +\item \Code{upperLimited(<max\_value>)}, +\item \Code{limited(<min\_value>, <max\_value>)}. +\end{itemize} +where \Code{<min\_value>} and \Code{<max\_value>} are +double values corresponding to the lower and higher boundary, respectively. + + +%=============================================================================== +\subsubsection{Associating reference and simulated data} +%=============================================================================== + +The minimization procedure deals with a pair of reference data (normally +associated with experimental data) and the theoretical model (presented by the sample and the simulation descriptions). + +We assume that the experimental data are a two-dimensional intensity +matrix as function of the output scattering +angles $\alpha_f$ and $\phi_f$ (see \cref{fig:multil3d}). +The user is required to provide the data in the form of an ASCII file +containing an axes +binning description and the intensity data itself. +\vspace*{2mm} + +\Note +{We recognize the importance of supporting the most common data formats. We are going to provide +this feature in the following releases and welcome users' requests on this subject.} + +To associate the simulation and the reference data to the fitting engine, method \newline +\Code{addSimulationAndRealData} has to be used as shown +\begin{lstlisting}[language=python, style=eclipseboxed,numbers=none] +fit_suite = FitSuite() +fit_suite.addSimulationAndRealData(<simulation>, <reference>, <chi2_module>) +\end{lstlisting} + +Here \Code{<simulation>} corresponds to a \BornAgain\ simulation object +with the sample, beam and detector fully defined, \Code{<reference>} +corresponds to the experimental data object obtained from the ASCII file and \Code{<chi2\_module>} is an optional parameter for advanced +control of $\chi^2$ calculations. + +It is possible to call this given method more than once to submit more than one pair of +\Code{<simulation>, <reference>} to the fitting procedure. +In this way, simultaneous fits of +some combined data sets are performed. + +By using the third parameter, \Code{<chi2\_module>}, different normalizations and weights +can be applied to give user full control of the way $\chi^2$ is calculated. +This feature will be explained in \cref{sec:FittingAdvanced}. + + +%=============================================================================== +\subsection{Minimizer settings} +%=============================================================================== + +\BornAgain\ contains a variety of minimization engines from \Code{ROOT} and \Code{GSL} +libraries. They are listed in Table~\ref{table:fit_minimizers}. +By default \Code{Minuit2} minimizer with default settings will be used and no additional +configuration needs to be done. +The remainder of this section explains some of the expert settings, which can be applied to get better +fit results. + +The default minimization algorithm can be changed using +\Code{MinimizerFactory} as shown below +\begin{lstlisting}[language=python, style=eclipseboxed,numbers=none] +fit_suite = FitSuite() +minimizer = MinimizerFactory.createMinimizer("<Minimizer name>","<algorithm>") +fit_suite.setMinimizer(minimizer) +\end{lstlisting} + +where \Code{<Minimizer name>} and \Code{<algorithm>} can be chosen from the first and +second column of Table~\ref{table:fit_minimizers} respectively. +The list of minimization algorithms implemented in \BornAgain\ +can also be obtained using \Code{MinimizerFactory.printCatalogue()} command. + + +\begin{table}[h] + \small +\centering +\begin{tabular}{@{}lll@{}} +\hline +\hline +\textbf{Minimizer name} & \textbf{Algorithm} & \textbf{Description}\\ +\hline +\Code{Minuit2} \cite{MinuitURL} & \Code{Migrad} & According to +\cite{mntutorial} best minimizer for nearly all functions,\\ + & & variable-metric method with inexact line search, \\ + & & a stable metric updating scheme,\\ + & & and checks for positive-definiteness.\\ +\hline + & \Code{Simplex} & simplex method of + Nelder and Mead\\ + & & usually slower than \Code{Migrad}, \\ + & & rather robust with respect to gross fluctuations in the\\ & & function + value, gives no reliable information about \\ & & parameter errors, \\ +\hline + & \Code{Combined} & minimization with + \Code{Migrad} \\ + & & but switches to Simplex if + Migrad fails to converge.\\ +\hline + & \Code{Scan} & not intended to + minimize, just scans the + function,\\ + & & one parameter at a + time, retains the best value + after\\ & & each scan\\ +\hline + & \Code{Fumili} & optimized + method for least square and log + likelihood\\ & & minimizations \\ +\hline +\Code{GSLMultiMin} \cite{GSLMultiMinURL} & \Code{ConjugateFR} & Fletcher-Reeves conjugate gradient + algorithm,\\ +\hline +& \Code{ConjugatePR} & Polak-Ribiere conjugate gradient algorithm,\\ +\hline +& \Code{BFGS} & Broyden-Fletcher-Goldfarb-Shanno algorithm,\\ +\hline +& \Code{BFGS2} & improved version of BFGS,\\ +\hline +& \Code{SteepestDescent} & follows the downhill gradient of the function at each step\\ +\hline +\Code{GSLLMA} \cite{GSLMultiFitURL} & & Levenberg-Marquardt +Algorithm\\ +\hline +\Code{GSLSimAn} \cite{GSLSimAnURL}& & Simulated Annealing Algorithm\\ +\hline +\hline +\end{tabular} +\caption{List of minimizers implemented in \BornAgain. } +\label{table:fit_minimizers} +\index{Minimizers} +\end{table} + +There are several options common to every minimization algorithm, which can be changed +before starting the minimization. They are handled by \Code{MinimizerOptions} class: +\begin{lstlisting}[language=python, style=eclipseboxed, numbers = none] +fit_suite.getMinimizer().getOptions().setMaxFunctionCalls(10) +\end{lstlisting} +In the above code snippet, a number of ``maximum function calls'', +namely the maximum number of times the minimizer is allowed to call the simulation, is limited to 10. %The minimizer will take that number into consideration and will try to limit number of iterations by that value. + +There are also expert-level options common for all minimizers as well +as a number of options to tune individual minimization algorithms. +They will be explained in \cref{sec:FittingAdvanced}. + + +%=============================================================================== +\subsection{Running the fitting ant retrieving the results} +%=============================================================================== + +After the initial configuration of \Code{FitSuite} has been performed, the fitting +can be started using the command +\begin{lstlisting}[language=python, style=eclipseboxed, numbers = none] +fit_suite.runFit() +\end{lstlisting} + +Depending on the complexity of the sample and the number of free sample parameters the fitting +process can take from tens to thousands of iterations. The results of the fit can +be printed on the screen using the command +\begin{lstlisting}[language=python, style=eclipseboxed, numbers = none] +fit_suite.printResults() +\end{lstlisting} +\cref{sec:FittingExamples} gives more details about how to access the fitting results. + + +%=============================================================================== +\subsection{Basic Python fitting example} \label{sec:FittingExamples} +%=============================================================================== + +In this section we are going to go through a complete example of +fitting using \BornAgain. Each step will be associated with a +detailed piece of code written in Python. +The complete listing of +the script is given in Appendix (see Listing~\ref{PythonFittingExampleScript}). +The script can also be found at +\begin{lstlisting}[language=shell, style=commandline] +./Examples/python/fitting/ex002_FitCylindersAndPrisms/FitCylindersAndPrisms.py +\end{lstlisting} + +\noindent +This example uses the same sample geometry as in \cref{sec:Example1Python}. +Cylindrical and +prismatic particles in equal proportion are deposited on a substrate layer, with no interference +between the particles. We consider the following parameters to be unkown +\begin{itemize} +\item the radius of cylinders, +\item the height of cylinders, +\item the length of the prisms' triangular basis, +\item the height of prisms. +\end{itemize} + +Our reference data are a ``noisy'' two-dimensional intensity +map obtained from the simulation of the same geometry with a fixed +value of $5\,{\rm nm}$ for the height and radius of cylinders and for the +height of prisms which have a 10-nanometer-long side length. +Then we run our fitting using default minimizer settings +starting with a cylinder's height +of $4\,{\rm nm}$, a cylinder's radius of $6\,{\rm nm}$, +a prism's half side of $6\,{\rm nm}$ and a height equal to $4\,{\rm nm}$. +As a result, the fitting procedure is able to find the correct value of $5\,{\rm nm}$ +for all four parameters. + + +%------------------------------------------------------------------------------- +\subsubsection*{Importing Python libraries} +%------------------------------------------------------------------------------- + +\begin{lstlisting}[language=python, style=eclipseboxed] +from libBornAgainCore import * +from libBornAgainFit import * +\end{lstlisting} +We start from importing two \BornAgain\ libraries required to create +the sample description +and to run the fitting. + +%------------------------------------------------------------------------------- +\subsubsection*{Building the sample} +%------------------------------------------------------------------------------- + +\begin{lstlisting}[language=python, style=eclipseboxed, firstnumber=5] +def get_sample(): @\label{script2::get_sample}@ + """ + Build the sample representing cylinders and pyramids on top of substrate without interference. + """ + # defining materials + m_air = HomogeneousMaterial("Air", 0.0, 0.0) + m_substrate = HomogeneousMaterial("Substrate", 6e-6, 2e-8) + m_particle = HomogeneousMaterial("Particle", 6e-4, 2e-8) + + # collection of particles + cylinder_ff = FormFactorCylinder(1.0*nanometer, 1.0*nanometer) + cylinder = Particle(m_particle, cylinder_ff) + prism_ff = FormFactorPrism3(2.0*nanometer, 1.0*nanometer) + prism = Particle(m_particle, prism_ff) + particle_layout = ParticleLayout() + particle_layout.addParticle(cylinder, 0.5) + particle_layout.addParticle(prism, 0.5) + interference = InterferenceFunctionNone() + particle_layout.addInterferenceFunction(interference) + + # air layer with particles and substrate form multi layer + air_layer = Layer(m_air) + air_layer.addLayout(particle_layout) + substrate_layer = Layer(m_substrate) + multi_layer = MultiLayer() + multi_layer.addLayer(air_layer) + multi_layer.addLayer(substrate_layer) + return multi_layer +\end{lstlisting} +The function starting at line~\ref{script2::get_sample} creates a multilayered sample +with cylinders and prisms using arbitrary $1\,{\rm nm}$ value for all size's of particles. +The details about the generation of this multilayered sample are given in \cref{sec:Example1Python}. + +%------------------------------------------------------------------------------- +\subsubsection*{Creating the simulation} +%------------------------------------------------------------------------------- +\begin{lstlisting}[language=python, style=eclipseboxed, firstnumber=35] +def get_simulation(): @\label{script2::get_simulation}@ + """ + Create GISAXS simulation with beam and detector defined + """ + simulation = Simulation() + simulation.setDetectorParameters(100, -1.0*degree, 1.0*degree, 100, 0.0*degree, 2.0*degree) + simulation.setBeamParameters(1.0*angstrom, 0.2*degree, 0.0*degree) + return simulation +\end{lstlisting} +The function starting at line~\ref{script2::get_simulation} creates +the simulation object with the definition of the beam and detector parameters. + +%------------------------------------------------------------------------------- +\subsubsection*{Preparing the fitting pair} +%------------------------------------------------------------------------------- +\begin{lstlisting}[language=python, style=eclipseboxed, firstnumber=45] +def run_fitting(): @\label{script2::run_fitting}@ + """ + run fitting + """ + sample = get_sample() @\label{script2::setup_simulation1}@ + simulation = get_simulation() + simulation.setSample(sample) @\label{script2::setup_simulation2}@ + + real_data = IntensityDataIOFactory.readIntensityData('refdata_fitcylinderprisms.int.gz') @\label{script2::real_data}@ +\end{lstlisting} +Lines +~\ref{script2::setup_simulation1}-~\ref{script2::setup_simulation2} +generate the +sample and simulation description and assign the sample to the simulation. +Our reference data are contained in the file \Code{'refdata\_fitcylinderprisms.int.gz'}. + This reference had been generated by adding noise +on the scattered intensity from a numerical sample with a fixed length of 5~nm for the four fitting +parameters (\idest the dimensions of the cylinders and prisms). +Line ~\ref{script2::real_data} creates the real data object by loading +the ASCII data from the input file. + +%------------------------------------------------------------------------------- +\subsubsection*{Setting up \rm\bf{FitSuite}} +%------------------------------------------------------------------------------- +\begin{lstlisting}[language=python, style=eclipseboxed, firstnumber=55] + fit_suite = FitSuite() @\label{script2::fitsuite1}@ + fit_suite.addSimulationAndRealData(simulation, real_data) @\label{script2::fitsuite2}@ + fit_suite.initPrint(10) @\label{script2::fitsuite3}@ +\end{lstlisting} +Line ~\ref{script2::fitsuite1} creates a \Code{FitSuite} object which provides +the main interface to the minimization kernel of \BornAgain\ . +Line ~\ref{script2::fitsuite2} submits simulation description and real data pair to the +subsequent fitting. Line ~\ref{script2::fitsuite3} sets up \Code{FitSuite} to print on +the screen the information about fit progress once per 10 iterations. +\begin{lstlisting}[language=python, style=eclipseboxed, firstnumber=60] + fit_suite.addFitParameter("*FormFactorCylinder/height", 4.*nanometer, 0.01*nanometer, AttLimits.lowerLimited(0.01)) @\label{script2::fitpars1}@ + fit_suite.addFitParameter("*FormFactorCylinder/radius", 6.*nanometer, 0.01*nanometer, AttLimits.lowerLimited(0.01)) + fit_suite.addFitParameter("*FormFactorPrism3/height", 4.*nanometer, 0.01*nanometer, AttLimits.lowerLimited(0.01)) + fit_suite.addFitParameter("*FormFactorPrism3/length", 12.*nanometer, 0.02*nanometer, AttLimits.lowerLimited(0.01)) @\label{script2::fitpars2}@ +\end{lstlisting} +Lines ~\ref{script2::fitpars1}--~\ref{script2::fitpars2} enter the +list of fitting parameters. Here we use the cylinders' height and +radius and the prisms' height and side length. +The cylinder's length and prism half side are initially equal to $4\,{\rm nm}$, +whereas the cylinder's radius and the prism half side length are equal to $6\,{\rm nm}$ before the minimization. The +iteration step is equal to $0.01\,{\rm nm}$ and only the lower +boundary is imposed to be equal to $0.01\,{\rm nm}$. + +%------------------------------------------------------------------------------- +\subsubsection*{Running the fit and accessing results} +%------------------------------------------------------------------------------- +\begin{lstlisting}[language=python, style=eclipseboxed, firstnumber=66] + fit_suite.runFit() @\label{script2::fitresults1}@ + + print "Fitting completed." + fit_suite.printResults()@\label{script2::fitresults2}@ + print "chi2:", fit_suite.getMinimizer().getMinValue() + fitpars = fit_suite.getFitParameters() + for i in range(0, fitpars.size()): + print fitpars[i].getName(), fitpars[i].getValue(), fitpars[i].getError() @\label{script2::fitresults3}@ +\end{lstlisting} +Line ~\ref{script2::fitresults1} shows the command to start the fitting process. +During the fitting the progress will be displayed on the screen. +Lines ~\ref{script2::fitresults2}--~\ref{script2::fitresults3} shows different ways of +accessing the fit results. + + +More details about fitting, access to its results and visualization of +the fit progress using matplotlib libraries can be learned from the +following detailed example +\begin{lstlisting}[language=shell, style=commandline] +./Examples/python/fitting/ex002_FitCylindersAndPrisms/FitCylindersAndPrisms_detailed.py +\end{lstlisting} + + +%=============================================================================== +\subsection{Advanced fitting} \label{sec:FittingAdvanced} +%=============================================================================== + +\subsubsection{Affecting chi-square calculations} +\MissingSection +\subsubsection{Simultaneous fits of several data sets} +\MissingSection +\subsubsection{Using fitting strategies} +\MissingSection +\subsubsection{Masking the real data} +\MissingSection +\subsubsection{Tuning fitting algorithms} +\MissingSection +\subsubsection{Fitting with correlated sample parameters} +\MissingSection + + +%=============================================================================== +\subsection {How to get the right answer from fitting} + \label{sec:FittingRightAnswers} +%=============================================================================== + +%As it has already been mentioned in \cref{sec:FittingGentleIntroducion}, +One of the main difficulties in fitting the data with the model +is the presence of multiple +local minima in the objective function. Many problems can cause the +fit to fail, for example: +\begin{itemize} +\item an unreliable physical model, +\item an unappropriate choice of objective function +\item multiple local minima, +\item an unphysical behavior of the objective function, unphysical regions + in the parameters space, +\item an unreliable parameter error calculation in the presence of + limits on the parameter value, +\item an exponential behavior of the objective function and the + corresponding numerical inaccuracies, excessive numerical roundoff + in the calculation of its value and derivatives, +\item large correlations between parameters, +\item very different scales of parameters involved in the calculation, +\item not positive definite error matrix even at minimum. +\end{itemize} + + +The given list, of course, is not only related to \BornAgain\ +fitting. It remains applicable to any fitting program and any kind of theoretical model. +%To address all these difficulties some amount of manual tuning might be necessary. + Below we give some recommendations which might help the user to achieve reliable fit results. + +\subsection*{General recommendations} +\begin{itemize} +\item initially choose a small number of free fitting parameters, +\item eliminate redundant parameters, +\item provide a good initial guess for the fit parameters, +\item start from the default minimizer settings and perform some fine tuning after some experience has been acquired, +\item repeat the fit using different starting values for the parameters or their limits, +\item repeat the fit, fixing and varying different groups of parameters, +%\item use \Code{Minuit2} minimizer with \Code{Migrad} algorithm +% (default) to get the most reliable parameter error estimation, +%\item try \Code{GSLMultiFit} minimizer or \Code{Minuit2} minimizer with \Code{Fumili} %algorithm to get fewer iterations. +\end{itemize} + +\Work{... to be continued ...} + +%\subsection*{Interpretation of errors.} + +\index{Fitting|)} diff --git a/Doc/UserManual/FormFactors.tex b/Doc/UserManual/FormFactors.tex index 77334d605aea7a8ddb45258c3b92b90376fc860a..1de1dd6601346c2dc1a9d41dd2022c257e3e431b 100644 --- a/Doc/UserManual/FormFactors.tex +++ b/Doc/UserManual/FormFactors.tex @@ -13,6 +13,8 @@ %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\part{Reference}\label{PREF} + \chapter{Form factor library} \label{SFF} % Don't number subfigures in this chapter. @@ -23,7 +25,7 @@ % \lstset{language=python,style=eclipseboxed,numbers=none,nolol} \def\ffsection#1{\FloatBarrier\clearpage\ifodd\value{page} -\textit{Page intentionally left blank}\clearpage\else\fi +\E{Page intentionally left blank}\clearpage\else\fi \section{#1}} diff --git a/Doc/UserManual/IntensityData.tex b/Doc/UserManual/IntensityData.tex new file mode 100644 index 0000000000000000000000000000000000000000..ccbcdb6fd3ea5a96752c68318ee8f0574fff6cab --- /dev/null +++ b/Doc/UserManual/IntensityData.tex @@ -0,0 +1,146 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{User API} \label{UserAPI} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%=============================================================================== +\subsection{IntensityData} +%=============================================================================== + +The \Code{IntensityData} object stores the +simulated or real intensity data together with the axes definition of the detector in BornAgain's internal format. +During the simulation setup +it is created automatically when the user specifies the detector characteristics and is filled with the simulated intensities after the simulation is completed. + +\begin{lstlisting}[language=python, style=eclipseboxed] +simulation = Simulation() +simulation.setDetectorParameters(10, -5.0*degree, 5.0*degree, 5, 0.0*degree, 1.0*degree) +... +simulation.runSimulation() +intensity = simulation.getIntensityData() @\label{py:UserApi:intensity}@ +\end{lstlisting} + +The \Code{IntensityData} object retrieved in line~\ref{py:UserApi:intensity} corresponds to +the two dimensional detector pixel array as shown in \cref{fig:UserApi:IntensityData}. + +\begin{figure}[ht] + \centering + \includegraphics[clip=, width=120mm]{fig/drawing/UserAPI_IntensityDataLayout.eps} + \caption{The axes layout of IntensityData object.} + \label{fig:UserApi:IntensityData} +\end{figure} + +The x-axis and y-axis of the figure correspond to the $\phi_f$ and $\alpha_f$ axes of the detector. +The x-axis is divided into 10 bins, +with low edge of the first bin set to $-5.0\,{\rm deg}$ and upper edge of the last bin set to $+5.0\,{\rm deg}$. +The y-axis is divided into 5 bins, +with low edge of the first bin set to $0.0\,{\rm deg}$ and upper edge of the last bin set to $1.0\,{\rm deg}$. +There are 50 bins in total (they are marked on the plot with indexes from 0 to 49), each bin will contain one intensity value. + +During a standard simulation (i.e. no Monte-Carlo integration involved) intensities are calculated for $\phi_f, \alpha_f$ values corresponding to the bin centers, e.g. the intensity stored in bin\#42 will correspond to $\phi_f=3.5\,{\rm deg}, \alpha_f=0.5\,{\rm deg}$. +\vspace*{2mm} + + +\MakeRemark{}{ +The \Code{IntensityData} object is not intended for direct usage from Python API. The idea is +that the API provides the user with the possibility to export the data from BornAgain internal format to the format of his choice as well as import user's data into BornAgain. +For the moment this functionality is limited to a few options explained below. +We encourage users feedback to implement the support of most requested formats. +}\\ + + + +\subsubsection{Import/export of intensity data} +For the moment we provide following options: +\begin{itemize} +\item Import/export of \Code{IntensityData} object from/to \Code{numpy} array. +\item Import/export of \Code{IntensityData} object from/to text file. + +\end{itemize} + +\paragraph{Export to numpy array} + +To export intensity data into \Code{numpy} array the method \Code{getArray()} should be used +on \Code{IntensityData} object as shown in line \ref{py:UserApi:getArray} of +following code snippet. + +\begin{lstlisting}[language=python, style=eclipseboxed] +intensity = simulation.getIntensityData() +array = intensity.getArray() @\label{py:UserApi:getArray}@ +... +pylab.imshow(numpy.rot90(array, 1)) @\label{py:UserApi:imshow}@ +pylab.show() +\end{lstlisting} + +For the detector settings defined in the previous paragraph the dimensions of the resulting array will be (10,5). By using \Code{numpy} indexes the user can get access to the intensity values, e.g. +\Code{array[0][0]} corresponds to the intensity in bin\#0 of \cref{fig:UserApi:IntensityData}, +\Code{array[0][4]} to bin\#4, +\Code{array[1][0]} to bin\#5, +\Code{array[8][2]} to bin\#42, +\Code{array[9][4]} to bin\#49. + + +To plot this resulting numpy array with \Code{matplotlib} it has to be rotated counter-clockwise +to match \Code{matplotlib} conventions as shown in line~\ref{py:UserApi:imshow}. + + +%\subsubsection{Direct access to the data} +%User can access to the + +%\begin{lstlisting}[language=python, style=eclipseboxed] +%for i in range(0, intensity.getAllocatedSize()): +% print intensity[i] +%\end{lstlisting} + + +\subsubsection{Importing from numpy array} + +To use fitting the user has to load experimental data into BornAgain fitting kernel. +To read experimental data the user has to create +IntensityData object, fill it with the experimental intensity values and pass +this object to the fitting kernel. + +First, the user creates empty \Code{IntensityData} as shown +in line~\ref{py:UserApi:IntensityData} of the following code snippet. +\begin{lstlisting}[language=python, style=eclipseboxed] +data = IntensityData() @\label{py:UserApi:IntensityData}@ +data.addAxis(FixedBinAxis("phi_f", 10, -5.0*degree, 5.0*degree)) @\label{py:UserApi:phi_f}@ +data.addAxis(FixedBinAxis("alpha_f", 5, 0.0*degree, 1.0*degree)) @\label{py:UserApi:alpha_f}@ +... +array = numpy.zeros((10, 5)) # fill array with experimental intensities @\label{py:UserApi:create_array}@ +... +data.setRawDataVector(array.flatten().tolist()) @\label{py:UserApi:set_raw}@ + +fitSuite = FitSuite() @\label{py:UserApi:fit_suite}@ +fitSuite.addSimulationAndRealData(simulation, data) @\label{py:UserApi:add_real_data}@ +\end{lstlisting} + +In lines~\ref{py:UserApi:phi_f}, \ref{py:UserApi:alpha_f} two axes with fixed bin sizes +are defined to represent the detector layout as shown in \cref{fig:UserApi:IntensityData}. +The constructor of \Code{FixedBinAxis} object has the following signature + +\begin{lstlisting}[language=python, style=eclipse,numbers=none] +FixedBinAxis(title, nbins, min_angle, max_angle) +\end{lstlisting} + +The created \Code{IntensityData} object has to be filled with experimental intensities +using \Code{numpy} array prepared by the user (lines ~\ref{py:UserApi:create_array}-~\ref{py:UserApi:set_raw}). In lines \ref{py:UserApi:fit_suite},\ref{py:UserApi:add_real_data} the fitting kernel is created and initialized with \Code{Simulation} object and +\Code{IntensityData} object representing the experimental data. + + +\subsubsection{Saving intensity data to text file.} + +The special class \Code{IntensityDataIOFactory} is intended for saving the intensity data +in different datafile formats. For the moment, it only supports saving the data in specific BornAgain's text files (the file extention \Code{*.int}). + +\begin{lstlisting}[language=python, style=eclipseboxed] +intensity = simulation.getIntensityData() +IntensityDataIOFactory.writeIntensityData(intensity, 'file_name.int') +\end{lstlisting} + +\subsubsection{Reading intensity data from a text file.} +The same class is also intended for reading intensity data +from files with different formats. For the moment, it only supports reading the data from text files of special BornAgain's format (the file extention \Code{*.int}). + +\begin{lstlisting}[language=python, style=eclipseboxed] +intensity = IntensityDataIOFactory.readIntensityData('file_name.int') +\end{lstlisting} diff --git a/Doc/UserManual/Introduction.tex b/Doc/UserManual/Introduction.tex index ffcc4a351c4fbf6e3d51d0154dcd4fe1cffc025b..b15a9c427fac123a5c1312d9894bd604d6f1c397 100644 --- a/Doc/UserManual/Introduction.tex +++ b/Doc/UserManual/Introduction.tex @@ -101,18 +101,63 @@ Adhering to a strict object-oriented design, \BornAgain\ provides a solid base for future extensions in response to specific user needs. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\isection{Registration, contact, discussion forum}\label{Snews} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\index{Registration} +\index{Newsletter} +To stay informed about the ongoing development of \BornAgain, +register on the project homepage \url{http://www.bornagainproject.org} +(``Create new account''). +You will then receive our occasional newsletters, +and be authorized to post to the discussion forum. + +\index{Contact} +To contact the \BornAgain\ development and maintenance team +in the Scientific Computing Group +of Heinz Maier-Leibnitz Zentrum (MLZ) Garching, +write a mail to \url{contact@bornagainproject.org}, +or fill the form in the \textsc{Contact} section of the +project web site. + +\index{Forum} +For questions that might be of wider interest, +please consider posting to the discussion forum, +accessible through the \textsc{Forums} tab of the project web site. + +\index{Bug reports}% +Please contact us for any question not answered here +or in the online documentation. +We are grateful for all kind of feedback: +criticism, praise, bug reports, feature requests or contributed modules. +If questions go beyond normal user support, +we will be glad to discuss a scientific collaboration. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \isection{About this Manual} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -This user manual is complementary to the online documentation +This User Manual is complementary to the online documentation at \url{http://www.bornagainproject.org}. It does not duplicate information that is more conveniently read online. -Therefore, \Cref{sec:online} just contains a few pointers to the web site. -The remainder of this manual mostly contains background -on the scattering theory and on the sample models implemented in \BornAgain, -and some documentation of the corresponding \Python\ functions. +The online documentation covers in particular +how to download and install \BornAgain. + +This User Manual containes of three parts: +\Cref{PPHYS} provides some physics background +on the scattering theory and on the sample models implemented in \BornAgain. +\Cref{PUSE} describes how to use \BornAgain\ through its three different interfaces: +C$++$, Python, and graphical. +\index{C++!using BornAgain from} +\index{Python!using BornAgain from} +\index{GUI|see {Graphical User Interface}} +\index{Graphical User Interface} +It then continues with a detailed tutorial on the Python interface. +Finally, \cref{PREF} is a partial reference of the C$++$ and Python interfaces; +it concentrates on physics related component, +and thereby complements the automatically generated interface documentation +that can be found online at \url{http://www.bornagainproject.org/???}. % TODO. \Work{\indent This manual is incomplete. Several important chapters are still missing.} @@ -139,21 +184,6 @@ To avoid confusion, the manual carries the same version number as the software, even though it is in a less mature state. -\Emph{\indent We urge users to subscribe to our newsletter -(see \Cref{Snews}), -and to contact us for any question not answered here -or in the online documentation.} - -\index{Bug reports}% -We are grateful for all kind of feedback: -criticism, praise, bug reports, feature requests or contributed modules. -If questions go beyond normal user support, -we will be glad to discuss a scientific collaboration. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\isection{Typesetting conventions} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - In this manual, we use the following colored boxes to highlight certain information: @@ -180,10 +210,11 @@ with the software or the documentation.}} how the theory exposed in this manual is actually used in \BornAgain.}} \medskip -\demobox{\Tuto{\indent Such a box provides one or several links - to a usages examples in the online tutorial, - like the basic script \tuto{52}{cylinders in distorted wave Born approximation} - or the long list of \tuto{72}{all available form factors}.}} +\demobox{\Tuto{\indent This is a link to a usage example in the online tutorial. + To be merged into this manual \ldots}} + +\medskip +\demobox{\Link{\indent This is a link to the online docs.}} \bigskip Mathematical notations are explained in the symbol index, page~\pageref{Snomencl}. diff --git a/Doc/UserManual/Macros.tex b/Doc/UserManual/Macros.tex index ffd56fa1da7d51ef14170ee406ed24f4b0f7e2d8..4e520068feb148ee2dc95d1a1979caf1285634c6 100644 --- a/Doc/UserManual/Macros.tex +++ b/Doc/UserManual/Macros.tex @@ -39,8 +39,7 @@ % Fixed-font words \newcommand{\Code}[1]{\texttt{#1}} -\newcommand{\BornAgain}{\Code{Born\discretionary{}{}{}Again}}% -\newcommand{\Python}{\Code{Python}}% +\newcommand{\BornAgain}{{Born\discretionary{}{}{}Again}}% \newcommand{\IsGISAXS}{\Code{IsGISAXS}}% \newcommand{\FitGISAXS}{\Code{FitGISAXS}}% diff --git a/Doc/UserManual/OnlineDocs.tex b/Doc/UserManual/OnlineDocs.tex deleted file mode 100644 index 1a240cce2db43a076ed8de2d5dff49d4fb80674f..0000000000000000000000000000000000000000 --- a/Doc/UserManual/OnlineDocs.tex +++ /dev/null @@ -1,113 +0,0 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% -%% BornAgain User Manual -%% -%% homepage: http://www.bornagainproject.org -%% -%% copyright: Forschungszentrum Jülich GmbH 2015 -%% -%% license: Creative Commons CC-BY-SA -%% -%% authors: Scientific Computing Group at MLZ Garching -%% C. Durniak, M. Ganeva, G. Pospelov, W. Van Herck, J. Wuttke -%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - -\newpage -\chapter{Online documentation} - \label{sec:online} - -This User Manual is complementary to the online documentation -at the project web site \url{http://www.bornagainproject.org}. -It does not duplicate information that is more conveniently -read online. -This brief chapter contains no more than a few pointers to the web site. - -\begin{figure}[ht] -\begin{center} -\includegraphics[width=0.83\textwidth]{fig/screenshot/website.png} -\end{center} -\caption{A screenshot of the home page - \url{http://www.bornagainproject.org}.} -\label{fig:website} -\end{figure} - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\section{Download and installation} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - \index{Download}% - \index{Installation}% - -\BornAgain\ -\index{Platform (operating system)}% -\index{Operating system}% -is a multi-platform software. -We actively support the operating systems -Linux, -\index{Linux}% -MacOS -\index{MacOS}% -and Microsoft Windows. -\index{Windows|see {Microsoft Windows}}% -\index{Microsoft Windows}% -The \textsc{Download} section on the \BornAgain\ web site -points to the download location for -binary and source packages. -It also provides a link to our \Code{git} server -where the unstable development trunk is available -for contributors or for users who want to live on the edge. - -The \textsc{Documentation} section contains -pages with \textit{Installation instructions}. - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\section{Further online information} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -The \textsc{Documentation} section of the project web site -contains in particular -\begin{itemize} -\item an overview of the software architecture, -\item a list of implemented functionality, -\item tutorials for ``Working with \BornAgain'', - using either the Graphical User Interface or - \Python\ scripts, - \index{Tutorials} -\item a comprehensive collection of tutorial examples that demonstrate - how to use \BornAgain\ for modeling various sample structures - and different experimental conditions, -\item a link to the API reference for using \BornAgain\ through - \Python\ scripts or C$++$ programs. -\index{API|see {Application programming interface}}% -\index{Application programming interface}% -\index{Python}% -\index{C++@C$++$} -\end{itemize} - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\section{Registration, contact, discussion forum}\label{Snews} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\index{Registration} -\index{Newsletter} -To stay informed about the ongoing development of \BornAgain, -register on the project homepage \url{http://www.bornagainproject.org} -(``Create new account''). -You will then receive our occasional newsletters, -and be authorized to post to the discussion forum. - -To contact the \BornAgain\ development and maintenance team -in the Scientific Computing Group -of Heinz Maier-Leibnitz Zentrum (MLZ) Garching, -write a mail to \url{contact@bornagainproject.org}, -or fill the form in the \textsc{Contact} section of the -project web site. - -\index{Forum} -For questions that might be of wider interest, -please consider posting to the discussion forum, -accessible through the \textsc{Forums} tab of the project web site. diff --git a/Doc/UserManual/Proofs.tex b/Doc/UserManual/Proofs.tex index dd497f2df1e819f329973661b4e9ca9c44fbc050..fbbe4c24eedf78002ad320ff32f0d388a5c1f966 100644 --- a/Doc/UserManual/Proofs.tex +++ b/Doc/UserManual/Proofs.tex @@ -7,7 +7,7 @@ %% copyright: Forschungszentrum Jülich GmbH 2015 %% %% license: Creative Commons CC-BY-SA -%% +%% %% authors: Scientific Computing Group at MLZ Garching %% C. Durniak, M. Ganeva, G. Pospelov, W. Van Herck, J. Wuttke %% @@ -93,7 +93,7 @@ in the boundary condition~\cref{Escabouco}, G(\r(R,\vartheta,\varphi),\rS) \doteq \frac{\e^{iKR}}{4\pi R} g(\vartheta,\varphi), \end{equation} -and similarly +and similarly \begin{equation} B(\r(R,\vartheta,\varphi),\rD) \doteq \frac{\e^{iKR}}{4\pi R} b(\vartheta,\varphi). @@ -109,7 +109,7 @@ It follows at once that (\text{$R$-dependent})(bg-gb) = 0. \end{equation} -From \cref{Eprerecipro} we obtain the \textit{reciprocity theorem} +From \cref{Eprerecipro} we obtain the \E{reciprocity theorem} \begin{equation}\label{Ereci} G(\rD,\rS) = B(\rS,\rD). \end{equation} diff --git a/Doc/UserManual/SAS.tex b/Doc/UserManual/SAS.tex index 7cc47421dc5703f3ab793e31f4e105ae118f8b79..ee70a48f6e255aff81e433b87d16ae723ae175fb 100644 --- a/Doc/UserManual/SAS.tex +++ b/Doc/UserManual/SAS.tex @@ -13,6 +13,8 @@ %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\part{Physics}\label{PPHYS} + \chapter{Foundations of small-angle scattering} \label{SSas} \chaptermark{Small-angle scattering} diff --git a/Doc/UserManual/Setup.tex b/Doc/UserManual/Setup.tex index 4fcecae3165a98ab4aeb6d2d2f6ec8a8aed0c61d..31f5b1ee9a6a26685fd0ca6d02a535ffcd065c7f 100644 --- a/Doc/UserManual/Setup.tex +++ b/Doc/UserManual/Setup.tex @@ -80,27 +80,54 @@ % Sectioning %------------------------------------------------------------------------------- -% Add rubber to white space around chapter header \makeatletter + \newif\ifnumberedchapter \def\@makechapterhead#1{\numberedchaptertrue\mychapterhead{#1}} \def\@makeschapterhead#1{\numberedchapterfalse\mychapterhead{#1}} +\newif\iffirstchapterinpart +\firstchapterinpartfalse +\renewcommand\part{% + \clearpage\firstchapterinparttrue + \thispagestyle{plain}% + \if@twocolumn + \onecolumn + \@tempswatrue + \else + \@tempswafalse + \fi + \vspace*{50\p@ plus 10\p@ minus 10\p@}% + \secdef\@part\@spart} + + +\def\@part[#1]#2{% + \refstepcounter{part}% + \addcontentsline{toc}{part}{Part~\thepart\hspace{1em}#1}% + \markboth{}{}% + {\interlinepenalty \@M + \normalfont + \ifnum \c@secnumdepth >-2\relax + \parindent \z@ \Large\bfseries \partname\nobreakspace\thepart + \par + \vskip 20\p@ + \fi + \parindent \z@ \huge \bfseries #2\par} + } + +\renewcommand\chapter{ + \iffirstchapterinpart\else\clearpage\fi + \firstchapterinpartfalse + \thispagestyle{plain}% + \global\@topnum\z@ + \@afterindentfalse + \secdef\@chapter\@schapter} + \def\mychapterhead#1{% \vspace*{50\p@ plus 10\p@ minus 10\p@}% {\parindent \z@ \normalfont - \ifnumberedchapter - \raggedright - \Large\bfseries \@chapapp\space \thechapter - \par\nobreak - \vskip 20\p@ plus 4\p@ minus 4\p@ - \interlinepenalty\@M - \fi -% \hrule - \vskip 10\p@ plus 2\p@ minus 2\p@ - \interlinepenalty\@M \raggedright - \huge \bfseries #1\par\nobreak + \LARGE \bfseries \ifnumberedchapter\thechapter~~\fi #1\par\nobreak \interlinepenalty\@M \vskip 10\p@ plus 2\p@ minus 2\p@ % \hrule @@ -108,6 +135,7 @@ \vskip 40\p@ plus 8\p@ minus 8\p@ }} +% Index, Bibliography, ... \def\otherchapter#1{ \clearpage \phantomsection @@ -253,21 +281,24 @@ \def\mdbreakoff{\makeatletter\booltrue{mdf@nobreak}\makeatother} \def\mdbreakon{\makeatletter\boolfalse{mdf@nobreak}\makeatother} -\def\marginSymbolLarge#1#2{\ifdraft{\textbf{#2~~~~}}{\raisebox{-3ex}% -{\includegraphics[width=3em]{#1}\hspace{10pt}}}} +\def\marginSymbolLarge#1#2{\raisebox{-3ex}{\includegraphics[width=3em]{#1}\hspace{10pt}}} \defineBox{boxWork}{boxxWork}{magenta!40}{magenta} {\marginSymbolLarge{fig/icons/Arbeiten.png}{TODO}} \defineBox{boxWarn}{boxxWarn}{magenta!40}{magenta} {\marginSymbolLarge{fig/icons/Achtung.png}{WARN}} \defineBox{boxNote}{boxxNote}{yellow!33}{yellow}{{}} -\defineBox{boxTuto}{boxxTuto}{blue!20}{blue}{{}} +\defineBox{boxTuto}{boxxTuto}{blue!25}{red} + {\marginSymbolLarge{fig/icons/Arbeiten.png}{TODO}} \defineBox{boxEmph}{boxxEmph}{green!20}{green}{{}} +\defineBox{boxLink}{boxxLink}{blue!25}{blue} + {\marginSymbolLarge{fig/icons/Weblink.png}{LINK}} \def\Warn#1{\begin{boxWarn}#1\end{boxWarn}} \def\Work#1{\begin{boxWork}#1\end{boxWork}} \def\Note#1{\begin{boxNote}#1\end{boxNote}} \def\Tuto#1{\begin{boxTuto}#1\end{boxTuto}} +\def\Link#1{\begin{boxLink}#1\end{boxLink}} \def\Emph#1{\begin{boxEmph}#1\end{boxEmph}} \def\Emphc#1{\begin{boxEmph}#1\vskip -5pt\end{boxEmph}} @@ -293,6 +324,9 @@ \crefformat{equation}{(#2#1#3)} \Crefformat{equation}{Equation~(#2#1#3)} +\crefformat{part}{Part~#2#1#3} +\Crefformat{part}{Part~#2#1#3} + \crefformat{chapter}{Chapter~#2#1#3} \Crefformat{chapter}{Chapter~#2#1#3} diff --git a/Doc/UserManual/ThreeAPIs.tex b/Doc/UserManual/ThreeAPIs.tex new file mode 100644 index 0000000000000000000000000000000000000000..c63e5892322a6b6ec02e89e88bbb169bbd9b8044 --- /dev/null +++ b/Doc/UserManual/ThreeAPIs.tex @@ -0,0 +1,249 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% BornAgain User Manual +%% +%% homepage: http://www.bornagainproject.org +%% +%% copyright: Forschungszentrum Jülich GmbH 2016 +%% +%% license: Creative Commons CC-BY-SA +%% +%% authors: Scientific Computing Group at MLZ Garching +%% M. Ganeva, G. Pospelov, W. Van Herck, J. Wuttke +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\part{Usage}\label{PUSE} + +\chapter{The three interfaces of \BornAgain} \label{sec:API3} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Architectural overview} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +The overall architecture of \BornAgain\ is outlined in \cref{Farch1}. +The core of \BornAgain\ +\index{Core|see {\Code{libBornAgainCore}}} +comprises functionality to construct arbitrary hierarchical sample models, +to setup instrument models, +and to compute the expected detector image for any given sample and instrument model. +Furthermore \BornAgain\ comes with various minimizers that optimize model parameters +to fit the simulated detector image to a given experimental image. +All this functionality is implemented in a library, \Code{libBornAgainCore}. + +\begin{figure}[tbh] +\begin{center} +\includegraphics[width=0.7\textwidth]{fig/drawing/architecture1.ps} +\end{center} +\caption{Overall architecture of \BornAgain. +\index{Architecture!applications and libraries}% +Applications are shown as oval fields, libraries as rectangles. +Black arrows indicate ``depends on''. +Green fields designate software that is part of \BornAgain. +Gray fields are external dependences +(only two external libraries are explicitly shown; +several more are listed in the online compilation instructions). +Blue fields indicate stand-alone applications that use \BornAgain's +two Application Programming Interfaces (the C$++$ API and the Python API). +\index{C++!using BornAgain from} +\index{Python!using BornAgain from} +\index{Application Programming Interface} +While such applications are to be written by users, +some examples come with the \BornAgain\ source distribution, +and are explained in the following Manual chapters. +It is also possible to export a simulation setup from GUI as Python code. +The binding of C++ to Python is highly simplified here. +For a more accurate picture, see \Cref{FarchPy}.} +\label{Farch1} +\end{figure} + +\index{libBornAgainCore@\Code{libBornAgainCore}} +This library, in turn, depends on a number of other libraries. +One of these, the minimizer wrapper \Code{libBornAgainFit} +\index{libBornAgainFit@\Code{libBornAgainFit}} +\index{Minimizers|see \Code{libBornAgainFit}} +has been written specifically for use in \BornAgain, +and for the time being is only distributed as part of \BornAgain, +though in the future it may find applications in other contexts. +The other library dependences of \Code{libBornAgainCore} +are multi-purpose libraries that are easily available as open-source packages. +\index{Dependences!libraries} + +The library \Code{libBornAgainCore} can be used in three different ways: +From its graphical user interface (GUI), or +from user-written stand-alone applications in the programming languages C$++$ or Python. +These different approaches are briefly outlined below. +The Python interface is then described at length in the next chapters. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Using \BornAgain\ from its Graphical User Interface} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\index{Graphical User Interface|(} +\index{bornagain@\Code{bornagain}|see {Graphical User Interface}} +\index{Exectutable!bornagain@\Code{bornagain}|see {Graphical User Interface}} +\index{Binary|see {Executable}} +%\index{Project name!BornAgain@\BornAgain} + +The project \BornAgain\ comes with a stand-alone application called \Code{bornagain} +that provides a Graphical User Interface (GUI). +Note that we distinguish between the GUI executable \Code{bornagain}, +the underlying library \Code{libBornAgainCore}, and the project \BornAgain\ at large. + +The GUI allows users to quickly setup a simulation, to visualize simulated +detector images, to compare with experimental images, and to run fits. +It provides comfortable access to much, but not all the functionality +of \Code{libBornAgainCore}. +Depending on application fields, +users may sooner or later reach the limits of current GUI support. +Other users may have repetitive tasks that are cumbersome under a GUI. +In such cases, users can export their sample and instrument models from +the GUI as a Python script, +and continue work by directly editing the Python code. +\index{Export!Python from GUI} + +\Link{Documentation of the GUI is available online:\\ + \url{http://www.bornagainproject.org/documentation/usage/gui}} +\index{Graphical User Interface|)} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Using \BornAgain\ from Python} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\index{Python!using BornAgain from|(} +\index{Application Programming Interface!Python|(} + +\BornAgain\ simulations and fits can be set up and run from Python programs +or from a Python command-line interpreter like \Code{IPython}. +\index{IPython} +\index{Command line!Python} +A short program in an interpreted language like Python is customarily called +\index{Script!Python} +\index{Python!script} +a \E{script}, +and therefore in the following we will talk about \E{Python scripts}. +Of course this does not preclude the possibility that such scripts evolve into +complex programs, modules, or packages. +And anything we say about scripts also applies to usage of \BornAgain\ in an +interactive Python session.% +\index{Interactive!Python session}% +\index{Python!interactive use}% + +Usage of \BornAgain\ in a Python script should start with the command +\begin{lstlisting}[language=python, style=eclipseboxed,name=ex1,nolol] +import bornagain as ba @\label{import_as}\index{Import!\BornAgain\ to Python|(}@ +\end{lstlisting} +This then allows calls to \BornAgain\ in commands like +\pagebreak[2] +\begin{lstlisting}[language=python, style=eclipseboxed,name=ex1,nolol] +air = ba.HomogeneousMaterial("Air", 0.0, 0.0) @\label{constructor_beg}@ +air_layer = ba.Layer(air) +sample = ba.MultiLayer() @\label{constructor_end}@ +sample.addLayer(air_layer) @\label{class_func_call}@ +\end{lstlisting} +The function calls in lines \ref{constructor_beg}--\ref{constructor_end} +return new \E{objects}. +\index{Object!constructor} +These objects are instances of \E{classes} defined in \BornAgain. +\index{Class!Instantiation} +In the language of object-oriented programming, +a Function that returns a new instance of a class is called a \E{constructor}. +\index{Constructor} +In Python, as in C++, constructor names coincide with class names; +so the constructor function \Code{Layer(material)} will return an +object of class type \Code{Layer}. + +\begin{figure}[tb] +\begin{center} +\includegraphics[width=0.72\textwidth]{fig/drawing/architecturePy.ps} +\end{center} +\caption{Relation between the BornAgain C++ libraries and the Python layer. +\index{Architecture!Python binding}% +Python code is indicated by \textsl{slanted font}. +Colors as in \Cref{Farch1}. +Bold arrows indicate ``depends on'' for code that is automatically generated +by the software tool Swig.% +\index{Swig}% +\index{Python!Swig}% +} +\label{FarchPy} +\end{figure} + +To prevent accidental use of class or constructor names, +they are encapsulated in a \E{namespace} +\index{Namespace} +called \Code{bornagain}. +The \Code{import} command in the above code line~\ref{import_as} +makes this namespace available under the shortcut \Code{ba}. +\index{Import!\BornAgain\ to Python|)} +Note, however, that not all calls to \BornAgain\ require +(and can be recognized by) the prefix \Code{ba}. +The function call \Code{addLayer} in line~\ref{class_func_call} +is defined inside the \BornAgain\ class \Code{MultiLayer}. +The programmer is supposed to know that \Code{sample} is an instance of +class \Code{MultiLayer}, which is part of \BornAgain. +Therefore, there is no need (and no way) to adorn function calls like \Code{addLayer} +with the namespace label \Code{ba}. + +The entirety of classes and functions provided by \BornAgain\ +and exposed to Python forms the \E{BornAgain Python API}. +An API (Application Programming Interface) +\index{Application Programming Interface!Python} +is a kind of protocol that tells a programmer how to use a library. +In this perspective, the research scientist +who uses Python to set up simulations or fits +is seen as a \E{programmer} who writes an application program. +This notwithstanding, he is still a \E{user} +of the BornAgain Python library. +The relation of this library to the underlaying C++ library is explained +in \Cref{FarchPy}. + +The remaining chapters of this \Cref{PUSE} of the BornAgain Manual +contain tutorial examples how to use the BornAgain Python API. +\index{Tutorial} +\Cref{PREF} provides an incomplete reference. +\index{Reference} +For a full reference, see the online API documentation at +\url{bornagain.org/???}. +This documentation is automatically generated from the source code +(which for this purpose contains standardized comments in Doxygen format). +\index{Doxygen!API reference} +\index{Python!Doxygen API reference} +It is actually a documentation of the C++ API, +but usually it is not difficult to infer the form of the corresponding Python +function calls. + +\index{Application Programming Interface!Python|)} +\index{Python!using BornAgain from|)} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Using \BornAgain\ from C++} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\index{C++!using BornAgain from|(} +\index{Application Programming Interface!C++|(} + +Alternatively, BornAgain can also be used from the programs written +in the language~C++. +Since BornAgain itself is written in C++, +\index{C++!BornAgain written in}% +the BornAgain C++ API natively consists of +all classes and functions in \Code{libBornAgainCore} and \Code{libBornAgainFit}, +\index{libBornAgainCore@\Code{libBornAgainCore}}% +\index{libBornAgainFit@\Code{libBornAgainFit}}% +including internal ones that are not exposed to Python. +It empowers application programmers to use BornAgain +in ways we cannot foresee. + +Normal GISAS users, however, will find that their simulation and fit tasks +are well served by the Python API, +that edit-and-rerun cycles are faster with Python than with a compiled language, +and that there is no need to use BornAgain from C++. +Therefore, we provide not much documentation for the C++ API, +except for the automatically generated Doxygen reference at +\url{bornagain.org/???} and +\index{Doxygen!API reference} +\index{C++!Doxygen API reference} +for one basic example \url{Examples/cpp/CylindersAndPrisms} +in the source distribution. + + +\index{Application Programming Interface!C++|)} +\index{C++!using BornAgain from|)} diff --git a/Doc/UserManual/Usage.tex b/Doc/UserManual/Usage.tex new file mode 100644 index 0000000000000000000000000000000000000000..69e98e3b3202a56f3119f6bdfe3183d7f1bae826 --- /dev/null +++ b/Doc/UserManual/Usage.tex @@ -0,0 +1,519 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% BornAgain User Manual +%% +%% homepage: http://www.bornagainproject.org +%% +%% copyright: Forschungszentrum Jülich GmbH 2015 +%% +%% license: Creative Commons CC-BY-SA +%% +%% authors: Scientific Computing Group at MLZ Garching +%% C. Durniak, M. Ganeva, G. Pospelov, W. Van Herck, J. Wuttke +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\def\PyImport#1{% +\lstinputlisting[language=python,style=eclipseboxed,name=ex1,nolol]{../../Examples/python/#1}} + +\newpage +\chapter{Using the Python API} \label{sec:Usage} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Running a simulation} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +A simulation of GISAS using \BornAgain\ consists of the following steps: +\begin{itemize} +\item define materials by specifying name and refractive index, +\item define layers by specifying thickness, roughness, material, +\item define embedded particles by specifying shape, size, + constituting material, interference function, +\item embed the particles in layers, specifying density, position, orientation, +\item assemble a multilayered sample, +\item specify input beam and detector characteristics, +\item run the simulation, +\item save the simulated detector image. +\end{itemize} + +\noindent +All these steps can be organized in either a Graphical User Interface (GUI) or by providing a Python script with the simulation description. +In the following, we describe how to write a +\Code{Python} script which runs a \BornAgain\ simulation. For tutorials about this programming language, the users are referred to \cite{Lut09}. + + +% More information about the general software architecture and \BornAgain\ internal design are given in \cref{sec:SoftwareArchitecture}. + + +%=============================================================================== +\subsection{Units:} +%=============================================================================== +\index{Units} + +By default the angles are expressed in radians and the lengths are given in +nanometers. But it is possible to use other units by +specifying them right after the value of the corresponding +parameter like, for example, \Code{20.0*micrometer}. + + +%=============================================================================== +\subsection{A first example} \label{sec:Example1Python} +%=============================================================================== + +In this example, we simulate the scattering from a mixture of +cylindrical and prismatic nanoparticles without any interference +between them. These particles are placed in air, on top +of a substrate.\\ We are going to go through each step of the +simulation. The Python code snippet specific to each stage will be given at +the beginning of the description. +More examples can be found at our project web site \url{http://www.bornagainproject.org/documentation/python_examples} + +% But for the sake of completeness the full code is given +% in \cref{PythonSimulationExampleScript}. + +%------------------------------------------------------------------------------- +\subsubsection{Importing Python modules} +%------------------------------------------------------------------------------- + +\begin{lstlisting}[language=python, style=eclipseboxed,name=ex1,nolol] +import numpy @\label{import_lib_beg}@ +import matplotlib +import pylab @\label{import_lib_end}@ +from bornagain import * @\label{import_ba}@ +\end{lstlisting} +We start by importing different functions from external +modules, for example \Code{NumPy} (lines~\ref{import_lib_beg}-\ref{import_lib_end}), which +is a fundamental package for scientific computing with Python +\cite{s:numpy}. In particular, line~\ref{import_ba} +imports the features of \BornAgain\ software. + +%------------------------------------------------------------------------------- +\subsubsection{Defining the materials} +%------------------------------------------------------------------------------- + +\begin{lstlisting}[language=python, style=eclipseboxed,name=ex1,nolol] +def get_sample(): @\label{def_function}@ + """ + Build and return the sample representing cylinders and pyramids on top of substrate without interference. + """ + # defining materials @\label{material1}@ + m_air = HomogeneousMaterial("Air", 0.0, 0.0) @\label{material2}@ + m_substrate = HomogeneousMaterial("Substrate", 6e-6, 2e-8) @\label{material3}@ + m_particle = HomogeneousMaterial("Particle", 6e-4, 2e-8) @\label{materialparticle}@ + +\end{lstlisting} +Line~\ref{def_function} marks the beginning of the +function to define our sample. Lines~\ref{material2}, \ref{material3} and \ref{materialparticle} define different +materials using class \Code{HomogeneousMaterial}. The general syntax is the following +\begin{lstlisting}[language=python, style=eclipse,numbers=none] +<material_name> = HomogeneousMaterial("name", delta, beta) +\end{lstlisting} +where \Code{name} is the name of the +material associated with its complex refractive index +n=1-\Code{delta} +i \Code{beta}. \Code{<material\_name>} is later used when +referring to this particular material. The three materials defined in this example are \Code{Air} with a refractive +index of 1 (\Code{delta = beta = 0}), a \Code{Substrate} associated with a complex refractive index +equal to $1-6\times 10^{-6} +i2\times 10^{-8} $, and the material of the particles, whose refractive index is \Code{n}$=1-6\times 10^{-4}+i2\times 10^{-8}$. + +%------------------------------------------------------------------------------- +\subsubsection{Defining the particles} +%------------------------------------------------------------------------------- +\begin{lstlisting}[language=python,style=eclipseboxed,name=ex1,nolol] + # collection of particles @\label{particles1}@ + cylinder_ff = FormFactorCylinder(5*nanometer, 5*nanometer) @\label{particlescyl1}@ + cylinder = Particle(m_particle, cylinder_ff) @\label{particlescyl2}@ + prism_ff = FormFactorPrism3(10*nanometer, 5*nanometer) @\label{particlesprism1}@ + prism = Particle(m_particle, prism_ff) @\label{particlesprism2}@ +\end{lstlisting} +We implement two different shapes of particles: cylinders and +prisms (\idest elongated particles with a constant equilateral triangular cross section). + +All particles implemented in \BornAgain\ are defined by their +form factors (see \cref{app:ff}), their sizes and the material +they are made of. Here, for the +cylindrical particle, we input its radius and height. For the prism, +the possible inputs are the length of one side of its equilateral triangular +base and its height. + +In order to define a particle, we proceed in two steps. For example for +the cylindrical particle, we first specify the form factor of a cylinder with +its radius and height, both equal to 5 nanometers in this particular +case (see line~\ref{particlescyl1}). Then we associate this shape with +the constituting material as in line~\ref{particlescyl2}. +The same procedure has been applied for the prism in lines~\ref{particlesprism1} and \ref{particlesprism2}, respectively. + +%------------------------------------------------------------------------------- +\subsubsection{Characterizing particles assembly} +%------------------------------------------------------------------------------- +\begin{lstlisting}[language=python, style=eclipseboxed, name=ex1,nolol] + particle_layout = ParticleLayout() @\label{particlesdecor1}@ + particle_layout.addParticle(cylinder, 0.5) @\label{particlesdecor2}@ + particle_layout.addParticle(prism, 0.5)@\label{particlesdecor3}@ + interference = InterferenceFunctionNone() @\label{particlesnointerf}@ + particle_layout.addInterferenceFunction(interference) @\label{particlesinterf}@ +\end{lstlisting} +The object which holds the information about the positions and densities of particles +in our sample is called \Code{ParticleLayout} +(line~\ref{particlesdecor1}). We use the associated function \Code{addParticle} +for each particle shape (lines~\ref{particlesdecor2}, \ref{particlesdecor3}). Its general syntax is + +\begin{lstlisting}[language=python, style=eclipse,numbers=none] +addParticle(<particle_name>, abundance) +\end{lstlisting} +where \Code{<particle\_name>} is the name used to define the particles +(lines~\ref{particlescyl2} and \ref{particlesprism2}) and +\Code{abundance} is the proportion of this type of particles, +normalized to the total number of particles. Here we have 50\% of cylinders +and 50\% of prisms. + +\noindent Finally, lines~\ref{particlesnointerf} and +\ref{particlesinterf} specify that there is \textbf{no coherent interference} between +the waves scattered by these particles. In this case, the intensity is calculated by +the incoherent sum of the scattered waves: $\bra |F_j|^2\ket$, +where $F_j$ is the form factor associated with the particle of type $j$. The way these waves +interfere imposes the horizontal distribution of +the particles as +the interference reflects the long or short-range order of the +particles distribution (see \cref{sec:sect:interf}). On the contrary, the vertical position is +imposed when we add the particles in a given layer by parameter \Code{depth}, as shown in lines~\ref{particlesdecor2} and \ref{particlesdecor3}. + +%------------------------------------------------------------------------------- +\subsubsection{Multilayer} +%------------------------------------------------------------------------------- +\begin{lstlisting}[language=python, style=eclipseboxed,name=ex1,nolol] +# air layer with particles and substrate form multi layer @\label{sampleassembling}@ + air_layer = Layer(m_air) @\label{airlayer}@ + air_layer.addLayout(particle_layout) @\label{airlayerdecorator}@ + substrate_layer = Layer(m_substrate, 0) @\label{substratelayer}@ + multi_layer = MultiLayer() @\label{multilayercanvas}@ + multi_layer.addLayer(air_layer) @\label{layerairdecor}@ + multi_layer.addLayer(substrate_layer) @\label{layersubstrate}@ + return multi_layer @\label{returnmlayer}@ +\end{lstlisting} +We now have to configure our sample. For this first example, +the particles, \idest cylinders and prisms, are on top of a substrate in an +air layer. \textbf{The order in which we define these layers is important: we +start from the top layer down to the bottom one}. + +Let us start with the air layer. It contains the particles. In +line~\ref{airlayer}, we use the previously defined \Code{m\_air} +(="air" material) (line~\ref{material2}). The command in line~\ref{airlayerdecorator} shows that this layer contains particles +which are defined using particle layout object. The substrate layer +only contains the substrate material (line~\ref{substratelayer}). +%Note that the +%\Code{depth} is referenced to the bottom of the top layer (negative +%values would correspond to particles floating above layer 1 as +%the vertical axis is pointing upwards). + +There are different possible syntaxes to define a layer. As shown in +lines~\ref{airlayer} and \ref{substratelayer}, we can use +\Code{Layer(<material\_name>,thickness)} or +\Code{Layer(<material\_name>)}. The second case corresponds +to the default value of the \Code{thickness}, equal to 0. The \Code{thickness} is +expressed in nanometers. + +Our two layers are now fully characterized. The sample is assembled using +\Code{MultiLayer()} constructor (line~\ref{multilayercanvas}): we start with the air layer decorated +with the particles (line~\ref{layerairdecor}), which is the layer at +the top and end with the bottom layer, which is the +substrate (line~\ref{layersubstrate}). + +%------------------------------------------------------------------------------- +\subsubsection{Characterizing the input beam and output detector} +%------------------------------------------------------------------------------- + +\begin{lstlisting}[language=python, style=eclipseboxed,name=ex1,nolol] +def get_simulation(): @\label{run1}@ + """ + Create and return GISAXS simulation with beam and detector defined + """ + simulation = Simulation() @\label{run2}@ + simulation.setDetectorParameters(100, -1.0*degree, 1.0*degree, 100, 0.0*degree, 2.0*degree) @\label{rundetector}@ + simulation.setBeamParameters(1.0*angstrom, 0.2*degree, 0.0*degree) @\label{runbeam}@ + return simulation @\label{returnsimul}@ +\end{lstlisting} +The first stage is to create the \Code{Simulation()} object (line~\ref{run2}). Then we define the detector (line~\ref{rundetector}) and beam +parameters (line~\ref{runbeam}). %, which are associated with the +%sample previously defined (line~\ref{runsample}). Finally we run +%the simulation (line~\ref{runsimul}). +Those functions are part of the Simulation +class. The different incident and exit angles are +shown in \cref{fig:multil3d}. + +The detector parameters are set using ranges of angles via +the function: + +\begin{lstlisting}[language=python, style=eclipse,numbers=none] +setDetectorParameters(n_phi, phi_f_min, phi_f_max, n_alpha, alpha_f_min, alpha_f_max), +\end{lstlisting} + + +\noindent where number of bins \Code{n\_phi}, low edge of first bin \Code{phi\_f\_min} and +upper edge of last bin \Code{phi\_f\_max} all together define $\phi_f$ detector axis, +while \Code{n\_alpha}, \Code{alpha\_f\_min} and \Code{alpha\_f\_max} are related to +$\alpha_f$ detector axis. + +\Note{Axis binning: +By default axes are binned to provide constant bin size in k-space, which means slightly +non-equidistant binning in angle space. Other possible options, including user defined +axes with custom variable bin size are explained elsewhere.} + +%are the minimum and maximum values of $\phi_f$, respectively, \Code{n\_alpha} is +%the number of bins for $\alpha_f$ axis, \Code{alpha\_f\_min} and \Code{alpha\_f\_max} +%are the minimum and maximum values of +%$\alpha_f$, respectively. + +%\Code{isgisaxs\_style=True} (default value = \Code{False}) is a boolean +%used to characterise the structure of the output data. If +%\Code{isgisaxs\_style=True}, the output data is binned at constant +%values of the sine of the output angles, $\alpha_f$ and $\phi_f$, otherwise it is binned +%at constant values of these two angles.\\ + +\noindent To characterize the beam we use function +\begin{lstlisting}[language=python, style=eclipse,numbers=none] +setBeamParameters(lambda, alpha_i, phi_i), +\end{lstlisting} + +\noindent where \Code{lambda} is the incident beam wavelength, +\Code{alpha\_i} is the incident +grazing angle on the surface of the sample, +\Code{phi\_i} is the in-plane +direction of the incident beam (measured with respect to the $x$-axis). + + +%------------------------------------------------------------------------------- +\subsubsection{Running the simulation and plotting the results} +%------------------------------------------------------------------------------- + +\begin{lstlisting}[language=python, style=eclipseboxed,name=ex1,nolol] +def run_simulation(): @\label{run_simulation}@ + """ + Run simulation and plot results + """ + sample = get_sample() @\label{get_sample}@ + simulation = get_simulation() @\label{get_simulation}@ + simulation.setSample(sample) @\label{setsample}@ + simulation.runSimulation() @\label{runsimul}@ + result = simulation.getIntensityData().getArray() + 1 # for log scale @\label{outputdata}@ + pylab.imshow(numpy.rot90(result, 1), norm=matplotlib.colors.LogNorm(), extent=[-1.0, 1.0, 0, 2.0]) @\label{plot1}@ + pylab.show() @\label{plot2}@ +\end{lstlisting} +%In function \Code{run\_simulation()}, we associate the sample +%characterised by function \Code{get\_sample()} with the input beam and +%output detector, defined in function \Code{get\_simulation()} (line~\ref{runsample}). +The function, whose definition starts from line~\ref{run_simulation}, gathers all +items. We create the sample and the simulation objects at the lines +~\ref{get_sample} and \ref{get_simulation}, using calls to the previously defined functions. We assign the sample to the simulation at line ~\ref{setsample} and +finally launch the simulation at line ~\ref{runsimul}. + +In line~\ref{outputdata} we obtain the simulated intensity +as a function of outgoing angles $\alpha_f$ and $\phi_f$ for further +uses (plots, fits,\ldots) as a \Code{NumPy} array containing +\Code{n\_phi}$\times$\Code{n\_alpha} +datapoints. Lines~\ref{plot1}-\ref{plot2} produces the two-dimensional +contour plot of the intensity as a function of $\alpha_f$ and +$\phi_f$ shown in \cref{fig:output_ex1}. + +\begin{figure}[htbp] + \begin{center} + \includegraphics[clip=true, width=120mm]{fig/gisasmap/Manual_ex1.eps} + \end{center} + \caption[Example 1: Simulated grazing-incidence small-angle X-ray scattering from a mixture of +cylindrical and prismatic nanoparticles without any interference, deposited on top +of a substrate]{Simulated grazing-incidence small-angle X-ray scattering from a mixture of +cylindrical and prismatic nanoparticles without any interference, deposited on top +of a substrate. The input beam is characterized by a wavelength +$\lambda$ of 1~\AA\ and incident angles $\alpha_i=0.2^{\circ}$, $\phi_i=0^{\circ}$. The +cylinders have a radius and a height both equal to 5~nm, the prisms +are characterized by a side length equal to 10~nm and they are 5~nm high. The +material of the particles has a refractive index of $1-6\times 10^{-4}+i2\times 10^{-8}$. For the substrate +it is equal to $1-6\times 10^{-6} +i2\times 10^{-8} $. The color scale +is associated with the output intensity in arbitrary units. } +\label{fig:output_ex1} +\end{figure} + + +%=============================================================================== +\subsection{Working with sample parameters} + \label{sec:WorkingWithSampleParameters} +%=============================================================================== + + +This section gives additional details about the manipulation of sample parameters +during run time; that is after the sample has already been constructed. +For a single simulation this is normally not necessary. However it might be useful +during interactive work when the user tries to find optimal sample parameters by +running a series of simulations. +A similar task also arises when the theoretical model, composed of the +description of the sample and of the simulation, is used for fitting real data. +In this case, the fitting kernel requires a list of the existing sample parameters +and a mechanism for changing the values of these parameters in order to find +their optima. + +In \BornAgain\ this is done using the so-called sample parameter pool +mechanism. We are going to briefly explain this approach using the example +of \cref{sec:Example1Python}. + +In \BornAgain\ a sample is described by a hierarchical tree of objects. +For the multilayer created in the previous section this tree can be graphically +represented as shown in \cref{fig:sample_tree}. Similar trees can +be printed in a Python +session by running \Code{multi\_layer.printSampleTree()} + +\begin{figure}[p!] + +\tikzstyle{every node}=[draw=black,thick,anchor=west] +\tikzstyle{selected}=[draw=red,fill=red!30] +\tikzstyle{optional}=[dashed,fill=gray!50] +\begin{tikzpicture}[% + grow via three points={one child at (0.5,-0.7) and + two children at (0.5,-0.7) and (0.5,-1.4)}, + edge from parent path={(\tikzparentnode.south) |- (\tikzchildnode.west)}] + \node {MultiLayer} + child { node {Layer \#0} + child { node {ParticleLayout } + child { node {Particle Info 0} + child {node {Particle } + child { node {FormFactorCylinder} + child { node [optional] { radius:5.0} } + child { node [optional] { height:5.0} } + } + } + child [missing] {} + child [missing] {} + child [missing] {} + child {node [optional] { abundance:0.5} } + child {node [optional] { depth:0.0} } + } + child [missing] {} + child [missing] {} + child [missing] {} + child [missing] {} + child [missing] {} + child [missing] {} + child { node {Particle Info 1} + child {node {Particle } + child { node {FormFactorPrism3} + child { node [optional] { length:10.0} } + child { node [optional] { height:5.0} } + } + } + child [missing] {} + child [missing] {} + child [missing] {} + child {node [optional] { abundance:0.5} } + child {node [optional] { depth:0.0} } + } + } + child [missing] {} + child [missing] {} + child [missing] {} + child [missing] {} + child [missing] {} + child [missing] {} + child [missing] {} + child [missing] {} + child [missing] {} + child [missing] {} + child [missing] {} + child [missing] {} + child [missing] {} + child [missing] {} + child {node [optional] { thickness:0.0} } + } + child [missing] {} + child [missing] {} + child [missing] {} + child [missing] {} + child [missing] {} + child [missing] {} + child [missing] {} + child [missing] {} + child [missing] {} + child [missing] {} + child [missing] {} + child [missing] {} + child [missing] {} + child [missing] {} + child [missing] {} + child [missing] {} + child { node {Layer interface \#0} + child {node { roughness} + child {node [optional] { corrlength:0.0} } + child {node [optional] { hurst:0.0} } + child {node [optional] { sigma:0.0} } + } + } + child [missing] {} + child [missing] {} + child [missing] {} + child { node {Layer \#1} + child {node [optional] { thickness:0.0} } + } + child [missing] {} + child { node [optional] {CrossCorrLength:0.0} }; + +\end{tikzpicture} +\caption{Tree representation of the sample structure.} +\label{fig:sample_tree} +\end{figure} + + +The top \Code{MultiLayer} object is composed of three children, namely +\Code{Layer \#0, Layer Interface \#0} and \Code{Layer \#1}. The +children objects might themselves also be decomposed into tree-like structures. For example, +\Code{Layer \#0} contains a \Code{ParticleLayout} object, which holds information +related to the two types of particles populating the layer. All numerical values used +during the sample construction (thickness of layers, size of particles, roughness parameters) are part of the same tree structure. +They are marked in the figure with shaded gray boxes. + +These values are registered in the sample parameter pool using the name +composed of the corresponding nodes' names. And they can be accessed/changed +during run time. For example, the \Code{height} of the cylinders +populating the first layer can be changed from the +current value of $5~\rm{nm}$ to $1~\rm{nm}$ by running the command + +\begin{lstlisting}[language=shell, style=commandline] +multi_layer.setParameterValue('/MultiLayer/Layer0/ParticleLayout/ParticleInfo0/Particle/FormFactorCylinder/height', 1.0) +\end{lstlisting} + + +A list of the names and values of all registered sample's parameters +can be displayed using the command + +\begin{lstlisting}[language=shell, style=commandline] +> multi_layer.printParameters() +The sample contains following parameters ('name':value) +'/MultiLayer/Layer0/ParticleLayout/ParticleInfo0/Particle/FormFactorCylinder/height':5 +'/MultiLayer/Layer0/ParticleLayout/ParticleInfo0/Particle/FormFactorCylinder/radius':5 +'/MultiLayer/Layer0/ParticleLayout/ParticleInfo0/abundance':0.5 +'/MultiLayer/Layer0/ParticleLayout/ParticleInfo0/depth':0 +'/MultiLayer/Layer0/ParticleLayout/ParticleInfo1/Particle/FormFactorPrism3/length':5 +'/MultiLayer/Layer0/ParticleLayout/ParticleInfo1/Particle/FormFactorPrism3/height':5 +'/MultiLayer/Layer0/ParticleLayout/ParticleInfo1/abundance':0.5 +'/MultiLayer/Layer0/ParticleLayout/ParticleInfo1/depth':0 +'/MultiLayer/Layer0/thickness':0 +'/MultiLayer/Layer1/thickness':0 +'/MultiLayer/LayerInterface/roughness/corrlength':0 +'/MultiLayer/LayerInterface/roughness/hurst':0 +'/MultiLayer/LayerInterface/roughness/sigma':0 +'/MultiLayer/crossCorrLength':0 +\end{lstlisting} + +Wildcards \Code{'*'} can be used to reduce typing or to work on a group +of parameters. In the example below, the first command will change the +height of all cylinders in the same way, as in the previous example. The second line will change simultaneously the height of {\it both} cylinders and prisms. +\begin{lstlisting}[language=shell, style=commandline] +multi_layer.setParameterValue('*FormFactorCylinder/height', 1.0) +multi_layer.setParameterValue('*height', 1.0) +\end{lstlisting} + +The complete example described in this section can be found at +\begin{lstlisting}[language=shell, style=commandline] +./Examples/python/fitting/ex001_SampleParametersIntro/SampleParametersIntro.py +\end{lstlisting} + +\section{UNDER CONSTRUCTION} + +\PyImport{simulation/ex01_BasicParticles/AllFormFactorsAvailable.py} diff --git a/Doc/UserManual/fig/drawing/architecture1.ps b/Doc/UserManual/fig/drawing/architecture1.ps new file mode 100644 index 0000000000000000000000000000000000000000..1b7abc3f2cd545ef32a2cdf038563c90fa42f422 --- /dev/null +++ b/Doc/UserManual/fig/drawing/architecture1.ps @@ -0,0 +1,1683 @@ +%!PS-Adobe-1.0 EPSF-1.0 +%%BoundingBox: 75 461 588 747 +%%Comment: Bounding box extracted by bboxx +%%+: A program by Dov Grobgeld 2003 + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% FRIDA: fast reliable interactive data analysis %% +%% wups11a.ps: graphic macros %% +%% (C) Joachim Wuttke 1990-2016 %% +%% http://www.messen-und-deuten.de/frida %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% Sections: +% - Programming, Page Formatting, Coordinate Transforms +% - Colors +% - Fonts and Text Blocks +% - Coordinate Frame +% - Data Plotting (Symbols and Curves) +% - Lists +% - Macro Collection + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Programming, Page Formatting, Coordinate Transforms %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%% Framework: + +% For interleaving applications, isolate what follows in a dictionary +/WuGdict11a 400 dict def +WuGdict11a begin + + +%% Shortcuts: + +/np { newpath } bind def +/mv { moveto } bind def +/rm { rmoveto } bind def +/rl { rlineto } bind def +/li { lineto } bind def +/cp { closepath } bind def +/st { stroke } bind def +/x { exch } bind def + +/black { 0 setgray } bind def +/white { 1 setgray } bind def + +/F false def +/T true def + + +%% Constants: + +/pt { .018567 mul} bind def % for line widths and font sizes, reason unclear +/cm {28.346456 mul} bind def % typographic_point -> cm + +/twopi { 6.2831853072 } def + + +%% Math operators: + +/rnd { rand cvr 1 30 bitshift div 2 div 0 max 1 min } def % -> between 0 and 1 + +/min { 2 copy gt { x } if pop } def +/max { 2 copy lt { x } if pop } def + +/tan { dup sin x cos div } def +/cot { dup cos x sin div } def +/pol2xy{ 2 copy cos mul 3 1 roll sin mul } def % r phi | x y + +/eexp { 2.71828 x exp } def % "exp" is x^y, eexp is e^x +/tanh { 2.71828 x 2 copy exp 3 1 roll neg exp + 2 copy sub 3 1 roll add div } def + + +%% Page layout and global figure size: + +% shift origin +% The PostScript coordinate system starts in the lower left corner +% of the page, whereas we want our figures to be justified in the +% upper left corner. Therefore we need a vertical translation, +% depending on the paper size. A4 is 210x297 mm^2. By this occasion, +% we also provide a border of 7 mm. +/cmtranslate { % x y cmtranslate | - + cm x cm x translate } bind def +/originUpperLeft_A4{ .7 28.3 cmtranslate } bind def +/goffsetA4 { ungscale originUpperLeft_A4 gscale } def +/EdgeLeftDIN{ originUpperLeft_A4 } bind def % OBSOLETE since 11a + +% set absolute global scale and relative symbol size +/defsiz { % size(cm) symbolsize(rel) | - + /ftot x def + /gsiz x cm 10 div def + gscale % within 'size', coordinates run from 0 to 10 + } def +/gscale { + gsiz dup scale +} def +/ungscale { + 1 gsiz div dup scale +} def + +% symbol (and label?) size as sublinear function of figure size +/autolabel { % size(cm) | symbolsize(rel) + dup 7 div 2 add 4 mul % the simplest sublinear increase + x div % anticipate overall rescaling + } def + + +%% Frame size and shape, frame coordinates: + +% aspect ratios +/gyld {0.447214 mul} bind def /Gyld {0.447214 div} bind def % sqrt(5) +/guld {0.547723 mul} bind def /Guld {0.547723 div} bind def % sqrt(3) +/gold {0.618034 mul} bind def /Gold {0.618034 div} bind def % goldener Schnitt +/gild {0.707107 mul} bind def /Gild {0.707107 div} bind def % sqrt(2) : DIN +/geld {0.759836 mul} bind def /Geld {0.759836 div} bind def % sqrt(sqrt(3)) +/gald {0.817765 mul} bind def /Gald {0.817765 div} bind def % sqrt sqrt sqrt 5 + +% define frame coordinates +/defred { % x_reduction y_reduction label_reduction | - + /fmm x ftot mul def + /ymm x def + /xmm x def + + % conversion frame_coordinate -> global_coord + /xm {xmm mul} bind def + /ym {ymm mul} bind def + /fm {fmm mul} bind def + /xym {ym x xm x} bind def + + % prefer rescaling over explicit conversion (make more use of this !) + /mmscale { xmm ymm scale } bind def + /mmunscale { 1 xmm div 1 ymm div scale } bind def + + % graphic commands in frame coordinates + /offset { xym translate } bind def + /currentxy { currentpoint ymm div x xmm div x } bind def + /setline { pt fm setlinewidth [] 0 setdash } bind def + } def + +/stdred { % x_reduction y_reduction | - + 2 copy mul sqrt defred + } def + +%% World (= user application) coordinates: + +% user must declare x and y range +/xSetCoord { % log min max | - + /wxmax x def + /wxmin x def + /wxlog x 0 eq not def + % prepare conversion world coord -> frame coord + /wxdel wxmax wxmin wxlog { div log } { sub } ifelse def + /wxd { % dx(world) | dx(frame) + wxlog { log } if wxdel div 10 mul + } bind def + /wx { % x(world) | x(frame) + wxmin wxlog { div } { sub } ifelse + wxd + } bind def + } def +/ySetCoord { % log min max | - + /wymax x def + /wymin x def + /wylog x 0 eq not def + /wydel wymax wymin wylog { div log } { sub } ifelse def + /wyd { % dy(world) | dy(frame) + wylog { log } if wydel div 10 mul + } bind def + /wy { % y(world) | y(frame) + wymin wylog { div } { sub } ifelse + wyd + } bind def + } def + +% pair conversion +/wxy { % x,y(world) -> x,y(frame) + wy x wx x + } def + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Colors %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%% Color operators: + +/setRGBcolor { + 3 { 255 div 3 1 roll } repeat setrgbcolor + } def + +/colormix { % weight(0..1) col1(R|G|B) col2(R|G|B) | col(R|G|B) + 7 -1 roll dup /weightA x def /weightB x 1 x sub def + 4 -1 roll weightA mul x weightB mul add 5 1 roll + 3 -1 roll weightA mul x weightB mul add 4 1 roll + 2 -1 roll weightA mul x weightB mul add 3 1 roll + } def + +/relcol { % i_col n_col | rel(0..1) : for one-dimensional choices + 1 sub div 0 max 1 min + } def + + +%% Named colors: + +/siemensorange { 255 153 0 setRGBcolor } bind def +/siemensblue { 0 102 153 setRGBcolor } bind def +/siemenstext { 0 51 102 setRGBcolor } bind def +/siemensred { 165 0 33 setRGBcolor } bind def +/siemenspink { 221 102 102 setRGBcolor } bind def +/siemensgrey { 221 221 221 setRGBcolor } bind def +/siemensdark { 102 102 102 setRGBcolor } bind def +/siemensgreen { 33 153 102 setRGBcolor } bind def +/siemensyellow { 255 221 0 setRGBcolor } bind def + +/red { 255 0 0 setRGBcolor } bind def + + +%% One-dimensional linear color choices: + +/iCol1 { % i i_max | - : default -2010, round the circle, RGBR + relcol dup 1 x % rel 1 rel + 360 mul 255 add cos 1 add dup mul neg .053 mul 1 add % modulate saturation + sethsbcolor + } def +/iCol2 { % i i_max | - : cyan - yellow - magenta + relcol 3 mul + dup 1 le { + dup 1 sub neg 0 3 2 roll } { + dup 2 le { + 1 sub dup 1 sub neg 0 3 1 roll } { + 2 sub dup 1 sub neg 0 3 0 roll } ifelse + } ifelse + 0 setcmykcolor + } def +/iCol3 { % i i_max | - : siemens + div /icnow x def + 165 1 icnow sub mul + 102 icnow mul + 33 120 icnow mul add setRGBcolor + } def +/iCol4 { % i i_max | - : red to blue (subsequence of old scheme iCol1) + relcol + 3 x sub 3 div 1 iCol1 + } def + + +%% One-dimensional color choice from given array: + +/iColA { % i i_max arr | - + /aCol x def + relcol + aCol length 1 sub mul % position within array + dup cvi dup 3 1 roll % idx pos idx + sub x % offset idx + 0 max aCol length 1 sub min % offset safe_idx + dup 1 add aCol length 1 sub min % offset i i+1 + aCol x get exec + 4 3 roll aCol x get exec colormix setRGBcolor + } def + + +%% Color arrays for non-linear one-dimensional choices: + +/aCol1 [ % red-blue + { 255 0 0 } % 1 + { 240 10 10 } % 2 + { 220 40 40 } % 3 + { 205 65 90 } % 4 + { 195 80 130 } % 5 + { 180 110 180 } % 6 + { 165 120 185 } % 7 + { 150 130 190 } % 8 + { 130 150 210 } % 9 + { 110 125 220 } % 10 + { 85 105 230 } % 11 + { 70 90 255 } % 12 + { 0 0 255 } % 13 + ] def +/aCol2 [ % orange-red-blue-darkblue + { 255 180 0 } % 1 + { 255 160 0 } % 1 + { 255 120 0 } % 2 + { 255 70 0 } % 3 + { 255 0 0 } % 4 + { 220 30 30 } % 5 + { 220 70 60 } % 6 + { 220 100 110 } % 7 + { 200 130 130 } % 8 + { 200 130 160 } % 9 + { 180 110 180 } % 10 + { 165 110 185 } % 11 + { 150 130 190 } % 12 + { 130 150 210 } % 13 + { 100 120 220 } % 14 + { 85 105 230 } % 15 + { 70 90 255 } % 16 + { 0 0 255 } % 17 + { 0 0 180 } % 18 + { 10 10 150 } % 19 + { 30 30 130 } % 20 + ] def +/aCol3 [ % [fixed size: 9] siemenscolors + { 165 0 33 } % siemensred + { 33 153 102 } % siemensgreen + { 0 102 153 } % siemensblue + { 0 51 102 } % siemenstext + { 255 153 0 } % siemensorange + { 102 102 102 } % siemensdark + { 255 221 0 } % siemensyellow + { 221 221 221 } % siemensgrey + { 221 102 102 } % siemenspink + ] def +/aCol4 [ % green-blue-brown + { 120 160 60 } + { 90 185 40 } + { 50 215 20 } + { 0 245 0 } + { 10 235 112 } + { 20 235 143 } + { 30 230 173 } + { 40 225 194 } + { 50 205 215 } + { 40 153 204 } + { 40 102 153 } + { 40 82 122 } + { 90 74 101 } + { 140 68 80 } + { 170 59 60 } + { 190 50 40 } + { 180 65 40 } + { 160 80 40 } + { 140 100 40 } + { 120 80 30 } + { 100 60 20 } + ] def +/aCol5 [ % [fixed size: 8] gnuplot default (see man gnuplot and rgb.txt) + { 255 0 0 } % red + { 0 255 0 } % green + { 0 0 255 } % blue + { 255 0 255 } % magenta + { 0 255 255 } % cyan + { 160 82 45 } % sienna + { 255 165 0 } % orange + { 255 127 80 } % coral + ] def + + +%% Specialized ifelse, depending on pcol / ccol - OBSOLETE since 11a: + +/ifpcol { % proc1 proc2 | - + pcol 0 eq { pop exec } { exec pop} ifelse % 3 1 roll ifelse + } def +/ifccol { % proc1 proc2 | - + ccol 0 eq { pop exec } { exec pop} ifelse % 3 1 roll ifelse + } def + + +%% old-style colors round the circle - OBSOLETE since 10a: + +% global preset +/pColSet { % col ncol | - + /npcol x def % # different colours + /pcol x def % colours off/on + } def +/cColSet { % col ncol | - + /nccol x def % # different colours + /ccol x def % colours off/on + } def +% default setting +0 3 pColSet % default setting +0 3 cColSet % default setting +% now defined locally in g3.ps +/ipCol { 100 iCol1 } def +/icCol { 100 iCol1 } def + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Fonts and Text Blocks %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%% Prepare standard fonts: + +% extend font encoding +/ReEncode { % OldFont NewFont Encoding | - + /MyEncoding x def + x findfont % select OldFont + dup length dict begin + {def} forall + /Encoding MyEncoding def + currentdict + end + definefont % define as NewFont + } def + +% we assume that image scripts are Latin1 encoded +/Helvetica /MyFont ISOLatin1Encoding ReEncode +/Helvetica-Oblique /MyFont-Oblique ISOLatin1Encoding ReEncode +/Helvetica-Bold /MyFont-Bold ISOLatin1Encoding ReEncode +/Helvetica-BoldOblique /MyFont-BoldOblique ISOLatin1Encoding ReEncode + +/setPalatino { +/Palatino /MyFont ISOLatin1Encoding ReEncode +/Palatino-Italic /MyFont-Oblique ISOLatin1Encoding ReEncode +/Palatino-Bold /MyFont-Bold ISOLatin1Encoding ReEncode +/Palatino-BoldItalic /MyFont-BoldOblique ISOLatin1Encoding ReEncode +} def + +%% Preset standard styles: + +% scale and set font; define fontsize, fontheight +/setfontandsize { % font size | - + dup 0 le { pop 100 } if % fontsize <= 0 not allowed ! + /fontnonnil true def + pt fm dup /fontsize x def + x findfont + x scalefont + setfont + gsave % determine fontheight - from the cookbook : + np 0 0 mv (1) true charpath flattenpath + pathbbox % low_left_x, low_left_y, up_right_x, up_right_y + x pop x pop x pop + /fontheight x def + grestore + } def + +% standard settings for labelling axes +/setnum { /MyFont 24 setfontandsize } def +/setlab { /MyFont 24 setfontandsize } def + +% user commands (free choice of fontsize, but fixed font family) +/setown { /MyFont x setfontandsize } def +/setbol { /MyFont-Bold x setfontandsize } def +/setboq { /MyFont-BoldOblique x setfontandsize } def +/setobl { /MyFont-Oblique x setfontandsize } def + + +%% String treatment: + +/showif { % string | - : increment xwidth or plot string + prepare + { stringwidth pop xwidth add /xwidth x def } + { show } + ifelse + } def +/script { % matrix relpos_y | - + /yoffset x fontheight mul def + currentfont x makefont setfont + 0 yoffset rm + } def +/scred .71 def +/subsc { + showif + [scred 0 0 scred 0 0] -.2 script + } def +/supsc { + showif + [scred 0 0 scred 0 0] .6 script + } def +/endsc { + showif + regularfont setfont + 0 yoffset neg rm + } def +/grec { + showif + /Symbol findfont fontsize scalefont setfont + } def +/endgr { + showif + regularfont setfont + } def +/endall { + showif + regularfont setfont + } def +/build { % string xrel yrel obj | - : plot obj above/below string + /obj x def /yrelbui x def /xrelbui x def + dup showif + prepare + { pop } + { stringwidth pop xrelbui neg mul fontheight yrelbui mul % relpos for obj + currentpoint 4 2 roll % save position after string + rm obj pop % obj must end with () that will be pop'ed + mv % back to saved position + } + ifelse + } def +/gbuild { % string xrel yrel obj | - : plot obj above/below string + /obj x def /yrelbui x def /xrelbui x def + /Symbol findfont fontsize scalefont setfont + dup showif + prepare + { pop regularfont setfont } + { stringwidth pop xrelbui neg mul fontheight yrelbui mul % relpos for obj + currentpoint 4 2 roll % save position after string + regularfont setfont + rm obj pop % obj must end with () that will be pop'ed + mv % back to saved position + } + ifelse + } def +/hut { % ..) (<Char>) hut (.. %%% MISERABEL PROGRAMMIERT + x showif + 1.4 .6 {(\136) show ()} build + } def +/ghut { % ..) (<grec-Char>) ghut (.. %%% BREITE PASST NUR FUER Phi(t) + x showif + .8 .65 {(\136) show ()} gbuild + } def +/tilde { + x showif + 1. .6 {(~) show ()} build + } def +/gtilde { + x showif + 1. .6 {(~) show ()} gbuild + } def +/spce { % string n spce - ; insert n times ( ) + {showif ( )} repeat + } def + +% the following macros use the symbol/curve plotting mechanism +/pins { % string symins - ; symbol must be selected by pset + showif + ( ) showif ( ) .5 .5 { currentxy 0 p black ()} build ( ) showif + } def +/clenins { % string len clenins - ; curve must be selected by cset + x showif % I suppose that pins is preceeded by 8 spaces + dup ( ) stringwidth pop mul 2 add /xstrich x xmm div def + % length of inserted curve : + % -1 space : curve begins and ends in middle of ( ) + % +3 spaces: pins requires 3 times ( ) + ( ) 0 .5 { currentxy currentxy 0 ci x xstrich add x 0 cf () } build + 2 add {( ) showif} repeat + } def +/cins { % string symins - ; curve must be selected by cset + showif 8 % I suppose that pins is preceeded by 8 spaces + dup ( ) stringwidth pop mul 2 add /xstrich x xmm div 10 div def + % nov03, ohne zu verstehen, "10 div" eingefuegt + % length of inserted curve : + % -1 space : curve begins and ends in middle of ( ) + % +3 spaces: pins requires 3 times ( ) + ( ) 0 .5 { currentxy currentxy 0 ci x xstrich add x 0 cf () } build + 2 add {( ) showif} repeat + } def + +/block { % x y ob xrel yrel | - + /yrel x def /xrel x def /blabla x def + /ypos x ym def /xpos x xm def + /regularfont currentfont def /yoffset 0 def % initialize for security + /prepare true def /xwidth 0 def 0 0 mv % to prevent empty-path-error + blabla endall % first pass : determine xwidth + boxif { /boxwidth xwidth (M) stringwidth pop boxxr mul 2 mul add def + /boxheight fontheight 1 boxyr 2 mul add mul def + np xpos xwidth xrel mul sub boxwidth xwidth sub 2 div sub + ypos fontheight .5 boxyr add mul sub mv + boxwidth 0 rl 0 boxheight rl boxwidth neg 0 rl cp + boxproc + } if + xpos xwidth xrel mul sub ypos fontheight yrel mul sub mv + /prepare false def + blabla endall % second pass : plot + /boxif false def + } def +/rblock { % x y ang ob proc rblock - + 5 3 roll + gsave + xym translate + 3 2 roll rotate + 0 0 4 2 roll exec + grestore + } def + +/Box { % x y {exe} + /boxif true def + /boxproc x def /boxyr x def /boxxr x def + } def +/nBox { .6 .6 3 2 roll Box } def +/boxif false def +/textW { % obj | length : calculate only length. + /blabla x def + /regularfont currentfont def /yoffset 0 def % initialize for security + /prepare true def /xwidth 0 def 0 0 mv % to prevent empty-path-error + blabla endall + xwidth % has been determined + } def +/textw { % obj | y : dito, in 0..10-units + textW xmm div + } def + +% horizontal text: x y ob | - +/textLB { 0. 0. block } bind def +/textCB { .5 0. block } bind def +/textRB { 1. 0. block } bind def +/textLM { 0. .5 block } bind def +/textCM { .5 .5 block } bind def +/textRM { 1. .5 block } bind def +/textLT { 0. 1. block } bind def +/textCT { .5 1. block } bind def +/textRT { 1. 1. block } bind def + +% rotated text: x y ang ob | - +/rtextLB { {textLB} rblock } bind def +/rtextLM { {textLM} rblock } bind def +/rtextRB { {textRB} rblock } bind def +/rtextRM { {textRM} rblock } bind def +/rtextCM { {textCM} rblock } bind def + + +%% Language selection: + +% preset +/language { % choose_this of_so_many | - % select current language + /langMax x def + /langChc x def + } def +1 1 language % default +% choose text from sequence +/langSel { % text_1 .. text_M | text_C : choose text, M=langMax, C=langChc + langMax dup langChc sub 1 add roll + langMax 1 sub { pop } repeat + } def + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Coordinate Frame %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%% Layout presets: + +/xyTicLen {0.10 fm} def +/xyTacLen {0.20 fm} def +/txllen {0.20 fm} def +/tyllen {0.20 fm} def +/linsetAxx {black 0.7 setline} def +/linsetTic {black 0.7 setline} def +/linsetTac {black 0.7 setline} def +/linsetGri {black 0.4 setline} def + +%% Start-up commands: + +/Resets { + /yNumLengthL 0 def /yNumLengthH 0 def + /xNumHeightL .3 def /xNumHeightH 0 def + /xNumHeightRel 2.4 def + /aMean 5 def + /xPlotFrame {} def + /yPlotFrame {} def + /zPlotFrame {} def + black + } def +/BoxBackground { + 0 0 10 10 boxit gsave setboxbackgroundcolor fill grestore +} def +/setboxbackgroundcolor { white } def + + +%% Some more presets for g3.ps: + +/iFrame 0 def + +/setnewpage { % xoff yoff + /yoffnewpage x def + /xoffnewpage x def +} def +/newpage { + goffsetA4 + xoffnewpage yoffnewpage offset +} def +/setpagegrid { % ncol nrow xoffnewframe yoffnewframe + /yoffnewframe x def + /xoffnewframe x def + /nrowpage x def + /ncolpage x def +} def +/nextFrame { + /iFrame iFrame 1 add def + iFrame nrowpage ncolpage mul mod 0 eq { + showpage gscale newpage + } { + iFrame ncolpage mod 0 eq { + xoffnewframe ncolpage 1 sub neg mul yoffnewframe offset + } { + xoffnewframe 0 offset + } ifelse + } ifelse +} def + + +/zValues { pop pop } def +/plotafter {} def +/whiteframe { 1 0 0 10 10 graybox } def +/plotframes { xPlotFrame yPlotFrame } def +/plotbefore { plotframes } def + +/abc {abclab setown abcx abcy 3 2 roll textCM} def % usage ((a)) abc +/abcset { % x y siz abcset - : preset for abc + /abclab x def /abcy x def /abcx x def + } def + + +%% Ticks: + +% set tick array - internal macros +/tiputs { % rel_pos_of_tick | pos_of_tick : innermost routine for /taproc + tastep mul taloop add + } def +/taproclin { % (#tick/tack) | - : define /taproc for use in SetVec + 1 x div /tistep x def + /taproc { 0 tistep .999 { tiputs } for } def + } def +/taproclog { % (#ticks/tacks) | - : define /taproc for use in SetVec + dup 3 gt { pop /taproc { 1 1 9 { log tiputs } for } def + }{ dup 1 gt { pop /taproc { 0 tiputs 2 log tiputs 5 log tiputs } def + }{ dup 0 gt { pop /taproc { 0 tiputs } def + }{ neg taproclin + } ifelse } ifelse } ifelse + } def +/SetVec { % tafro tatoo nta /vector | - : set /vector + 4 1 roll + /nta x def /tatoo x def /tafro x def + /tastep tatoo tafro sub nta 1 sub div def + [ + 0 1 nta { + tastep mul tafro add /taloop x def + taproc exec + } for + ] def + } def +% set tick array - user commands +/SetTicVecLin { taproclin /TicVec SetVec } def +/SetTicVecLog { taproclog /TicVec SetVec } def + +% set tack-and-number array +/SetTacVec { % [ pos {label} pos {label} ... ] | - + /TacVec x def + } def + +% define axes + % note on angles : 0 = x-axis, 90 = y-axis +/OneAxx { % fro to xpos ypos aang tang | - : presets for Axx, Tic, Tac, Num + % store arguments + /tAng x def /aAng x def + /yPos x def /xPos x def + /aTo x def /aFro x def + % set constants + /xTicLen tAng cos xyTicLen mul def /yTicLen tAng sin xyTicLen mul def + /xTacLen tAng cos xyTacLen mul def /yTacLen tAng sin xyTacLen mul def + /xAng aAng cos def /yAng aAng sin def + /aMean aFro aTo add 2 div def + /aArr false def + } def +/ArrAxx { % label <args of OneAxx> | - : axis with arrow + OneAxx + /aLab x def + /aArr true def + } def + +% draw axis (with parameters preset by OneAxx or ArrAxx) +/Axx { % - | - + linsetAxx + gsave + xPos yPos offset + mmscale + aAng rotate + % draw a line + aFro 0 np mv + aTo 0 li st + % draw an arrow and a label, if requested + aArr { + gsave + aTo 0 offset + aAng neg rotate + mmunscale + aAng rotate + 0 0 0 .3 pfeilspitze % draw an arrow + .3 0 offset + aAng neg rotate + setlab + aAng 45 le + { 0 -.8 xNumHeightL sub aLab textRT } + { 0 .2 aLab textCB } + ifelse + grestore + } if + grestore + } def + +% draw ticks (positions given by SetTicVec, parameters preset by OneAxx/..) +/Tic { % - | - : draw tick as defined in TicProc + linsetTic + TicVec { + dup dup aFro lt x aTo gt or {pop} {TicProc} ifelse + } forall + } def +/TicProc { % aPos | - : default procedure to plot one tick + np + xPos yPos xym mv + dup xAng mul x yAng mul xym rm % eat argument, go to start pos. + xTicLen yTicLen rl st + } def +/xGric { % yFro yTo | - : draw a grid line (instead of an x tick) + linsetGri + TicVec { + 3 copy dup 5 -1 roll aFro lt x aTo gt or {pop pop pop} { + dup % y1 y2 x x + 4 -1 roll xym np mv % y2 x + x xym li st + } ifelse + } forall + pop pop + } def +/yGric { % xFro xTo | - : draw a grid line (instead of an y tick) + linsetGri + TicVec { + 3 copy dup 5 -1 roll aFro lt x aTo gt or {pop pop pop} { + dup % x1 x2 y y + 4 -1 roll x xym np mv % x2 y + xym li st + } ifelse + } forall + pop pop + } def + +% draw tacks (positions given by SetTacVec, parameters preset by OneAxx/..) +/TacExe { % Proc | - % Execute Proc for all pairs of elements of TacVec + % (but only if inside aFro..aTo) + /TacProc x def + /ispair true def % toggle: take pos, take label, take pos, take label ... + TacVec { + ispair + { + /aPos x def + /ispair false def + } { + aPos dup aFro lt x aTo gt or + {pop} {TacProc} ifelse + /ispair true def + } ifelse + } forall + } def +/Tac { + linsetTac + { pop xPos yPos xym mv + aPos dup xAng mul x yAng mul xym rm + xTacLen yTacLen rl st + } TacExe + } def +% unnecessary optimisation by specialisation: OBSOLETE since 11a +/xTacL { Tac } def +/xTacH { Tac } def +/yTacL { Tac } def +/yTacH { Tac } def +% special tack routines, only for rectangular axes +/xTacC { % : centered tack on x axis + linsetTac + { pop aPos xm yPos ym txllen 2 div sub np mv 0 txllen rl st } TacExe + } def +/xGrid { % : rule instead of tack on x axis + linsetTac + { pop aPos xm np yPos ym mv 0 10 xym rl st } TacExe + } def +/yTacC { % : centered tack on y axis + linsetTac + { pop xPos xm tyllen 2 div sub aPos ym np mv tyllen 0 rl st } TacExe + } def +/yGrid { % : rule instead of tack on low y axis + linsetTac + { pop aPos ym np xPos xm x mv 10 0 xym rl st } TacExe + } def + +% draw numbers (pos-txt pairs given by SetTacVec) +/Num { % Generic but useless. Adjust for your application. + setnum + fontheight ymm div yDisRel mul tAng sin mul /yDist x def + { dup textW xDisRel mul tAng cos mul /xDist x def + xPos aPos xAng mul add xDist sub + yPos aPos yAng mul add yDist sub 3 2 roll textCM } TacExe + } def +/setnumDisRel { % xDisRel yDisRel | - : adjust just a little bit + /yDisRel x def /xDisRel x def + } def +1.2 1.2 setnumDisRel % default setting +% explicit Num routines for rectangular case +/xNumL { % : numbers on low x axis + setnum + { fontheight ymm div % conversion -> user_scale + dup /xNumHeightL x def + -.6 mul yPos add aPos x 3 2 roll textCT } TacExe + } def +/xNumH { % : numbers on high x axis + setnum + { fontheight ymm div % conversion -> user_scale + dup /xNumHeightH x def + .6 mul yPos add aPos x 3 2 roll textCB } TacExe + } def +/yNumL { % : numbers on low y axis + setnum + { fontsize -.3 mul xmm div xPos add aPos 3 2 roll textRM + xwidth dup yNumLengthL gt {/yNumLengthL x def} {pop} ifelse + } TacExe + } def +/yNumLD { % : calculate only yNumLength (used for adjustement) + setnum + { textW dup yNumLengthL gt {/yNumLengthL x def} {pop} ifelse + } TacExe + } def +/yDumL { % {(..)} yDumL : compare yNumLength with one arg (used for adjustement) + setnum + textW dup yNumLengthL gt {/yNumLengthL x def} {pop} ifelse + } def +/yNumH { % : numbers on high y axis + setnum + { fontsize .3 mul xmm div xPos add aPos 3 2 roll textLM + xwidth dup yNumLengthH gt {/yNumLengthH x def} {pop} ifelse + } TacExe + } def +/yNumHD { % : calculate only yNumLength (used for adjustement) + setnum + {textW dup yNumLengthH gt {/yNumLengthH x def} {pop} ifelse + } TacExe + } def +/yDumH { % {(..)} yDumH : compare yNumLength with one arg (used for adjustement) + setnum + textW dup yNumLengthH gt {/yNumLengthH x def} {pop} ifelse + } def + +% draw labels +/xCL { % xlabel | - ; plots coordinate name below the x-axis. + setlab + aMean xNumHeightL xNumHeightRel neg mul + 3 -1 roll textCT + } def +/xCH { % xlabel | - ; plots coordinate name above the x-axis. + setlab + aMean xNumHeightH xNumHeightRel mul 10 add + 3 -1 roll textCB + } def +/yCL { % ylabel | - ; plots coordinate name to the left of the y-axis. + gsave + setlab + yNumLengthL neg fontsize -.85 mul add % yNumLengthL calculated in yN + aMean ym translate + 0 0 mv + 90 rotate + 0 x 0 x textCB + grestore + } def +/yCH { % ylabel | - ; plots coordinate name to the right of the y-axis. + gsave + setlab + yNumLengthH fontsize .85 mul add 10 xm add + aMean ym translate + 0 0 mv + 90 rotate + 0 x 0 x textCT + grestore + } def +/yCF { % ylabel | - ; plots coordinate name *falling* right of the y-axis. + gsave + setlab + yNumLengthH fontsize .85 mul add 10 xm add + aMEan ym translate + 0 0 mv + -90 rotate + 0 x 0 x textCB + grestore + } def + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Data Plotting (Symbols and Curves) %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%% Initializations: + +% asymmetric error bars? +/err_asy false def % overwrite this if data are quadruples x y d- d+ + + +%% Presets: + +% global preset [wups11a: exchanged rad<->lin to conform with pset] +/SymGSet { % sradglo slinglo serrglo | - + /serrglo x def % plot error bars? 0=never, 1=always, 2=as_given_in_pset + /slinglo x def % symbol linewidth multiplier + /sradglo x def % symbol size multiplier + } def + + +%% Retrieve presets from style array: + +/pstyle { pStyles setstyle } def +/cstyle { cStyles setstyle } def +/setstyle { % chosen_number array | - : set p or c as predefined in array. + dup length % i A n + 3 2 roll % A n i + dup 0 le { + pop pop pop ostyle % chosen_number<=0 means: don't plot + } { + 1 sub x % A i-1 n + mod get % A(i-1) + exec + } ifelse + } def + + +%% Set plot symbol: + +/pset { % styp sfill serr srad slin | - + % arg -> symbol linewidth + /slin x slinglo mul def + % arg -> symbol size + /srad x fm 0.16 mul sradglo mul def + % arg -> plot error bar? + 2 serrglo ne { pop serrglo } if % if (serrglo=2) use serr else use serrglo + /plot_errorbar x 1 eq { { errorbar } } { { pop pop pop pop } } ifelse def + % arg -> fill the symbol? (0=open, 1=full, 2=colored_with_black_border) + /sfill x def + % adjust srad: it's the _outer_ radius + % TROUBLE sfill 1 ne {/srad srad slin fm pt sub def} if + % arg -> symbol type + /ps {ps_nil} def % default: don't plot (maybe we only want an error bar) + dup 1 eq {/ps {ps_square} def} if + dup 2 eq {/ps {ps_diamond} def} if + dup 3 eq {/ps {ps_circle} def} if + dup 4 eq {/ps {ps_triangle} def} if + dup 5 eq {/ps {ps_cedez} def} if + dup 6 eq {/ps {ps_eieruhr} def} if + dup 7 eq {/ps {ps_valve} def} if + dup 8 eq {/ps {ps_tfwd} def} if + dup 9 eq {/ps {ps_tbwd} def} if + dup 10 eq {/ps {ps_pentagram} def} if + dup 11 eq {/ps {ps_plus} def} if + dup 12 eq {/ps {ps_cross} def} if + dup 13 eq {/ps {ps_star} def} if + dup 14 eq {/ps {ps_pentagon} def} if + dup 15 eq {/ps {ps_horiz} def} if + dup 16 eq {/ps {ps_verti} def} if + pop + % + /t { % x y d[- d+] | - : plot a symbol and eventually an error bar. + err_asy not { dup } if + 4 copy pop pop plot_symbol + plot_errorbar + } bind def + /ti { t } bind def + /tf { t black } bind def + } def + + +%% Set curve: + +/lset { % lwidth dashes | - + 0 setdash + dup 0 gt { + pt fm setlinewidth + % pop error bar and convert frame coord -> paper coord + /txy { err_asy { pop } if pop xym } def % x y d[- d+] | x' y' + % commands to plot points (can be overwritten by nopoints): + /ti { np txy mv } def % x y d[- d+] | - : start curve + /t { txy li } def % x y d[- d+] | - : continue curve + /tf { txy li st } def % x y d[- d+] | - : terminate and plot curve + } { + ostyle + } ifelse + } def + + +%% Plot nothing: + +/ostyle { % - | - + /ti { nopoint } def + /t { nopoint } def + /tf { nopoint } def +} def +/nopoint { % x y d[- d+] | - + pop pop pop err_asy { pop } if +} def + + +%% Plot an asymmetric vertical error bar: + +/errorbar { % x y d- d+ | - + gsave + slin setline + 3 copy pop pop + dup 0 gt x 10 lt and { + 4 copy + x pop add 10. 2 copy gt { x } if pop ym x xm x + 2 copy x .05 sub x np mv .1 0 rl st + np mv + pop sub 0. 2 copy lt { x } if pop ym x xm x + 2 copy lineto st + x .05 sub x np mv .1 0 rl st + } { + pop pop pop pop + } ifelse + grestore +} def + + +%% Plot a data symbol: + +/plot_symbol { % x y | - + gsave + offset + srad dup scale + slin srad div setline % factor 1/srad compensates "scale" + ps % the actual plot symbol, defined by 'pset' + grestore + } def + +/fill_symbol { + sfill dup + 0 eq { + pop st + } { + 1 eq { + fill + } { + gsave fill grestore + gsave black st grestore + } ifelse + } ifelse + } def + + +%% The different symbols, designed for unit area (no arguments): + +/ps_nil { + } bind def + +/ps_square { + .5 .5 np mv + 0 -1 rl + -1 0 rl + 0 1 rl cp fill_symbol + } bind def + +/ps_diamond { + gsave 45 rotate ps_square grestore + } bind def + +/ps_circle { + 0 0 np .564 0 360 arc cp fill_symbol + } bind def + +/ps_triangle { + .77 dup dup 90 pol2xy np mv + 210 pol2xy li + 330 pol2xy li cp fill_symbol + } bind def + +/ps_cedez { + gsave 180 rotate ps_triangle grestore + } bind def + +/ps_tfwd { + gsave 30 rotate ps_triangle grestore + } bind def + +/ps_tbwd { + gsave 210 rotate ps_triangle grestore + } bind def + +/ps_eieruhr { + -.7 -.7 np mv + .7 -.7 li + -.7 .7 li + .7 .7 li cp fill_symbol + } bind def + +/ps_valve { + gsave 90 rotate ps_eieruhr grestore + } bind def + +/ps_pentagram { + .8 dup dup dup dup + 90 pol2xy np mv + 234 pol2xy li + 18 pol2xy li + 162 pol2xy li + 306 pol2xy li cp fill_symbol + } bind def + +/ps_pentagon { + .8 dup dup dup dup + 18 pol2xy np mv + 90 pol2xy li + 162 pol2xy li + 234 pol2xy li + 306 pol2xy li cp fill_symbol + } bind def + +/ps_plus { + gsave 45 rotate ps_cross grestore + } bind def + +/ps_cross { + .5 .5 np mv + -1 -1 rl st + -.5 .5 np mv + 1 -1 rl st + } bind def + +/ps_star { + .7 dup 0 pol2xy np mv 180 pol2xy li st + .7 dup 120 pol2xy np mv 300 pol2xy li st + .7 dup 240 pol2xy np mv 60 pol2xy li st + } bind def + +/ps_horiz { + -.7 0 np mv + 1.4 0 rl st + } bind def + +/ps_verti { + 0 -.7 np mv + 0 1.4 rl st + } bind def + + +%% Set column plotting (use this instead of pset) - BROKEN in 11a or earlier + +/setcolumn{ % shift width exec | % + % usage: 0 .2 { gsave { .5 setgray fill } grestore cp } setcolumn + /colexec x def % what's this ? + /colwidth x def + /colshift x def + /t { % broken - may need rewrite + np x colshift add x xym 2 copy mv pop + colwidth xm 0 rl + colwidth xm add 0 wy ym li + colwidth neg xm 0 rl + cp colexec + } def + /ti { t } bind def + /tf { t black } bind def +} def + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% List %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +/NewList { % xins yins size advance NewList - + /nl_advance x def setown /nl_yins x def /nl_xins x def + /nl_xshift fontsize xmm div .9 mul def + /nl_xrline 0.33 def + /nl_ystep fontheight ymm div nl_advance mul def + /newline { + /nl_yins nl_yins nl_ystep sub def + } def + /fracline { % frac | - + fontheight ymm div nl_advance mul mul /nl_yins x nl_yins x sub def + } def + } def +/newlist { 1.65 NewList } def +/TxLine { % text TxLine - + nl_xins nl_yins 3 -1 roll textLM newline + } bind def +/TxCLine { % text TxLine - + nl_xins nl_yins 3 -1 roll textCM newline + } bind def +/infline{ % Obsolete since Frida2.1.5 + oooinfo 1 eq { TxLine } { pop } ifelse + } bind def +/PtTxLine { % pstyle text | - + x pstyle + nl_xins nl_xshift .5 mul add nl_yins 0 t + black nl_xins nl_xshift 1.5 mul add nl_yins 3 2 roll textLM + newline + } bind def +/PttttTxLine { % pstyle text | - %% chain of very small symbols + x pstyle + nl_xins nl_xshift .10 mul add nl_yins 0 t + nl_xins nl_xshift .26 mul add nl_yins 0 t + nl_xins nl_xshift .42 mul add nl_yins 0 t + nl_xins nl_xshift .58 mul add nl_yins 0 t + nl_xins nl_xshift .74 mul add nl_yins 0 t + nl_xins nl_xshift .90 mul add nl_yins 0 t + black nl_xins nl_xshift 1.5 mul add nl_yins 3 2 roll textLM + newline + } bind def +/PtPtCvTxLine { % pstyle pstyle cstyle text | - + 4 3 roll pstyle nl_xins nl_yins 0 t + 3 2 roll pstyle nl_xins nl_xshift add nl_yins 0 t + x cstyle + nl_xins nl_xshift 2 mul add + dup dup nl_xshift nl_xrline mul sub nl_yins 0 ti + nl_xshift nl_xrline mul add nl_yins 0 tf + nl_xshift add nl_yins 3 2 roll black textLM + newline + } bind def +/PtCvTxLine { % pstyle cstyle text | - + 3 2 roll pstyle nl_xins nl_yins 0 t + x cstyle + nl_xins nl_xshift 1 mul add + dup dup nl_xshift -.33 mul add nl_yins 0 ti + nl_xshift 0.33 mul add nl_yins 0 tf + nl_xshift add nl_yins 3 2 roll black textLM + newline + } bind def +/PtPtTxLine { % pstyle pstyle text | - + 3 2 roll pstyle nl_xins nl_yins 0 t + x pstyle nl_xins nl_xshift add nl_yins 0 t + black nl_xins nl_xshift 2 mul add nl_yins 3 2 roll textLM + newline + } bind def +/CvTxLine { % cstyle text | - + x cstyle + nl_xins fontsize xmm div nl_xrline mul 0 mul sub nl_yins 0 ti + nl_xins fontsize xmm div nl_xrline mul 3 mul add nl_yins 0 tf + black nl_xins nl_xshift 1.5 mul add nl_yins 3 2 roll textLM + newline + } bind def +/Cv2TxLine { % cstyle text | - + x cstyle + nl_xins fontsize xmm div nl_xrline mul sub nl_yins 0 ti + nl_xins fontsize xmm div nl_xrline mul add nl_xshift add nl_yins 0 tf + black nl_xins nl_xshift 2 mul add nl_yins 3 2 roll textLM + newline + } bind def +/PCTxLine { % pstyle(with plset) text | - + x pstyle + nl_xins fontsize xmm div nl_xrline 2 mul mul sub nl_yins 0 ci + nl_xins fontsize xmm div nl_xrline 2 mul mul add nl_yins 0 cf + nl_xins yins 0 t + black nl_xins + fontsize xmm div 1.9 mul % instead of xshift + add nl_yins 3 2 roll textLM + newline + } bind def +/showfilename { % xins yins size | - + setown + ooofnam 1 eq { filename textRB } { pop pop } ifelse + } def +/InfSet { % ooofnam oooinfo | - : set on(1) or off(0) + /oooinfo x def /ooofnam x def + } def +0 0 InfSet % default setting + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Macro Collection %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%% gray areas (mainly applied with grayval=1 for blank areas) [longtime grey..] + +/execOval3 { % xl xh yl yh dr { proc } | - + gsave + 6 1 roll + fm /qqdr x def + ym /qqyh x def + ym /qqyl x def + xm /qqxh x def + xm /qqxl x def + qqxl qqyl qqdr add np mv + qqxl qqyh qqdr sub li + qqxl qqdr add qqyh qqdr sub qqdr 180 90 arcn + qqxh qqdr sub qqyh li + qqxh qqdr sub qqyh qqdr sub qqdr 90 0 arcn + qqxh qqyl qqdr add li + qqxh qqdr sub qqyl qqdr add qqdr 0 -90 arcn + qqxl qqdr add qqyl li + qqxl qqdr add qqyl qqdr add qqdr -90 -180 arcn + cp exec grestore + } def +/execRect3 { % xl xh yl yh {proc} | - + 5 1 roll + gsave + ym /qqyh x def + ym /qqyl x def + xm /qqxh x def + xm /qqxl x def + np + qqxl qqyl mv + qqxh qqyl li + qqxh qqyh li + qqxl qqyh li + cp exec grestore + } def +/execRectangle { % OBSOLETE + 5 1 roll + gsave + wy /qqyh x def + wy /qqyl x def + wx /qqxh x def + wx /qqxl x def + np + qqxl xm qqyl ym mv + qqxh xm qqyl ym li + qqxh xm qqyh ym li + qqxl xm qqyh ym li + cp exec grestore + } def +/execHexagon { % xl xh yl yh (all in user coords) {proc} | - + 5 1 roll + gsave + wy /qqyh x def + wy /qqyl x def + wx /qqxh x def + wx /qqxl x def + /qqdr qqyh qqyl sub 2 div def + np + qqxl qqdr add qqyl xym mv + qqxh qqdr sub qqyl xym li + qqxh qqyl qqdr add xym li + qqxh qqdr sub qqyh xym li + qqxl qqdr add qqyh xym li + qqxl qqyl qqdr add xym li + cp exec grestore + } def +/coordRectangle { % xl xh yl yh (all in plot coords) {proc} | - + 5 1 roll + gsave + /qqyh x def + /qqyl x def + /qqxh x def + /qqxl x def + np + qqxl xm qqyl ym mv + qqxh xm qqyl ym li + qqxh xm qqyh ym li + qqxl xm qqyh ym li + cp exec grestore + } def + + +%% special objects + +/pfeilangle 36.87 def +/pfeilspitze { % x[local] y[local] rot siz + % draw with current linestyle, as set e.g. by linsetAxx + x 4 2 roll % siz rot x y + gsave + xym translate 180 add rotate dup dup dup + [] 0 setdash + pfeilangle cos mul x pfeilangle sin mul np mv + 0 0 li pfeilangle cos mul x pfeilangle sin neg mul li st + grestore + } def +/pfeiL { % (arrow anchored at base) x y rot siz len + gsave + dup xm x ym mul sqrt % (scale len) + 5 3 roll + xym translate % (origin at base) rot siz len + 3 2 roll + rotate % (draw rightwards) siz len + dup 0 translate % (origin at head) siz len + x 0 0 0 4 3 roll pfeilspitze % len + 0 0 np mv neg 0 li st + grestore + } def +/Pfeil { % (arrow anchored at head) x y rot siz len + dup xm x ym mul sqrt 5 copy + pop pfeilspitze + x pop + x 4 2 roll % len rot x y + gsave + xym translate 180 add rotate + 0 0 np mv 0 li st + grestore + } def +/pfeil { % (OBSOLETE) x[local] y[local] rot siz len[global] + fm 5 copy % not working well + pop pfeilspitze + x pop + x 4 2 roll % len rot x y + gsave + xym translate 180 add rotate + 0 0 np mv 0 li st + grestore + } def +/pfeil_arcn { % x_cent y_cent radius ang_from ang_to siz + gsave + 6 -2 roll offset + 4 copy pop 0 0 5 2 roll + np arcn st + % radius ang_from ang_to siz + 4 1 roll + gsave + rotate + pop + % siz radius + 0 -90 4 3 roll + pfeilspitze + grestore + grestore +} def + +/knautschy { % x0 y0 y_knau y_tot knautschy - : insert an S in dived y-axis + % the total height of the generated object is y_tot + % of which y_knau(.le. y_tot) is for the real knautsch, + % the remainder is for vertical prolongations. + x ym 4 div dup /tmpy x def 5 sqrt mul /tmpx x def + /tmpa x ym tmpy 4 mul sub 2 div def + np ym x xm x mv 0 tmpa rl tmpx tmpy rl tmpx -2 mul tmpy 2 mul rl + tmpx tmpy rl 0 tmpa rl st + } def +/separy { % x0 y0 sep lng ang lin - : insert an // in dived y-axis + setline + /spang x def + /splng x def + /spsep x def + 2 copy spsep sub gsave offset spang rotate + splng -.5 mul fm 0 np mv splng fm 0 rl st grestore + spsep add gsave offset spang rotate + splng -.5 mul fm 0 np mv splng fm 0 rl st grestore + } def + +/bemasz { % x y L ang text | - %% precede by '24 setown 1 [] lset /pfeilangle 90 def' + gsave + 5 3 roll offset % consumes x and y + x rotate % consumes ang | L text + dup textw .5 mul fontheight .4 mul add /bmszDT x def % => half text width + 0 0 3 2 roll textCM % L + .5 mul /bmszDX x def % => half bemasz length + bmszDX 0 0 fontheight .67 mul bmszDX bmszDT sub Pfeil + bmszDX neg 0 180 fontheight .67 mul bmszDX bmszDT sub Pfeil + grestore + } def + + +%% Text composition shortcuts: + +/g { x grec endgr} bind def +/sb { x subsc endsc} bind def +/sp { x supsc endsc} bind def +/sbgr { x grec () subsc endsc () endgr} bind def +/spgr { x grec () supsc endsc () endgr} bind def + + +%% Text macros for neutron scattering: + +/hbar { + showif + (h) 1.2 .66 { + currentpoint fontheight .11 mul setline np mv + fontheight dup .8 mul x .3 mul rl + st () + } build + } bind def +/hbarw { hbar () grec (w) endgr } bind def +/wbar { grec (w) endgr ( / 2) grec (p) endgr } bind def +/taumean { () (\341t\361) g } bind def +/Sqw { showif (S\(q,) grec (w) endgr (\)) showif } bind def +/Sqn { showif (S\(q,) grec (n) endgr (\)) showif } bind def +/SQw { showif (S\(Q,) grec (w) endgr (\)) showif } bind def +/Sttw { showif (S\(2) grec (q) endgr (,) grec (w) endgr (\)) showif } bind def +/Sttn { showif (S\(2) grec (q) endgr (,) grec (n) endgr (\)) showif } bind def +/Xqw { grec (c) endgr (''\(q,) grec (w) endgr (\)) showif } bind def +/Xqn { grec (c) endgr (''\(q,) grec (n) endgr (\)) showif } bind def +/ueV{ grec (m) endgr (eV) showif} bind def +/inueV { showif (\() grec (m) endgr (eV\)) showif } bind def +/inmeVr { showif (\(meV) supsc (-1) endsc (\)) showif } bind def +/inueVr { showif (\() grec (m) endgr (eV) + supsc (-1) endsc (\)) showif } bind def +/inGHzr { showif (\(GHz) (-1) sp (\)) showif } def + +%% home-made Angstr is obsolete; use \305 (more reliable than Ã…) +/Angstr { + showif + (A) .5 1.23 { + currentpoint fontheight .1 mul setline np + fontheight .14 mul 0 360 arc st () + } build +} bind def +/Angr { showif (\305) supsc (-1) endsc } bind def +/inAngr { showif (\() Angr (\)) showif } bind def +/Angrr { showif (\305) supsc (-2) endsc } bind def +/inAngrr { showif (\() Angrr (\)) showif } bind def +/wmin {grec (w) endgr () subsc (min) endsc} def +/winpi { grec (w) endgr ( / 2) grec (p) endgr } def +/Celsius { showif (\26x)g(C) showif } bind def + + +%% More shortcuts for impatient users: + +/L { langSel } bind def +/G { gsave exec grestore } bind def +/gs { gsave } bind def +/gr { grestore } bind def + +end % WuGdict... + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Mark "ewu", the end of the wups.. macro definition file %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +WuGdict11a begin + +10 dup autolabel defsiz +1 dup stdred +2 -13 setnewpage newpage + +/darkgreen { 13 133 13 setRGBcolor } def +/litegreen {202 253 222 setRGBcolor } def +/darkblue { 13 13 133 setRGBcolor } def +/liteblue {202 202 255 setRGBcolor } def + +/boxcenter{ qqxl qqxh add 2 div qqyl qqyh add 2 div } def + +/greenbox{ + 5 1 roll + { { litegreen fill } G darkgreen 2 [] lset st } execRect3 + black boxcenter 3 2 roll textCM +} def + +/grisbox{ + 5 1 roll + { { .8 setgray fill } G .2 setgray 2 [] lset st } execRect3 + black boxcenter 3 2 roll textCM +} def + +/blueoval{ + 6 1 roll + { { liteblue fill } G darkblue 2 [] lset st } execOval3 + black boxcenter 3 2 roll textCM +} def +/greenoval{ + 6 1 roll + { { litegreen fill } G darkgreen 2 [] lset st } execOval3 + black boxcenter 3 2 roll textCM +} def + +21 setown + +1 [] lset black +/upline { 270 .5 2 Pfeil } def % (arrow anchored at base) x y rot siz len + 2.5 7 upline + 9 7 upline +15.5 7 upline + +0 18 5 7 {(libBornAgainCore)} greenbox + +gsave +0 4 1 3 {(libBornAgainFit)} greenbox + 2 3 upline +4.5 0 offset +0 3.8 1 3 {(libgsl)} grisbox + 1.9 3 upline +4.3 0 offset +0 3.8 1 3 {(libfftw3)} grisbox + 1.9 3 upline +4.3 0 offset +gsave +0 1 offset +1. .4 offset +3 { + 0 3.8 0 2 {(other libs)} grisbox + -.5 -.2 offset +} repeat +grestore + 2.4 3.4 270 .5 1.6 Pfeil +grestore + +0 5 9 11 .4 {(BornAgain GUI)} greenoval +21 setobl 6.5 11.5 9 11 .4 {(Python apps)} blueoval +21 setobl 8.5 11.5 8.5 9.5 .3 {(Examples)} greenoval +21 setown 13 18 9 11 .4 {(C++ apps)} blueoval +15 18 8.5 9.5 .3 {(Examples)} greenoval + +darkblue +3 [] lset +{ 5.75 10.1 offset + 0 0 np 1.5 225 315 arc st + 315 rotate 1.5 0 90 .4 0 Pfeil % (arrow anchored at head) x y rot siz lenoffset } G + } G +5.75 8.2 {(export)} textCM + +showpage +end % WuGdict... diff --git a/Doc/UserManual/fig/drawing/architecturePy.ps b/Doc/UserManual/fig/drawing/architecturePy.ps new file mode 100644 index 0000000000000000000000000000000000000000..97a3cc22e6cbc1f4d65cdfee5076362bfc6228a2 --- /dev/null +++ b/Doc/UserManual/fig/drawing/architecturePy.ps @@ -0,0 +1,1711 @@ +%!PS-Adobe-1.0 EPSF-1.0 +%%BoundingBox: 19 214 567 804 +%%Comment: Bounding box extracted by bboxx +%%+: A program by Dov Grobgeld 2003 + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% FRIDA: fast reliable interactive data analysis %% +%% wups11a.ps: graphic macros %% +%% (C) Joachim Wuttke 1990-2016 %% +%% http://www.messen-und-deuten.de/frida %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% Sections: +% - Programming, Page Formatting, Coordinate Transforms +% - Colors +% - Fonts and Text Blocks +% - Coordinate Frame +% - Data Plotting (Symbols and Curves) +% - Lists +% - Macro Collection + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Programming, Page Formatting, Coordinate Transforms %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%% Framework: + +% For interleaving applications, isolate what follows in a dictionary +/WuGdict11a 400 dict def +WuGdict11a begin + + +%% Shortcuts: + +/np { newpath } bind def +/mv { moveto } bind def +/rm { rmoveto } bind def +/rl { rlineto } bind def +/li { lineto } bind def +/cp { closepath } bind def +/st { stroke } bind def +/x { exch } bind def + +/black { 0 setgray } bind def +/white { 1 setgray } bind def + +/F false def +/T true def + + +%% Constants: + +/pt { .018567 mul} bind def % for line widths and font sizes, reason unclear +/cm {28.346456 mul} bind def % typographic_point -> cm + +/twopi { 6.2831853072 } def + + +%% Math operators: + +/rnd { rand cvr 1 30 bitshift div 2 div 0 max 1 min } def % -> between 0 and 1 + +/min { 2 copy gt { x } if pop } def +/max { 2 copy lt { x } if pop } def + +/tan { dup sin x cos div } def +/cot { dup cos x sin div } def +/pol2xy{ 2 copy cos mul 3 1 roll sin mul } def % r phi | x y + +/eexp { 2.71828 x exp } def % "exp" is x^y, eexp is e^x +/tanh { 2.71828 x 2 copy exp 3 1 roll neg exp + 2 copy sub 3 1 roll add div } def + + +%% Page layout and global figure size: + +% shift origin +% The PostScript coordinate system starts in the lower left corner +% of the page, whereas we want our figures to be justified in the +% upper left corner. Therefore we need a vertical translation, +% depending on the paper size. A4 is 210x297 mm^2. By this occasion, +% we also provide a border of 7 mm. +/cmtranslate { % x y cmtranslate | - + cm x cm x translate } bind def +/originUpperLeft_A4{ .7 28.3 cmtranslate } bind def +/goffsetA4 { ungscale originUpperLeft_A4 gscale } def +/EdgeLeftDIN{ originUpperLeft_A4 } bind def % OBSOLETE since 11a + +% set absolute global scale and relative symbol size +/defsiz { % size(cm) symbolsize(rel) | - + /ftot x def + /gsiz x cm 10 div def + gscale % within 'size', coordinates run from 0 to 10 + } def +/gscale { + gsiz dup scale +} def +/ungscale { + 1 gsiz div dup scale +} def + +% symbol (and label?) size as sublinear function of figure size +/autolabel { % size(cm) | symbolsize(rel) + dup 7 div 2 add 4 mul % the simplest sublinear increase + x div % anticipate overall rescaling + } def + + +%% Frame size and shape, frame coordinates: + +% aspect ratios +/gyld {0.447214 mul} bind def /Gyld {0.447214 div} bind def % sqrt(5) +/guld {0.547723 mul} bind def /Guld {0.547723 div} bind def % sqrt(3) +/gold {0.618034 mul} bind def /Gold {0.618034 div} bind def % goldener Schnitt +/gild {0.707107 mul} bind def /Gild {0.707107 div} bind def % sqrt(2) : DIN +/geld {0.759836 mul} bind def /Geld {0.759836 div} bind def % sqrt(sqrt(3)) +/gald {0.817765 mul} bind def /Gald {0.817765 div} bind def % sqrt sqrt sqrt 5 + +% define frame coordinates +/defred { % x_reduction y_reduction label_reduction | - + /fmm x ftot mul def + /ymm x def + /xmm x def + + % conversion frame_coordinate -> global_coord + /xm {xmm mul} bind def + /ym {ymm mul} bind def + /fm {fmm mul} bind def + /xym {ym x xm x} bind def + + % prefer rescaling over explicit conversion (make more use of this !) + /mmscale { xmm ymm scale } bind def + /mmunscale { 1 xmm div 1 ymm div scale } bind def + + % graphic commands in frame coordinates + /offset { xym translate } bind def + /currentxy { currentpoint ymm div x xmm div x } bind def + /setline { pt fm setlinewidth [] 0 setdash } bind def + } def + +/stdred { % x_reduction y_reduction | - + 2 copy mul sqrt defred + } def + +%% World (= user application) coordinates: + +% user must declare x and y range +/xSetCoord { % log min max | - + /wxmax x def + /wxmin x def + /wxlog x 0 eq not def + % prepare conversion world coord -> frame coord + /wxdel wxmax wxmin wxlog { div log } { sub } ifelse def + /wxd { % dx(world) | dx(frame) + wxlog { log } if wxdel div 10 mul + } bind def + /wx { % x(world) | x(frame) + wxmin wxlog { div } { sub } ifelse + wxd + } bind def + } def +/ySetCoord { % log min max | - + /wymax x def + /wymin x def + /wylog x 0 eq not def + /wydel wymax wymin wylog { div log } { sub } ifelse def + /wyd { % dy(world) | dy(frame) + wylog { log } if wydel div 10 mul + } bind def + /wy { % y(world) | y(frame) + wymin wylog { div } { sub } ifelse + wyd + } bind def + } def + +% pair conversion +/wxy { % x,y(world) -> x,y(frame) + wy x wx x + } def + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Colors %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%% Color operators: + +/setRGBcolor { + 3 { 255 div 3 1 roll } repeat setrgbcolor + } def + +/colormix { % weight(0..1) col1(R|G|B) col2(R|G|B) | col(R|G|B) + 7 -1 roll dup /weightA x def /weightB x 1 x sub def + 4 -1 roll weightA mul x weightB mul add 5 1 roll + 3 -1 roll weightA mul x weightB mul add 4 1 roll + 2 -1 roll weightA mul x weightB mul add 3 1 roll + } def + +/relcol { % i_col n_col | rel(0..1) : for one-dimensional choices + 1 sub div 0 max 1 min + } def + + +%% Named colors: + +/siemensorange { 255 153 0 setRGBcolor } bind def +/siemensblue { 0 102 153 setRGBcolor } bind def +/siemenstext { 0 51 102 setRGBcolor } bind def +/siemensred { 165 0 33 setRGBcolor } bind def +/siemenspink { 221 102 102 setRGBcolor } bind def +/siemensgrey { 221 221 221 setRGBcolor } bind def +/siemensdark { 102 102 102 setRGBcolor } bind def +/siemensgreen { 33 153 102 setRGBcolor } bind def +/siemensyellow { 255 221 0 setRGBcolor } bind def + +/red { 255 0 0 setRGBcolor } bind def + + +%% One-dimensional linear color choices: + +/iCol1 { % i i_max | - : default -2010, round the circle, RGBR + relcol dup 1 x % rel 1 rel + 360 mul 255 add cos 1 add dup mul neg .053 mul 1 add % modulate saturation + sethsbcolor + } def +/iCol2 { % i i_max | - : cyan - yellow - magenta + relcol 3 mul + dup 1 le { + dup 1 sub neg 0 3 2 roll } { + dup 2 le { + 1 sub dup 1 sub neg 0 3 1 roll } { + 2 sub dup 1 sub neg 0 3 0 roll } ifelse + } ifelse + 0 setcmykcolor + } def +/iCol3 { % i i_max | - : siemens + div /icnow x def + 165 1 icnow sub mul + 102 icnow mul + 33 120 icnow mul add setRGBcolor + } def +/iCol4 { % i i_max | - : red to blue (subsequence of old scheme iCol1) + relcol + 3 x sub 3 div 1 iCol1 + } def + + +%% One-dimensional color choice from given array: + +/iColA { % i i_max arr | - + /aCol x def + relcol + aCol length 1 sub mul % position within array + dup cvi dup 3 1 roll % idx pos idx + sub x % offset idx + 0 max aCol length 1 sub min % offset safe_idx + dup 1 add aCol length 1 sub min % offset i i+1 + aCol x get exec + 4 3 roll aCol x get exec colormix setRGBcolor + } def + + +%% Color arrays for non-linear one-dimensional choices: + +/aCol1 [ % red-blue + { 255 0 0 } % 1 + { 240 10 10 } % 2 + { 220 40 40 } % 3 + { 205 65 90 } % 4 + { 195 80 130 } % 5 + { 180 110 180 } % 6 + { 165 120 185 } % 7 + { 150 130 190 } % 8 + { 130 150 210 } % 9 + { 110 125 220 } % 10 + { 85 105 230 } % 11 + { 70 90 255 } % 12 + { 0 0 255 } % 13 + ] def +/aCol2 [ % orange-red-blue-darkblue + { 255 180 0 } % 1 + { 255 160 0 } % 1 + { 255 120 0 } % 2 + { 255 70 0 } % 3 + { 255 0 0 } % 4 + { 220 30 30 } % 5 + { 220 70 60 } % 6 + { 220 100 110 } % 7 + { 200 130 130 } % 8 + { 200 130 160 } % 9 + { 180 110 180 } % 10 + { 165 110 185 } % 11 + { 150 130 190 } % 12 + { 130 150 210 } % 13 + { 100 120 220 } % 14 + { 85 105 230 } % 15 + { 70 90 255 } % 16 + { 0 0 255 } % 17 + { 0 0 180 } % 18 + { 10 10 150 } % 19 + { 30 30 130 } % 20 + ] def +/aCol3 [ % [fixed size: 9] siemenscolors + { 165 0 33 } % siemensred + { 33 153 102 } % siemensgreen + { 0 102 153 } % siemensblue + { 0 51 102 } % siemenstext + { 255 153 0 } % siemensorange + { 102 102 102 } % siemensdark + { 255 221 0 } % siemensyellow + { 221 221 221 } % siemensgrey + { 221 102 102 } % siemenspink + ] def +/aCol4 [ % green-blue-brown + { 120 160 60 } + { 90 185 40 } + { 50 215 20 } + { 0 245 0 } + { 10 235 112 } + { 20 235 143 } + { 30 230 173 } + { 40 225 194 } + { 50 205 215 } + { 40 153 204 } + { 40 102 153 } + { 40 82 122 } + { 90 74 101 } + { 140 68 80 } + { 170 59 60 } + { 190 50 40 } + { 180 65 40 } + { 160 80 40 } + { 140 100 40 } + { 120 80 30 } + { 100 60 20 } + ] def +/aCol5 [ % [fixed size: 8] gnuplot default (see man gnuplot and rgb.txt) + { 255 0 0 } % red + { 0 255 0 } % green + { 0 0 255 } % blue + { 255 0 255 } % magenta + { 0 255 255 } % cyan + { 160 82 45 } % sienna + { 255 165 0 } % orange + { 255 127 80 } % coral + ] def + + +%% Specialized ifelse, depending on pcol / ccol - OBSOLETE since 11a: + +/ifpcol { % proc1 proc2 | - + pcol 0 eq { pop exec } { exec pop} ifelse % 3 1 roll ifelse + } def +/ifccol { % proc1 proc2 | - + ccol 0 eq { pop exec } { exec pop} ifelse % 3 1 roll ifelse + } def + + +%% old-style colors round the circle - OBSOLETE since 10a: + +% global preset +/pColSet { % col ncol | - + /npcol x def % # different colours + /pcol x def % colours off/on + } def +/cColSet { % col ncol | - + /nccol x def % # different colours + /ccol x def % colours off/on + } def +% default setting +0 3 pColSet % default setting +0 3 cColSet % default setting +% now defined locally in g3.ps +/ipCol { 100 iCol1 } def +/icCol { 100 iCol1 } def + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Fonts and Text Blocks %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%% Prepare standard fonts: + +% extend font encoding +/ReEncode { % OldFont NewFont Encoding | - + /MyEncoding x def + x findfont % select OldFont + dup length dict begin + {def} forall + /Encoding MyEncoding def + currentdict + end + definefont % define as NewFont + } def + +% we assume that image scripts are Latin1 encoded +/Helvetica /MyFont ISOLatin1Encoding ReEncode +/Helvetica-Oblique /MyFont-Oblique ISOLatin1Encoding ReEncode +/Helvetica-Bold /MyFont-Bold ISOLatin1Encoding ReEncode +/Helvetica-BoldOblique /MyFont-BoldOblique ISOLatin1Encoding ReEncode + +/setPalatino { +/Palatino /MyFont ISOLatin1Encoding ReEncode +/Palatino-Italic /MyFont-Oblique ISOLatin1Encoding ReEncode +/Palatino-Bold /MyFont-Bold ISOLatin1Encoding ReEncode +/Palatino-BoldItalic /MyFont-BoldOblique ISOLatin1Encoding ReEncode +} def + +%% Preset standard styles: + +% scale and set font; define fontsize, fontheight +/setfontandsize { % font size | - + dup 0 le { pop 100 } if % fontsize <= 0 not allowed ! + /fontnonnil true def + pt fm dup /fontsize x def + x findfont + x scalefont + setfont + gsave % determine fontheight - from the cookbook : + np 0 0 mv (1) true charpath flattenpath + pathbbox % low_left_x, low_left_y, up_right_x, up_right_y + x pop x pop x pop + /fontheight x def + grestore + } def + +% standard settings for labelling axes +/setnum { /MyFont 24 setfontandsize } def +/setlab { /MyFont 24 setfontandsize } def + +% user commands (free choice of fontsize, but fixed font family) +/setown { /MyFont x setfontandsize } def +/setbol { /MyFont-Bold x setfontandsize } def +/setboq { /MyFont-BoldOblique x setfontandsize } def +/setobl { /MyFont-Oblique x setfontandsize } def + + +%% String treatment: + +/showif { % string | - : increment xwidth or plot string + prepare + { stringwidth pop xwidth add /xwidth x def } + { show } + ifelse + } def +/script { % matrix relpos_y | - + /yoffset x fontheight mul def + currentfont x makefont setfont + 0 yoffset rm + } def +/scred .71 def +/subsc { + showif + [scred 0 0 scred 0 0] -.2 script + } def +/supsc { + showif + [scred 0 0 scred 0 0] .6 script + } def +/endsc { + showif + regularfont setfont + 0 yoffset neg rm + } def +/grec { + showif + /Symbol findfont fontsize scalefont setfont + } def +/endgr { + showif + regularfont setfont + } def +/endall { + showif + regularfont setfont + } def +/build { % string xrel yrel obj | - : plot obj above/below string + /obj x def /yrelbui x def /xrelbui x def + dup showif + prepare + { pop } + { stringwidth pop xrelbui neg mul fontheight yrelbui mul % relpos for obj + currentpoint 4 2 roll % save position after string + rm obj pop % obj must end with () that will be pop'ed + mv % back to saved position + } + ifelse + } def +/gbuild { % string xrel yrel obj | - : plot obj above/below string + /obj x def /yrelbui x def /xrelbui x def + /Symbol findfont fontsize scalefont setfont + dup showif + prepare + { pop regularfont setfont } + { stringwidth pop xrelbui neg mul fontheight yrelbui mul % relpos for obj + currentpoint 4 2 roll % save position after string + regularfont setfont + rm obj pop % obj must end with () that will be pop'ed + mv % back to saved position + } + ifelse + } def +/hut { % ..) (<Char>) hut (.. %%% MISERABEL PROGRAMMIERT + x showif + 1.4 .6 {(\136) show ()} build + } def +/ghut { % ..) (<grec-Char>) ghut (.. %%% BREITE PASST NUR FUER Phi(t) + x showif + .8 .65 {(\136) show ()} gbuild + } def +/tilde { + x showif + 1. .6 {(~) show ()} build + } def +/gtilde { + x showif + 1. .6 {(~) show ()} gbuild + } def +/spce { % string n spce - ; insert n times ( ) + {showif ( )} repeat + } def + +% the following macros use the symbol/curve plotting mechanism +/pins { % string symins - ; symbol must be selected by pset + showif + ( ) showif ( ) .5 .5 { currentxy 0 p black ()} build ( ) showif + } def +/clenins { % string len clenins - ; curve must be selected by cset + x showif % I suppose that pins is preceeded by 8 spaces + dup ( ) stringwidth pop mul 2 add /xstrich x xmm div def + % length of inserted curve : + % -1 space : curve begins and ends in middle of ( ) + % +3 spaces: pins requires 3 times ( ) + ( ) 0 .5 { currentxy currentxy 0 ci x xstrich add x 0 cf () } build + 2 add {( ) showif} repeat + } def +/cins { % string symins - ; curve must be selected by cset + showif 8 % I suppose that pins is preceeded by 8 spaces + dup ( ) stringwidth pop mul 2 add /xstrich x xmm div 10 div def + % nov03, ohne zu verstehen, "10 div" eingefuegt + % length of inserted curve : + % -1 space : curve begins and ends in middle of ( ) + % +3 spaces: pins requires 3 times ( ) + ( ) 0 .5 { currentxy currentxy 0 ci x xstrich add x 0 cf () } build + 2 add {( ) showif} repeat + } def + +/block { % x y ob xrel yrel | - + /yrel x def /xrel x def /blabla x def + /ypos x ym def /xpos x xm def + /regularfont currentfont def /yoffset 0 def % initialize for security + /prepare true def /xwidth 0 def 0 0 mv % to prevent empty-path-error + blabla endall % first pass : determine xwidth + boxif { /boxwidth xwidth (M) stringwidth pop boxxr mul 2 mul add def + /boxheight fontheight 1 boxyr 2 mul add mul def + np xpos xwidth xrel mul sub boxwidth xwidth sub 2 div sub + ypos fontheight .5 boxyr add mul sub mv + boxwidth 0 rl 0 boxheight rl boxwidth neg 0 rl cp + boxproc + } if + xpos xwidth xrel mul sub ypos fontheight yrel mul sub mv + /prepare false def + blabla endall % second pass : plot + /boxif false def + } def +/rblock { % x y ang ob proc rblock - + 5 3 roll + gsave + xym translate + 3 2 roll rotate + 0 0 4 2 roll exec + grestore + } def + +/Box { % x y {exe} + /boxif true def + /boxproc x def /boxyr x def /boxxr x def + } def +/nBox { .6 .6 3 2 roll Box } def +/boxif false def +/textW { % obj | length : calculate only length. + /blabla x def + /regularfont currentfont def /yoffset 0 def % initialize for security + /prepare true def /xwidth 0 def 0 0 mv % to prevent empty-path-error + blabla endall + xwidth % has been determined + } def +/textw { % obj | y : dito, in 0..10-units + textW xmm div + } def + +% horizontal text: x y ob | - +/textLB { 0. 0. block } bind def +/textCB { .5 0. block } bind def +/textRB { 1. 0. block } bind def +/textLM { 0. .5 block } bind def +/textCM { .5 .5 block } bind def +/textRM { 1. .5 block } bind def +/textLT { 0. 1. block } bind def +/textCT { .5 1. block } bind def +/textRT { 1. 1. block } bind def + +% rotated text: x y ang ob | - +/rtextLB { {textLB} rblock } bind def +/rtextLM { {textLM} rblock } bind def +/rtextRB { {textRB} rblock } bind def +/rtextRM { {textRM} rblock } bind def +/rtextCM { {textCM} rblock } bind def + + +%% Language selection: + +% preset +/language { % choose_this of_so_many | - % select current language + /langMax x def + /langChc x def + } def +1 1 language % default +% choose text from sequence +/langSel { % text_1 .. text_M | text_C : choose text, M=langMax, C=langChc + langMax dup langChc sub 1 add roll + langMax 1 sub { pop } repeat + } def + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Coordinate Frame %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%% Layout presets: + +/xyTicLen {0.10 fm} def +/xyTacLen {0.20 fm} def +/txllen {0.20 fm} def +/tyllen {0.20 fm} def +/linsetAxx {black 0.7 setline} def +/linsetTic {black 0.7 setline} def +/linsetTac {black 0.7 setline} def +/linsetGri {black 0.4 setline} def + +%% Start-up commands: + +/Resets { + /yNumLengthL 0 def /yNumLengthH 0 def + /xNumHeightL .3 def /xNumHeightH 0 def + /xNumHeightRel 2.4 def + /aMean 5 def + /xPlotFrame {} def + /yPlotFrame {} def + /zPlotFrame {} def + black + } def +/BoxBackground { + 0 0 10 10 boxit gsave setboxbackgroundcolor fill grestore +} def +/setboxbackgroundcolor { white } def + + +%% Some more presets for g3.ps: + +/iFrame 0 def + +/setnewpage { % xoff yoff + /yoffnewpage x def + /xoffnewpage x def +} def +/newpage { + goffsetA4 + xoffnewpage yoffnewpage offset +} def +/setpagegrid { % ncol nrow xoffnewframe yoffnewframe + /yoffnewframe x def + /xoffnewframe x def + /nrowpage x def + /ncolpage x def +} def +/nextFrame { + /iFrame iFrame 1 add def + iFrame nrowpage ncolpage mul mod 0 eq { + showpage gscale newpage + } { + iFrame ncolpage mod 0 eq { + xoffnewframe ncolpage 1 sub neg mul yoffnewframe offset + } { + xoffnewframe 0 offset + } ifelse + } ifelse +} def + + +/zValues { pop pop } def +/plotafter {} def +/whiteframe { 1 0 0 10 10 graybox } def +/plotframes { xPlotFrame yPlotFrame } def +/plotbefore { plotframes } def + +/abc {abclab setown abcx abcy 3 2 roll textCM} def % usage ((a)) abc +/abcset { % x y siz abcset - : preset for abc + /abclab x def /abcy x def /abcx x def + } def + + +%% Ticks: + +% set tick array - internal macros +/tiputs { % rel_pos_of_tick | pos_of_tick : innermost routine for /taproc + tastep mul taloop add + } def +/taproclin { % (#tick/tack) | - : define /taproc for use in SetVec + 1 x div /tistep x def + /taproc { 0 tistep .999 { tiputs } for } def + } def +/taproclog { % (#ticks/tacks) | - : define /taproc for use in SetVec + dup 3 gt { pop /taproc { 1 1 9 { log tiputs } for } def + }{ dup 1 gt { pop /taproc { 0 tiputs 2 log tiputs 5 log tiputs } def + }{ dup 0 gt { pop /taproc { 0 tiputs } def + }{ neg taproclin + } ifelse } ifelse } ifelse + } def +/SetVec { % tafro tatoo nta /vector | - : set /vector + 4 1 roll + /nta x def /tatoo x def /tafro x def + /tastep tatoo tafro sub nta 1 sub div def + [ + 0 1 nta { + tastep mul tafro add /taloop x def + taproc exec + } for + ] def + } def +% set tick array - user commands +/SetTicVecLin { taproclin /TicVec SetVec } def +/SetTicVecLog { taproclog /TicVec SetVec } def + +% set tack-and-number array +/SetTacVec { % [ pos {label} pos {label} ... ] | - + /TacVec x def + } def + +% define axes + % note on angles : 0 = x-axis, 90 = y-axis +/OneAxx { % fro to xpos ypos aang tang | - : presets for Axx, Tic, Tac, Num + % store arguments + /tAng x def /aAng x def + /yPos x def /xPos x def + /aTo x def /aFro x def + % set constants + /xTicLen tAng cos xyTicLen mul def /yTicLen tAng sin xyTicLen mul def + /xTacLen tAng cos xyTacLen mul def /yTacLen tAng sin xyTacLen mul def + /xAng aAng cos def /yAng aAng sin def + /aMean aFro aTo add 2 div def + /aArr false def + } def +/ArrAxx { % label <args of OneAxx> | - : axis with arrow + OneAxx + /aLab x def + /aArr true def + } def + +% draw axis (with parameters preset by OneAxx or ArrAxx) +/Axx { % - | - + linsetAxx + gsave + xPos yPos offset + mmscale + aAng rotate + % draw a line + aFro 0 np mv + aTo 0 li st + % draw an arrow and a label, if requested + aArr { + gsave + aTo 0 offset + aAng neg rotate + mmunscale + aAng rotate + 0 0 0 .3 pfeilspitze % draw an arrow + .3 0 offset + aAng neg rotate + setlab + aAng 45 le + { 0 -.8 xNumHeightL sub aLab textRT } + { 0 .2 aLab textCB } + ifelse + grestore + } if + grestore + } def + +% draw ticks (positions given by SetTicVec, parameters preset by OneAxx/..) +/Tic { % - | - : draw tick as defined in TicProc + linsetTic + TicVec { + dup dup aFro lt x aTo gt or {pop} {TicProc} ifelse + } forall + } def +/TicProc { % aPos | - : default procedure to plot one tick + np + xPos yPos xym mv + dup xAng mul x yAng mul xym rm % eat argument, go to start pos. + xTicLen yTicLen rl st + } def +/xGric { % yFro yTo | - : draw a grid line (instead of an x tick) + linsetGri + TicVec { + 3 copy dup 5 -1 roll aFro lt x aTo gt or {pop pop pop} { + dup % y1 y2 x x + 4 -1 roll xym np mv % y2 x + x xym li st + } ifelse + } forall + pop pop + } def +/yGric { % xFro xTo | - : draw a grid line (instead of an y tick) + linsetGri + TicVec { + 3 copy dup 5 -1 roll aFro lt x aTo gt or {pop pop pop} { + dup % x1 x2 y y + 4 -1 roll x xym np mv % x2 y + xym li st + } ifelse + } forall + pop pop + } def + +% draw tacks (positions given by SetTacVec, parameters preset by OneAxx/..) +/TacExe { % Proc | - % Execute Proc for all pairs of elements of TacVec + % (but only if inside aFro..aTo) + /TacProc x def + /ispair true def % toggle: take pos, take label, take pos, take label ... + TacVec { + ispair + { + /aPos x def + /ispair false def + } { + aPos dup aFro lt x aTo gt or + {pop} {TacProc} ifelse + /ispair true def + } ifelse + } forall + } def +/Tac { + linsetTac + { pop xPos yPos xym mv + aPos dup xAng mul x yAng mul xym rm + xTacLen yTacLen rl st + } TacExe + } def +% unnecessary optimisation by specialisation: OBSOLETE since 11a +/xTacL { Tac } def +/xTacH { Tac } def +/yTacL { Tac } def +/yTacH { Tac } def +% special tack routines, only for rectangular axes +/xTacC { % : centered tack on x axis + linsetTac + { pop aPos xm yPos ym txllen 2 div sub np mv 0 txllen rl st } TacExe + } def +/xGrid { % : rule instead of tack on x axis + linsetTac + { pop aPos xm np yPos ym mv 0 10 xym rl st } TacExe + } def +/yTacC { % : centered tack on y axis + linsetTac + { pop xPos xm tyllen 2 div sub aPos ym np mv tyllen 0 rl st } TacExe + } def +/yGrid { % : rule instead of tack on low y axis + linsetTac + { pop aPos ym np xPos xm x mv 10 0 xym rl st } TacExe + } def + +% draw numbers (pos-txt pairs given by SetTacVec) +/Num { % Generic but useless. Adjust for your application. + setnum + fontheight ymm div yDisRel mul tAng sin mul /yDist x def + { dup textW xDisRel mul tAng cos mul /xDist x def + xPos aPos xAng mul add xDist sub + yPos aPos yAng mul add yDist sub 3 2 roll textCM } TacExe + } def +/setnumDisRel { % xDisRel yDisRel | - : adjust just a little bit + /yDisRel x def /xDisRel x def + } def +1.2 1.2 setnumDisRel % default setting +% explicit Num routines for rectangular case +/xNumL { % : numbers on low x axis + setnum + { fontheight ymm div % conversion -> user_scale + dup /xNumHeightL x def + -.6 mul yPos add aPos x 3 2 roll textCT } TacExe + } def +/xNumH { % : numbers on high x axis + setnum + { fontheight ymm div % conversion -> user_scale + dup /xNumHeightH x def + .6 mul yPos add aPos x 3 2 roll textCB } TacExe + } def +/yNumL { % : numbers on low y axis + setnum + { fontsize -.3 mul xmm div xPos add aPos 3 2 roll textRM + xwidth dup yNumLengthL gt {/yNumLengthL x def} {pop} ifelse + } TacExe + } def +/yNumLD { % : calculate only yNumLength (used for adjustement) + setnum + { textW dup yNumLengthL gt {/yNumLengthL x def} {pop} ifelse + } TacExe + } def +/yDumL { % {(..)} yDumL : compare yNumLength with one arg (used for adjustement) + setnum + textW dup yNumLengthL gt {/yNumLengthL x def} {pop} ifelse + } def +/yNumH { % : numbers on high y axis + setnum + { fontsize .3 mul xmm div xPos add aPos 3 2 roll textLM + xwidth dup yNumLengthH gt {/yNumLengthH x def} {pop} ifelse + } TacExe + } def +/yNumHD { % : calculate only yNumLength (used for adjustement) + setnum + {textW dup yNumLengthH gt {/yNumLengthH x def} {pop} ifelse + } TacExe + } def +/yDumH { % {(..)} yDumH : compare yNumLength with one arg (used for adjustement) + setnum + textW dup yNumLengthH gt {/yNumLengthH x def} {pop} ifelse + } def + +% draw labels +/xCL { % xlabel | - ; plots coordinate name below the x-axis. + setlab + aMean xNumHeightL xNumHeightRel neg mul + 3 -1 roll textCT + } def +/xCH { % xlabel | - ; plots coordinate name above the x-axis. + setlab + aMean xNumHeightH xNumHeightRel mul 10 add + 3 -1 roll textCB + } def +/yCL { % ylabel | - ; plots coordinate name to the left of the y-axis. + gsave + setlab + yNumLengthL neg fontsize -.85 mul add % yNumLengthL calculated in yN + aMean ym translate + 0 0 mv + 90 rotate + 0 x 0 x textCB + grestore + } def +/yCH { % ylabel | - ; plots coordinate name to the right of the y-axis. + gsave + setlab + yNumLengthH fontsize .85 mul add 10 xm add + aMean ym translate + 0 0 mv + 90 rotate + 0 x 0 x textCT + grestore + } def +/yCF { % ylabel | - ; plots coordinate name *falling* right of the y-axis. + gsave + setlab + yNumLengthH fontsize .85 mul add 10 xm add + aMEan ym translate + 0 0 mv + -90 rotate + 0 x 0 x textCB + grestore + } def + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Data Plotting (Symbols and Curves) %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%% Initializations: + +% asymmetric error bars? +/err_asy false def % overwrite this if data are quadruples x y d- d+ + + +%% Presets: + +% global preset [wups11a: exchanged rad<->lin to conform with pset] +/SymGSet { % sradglo slinglo serrglo | - + /serrglo x def % plot error bars? 0=never, 1=always, 2=as_given_in_pset + /slinglo x def % symbol linewidth multiplier + /sradglo x def % symbol size multiplier + } def + + +%% Retrieve presets from style array: + +/pstyle { pStyles setstyle } def +/cstyle { cStyles setstyle } def +/setstyle { % chosen_number array | - : set p or c as predefined in array. + dup length % i A n + 3 2 roll % A n i + dup 0 le { + pop pop pop ostyle % chosen_number<=0 means: don't plot + } { + 1 sub x % A i-1 n + mod get % A(i-1) + exec + } ifelse + } def + + +%% Set plot symbol: + +/pset { % styp sfill serr srad slin | - + % arg -> symbol linewidth + /slin x slinglo mul def + % arg -> symbol size + /srad x fm 0.16 mul sradglo mul def + % arg -> plot error bar? + 2 serrglo ne { pop serrglo } if % if (serrglo=2) use serr else use serrglo + /plot_errorbar x 1 eq { { errorbar } } { { pop pop pop pop } } ifelse def + % arg -> fill the symbol? (0=open, 1=full, 2=colored_with_black_border) + /sfill x def + % adjust srad: it's the _outer_ radius + % TROUBLE sfill 1 ne {/srad srad slin fm pt sub def} if + % arg -> symbol type + /ps {ps_nil} def % default: don't plot (maybe we only want an error bar) + dup 1 eq {/ps {ps_square} def} if + dup 2 eq {/ps {ps_diamond} def} if + dup 3 eq {/ps {ps_circle} def} if + dup 4 eq {/ps {ps_triangle} def} if + dup 5 eq {/ps {ps_cedez} def} if + dup 6 eq {/ps {ps_eieruhr} def} if + dup 7 eq {/ps {ps_valve} def} if + dup 8 eq {/ps {ps_tfwd} def} if + dup 9 eq {/ps {ps_tbwd} def} if + dup 10 eq {/ps {ps_pentagram} def} if + dup 11 eq {/ps {ps_plus} def} if + dup 12 eq {/ps {ps_cross} def} if + dup 13 eq {/ps {ps_star} def} if + dup 14 eq {/ps {ps_pentagon} def} if + dup 15 eq {/ps {ps_horiz} def} if + dup 16 eq {/ps {ps_verti} def} if + pop + % + /t { % x y d[- d+] | - : plot a symbol and eventually an error bar. + err_asy not { dup } if + 4 copy pop pop plot_symbol + plot_errorbar + } bind def + /ti { t } bind def + /tf { t black } bind def + } def + + +%% Set curve: + +/lset { % lwidth dashes | - + 0 setdash + dup 0 gt { + pt fm setlinewidth + % pop error bar and convert frame coord -> paper coord + /txy { err_asy { pop } if pop xym } def % x y d[- d+] | x' y' + % commands to plot points (can be overwritten by nopoints): + /ti { np txy mv } def % x y d[- d+] | - : start curve + /t { txy li } def % x y d[- d+] | - : continue curve + /tf { txy li st } def % x y d[- d+] | - : terminate and plot curve + } { + ostyle + } ifelse + } def + + +%% Plot nothing: + +/ostyle { % - | - + /ti { nopoint } def + /t { nopoint } def + /tf { nopoint } def +} def +/nopoint { % x y d[- d+] | - + pop pop pop err_asy { pop } if +} def + + +%% Plot an asymmetric vertical error bar: + +/errorbar { % x y d- d+ | - + gsave + slin setline + 3 copy pop pop + dup 0 gt x 10 lt and { + 4 copy + x pop add 10. 2 copy gt { x } if pop ym x xm x + 2 copy x .05 sub x np mv .1 0 rl st + np mv + pop sub 0. 2 copy lt { x } if pop ym x xm x + 2 copy lineto st + x .05 sub x np mv .1 0 rl st + } { + pop pop pop pop + } ifelse + grestore +} def + + +%% Plot a data symbol: + +/plot_symbol { % x y | - + gsave + offset + srad dup scale + slin srad div setline % factor 1/srad compensates "scale" + ps % the actual plot symbol, defined by 'pset' + grestore + } def + +/fill_symbol { + sfill dup + 0 eq { + pop st + } { + 1 eq { + fill + } { + gsave fill grestore + gsave black st grestore + } ifelse + } ifelse + } def + + +%% The different symbols, designed for unit area (no arguments): + +/ps_nil { + } bind def + +/ps_square { + .5 .5 np mv + 0 -1 rl + -1 0 rl + 0 1 rl cp fill_symbol + } bind def + +/ps_diamond { + gsave 45 rotate ps_square grestore + } bind def + +/ps_circle { + 0 0 np .564 0 360 arc cp fill_symbol + } bind def + +/ps_triangle { + .77 dup dup 90 pol2xy np mv + 210 pol2xy li + 330 pol2xy li cp fill_symbol + } bind def + +/ps_cedez { + gsave 180 rotate ps_triangle grestore + } bind def + +/ps_tfwd { + gsave 30 rotate ps_triangle grestore + } bind def + +/ps_tbwd { + gsave 210 rotate ps_triangle grestore + } bind def + +/ps_eieruhr { + -.7 -.7 np mv + .7 -.7 li + -.7 .7 li + .7 .7 li cp fill_symbol + } bind def + +/ps_valve { + gsave 90 rotate ps_eieruhr grestore + } bind def + +/ps_pentagram { + .8 dup dup dup dup + 90 pol2xy np mv + 234 pol2xy li + 18 pol2xy li + 162 pol2xy li + 306 pol2xy li cp fill_symbol + } bind def + +/ps_pentagon { + .8 dup dup dup dup + 18 pol2xy np mv + 90 pol2xy li + 162 pol2xy li + 234 pol2xy li + 306 pol2xy li cp fill_symbol + } bind def + +/ps_plus { + gsave 45 rotate ps_cross grestore + } bind def + +/ps_cross { + .5 .5 np mv + -1 -1 rl st + -.5 .5 np mv + 1 -1 rl st + } bind def + +/ps_star { + .7 dup 0 pol2xy np mv 180 pol2xy li st + .7 dup 120 pol2xy np mv 300 pol2xy li st + .7 dup 240 pol2xy np mv 60 pol2xy li st + } bind def + +/ps_horiz { + -.7 0 np mv + 1.4 0 rl st + } bind def + +/ps_verti { + 0 -.7 np mv + 0 1.4 rl st + } bind def + + +%% Set column plotting (use this instead of pset) - BROKEN in 11a or earlier + +/setcolumn{ % shift width exec | % + % usage: 0 .2 { gsave { .5 setgray fill } grestore cp } setcolumn + /colexec x def % what's this ? + /colwidth x def + /colshift x def + /t { % broken - may need rewrite + np x colshift add x xym 2 copy mv pop + colwidth xm 0 rl + colwidth xm add 0 wy ym li + colwidth neg xm 0 rl + cp colexec + } def + /ti { t } bind def + /tf { t black } bind def +} def + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% List %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +/NewList { % xins yins size advance NewList - + /nl_advance x def setown /nl_yins x def /nl_xins x def + /nl_xshift fontsize xmm div .9 mul def + /nl_xrline 0.33 def + /nl_ystep fontheight ymm div nl_advance mul def + /newline { + /nl_yins nl_yins nl_ystep sub def + } def + /fracline { % frac | - + fontheight ymm div nl_advance mul mul /nl_yins x nl_yins x sub def + } def + } def +/newlist { 1.65 NewList } def +/TxLine { % text TxLine - + nl_xins nl_yins 3 -1 roll textLM newline + } bind def +/TxCLine { % text TxLine - + nl_xins nl_yins 3 -1 roll textCM newline + } bind def +/infline{ % Obsolete since Frida2.1.5 + oooinfo 1 eq { TxLine } { pop } ifelse + } bind def +/PtTxLine { % pstyle text | - + x pstyle + nl_xins nl_xshift .5 mul add nl_yins 0 t + black nl_xins nl_xshift 1.5 mul add nl_yins 3 2 roll textLM + newline + } bind def +/PttttTxLine { % pstyle text | - %% chain of very small symbols + x pstyle + nl_xins nl_xshift .10 mul add nl_yins 0 t + nl_xins nl_xshift .26 mul add nl_yins 0 t + nl_xins nl_xshift .42 mul add nl_yins 0 t + nl_xins nl_xshift .58 mul add nl_yins 0 t + nl_xins nl_xshift .74 mul add nl_yins 0 t + nl_xins nl_xshift .90 mul add nl_yins 0 t + black nl_xins nl_xshift 1.5 mul add nl_yins 3 2 roll textLM + newline + } bind def +/PtPtCvTxLine { % pstyle pstyle cstyle text | - + 4 3 roll pstyle nl_xins nl_yins 0 t + 3 2 roll pstyle nl_xins nl_xshift add nl_yins 0 t + x cstyle + nl_xins nl_xshift 2 mul add + dup dup nl_xshift nl_xrline mul sub nl_yins 0 ti + nl_xshift nl_xrline mul add nl_yins 0 tf + nl_xshift add nl_yins 3 2 roll black textLM + newline + } bind def +/PtCvTxLine { % pstyle cstyle text | - + 3 2 roll pstyle nl_xins nl_yins 0 t + x cstyle + nl_xins nl_xshift 1 mul add + dup dup nl_xshift -.33 mul add nl_yins 0 ti + nl_xshift 0.33 mul add nl_yins 0 tf + nl_xshift add nl_yins 3 2 roll black textLM + newline + } bind def +/PtPtTxLine { % pstyle pstyle text | - + 3 2 roll pstyle nl_xins nl_yins 0 t + x pstyle nl_xins nl_xshift add nl_yins 0 t + black nl_xins nl_xshift 2 mul add nl_yins 3 2 roll textLM + newline + } bind def +/CvTxLine { % cstyle text | - + x cstyle + nl_xins fontsize xmm div nl_xrline mul 0 mul sub nl_yins 0 ti + nl_xins fontsize xmm div nl_xrline mul 3 mul add nl_yins 0 tf + black nl_xins nl_xshift 1.5 mul add nl_yins 3 2 roll textLM + newline + } bind def +/Cv2TxLine { % cstyle text | - + x cstyle + nl_xins fontsize xmm div nl_xrline mul sub nl_yins 0 ti + nl_xins fontsize xmm div nl_xrline mul add nl_xshift add nl_yins 0 tf + black nl_xins nl_xshift 2 mul add nl_yins 3 2 roll textLM + newline + } bind def +/PCTxLine { % pstyle(with plset) text | - + x pstyle + nl_xins fontsize xmm div nl_xrline 2 mul mul sub nl_yins 0 ci + nl_xins fontsize xmm div nl_xrline 2 mul mul add nl_yins 0 cf + nl_xins yins 0 t + black nl_xins + fontsize xmm div 1.9 mul % instead of xshift + add nl_yins 3 2 roll textLM + newline + } bind def +/showfilename { % xins yins size | - + setown + ooofnam 1 eq { filename textRB } { pop pop } ifelse + } def +/InfSet { % ooofnam oooinfo | - : set on(1) or off(0) + /oooinfo x def /ooofnam x def + } def +0 0 InfSet % default setting + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Macro Collection %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%% gray areas (mainly applied with grayval=1 for blank areas) [longtime grey..] + +/execOval3 { % xl xh yl yh dr { proc } | - + gsave + 6 1 roll + fm /qqdr x def + ym /qqyh x def + ym /qqyl x def + xm /qqxh x def + xm /qqxl x def + qqxl qqyl qqdr add np mv + qqxl qqyh qqdr sub li + qqxl qqdr add qqyh qqdr sub qqdr 180 90 arcn + qqxh qqdr sub qqyh li + qqxh qqdr sub qqyh qqdr sub qqdr 90 0 arcn + qqxh qqyl qqdr add li + qqxh qqdr sub qqyl qqdr add qqdr 0 -90 arcn + qqxl qqdr add qqyl li + qqxl qqdr add qqyl qqdr add qqdr -90 -180 arcn + cp exec grestore + } def +/execRect3 { % xl xh yl yh {proc} | - + 5 1 roll + gsave + ym /qqyh x def + ym /qqyl x def + xm /qqxh x def + xm /qqxl x def + np + qqxl qqyl mv + qqxh qqyl li + qqxh qqyh li + qqxl qqyh li + cp exec grestore + } def +/execRectangle { % OBSOLETE + 5 1 roll + gsave + wy /qqyh x def + wy /qqyl x def + wx /qqxh x def + wx /qqxl x def + np + qqxl xm qqyl ym mv + qqxh xm qqyl ym li + qqxh xm qqyh ym li + qqxl xm qqyh ym li + cp exec grestore + } def +/execHexagon { % xl xh yl yh (all in user coords) {proc} | - + 5 1 roll + gsave + wy /qqyh x def + wy /qqyl x def + wx /qqxh x def + wx /qqxl x def + /qqdr qqyh qqyl sub 2 div def + np + qqxl qqdr add qqyl xym mv + qqxh qqdr sub qqyl xym li + qqxh qqyl qqdr add xym li + qqxh qqdr sub qqyh xym li + qqxl qqdr add qqyh xym li + qqxl qqyl qqdr add xym li + cp exec grestore + } def +/coordRectangle { % xl xh yl yh (all in plot coords) {proc} | - + 5 1 roll + gsave + /qqyh x def + /qqyl x def + /qqxh x def + /qqxl x def + np + qqxl xm qqyl ym mv + qqxh xm qqyl ym li + qqxh xm qqyh ym li + qqxl xm qqyh ym li + cp exec grestore + } def + + +%% special objects + +/pfeilangle 36.87 def +/pfeilspitze { % x[local] y[local] rot siz + % draw with current linestyle, as set e.g. by linsetAxx + x 4 2 roll % siz rot x y + gsave + xym translate 180 add rotate dup dup dup + [] 0 setdash + pfeilangle cos mul x pfeilangle sin mul np mv + 0 0 li pfeilangle cos mul x pfeilangle sin neg mul li st + grestore + } def +/pfeiL { % (arrow anchored at base) x y rot siz len + gsave + dup xm x ym mul sqrt % (scale len) + 5 3 roll + xym translate % (origin at base) rot siz len + 3 2 roll + rotate % (draw rightwards) siz len + dup 0 translate % (origin at head) siz len + x 0 0 0 4 3 roll pfeilspitze % len + 0 0 np mv neg 0 li st + grestore + } def +/Pfeil { % (arrow anchored at head) x y rot siz len + dup xm x ym mul sqrt 5 copy + pop pfeilspitze + x pop + x 4 2 roll % len rot x y + gsave + xym translate 180 add rotate + 0 0 np mv 0 li st + grestore + } def +/pfeil { % (OBSOLETE) x[local] y[local] rot siz len[global] + fm 5 copy % not working well + pop pfeilspitze + x pop + x 4 2 roll % len rot x y + gsave + xym translate 180 add rotate + 0 0 np mv 0 li st + grestore + } def +/pfeil_arcn { % x_cent y_cent radius ang_from ang_to siz + gsave + 6 -2 roll offset + 4 copy pop 0 0 5 2 roll + np arcn st + % radius ang_from ang_to siz + 4 1 roll + gsave + rotate + pop + % siz radius + 0 -90 4 3 roll + pfeilspitze + grestore + grestore +} def + +/knautschy { % x0 y0 y_knau y_tot knautschy - : insert an S in dived y-axis + % the total height of the generated object is y_tot + % of which y_knau(.le. y_tot) is for the real knautsch, + % the remainder is for vertical prolongations. + x ym 4 div dup /tmpy x def 5 sqrt mul /tmpx x def + /tmpa x ym tmpy 4 mul sub 2 div def + np ym x xm x mv 0 tmpa rl tmpx tmpy rl tmpx -2 mul tmpy 2 mul rl + tmpx tmpy rl 0 tmpa rl st + } def +/separy { % x0 y0 sep lng ang lin - : insert an // in dived y-axis + setline + /spang x def + /splng x def + /spsep x def + 2 copy spsep sub gsave offset spang rotate + splng -.5 mul fm 0 np mv splng fm 0 rl st grestore + spsep add gsave offset spang rotate + splng -.5 mul fm 0 np mv splng fm 0 rl st grestore + } def + +/bemasz { % x y L ang text | - %% precede by '24 setown 1 [] lset /pfeilangle 90 def' + gsave + 5 3 roll offset % consumes x and y + x rotate % consumes ang | L text + dup textw .5 mul fontheight .4 mul add /bmszDT x def % => half text width + 0 0 3 2 roll textCM % L + .5 mul /bmszDX x def % => half bemasz length + bmszDX 0 0 fontheight .67 mul bmszDX bmszDT sub Pfeil + bmszDX neg 0 180 fontheight .67 mul bmszDX bmszDT sub Pfeil + grestore + } def + + +%% Text composition shortcuts: + +/g { x grec endgr} bind def +/sb { x subsc endsc} bind def +/sp { x supsc endsc} bind def +/sbgr { x grec () subsc endsc () endgr} bind def +/spgr { x grec () supsc endsc () endgr} bind def + + +%% Text macros for neutron scattering: + +/hbar { + showif + (h) 1.2 .66 { + currentpoint fontheight .11 mul setline np mv + fontheight dup .8 mul x .3 mul rl + st () + } build + } bind def +/hbarw { hbar () grec (w) endgr } bind def +/wbar { grec (w) endgr ( / 2) grec (p) endgr } bind def +/taumean { () (\341t\361) g } bind def +/Sqw { showif (S\(q,) grec (w) endgr (\)) showif } bind def +/Sqn { showif (S\(q,) grec (n) endgr (\)) showif } bind def +/SQw { showif (S\(Q,) grec (w) endgr (\)) showif } bind def +/Sttw { showif (S\(2) grec (q) endgr (,) grec (w) endgr (\)) showif } bind def +/Sttn { showif (S\(2) grec (q) endgr (,) grec (n) endgr (\)) showif } bind def +/Xqw { grec (c) endgr (''\(q,) grec (w) endgr (\)) showif } bind def +/Xqn { grec (c) endgr (''\(q,) grec (n) endgr (\)) showif } bind def +/ueV{ grec (m) endgr (eV) showif} bind def +/inueV { showif (\() grec (m) endgr (eV\)) showif } bind def +/inmeVr { showif (\(meV) supsc (-1) endsc (\)) showif } bind def +/inueVr { showif (\() grec (m) endgr (eV) + supsc (-1) endsc (\)) showif } bind def +/inGHzr { showif (\(GHz) (-1) sp (\)) showif } def + +%% home-made Angstr is obsolete; use \305 (more reliable than Ã…) +/Angstr { + showif + (A) .5 1.23 { + currentpoint fontheight .1 mul setline np + fontheight .14 mul 0 360 arc st () + } build +} bind def +/Angr { showif (\305) supsc (-1) endsc } bind def +/inAngr { showif (\() Angr (\)) showif } bind def +/Angrr { showif (\305) supsc (-2) endsc } bind def +/inAngrr { showif (\() Angrr (\)) showif } bind def +/wmin {grec (w) endgr () subsc (min) endsc} def +/winpi { grec (w) endgr ( / 2) grec (p) endgr } def +/Celsius { showif (\26x)g(C) showif } bind def + + +%% More shortcuts for impatient users: + +/L { langSel } bind def +/G { gsave exec grestore } bind def +/gs { gsave } bind def +/gr { grestore } bind def + +end % WuGdict... + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Mark "ewu", the end of the wups.. macro definition file %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +WuGdict11a begin + +9 dup autolabel defsiz +1 dup stdred +2 -21 setnewpage newpage + +/darkgreen { 13 133 13 setRGBcolor } def +/litegreen {202 253 222 setRGBcolor } def +/darkGreen { 1 33 1 setRGBcolor } def +/liteGreen {162 233 172 setRGBcolor } def +/darkblue { 13 13 133 setRGBcolor } def +/liteblue {202 202 255 setRGBcolor } def + +/boxcenter{ qqxl qqxh add 2 div qqyl qqyh add 2 div } def + +/greenbox{ + 5 1 roll + { { litegreen fill } G darkgreen 2 [] lset st } execRect3 + black boxcenter 3 2 roll textCM +} def + +/Greenbox{ + 5 1 roll + { { liteGreen fill } G darkgreen 3 [.27 .12] lset st } execRect3 + black boxcenter 3 2 roll textCM +} def + +/grisbox{ + 5 1 roll + { { .8 setgray fill } G .2 setgray 2 [] lset st } execRect3 + black boxcenter 3 2 roll textCM +} def + +/blueoval{ + 6 1 roll + { { liteblue fill } G darkblue 2 [] lset st } execOval3 + black boxcenter 3 2 roll textCM +} def +/greenoval{ + 6 1 roll + { { litegreen fill } G darkgreen 2 [] lset st } execOval3 + black boxcenter 3 2 roll textCM +} def +/Greenoval{ + 6 1 roll + { { liteGreen fill } G darkgreen 2 [] lset st } execOval3 + black boxcenter 3 2 roll textCM +} def + +21 setown + +1 [] lset black +/upline { 270 .5 2 Pfeil } def % (arrow anchored at base) x y rot siz len + +4 14 3.5 7.5 {()} greenbox +5 13 5 7 {()} Greenbox +9 4.25 {(libBornAgainCore (C++))} textCM +9 6 {(libBornAgainCore (exposed))} textCM + +gsave +9 -.5 offset +2.4 2.4 270 .5 1.6 Pfeil +1. .4 offset +3 { + 0 3.8 0 2 {(other libs)} grisbox + -.5 -.2 offset +} repeat +grestore + +gsave 0 1 offset +21 setobl +-2 18 8 16 {()} greenbox +5 13 11 13 .3 {(Core wrapper)} Greenoval +-1 7 8.5 10.5 .3 {(Fit wrapper)} Greenoval +11 17 13.5 15.5 .3 {(plot utils)} Greenoval +{ 4 [] lset 9 6 270 .5 5 Pfeil } G +9 16 270 .5 1.5 Pfeil +-1 15 {(bornagain Python module)} textLT +grestore + +gsave +21 setobl +15 19.4 5 7 {(matplotlib)} grisbox +16 7 270 .5 7.5 Pfeil +% Py -> matplotlib +{ 11.5 19.3 offset +0 0 np mv 5 0 rl +6 -1 1 90 0 arcn st +7 -12.3 270 .5 11.3 Pfeil +} G +grestore + +gsave +-6 -5.5 offset +12 7.5 270 .5 1.5 Pfeil +4 14 3.5 7.5 {()} greenbox +5 13 5 7 {()} Greenbox +9 4.25 {(libBornAgainFit (C++))} textCM +9 6 {(libBornAgainFit (exposed))} textCM +{ 4 [] lset 9 7 270 .5 8 Pfeil } G +grestore + +gsave +21 setobl +0 18 offset +6.5 11.5 1 3 .4 {(Python apps)} blueoval +8.5 12 0.5 1.5 .3 {(Examples)} greenoval +grestore + +showpage +end % WuGdict... diff --git a/Doc/UserManual/fig/icons/Weblink.png b/Doc/UserManual/fig/icons/Weblink.png new file mode 100644 index 0000000000000000000000000000000000000000..cfc7b6e33c068b3a288adf44ff9aa4ae836c473c Binary files /dev/null and b/Doc/UserManual/fig/icons/Weblink.png differ diff --git a/Wrap/python/__init__.py.in b/Wrap/python/__init__.py.in index 667e10d0b41de3571984b93ef41d708e4bd6d6b2..7d8c3655e9c14bc3755648d6344d3de5d5e44601 100644 --- a/Wrap/python/__init__.py.in +++ b/Wrap/python/__init__.py.in @@ -11,4 +11,3 @@ from libBornAgainFit import * sys.path.append(os.path.abspath(os.path.dirname(__file__))) from plot_utils import * - diff --git a/Wrap/swig/ignores.i b/Wrap/swig/ignores.i index 5776921c4af1b3bfced784d9b8276200f95f17c0..bbec62a5f0d97292d83f732ff46690c5b4d81370 100644 --- a/Wrap/swig/ignores.i +++ b/Wrap/swig/ignores.i @@ -41,8 +41,6 @@ // need this to play nicely with ctypes -//%ignore IMultiLayerBuilder::registerParameter(const std::string&, double*, const Limits&); -//%ignore IMultiLayerBuilder::registerParameter(const std::string&, double*); %ignore IParameterized::addParametersToExternalPool(const std::string&, ParameterPool*, int) const; %ignore IParameterized::addParametersToExternalPool(const std::string&, ParameterPool*) const; %ignore IMultiLayerBuilder::addParametersToExternalPool(const std::string&, ParameterPool*, int) const; @@ -54,3 +52,10 @@ // taken from dev-tools/python-bindings/settings_fit.py %ignore FitSuite::setOptions(const FitOptions&); %ignore FitSuite::getOptions(); + + +// extra ignores for types and methods that shouldn't be visible in Python +%ignore FormFactorDWBAPol; +%ignore ISampleVisitor::visit(const FormFactorDWBAPol*); +%ignore FormFactorDWBA; +%ignore ISampleVisitor::visit(const FormFactorDWBA*); diff --git a/auto/Wrap/doxygen_core.i b/auto/Wrap/doxygen_core.i index d25205b27280e7d1582c784b1e66927804259acc..fbf55e27e632c82aa4d7de58a779286c2ee695d5 100644 --- a/auto/Wrap/doxygen_core.i +++ b/auto/Wrap/doxygen_core.i @@ -496,21 +496,6 @@ clone method "; -// File: classComponentParameter.xml -%feature("docstring") ComponentParameter " - -Wraps a parameter of type ISample. - -C++ includes: ComponentParameter.h -"; - -%feature("docstring") ComponentParameter::ComponentParameter "ComponentParameter::ComponentParameter(const std::string &name, volatile ISample *par, const std::string &parent_name, const std::function< void()> &onChange) -"; - -%feature("docstring") ComponentParameter::clone "ComponentParameter* ComponentParameter::clone(const std::string &new_name=\"\") const -"; - - // File: classComputationOutcome.xml %feature("docstring") ComputationOutcome " @@ -1617,9 +1602,9 @@ Returns current number of minimization function calls. Returns the number of current strategy. "; -%feature("docstring") FitKernel::printResults "void FitKernel::printResults() const +%feature("docstring") FitKernel::reportResults "std::string FitKernel::reportResults() const -Prints fit results to stdout. +Reports results of minimization in the form of multi-line string. "; %feature("docstring") FitKernel::getOptions "FitOptions& FitKernel::getOptions() @@ -1819,7 +1804,7 @@ C++ includes: FitStrategyAdjustMinimizer.h %feature("docstring") FitStrategyAdjustMinimizer::execute "void FitStrategyAdjustMinimizer::execute() "; -%feature("docstring") FitStrategyAdjustMinimizer::getMinimizerOptions "MinimizerOptions * FitStrategyAdjustMinimizer::getMinimizerOptions() +%feature("docstring") FitStrategyAdjustMinimizer::getMinimizerOptions "ObsoleteMinimizerOptions * FitStrategyAdjustMinimizer::getMinimizerOptions() "; @@ -2122,7 +2107,14 @@ Returns current number of minimization function calls. Returns the number of current strategy. "; -%feature("docstring") FitSuite::printResults "void FitSuite::printResults() const +%feature("docstring") FitSuite::printResults "void FitSuite::printResults() const + +Prints results of the minimization to the standard output. +"; + +%feature("docstring") FitSuite::reportResults "std::string FitSuite::reportResults() const + +Reports results of minimization in the form of multi-line string. "; %feature("docstring") FitSuite::getChi2 "double FitSuite::getChi2() const @@ -3001,15 +2993,15 @@ C++ includes: FormFactorDWBA.h %feature("docstring") FormFactorDWBA::FormFactorDWBA "FormFactorDWBA::FormFactorDWBA(const IFormFactor &form_factor) "; -%feature("docstring") FormFactorDWBA::~FormFactorDWBA "FormFactorDWBA::~FormFactorDWBA() final +%feature("docstring") FormFactorDWBA::~FormFactorDWBA "FormFactorDWBA::~FormFactorDWBA() "; -%feature("docstring") FormFactorDWBA::clone "FormFactorDWBA * FormFactorDWBA::clone() const final +%feature("docstring") FormFactorDWBA::clone "FormFactorDWBA * FormFactorDWBA::clone() const Returns a clone of this ISample object. "; -%feature("docstring") FormFactorDWBA::accept "void FormFactorDWBA::accept(ISampleVisitor *visitor) const final +%feature("docstring") FormFactorDWBA::accept "void FormFactorDWBA::accept(ISampleVisitor *visitor) const Calls the ISampleVisitor's visit method. "; @@ -3019,7 +3011,7 @@ Calls the ISampleVisitor's visit method. Sets reflection/transmission info for scalar DWBA simulation. "; -%feature("docstring") FormFactorDWBA::evaluate "complex_t FormFactorDWBA::evaluate(const WavevectorInfo &wavevectors) const final +%feature("docstring") FormFactorDWBA::evaluate "complex_t FormFactorDWBA::evaluate(const WavevectorInfo &wavevectors) const Returns scattering amplitude for complex wavevectors ki, kf. "; @@ -3033,31 +3025,28 @@ Evaluates the coherent sum of the 16 matrix DWBA terms in a polarized IFormFact C++ includes: FormFactorDWBAPol.h "; -%feature("docstring") FormFactorDWBAPol::FormFactorDWBAPol "FormFactorDWBAPol::FormFactorDWBAPol()=delete -"; - %feature("docstring") FormFactorDWBAPol::FormFactorDWBAPol "FormFactorDWBAPol::FormFactorDWBAPol(const IFormFactor &form_factor) "; %feature("docstring") FormFactorDWBAPol::~FormFactorDWBAPol "FormFactorDWBAPol::~FormFactorDWBAPol() "; -%feature("docstring") FormFactorDWBAPol::clone "FormFactorDWBAPol * FormFactorDWBAPol::clone() const final +%feature("docstring") FormFactorDWBAPol::clone "FormFactorDWBAPol * FormFactorDWBAPol::clone() const Returns a clone of this ISample object. "; -%feature("docstring") FormFactorDWBAPol::accept "void FormFactorDWBAPol::accept(ISampleVisitor *visitor) const final +%feature("docstring") FormFactorDWBAPol::accept "void FormFactorDWBAPol::accept(ISampleVisitor *visitor) const Calls the ISampleVisitor's visit method. "; -%feature("docstring") FormFactorDWBAPol::evaluate "complex_t FormFactorDWBAPol::evaluate(const WavevectorInfo &wavevectors) const final +%feature("docstring") FormFactorDWBAPol::evaluate "complex_t FormFactorDWBAPol::evaluate(const WavevectorInfo &wavevectors) const Throws not-implemented exception. "; -%feature("docstring") FormFactorDWBAPol::evaluatePol "Eigen::Matrix2cd FormFactorDWBAPol::evaluatePol(const WavevectorInfo &wavevectors) const final +%feature("docstring") FormFactorDWBAPol::evaluatePol "Eigen::Matrix2cd FormFactorDWBAPol::evaluatePol(const WavevectorInfo &wavevectors) const Calculates and returns a polarized form factor calculation in DWBA. "; @@ -4511,7 +4500,7 @@ Two-dimensional Cauchy decay function in reciprocal space; corresponds to exp(-r C++ includes: FTDecayFunctions.h "; -%feature("docstring") FTDecayFunction2DCauchy::FTDecayFunction2DCauchy "FTDecayFunction2DCauchy::FTDecayFunction2DCauchy(double decay_length_x, double decay_length_y, double gamma=0, double delta=Pi::PID2) +%feature("docstring") FTDecayFunction2DCauchy::FTDecayFunction2DCauchy "FTDecayFunction2DCauchy::FTDecayFunction2DCauchy(double decay_length_x, double decay_length_y, double gamma=0, double delta=M_PI_2) "; %feature("docstring") FTDecayFunction2DCauchy::clone "virtual FTDecayFunction2DCauchy* FTDecayFunction2DCauchy::clone() const @@ -4531,7 +4520,7 @@ Two-dimensional Gauss decay function in reciprocal space; corresponds to exp(-r^ C++ includes: FTDecayFunctions.h "; -%feature("docstring") FTDecayFunction2DGauss::FTDecayFunction2DGauss "FTDecayFunction2DGauss::FTDecayFunction2DGauss(double decay_length_x, double decay_length_y, double gamma=0, double delta=Pi::PID2) +%feature("docstring") FTDecayFunction2DGauss::FTDecayFunction2DGauss "FTDecayFunction2DGauss::FTDecayFunction2DGauss(double decay_length_x, double decay_length_y, double gamma=0, double delta=M_PI_2) "; %feature("docstring") FTDecayFunction2DGauss::clone "virtual FTDecayFunction2DGauss* FTDecayFunction2DGauss::clone() const @@ -4551,7 +4540,7 @@ Two-dimensional pseudo-Voigt decay function in reciprocal space; corresponds to C++ includes: FTDecayFunctions.h "; -%feature("docstring") FTDecayFunction2DVoigt::FTDecayFunction2DVoigt "FTDecayFunction2DVoigt::FTDecayFunction2DVoigt(double decay_length_x, double decay_length_y, double eta, double gamma=0, double delta=Pi::PID2) +%feature("docstring") FTDecayFunction2DVoigt::FTDecayFunction2DVoigt "FTDecayFunction2DVoigt::FTDecayFunction2DVoigt(double decay_length_x, double decay_length_y, double eta, double gamma=0, double delta=M_PI_2) "; %feature("docstring") FTDecayFunction2DVoigt::clone "virtual FTDecayFunction2DVoigt* FTDecayFunction2DVoigt::clone() const @@ -4700,7 +4689,7 @@ Two-dimensional Cauchy distribution in Fourier space; corresponds to a normalize C++ includes: FTDistributions2D.h "; -%feature("docstring") FTDistribution2DCauchy::FTDistribution2DCauchy "FTDistribution2DCauchy::FTDistribution2DCauchy(double coherence_length_x, double coherence_length_y, double gamma=0, double delta=Pi::PID2) +%feature("docstring") FTDistribution2DCauchy::FTDistribution2DCauchy "FTDistribution2DCauchy::FTDistribution2DCauchy(double coherence_length_x, double coherence_length_y, double gamma=0, double delta=M_PI_2) "; %feature("docstring") FTDistribution2DCauchy::clone "FTDistribution2DCauchy* FTDistribution2DCauchy::clone() const final @@ -4720,7 +4709,7 @@ Two-dimensional cone distribution in Fourier space; corresponds to 1-r if r<1 (a C++ includes: FTDistributions2D.h "; -%feature("docstring") FTDistribution2DCone::FTDistribution2DCone "FTDistribution2DCone::FTDistribution2DCone(double coherence_length_x, double coherence_length_y, double gamma=0, double delta=Pi::PID2) +%feature("docstring") FTDistribution2DCone::FTDistribution2DCone "FTDistribution2DCone::FTDistribution2DCone(double coherence_length_x, double coherence_length_y, double gamma=0, double delta=M_PI_2) "; %feature("docstring") FTDistribution2DCone::clone "FTDistribution2DCone* FTDistribution2DCone::clone() const final @@ -4740,7 +4729,7 @@ Two-dimensional gate distribution in Fourier space; corresponds to normalized co C++ includes: FTDistributions2D.h "; -%feature("docstring") FTDistribution2DGate::FTDistribution2DGate "FTDistribution2DGate::FTDistribution2DGate(double coherence_length_x, double coherence_length_y, double gamma=0, double delta=Pi::PID2) +%feature("docstring") FTDistribution2DGate::FTDistribution2DGate "FTDistribution2DGate::FTDistribution2DGate(double coherence_length_x, double coherence_length_y, double gamma=0, double delta=M_PI_2) "; %feature("docstring") FTDistribution2DGate::clone "FTDistribution2DGate* FTDistribution2DGate::clone() const final @@ -4760,7 +4749,7 @@ Two-dimensional Gauss distribution in Fourier space; corresponds to normalized e C++ includes: FTDistributions2D.h "; -%feature("docstring") FTDistribution2DGauss::FTDistribution2DGauss "FTDistribution2DGauss::FTDistribution2DGauss(double coherence_length_x, double coherence_length_y, double gamma=0, double delta=Pi::PID2) +%feature("docstring") FTDistribution2DGauss::FTDistribution2DGauss "FTDistribution2DGauss::FTDistribution2DGauss(double coherence_length_x, double coherence_length_y, double gamma=0, double delta=M_PI_2) "; %feature("docstring") FTDistribution2DGauss::clone "FTDistribution2DGauss* FTDistribution2DGauss::clone() const final @@ -4780,7 +4769,7 @@ Two-dimensional Voigt distribution in Fourier space; corresponds to eta*Gauss + C++ includes: FTDistributions2D.h "; -%feature("docstring") FTDistribution2DVoigt::FTDistribution2DVoigt "FTDistribution2DVoigt::FTDistribution2DVoigt(double coherence_length_x, double coherence_length_y, double eta, double gamma=0, double delta=Pi::PID2) +%feature("docstring") FTDistribution2DVoigt::FTDistribution2DVoigt "FTDistribution2DVoigt::FTDistribution2DVoigt(double coherence_length_x, double coherence_length_y, double eta, double gamma=0, double delta=M_PI_2) "; %feature("docstring") FTDistribution2DVoigt::clone "FTDistribution2DVoigt* FTDistribution2DVoigt::clone() const final @@ -4848,16 +4837,6 @@ Returns clone of the detector intensity map with detector resolution applied in Sets beam parameters from here (forwarded to Instrument) "; -%feature("docstring") GISASSimulation::setBeamIntensity "void GISASSimulation::setBeamIntensity(double intensity) - -Sets beam intensity from here (forwarded to Instrument) -"; - -%feature("docstring") GISASSimulation::setBeamPolarization "void GISASSimulation::setBeamPolarization(const kvector_t bloch_vector) - -Sets the beam polarization according to the given Bloch vector. -"; - %feature("docstring") GISASSimulation::setDetector "void GISASSimulation::setDetector(const IDetector2D &detector) Sets the detector (axes can be overwritten later) @@ -4897,21 +4876,6 @@ alpha_max: upper edge of last alpha-bin "; -%feature("docstring") GISASSimulation::setDetectorResolutionFunction "void GISASSimulation::setDetectorResolutionFunction(const IResolutionFunction2D &resolution_function) - -Define resolution function for detector. -"; - -%feature("docstring") GISASSimulation::removeDetectorResolutionFunction "void GISASSimulation::removeDetectorResolutionFunction() - -Removes detector resolution function. -"; - -%feature("docstring") GISASSimulation::setAnalyzerProperties "void GISASSimulation::setAnalyzerProperties(const kvector_t direction, double efficiency, double total_transmission=1.0) - -Sets the polarization analyzer characteristics of the detector. -"; - %feature("docstring") GISASSimulation::removeMasks "void GISASSimulation::removeMasks() removes all masks from the detector @@ -6046,9 +6010,7 @@ Sets reflection/transmission info. // File: classIFormFactorBorn.xml %feature("docstring") IFormFactorBorn " -Base class for Born form factors. In contrast to the generic IFormFactor, a Born form factor does not depend on the incoming and outgoing wave vectors ki and kf, except through their difference, the scattering vector q=ki-kf. - -NOTE: These class should be pure virtual; the functions evaluate and evaluatePol should be declared final; the functions clone, accept, evaluate_for_q, getRadialExtension should be =0 instead of having trivial implementations. HOWEVER, this seems to conflict with the inclusion of this class in Wrap/swig/directors.i, which in turn seems to be necessary for CustomFormFactor.py to work. +Pure virtual base class for Born form factors. In contrast to the generic IFormFactor, a Born form factor does not depend on the incoming and outgoing wave vectors ki and kf, except through their difference, the scattering vector q=ki-kf. C++ includes: IFormFactorBorn.h "; @@ -6059,36 +6021,21 @@ C++ includes: IFormFactorBorn.h %feature("docstring") IFormFactorBorn::~IFormFactorBorn "virtual IFormFactorBorn::~IFormFactorBorn() "; -%feature("docstring") IFormFactorBorn::clone "virtual IFormFactorBorn* IFormFactorBorn::clone() const +%feature("docstring") IFormFactorBorn::clone "virtual IFormFactorBorn* IFormFactorBorn::clone() const =0 Returns a clone of this ISample object. "; -%feature("docstring") IFormFactorBorn::accept "virtual void IFormFactorBorn::accept(ISampleVisitor *visitor) const - -Calls the ISampleVisitor's visit method. -"; - %feature("docstring") IFormFactorBorn::evaluate "complex_t IFormFactorBorn::evaluate(const WavevectorInfo &wavevectors) const Returns scattering amplitude for complex wavevectors ki, kf. "; -%feature("docstring") IFormFactorBorn::evaluatePol "Eigen::Matrix2cd IFormFactorBorn::evaluatePol(const WavevectorInfo &wavevectors) const - -Returns scattering amplitude for matrix interactions. -"; - -%feature("docstring") IFormFactorBorn::evaluate_for_q "complex_t IFormFactorBorn::evaluate_for_q(const cvector_t q) const +%feature("docstring") IFormFactorBorn::evaluate_for_q "virtual complex_t IFormFactorBorn::evaluate_for_q(const cvector_t q) const =0 Returns scattering amplitude for complex scattering wavevector q=k_i-k_f. "; -%feature("docstring") IFormFactorBorn::getRadialExtension "double IFormFactorBorn::getRadialExtension() const - -Returns the (approximate in some cases) radial size of the particle of this form factor's shape. This is used for SSCA calculations -"; - // File: classIFormFactorDecorator.xml %feature("docstring") IFormFactorDecorator " @@ -6167,7 +6114,7 @@ Interface for two-dimensional decay function in reciprocal space. C++ includes: FTDecayFunctions.h "; -%feature("docstring") IFTDecayFunction2D::IFTDecayFunction2D "IFTDecayFunction2D::IFTDecayFunction2D(double decay_length_x, double decay_length_y, double gamma=0, double delta=Pi::PID2) +%feature("docstring") IFTDecayFunction2D::IFTDecayFunction2D "IFTDecayFunction2D::IFTDecayFunction2D(double decay_length_x, double decay_length_y, double gamma=0, double delta=M_PI_2) "; %feature("docstring") IFTDecayFunction2D::clone "virtual IFTDecayFunction2D* IFTDecayFunction2D::clone() const =0 @@ -6243,7 +6190,7 @@ Interface for two-dimensional distributions in Fourier space. C++ includes: FTDistributions2D.h "; -%feature("docstring") IFTDistribution2D::IFTDistribution2D "IFTDistribution2D::IFTDistribution2D(double coherence_length_x, double coherence_length_y, double gamma=0, double delta=Pi::PID2) +%feature("docstring") IFTDistribution2D::IFTDistribution2D "IFTDistribution2D::IFTDistribution2D(double coherence_length_x, double coherence_length_y, double gamma=0, double delta=M_PI_2) "; %feature("docstring") IFTDistribution2D::clone "virtual IFTDistribution2D* IFTDistribution2D::clone() const =0 @@ -7632,7 +7579,7 @@ C++ includes: OutputDataWriteStrategy.h // File: classIParameter.xml %feature("docstring") IParameter " -Pure virtual base class for parameter wrapper classes RealParameter, ComponentParameter. Holds a pointer to the wrapped parameter, a name, and a callback function to be called when the parameter is changed. This class is templated on the data type of the wrapped parameter. +Pure virtual base class for parameter wrapper classes RealParameter, ComponentParameter. Holds a pointer to the wrapped parameter, a name, and a callback function to be called when the parameter is changed. This class is templated on the data type of the wrapped parameter. C++ includes: IParameter.h "; @@ -9583,16 +9530,6 @@ Returns clone of the detector intensity map in the form of 2D histogram. Sets beam parameters from here (forwarded to Instrument) "; -%feature("docstring") OffSpecSimulation::setBeamIntensity "void OffSpecSimulation::setBeamIntensity(double intensity) - -Sets beam intensity from here (forwarded to Instrument) -"; - -%feature("docstring") OffSpecSimulation::setBeamPolarization "void OffSpecSimulation::setBeamPolarization(const kvector_t bloch_vector) - -Sets the beam polarization according to the given Bloch vector. -"; - %feature("docstring") OffSpecSimulation::setDetectorParameters "void OffSpecSimulation::setDetectorParameters(const OutputData< double > &output_data) Sets detector parameters using axes of output data. @@ -9603,21 +9540,6 @@ Sets detector parameters using axes of output data. Sets detector parameters using angle ranges. "; -%feature("docstring") OffSpecSimulation::setDetectorResolutionFunction "void OffSpecSimulation::setDetectorResolutionFunction(const IResolutionFunction2D &resolution_function) - -Define resolution function for detector. -"; - -%feature("docstring") OffSpecSimulation::removeDetectorResolutionFunction "void OffSpecSimulation::removeDetectorResolutionFunction() - -Removes detector resolution function. -"; - -%feature("docstring") OffSpecSimulation::setAnalyzerProperties "void OffSpecSimulation::setAnalyzerProperties(const kvector_t direction, double efficiency, double total_transmission=1.0) - -Sets the polarization analyzer characteristics of the detector. -"; - %feature("docstring") OffSpecSimulation::addParametersToExternalPool "std::string OffSpecSimulation::addParametersToExternalPool(const std::string &path, ParameterPool *external_pool, int copy_number=-1) const final Adds parameters from local pool to external pool and recursively calls its direct children. @@ -11868,6 +11790,28 @@ Run simulation with possible averaging over parameter distributions. %feature("docstring") Simulation::getInstrument "Instrument& Simulation::getInstrument() "; +%feature("docstring") Simulation::setBeamIntensity "void Simulation::setBeamIntensity(double intensity) +"; + +%feature("docstring") Simulation::getBeamIntensity "double Simulation::getBeamIntensity() const +"; + +%feature("docstring") Simulation::setBeamPolarization "void Simulation::setBeamPolarization(const kvector_t bloch_vector) + +Sets the beam polarization according to the given Bloch vector. +"; + +%feature("docstring") Simulation::setDetectorResolutionFunction "void Simulation::setDetectorResolutionFunction(const IResolutionFunction2D &resolution_function) +"; + +%feature("docstring") Simulation::removeDetectorResolutionFunction "void Simulation::removeDetectorResolutionFunction() +"; + +%feature("docstring") Simulation::setAnalyzerProperties "void Simulation::setAnalyzerProperties(const kvector_t direction, double efficiency, double total_transmission=1.0) + +Sets the polarization analyzer characteristics of the detector. +"; + %feature("docstring") Simulation::setSample "void Simulation::setSample(const MultiLayer &sample) The MultiLayer object will not be owned by the Simulation object. @@ -12859,10 +12803,13 @@ C++ includes: WavevectorInfo.h // File: classMathFunctions_1_1Convolve_1_1Workspace.xml +// File: namespace_0D270.xml + + // File: namespace_0D302.xml -// File: namespace_0D425.xml +// File: namespace_0D423.xml // File: namespace_0D55.xml @@ -13190,9 +13137,6 @@ Parse double values from string to vector of double. "; -// File: namespacePi.xml - - // File: namespacePythonFormatting.xml %feature("docstring") PythonFormatting::representShape2D "BA_CORE_API_ std::string PythonFormatting::representShape2D(const std::string &indent, const Geometry::IShape2D *ishape, bool mask_value) @@ -13434,7 +13378,7 @@ Returns exp(I*z), where I is the imaginary unit. // File: Macros_8h.xml -// File: Pi_8h.xml +// File: MathConstants_8h.xml // File: Bin_8cpp.xml @@ -14300,12 +14244,6 @@ The mathematics implemented here is described in full detail in a paper by Joach // File: SpecularMatrix_8h.xml -// File: ComponentParameter_8cpp.xml - - -// File: ComponentParameter_8h.xml - - // File: DistributionHandler_8cpp.xml @@ -14798,74 +14736,77 @@ Creates a vector<double> as a wavevector with given wavelength and angles. Speci // File: WavevectorInfo_8h.xml -// File: dir_5f1a4a05eca575eab319839347bb4113.xml +// File: dir_52a2c863b7b3435f7dcd40f26828d521.xml + + +// File: dir_41e08c09ca0aab46c4ada92f12a8c00b.xml -// File: dir_f2db70b1039b2dc98a7a13a1758f382f.xml +// File: dir_4544cbc948815333bef1258cf6b298b8.xml -// File: dir_629bf8536959f2975d8caec326cd60c0.xml +// File: dir_d0c8f8fb9032c27878972645c4679f14.xml -// File: dir_7de90f35ae2a2c7b4fa95823d333cc96.xml +// File: dir_404b7d29693a4f046d60c2eccafd1df4.xml -// File: dir_c6310732a22f63c0c2fc5595561e68f1.xml +// File: dir_c83916cd1ff49c9e86c8a91c5655951d.xml -// File: dir_e5c18127747cd9d7214e02067b529d74.xml +// File: dir_59be1faf7048e95263c2fcba140abda1.xml -// File: dir_cca9b87b2505f372a6ce58947a507789.xml +// File: dir_e746abb3ff095e53619d5a61a48e781a.xml -// File: dir_4470199ae7eb44153ffe31d163ed0f28.xml +// File: dir_554fcc4911648c79d524724e80d45fa4.xml -// File: dir_05b265732c0b4c8e8dad02f2f774744b.xml +// File: dir_cc3c45a5d33be920aaf94cb9b9fbdb35.xml -// File: dir_72a38c5b455c03a72881c3c65e21783d.xml +// File: dir_9a756f0b2738ef3b5663c172b32b6a4b.xml -// File: dir_d7044b5fc4daccc5700de9f07da81a11.xml +// File: dir_e8bc32d0cf85ef86a42504cd31af1370.xml -// File: dir_602d2305564088eb1fd2ee9e74929d48.xml +// File: dir_8b890ad49a09d8f36525f5af93e5737c.xml -// File: dir_7f8c371d7d9c2d18aea541845cde06e7.xml +// File: dir_9bdb7f774cce5b77ddd3ed60472b168c.xml -// File: dir_24998d15d4ee11ef081e71321705b47b.xml +// File: dir_74beab5553c7ad06e27a6baadceea9c3.xml -// File: dir_0bf70e747e161ad6105733dd3b116e64.xml +// File: dir_bcc7f66c041cef9b775368068412e104.xml -// File: dir_c21740227f50b02f28bdacfb625f042a.xml +// File: dir_95667ae48b286f0957284f712e6e3af5.xml -// File: dir_d4e34ce36424db6c5895519defe19e58.xml +// File: dir_4251a3aefb390b6051267154c2f94d1e.xml -// File: dir_3a34810b9fbc1682c26e767b1a1a5860.xml +// File: dir_529c0a19338d84aadf389c7b83eb56b1.xml -// File: dir_6babb1605c026604526d064f820d612b.xml +// File: dir_051c0ff7ebc48614253af3001519ace0.xml -// File: dir_d7a24665a95cfc15308ebd7b07b5ebd6.xml +// File: dir_f59c6b3c978505a5ca3672a364c1918e.xml -// File: dir_bf872a709c84554e66a8525bb546523f.xml +// File: dir_871fae137308712382f6192f4445a900.xml -// File: dir_5d2259b43612a5a0ff7512df653d7370.xml +// File: dir_44b1a8f39c14c02f6e3c2be419aa97b0.xml -// File: dir_e120110860f9b345e7b3217e8b15cbb8.xml +// File: dir_1a0696269c107461a4ce8ff1a48cd2f2.xml -// File: dir_19cd2158bba3b9a051f8f27403820580.xml +// File: dir_7f288243cf9c204a176dfbf45ea9d349.xml diff --git a/auto/Wrap/doxygen_fit.i b/auto/Wrap/doxygen_fit.i index 8e9193af5905fbe9bf467ccbf0a11ae80b09c6bc..cc0c00a7fc418ee5afb43a4833c63a52c6595533 100644 --- a/auto/Wrap/doxygen_fit.i +++ b/auto/Wrap/doxygen_fit.i @@ -1,21 +1,6 @@ // File: index.xml -// File: classMinimizerLibrary_1_1AlgorithmInfo.xml -%feature("docstring") MinimizerLibrary::AlgorithmInfo " - -Provides description of minimization algorithm. - -C++ includes: MinimizerLibrary.h -"; - -%feature("docstring") MinimizerLibrary::AlgorithmInfo::AlgorithmInfo "MinimizerLibrary::AlgorithmInfo::AlgorithmInfo() -"; - -%feature("docstring") MinimizerLibrary::AlgorithmInfo::AlgorithmInfo "AlgorithmInfo::AlgorithmInfo(const std::string &algType, const std::string &algDescription) -"; - - // File: classAttributes.xml %feature("docstring") Attributes " @@ -42,9 +27,6 @@ The BasicMinimizer class is a base for all minimizers. C++ includes: BasicMinimizer.h "; -%feature("docstring") BasicMinimizer::BasicMinimizer "BasicMinimizer::BasicMinimizer(const std::string &minimizerName, const std::string &algorithmName=std::string()) -"; - %feature("docstring") BasicMinimizer::~BasicMinimizer "BasicMinimizer::~BasicMinimizer() "; @@ -53,27 +35,24 @@ C++ includes: BasicMinimizer.h run minimization "; -%feature("docstring") BasicMinimizer::getMinimizerName "std::string BasicMinimizer::getMinimizerName() const final +%feature("docstring") BasicMinimizer::minimizerName "std::string BasicMinimizer::minimizerName() const -return name of the minimizer +Returns name of the minimizer. "; -%feature("docstring") BasicMinimizer::getAlgorithmName "std::string BasicMinimizer::getAlgorithmName() const final +%feature("docstring") BasicMinimizer::algorithmName "std::string BasicMinimizer::algorithmName() const -return name of the minimization algorithm -"; - -%feature("docstring") BasicMinimizer::setAlgorithmName "void BasicMinimizer::setAlgorithmName(const std::string &algorithmName) +Returns name of the minimization algorithm. "; %feature("docstring") BasicMinimizer::setParameter "void BasicMinimizer::setParameter(size_t index, const FitParameter *par) + +Sets internal minimizer parameter. "; %feature("docstring") BasicMinimizer::setParameters "void BasicMinimizer::setParameters(const FitSuiteParameters ¶meters) -Sets internal minimizer parameter. - -Sets internal minimizer parameters using external parameter list +Sets internal minimizer parameters using external parameter list. "; %feature("docstring") BasicMinimizer::setChiSquaredFunction "void BasicMinimizer::setChiSquaredFunction(function_chi2_t fun_chi2, size_t nparameters) @@ -86,16 +65,9 @@ Sets chi squared function to minimize. Sets gradient function to minimize. "; -%feature("docstring") BasicMinimizer::getNumberOfVariables "size_t BasicMinimizer::getNumberOfVariables() const - -Returns number of variables to fit. -"; - %feature("docstring") BasicMinimizer::getValueOfVariablesAtMinimum "std::vector< double > BasicMinimizer::getValueOfVariablesAtMinimum() const -Returns minimum function value. - -Returns values of parameters at the minimum +Returns values of parameters at the minimum. "; %feature("docstring") BasicMinimizer::getErrorOfVariables "std::vector< double > BasicMinimizer::getErrorOfVariables() const @@ -103,82 +75,35 @@ Returns values of parameters at the minimum Returns errors of variables at minimum. "; -%feature("docstring") BasicMinimizer::printResults "void BasicMinimizer::printResults() const - -clear resources (parameters) for consecutives minimizations - -Prints fit results -"; - -%feature("docstring") BasicMinimizer::toResultString "std::string BasicMinimizer::toResultString() const -"; - -%feature("docstring") BasicMinimizer::isGradientBasedAgorithm "virtual bool BasicMinimizer::isGradientBasedAgorithm() - -Returns true if type of algorithm is Levenberg-Marquardt or similar. -"; - - -// File: classMinimizerLibrary_1_1Catalogue.xml -%feature("docstring") MinimizerLibrary::Catalogue ""; - -%feature("docstring") MinimizerLibrary::Catalogue::Catalogue "Catalogue::Catalogue() - -Catalogue constructor fills in all information related to available minimizers/algorithms. -"; - -%feature("docstring") MinimizerLibrary::Catalogue::addMinimizer "void Catalogue::addMinimizer(const MinimizerInfo &minimizer) - -Adds minimizer info to the catalogue. -"; - -%feature("docstring") MinimizerLibrary::Catalogue::algorithmTypes "std::list< std::string > Catalogue::algorithmTypes(const std::string &minimizerType) - -Returns list of algorithm types for given minimizer type. -"; - -%feature("docstring") MinimizerLibrary::Catalogue::algorithmDescriptions "std::list< std::string > Catalogue::algorithmDescriptions(const std::string &minimizerType) - -Returns list of algorithm descriptions for given minimizer type. -"; - - -// File: classConfigurable.xml -%feature("docstring") Configurable " - -A base class for storing (int,double,string) options. +%feature("docstring") BasicMinimizer::reportResults "std::string BasicMinimizer::reportResults() const -C++ includes: Configurable.h +Prints fit results. "; -%feature("docstring") Configurable::Configurable "Configurable::Configurable() +%feature("docstring") BasicMinimizer::options "MinimizerOptions& BasicMinimizer::options() "; -%feature("docstring") Configurable::Configurable "Configurable::Configurable(const Configurable &other) - -Returns true if option with such name already exists. +%feature("docstring") BasicMinimizer::options "const MinimizerOptions& BasicMinimizer::options() const "; -%feature("docstring") Configurable::addOption "Configurable::option_t Configurable::addOption(const std::string &optionName, T value, const std::string &description=std::string()) -"; +%feature("docstring") BasicMinimizer::statusToString "std::string BasicMinimizer::statusToString() const -%feature("docstring") Configurable::option "Configurable::option_t Configurable::option(const std::string &optionName) +Returns string representation of current minimizer status. "; -%feature("docstring") Configurable::option "const Configurable::option_t Configurable::option(const std::string &optionName) const -"; +%feature("docstring") BasicMinimizer::providesError "bool BasicMinimizer::providesError() const -%feature("docstring") Configurable::optionValue "T Configurable::optionValue(const std::string &optionName) const +Returns true if minimizer provides error and error matrix. "; -%feature("docstring") Configurable::setOptionValue "void Configurable::setOptionValue(const std::string &optionName, T value) +%feature("docstring") BasicMinimizer::statusMap "std::map< std::string, std::string > BasicMinimizer::statusMap() const -Sets the value of option. Option should hold same value type already. +Returns map of string representing different minimizer statuses. "; -%feature("docstring") Configurable::toOptionString "std::string Configurable::toOptionString(const std::string &delimeter=\";\") const +%feature("docstring") BasicMinimizer::propagateResults "void BasicMinimizer::propagateResults(FitSuiteParameters ¶meters) -Returns string with all options using given delimeter. +Propagates results of minimization to fit parameter set. "; @@ -202,6 +127,9 @@ C++ includes: FitParameter.h %feature("docstring") FitParameter::getName "std::string FitParameter::getName() const "; +%feature("docstring") FitParameter::getStartValue "virtual double FitParameter::getStartValue() const +"; + %feature("docstring") FitParameter::setValue "virtual void FitParameter::setValue(double value) "; @@ -220,6 +148,9 @@ C++ includes: FitParameter.h %feature("docstring") FitParameter::getError "double FitParameter::getError() const "; +%feature("docstring") FitParameter::limitsToString "std::string FitParameter::limitsToString() const +"; + // File: classFitSuiteParameters.xml %feature("docstring") FitSuiteParameters " @@ -250,6 +181,9 @@ Adds fit parameter. Returns all parameters. "; +%feature("docstring") FitSuiteParameters::getFitParameters "const std::vector<FitParameter*>& FitSuiteParameters::getFitParameters() const +"; + %feature("docstring") FitSuiteParameters::getFitParameter "const FitParameter * FitSuiteParameters::getFitParameter(const std::string &name) const Returns fit parameter with given name. @@ -332,354 +266,414 @@ Set fixed flag for parameters from the list. Returns true if parameters already have the given values. "; - -// File: classIMinimizer.xml -%feature("docstring") IMinimizer " - -Common interface for all kind minimizers. - -C++ includes: IMinimizer.h +%feature("docstring") FitSuiteParameters::reportResults "std::string FitSuiteParameters::reportResults() const "; -%feature("docstring") IMinimizer::IMinimizer "IMinimizer::IMinimizer() +%feature("docstring") FitSuiteParameters::correlationMatrix "corr_matrix_t FitSuiteParameters::correlationMatrix() const "; -%feature("docstring") IMinimizer::~IMinimizer "virtual IMinimizer::~IMinimizer() +%feature("docstring") FitSuiteParameters::setCorrelationMatrix "void FitSuiteParameters::setCorrelationMatrix(const corr_matrix_t &matrix) "; -%feature("docstring") IMinimizer::minimize "virtual void IMinimizer::minimize()=0 - -run minimization -"; -%feature("docstring") IMinimizer::setParameters "virtual void IMinimizer::setParameters(const FitSuiteParameters ¶meters)=0 +// File: classGeneticMinimizer.xml +%feature("docstring") GeneticMinimizer " -Sets internal minimizer parameter. +Wrapper for ROOT Genetic minimizer. -Sets internal minimizer parameters using external parameter list +C++ includes: GeneticMinimizer.h "; -%feature("docstring") IMinimizer::setChiSquaredFunction "virtual void IMinimizer::setChiSquaredFunction(function_chi2_t fun_chi2, size_t nparameters)=0 - -Sets chi squared function to minimize. +%feature("docstring") GeneticMinimizer::GeneticMinimizer "GeneticMinimizer::GeneticMinimizer() "; -%feature("docstring") IMinimizer::setGradientFunction "virtual void IMinimizer::setGradientFunction(function_gradient_t fun_gradient, size_t nparameters, size_t ndatasize)=0 +%feature("docstring") GeneticMinimizer::~GeneticMinimizer "GeneticMinimizer::~GeneticMinimizer() -Sets gradient function to minimize. +Sets tolerance on the function value at the minimum. Minimization will stop when the estimated vertical distance to the minimum (EDM) is less than 0.001*tolerance*ErrorDef. Here ErrorDef=1.0 for chi squared fit and ErrorDef=0.5 for negative log likelihood fit. Default value is 0.01. "; -%feature("docstring") IMinimizer::getNumberOfVariables "virtual size_t IMinimizer::getNumberOfVariables() const =0 - -Returns number of variables to fit. +%feature("docstring") GeneticMinimizer::setTolerance "void GeneticMinimizer::setTolerance(double value) "; -%feature("docstring") IMinimizer::getValueOfVariablesAtMinimum "virtual std::vector<double> IMinimizer::getValueOfVariablesAtMinimum() const =0 - -Returns minimum function value. - -Returns values of parameters at the minimum +%feature("docstring") GeneticMinimizer::tolerance "double GeneticMinimizer::tolerance() const "; -%feature("docstring") IMinimizer::getErrorOfVariables "virtual std::vector<double> IMinimizer::getErrorOfVariables() const =0 +%feature("docstring") GeneticMinimizer::setPrintLevel "void GeneticMinimizer::setPrintLevel(int value) -Returns errors of variables at minimum. +Sets minimizer internal print level. Default value is 0 (silent). "; -%feature("docstring") IMinimizer::printResults "virtual void IMinimizer::printResults() const =0 +%feature("docstring") GeneticMinimizer::printLevel "int GeneticMinimizer::printLevel() const +"; -clear resources (parameters) for consecutives minimizations +%feature("docstring") GeneticMinimizer::setMaxIterations "void GeneticMinimizer::setMaxIterations(int value) -Prints fit results +Sets maximum number of iterations to try at each step. Default values is 3. "; -%feature("docstring") IMinimizer::getNCalls "virtual size_t IMinimizer::getNCalls() const - -Returns number of calls of minimized function. +%feature("docstring") GeneticMinimizer::maxIterations "int GeneticMinimizer::maxIterations() const "; -%feature("docstring") IMinimizer::getOptions "virtual MinimizerOptions* IMinimizer::getOptions() +%feature("docstring") GeneticMinimizer::setPopulationSize "void GeneticMinimizer::setPopulationSize(int value) -return minimizer options +Sets population size. Default value is 300. "; -%feature("docstring") IMinimizer::getOptions "virtual const MinimizerOptions* IMinimizer::getOptions() const +%feature("docstring") GeneticMinimizer::populationSize "int GeneticMinimizer::populationSize() const "; -%feature("docstring") IMinimizer::setOptions "virtual void IMinimizer::setOptions(const MinimizerOptions &) +%feature("docstring") GeneticMinimizer::setRandomSeed "void GeneticMinimizer::setRandomSeed(int value) -set minimizer options +Sets random seed. Default value is 0. "; -%feature("docstring") IMinimizer::setOptionString "virtual void IMinimizer::setOptionString(const std::string &) - -set minimizer option string +%feature("docstring") GeneticMinimizer::randomSeed "int GeneticMinimizer::randomSeed() const "; -%feature("docstring") IMinimizer::isGradientBasedAgorithm "virtual bool IMinimizer::isGradientBasedAgorithm() +%feature("docstring") GeneticMinimizer::setParameter "void GeneticMinimizer::setParameter(size_t index, const FitParameter *par) -Returns true if type of algorithm is Levenberg-Marquardt or similar. +Sets minimizer parameter. Overload is required to check that parameter is properly limited. "; -%feature("docstring") IMinimizer::getMinimizerName "virtual std::string IMinimizer::getMinimizerName() const =0 +%feature("docstring") GeneticMinimizer::statusToString "std::string GeneticMinimizer::statusToString() const -return name of the minimizer +Returns string representation of current minimizer status. "; -%feature("docstring") IMinimizer::getAlgorithmName "virtual std::string IMinimizer::getAlgorithmName() const =0 +%feature("docstring") GeneticMinimizer::statusMap "std::map< std::string, std::string > GeneticMinimizer::statusMap() const -return name of the minimization algorithm +Returns map of string representing different minimizer statuses. "; -// File: classMinimizerLibrary_1_1InfoItem.xml -%feature("docstring") MinimizerLibrary::InfoItem " +// File: classGSLLevenbergMarquardtMinimizer.xml +%feature("docstring") GSLLevenbergMarquardtMinimizer " -Simple item to hold the name and the description. +Wrapper for GSL Levenberg-Marquardt minimizer. http://www.gnu.org/software/gsl/manual/html_node/Nonlinear-Least_002dSquares-Fitting.html. -C++ includes: MinimizerLibrary.h +C++ includes: GSLLevenbergMarquardtMinimizer.h "; -%feature("docstring") MinimizerLibrary::InfoItem::InfoItem "MinimizerLibrary::InfoItem::InfoItem() +%feature("docstring") GSLLevenbergMarquardtMinimizer::GSLLevenbergMarquardtMinimizer "GSLLevenbergMarquardtMinimizer::GSLLevenbergMarquardtMinimizer() "; -%feature("docstring") MinimizerLibrary::InfoItem::InfoItem "MinimizerLibrary::InfoItem::InfoItem(const std::string &itemType, const std::string &itemDescription) +%feature("docstring") GSLLevenbergMarquardtMinimizer::~GSLLevenbergMarquardtMinimizer "GSLLevenbergMarquardtMinimizer::~GSLLevenbergMarquardtMinimizer() + +Sets tolerance on the function value at the minimum. Default value is 0.01. "; -%feature("docstring") MinimizerLibrary::InfoItem::getType "std::string MinimizerLibrary::InfoItem::getType() const +%feature("docstring") GSLLevenbergMarquardtMinimizer::setTolerance "void GSLLevenbergMarquardtMinimizer::setTolerance(double value) "; -%feature("docstring") MinimizerLibrary::InfoItem::getDescription "std::string MinimizerLibrary::InfoItem::getDescription() const +%feature("docstring") GSLLevenbergMarquardtMinimizer::tolerance "double GSLLevenbergMarquardtMinimizer::tolerance() const "; +%feature("docstring") GSLLevenbergMarquardtMinimizer::setPrintLevel "void GSLLevenbergMarquardtMinimizer::setPrintLevel(int value) -// File: classMSG_1_1Logger.xml -%feature("docstring") MSG::Logger " - -Provides message service. +Sets minimizer internal print level. Default value is 0 (silent). +"; -C++ includes: Logger.h +%feature("docstring") GSLLevenbergMarquardtMinimizer::printLevel "int GSLLevenbergMarquardtMinimizer::printLevel() const "; -%feature("docstring") MSG::Logger::Logger "MSG::Logger::Logger(EMessageLevel level) +%feature("docstring") GSLLevenbergMarquardtMinimizer::setMaxIterations "void GSLLevenbergMarquardtMinimizer::setMaxIterations(int value) + +Sets maximum number of iterations. This is an internal minimizer setting which has no direct relation to the number of objective function calls (e.g. numberOfIteraction=5 might correspond to ~100 objective function calls). "; -%feature("docstring") MSG::Logger::~Logger "MSG::Logger::~Logger() +%feature("docstring") GSLLevenbergMarquardtMinimizer::maxIterations "int GSLLevenbergMarquardtMinimizer::maxIterations() const "; -%feature("docstring") MSG::Logger::NowTime "std::string MSG::Logger::NowTime() +%feature("docstring") GSLLevenbergMarquardtMinimizer::statusToString "std::string GSLLevenbergMarquardtMinimizer::statusToString() const + +Returns string representation of current minimizer status. "; -%feature("docstring") MSG::Logger::ToString "const std::string & MSG::Logger::ToString(EMessageLevel level) +%feature("docstring") GSLLevenbergMarquardtMinimizer::statusMap "std::map< std::string, std::string > GSLLevenbergMarquardtMinimizer::statusMap() const + +Returns map of string representing different minimizer statuses. "; -// File: classMinimizerCatalogue.xml -%feature("docstring") MinimizerCatalogue " +// File: classGSLMultiMinimizer.xml +%feature("docstring") GSLMultiMinimizer " -Map of minimizer names holding list of defined algorithms for every minimizer. -"; +Wrapper for GSL multi minimizer (gradient descent based) family. -%feature("docstring") MinimizerCatalogue::MinimizerCatalogue "MinimizerCatalogue::MinimizerCatalogue() +C++ includes: GSLMultiMinimizer.h "; -%feature("docstring") MinimizerCatalogue::begin "const_iterator MinimizerCatalogue::begin() const +%feature("docstring") GSLMultiMinimizer::GSLMultiMinimizer "GSLMultiMinimizer::GSLMultiMinimizer(const std::string &algorithmName=AlgorithmNames::ConjugateFR) "; -%feature("docstring") MinimizerCatalogue::end "const_iterator MinimizerCatalogue::end() const +%feature("docstring") GSLMultiMinimizer::~GSLMultiMinimizer "GSLMultiMinimizer::~GSLMultiMinimizer() "; -%feature("docstring") MinimizerCatalogue::isValid "bool MinimizerCatalogue::isValid(const std::string &minimizer, const std::string &algorithm) const +%feature("docstring") GSLMultiMinimizer::setPrintLevel "void GSLMultiMinimizer::setPrintLevel(int value) + +Sets minimizer internal print level. Default value is 0 (silent). "; +%feature("docstring") GSLMultiMinimizer::printLevel "int GSLMultiMinimizer::printLevel() const +"; -// File: classMinimizerFactory.xml -%feature("docstring") MinimizerFactory " +%feature("docstring") GSLMultiMinimizer::setMaxIterations "void GSLMultiMinimizer::setMaxIterations(int value) -Factory to create minimizers. +Sets maximum number of iterations. This is an internal minimizer setting which has no direct relation to the number of objective function calls (e.g. numberOfIteraction=5 might correspond to ~100 objective function calls). +"; -C++ includes: MinimizerFactory.h +%feature("docstring") GSLMultiMinimizer::maxIterations "int GSLMultiMinimizer::maxIterations() const "; +%feature("docstring") GSLMultiMinimizer::statusToString "std::string GSLMultiMinimizer::statusToString() const + +Returns string representation of current minimizer status. +"; -// File: classMinimizerLibrary_1_1MinimizerInfo.xml -%feature("docstring") MinimizerLibrary::MinimizerInfo " -Provides info about the minimizer, including list of defined minimization algorithms. +// File: classIMinimizer.xml +%feature("docstring") IMinimizer " -Holds all information about available minimization engines. +Common interface for all kind minimizer's. -C++ includes: MinimizerLibrary.h +C++ includes: IMinimizer.h "; -%feature("docstring") MinimizerLibrary::MinimizerInfo::MinimizerInfo "MinimizerLibrary::MinimizerInfo::MinimizerInfo() +%feature("docstring") IMinimizer::IMinimizer "IMinimizer::IMinimizer() "; -%feature("docstring") MinimizerLibrary::MinimizerInfo::MinimizerInfo "MinimizerInfo::MinimizerInfo(const std::string &minimizerType, const std::string &minimizerDescription) +%feature("docstring") IMinimizer::~IMinimizer "virtual IMinimizer::~IMinimizer() "; -%feature("docstring") MinimizerLibrary::MinimizerInfo::addAlgorithm "void MinimizerInfo::addAlgorithm(const AlgorithmInfo &algorithm) +%feature("docstring") IMinimizer::minimizerName "std::string IMinimizer::minimizerName() const + +return name of the minimizer "; -%feature("docstring") MinimizerLibrary::MinimizerInfo::addAlgorithm "void MinimizerInfo::addAlgorithm(const std::string &algorithmName, const std::string &algorithmDescription) +%feature("docstring") IMinimizer::algorithmName "std::string IMinimizer::algorithmName() const + +return name of the minimization algorithm "; -%feature("docstring") MinimizerLibrary::MinimizerInfo::algorithmTypes "std::list< std::string > MinimizerInfo::algorithmTypes() const +%feature("docstring") IMinimizer::minimize "void IMinimizer::minimize() -Return list of algorithm types. +run minimization "; -%feature("docstring") MinimizerLibrary::MinimizerInfo::algorithmDescriptions "std::list< std::string > MinimizerInfo::algorithmDescriptions() const +%feature("docstring") IMinimizer::setParameter "void IMinimizer::setParameter(size_t index, const FitParameter *par) -Returns list of string with description of all available algorithms. +Sets internal minimizer parameter. "; +%feature("docstring") IMinimizer::setParameters "void IMinimizer::setParameters(const FitSuiteParameters ¶meters) -// File: classMinimizerOption.xml -%feature("docstring") MinimizerOption " +Sets internal minimizer parameters using external parameter list. +"; -The MinimizerOption class is intended to store a single option for minimization algorithm. Int, double, string values are available. Relies on https://github.com/mapbox/variant, will be switched to std::variant in C++-17. +%feature("docstring") IMinimizer::setChiSquaredFunction "void IMinimizer::setChiSquaredFunction(function_chi2_t fun_chi2, size_t nparameters) -C++ includes: MinimizerOption.h +Sets chi squared function to minimize. "; -%feature("docstring") MinimizerOption::MinimizerOption "MinimizerOption::MinimizerOption(const std::string &name=std::string()) +%feature("docstring") IMinimizer::setGradientFunction "void IMinimizer::setGradientFunction(function_gradient_t fun_gradient, size_t nparameters, size_t ndatasize) + +Sets gradient function to minimize. "; -%feature("docstring") MinimizerOption::MinimizerOption "MinimizerOption::MinimizerOption(const std::string &name, const T &t, const std::string &descripion=std::string()) +%feature("docstring") IMinimizer::getNumberOfVariables "size_t IMinimizer::getNumberOfVariables() const + +Returns number of variables to fit. "; -%feature("docstring") MinimizerOption::name "std::string MinimizerOption::name() const +%feature("docstring") IMinimizer::getMinValue "double IMinimizer::getMinValue() const + +Returns minimum function value. "; -%feature("docstring") MinimizerOption::description "std::string MinimizerOption::description() const +%feature("docstring") IMinimizer::getValueOfVariableAtMinimum "double IMinimizer::getValueOfVariableAtMinimum(size_t index) const + +Returns value of the parameter at the minimum. "; -%feature("docstring") MinimizerOption::setDescription "void MinimizerOption::setDescription(const std::string &description) +%feature("docstring") IMinimizer::getValueOfVariablesAtMinimum "std::vector< double > IMinimizer::getValueOfVariablesAtMinimum() const + +Returns values of parameters at the minimum. "; -%feature("docstring") MinimizerOption::value "MinimizerOption::variant_t & MinimizerOption::value() +%feature("docstring") IMinimizer::getErrorOfVariable "double IMinimizer::getErrorOfVariable(size_t index) const + +Returns error of variable at minimum. "; -%feature("docstring") MinimizerOption::defaultValue "MinimizerOption::variant_t & MinimizerOption::defaultValue() +%feature("docstring") IMinimizer::getErrorOfVariables "std::vector< double > IMinimizer::getErrorOfVariables() const + +Returns errors of variables at minimum. "; -%feature("docstring") MinimizerOption::get "T MinimizerOption::get() const +%feature("docstring") IMinimizer::clear "void IMinimizer::clear() -Returns the option's value. +clear resources (parameters) for consecutives minimizations "; -%feature("docstring") MinimizerOption::getDefault "T MinimizerOption::getDefault() const +%feature("docstring") IMinimizer::reportResults "std::string IMinimizer::reportResults() const -Returns the option's default value (i.e. used during construction) +Prints fit results. "; +%feature("docstring") IMinimizer::propagateResults "void IMinimizer::propagateResults(FitSuiteParameters ¶meters) -// File: classMinimizerOptions.xml -%feature("docstring") MinimizerOptions " +Propagates results of minimization to fit parameter set. +"; -The MinimizerOptions class contains options for minimization algorithms. -It allows to set values only if they have been already registered. +// File: classInfoItem.xml +%feature("docstring") InfoItem " -C++ includes: MinimizerOptions.h +Simple item to hold the name and the description. + +C++ includes: MinimizerInfo.h "; -%feature("docstring") MinimizerOptions::MinimizerOptions "MinimizerOptions::MinimizerOptions() +%feature("docstring") InfoItem::InfoItem "InfoItem::InfoItem() "; -%feature("docstring") MinimizerOptions::~MinimizerOptions "MinimizerOptions::~MinimizerOptions() +%feature("docstring") InfoItem::InfoItem "InfoItem::InfoItem(const std::string &itemName, const std::string &itemDescription) "; -%feature("docstring") MinimizerOptions::getTolerance "double MinimizerOptions::getTolerance() const +%feature("docstring") InfoItem::name "std::string InfoItem::name() const +"; -return minimizer tolerance +%feature("docstring") InfoItem::description "std::string InfoItem::description() const "; -%feature("docstring") MinimizerOptions::setTolerance "void MinimizerOptions::setTolerance(double tolerance) -set minimizer tolerance -"; +// File: classMSG_1_1Logger.xml +%feature("docstring") MSG::Logger " -%feature("docstring") MinimizerOptions::getPrecision "double MinimizerOptions::getPrecision() const +Provides message service. -return minimizer precision +C++ includes: Logger.h "; -%feature("docstring") MinimizerOptions::setPrecision "void MinimizerOptions::setPrecision(double precision) +%feature("docstring") MSG::Logger::Logger "MSG::Logger::Logger(EMessageLevel level) +"; -set minimizer precision +%feature("docstring") MSG::Logger::~Logger "MSG::Logger::~Logger() "; -%feature("docstring") MinimizerOptions::getMaxIterations "int MinimizerOptions::getMaxIterations() const +%feature("docstring") MSG::Logger::NowTime "std::string MSG::Logger::NowTime() +"; -return maximum number of allowed iterations +%feature("docstring") MSG::Logger::ToString "const std::string & MSG::Logger::ToString(EMessageLevel level) "; -%feature("docstring") MinimizerOptions::setMaxIterations "void MinimizerOptions::setMaxIterations(int max_iterations) -set maximum number of allowed iterations +// File: classMinimizerCatalogue.xml +%feature("docstring") MinimizerCatalogue " + +The MinimizerCatalogue class contains information over all minimizers available. + +C++ includes: MinimizerCatalogue.h "; -%feature("docstring") MinimizerOptions::getMaxFunctionCalls "int MinimizerOptions::getMaxFunctionCalls() const +%feature("docstring") MinimizerCatalogue::MinimizerCatalogue "MinimizerCatalogue::MinimizerCatalogue() +"; + +%feature("docstring") MinimizerCatalogue::toString "std::string MinimizerCatalogue::toString() const -return maximum number of allowed function calls +Returns multiline string representing catalogue content. "; -%feature("docstring") MinimizerOptions::setMaxFunctionCalls "void MinimizerOptions::setMaxFunctionCalls(int max_function_calls) +%feature("docstring") MinimizerCatalogue::algorithmNames "std::vector< std::string > MinimizerCatalogue::algorithmNames(const std::string &minimizerName) const -set maximum number of allowed function calls +Returns list of algorithms defined for the minimizer with a given name. "; -%feature("docstring") MinimizerOptions::getPrintLevel "int MinimizerOptions::getPrintLevel() const +%feature("docstring") MinimizerCatalogue::algorithmDescriptions "std::vector< std::string > MinimizerCatalogue::algorithmDescriptions(const std::string &minimizerName) const -return internal print level of the minimizer +Returns list of algorithm's descriptions for the minimizer with a given name . "; -%feature("docstring") MinimizerOptions::setPrintLevel "void MinimizerOptions::setPrintLevel(int print_level) -set internal print level of the minimizer +// File: classMinimizerFactory.xml +%feature("docstring") MinimizerFactory " + +Factory to create minimizers. + +Minimizer | Algorithms + +Minuit2 | Migrad Simplex Combined Scan Fumili GSLMultiMin | SteepestDescent ConjugateFR ConjugatePR BFGS BFGS2 GSLLMA | Default GSLSimAn | Default Genetic | Default + +C++ includes: MinimizerFactory.h "; -%feature("docstring") MinimizerOptions::setValue "void MinimizerOptions::setValue(const std::string &name, double val) -set option value +// File: classMinimizerInfo.xml +%feature("docstring") MinimizerInfo " + +The MinimizerInfo class provides info about the minimizer, including list of defined minimization algorithms. + +C++ includes: MinimizerInfo.h "; -%feature("docstring") MinimizerOptions::setValue "void MinimizerOptions::setValue(const std::string &name, int val) +%feature("docstring") MinimizerInfo::MinimizerInfo "MinimizerInfo::MinimizerInfo() "; -%feature("docstring") MinimizerOptions::setValue "void MinimizerOptions::setValue(const std::string &name, const std::string &val) +%feature("docstring") MinimizerInfo::MinimizerInfo "MinimizerInfo::MinimizerInfo(const std::string &minimizerType, const std::string &minimizerDescription) "; -%feature("docstring") MinimizerOptions::getValue "void MinimizerOptions::getValue(const std::string &name, int &val) +%feature("docstring") MinimizerInfo::setAlgorithmName "void MinimizerInfo::setAlgorithmName(const std::string &algorithmName) + +Sets currently active algorithm. "; -%feature("docstring") MinimizerOptions::getValue "void MinimizerOptions::getValue(const std::string &name, double &val) +%feature("docstring") MinimizerInfo::algorithmName "std::string MinimizerInfo::algorithmName() const "; -%feature("docstring") MinimizerOptions::getValue "void MinimizerOptions::getValue(const std::string &name, std::string &val) +%feature("docstring") MinimizerInfo::algorithmNames "std::vector< std::string > MinimizerInfo::algorithmNames() const + +Return list of defined algorithm names. "; -%feature("docstring") MinimizerOptions::addValue "void MinimizerOptions::addValue(const std::string &name, double val) +%feature("docstring") MinimizerInfo::algorithmDescriptions "std::vector< std::string > MinimizerInfo::algorithmDescriptions() const + +Returns list of string with description of all available algorithms. "; -%feature("docstring") MinimizerOptions::addValue "void MinimizerOptions::addValue(const std::string &name, int val) + +// File: classMinimizerOptions.xml +%feature("docstring") MinimizerOptions " + +The MinimizerOptions class holds collection of internal minimizer settings. + +C++ includes: MinimizerOptions.h "; -%feature("docstring") MinimizerOptions::addValue "void MinimizerOptions::addValue(const std::string &name, const std::string &val) +%feature("docstring") MinimizerOptions::toOptionString "std::string MinimizerOptions::toOptionString(const std::string &delimeter=\";\") const + +Returns string with all options using given delimeter. "; -%feature("docstring") MinimizerOptions::getIntValue "int MinimizerOptions::getIntValue(const std::string &name) + +// File: classMinimizerResultsHelper.xml +%feature("docstring") MinimizerResultsHelper " + +The MinimizerResultsHelper class contains all logic to generate reports with the result of minimization. + +C++ includes: MinimizerResultsHelper.h "; -%feature("docstring") MinimizerOptions::getRealValue "double MinimizerOptions::getRealValue(const std::string &name) +%feature("docstring") MinimizerResultsHelper::MinimizerResultsHelper "MinimizerResultsHelper::MinimizerResultsHelper() "; -%feature("docstring") MinimizerOptions::getNamedValue "std::string MinimizerOptions::getNamedValue(const std::string &name) +%feature("docstring") MinimizerResultsHelper::reportResults "std::string MinimizerResultsHelper::reportResults(const BasicMinimizer *minimizer) const + +Reports results of minimization in the form of multi-line string. "; -%feature("docstring") MinimizerOptions::print "void MinimizerOptions::print() const +%feature("docstring") MinimizerResultsHelper::reportResults "std::string MinimizerResultsHelper::reportResults(const FitSuiteParameters *parameters) const + +Reports fit parameters settings and final results. "; @@ -691,7 +685,7 @@ The Minuit2Minimizer class is a wrapper for ROOT Minuit2 minimizer See Minuit2 C++ includes: Minuit2Minimizer.h "; -%feature("docstring") Minuit2Minimizer::Minuit2Minimizer "Minuit2Minimizer::Minuit2Minimizer() +%feature("docstring") Minuit2Minimizer::Minuit2Minimizer "Minuit2Minimizer::Minuit2Minimizer(const std::string &algorithmName=AlgorithmNames::Migrad) "; %feature("docstring") Minuit2Minimizer::~Minuit2Minimizer "Minuit2Minimizer::~Minuit2Minimizer() @@ -737,225 +731,183 @@ Sets minimizer internal print level. Default value is 0 (silent). %feature("docstring") Minuit2Minimizer::printLevel "int Minuit2Minimizer::printLevel() const "; +%feature("docstring") Minuit2Minimizer::setMaxFunctionCalls "void Minuit2Minimizer::setMaxFunctionCalls(int value) -// File: classRealLimits.xml -%feature("docstring") RealLimits " - -Limits for a real fit parameter. - -C++ includes: RealLimits.h +Sets maximum number of objective function calls. "; -%feature("docstring") RealLimits::RealLimits "RealLimits::RealLimits() +%feature("docstring") Minuit2Minimizer::maxFunctionCalls "int Minuit2Minimizer::maxFunctionCalls() const "; -%feature("docstring") RealLimits::hasLowerLimit "bool RealLimits::hasLowerLimit() const +%feature("docstring") Minuit2Minimizer::statusToString "std::string Minuit2Minimizer::statusToString() const -if has lower limit +Returns string representation of current minimizer status. "; -%feature("docstring") RealLimits::getLowerLimit "double RealLimits::getLowerLimit() const +%feature("docstring") Minuit2Minimizer::statusMap "std::map< std::string, std::string > Minuit2Minimizer::statusMap() const -Returns lower limit. +Returns map of string representing different minimizer statuses. "; -%feature("docstring") RealLimits::setLowerLimit "void RealLimits::setLowerLimit(double value) -Sets lower limit. -"; +// File: classMultiOption.xml +%feature("docstring") MultiOption " -%feature("docstring") RealLimits::removeLowerLimit "void RealLimits::removeLowerLimit() +The MultiOption class is intended to store a single option for minimization algorithm. Int, double, string values are available. Relies on boost::variant, will be switched to std::variant in C++-17. (before was https://github.com/mapbox/variant. -remove lower limit +C++ includes: MultiOption.h "; -%feature("docstring") RealLimits::hasUpperLimit "bool RealLimits::hasUpperLimit() const - -if has upper limit +%feature("docstring") MultiOption::MultiOption "MultiOption::MultiOption(const std::string &name=std::string()) "; -%feature("docstring") RealLimits::getUpperLimit "double RealLimits::getUpperLimit() const - -Returns upper limit. +%feature("docstring") MultiOption::MultiOption "MultiOption::MultiOption(const std::string &name, const T &t, const std::string &descripion=std::string()) "; -%feature("docstring") RealLimits::setUpperLimit "void RealLimits::setUpperLimit(double value) - -Sets upper limit. +%feature("docstring") MultiOption::name "std::string MultiOption::name() const "; -%feature("docstring") RealLimits::removeUpperLimit "void RealLimits::removeUpperLimit() - -remove upper limit +%feature("docstring") MultiOption::description "std::string MultiOption::description() const "; -%feature("docstring") RealLimits::hasLowerAndUpperLimits "bool RealLimits::hasLowerAndUpperLimits() const - -if has lower and upper limit +%feature("docstring") MultiOption::setDescription "void MultiOption::setDescription(const std::string &description) "; -%feature("docstring") RealLimits::setLimits "void RealLimits::setLimits(double xmin, double xmax) +%feature("docstring") MultiOption::value "MultiOption::variant_t & MultiOption::value() +"; -Sets lower and upper limits. +%feature("docstring") MultiOption::defaultValue "MultiOption::variant_t & MultiOption::defaultValue() "; -%feature("docstring") RealLimits::removeLimits "void RealLimits::removeLimits() +%feature("docstring") MultiOption::get "T MultiOption::get() const -remove limits +Returns the option's value. "; -%feature("docstring") RealLimits::isInRange "bool RealLimits::isInRange(double value) const +%feature("docstring") MultiOption::getDefault "T MultiOption::getDefault() const -returns true if proposed value is in limits range +Returns the option's default value (i.e. used during construction) "; -// File: classROOTGeneticMinimizer.xml -%feature("docstring") ROOTGeneticMinimizer " +// File: classOptionContainer.xml +%feature("docstring") OptionContainer " -Wrapper for ROOT Genetic minimizer. +The OptionContainer class stores multi option (int,double,string) in a container. -C++ includes: ROOTGeneticMinimizer.h +C++ includes: OptionContainer.h "; -%feature("docstring") ROOTGeneticMinimizer::ROOTGeneticMinimizer "ROOTGeneticMinimizer::ROOTGeneticMinimizer(const std::string &minimizer_name, const std::string &algo_type) +%feature("docstring") OptionContainer::OptionContainer "OptionContainer::OptionContainer() "; -%feature("docstring") ROOTGeneticMinimizer::~ROOTGeneticMinimizer "virtual ROOTGeneticMinimizer::~ROOTGeneticMinimizer() -"; +%feature("docstring") OptionContainer::OptionContainer "OptionContainer::OptionContainer(const OptionContainer &other) -%feature("docstring") ROOTGeneticMinimizer::setParameter "void ROOTGeneticMinimizer::setParameter(size_t index, const FitParameter *par) +Returns true if option with such name already exists. "; - -// File: classROOTLMAMinimizer.xml -%feature("docstring") ROOTLMAMinimizer " - -Wrapper for Levenberg Marquard GSL minimizer. - -C++ includes: ROOTLMAMinimizer.h +%feature("docstring") OptionContainer::addOption "OptionContainer::option_t OptionContainer::addOption(const std::string &optionName, T value, const std::string &description=std::string()) "; -%feature("docstring") ROOTLMAMinimizer::ROOTLMAMinimizer "ROOTLMAMinimizer::ROOTLMAMinimizer(const std::string &minimizer_name, const std::string &algo_type) +%feature("docstring") OptionContainer::option "OptionContainer::option_t OptionContainer::option(const std::string &optionName) "; -%feature("docstring") ROOTLMAMinimizer::~ROOTLMAMinimizer "virtual ROOTLMAMinimizer::~ROOTLMAMinimizer() +%feature("docstring") OptionContainer::option "const OptionContainer::option_t OptionContainer::option(const std::string &optionName) const "; -%feature("docstring") ROOTLMAMinimizer::isGradientBasedAgorithm "virtual bool ROOTLMAMinimizer::isGradientBasedAgorithm() - -Returns true if type of algorithm is Levenberg-Marquardt or similar. +%feature("docstring") OptionContainer::optionValue "T OptionContainer::optionValue(const std::string &optionName) const "; +%feature("docstring") OptionContainer::setOptionValue "void OptionContainer::setOptionValue(const std::string &optionName, T value) -// File: classROOTMinimizer.xml -%feature("docstring") ROOTMinimizer " - -Wrapper for ROOT minimizers to interface with FitSuite. - -C++ includes: ROOTMinimizer.h -"; - -%feature("docstring") ROOTMinimizer::ROOTMinimizer "ROOTMinimizer::ROOTMinimizer(const std::string &minimizer_name, const std::string &algo_type=std::string()) +Sets the value of option. Option should hold same value type already. "; -%feature("docstring") ROOTMinimizer::~ROOTMinimizer "ROOTMinimizer::~ROOTMinimizer() +%feature("docstring") OptionContainer::begin "iterator OptionContainer::begin() "; -%feature("docstring") ROOTMinimizer::minimize "void ROOTMinimizer::minimize() - -run minimization +%feature("docstring") OptionContainer::begin "const_iterator OptionContainer::begin() const "; -%feature("docstring") ROOTMinimizer::setParameter "void ROOTMinimizer::setParameter(size_t index, const FitParameter *par) +%feature("docstring") OptionContainer::end "iterator OptionContainer::end() "; -%feature("docstring") ROOTMinimizer::setParameters "void ROOTMinimizer::setParameters(const FitSuiteParameters ¶meters) - -Sets internal minimizer parameter. - -Sets internal minimizer parameters using external parameter list +%feature("docstring") OptionContainer::end "const_iterator OptionContainer::end() const "; -%feature("docstring") ROOTMinimizer::setChiSquaredFunction "void ROOTMinimizer::setChiSquaredFunction(function_chi2_t fun_chi2, size_t nparameters) - -Sets chi squared function to minimize. +%feature("docstring") OptionContainer::size "size_t OptionContainer::size() const "; -%feature("docstring") ROOTMinimizer::setGradientFunction "void ROOTMinimizer::setGradientFunction(function_gradient_t fun_gradient, size_t nparameters, size_t ndatasize) -Sets gradient function to minimize. -"; +// File: classRealLimits.xml +%feature("docstring") RealLimits " -%feature("docstring") ROOTMinimizer::getNumberOfVariables "size_t ROOTMinimizer::getNumberOfVariables() const +Limits for a real fit parameter. -Returns number of variables to fit. +C++ includes: RealLimits.h "; -%feature("docstring") ROOTMinimizer::getMinValue "double ROOTMinimizer::getMinValue() const +%feature("docstring") RealLimits::RealLimits "RealLimits::RealLimits() "; -%feature("docstring") ROOTMinimizer::getValueOfVariablesAtMinimum "std::vector< double > ROOTMinimizer::getValueOfVariablesAtMinimum() const - -Returns minimum function value. +%feature("docstring") RealLimits::hasLowerLimit "bool RealLimits::hasLowerLimit() const -Returns values of parameters at the minimum +if has lower limit "; -%feature("docstring") ROOTMinimizer::getErrorOfVariables "std::vector< double > ROOTMinimizer::getErrorOfVariables() const +%feature("docstring") RealLimits::getLowerLimit "double RealLimits::getLowerLimit() const -Returns errors of variables at minimum. +Returns lower limit. "; -%feature("docstring") ROOTMinimizer::printResults "void ROOTMinimizer::printResults() const - -clear resources (parameters) for consecutives minimizations - -Prints fit results -"; +%feature("docstring") RealLimits::setLowerLimit "void RealLimits::setLowerLimit(double value) -%feature("docstring") ROOTMinimizer::clear "void ROOTMinimizer::clear() +Sets lower limit. "; -%feature("docstring") ROOTMinimizer::getNCalls "size_t ROOTMinimizer::getNCalls() const +%feature("docstring") RealLimits::removeLowerLimit "void RealLimits::removeLowerLimit() -Returns number of calls of minimized function. +remove lower limit "; -%feature("docstring") ROOTMinimizer::getOptions "MinimizerOptions * ROOTMinimizer::getOptions() +%feature("docstring") RealLimits::hasUpperLimit "bool RealLimits::hasUpperLimit() const -return minimizer options +if has upper limit "; -%feature("docstring") ROOTMinimizer::getOptions "const MinimizerOptions * ROOTMinimizer::getOptions() const +%feature("docstring") RealLimits::getUpperLimit "double RealLimits::getUpperLimit() const + +Returns upper limit. "; -%feature("docstring") ROOTMinimizer::setOptions "void ROOTMinimizer::setOptions(const MinimizerOptions &options) +%feature("docstring") RealLimits::setUpperLimit "void RealLimits::setUpperLimit(double value) -set minimizer options +Sets upper limit. "; -%feature("docstring") ROOTMinimizer::getROOTMinimizer "BA_ROOT::Math::Minimizer * ROOTMinimizer::getROOTMinimizer() +%feature("docstring") RealLimits::removeUpperLimit "void RealLimits::removeUpperLimit() -Returns created minimizer. +remove upper limit "; -%feature("docstring") ROOTMinimizer::getROOTMinimizer "const BA_ROOT::Math::Minimizer * ROOTMinimizer::getROOTMinimizer() const +%feature("docstring") RealLimits::hasLowerAndUpperLimits "bool RealLimits::hasLowerAndUpperLimits() const + +if has lower and upper limit "; -%feature("docstring") ROOTMinimizer::isGradientBasedAgorithm "virtual bool ROOTMinimizer::isGradientBasedAgorithm() +%feature("docstring") RealLimits::setLimits "void RealLimits::setLimits(double xmin, double xmax) -Returns true if type of algorithm is Levenberg-Marquardt or similar. +Sets lower and upper limits. "; -%feature("docstring") ROOTMinimizer::getMinimizerName "std::string ROOTMinimizer::getMinimizerName() const +%feature("docstring") RealLimits::removeLimits "void RealLimits::removeLimits() -return name of the minimizer +remove limits "; -%feature("docstring") ROOTMinimizer::getAlgorithmName "std::string ROOTMinimizer::getAlgorithmName() const +%feature("docstring") RealLimits::isInRange "bool RealLimits::isInRange(double value) const -return name of the minimization algorithm +returns true if proposed value is in limits range "; @@ -1000,146 +952,173 @@ evaluation of single data element residual "; -// File: classROOTMinimizerHelper.xml -%feature("docstring") ROOTMinimizerHelper " +// File: classSimAnMinimizer.xml +%feature("docstring") SimAnMinimizer " -Handles options and printing for ROOTMinimizer Required by Fumili, Fumili2 and GSLMultiMin minimizers. +Wrapper for ROOT GSL simmulated annealing minimizer. -C++ includes: ROOTMinimizerHelper.h +C++ includes: SimAnMinimizer.h "; -%feature("docstring") ROOTMinimizerHelper::ROOTMinimizerHelper "ROOTMinimizerHelper::ROOTMinimizerHelper() +%feature("docstring") SimAnMinimizer::SimAnMinimizer "SimAnMinimizer::SimAnMinimizer() "; +%feature("docstring") SimAnMinimizer::~SimAnMinimizer "SimAnMinimizer::~SimAnMinimizer() +"; -// File: classROOTMinuit2Minimizer.xml -%feature("docstring") ROOTMinuit2Minimizer " +%feature("docstring") SimAnMinimizer::setPrintLevel "void SimAnMinimizer::setPrintLevel(int value) -Wrapper for ROOT Minuit2 minimizer. +Sets minimizer internal print level. Default value is 0 (silent). +"; -C++ includes: ROOTMinuit2Minimizer.h +%feature("docstring") SimAnMinimizer::printLevel "int SimAnMinimizer::printLevel() const "; -%feature("docstring") ROOTMinuit2Minimizer::ROOTMinuit2Minimizer "ROOTMinuit2Minimizer::ROOTMinuit2Minimizer(const std::string &minimizer_name, const std::string &algo_type) +%feature("docstring") SimAnMinimizer::setMaxIterations "void SimAnMinimizer::setMaxIterations(int value) + +Sets maximum number of iterations to try at each step. Default values is 100. "; -%feature("docstring") ROOTMinuit2Minimizer::~ROOTMinuit2Minimizer "virtual ROOTMinuit2Minimizer::~ROOTMinuit2Minimizer() +%feature("docstring") SimAnMinimizer::maxIterations "int SimAnMinimizer::maxIterations() const "; -%feature("docstring") ROOTMinuit2Minimizer::isGradientBasedAgorithm "bool ROOTMinuit2Minimizer::isGradientBasedAgorithm() +%feature("docstring") SimAnMinimizer::setIterationsAtEachTemp "void SimAnMinimizer::setIterationsAtEachTemp(int value) -Returns true if type of algorithm is Levenberg-Marquardt or similar. +Sets number of iterations at each temperature. Default value is 10. "; +%feature("docstring") SimAnMinimizer::iterationsAtEachTemp "int SimAnMinimizer::iterationsAtEachTemp() const +"; -// File: classROOTMultiMinMinimizer.xml -%feature("docstring") ROOTMultiMinMinimizer " +%feature("docstring") SimAnMinimizer::setStepSize "void SimAnMinimizer::setStepSize(double value) -Wrapper for GSL gradiend descent minimizer family. +Sets max step size used in random walk. Default value is 1.0. +"; -C++ includes: ROOTMultiMinMinimizer.h +%feature("docstring") SimAnMinimizer::stepSize "double SimAnMinimizer::stepSize() const "; -%feature("docstring") ROOTMultiMinMinimizer::ROOTMultiMinMinimizer "ROOTMultiMinMinimizer::ROOTMultiMinMinimizer(const std::string &minimizer_name, const std::string &algo_type) +%feature("docstring") SimAnMinimizer::setBoltzmannK "void SimAnMinimizer::setBoltzmannK(double value) + +Sets Boltzmann distribution parameter: k. Default value 1.0. "; -%feature("docstring") ROOTMultiMinMinimizer::~ROOTMultiMinMinimizer "virtual ROOTMultiMinMinimizer::~ROOTMultiMinMinimizer() +%feature("docstring") SimAnMinimizer::boltzmannK "double SimAnMinimizer::boltzmannK() const "; +%feature("docstring") SimAnMinimizer::setBoltzmannInitialTemp "void SimAnMinimizer::setBoltzmannInitialTemp(double value) -// File: classROOTSimAnMinimizer.xml -%feature("docstring") ROOTSimAnMinimizer " +Sets Boltzmann distribution parameter: initial temperature. Default value 50.0. +"; -Wrapper for ROOT GSL simmulated annealing minimizer. +%feature("docstring") SimAnMinimizer::boltzmannInitialTemp "double SimAnMinimizer::boltzmannInitialTemp() const +"; + +%feature("docstring") SimAnMinimizer::setBoltzmannMu "void SimAnMinimizer::setBoltzmannMu(double value) -C++ includes: ROOTSimAnMinimizer.h +Sets Boltzmann distribution parameter: mu. Default value 1.05. "; -%feature("docstring") ROOTSimAnMinimizer::ROOTSimAnMinimizer "ROOTSimAnMinimizer::ROOTSimAnMinimizer(const std::string &minimizer_name, const std::string &algo_type) +%feature("docstring") SimAnMinimizer::boltzmannMu "double SimAnMinimizer::boltzmannMu() const "; -%feature("docstring") ROOTSimAnMinimizer::~ROOTSimAnMinimizer "virtual ROOTSimAnMinimizer::~ROOTSimAnMinimizer() +%feature("docstring") SimAnMinimizer::setBoltzmannMinTemp "void SimAnMinimizer::setBoltzmannMinTemp(double value) + +Sets Boltzmann distribution parameter: minimal temperature. Default value 0.1. "; +%feature("docstring") SimAnMinimizer::boltzmannMinTemp "double SimAnMinimizer::boltzmannMinTemp() const +"; + +%feature("docstring") SimAnMinimizer::statusMap "std::map< std::string, std::string > SimAnMinimizer::statusMap() const + +Returns map of string representing different minimizer statuses. +"; + +%feature("docstring") SimAnMinimizer::isGradientBasedAgorithm "virtual bool SimAnMinimizer::isGradientBasedAgorithm() +"; -// File: classTrivialMinimizer.xml -%feature("docstring") TrivialMinimizer " + +// File: classTestMinimizer.xml +%feature("docstring") TestMinimizer " Minimizer which calls minimization function once to test whole chain. -C++ includes: TrivialMinimizer.h +C++ includes: TestMinimizer.h "; -%feature("docstring") TrivialMinimizer::TrivialMinimizer "TrivialMinimizer::TrivialMinimizer() +%feature("docstring") TestMinimizer::TestMinimizer "TestMinimizer::TestMinimizer() "; -%feature("docstring") TrivialMinimizer::~TrivialMinimizer "TrivialMinimizer::~TrivialMinimizer() final +%feature("docstring") TestMinimizer::~TestMinimizer "TestMinimizer::~TestMinimizer() "; -%feature("docstring") TrivialMinimizer::minimize "void TrivialMinimizer::minimize() final +%feature("docstring") TestMinimizer::minimizerName "std::string TestMinimizer::minimizerName() const -run minimization +return name of the minimizer "; -%feature("docstring") TrivialMinimizer::setParameters "void TrivialMinimizer::setParameters(const FitSuiteParameters ¶meters) final +%feature("docstring") TestMinimizer::minimize "void TestMinimizer::minimize() + +run minimization +"; -Sets internal minimizer parameter. +%feature("docstring") TestMinimizer::setParameters "void TestMinimizer::setParameters(const FitSuiteParameters ¶meters) -Sets internal minimizer parameters using external parameter list +Sets internal minimizer parameters using external parameter list. "; -%feature("docstring") TrivialMinimizer::setChiSquaredFunction "void TrivialMinimizer::setChiSquaredFunction(function_chi2_t fun_chi2, size_t) final +%feature("docstring") TestMinimizer::setChiSquaredFunction "void TestMinimizer::setChiSquaredFunction(function_chi2_t fun_chi2, size_t) Sets chi squared function to minimize. "; -%feature("docstring") TrivialMinimizer::setGradientFunction "void TrivialMinimizer::setGradientFunction(function_gradient_t, size_t, size_t) final +%feature("docstring") TestMinimizer::setGradientFunction "virtual void TestMinimizer::setGradientFunction(function_gradient_t, size_t, size_t) Sets gradient function to minimize. "; -%feature("docstring") TrivialMinimizer::getNumberOfVariables "size_t TrivialMinimizer::getNumberOfVariables() const final +%feature("docstring") TestMinimizer::getNumberOfVariables "virtual size_t TestMinimizer::getNumberOfVariables() const Returns number of variables to fit. "; -%feature("docstring") TrivialMinimizer::getValueOfVariablesAtMinimum "std::vector< double > TrivialMinimizer::getValueOfVariablesAtMinimum() const final +%feature("docstring") TestMinimizer::getValueOfVariableAtMinimum "double TestMinimizer::getValueOfVariableAtMinimum(size_t index) const -Returns value of the parameter at the minimum. +Returns pointer to the parameters values at the minimum. "; -%feature("docstring") TrivialMinimizer::getErrorOfVariables "std::vector< double > TrivialMinimizer::getErrorOfVariables() const final +%feature("docstring") TestMinimizer::getValueOfVariablesAtMinimum "std::vector< double > TestMinimizer::getValueOfVariablesAtMinimum() const -Returns errors of variables at minimum. +Returns value of the parameter at the minimum. "; -%feature("docstring") TrivialMinimizer::printResults "void TrivialMinimizer::printResults() const final +%feature("docstring") TestMinimizer::reportResults "std::string TestMinimizer::reportResults() const -clear resources (parameters) for consecutives minimizations - -Prints fit results +Prints fit results. "; -%feature("docstring") TrivialMinimizer::getMinimizerName "std::string TrivialMinimizer::getMinimizerName() const final +%feature("docstring") TestMinimizer::getErrorOfVariables "std::vector< double > TestMinimizer::getErrorOfVariables() const -return name of the minimizer +Returns errors of variables at minimum. "; -%feature("docstring") TrivialMinimizer::getAlgorithmName "std::string TrivialMinimizer::getAlgorithmName() const final +%feature("docstring") TestMinimizer::propagateResults "void TestMinimizer::propagateResults(FitSuiteParameters &) -return name of the minimization algorithm +Propagates results of minimization to fit parameter set. "; -%feature("docstring") TrivialMinimizer::getOptions "MinimizerOptions* TrivialMinimizer::getOptions() final -return minimizer options -"; +// File: namespace_0D11.xml + + +// File: namespace_0D30.xml -%feature("docstring") TrivialMinimizer::getOptions "const MinimizerOptions* TrivialMinimizer::getOptions() const final -"; +// File: namespace_0D32.xml -// File: namespace_0D14.xml + +// File: namespace_0D36.xml // File: namespaceAlgorithmNames.xml @@ -1151,12 +1130,25 @@ return minimizer options // File: namespaceBA__ROOT_1_1Math.xml -// File: namespaceMinimizerLibrary.xml +// File: namespaceBA__ROOT_1_1Minuit2.xml // File: namespaceMinimizerNames.xml +// File: namespaceMinimizerUtils.xml +%feature("docstring") MinimizerUtils::toString "std::string MinimizerUtils::toString(const std::vector< std::string > &v, const std::string &delim=\"\") +"; + +%feature("docstring") MinimizerUtils::gslErrorDescriptionMap "std::map< int, std::string > MinimizerUtils::gslErrorDescriptionMap() + +Returns translation of GSL error code to string. +"; + +%feature("docstring") MinimizerUtils::gslErrorDescription "std::string MinimizerUtils::gslErrorDescription(int errorCode) +"; + + // File: namespaceMSG.xml %feature("docstring") MSG::SetLevel "BA_CORE_API_ void MSG::SetLevel(EMessageLevel level) "; @@ -1165,6 +1157,9 @@ return minimizer options "; +// File: namespaceOptionNames.xml + + // File: namespaceStringUtils.xml %feature("docstring") StringUtils::matchesPattern "bool StringUtils::matchesPattern(const std::string &text, const std::string &wildcardPattern) @@ -1177,22 +1172,19 @@ Returns string right-padded with blanks. "; -// File: AlgorithmNames_8h.xml +// File: IMinimizer_8cpp.xml -// File: BasicMinimizer_8cpp.xml - - -// File: BasicMinimizer_8h.xml +// File: IMinimizer_8h.xml -// File: Configurable_8cpp.xml +// File: MinimizerCatalogue_8cpp.xml -// File: Configurable_8h.xml +// File: MinimizerCatalogue_8h.xml -// File: IMinimizer_8h.xml +// File: MinimizerConstants_8h.xml // File: MinimizerFactory_8cpp.xml @@ -1201,34 +1193,51 @@ Returns string right-padded with blanks. // File: MinimizerFactory_8h.xml -// File: MinimizerLibrary_8cpp.xml +// File: MinimizerInfo_8cpp.xml -// File: MinimizerLibrary_8h.xml +// File: MinimizerInfo_8h.xml -// File: MinimizerOption_8cpp.xml +// File: MinimizerOptions_8cpp.xml -// File: MinimizerOption_8h.xml +// File: MinimizerOptions_8h.xml -// File: MinimizerOptions_8cpp.xml +// File: MinimizerResultsHelper_8cpp.xml -// File: MinimizerOptions_8h.xml +// File: MinimizerResultsHelper_8h.xml +%feature("docstring") to_string_with_precision "std::string to_string_with_precision(const T a_value, int precision=10, int width=0) +"; + +%feature("docstring") to_string_scientific "std::string to_string_scientific(const T a_value, int n=10) +"; -// File: Minuit2Minimizer_8cpp.xml +// File: MinimizerUtils_8cpp.xml -// File: Minuit2Minimizer_8h.xml +// File: MinimizerUtils_8h.xml + + +// File: MultiOption_8cpp.xml + +// File: MultiOption_8h.xml -// File: TrivialMinimizer_8cpp.xml +// File: OptionContainer_8cpp.xml -// File: TrivialMinimizer_8h.xml + +// File: OptionContainer_8h.xml + + +// File: TestMinimizer_8cpp.xml + + +// File: TestMinimizer_8h.xml // File: Attributes_8h.xml @@ -1252,49 +1261,43 @@ Returns string right-padded with blanks. // File: RealLimits_8h.xml -// File: ROOTGeneticMinimizer_8cpp.xml - - -// File: ROOTGeneticMinimizer_8h.xml - - -// File: ROOTLMAMinimizer_8cpp.xml +// File: BasicMinimizer_8cpp.xml -// File: ROOTLMAMinimizer_8h.xml +// File: BasicMinimizer_8h.xml -// File: ROOTMinimizer_8cpp.xml +// File: GeneticMinimizer_8cpp.xml -// File: ROOTMinimizer_8h.xml +// File: GeneticMinimizer_8h.xml -// File: ROOTMinimizerFunction_8h.xml +// File: GSLLevenbergMarquardtMinimizer_8cpp.xml -// File: ROOTMinimizerHelper_8cpp.xml +// File: GSLLevenbergMarquardtMinimizer_8h.xml -// File: ROOTMinimizerHelper_8h.xml +// File: GSLMultiMinimizer_8cpp.xml -// File: ROOTMinuit2Minimizer_8cpp.xml +// File: GSLMultiMinimizer_8h.xml -// File: ROOTMinuit2Minimizer_8h.xml +// File: Minuit2Minimizer_8cpp.xml -// File: ROOTMultiMinMinimizer_8cpp.xml +// File: Minuit2Minimizer_8h.xml -// File: ROOTMultiMinMinimizer_8h.xml +// File: ROOTMinimizerFunction_8h.xml -// File: ROOTSimAnMinimizer_8cpp.xml +// File: SimAnMinimizer_8cpp.xml -// File: ROOTSimAnMinimizer_8h.xml +// File: SimAnMinimizer_8h.xml // File: Logger_8cpp.xml @@ -1309,17 +1312,20 @@ Returns string right-padded with blanks. // File: StringUtils_8h.xml -// File: dir_892d84e8d1420bf45a9053cf0eede900.xml +// File: dir_d0c8f8fb9032c27878972645c4679f14.xml + + +// File: dir_befad91b6aded329d87ab1464acca32e.xml -// File: dir_7c95011753c2f8fb6f2a9c22c1fbdc50.xml +// File: dir_f668eca225435178269b3663d40ba22e.xml -// File: dir_17bde39ef6b5d64be6f6883a061c9058.xml +// File: dir_1acb97a05207425a4804447756e3d919.xml -// File: dir_3d2dd2c6a4dddd0587ea5f12e3139107.xml +// File: dir_66d655750f7b00e32587449835def8b0.xml -// File: dir_c742711e288b52ad835463ef3a11378f.xml +// File: dir_111d40054bb7ae6116a9a4a5aab3a0b8.xml diff --git a/auto/Wrap/libBornAgainFit_wrap.cpp b/auto/Wrap/libBornAgainFit_wrap.cpp index 5e6e279867699acf97830b2ffdfca561932d73b1..a9f6ee51209b35738ec3db1a6280c2a509e70b28 100644 --- a/auto/Wrap/libBornAgainFit_wrap.cpp +++ b/auto/Wrap/libBornAgainFit_wrap.cpp @@ -5627,7 +5627,11 @@ SWIG_AsVal_std_complex_Sl_double_Sg_ (PyObject *o, std::complex<double>* val) SWIGINTERNINLINE PyObject* +<<<<<<< HEAD SWIG_From_std_complex_Sl_double_Sg_ (/*@SWIG:/home/pospelov/software/local/share/swig/3.0.8/typemaps/swigmacros.swg,104,%ifcplusplus@*/ +======= +SWIG_From_std_complex_Sl_double_Sg_ (/*@SWIG:/usr/share/swig3.0/typemaps/swigmacros.swg,104,%ifcplusplus@*/ +>>>>>>> upstream/develop const std::complex<double>& @@ -10010,6 +10014,74 @@ fail: SWIGINTERN PyObject *_wrap_vdouble2d_t_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +<<<<<<< HEAD +======= + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:vdouble2d_t_clear",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "vdouble2d_t_clear" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + (arg1)->clear(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_vdouble2d_t_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + SwigValueWrapper< std::allocator< std::vector< double,std::allocator< double > > > > result; + + if (!PyArg_ParseTuple(args,(char *)"O:vdouble2d_t_get_allocator",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "vdouble2d_t_get_allocator" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); + } + arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); + result = ((std::vector< std::vector< double > > const *)arg1)->get_allocator(); + resultobj = SWIG_NewPointerObj((new std::vector< std::vector< double > >::allocator_type(static_cast< const std::vector< std::vector< double > >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_vdouble2d_t__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::vector< double > >::size_type arg1 ; + size_t val1 ; + int ecode1 = 0 ; + PyObject * obj0 = 0 ; + std::vector< std::vector< double > > *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:new_vdouble2d_t",&obj0)) SWIG_fail; + ecode1 = SWIG_AsVal_size_t(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_vdouble2d_t" "', argument " "1"" of type '" "std::vector< std::vector< double > >::size_type""'"); + } + arg1 = static_cast< std::vector< std::vector< double > >::size_type >(val1); + result = (std::vector< std::vector< double > > *)new std::vector< std::vector< double > >(arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_vdouble2d_t_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +>>>>>>> upstream/develop PyObject *resultobj = 0; std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; void *argp1 = 0 ; @@ -15515,6 +15587,37 @@ fail: SWIGINTERN PyObject *_wrap_vector_complex_t_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +<<<<<<< HEAD +======= + PyObject *resultobj = 0; + std::vector< std::complex< double > > *arg1 = (std::vector< std::complex< double > > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + std::vector< std::complex< double > >::value_type result; + + if (!PyArg_ParseTuple(args,(char *)"O:vector_complex_t_pop",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__complexT_double_t_std__allocatorT_std__complexT_double_t_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "vector_complex_t_pop" "', argument " "1"" of type '" "std::vector< std::complex< double > > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::complex< double > > * >(argp1); + try { + result = std_vector_Sl_std_complex_Sl_double_Sg__Sg__pop(arg1); + } + catch(std::out_of_range &_e) { + SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); + } + + resultobj = SWIG_From_std_complex_Sl_double_Sg_(static_cast< std::complex<double> >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_vector_complex_t_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +>>>>>>> upstream/develop PyObject *resultobj = 0; std::vector< std::complex< double > > *arg1 = (std::vector< std::complex< double > > *) 0 ; void *argp1 = 0 ; @@ -17620,6 +17723,7 @@ fail: SWIGINTERN PyObject *_wrap_vector_string_t_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +<<<<<<< HEAD PyObject *resultobj = 0; std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; void *argp1 = 0 ; @@ -17643,6 +17747,8 @@ fail: SWIGINTERN PyObject *_wrap_vector_string_t_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +======= +>>>>>>> upstream/develop PyObject *resultobj = 0; std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; void *argp1 = 0 ; @@ -17754,6 +17860,49 @@ fail: } +SWIGINTERN PyObject *_wrap_vector_string_t_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:vector_string_t_clear",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "vector_string_t_clear" "', argument " "1"" of type '" "std::vector< std::string > *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + (arg1)->clear(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_vector_string_t_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + SwigValueWrapper< std::allocator< std::string > > result; + + if (!PyArg_ParseTuple(args,(char *)"O:vector_string_t_get_allocator",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "vector_string_t_get_allocator" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); + } + arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); + result = ((std::vector< std::string > const *)arg1)->get_allocator(); + resultobj = SWIG_NewPointerObj((new std::vector< std::string >::allocator_type(static_cast< const std::vector< std::string >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__string_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_new_vector_string_t__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; std::vector< std::string >::size_type arg1 ; @@ -19525,6 +19674,136 @@ fail: } +<<<<<<< HEAD +======= +SWIGINTERN PyObject *_wrap_IMinimizer_getValueOfVariableAtMinimum(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + IMinimizer *arg1 = (IMinimizer *) 0 ; + size_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + double result; + + if (!PyArg_ParseTuple(args,(char *)"OO:IMinimizer_getValueOfVariableAtMinimum",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IMinimizer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IMinimizer_getValueOfVariableAtMinimum" "', argument " "1"" of type '" "IMinimizer const *""'"); + } + arg1 = reinterpret_cast< IMinimizer * >(argp1); + ecode2 = SWIG_AsVal_size_t(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IMinimizer_getValueOfVariableAtMinimum" "', argument " "2"" of type '" "size_t""'"); + } + arg2 = static_cast< size_t >(val2); + result = (double)((IMinimizer const *)arg1)->getValueOfVariableAtMinimum(arg2); + resultobj = SWIG_From_double(static_cast< double >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IMinimizer_getValueOfVariablesAtMinimum(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + IMinimizer *arg1 = (IMinimizer *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + std::vector< double,std::allocator< double > > result; + + if (!PyArg_ParseTuple(args,(char *)"O:IMinimizer_getValueOfVariablesAtMinimum",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IMinimizer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IMinimizer_getValueOfVariablesAtMinimum" "', argument " "1"" of type '" "IMinimizer const *""'"); + } + arg1 = reinterpret_cast< IMinimizer * >(argp1); + result = ((IMinimizer const *)arg1)->getValueOfVariablesAtMinimum(); + resultobj = swig::from(static_cast< std::vector< double,std::allocator< double > > >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IMinimizer_getErrorOfVariable(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + IMinimizer *arg1 = (IMinimizer *) 0 ; + size_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + size_t val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + double result; + + if (!PyArg_ParseTuple(args,(char *)"OO:IMinimizer_getErrorOfVariable",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IMinimizer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IMinimizer_getErrorOfVariable" "', argument " "1"" of type '" "IMinimizer const *""'"); + } + arg1 = reinterpret_cast< IMinimizer * >(argp1); + ecode2 = SWIG_AsVal_size_t(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IMinimizer_getErrorOfVariable" "', argument " "2"" of type '" "size_t""'"); + } + arg2 = static_cast< size_t >(val2); + result = (double)((IMinimizer const *)arg1)->getErrorOfVariable(arg2); + resultobj = SWIG_From_double(static_cast< double >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IMinimizer_getErrorOfVariables(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + IMinimizer *arg1 = (IMinimizer *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + std::vector< double,std::allocator< double > > result; + + if (!PyArg_ParseTuple(args,(char *)"O:IMinimizer_getErrorOfVariables",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IMinimizer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IMinimizer_getErrorOfVariables" "', argument " "1"" of type '" "IMinimizer const *""'"); + } + arg1 = reinterpret_cast< IMinimizer * >(argp1); + result = ((IMinimizer const *)arg1)->getErrorOfVariables(); + resultobj = swig::from(static_cast< std::vector< double,std::allocator< double > > >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IMinimizer_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + IMinimizer *arg1 = (IMinimizer *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:IMinimizer_clear",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IMinimizer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IMinimizer_clear" "', argument " "1"" of type '" "IMinimizer *""'"); + } + arg1 = reinterpret_cast< IMinimizer * >(argp1); + (arg1)->clear(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +>>>>>>> upstream/develop SWIGINTERN PyObject *_wrap_IMinimizer_reportResults(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; IMinimizer *arg1 = (IMinimizer *) 0 ; @@ -20415,7 +20694,11 @@ fail: } +<<<<<<< HEAD SWIGINTERN PyObject *_wrap_FitParameterSet_begin(PyObject *self, PyObject *args) { +======= +SWIGINTERN PyObject *_wrap_FitSuiteParameters_getFitParameters(PyObject *self, PyObject *args) { +>>>>>>> upstream/develop Py_ssize_t argc; PyObject *argv[2] = { 0 @@ -20499,16 +20782,26 @@ fail: } +<<<<<<< HEAD SWIGINTERN PyObject *_wrap_FitParameterSet_end(PyObject *self, PyObject *args) { Py_ssize_t argc; PyObject *argv[2] = { +======= +SWIGINTERN PyObject *_wrap_FitSuiteParameters_getFitParameter(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[3] = { +>>>>>>> upstream/develop 0 }; Py_ssize_t ii; if (!PyTuple_Check(args)) SWIG_fail; argc = args ? PyObject_Length(args) : 0; +<<<<<<< HEAD for (ii = 0; (ii < 1) && (ii < argc); ii++) { +======= + for (ii = 0; (ii < 2) && (ii < argc); ii++) { +>>>>>>> upstream/develop argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 1) { @@ -20587,8 +20880,13 @@ SWIGINTERN PyObject *_wrap_FitParameterSet_fitParameter__SWIG_0(PyObject *SWIGUN } arg1 = reinterpret_cast< FitParameterSet * >(argp1); { +<<<<<<< HEAD std::string *ptr = (std::string *)0; res2 = SWIG_AsPtr_std_string(obj1, &ptr); +======= + std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; + res2 = swig::asptr(obj1, &ptr); +>>>>>>> upstream/develop if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FitParameterSet_fitParameter" "', argument " "2"" of type '" "std::string const &""'"); } @@ -20645,7 +20943,11 @@ fail: } +<<<<<<< HEAD SWIGINTERN PyObject *_wrap_FitParameterSet_fitParameter(PyObject *self, PyObject *args) { +======= +SWIGINTERN PyObject *_wrap_FitSuiteParameters_setValues(PyObject *self, PyObject *args) { +>>>>>>> upstream/develop Py_ssize_t argc; PyObject *argv[3] = { 0 @@ -20676,7 +20978,11 @@ SWIGINTERN PyObject *_wrap_FitParameterSet_fitParameter(PyObject *self, PyObject int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_FitParameterSet, 0); _v = SWIG_CheckState(res); if (_v) { +<<<<<<< HEAD int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0)); +======= + int res = swig::asptr(argv[1], (std::vector< double,std::allocator< double > >**)(0)); +>>>>>>> upstream/develop _v = SWIG_CheckState(res); if (_v) { return _wrap_FitParameterSet_fitParameter__SWIG_0(self, args); @@ -20706,8 +21012,13 @@ SWIGINTERN PyObject *_wrap_FitParameterSet_values(PyObject *SWIGUNUSEDPARM(self) if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FitParameterSet_values" "', argument " "1"" of type '" "FitParameterSet const *""'"); } +<<<<<<< HEAD arg1 = reinterpret_cast< FitParameterSet * >(argp1); result = ((FitParameterSet const *)arg1)->values(); +======= + arg1 = reinterpret_cast< FitSuiteParameters * >(argp1); + result = ((FitSuiteParameters const *)arg1)->getValues(); +>>>>>>> upstream/develop resultobj = swig::from(static_cast< std::vector< double,std::allocator< double > > >(result)); return resultobj; fail: @@ -20752,11 +21063,145 @@ fail: } +<<<<<<< HEAD SWIGINTERN PyObject *_wrap_FitParameterSet_valuesDifferFrom__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; FitParameterSet *arg1 = (FitParameterSet *) 0 ; std::vector< double,std::allocator< double > > *arg2 = 0 ; double arg3 ; +======= +SWIGINTERN PyObject *_wrap_FitSuiteParameters_getErrors(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + FitSuiteParameters *arg1 = (FitSuiteParameters *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + std::vector< double,std::allocator< double > > result; + + if (!PyArg_ParseTuple(args,(char *)"O:FitSuiteParameters_getErrors",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_FitSuiteParameters, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FitSuiteParameters_getErrors" "', argument " "1"" of type '" "FitSuiteParameters const *""'"); + } + arg1 = reinterpret_cast< FitSuiteParameters * >(argp1); + result = ((FitSuiteParameters const *)arg1)->getErrors(); + resultobj = swig::from(static_cast< std::vector< double,std::allocator< double > > >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_FitSuiteParameters_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + FitSuiteParameters *arg1 = (FitSuiteParameters *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + size_t result; + + if (!PyArg_ParseTuple(args,(char *)"O:FitSuiteParameters_size",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_FitSuiteParameters, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FitSuiteParameters_size" "', argument " "1"" of type '" "FitSuiteParameters const *""'"); + } + arg1 = reinterpret_cast< FitSuiteParameters * >(argp1); + result = ((FitSuiteParameters const *)arg1)->size(); + resultobj = SWIG_From_size_t(static_cast< size_t >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_FitSuiteParameters_begin__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + FitSuiteParameters *arg1 = (FitSuiteParameters *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + SwigValueWrapper< std::vector< FitParameter *,std::allocator< FitParameter * > >::iterator > result; + + if (!PyArg_ParseTuple(args,(char *)"O:FitSuiteParameters_begin",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_FitSuiteParameters, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FitSuiteParameters_begin" "', argument " "1"" of type '" "FitSuiteParameters *""'"); + } + arg1 = reinterpret_cast< FitSuiteParameters * >(argp1); + result = (arg1)->begin(); + resultobj = SWIG_NewPointerObj((new std::vector< FitParameter *,std::allocator< FitParameter * > >::iterator(static_cast< const std::vector< FitParameter *,std::allocator< FitParameter * > >::iterator& >(result))), SWIGTYPE_p_std__vectorT_FitParameter_p_std__allocatorT_FitParameter_p_t_t__iterator, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_FitSuiteParameters_begin__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + FitSuiteParameters *arg1 = (FitSuiteParameters *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + SwigValueWrapper< std::vector< FitParameter *,std::allocator< FitParameter * > >::const_iterator > result; + + if (!PyArg_ParseTuple(args,(char *)"O:FitSuiteParameters_begin",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_FitSuiteParameters, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FitSuiteParameters_begin" "', argument " "1"" of type '" "FitSuiteParameters const *""'"); + } + arg1 = reinterpret_cast< FitSuiteParameters * >(argp1); + result = ((FitSuiteParameters const *)arg1)->begin(); + resultobj = SWIG_NewPointerObj((new std::vector< FitParameter *,std::allocator< FitParameter * > >::const_iterator(static_cast< const std::vector< FitParameter *,std::allocator< FitParameter * > >::const_iterator& >(result))), SWIGTYPE_p_std__vectorT_FitParameter_p_std__allocatorT_FitParameter_p_t_t__const_iterator, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_FitSuiteParameters_begin(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[2] = { + 0 + }; + Py_ssize_t ii; + + if (!PyTuple_Check(args)) SWIG_fail; + argc = args ? PyObject_Length(args) : 0; + for (ii = 0; (ii < 1) && (ii < argc); ii++) { + argv[ii] = PyTuple_GET_ITEM(args,ii); + } + if (argc == 1) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_FitSuiteParameters, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_FitSuiteParameters_begin__SWIG_0(self, args); + } + } + if (argc == 1) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_FitSuiteParameters, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_FitSuiteParameters_begin__SWIG_1(self, args); + } + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'FitSuiteParameters_begin'.\n" + " Possible C/C++ prototypes are:\n" + " FitSuiteParameters::begin()\n" + " FitSuiteParameters::begin() const\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_FitSuiteParameters_end__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + FitSuiteParameters *arg1 = (FitSuiteParameters *) 0 ; +>>>>>>> upstream/develop void *argp1 = 0 ; int res1 = 0 ; int res2 = SWIG_OLDOBJ ; @@ -20837,16 +21282,26 @@ fail: } +<<<<<<< HEAD SWIGINTERN PyObject *_wrap_FitParameterSet_valuesDifferFrom(PyObject *self, PyObject *args) { Py_ssize_t argc; PyObject *argv[4] = { +======= +SWIGINTERN PyObject *_wrap_FitSuiteParameters_end(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[2] = { +>>>>>>> upstream/develop 0 }; Py_ssize_t ii; if (!PyTuple_Check(args)) SWIG_fail; argc = args ? PyObject_Length(args) : 0; +<<<<<<< HEAD for (ii = 0; (ii < 3) && (ii < argc); ii++) { +======= + for (ii = 0; (ii < 1) && (ii < argc); ii++) { +>>>>>>> upstream/develop argv[ii] = PyTuple_GET_ITEM(args,ii); } if (argc == 2) { @@ -21117,8 +21572,13 @@ SWIGINTERN PyObject *_wrap_FitParameterSet_correlationMatrix(PyObject *SWIGUNUSE if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FitParameterSet_correlationMatrix" "', argument " "1"" of type '" "FitParameterSet const *""'"); } +<<<<<<< HEAD arg1 = reinterpret_cast< FitParameterSet * >(argp1); result = ((FitParameterSet const *)arg1)->correlationMatrix(); +======= + arg1 = reinterpret_cast< FitSuiteParameters * >(argp1); + result = ((FitSuiteParameters const *)arg1)->correlationMatrix(); +>>>>>>> upstream/develop resultobj = swig::from(static_cast< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > >(result)); return resultobj; fail: @@ -21265,7 +21725,11 @@ fail: } +<<<<<<< HEAD SWIGINTERN PyObject *_wrap_FitParameterSet___getitem__(PyObject *self, PyObject *args) { +======= +SWIGINTERN PyObject *_wrap_FitSuiteParameters___getitem__(PyObject *self, PyObject *args) { +>>>>>>> upstream/develop Py_ssize_t argc; PyObject *argv[3] = { 0 @@ -22310,39 +22774,148 @@ static PyMethodDef SwigMethods[] = { "virtual IMinimizer::~IMinimizer()\n" "\n" ""}, - { (char *)"IMinimizer_minimizerName", _wrap_IMinimizer_minimizerName, METH_VARARGS, (char *)"IMinimizer_minimizerName(IMinimizer self) -> std::string"}, - { (char *)"IMinimizer_algorithmName", _wrap_IMinimizer_algorithmName, METH_VARARGS, (char *)"IMinimizer_algorithmName(IMinimizer self) -> std::string"}, + { (char *)"IMinimizer_minimizerName", _wrap_IMinimizer_minimizerName, METH_VARARGS, (char *)"\n" + "IMinimizer_minimizerName(IMinimizer self) -> std::string\n" + "\n" + "std::string IMinimizer::minimizerName() const\n" + "\n" + "return name of the minimizer \n" + "\n" + ""}, + { (char *)"IMinimizer_algorithmName", _wrap_IMinimizer_algorithmName, METH_VARARGS, (char *)"\n" + "IMinimizer_algorithmName(IMinimizer self) -> std::string\n" + "\n" + "std::string IMinimizer::algorithmName() const\n" + "\n" + "return name of the minimization algorithm \n" + "\n" + ""}, { (char *)"IMinimizer_minimize", _wrap_IMinimizer_minimize, METH_VARARGS, (char *)"\n" "IMinimizer_minimize(IMinimizer self)\n" "\n" - "virtual void IMinimizer::minimize()=0\n" + "void IMinimizer::minimize()\n" "\n" "run minimization \n" "\n" ""}, +<<<<<<< HEAD { (char *)"IMinimizer_clear", _wrap_IMinimizer_clear, METH_VARARGS, (char *)"IMinimizer_clear(IMinimizer self)"}, +======= + { (char *)"IMinimizer_setParameter", _wrap_IMinimizer_setParameter, METH_VARARGS, (char *)"\n" + "IMinimizer_setParameter(IMinimizer self, size_t index, FitParameter par)\n" + "\n" + "void IMinimizer::setParameter(size_t index, const FitParameter *par)\n" + "\n" + "Sets internal minimizer parameter. \n" + "\n" + ""}, +>>>>>>> upstream/develop { (char *)"IMinimizer_setParameters", _wrap_IMinimizer_setParameters, METH_VARARGS, (char *)"\n" "IMinimizer_setParameters(IMinimizer self, FitParameterSet parameters)\n" "\n" - "virtual void IMinimizer::setParameters(const FitSuiteParameters ¶meters)=0\n" + "void IMinimizer::setParameters(const FitSuiteParameters ¶meters)\n" "\n" - "Sets internal minimizer parameter.\n" - "\n" - "Sets internal minimizer parameters using external parameter list \n" + "Sets internal minimizer parameters using external parameter list. \n" "\n" ""}, +<<<<<<< HEAD { (char *)"IMinimizer_setObjectiveFunction", _wrap_IMinimizer_setObjectiveFunction, METH_VARARGS, (char *)"IMinimizer_setObjectiveFunction(IMinimizer self, objective_function_t arg3)"}, +======= + { (char *)"IMinimizer_setChiSquaredFunction", _wrap_IMinimizer_setChiSquaredFunction, METH_VARARGS, (char *)"\n" + "IMinimizer_setChiSquaredFunction(IMinimizer self, IMinimizer::function_chi2_t fun_chi2, size_t nparameters)\n" + "\n" + "void IMinimizer::setChiSquaredFunction(function_chi2_t fun_chi2, size_t nparameters)\n" + "\n" + "Sets chi squared function to minimize. \n" + "\n" + ""}, +>>>>>>> upstream/develop { (char *)"IMinimizer_setGradientFunction", _wrap_IMinimizer_setGradientFunction, METH_VARARGS, (char *)"\n" "IMinimizer_setGradientFunction(IMinimizer self, gradient_function_t arg3, int arg4)\n" "\n" - "virtual void IMinimizer::setGradientFunction(function_gradient_t fun_gradient, size_t nparameters, size_t ndatasize)=0\n" + "void IMinimizer::setGradientFunction(function_gradient_t fun_gradient, size_t nparameters, size_t ndatasize)\n" "\n" "Sets gradient function to minimize. \n" "\n" ""}, +<<<<<<< HEAD { (char *)"IMinimizer_getMinValue", _wrap_IMinimizer_getMinValue, METH_VARARGS, (char *)"IMinimizer_getMinValue(IMinimizer self) -> double"}, { (char *)"IMinimizer_reportResults", _wrap_IMinimizer_reportResults, METH_VARARGS, (char *)"IMinimizer_reportResults(IMinimizer self) -> std::string"}, { (char *)"IMinimizer_propagateResults", _wrap_IMinimizer_propagateResults, METH_VARARGS, (char *)"IMinimizer_propagateResults(IMinimizer self, FitParameterSet parameters)"}, +======= + { (char *)"IMinimizer_getNumberOfVariables", _wrap_IMinimizer_getNumberOfVariables, METH_VARARGS, (char *)"\n" + "IMinimizer_getNumberOfVariables(IMinimizer self) -> size_t\n" + "\n" + "size_t IMinimizer::getNumberOfVariables() const\n" + "\n" + "Returns number of variables to fit. \n" + "\n" + ""}, + { (char *)"IMinimizer_getMinValue", _wrap_IMinimizer_getMinValue, METH_VARARGS, (char *)"\n" + "IMinimizer_getMinValue(IMinimizer self) -> double\n" + "\n" + "double IMinimizer::getMinValue() const\n" + "\n" + "Returns minimum function value. \n" + "\n" + ""}, + { (char *)"IMinimizer_getValueOfVariableAtMinimum", _wrap_IMinimizer_getValueOfVariableAtMinimum, METH_VARARGS, (char *)"\n" + "IMinimizer_getValueOfVariableAtMinimum(IMinimizer self, size_t index) -> double\n" + "\n" + "double IMinimizer::getValueOfVariableAtMinimum(size_t index) const\n" + "\n" + "Returns value of the parameter at the minimum. \n" + "\n" + ""}, + { (char *)"IMinimizer_getValueOfVariablesAtMinimum", _wrap_IMinimizer_getValueOfVariablesAtMinimum, METH_VARARGS, (char *)"\n" + "IMinimizer_getValueOfVariablesAtMinimum(IMinimizer self) -> vdouble1d_t\n" + "\n" + "std::vector< double > IMinimizer::getValueOfVariablesAtMinimum() const\n" + "\n" + "Returns values of parameters at the minimum. \n" + "\n" + ""}, + { (char *)"IMinimizer_getErrorOfVariable", _wrap_IMinimizer_getErrorOfVariable, METH_VARARGS, (char *)"\n" + "IMinimizer_getErrorOfVariable(IMinimizer self, size_t index) -> double\n" + "\n" + "double IMinimizer::getErrorOfVariable(size_t index) const\n" + "\n" + "Returns error of variable at minimum. \n" + "\n" + ""}, + { (char *)"IMinimizer_getErrorOfVariables", _wrap_IMinimizer_getErrorOfVariables, METH_VARARGS, (char *)"\n" + "IMinimizer_getErrorOfVariables(IMinimizer self) -> vdouble1d_t\n" + "\n" + "std::vector< double > IMinimizer::getErrorOfVariables() const\n" + "\n" + "Returns errors of variables at minimum. \n" + "\n" + ""}, + { (char *)"IMinimizer_clear", _wrap_IMinimizer_clear, METH_VARARGS, (char *)"\n" + "IMinimizer_clear(IMinimizer self)\n" + "\n" + "void IMinimizer::clear()\n" + "\n" + "clear resources (parameters) for consecutives minimizations \n" + "\n" + ""}, + { (char *)"IMinimizer_reportResults", _wrap_IMinimizer_reportResults, METH_VARARGS, (char *)"\n" + "IMinimizer_reportResults(IMinimizer self) -> std::string\n" + "\n" + "std::string IMinimizer::reportResults() const\n" + "\n" + "Prints fit results. \n" + "\n" + ""}, + { (char *)"IMinimizer_propagateResults", _wrap_IMinimizer_propagateResults, METH_VARARGS, (char *)"\n" + "IMinimizer_propagateResults(IMinimizer self, FitSuiteParameters parameters)\n" + "\n" + "void IMinimizer::propagateResults(FitSuiteParameters ¶meters)\n" + "\n" + "Propagates results of minimization to fit parameter set. \n" + "\n" + ""}, +>>>>>>> upstream/develop { (char *)"IMinimizer_swigregister", IMinimizer_swigregister, METH_VARARGS, NULL}, { (char *)"new_FitParameter", _wrap_new_FitParameter, METH_VARARGS, (char *)"\n" "FitParameter()\n" @@ -22367,7 +22940,12 @@ static PyMethodDef SwigMethods[] = { "std::string FitParameter::getName() const \n" "\n" ""}, - { (char *)"FitParameter_getStartValue", _wrap_FitParameter_getStartValue, METH_VARARGS, (char *)"FitParameter_getStartValue(FitParameter self) -> double"}, + { (char *)"FitParameter_getStartValue", _wrap_FitParameter_getStartValue, METH_VARARGS, (char *)"\n" + "FitParameter_getStartValue(FitParameter self) -> double\n" + "\n" + "virtual double FitParameter::getStartValue() const \n" + "\n" + ""}, { (char *)"FitParameter_setValue", _wrap_FitParameter_setValue, METH_VARARGS, (char *)"\n" "FitParameter_setValue(FitParameter self, double value)\n" "\n" @@ -22404,8 +22982,14 @@ static PyMethodDef SwigMethods[] = { "double FitParameter::getError() const \n" "\n" ""}, - { (char *)"FitParameter_limitsToString", _wrap_FitParameter_limitsToString, METH_VARARGS, (char *)"FitParameter_limitsToString(FitParameter self) -> std::string"}, + { (char *)"FitParameter_limitsToString", _wrap_FitParameter_limitsToString, METH_VARARGS, (char *)"\n" + "FitParameter_limitsToString(FitParameter self) -> std::string\n" + "\n" + "std::string FitParameter::limitsToString() const \n" + "\n" + ""}, { (char *)"FitParameter_swigregister", FitParameter_swigregister, METH_VARARGS, NULL}, +<<<<<<< HEAD { (char *)"new_FitParameterSet", _wrap_new_FitParameterSet, METH_VARARGS, (char *)"new_FitParameterSet() -> FitParameterSet"}, { (char *)"delete_FitParameterSet", _wrap_delete_FitParameterSet, METH_VARARGS, (char *)"delete_FitParameterSet(FitParameterSet self)"}, { (char *)"FitParameterSet_clear", _wrap_FitParameterSet_clear, METH_VARARGS, (char *)"FitParameterSet_clear(FitParameterSet self)"}, @@ -22413,6 +22997,126 @@ static PyMethodDef SwigMethods[] = { { (char *)"FitParameterSet_begin", _wrap_FitParameterSet_begin, METH_VARARGS, (char *)"\n" "begin() -> FitParameterSet::iterator\n" "FitParameterSet_begin(FitParameterSet self) -> FitParameterSet::const_iterator\n" +======= + { (char *)"new_FitSuiteParameters", _wrap_new_FitSuiteParameters, METH_VARARGS, (char *)"\n" + "new_FitSuiteParameters() -> FitSuiteParameters\n" + "\n" + "FitSuiteParameters::FitSuiteParameters()\n" + "\n" + ""}, + { (char *)"delete_FitSuiteParameters", _wrap_delete_FitSuiteParameters, METH_VARARGS, (char *)"\n" + "delete_FitSuiteParameters(FitSuiteParameters self)\n" + "\n" + "FitSuiteParameters::~FitSuiteParameters()\n" + "\n" + ""}, + { (char *)"FitSuiteParameters_clear", _wrap_FitSuiteParameters_clear, METH_VARARGS, (char *)"\n" + "FitSuiteParameters_clear(FitSuiteParameters self)\n" + "\n" + "void FitSuiteParameters::clear()\n" + "\n" + "Clears all defined parameters. \n" + "\n" + ""}, + { (char *)"FitSuiteParameters_addFitParameter", _wrap_FitSuiteParameters_addFitParameter, METH_VARARGS, (char *)"\n" + "FitSuiteParameters_addFitParameter(FitSuiteParameters self, FitParameter par)\n" + "\n" + "void FitSuiteParameters::addFitParameter(FitParameter *par)\n" + "\n" + "Adds fit parameter. \n" + "\n" + ""}, + { (char *)"FitSuiteParameters_getFitParameters", _wrap_FitSuiteParameters_getFitParameters, METH_VARARGS, (char *)"\n" + "getFitParameters() -> std::vector< FitParameter *,std::allocator< FitParameter * > >\n" + "FitSuiteParameters_getFitParameters(FitSuiteParameters self) -> std::vector< FitParameter *,std::allocator< FitParameter * > > const &\n" + "\n" + "const std::vector<FitParameter*>& FitSuiteParameters::getFitParameters() const \n" + "\n" + ""}, + { (char *)"FitSuiteParameters_getFitParameter", _wrap_FitSuiteParameters_getFitParameter, METH_VARARGS, (char *)"\n" + "getFitParameter(std::string const & name) -> FitParameter\n" + "FitSuiteParameters_getFitParameter(FitSuiteParameters self, std::string const & name) -> FitParameter\n" + "\n" + "FitParameter * FitSuiteParameters::getFitParameter(const std::string &name)\n" + "\n" + ""}, + { (char *)"FitSuiteParameters_setValues", _wrap_FitSuiteParameters_setValues, METH_VARARGS, (char *)"\n" + "setValues(double const * pars_values)\n" + "FitSuiteParameters_setValues(FitSuiteParameters self, vdouble1d_t pars_values)\n" + "\n" + "void FitSuiteParameters::setValues(const std::vector< double > &pars_values)\n" + "\n" + ""}, + { (char *)"FitSuiteParameters_getValues", _wrap_FitSuiteParameters_getValues, METH_VARARGS, (char *)"\n" + "FitSuiteParameters_getValues(FitSuiteParameters self) -> vdouble1d_t\n" + "\n" + "std::vector< double > FitSuiteParameters::getValues() const\n" + "\n" + "Returns values of all defined parameters. \n" + "\n" + ""}, + { (char *)"FitSuiteParameters_setErrors", _wrap_FitSuiteParameters_setErrors, METH_VARARGS, (char *)"\n" + "FitSuiteParameters_setErrors(FitSuiteParameters self, vdouble1d_t pars_errors)\n" + "\n" + "void FitSuiteParameters::setErrors(const std::vector< double > &pars_errors)\n" + "\n" + "Sets errors to all parameters. \n" + "\n" + ""}, + { (char *)"FitSuiteParameters_getErrors", _wrap_FitSuiteParameters_getErrors, METH_VARARGS, (char *)"\n" + "FitSuiteParameters_getErrors(FitSuiteParameters self) -> vdouble1d_t\n" + "\n" + "std::vector< double > FitSuiteParameters::getErrors() const\n" + "\n" + "Returns errors of all defined parameters. \n" + "\n" + ""}, + { (char *)"FitSuiteParameters_size", _wrap_FitSuiteParameters_size, METH_VARARGS, (char *)"\n" + "FitSuiteParameters_size(FitSuiteParameters self) -> size_t\n" + "\n" + "size_t FitSuiteParameters::size() const\n" + "\n" + "Returns number of parameters. \n" + "\n" + ""}, + { (char *)"FitSuiteParameters_begin", _wrap_FitSuiteParameters_begin, METH_VARARGS, (char *)"\n" + "begin() -> std::vector< FitParameter *,std::allocator< FitParameter * > >::iterator\n" + "FitSuiteParameters_begin(FitSuiteParameters self) -> std::vector< FitParameter *,std::allocator< FitParameter * > >::const_iterator\n" + "\n" + "std::vector<FitParameter*>::const_iterator FitSuiteParameters::begin() const \n" + "\n" + ""}, + { (char *)"FitSuiteParameters_end", _wrap_FitSuiteParameters_end, METH_VARARGS, (char *)"\n" + "end() -> std::vector< FitParameter *,std::allocator< FitParameter * > >::iterator\n" + "FitSuiteParameters_end(FitSuiteParameters self) -> std::vector< FitParameter *,std::allocator< FitParameter * > >::const_iterator\n" + "\n" + "std::vector<FitParameter*>::const_iterator FitSuiteParameters::end() const \n" + "\n" + ""}, + { (char *)"FitSuiteParameters_numberOfFreeFitParameters", _wrap_FitSuiteParameters_numberOfFreeFitParameters, METH_VARARGS, (char *)"\n" + "FitSuiteParameters_numberOfFreeFitParameters(FitSuiteParameters self) -> size_t\n" + "\n" + "size_t FitSuiteParameters::numberOfFreeFitParameters() const\n" + "\n" + "Returns number of free parameters. \n" + "\n" + ""}, + { (char *)"FitSuiteParameters_printFitParameters", _wrap_FitSuiteParameters_printFitParameters, METH_VARARGS, (char *)"\n" + "FitSuiteParameters_printFitParameters(FitSuiteParameters self)\n" + "\n" + "void FitSuiteParameters::printFitParameters() const\n" + "\n" + "Print defined parameters. \n" + "\n" + ""}, + { (char *)"FitSuiteParameters_fixAll", _wrap_FitSuiteParameters_fixAll, METH_VARARGS, (char *)"\n" + "FitSuiteParameters_fixAll(FitSuiteParameters self)\n" + "\n" + "void FitSuiteParameters::fixAll()\n" + "\n" + "Fix all parameters. \n" + "\n" +>>>>>>> upstream/develop ""}, { (char *)"FitParameterSet_end", _wrap_FitParameterSet_end, METH_VARARGS, (char *)"\n" "end() -> FitParameterSet::iterator\n" @@ -22429,6 +23133,7 @@ static PyMethodDef SwigMethods[] = { "valuesDifferFrom(vdouble1d_t par_values, double tolerance=2.0) -> bool\n" "FitParameterSet_valuesDifferFrom(FitParameterSet self, vdouble1d_t par_values) -> bool\n" ""}, +<<<<<<< HEAD { (char *)"FitParameterSet_errors", _wrap_FitParameterSet_errors, METH_VARARGS, (char *)"FitParameterSet_errors(FitParameterSet self) -> vdouble1d_t"}, { (char *)"FitParameterSet_setErrors", _wrap_FitParameterSet_setErrors, METH_VARARGS, (char *)"FitParameterSet_setErrors(FitParameterSet self, vdouble1d_t pars_errors)"}, { (char *)"FitParameterSet_freeFitParameterCount", _wrap_FitParameterSet_freeFitParameterCount, METH_VARARGS, (char *)"FitParameterSet_freeFitParameterCount(FitParameterSet self) -> size_t"}, @@ -22441,6 +23146,27 @@ static PyMethodDef SwigMethods[] = { { (char *)"FitParameterSet_setCorrelationMatrix", _wrap_FitParameterSet_setCorrelationMatrix, METH_VARARGS, (char *)"FitParameterSet_setCorrelationMatrix(FitParameterSet self, vdouble2d_t matrix)"}, { (char *)"FitParameterSet_isExistingName", _wrap_FitParameterSet_isExistingName, METH_VARARGS, (char *)"FitParameterSet_isExistingName(FitParameterSet self, std::string const & name) -> bool"}, { (char *)"FitParameterSet___getitem__", _wrap_FitParameterSet___getitem__, METH_VARARGS, (char *)"\n" +======= + { (char *)"FitSuiteParameters_reportResults", _wrap_FitSuiteParameters_reportResults, METH_VARARGS, (char *)"\n" + "FitSuiteParameters_reportResults(FitSuiteParameters self) -> std::string\n" + "\n" + "std::string FitSuiteParameters::reportResults() const \n" + "\n" + ""}, + { (char *)"FitSuiteParameters_correlationMatrix", _wrap_FitSuiteParameters_correlationMatrix, METH_VARARGS, (char *)"\n" + "FitSuiteParameters_correlationMatrix(FitSuiteParameters self) -> vdouble2d_t\n" + "\n" + "corr_matrix_t FitSuiteParameters::correlationMatrix() const \n" + "\n" + ""}, + { (char *)"FitSuiteParameters_setCorrelationMatrix", _wrap_FitSuiteParameters_setCorrelationMatrix, METH_VARARGS, (char *)"\n" + "FitSuiteParameters_setCorrelationMatrix(FitSuiteParameters self, vdouble2d_t matrix)\n" + "\n" + "void FitSuiteParameters::setCorrelationMatrix(const corr_matrix_t &matrix)\n" + "\n" + ""}, + { (char *)"FitSuiteParameters___getitem__", _wrap_FitSuiteParameters___getitem__, METH_VARARGS, (char *)"\n" +>>>>>>> upstream/develop "__getitem__(std::string name) -> FitParameter\n" "FitParameterSet___getitem__(FitParameterSet self, size_t index) -> FitParameter\n" ""}, @@ -22451,9 +23177,30 @@ static PyMethodDef SwigMethods[] = { "MinimizerCatalogue::MinimizerCatalogue()\n" "\n" ""}, - { (char *)"MinimizerCatalogue_toString", _wrap_MinimizerCatalogue_toString, METH_VARARGS, (char *)"MinimizerCatalogue_toString(MinimizerCatalogue self) -> std::string"}, - { (char *)"MinimizerCatalogue_algorithmNames", _wrap_MinimizerCatalogue_algorithmNames, METH_VARARGS, (char *)"MinimizerCatalogue_algorithmNames(MinimizerCatalogue self, std::string const & minimizerName) -> vector_string_t"}, - { (char *)"MinimizerCatalogue_algorithmDescriptions", _wrap_MinimizerCatalogue_algorithmDescriptions, METH_VARARGS, (char *)"MinimizerCatalogue_algorithmDescriptions(MinimizerCatalogue self, std::string const & minimizerName) -> vector_string_t"}, + { (char *)"MinimizerCatalogue_toString", _wrap_MinimizerCatalogue_toString, METH_VARARGS, (char *)"\n" + "MinimizerCatalogue_toString(MinimizerCatalogue self) -> std::string\n" + "\n" + "std::string MinimizerCatalogue::toString() const\n" + "\n" + "Returns multiline string representing catalogue content. \n" + "\n" + ""}, + { (char *)"MinimizerCatalogue_algorithmNames", _wrap_MinimizerCatalogue_algorithmNames, METH_VARARGS, (char *)"\n" + "MinimizerCatalogue_algorithmNames(MinimizerCatalogue self, std::string const & minimizerName) -> vector_string_t\n" + "\n" + "std::vector< std::string > MinimizerCatalogue::algorithmNames(const std::string &minimizerName) const\n" + "\n" + "Returns list of algorithms defined for the minimizer with a given name. \n" + "\n" + ""}, + { (char *)"MinimizerCatalogue_algorithmDescriptions", _wrap_MinimizerCatalogue_algorithmDescriptions, METH_VARARGS, (char *)"\n" + "MinimizerCatalogue_algorithmDescriptions(MinimizerCatalogue self, std::string const & minimizerName) -> vector_string_t\n" + "\n" + "std::vector< std::string > MinimizerCatalogue::algorithmDescriptions(const std::string &minimizerName) const\n" + "\n" + "Returns list of algorithm's descriptions for the minimizer with a given name . \n" + "\n" + ""}, { (char *)"delete_MinimizerCatalogue", _wrap_delete_MinimizerCatalogue, METH_VARARGS, (char *)"delete_MinimizerCatalogue(MinimizerCatalogue self)"}, { (char *)"MinimizerCatalogue_swigregister", MinimizerCatalogue_swigregister, METH_VARARGS, NULL}, { (char *)"MinimizerFactory_printCatalogue", _wrap_MinimizerFactory_printCatalogue, METH_VARARGS, (char *)"MinimizerFactory_printCatalogue()"}, @@ -22472,6 +23219,10 @@ static PyMethodDef SwigMethods[] = { "\n" "Factory to create minimizers.\n" "\n" + "Minimizer | Algorithms\n" + "\n" + "Minuit2 | Migrad Simplex Combined Scan Fumili GSLMultiMin | SteepestDescent ConjugateFR ConjugatePR BFGS BFGS2 GSLLMA | Default GSLSimAn | Default Genetic | Default\n" + "\n" "C++ includes: MinimizerFactory.h\n" "\n" ""}, diff --git a/dev-tools/plot-ff/plotff.py b/dev-tools/plot-ff/plotff.py index 0515e28059493e661c1a893a5885295c1e0d243e..d8392424dd86b9bcefdd08cdeb1b444effefcaca 100644 --- a/dev-tools/plot-ff/plotff.py +++ b/dev-tools/plot-ff/plotff.py @@ -11,7 +11,7 @@ from libBornAgainCore import * ff = FormFactorPyramid(13*nanometer, 10.0*nanometer, 60*degree) -# volume +# volume # I suggest, that the formfactor evaluated for q=0 gives the volume # please correct if not zero = cvector_t(0,0,0) @@ -53,24 +53,24 @@ ROOT.gStyle.SetPadLeftMargin(0.18) ROOT.gStyle.SetPadBottomMargin(0.18) t = ROOT.TText() -# create ROOT histograms +# create ROOT histograms hist = ROOT.TH2D("hist","Sphere:H=R",nqy,qymin,qymax, nqz, qzmin, qzmax) hist2 = ROOT.TH2D("hist2","Sphere:H=R",nqx,qxmin,qxmax, nqy, qymin, qymax) # and fill them with the values for i in range(nqy): - qy = qymin + i*stepqy - for j in range(nqz): - qz = qzmin + j*stepqz - k = cvector_t(0,qy,qz) - hist.Fill(qy,qz,(abs(ff.evaluate_for_q(k)))**2+1) + qy = qymin + i*stepqy + for j in range(nqz): + qz = qzmin + j*stepqz + k = cvector_t(0,qy,qz) + hist.Fill(qy,qz,(abs(ff.evaluate_for_q(k)))**2+1) for i in range(nqy): - qy = qymin + i*stepqy - for j in range(nqx): - qx = qxmin + j*stepqx - k = cvector_t(qx,qy,0) - hist2.Fill(qx,qy,(abs(ff.evaluate_for_q(k)))**2+1) + qy = qymin + i*stepqy + for j in range(nqx): + qx = qxmin + j*stepqx + k = cvector_t(qx,qy,0) + hist2.Fill(qx,qy,(abs(ff.evaluate_for_q(k)))**2+1) # create a ROOT canvas and put all plots on it