UnrecognizedUnit¶
-
class
astropy.units.UnrecognizedUnit[source] [edit on github]¶ Bases:
astropy.units.IrreducibleUnitA unit that did not parse correctly. This allows for roundtripping it as a string, but no unit operations actually work on it.
Parameters: st : str
The name of the unit.
Methods Summary
Methods Documentation
-
get_format_name(format)[source] [edit on github]¶ Get a name for this unit that is specific to a particular format.
Uses the dictionary passed into the
formatkwarg in the constructor.Parameters: format : str
The name of the format
Returns: name : str
The name of the unit for the given format.
-
is_equivalent(other, equivalencies=None)[source] [edit on github]¶ Returns
Trueif this unit is equivalent toother.Parameters: other : unit object or string or tuple
The unit to convert to. If a tuple of units is specified, this method returns true if the unit matches any of those in the tuple.
equivalencies : list of equivalence pairs, optional
A list of equivalence pairs to try if the units are not directly convertible. See Equivalencies. This list is in addition to possible global defaults set by, e.g.,
set_enabled_equivalencies. UseNoneto turn off all equivalencies.Returns: bool
-
is_unity()[source] [edit on github]¶ Returns
Trueif the unit is unscaled and dimensionless.
-
to_string(format=<class 'astropy.units.format.generic.Generic'>)[source] [edit on github]¶ Output the unit in the given format as a string.
Parameters: format :
astropy.units.format.Baseinstance or strThe name of a format or a formatter object. If not provided, defaults to the generic format.
-