# Galactocentric¶

class astropy.coordinates.Galactocentric(*args, **kwargs)[source]

A coordinate or frame in the Galactocentric system. This frame requires specifying the Sun-Galactic center distance, and optionally the height of the Sun above the Galactic midplane.

The position of the Sun is assumed to be on the x axis of the final, right-handed system. That is, the x axis points from the position of the Sun projected to the Galactic midplane to the Galactic center – roughly towards $$(l,b) = (0^\circ,0^\circ)$$. For the default transformation ($${\rm roll}=0^\circ$$), the y axis points roughly towards Galactic longitude $$l=90^\circ$$, and the z axis points roughly towards the North Galactic Pole ($$b=90^\circ$$).

The default position of the Galactic Center in ICRS coordinates is taken from Reid et al. 2004, http://adsabs.harvard.edu/abs/2004ApJ…616..872R.

$\begin{split}{\rm RA} = 17:45:37.224~{\rm hr}\\ {\rm Dec} = -28:56:10.23~{\rm deg}\end{split}$

The default distance to the Galactic Center is 8.3 kpc, e.g., Gillessen et al. (2009), https://ui.adsabs.harvard.edu/#abs/2009ApJ…692.1075G/abstract

The default height of the Sun above the Galactic midplane is taken to be 27 pc, as measured by Chen et al. (2001), https://ui.adsabs.harvard.edu/#abs/2001ApJ…553..184C/abstract

The default solar motion relative to the Galactic center is taken from a combination of Schönrich et al. (2010) [for the peculiar velocity] and Bovy (2015) [for the circular velocity at the solar radius], https://ui.adsabs.harvard.edu/#abs/2010MNRAS.403.1829S/abstract https://ui.adsabs.harvard.edu/#abs/2015ApJS..216…29B/abstract

For a more detailed look at the math behind this transformation, see the document Description of Galactocentric Coordinates Transformation.

The frame attributes are listed under Other Parameters.

Parameters: Other Parameters: data : BaseRepresentation subclass instance A representation object or None to have no data (or use the coordinate component arguments, see below). x : Quantity, optional Cartesian, Galactocentric $$x$$ position component. y : Quantity, optional Cartesian, Galactocentric $$y$$ position component. z : Quantity, optional Cartesian, Galactocentric $$z$$ position component. v_x : Quantity, optional Cartesian, Galactocentric $$v_x$$ velocity component. v_y : Quantity, optional Cartesian, Galactocentric $$v_y$$ velocity component. v_z : Quantity, optional Cartesian, Galactocentric $$v_z$$ velocity component. representation_type : BaseRepresentation subclass, str, optional A representation class or string name of a representation class. This sets the expected input representation class, thereby changing the expected keyword arguments for the data passed in. For example, passing representation_type='cartesian' will make the classes expect position data with cartesian names, i.e. x, y, z in most cases. differential_type : BaseDifferential subclass, str, dict, optional A differential class or dictionary of differential classes (currently only a velocity differential with key ‘s’ is supported). This sets the expected input differential class, thereby changing the expected keyword arguments of the data passed in. For example, passing differential_type='cartesian' will make the classes expect velocity data with the argument names v_x, v_y, v_z. copy : bool, optional If True (default), make copies of the input coordinate arrays. Can only be passed in as a keyword argument. galcen_coord : ICRS, optional, must be keyword The ICRS coordinates of the Galactic center. galcen_distance : Quantity, optional, must be keyword The distance from the sun to the Galactic center. galcen_v_sun : CartesianDifferential, optional, must be keyword The velocity of the sun in the Galactocentric frame as Cartesian velocity components. z_sun : Quantity, optional, must be keyword The distance from the sun to the Galactic midplane. roll : Angle, optional, must be keyword The angle to rotate about the final x-axis, relative to the orientation for Galactic. For example, if this roll angle is 0, the final x-z plane will align with the Galactic coordinates x-z plane. Unless you really know what this means, you probably should not change this!

Examples

To transform to the Galactocentric frame with the default frame attributes, pass the uninstantiated class name to the transform_to() method of a coordinate frame or SkyCoord object:

