.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_examples/Tests/test_ellipsoid_location_accuracy.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr__examples_Tests_test_ellipsoid_location_accuracy.py: Ellipsoid location on AIA images -------------------------------- This is an example of how the accuracy of the ellipsoid possition is tested in PyThea. We use an EUV image when Venus transited in front of the Sun and was observed by SDO/AIA and we oveplot the ellipsoid. .. GENERATED FROM PYTHON SOURCE LINES 11-21 .. code-block:: Python import astropy.units as u import matplotlib.pyplot as plt import sunpy.map from astropy.coordinates import SkyCoord, solar_system_ephemeris from sunpy.coordinates import get_body_heliographic_stonyhurst from PyThea.data.sample_data import aia_sample_data from PyThea.geometrical_models import ellipsoid from PyThea.sunpy_dev.map.maputils import prepare_maps .. GENERATED FROM PYTHON SOURCE LINES 22-23 Use high-precision ephemeris information from jplephem to have a more accurate position of Venus than the ephemeris provided by astropy. .. GENERATED FROM PYTHON SOURCE LINES 23-25 .. code-block:: Python solar_system_ephemeris.set('de432s') .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 26-27 Load the SDO/AIA image from PyThea's sample data and prepare the image correcting for pointing and observer location. .. GENERATED FROM PYTHON SOURCE LINES 27-31 .. code-block:: Python aia_fits_venus = aia_sample_data.fetch('aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits') aiamap = sunpy.map.Map(aia_fits_venus, sequence=True) aiamap = prepare_maps(aiamap)[0] .. rst-class:: sphx-glr-script-out .. code-block:: none Preparing image sequence for AIA. This could take a while... /home/docs/checkouts/readthedocs.org/user_builds/pythea/envs/docs/lib/python3.11/site-packages/PyThea/sunpy_dev/extern/sunkit_instruments/aia/utils.py:12: UserWarning: Prepare AIA maps failed, script proceeded without update_pointing. Check connection with JSOC. warnings.warn('Prepare AIA maps failed, script proceeded without update_pointing. Check connection with JSOC.', UserWarning) .. GENERATED FROM PYTHON SOURCE LINES 32-33 Define Venus radious and get the sky coordinates at the time of observation. .. GENERATED FROM PYTHON SOURCE LINES 33-39 .. code-block:: Python venus_radius = 6051.8 * u.km # From here: https://nssdc.gsfc.nasa.gov/planetary/factsheet/venusfact.html venus = get_body_heliographic_stonyhurst('venus', aiamap.date_average, observer=aiamap.observer_coordinate) center = SkyCoord(venus) .. rst-class:: sphx-glr-script-out .. code-block:: none INFO: Apparent body location accounts for 144.14 seconds of light travel time [sunpy.coordinates.ephemeris] .. GENERATED FROM PYTHON SOURCE LINES 40-41 Construct the ellipsoid model. The model is centred at Venus with a radius equal to the planet's radius. .. GENERATED FROM PYTHON SOURCE LINES 41-44 .. code-block:: Python model_shock = ellipsoid(center, venus_radius, venus_radius, venus_radius, 0 * u.degree) .. GENERATED FROM PYTHON SOURCE LINES 45-46 Create a submap with Venus at its center. .. GENERATED FROM PYTHON SOURCE LINES 46-51 .. code-block:: Python venus_hpc = venus.transform_to(aiamap.coordinate_frame) fov = 200 * u.arcsec bottom_left = SkyCoord(venus_hpc.Tx - fov/2, venus_hpc.Ty - fov/2, frame=aiamap.coordinate_frame) smap = aiamap.submap(bottom_left, width=fov, height=fov) .. GENERATED FROM PYTHON SOURCE LINES 52-53 Make a figure and plot the map and the ellipsoid. The ellipsoid should appear on top of Venus. .. GENERATED FROM PYTHON SOURCE LINES 53-63 .. code-block:: Python fig = plt.figure(dpi=200) ax = fig.add_subplot(projection=smap) smap.plot(axes=ax) smap.draw_limb(axes=ax) ax.grid(False) model_shock.plot(ax, mode='Full') ax.set_xlim([0, smap.data.shape[0]]) ax.set_ylim([0, smap.data.shape[1]]) plt.show() .. image-sg:: /_examples/Tests/images/sphx_glr_test_ellipsoid_location_accuracy_001.png :alt: AIA $1600 \; \mathrm{\mathring{A}}$ 2012-06-06 04:07:29 :srcset: /_examples/Tests/images/sphx_glr_test_ellipsoid_location_accuracy_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 5.208 seconds) .. _sphx_glr_download__examples_Tests_test_ellipsoid_location_accuracy.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: test_ellipsoid_location_accuracy.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: test_ellipsoid_location_accuracy.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: test_ellipsoid_location_accuracy.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_