Data.format¶
- Data.format(key, mode='float', units=None, prefix=None, latex=False, fmt=None, escape=False)¶
Return the contents of key pretty formatted using
format_error().- Parameters:
datafile (Data) – Data object to work with if not being used as a bound method.
key (str) – Metadata key to get values from.
- Keyword Argume3nts:
fmt (str): Specify the output format, options are:
“text” - plain text output
“latex” - latex output
“html” - html entities
- escape (bool):
Specifies whether to escape the prefix and units for unprintable characters in non text formats )default False)
- mode (string):
If “float” (default) the number is formatted as is, if “eng” the value and error is converted to the next samllest power of 1000 and the appropriate SI index appended. If mode is “sci” then a scientific, i.e. mantissa and exponent format is used.
- units (string):
A suffix providing the units of the value. If si mode is used, then appropriate si prefixes are prepended to the units string. In LaTeX mode, the units string is embedded in mathrm
- prefix (string):
A prefix string that should be included before the value and error string. in LaTeX mode this is inside the math-mode markers, but not embedded in mathrm.
- latex (bool):
Whether to use latex formatting codes or not (mainly if the formatted text is going to be used with matplotlib.)
- Returns:
A pretty string representation.
The if key=”key”, then the value is datafile[“key”], the error is datafile[“key err”], the default prefix is datafile[“key label”]+”=” or “key=”, the units are datafile[“key units”] or “”.