>>> import astropy.units as u
>>> import astropy.coordinates as coord
>>> c = coord.ICRS(ra=[158.3122, 24.5] * u.degree,
...                dec=[-17.3, 81.52] * u.degree,
...                distance=[11.5, 24.12] * u.kpc)
>>> c.transform_to(coord.Galactocentric)
<Galactocentric Coordinate (galcen_coord=<ICRS Coordinate: (ra, dec) in deg
( 266.4051, -28.936175)>, galcen_distance=8.3 kpc, galcen_v_sun=( 11.1,  232.24,  7.25) km / s, z_sun=27.0 pc, roll=0.0 deg): (x, y, z) in kpc
[( -9.6083819 ,  -9.40062188,  6.52056066),
(-21.28302307,  18.76334013,  7.84693855)]>


To specify a custom set of parameters, you have to include extra keyword arguments when initializing the Galactocentric frame object:

>>> c.transform_to(coord.Galactocentric(galcen_distance=8.1*u.kpc))
<Galactocentric Coordinate (galcen_coord=<ICRS Coordinate: (ra, dec) in deg
( 266.4051, -28.936175)>, galcen_distance=8.1 kpc, galcen_v_sun=( 11.1,  232.24,  7.25) km / s, z_sun=27.0 pc, roll=0.0 deg): (x, y, z) in kpc
[( -9.40785924,  -9.40062188,  6.52066574),
(-21.08239383,  18.76334013,  7.84798135)]>


Similarly, transforming from the Galactocentric frame to another coordinate frame:

>>> c = coord.Galactocentric(x=[-8.3, 4.5] * u.kpc,
...                          y=[0., 81.52] * u.kpc,
...                          z=[0.027, 24.12] * u.kpc)
>>> c.transform_to(coord.ICRS)
<ICRS Coordinate: (ra, dec, distance) in (deg, deg, kpc)
[(  86.22349059, 28.83894138,  4.39157788e-05),
( 289.66802652, 49.88763881,  8.59640735e+01)]>


Or, with custom specification of the Galactic center:

>>> c = coord.Galactocentric(x=[-8.0, 4.5] * u.kpc,
...                          y=[0., 81.52] * u.kpc,
...                          z=[21.0, 24120.0] * u.pc,
...                          z_sun=21 * u.pc, galcen_distance=8. * u.kpc)
>>> c.transform_to(coord.ICRS)
<ICRS Coordinate: (ra, dec, distance) in (deg, deg, kpc)
[(  86.2585249 ,  28.85773187,  2.75625475e-05),
( 289.77285255,  50.06290457,  8.59216010e+01)]>


Attributes Summary

Methods Summary

 get_roll0() The additional roll angle (about the final x axis) necessary to align the final z axis to match the Galactic yz-plane.

Attributes Documentation

default_differential
default_representation
frame_attributes = {'galcen_coord': <astropy.coordinates.attributes.CoordinateAttribute object>, 'galcen_distance': <astropy.coordinates.attributes.QuantityAttribute object>, 'galcen_v_sun': <astropy.coordinates.attributes.DifferentialAttribute object>, 'roll': <astropy.coordinates.attributes.QuantityAttribute object>, 'z_sun': <astropy.coordinates.attributes.QuantityAttribute object>}
frame_specific_representation_info
galcen_coord = <ICRS Coordinate: (ra, dec) in deg (266.4051, -28.936175)>
galcen_dec
galcen_distance = <Quantity 8.3 kpc>
galcen_ra
galcen_v_sun = <CartesianDifferential (d_x, d_y, d_z) in km / s (11.1, 232.24, 7.25)>
name = 'galactocentric'
roll = <Quantity 0. deg>
z_sun = <Quantity 27. pc>

Methods Documentation

classmethod get_roll0()[source]

The additional roll angle (about the final x axis) necessary to align the final z axis to match the Galactic yz-plane. Setting the roll frame attribute to -this method’s return value removes this rotation, allowing the use of the Galactocentric frame in more general contexts.