39                              std::function<std::string(
double)> printValueFunc)
 
   41     std::ostringstream result;
 
   42     result << std::setprecision(12);
 
   45         std::vector<double> xpos, ypos;
 
   46         shape->getPoints(xpos, ypos);
 
   47         result << 
indent << 
"points = [";
 
   48         for (
size_t i = 0; i < xpos.size(); ++i) {
 
   49             result << 
"[" << printValueFunc(xpos[i]) << 
", " << printValueFunc(ypos[i]) << 
"]";
 
   50             if (i != xpos.size() - 1)
 
   54         result << 
indent << 
"simulation.addMask(" 
   55                << 
"ba.Polygon(points), " << pyfmt::printBool(mask_value) << 
")\n";
 
   58         result << 
indent << 
"simulation.maskAll()\n";
 
   60     } 
else if (
const Ellipse* shape = 
dynamic_cast<const Ellipse*
>(ishape)) {
 
   61         result << 
indent << 
"simulation.addMask(";
 
   62         result << 
"ba.Ellipse(" << printValueFunc(shape->getCenterX()) << 
", " 
   63                << printValueFunc(shape->getCenterY()) << 
", " << printValueFunc(shape->getRadiusX())
 
   64                << 
", " << printValueFunc(shape->getRadiusY());
 
   65         if (shape->getTheta() != 0.0)
 
   66             result << 
", " << pyfmt::printDegrees(shape->getTheta());
 
   67         result << 
"), " << pyfmt::printBool(mask_value) << 
")\n";
 
   71         result << 
indent << 
"simulation.addMask(";
 
   72         result << 
"ba.Rectangle(" << printValueFunc(shape->getXlow()) << 
", " 
   73                << printValueFunc(shape->getYlow()) << 
", " << printValueFunc(shape->getXup())
 
   74                << 
", " << printValueFunc(shape->getYup()) << 
"), " << pyfmt::printBool(mask_value)
 
   79         result << 
indent << 
"simulation.addMask(";
 
   80         result << 
"ba.VerticalLine(" << printValueFunc(shape->getXpos()) << 
"), " 
   81                << pyfmt::printBool(mask_value) << 
")\n";
 
   85         result << 
indent << 
"simulation.addMask(";
 
   86         result << 
"ba.HorizontalLine(" << printValueFunc(shape->getYpos()) << 
"), " 
   87                << pyfmt::printBool(mask_value) << 
")\n";
 
   90         throw std::runtime_error(
"representShape2D(const IShape2D*) -> Error. Unknown shape");
 
   99     if (par->unit() == 
"rad")
 
  100         return pyfmt::printDegrees(par->
value());
 
  101     return pyfmt::printDouble(par->
value()) + (par->unit() == 
"" ? 
"" : (
"*" + par->unit()));
 
  108     std::vector<std::string> args;
 
  119     std::unique_ptr<IDistribution1D> distr(par_distr.clone());
 
  120     distr->setUnits(units);
 
  122     std::ostringstream result;
 
  123     result << 
"ba." << distr->getName() << 
"(" << 
argumentList(distr.get()) << 
")";
 
  128                                        const std::string& distVarName, 
const std::string& units)
 
  130     std::ostringstream result;
 
  132     result << 
"ba.ParameterDistribution(" 
  134            << 
", " << distVarName << 
", " << par_distr.
getNbrSamples() << 
", " 
Defines and implements namespace algo with some algorithms.
 
Defines classes representing one-dimensional distributions.
 
Defines class InfinitePlane.
 
Defines M_PI and some more mathematical constants.
 
Defines class ParameterDistribution.
 
Defines class ParameterPool.
 
Defines namespace pyfmt2.
 
Defines functions in namespace pyfmt.
 
Defines functions in namespace pyfmt.
 
Defines class RealParameter.
 
Defines a few helper functions.
 
Defines some unit conversion factors and other constants in namespace Units.
 
An infinite horizontal line.
 
Interface for one-dimensional distributions.
 
Manages a local parameter pool, and a tree of child pools.
 
ParameterPool * parameterPool() const
Returns pointer to the parameter pool.
 
Basic class for all shapes in 2D.
 
The infinite plane is used for masking everything once and forever.
 
A parametric distribution function, for use with any model parameter.
 
size_t getNbrSamples() const
get number of samples for this distribution
 
double getSigmaFactor() const
get the sigma factor
 
std::string getMainParameterName() const
get the main parameter's name
 
const std::vector< RealParameter * > parameters() const
Returns full vector of parameters.
 
Wraps a parameter of type double.
 
double value() const
Returns value of wrapped parameter.
 
The rectangle shape having its axis aligned to the (non-rotated) coordinate system.
 
An infinite vertical line.
 
std::string join(const std::vector< std::string > &joinable, const std::string &joint)
Returns string obtain by joining vector elements.
 
Utility functions for writing Python code snippets.
 
std::string argumentList(const IParameterized *ip)
Returns comma-separated list of parameter values, including unit multiplicator (like "* nm").
 
std::string printDistribution(const IDistribution1D &par_distr, const std::string &units)
Prints distribution with constructor parameters in given units.
 
std::string valueTimesUnit(const RealParameter *par)
Returns parameter value, followed by its unit multiplicator (like "* nm").
 
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 "runSimulation".
 
std::string indent(size_t width)
Returns a string of blanks with given width.
 
std::string printRealLimitsArg(const RealLimits &limits, const std::string &units)
Prints RealLimits in the form of argument (in the context of ParameterDistribution and similar).