#!/usr/bin/env python # coding: utf-8 # # A Simple Solar System Simulation # # This notebook demonstrates some basic controls of the [pywwt] Jupyter widget in its 3D (really, 4D) Solar System mode. # # [pywwt]: https://pywwt.readthedocs.io/ # # First, we import the necessary modules: # In[ ]: from pywwt.jupyter import connect_to_app from astropy.coordinates import SkyCoord from astropy import units as u from astropy.time import Time # Next, we connect to the WWT app: # In[ ]: wwt = connect_to_app() # Turn on the 3D Solar System mode and adjust a few view parameters, including significantly exaggerating the size of the planets to make them more visible: # In[ ]: wwt.set_view('Solar System') wwt.solar_system.scale = 99 # scale up the planet size very unrealistically! wwt.solar_system.track_object('sun') # Choose a nice angle that will show several planets: # In[ ]: wwt.center_on_coordinates(SkyCoord(339.32980758, 20.78999814, unit=u.deg), fov=.6*u.deg) # Finally, set the time of WWT's internal clock and adjust its rate to make the planets move at a nice pace: # In[ ]: wwt.set_current_time(Time('2019-07-01')) wwt.play_time(rate=300000) # 300,000 times faster than real time # In[ ]: wwt.get_current_time() # In[ ]: wwt.pause_time() # In[ ]: wwt.set_current_time(Time('2020-07-01')) # ## Credits # # This notebook was prepared by O. Justin Otor with contributions from Thomas Robitaille and Peter K. G. Williams.