BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
pyfmt Namespace Reference

Utility functions for writing Python code snippets. More...

Functions

std::string scriptPreamble ()
 
std::string getSampleFunctionName ()
 
std::string printBool (double value)
 
std::string printDouble (double input)
 
std::string printNm (double input)
 
std::string printNm2 (double input)
 
std::string printScientificDouble (double input)
 
std::string printDegrees (double input)
 
std::string printValue (double value, const std::string &units)
 
std::string printString (const std::string &value)
 
bool isSquare (double length1, double length2, double angle)
 
bool isHexagonal (double length1, double length2, double angle)
 
std::string printKvector (const kvector_t value)
 
std::string indent (size_t width=4u)
 Returns a string of blanks with given width. More...
 
std::string printInt (int value)
 
std::string printRealLimits (const RealLimits &limits, const std::string &units)
 
std::string printRealLimitsArg (const RealLimits &limits, const std::string &units)
 Prints RealLimits in the form of argument (in the context of ParameterDistribution and similar). More...
 

Detailed Description

Utility functions for writing Python code snippets.

Function Documentation

◆ indent()

std::string pyfmt::indent ( size_t  width = 4u)

Returns a string of blanks with given width.

By default the width equals standard offset in python files.

Definition at line 141 of file PyFmt.cpp.

◆ printRealLimitsArg()

std::string pyfmt::printRealLimitsArg ( const RealLimits limits,
const std::string &  units 
)

Prints RealLimits in the form of argument (in the context of ParameterDistribution and similar).

Default RealLimits will not be printed, any other will be printed as ", ba.RealLimits.limited(1*deg, 2*deg)"

Definition at line 61 of file PyFmtLimits.cpp.