Generic#

class astropy.units.format.Generic(*args, **kwargs)[source]#

Bases: Base, _GenericParserMixin

A “generic” format.

The syntax of the format is based directly on the FITS standard, but instead of only supporting the units that FITS knows about, it supports any unit available in the astropy.units namespace.

Attributes Summary

Methods Summary

format_exponential_notation(val[, format_spec])

Formats a value in exponential notation.

parse(s[, debug])

Convert a string to a unit object.

Attributes Documentation

name: ClassVar[str] = 'generic'#

Methods Documentation

classmethod format_exponential_notation(val: UnitScale | np.number, format_spec: str = 'g') str[source]#

Formats a value in exponential notation.

Parameters:
valnumber

The value to be formatted

format_specstr, optional

Format used to split up mantissa and exponent

Returns:
str

The value in exponential notation in a this class’s format.

classmethod parse(s: str, debug: bool = False) UnitBase[source]#

Convert a string to a unit object.