cherab.inversion.tools.parse_scientific_notationยถ
-
cherab.inversion.tools.parse_scientific_notation(sci_str: str, scilimits: tuple =
(-1, 1), useLatex: bool =True) strSourceยถ Parse a string in scientific notation and return a formatted string.
Strings like
'1.23e-4'are converted tor'1.23x10^-4'orr'1.23 \\times 10^{-4}'ifuseLatexis True.- Parameters:
- sci_str: strยถ
String in scientific notation. Must be in the form of โmantissaโ + โeโ + โexponentโ.
- scilimits: tuple =
(-1, 1)ยถ Scientific notation parsing is conducted only for numbers outside the range 10 m to 10 n, by default (-1, 1).
- useLatex: bool =
Trueยถ If True, the output string will be formatted using LaTeX.
- Returns:
str โ The formatted string.
- Raises:
ValueError โ If the input string does not contain an โeโ character.
Examples
>>> parse_scientific_notation("1.23e-4") '1.23 \\\\times 10^{-4}'