Skip to main content
`Ctrl`+`K`

# RadialRepresentation

class astropy.coordinates.RadialRepresentation(distance, differentials=None, copy=True)

  Bases: `BaseRepresentation`

  Representation of the distance of points from the origin.

  Note that this is mostly intended as an internal helper representation. It can do little else but being used as a scale in multiplication.

  Parameters:
    distance `Quantity` [:ref: ‘length’]

      The distance of the point(s) from the origin.

    differentials `python:dict`, `BaseDifferential`, optional

      Any differential classes that should be associated with this representation. The input must either be a single `BaseDifferential` instance (see `_compatible_differentials` for valid types), or a dictionary of of differential instances with keys set to a string representation of the SI unit with which the differential (derivative) is taken. For example, for a velocity differential on a positional representation, the key would be `'s'` for seconds, indicating that the derivative is a time derivative.

    copy bool, optional

      If `True` (default), arrays will be copied. If `False`, arrays will be references, though possibly broadcast to ensure matching shapes.

  Attributes Summary

  `attr_classes` |
  `distance` | The distance from the origin to the point(s).
  `name` | Name of the representation or differential.

  Methods Summary

  `from_cartesian`(cart) | Converts 3D rectangular cartesian coordinates to radial coordinate.
  `norm`() | Vector norm.
  `scale_factors`() | Scale factors for each component's direction.
  `to_cartesian`() | Cannot convert radial representation to cartesian.
  `transform`(matrix) | Radial representations cannot be transformed by a Cartesian matrix.
  `unit_vectors`() | Cartesian unit vectors are undefined for radial representation.

  Attributes Documentation

  attr_classes = {'distance': <class 'astropy.units.quantity.Quantity'>}
  distance

    The distance from the origin to the point(s).

  name = 'radial'

    Name of the representation or differential.

    When a subclass is defined, by default, the name is the lower-cased name of the class with with any trailing ‘representation’ or ‘differential’ removed. (E.g., ‘spherical’ for `SphericalRepresentation` or `SphericalDifferential`.)

    This can be customized when defining a subclass by setting the class attribute.

  Methods Documentation

  classmethod from_cartesian(cart)

    Converts 3D rectangular cartesian coordinates to radial coordinate.

  norm()

    Vector norm.

    Just the distance itself.

    Returns:
      norm `Quantity` [:ref: ‘dimensionless’]

        Dimensionless ones, with the same shape as the representation.

  scale_factors()

    Scale factors for each component’s direction.

    Given unit vectors \(\hat{e}_c\) and scale factors \(f_c\), a change in one component of \(\delta c\) corresponds to a change in representation of \(\delta c \times f_c \times \hat{e}_c\).

    Returns:
      scale_factors `python:dict` of `Quantity`

        The keys are the component names.

  to_cartesian()

    Cannot convert radial representation to cartesian.

  transform(matrix)

    Radial representations cannot be transformed by a Cartesian matrix.

    Parameters:
      matrix numpy:array_like

        The transformation matrix in a Cartesian basis. Must be a multiplication: a diagonal matrix with identical elements. Must have shape (…, 3, 3), where the last 2 indices are for the matrix on each other axis. Make sure that the matrix shape is compatible with the shape of this representation.

    Raises:
      `ValueError`

        If the matrix is not a multiplication.

  unit_vectors()

    Cartesian unit vectors are undefined for radial representation.