Last active
August 29, 2015 14:08
-
-
Save eteq/4b7536e6923a4f97e3ef to your computer and use it in GitHub Desktop.
Code to show galactocentric stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from mpl_toolkits.mplot3d import Axes3D | |
from astropy.coordinates import * | |
from astropy import units as u | |
fig = plt.figure() | |
ax = fig.add_subplot(111, projection='3d') | |
icrszaxspher = ICRS(np.repeat([0,180], 60)*u.deg,np.tile(np.linspace(-90,90,60),2)*u.deg,8.3*u.kpc) | |
icrsxaxspher = ICRS(np.linspace(0,360,120)*u.deg,0*u.deg,8.3*u.kpc) | |
disk=SphericalRepresentation(np.linspace(0,360,120)*u.deg,0*u.deg,8.3*u.kpc) | |
galzaxspher = Galactic(np.repeat([0,180], 60)*u.deg,np.tile(np.linspace(-90,90,60),2)*u.deg,8.3*u.kpc) | |
icrscen=ICRS([0]*u.deg,[0]*u.deg,[0]*u.kpc) | |
ax.plot3D(*icrsxaxspher.transform_to(Galactocentric).cartesian.xyz.value, c='b', label='ICRS XY-plane') | |
ax.plot3D(*icrszaxspher.transform_to(Galactocentric).cartesian.xyz.value, c='r', label='ICRS XZ-plane') | |
ax.scatter3D([0],[0],[0],c='g') | |
ax.scatter3D(*icrscen.transform_to(Galactocentric).cartesian.xyz.value, c='r') | |
ax.plot3D(*disk.to_cartesian().xyz.value, c='g', label='Galactocentric XY-plane') | |
ax.plot3D(*galzaxspher.transform_to(Galactocentric).cartesian.xyz.value, c='k', label='Galactic XZ-plane') | |
ax.set_zlabel('$z_{galo}$',fontsize=24) | |
ax.set_xlabel('$x_{galo}$',fontsize=24) | |
ax.set_ylabel('$y_{galo}$',fontsize=24) | |
ax.set_xlim(-15, 10) | |
ax.set_ylim(-12.5, 12.5) | |
ax.set_zlim(-12.5, 12.5) | |
ax.set_aspect(1) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment