Skip to main content
`Ctrl`+`K`

# CDS

class astropy.units.format.CDS(*args, **kwargs)

  Bases: `Base`, `_ParsingFormatMixin`

  Support the Centre de Données astronomiques de Strasbourg Standards for Astronomical Catalogues 2.0 format, and the complete set of supported units. This format is used by VOTable up to version 1.2.

  Attributes Summary

  `name` |

  Methods Summary

  `parse`(s[, debug]) | Convert a string to a unit object.
  `to_string`(unit[, fraction, deprecations]) | Convert a unit to its string representation.

  Attributes Documentation

  name = 'cds'

  Methods Documentation

  classmethod parse(s, debug=False)

    Convert a string to a unit object.

  classmethod to_string(unit, fraction=False, deprecations=DeprecatedUnitAction.WARN)

    Convert a unit to its string representation.

    Implementation for `to_string`.

    Parameters:
      unit|Unit|

        The unit to convert.

      deprecations{“warn”, “silent”, “raise”, “convert”}, optional, keyword-only

        Whether deprecated units should emit a warning, be handled silently or raise an error. The “convert” option replaces the deprecated unit if possible and emits a warning otherwise.

      fraction{False|True|’inline’|’multiline’}, optional

        Options are as follows:

        - `False` : display unit bases with negative powers as they are (e.g., `km s-1`);

        - ‘inline’ or `True` : use a single-line fraction (e.g., `km / s`);

        - ‘multiline’ : use a multiline fraction if possible (available for the `latex`, `console` and `unicode` formats; e.g., `$\mathrm{\frac{km}{s}}$`). If not possible, use ‘inline’.

    Raises:
      `ValueError`

        If `fraction` is not recognized.