I have successfully install astropy-0.3 with python-3.4 on Ubuntu-14.04 but whenever I search any conventional library of Astropy like cosmology, time, units it doesn't work here.. Is this library specifically made for windows or any thing else?
I am using Astropy library on IDLE python-2.7 conveniently.
Any solution for this issue?
In Ubuntu 14.04 and later open the terminal and type:
sudo apt install python3-astropy
Now to check if it is working open IDLE3 and run the following commands in IDLE3:
import astropy
from astropy.cosmology import WMAP9 as cosmo
dir(astropy)
The expected output of dir(astropy)
is:
['ConfigurationItem', 'UNICODE_OUTPUT', '__builtins__', '__cached__', '__doc__', '__file__', '__githash__', '__loader__', '__minimum_numpy_version__', '__name__', '__package__', '__path__', '__spec__', '__version__', '_check_numpy', '_get_test_runner', '_init_log', '_initialize_astropy', '_teardown_log', 'config', 'constants', 'coordinates', 'cosmology', 'cython_version', 'extern', 'find_api_page', 'io', 'log', 'logger', 'logging', 'online_docs_root', 'table', 'test', 'time', 'units', 'utils', 'version', 'version_helpers', 'wcs']
The above output shows that the built-in functions of astropy that you mentioned in your question: cosmology, time and units have all been successfully imported.
The following Python code1 is a simple test to check if the cosmology and units built-in functions of astropy are working correctly. From IDLE3 run the following commands:
from astropy.cosmology import WMAP9 as cosmo
H0 = cosmo.H(0)
H0.value, H0.unit
The expected output is:
(69.32, Unit("km / (Mpc s)"))