BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Utility functions for writing Python code snippets. More...
Functions | |
std::string | indent (size_t width=4u) |
Returns a string of blanks with given width. More... | |
bool | isHexagonal (double length1, double length2, double angle) |
bool | isSquare (double length1, double length2, double angle) |
std::string | printBool (double value) |
std::string | printDegrees (double input) |
std::string | printDouble (double input) |
std::string | printImportedSymbols (const std::string &code) |
std::string | printInt (int value) |
std::string | printKvector (const kvector_t value) |
std::string | printLightDouble (double input) |
prints double as an integer, if possible within standard accuracy More... | |
std::string | printNm (double input) |
std::string | printNm2 (double input) |
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... | |
std::string | printScientificDouble (double input) |
std::string | printString (const std::string &value) |
std::string | printValue (double value, const std::string &units) |
Utility functions for writing Python code snippets.
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 155 of file PyFmt.cpp.
Referenced by SampleToPython::defineCoreShellParticles(), SampleToPython::defineCrystals(), SampleToPython::defineFormFactors(), SampleToPython::defineInterferenceFunctions(), SampleToPython::defineLattices2D(), SampleToPython::defineLattices3D(), SampleToPython::defineLayers(), SampleToPython::defineMaterials(), SampleToPython::defineMesoCrystals(), SampleToPython::defineMultiLayers(), SampleToPython::defineParticleCompositions(), SampleToPython::defineParticleDistributions(), SampleToPython::defineParticleLayouts(), SampleToPython::defineParticles(), SampleToPython::defineRoughnesses(), pyfmt2::printRangedDistribution(), and pyfmt2::representShape2D().
bool pyfmt::isHexagonal | ( | double | length1, |
double | length2, | ||
double | angle | ||
) |
Definition at line 142 of file PyFmt.cpp.
References algo::almostEqual(), and M_TWOPI.
bool pyfmt::isSquare | ( | double | length1, |
double | length2, | ||
double | angle | ||
) |
Definition at line 137 of file PyFmt.cpp.
References algo::almostEqual(), and M_PI_2.
std::string pyfmt::printBool | ( | double | value | ) |
Definition at line 36 of file PyFmt.cpp.
Referenced by pyfmt2::representShape2D().
std::string pyfmt::printDegrees | ( | double | input | ) |
Definition at line 111 of file PyFmt.cpp.
References printLightDouble(), and Units::rad2deg().
Referenced by SampleToPython::defineInterferenceFunctions(), SampleToPython::defineLattices2D(), printValue(), and pyfmt2::representShape2D().
std::string pyfmt::printDouble | ( | double | input | ) |
Definition at line 41 of file PyFmt.cpp.
Referenced by SampleToPython::defineInterferenceFunctions(), SampleToPython::defineMaterials(), SampleToPython::defineParticleLayouts(), printKvector(), pyfmt2::printParameterDistribution(), pyfmt2::printRangedDistribution(), and printValue().
std::string pyfmt::printImportedSymbols | ( | const std::string & | code | ) |
Definition at line 24 of file PyFmt.cpp.
References StringUtils::join().
std::string pyfmt::printInt | ( | int | value | ) |
std::string pyfmt::printKvector | ( | const kvector_t | value | ) |
Definition at line 147 of file PyFmt.cpp.
References printDouble(), BasicVector3D< T >::x(), BasicVector3D< T >::y(), and BasicVector3D< T >::z().
std::string pyfmt::printLightDouble | ( | double | input | ) |
prints double as an integer, if possible within standard accuracy
Definition at line 56 of file PyFmt.cpp.
Referenced by printDegrees(), printNm(), and printNm2().
std::string pyfmt::printNm | ( | double | input | ) |
Definition at line 74 of file PyFmt.cpp.
References printLightDouble().
Referenced by SampleToPython::defineInterferenceFunctions(), SampleToPython::defineLattices2D(), SampleToPython::defineLattices3D(), SampleToPython::defineLayers(), and printValue().
std::string pyfmt::printNm2 | ( | double | input | ) |
Definition at line 82 of file PyFmt.cpp.
References printLightDouble().
Referenced by SampleToPython::defineInterferenceFunctions().
std::string pyfmt::printRealLimits | ( | const RealLimits & | limits, |
const std::string & | units | ||
) |
Definition at line 22 of file PyFmtLimits.cpp.
References RealLimits::isLimited(), RealLimits::isLimitless(), RealLimits::isLowerLimited(), RealLimits::isNonnegative(), RealLimits::isPositive(), RealLimits::isUpperLimited(), RealLimits::lowerLimit(), printValue(), and RealLimits::upperLimit().
Referenced by 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 60 of file PyFmtLimits.cpp.
References RealLimits::isLimitless(), and printRealLimits().
Referenced by pyfmt2::printParameterDistribution(), and pyfmt2::printRangedDistribution().
std::string pyfmt::printScientificDouble | ( | double | input | ) |
Definition at line 91 of file PyFmt.cpp.
References StringUtils::scientific().
Referenced by SampleToPython::defineMultiLayers(), and PlotEventInfo::valueToString().
std::string pyfmt::printString | ( | const std::string & | value | ) |
std::string pyfmt::printValue | ( | double | value, |
const std::string & | units | ||
) |
Definition at line 118 of file PyFmt.cpp.
References printDegrees(), printDouble(), and printNm().
Referenced by pyfmt2::printAxis(), printRealLimits(), and pyfmt2::valueTimesUnit().