apps121023_jesframe.xz_moonsΒΆ

''' X-Z projection of moons.

The script draws two panels of the moon positions.
Left is for the JSE system and right is for the JEQS system.
Refer to :ref:`juice-spice-readme` for the definition.

In the JSE system, the tilt of 3.13 degrees of the Jupiter rotation
axis makes a deviation of the Moon orbits.

In the JEQS system, such deviations become small.
According to the Wikipedia,
inclination of moon's orbit wrt Jupiter equator is 0.05 for Io
0.47 for Europa 0.20 for Ganymede and (TBC) for Callisto.
These values agree rather well with the calculation by this script.

.. image:: ../../../src/scripts/apps121023_jesframe/xz_moons.png


'''
import datetime
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as mpldates

import pyana.juice.jspice as js
js.init()

def main():
    '''Main script'''
    
    fig = plt.figure(figsize=(12, 6))
    ax_jse = fig.add_subplot(121)
    ax_jeqs = fig.add_subplot(122)

    t0 = datetime.datetime(2031, 1, 1)
    t0m = mpldates.date2num(t0)
    t1 = datetime.datetime(2031, 1, 18)
    dt = datetime.timedelta(minutes=5)

    for moon in ('IO', 'EUROPA', 'GANYMEDE', 'CALLISTO'):
        print(moon)

        t = t0
        tlist = []
        jselist = []
        jeqslist = []

        while t <= t1:

            jselist.append(js.get_position(t, frame='JSE', target=moon, origin='Jupiter'))
            jeqslist.append(js.get_position(t, frame='JEQS', target=moon, origin='Jupiter'))

            tlist.append(mpldates.date2num(t))
            t = t + dt

        jselist = np.array(jselist)
        jeqslist = np.array(jeqslist)

        ### Angle.
        xy = np.sqrt((jeqslist ** 2).sum(1))
        thetamax = np.abs(np.rad2deg(np.arcsin(jeqslist[:, 2] / xy))).max()
        
        ### Plot
        rj = 71500
        ax_jse.plot(jselist[:, 0] / rj, jselist[:, 2] / rj)
        ax_jeqs.plot(jeqslist[:, 0] / rj, jeqslist[:, 2] / rj, label='%s (%.3f)' % (moon, thetamax))

        ax_jeqs.legend(loc='best')
        

    ax_jse.set_ylim(-2, 2)
    ax_jeqs.set_ylim(-2, 2)

    ax_jse.set_title('JSE')
    ax_jeqs.set_title('JEqS')


    fig.savefig('xz_moons.png')

if __name__ == "__main__":
    main()