astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- Astropy v5.2.1 »
- Units and Quantities (`astropy.units`) »
- UnrecognizedUnit

# UnrecognizedUnit

class astropy.units.UnrecognizedUnit(st, doc=None, format=None, namespace=None)

  Bases: `IrreducibleUnit`

  A unit that did not parse correctly. This allows for round-tripping it as a string, but no unit operations actually work on it.

  Parameters:
    st `python:str`

      The name of the unit.

  Methods Summary

  `get_format_name`(format) | Get a name for this unit that is specific to a particular format.
  `is_equivalent`(other[, equivalencies]) | Returns `True` if this unit is equivalent to `other`.
  `is_unity`() | Returns `True` if the unit is unscaled and dimensionless.
  `to_string`([format]) | Output the unit in the given format as a string.

  Methods Documentation

  get_format_name(format)

    Get a name for this unit that is specific to a particular format.

    Uses the dictionary passed into the `format` kwarg in the constructor.

    Parameters:
      format `python:str`

        The name of the format

    Returns:
      name `python:str`

        The name of the unit for the given format.

  is_equivalent(other, equivalencies=None)

    Returns `True` if this unit is equivalent to `other`.

    Parameters:
      other `Unit`, `python:str`, or `python: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 `python:list` of `python:tuple`

        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`. Use `None` to turn off all equivalencies.

    Returns:
      bool
  is_unity()

    Returns `True` if the unit is unscaled and dimensionless.

  to_string(format=None)

    Output the unit in the given format as a string.

    Parameters:
      format `astropy.units.format.Base` instance or `python:str`

        The name of a format or a formatter object. If not provided, defaults to the generic format.