What is 1 barn megaparsecs in teaspoons?
from astropy import units as u
from astropy.units import imperial
(1. * u.barn * u.Mpc).to(imperial.tsp)
What is \(3 \mathrm{nm}^2 \mathrm{Mpc} / \mathrm{m}^3\) in dimensionless units?
(3. * u.nm**2 * u.Mpc / u.m**3).decompose()
or to just get the numerical value:
(3. * u.nm**2 * u.Mpc / u.m**3).decompose().value
Try and use equivalencies to find the doppler shifted wavelength of a line at \(454.4\mathrm{nm}\) if the object is moving at a velocity of \(510\mathrm{km}/\mathrm{s}\) away from the observer.
(510. * u.km / u.s).to(u.nm, equivalencies=u.doppler_optical(454.4 * u.nm))