BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
PyFmt2.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sim/Export/PyFmt2.h
6 //! @brief Defines namespace pyfmt2.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifdef SWIG
16 #error no need to expose this header to Swig
17 #endif
18 
19 #ifndef USER_API
20 #ifndef BORNAGAIN_SIM_EXPORT_PYFMT2_H
21 #define BORNAGAIN_SIM_EXPORT_PYFMT2_H
22 
23 #include <functional>
24 #include <string>
25 
26 class IAxis;
27 class IDistribution1D;
28 class IShape2D;
31 
32 //! Utility functions for writing Python code snippets.
33 
34 namespace Py::Fmt2 {
35 
36 std::string representShape2D(const std::string& indent, const IShape2D* ishape, bool mask_value,
37  std::function<std::string(double)> printValueFunc);
38 
39 std::string printAxis(const IAxis* axis, const std::string& unit);
40 
41 std::string printParameterDistribution(const ParameterDistribution& par_distr,
42  const std::string& distVarName,
43  const std::string& units = "");
44 
45 std::string printRangedDistribution(const IRangedDistribution& distr);
46 
47 } // namespace Py::Fmt2
48 
49 #endif // BORNAGAIN_SIM_EXPORT_PYFMT2_H
50 #endif // USER_API
Abstract base class for one-dimensional axes.
Definition: IAxis.h:27
Interface for one-dimensional distributions.
Definition: Distributions.h:33
Interface for one-dimensional ranged distributions. All derived distributions allow for generating sa...
Basic class for all shapes in 2D.
Definition: IShape2D.h:26
A parametric distribution function, for use with any model parameter.
Utility functions for writing Python code snippets.
Definition: PyFmt2.cpp:34
std::string representShape2D(const std::string &indent, const IShape2D *ishape, bool mask_value, std::function< std::string(double)> printValueFunc)
Returns fixed Python code snippet that defines the function "simulate".
Definition: PyFmt2.cpp:38
std::string printRangedDistribution(const IRangedDistribution &distr)
Definition: PyFmt2.cpp:124
std::string printParameterDistribution(const ParameterDistribution &par_distr, const std::string &distVarName, const std::string &units)
Definition: PyFmt2.cpp:111
std::string printAxis(const IAxis *axis, const std::string &unit)
Prints an axis.
Definition: PyFmt2.cpp:93
std::string indent(size_t width)
Returns a string of blanks with given width. By default the width equals standard offset in python fi...
Definition: PyFmt.cpp:203