Heliocentric#

class sunpy.coordinates.Heliocentric(*args, **kwargs)[source]#

Bases: SunPyBaseCoordinateFrame

A coordinate or frame in the Heliocentric system, which is observer-based.

  • The origin is the center of the Sun.

  • The Z-axis is aligned with the Sun-observer line.

  • The Y-axis is aligned with the component of the vector to the Sun’s north pole that is perpendicular to the Z-axis.

This frame defaults to a Cartesian component representation, which is known as Heliocentric Cartesian (HCC). This frame can also be represented using cylindrical components, where where rho is the impact parameter and psi is the position angle. psi is measured relative to the west limb, rather than solar north, so is shifted by 90 degrees compared to the convention of the Heliocentric Radial (HCR) system.

A new instance can be created using the following signatures (note that if supplied, obstime, observer, and representation_type must be keyword arguments):

Heliocentric(x, y, z, obstime=obstime, observer=observer)
Heliocentric(rho, psi, z, representation_type='cylindrical', obstime=obstime, observer=observer)
Parameters:
  • data (BaseRepresentation or None) – A representation object or None to have no data (or use the coordinate component arguments, see below).

  • x (Quantity, optional) – X-axis coordinate for this object. Not needed if data is given.

  • y (Quantity, optional) – Y-axis coordinate for this object. Not needed if data is given.

  • z (Quantity, optional) – Z-axis coordinate for this object. Not needed if data is given.

  • observer (HeliographicStonyhurst, str) – The location of the observer. If a string is provided, it must be a solar system body that can be parsed by get_body_heliographic_stonyhurst at the time obstime. Defaults to Earth center.

  • obstime (tuple, list, str, pandas.Timestamp, pandas.Series, pandas.DatetimeIndex, datetime.datetime, datetime.date, numpy.datetime64, numpy.ndarray, astropy.time.Time) – The time of the observation. This is used to determine the position of solar-system bodies (e.g., the Sun and the Earth) as needed to define the origin and orientation of the frame.

  • representation_type (BaseRepresentation, str, optional) – A representation class or string name of a representation class. This may change the valid coordinate component arguments from the defaults (see above). For example, passing representation_type='cartesian' will make the frame expect Cartesian coordinate component arguments (typically, x, y, and z).

  • copy (bool, optional) – If True (default), make copies of the input coordinate arrays.

Examples

>>> from astropy.coordinates import SkyCoord, CartesianRepresentation
>>> import sunpy.coordinates
>>> import astropy.units as u
>>> sc = SkyCoord(CartesianRepresentation(10*u.km, 1*u.km, 2*u.km),
...               obstime="2011/01/05T00:00:50", observer="earth", frame="heliocentric")
>>> sc
<SkyCoord (Heliocentric: obstime=2011-01-05T00:00:50.000, observer=<HeliographicStonyhurst Coordinate for 'earth'>): (x, y, z) in km
    (10., 1., 2.)>
>>> sc = SkyCoord([1,2]*u.km, [3,4]*u.m, [5,6]*u.cm,
...               obstime="2011/01/01T00:00:54", observer="earth", frame="heliocentric")
>>> sc
<SkyCoord (Heliocentric: obstime=2011-01-01T00:00:54.000, observer=<HeliographicStonyhurst Coordinate for 'earth'>): (x, y, z) in (km, m, cm)
    [(1., 3., 5.), (2., 4., 6.)]>
>>> sc = SkyCoord(CylindricalRepresentation(10*u.km, 60*u.deg, 10*u.km),
...               obstime="2011/01/05T00:00:50", observer="earth", frame="heliocentric")
>>> sc
<SkyCoord (Heliocentric: obstime=2011-01-05T00:00:50.000, observer=<HeliographicStonyhurst Coordinate for 'earth'>): (x, y, z) in km
    (5., 8.66025404, 10.)>

Attributes Summary

default_differential

Default representation for differential data (e.g., velocity)

default_representation

Default representation for position data

frame_attributes

frame_specific_representation_info

Mapping for frame-specific component names

name

observer

A frame attribute

Methods Summary

represent_as(base[, s, in_frame_units])

Generate and return a new representation of this frame's data as a Representation object.

Attributes Documentation

default_differential#

Default representation for differential data (e.g., velocity)

default_representation#

Default representation for position data

frame_attributes = {'observer': <sunpy.coordinates.frameattributes.ObserverCoordinateAttribute object>, 'obstime': <sunpy.coordinates.frameattributes.TimeFrameAttributeSunPy object>}#
frame_specific_representation_info#

Mapping for frame-specific component names

name = 'heliocentric'#
observer#

A frame attribute

No default value

Methods Documentation

represent_as(base, s='base', in_frame_units=False)[source]#

Generate and return a new representation of this frame’s data as a Representation object.

Note: In order to make an in-place change of the representation of a Frame or SkyCoord object, set the representation attribute of that object to the desired new representation, or use the set_representation_cls method to also set the differential.

Parameters:
  • base (subclass of BaseRepresentation or string) – The type of representation to generate. Must be a class (not an instance), or the string name of the representation class.

  • s (subclass of BaseDifferential, str, optional) – Class in which any velocities should be represented. Must be a class (not an instance), or the string name of the differential class. If equal to ‘base’ (default), inferred from the base class. If None, all velocity information is dropped.

  • in_frame_units (bool, keyword-only) – Force the representation units to match the specified units particular to this frame

Returns:

newrep (BaseRepresentation-derived object) – A new representation object of this frame’s data.

Raises:

AttributeError – If this object had no data

Examples

>>> from astropy import units as u
>>> from astropy.coordinates import SkyCoord, CartesianRepresentation
>>> coord = SkyCoord(0*u.deg, 0*u.deg)
>>> coord.represent_as(CartesianRepresentation)  
<CartesianRepresentation (x, y, z) [dimensionless]
        (1., 0., 0.)>
>>> coord.representation_type = CartesianRepresentation
>>> coord  
<SkyCoord (ICRS): (x, y, z) [dimensionless]
    (1., 0., 0.)>