Additional coordinates
When analysing a galaxy it is often convenient to work in spherical or cylindrical
coordinates. A SWIFTGalaxy will compute these (and the
velocities) on the fly if requested. The poles of the spherical/cylindrical coordinate
frame are assumed to lie along the cartesian \(z\) axis of the
current coordinate frame, the reference
azimuth (\(\phi=0\)) lies along the \(x\) axis, and the coordinate system is
assumed to be right-handed.
Any computed coordinates (or velocities) are cached to speed up subsequent requests, but note that coordinate transformations in general would require a conversion back to cartesian coordinates, application of the transformation, and then re-calculation of the spherical/cylindrical coordinates. Therefore, in the interest of efficiency, if a coordinate transformation occurs the spherical/cylindrical coordinates are simply discarded, and re-computed if they are subsequently requested.
Spherical coordinates
Note
A “physics” notation convention is assumed, with coordinate components named \((r, \theta, \phi)\), where \(-\frac{\pi}{2} \leq \theta \leq \frac{\pi}{2}\) is the polar angle and \(0 < \phi \leq 2\pi\) is the azimuthal angle. The convention that if \(r=0\), then \(\theta=0\) and \(\phi=0\) is also adopted.
The spherical coordinates can be accessed through the
spherical_coordinates property of
a particle dataset. Supposing that we are interested in the gas particles:
sg = SWIFTGalaxy(...)
sg.gas.spherical_coordinates.r
sg.gas.spherical_coordinates.theta
sg.gas.spherical_coordinates.phi
For convenience and/or readability, some common (?) aliases to the coordinates are also supported.
Aliases
Aliases for spherical coordinates are as follows:
spherical_coordinates.r:spherical_coordinates.radius
spherical_coordinates.theta:spherical_coordinates.latspherical_coordinates.latitudespherical_coordinates.polspherical_coordinates.polar
spherical_coordinates.phi:spherical_coordinates.lonspherical_coordinates.longitudespherical_coordinates.azspherical_coordinates.azimuth
Spherical velocities
The velocity components in the directions of the spherical unit vectors – \((v_r, v_\theta, v_\phi)\) – can be accessed with the following syntax:
sg.gas.spherical_velocities.r
sg.gas.spherical_velocities.theta
sg.gas.spherical_velocities.phi
Note that if \(r=0\), then \(\theta=0\) and \(\phi=0\) are assumed to define the directions of the unit vectors.
Aliases
Again, some aliases are provided:
spherical_velocities.r:spherical_velocities.radius
spherical_velocities.theta:spherical_velocities.latspherical_velocities.latitudespherical_velocities.polspherical_velocities.polar
spherical_velocities.phi:spherical_velocities.lonspherical_velocities.longitudespherical_velocities.azspherical_velocities.azimuth
Cylindrical coordinates
Note
The coordinate components are named \((\rho, \phi, z)\) by default, and assume a convention where \(0 < \phi \leq 2\pi\). The convention that if \(\rho=0\), then \(\phi=0\) is also adopted.
Similarly to the spherical coordinates, the cylindrical coordinates can be accessed
through the
cylindrical_coordinates property
of a particle dataset. Supposing again that we are interested in the gas particles:
sg.gas.cylindrical_coordinates.rho
sg.gas.cylindrical_coordinates.phi
sg.gas.cylindrical_coordinates.z
Aliases
Aliases for cylindrical coordinates are as follows:
cylindrical_coordinates.rho:cylindrical_coordinates.Rcylindrical_coordinates.radius
cylindrical_coordinates.phi:cylindrical_coordinates.loncylindrical_coordinates.longitudecylindrical_coordinates.azcylindrical_coordinates.azimuth
cylindrical_coordinates.zcylindrical_coordinates.height
Cylindrical velocities
The velocity components in the directions of the cylindrical unit vectors – \((v_\rho, v_\phi, v_z)\) – can be accessed with the following syntax:
sg.gas.cylindrical_velocities.rho
sg.gas.cylindrical_velocities.phi
sg.gas.cylindrical_velocities.z
Note that if \(\rho=0\), then \(\phi=0\) is assumed to define the directions of the unit vectors.
Aliases
Again, some aliases are provided:
cylindrical_velocities.rho:cylindrical_velocities.Rcylindrical_velocities.radius
cylindrical_coordinates.phi:cylindrical_velocities.loncylindrical_velocities.longitudecylindrical_velocities.azcylindrical_velocities.azimuth
cylindrical_velocities.zcylindrical_coordinates.height
Cartesian coordinates
For completeness, the cartesian coordinates \((x, y, z)\) are made available with a similar syntax:
sg.gas.cartesian_coordinates.x
sg.gas.cartesian_coordinates.y
sg.gas.cartesian_coordinates.z
These are implemented such that a reference to the coordinates array is used and therefore occupy no additional memory. In addition to the individual coordinate components, for cartesian coordinates the \((N, 3)\) coordinate array is available as:
sg.gas.cartesian_coordinates.xyz
Cartesian velocities
Similarly, the cartesian velocity components \((v_x, v_y, v_z)\) are made available:
sg.gas.cartesian_velocities.x
sg.gas.cartesian_velocities.y
sg.gas.cartesian_velocities.z
sg.gas.cartesian_velocities.xyz