<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Python 1 solutions with astropy
Astropy is an open source collection of tools for astronomers written in Python. One of astropy's most useful features for using Python as a calculator is its units module. This module lets you assign units to variables and understands how they propagate through arithmetic. 
5) Schwarzschild radii
a) Print the masses
Step1:  b) Retrieve constants from astropy's constants module
Step2:  c) Compute $r_s$, convert to cm
Step3:  d) $r_s$ in units of solar radii
Step4:  e) $r_s$ in units of AU
Step5:  f) Compare $r_s$ of Sag A* to orbits of solar system planets
Step6:  g) How much bigger is neutron star radius than $r_s$?
Step7:  6) Planets
a) Semimajor axes in cm
Step8:  b-c) Orbital period, in years
Use numpy's np.pi variable to get a high-precision value for $\pi$
Step9:  d) Light travel time in hours, given
$$\Delta t = \frac{\Delta x}{c}$$
<ASSISTANT_TASK:>
Python Code:
import numpy as np
# This is how we'll access astropy's units module: 
import astropy.units as u
# astropy stores fundamental physical constants like 
# the mass of the sun M_sun
from astropy.constants import M_sun
masses = u.Quantity([4.31e6*M_sun, 1*M_sun, 1.4*M_sun])
masses
Explanation: Python 1 solutions with astropy
Astropy is an open source collection of tools for astronomers written in Python. One of astropy's most useful features for using Python as a calculator is its units module. This module lets you assign units to variables and understands how they propagate through arithmetic. 
5) Schwarzschild radii
a) Print the masses:
End of explanation
# Newton's gravitational constant G, 
# speed of light c, radius of sun R_sun
from astropy.constants import c, G, R_sun
# Convert the masses to units of grams using the `to` method
masses.to(u.gram)
Explanation: b) Retrieve constants from astropy's constants module
End of explanation
r_s = 2*G*masses/c**2
print "r_s in centimeters: {0}".format(r_s.to(u.cm))
Explanation: c) Compute $r_s$, convert to cm
End of explanation
print "r_s in solar radii: {0}".format(r_s/R_sun)
Explanation: d) $r_s$ in units of solar radii:
End of explanation
print "r_s in AU: {0}".format(r_s.to(u.AU))
Explanation: e) $r_s$ in units of AU
End of explanation
%matplotlib inline
import matplotlib.pyplot as plt
planet_names = ['Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn', 'Uranus', 'Neptune']
semimajor_axes = u.Quantity([0.38, 0.72, 1, 1.5, 5.2, 9.5, 19.1, 30.0], unit=u.AU)
print "Any planets interior to r_s?: {0}".format(any(r_s[0] > semimajor_axes))
fig, ax = plt.subplots()
ax.bar(range(len(semimajor_axes)), semimajor_axes.to(u.AU).value, 
       log=True, color='k')
ax.set_xticklabels(planet_names, ha='left')
ax.axhline(r_s[0].to(u.AU).value, color='r', label='$r_s$')
ax.legend()
ax.set_ylabel('Semimajor Axis [AU]');
Explanation: f) Compare $r_s$ of Sag A* to orbits of solar system planets:
End of explanation
radius_neutron_star = 10*u.km
print("how much bigger is neutron star's radius?: {0:.2f}x bigger"
      .format(float(radius_neutron_star/r_s[2])))
Explanation: g) How much bigger is neutron star radius than $r_s$?
End of explanation
planet_names = ['Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn', 'Uranus', 'Neptune', 'Pluto']
semimajor_axes = u.Quantity([0.38, 0.72, 1, 1.5, 5.2, 9.5, 19.1, 30.0, 40], unit=u.AU)
semimajor_axes.to(u.cm)
Explanation: 6) Planets
a) Semimajor axes in cm:
End of explanation
T = (4 * np.pi**2 * semimajor_axes**3 / (G*M_sun))**0.5
T.to(u.year)
Explanation: b-c) Orbital period, in years
Use numpy's np.pi variable to get a high-precision value for $\pi$
End of explanation
(semimajor_axes/c).to(u.hour)
Explanation: d) Light travel time in hours, given
$$\Delta t = \frac{\Delta x}{c}$$
End of explanation
<END_TASK>