Galactocentric Radii
Translating from sky coorindates (angles) to a position in a galaxy’s disk requires doing some clever three-dimensional geometry. This geometry is easy to get wrong, especially for galaxies that are large on the sky so that the curvature of the celestial sphere starts to become problematic. To this end, I’ve started work on a python package that provides methods to make this more tractable. Ultimately the galaxies
package will give lots of galatic properties, but for now it just calculates position in the galaxy’s disk given inputs.
First, you’ll need to intall the package. Clone it off of the github page using the command line. This will create a directory called galaxies
wherever you created it. Enter the directory and run the python setup script:
python setup.py install
This will install the package plus any other dependencies that are required, such as astroquery. At least that’s the theory.
Now, you should have the galaxies
package in your python distribution. Now, you can run, from within python,
from galaxies import Galaxy
mygalaxy = Galaxy("M101")
You can then print(mygalaxy)
and see some basic information about it. Of note, the mygalaxy
object contains positional information about the galaxy expressed in terms of celestial coordinates: right ascension and declination. These are embodied in the highly abstract but powerful SkyCoord
class from astropy. For our purposes, we should just know that these are the longitude and latitude coordinates for a spherical coordinate system. Right ascension (RA) is the equivalent of longitude and declination (DEC) is the equivalent of latitude.
What is cool is that the cloud properties also identify the centre positions of these clouds in RA/DEC coordinates. Thus, we can just directly relate these coordinates to that of the galaxy. There are deep subtleties about different RA and DEC systems, but you should postpone caring about these for as long as possible.
The mygalaxy
object created above has a method called radius
. For the table, you can calculate the distance from the galactic centre as
cpropstable = Table.read('myfitstable.fits')
rgal=mygalaxy.radius(ra = cpropstable['XPOS'], dec = cpropstable['YPOS'])
Then, you can see the distance from the centre if you print rgal
. Notice the results are given in astropy units. To get out ordinary numbers, you can always just call rgal.value
, which returns a numpy array. However the units framework provides some awesome capabilities. For example, conversions where you can run
import astropy.units as u
print rgal.to(u.kpc) # get values in kpc
print rgal.to(u.m) # get values in metres
It also does excellent conversions when combined with the astropy.constants
package, which we will deal with later.