dsavransky / EXOSIMS

Simulator for exoplanet direct imaging space missions
BSD 3-Clause "New" or "Revised" License
25 stars 35 forks source link

L2 Orbit: earth excursion too great #36

Closed rhondamorgan closed 7 years ago

rhondamorgan commented 7 years ago

A video of the keepout zones for the star shade shows that the largest separation between the earth and the sun is ~80 degrees. This is too large. Doing the geometry by hand, using the semimajor axis for the WFIRST L2 orbit file in EXOSIMS/Observatory, the largest separation should be <29 degrees.

Potentially, the issue could be the position of the L2 node. In the frame below of the video, the distance between the earth and observatory is 0.061 AU; the L2 point is ~0.01 AU from the earth.

I also checked how much the moon separates from the earth, which should be < 12 degrees, and this looks correct in the video, to the coarse resolution provided by the 10 degree ticks on the axes.

screen shot 2017-05-19 at 7 06 40 pm starshade_20170519_earthwrong

ChrisDelaX commented 7 years ago

Thanks Rhonda, I'll have a look at this issue. On your first image, I believe the values for Earth-moon and Earth-sun angles should be switched, correct? Also, could you send me the movie you made? Because I'm only able to download the first image in png.

rhondamorgan commented 7 years ago

Here is the movie. Github doesn’t accept movies in bug reports.

I will also forward the earth to obs distance for the whole movie, from Mike Turmon.

The angle from observatory at greatest elongation in HALO orbit to sun is correct. It the angle at the sun between L2 and observatory at greatest elongation which is very small.

Thank you, Rhonda

From: Christian notifications@github.com<mailto:notifications@github.com> Reply-To: dsavransky/EXOSIMS reply@reply.github.com<mailto:reply@reply.github.com> Date: Monday, May 22, 2017 at 8:58 AM To: dsavransky/EXOSIMS EXOSIMS@noreply.github.com<mailto:EXOSIMS@noreply.github.com> Cc: "Morgan, Rhonda M (383A)" rhonda.m.morgan@jpl.nasa.gov<mailto:rhonda.m.morgan@jpl.nasa.gov>, Author author@noreply.github.com<mailto:author@noreply.github.com> Subject: Re: [dsavransky/EXOSIMS] L2 Orbit: earth excursion too great (#36)

Thanks Rhonda, I'll have a look at this issue. On your first image, I believe the values for Earth-moon and Earth-sun angles should be switched, correct? Also, could you send me the movie you made? Because I'm only able to download the first image in png.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/dsavransky/EXOSIMS/issues/36#issuecomment-303142991, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AMc20OT2dM5d973VkwjGbgZKdGjOfe6mks5r8bCkgaJpZM4NhKcf.

ChrisDelaX commented 7 years ago

Okay, at first I thought of a bug with the solarSystem_body_position, but I double-checked the body distances look normal: Sun-Sun distances (4 seasons): [ 0. 0. 0. 0.] AU Sun-WFIRST distances (4 seasons): [ 1.002 0.998 1.019 1.023] AU Earth-Sun distances (4 seasons): [ 0.988 0.989 1.012 1.012] AU Earth-WFIRST distances (4 seasons): [ 0.015 0.042 0.048 0.011] AU Moon-Sun distances (4 seasons): [ 0.99 0.989 1.012 1.01 ] AU Moon-WFIRST distances (4 seasons): [ 0.013 0.044 0.051 0.014] AU Mercury-Sun distances (4 seasons): [ 0.373 0.354 0.336 0.321] AU Mercury-WFIRST distances (4 seasons): [ 0.955 1.307 1.294 0.953] AU Venus-Sun distances (4 seasons): [ 0.727 0.718 0.727 0.722] AU Venus-WFIRST distances (4 seasons): [ 1.063 0.382 0.653 1.302] AU Mars-Sun distances (4 seasons): [ 1.567 1.65 1.66 1.592] AU Mars-WFIRST distances (4 seasons): [ 0.871 0.755 1.561 2.222] AU Jupiter-Sun distances (4 seasons): [ 5.069 5.099 5.131 5.163] AU Jupiter-WFIRST distances (4 seasons): [ 4.117 4.779 6.015 5.878] AU Saturn-Sun distances (4 seasons): [ 9.643 9.616 9.588 9.56 ] AU Saturn-WFIRST distances (4 seasons): [ 9.348 10.541 10.082 8.686] AU Uranus-Sun distances (4 seasons): [ 19.56 19.545 19.529 19.514] AU Uranus-WFIRST distances (4 seasons): [ 18.56 19.608 20.548 19.551] AU Neptune-Sun distances (4 seasons): [ 29.895 29.893 29.891 29.888] AU Neptune-WFIRST distances (4 seasons): [ 29.4 30.753 30.442 29.034] AU Pluto-Sun distances (4 seasons): [ 35.143 35.205 35.267 35.33 ] AU Pluto-WFIRST distances (4 seasons): [ 35.608 36.098 34.838 34.408] AU

I will now check that the Earth-WFIRST and Moon-WFIRST distances make sense.

ChrisDelaX commented 7 years ago

One possible explanation could be that JPL ephemerides produce barycentric coordinates (not heliocentric). Here is a simple test I ran with the position of the Earth:

import EXOSIMS from EXOSIMS.util.get_module import get_module import numpy as np import astropy.units as u from astropy.time import Time from astropy.coordinates import SkyCoord Obs = get_module('WFIRSTObservatoryL2')() currentTime = Time(np.array([60634.]), format='mjd', scale='tai') r_Earth_JPL = Obs.solarSystem_body_position(currentTime, 'Earth') coords = SkyCoord(r_Earth_JPL[:,0],r_Earth_JPL[:,1],r_Earth_JPL[:,2],representation='cartesian') print 'heliocentrictrueecliptic ', coords.heliocentrictrueecliptic.distance.to('AU') print 'heliocentrictrueecliptic.icrs', coords.heliocentrictrueecliptic.icrs.distance.to('AU') print 'barycentrictrueecliptic ', coords.barycentrictrueecliptic.distance.to('AU') print 'norm(r_Earth_JPL) ', np.linalg.norm(r_Earth_JPL.to('AU').value,axis=1)*u.AU

out: heliocentrictrueecliptic [ 0.98191807] AU heliocentrictrueecliptic.icrs [ 0.98807535] AU barycentrictrueecliptic [ 0.98807535] AU norm(r_Earth_JPL) [ 0.98807535] AU

ChrisDelaX commented 7 years ago

I made some progress. I ran the same test but for the Sun JPL coordinates: r_Sun_JPL = Obs.solarSystem_body_position(currentTime, 'Sun') coords = SkyCoord(r_Sun_JPL[:,0],r_Sun_JPL[:,1],r_Sun_JPL[:,2],representation='cartesian') print 'heliocentrictrueecliptic ', coords.heliocentrictrueecliptic.distance.to('AU') print 'heliocentrictrueecliptic.icrs', coords.heliocentrictrueecliptic.icrs.distance.to('AU') print 'barycentrictrueecliptic ', coords.barycentrictrueecliptic.distance.to('AU') print 'norm(r_Sun_JPL) ', np.linalg.norm(r_Sun_JPL.to('AU').value,axis=1)*u.AU

out: heliocentrictrueecliptic [ 0.00766731] AU heliocentrictrueecliptic.icrs [ 4.55423062e-18] AU barycentrictrueecliptic [ 0.] AU norm(r_Sun_JPL) [ 0.] AU

The JPL ephemerides give a position of the Sun that is [0,0,0]. They are indeed heliocentric. The problem seems to come from the call to astropy.SkyCoord, when I do:

coords = SkyCoord(r_Earth_JPL[:,0],r_Earth_JPL[:,1],r_Earth_JPL[:,2],representation='cartesian')

I actually create ICRS coordinates, using heliocentric coordinates.

To be continued...

ChrisDelaX commented 7 years ago

I found out the good way of doing this with astropy: c = SkyCoord(r_Earth_JPL[:,0],r_Earth_JPL[:,1],r_Earth_JPL[:,2], representation='cartesian').represent_as('spherical') coords = SkyCoord(c.lon.to('deg'),c.lat.to('deg'),c.distance.to('AU'),frame='heliocentrictrueecliptic')

This seems to fix all bodies coordinates to heliocentric, e.g. Sun coords: norm(r_Sun_JPL) [ 0.] AU heliocentrictrueecliptic [ 0.] AU icrs [ 0.00766731] AU barycentrictrueecliptic [ 0.00766731] AU

rhondamorgan commented 7 years ago

It looks like you’re making good progress. I have a meeting at 2pm with a mission design systems engineer to talk about the basic steps of how to use a HALO orbit ephemeris file, to implement in an orbital simulation. Rhonda

From: Christian notifications@github.com<mailto:notifications@github.com> Reply-To: dsavransky/EXOSIMS reply@reply.github.com<mailto:reply@reply.github.com> Date: Thursday, May 25, 2017 at 9:53 AM To: dsavransky/EXOSIMS EXOSIMS@noreply.github.com<mailto:EXOSIMS@noreply.github.com> Cc: "Morgan, Rhonda M (383A)" rhonda.m.morgan@jpl.nasa.gov<mailto:rhonda.m.morgan@jpl.nasa.gov>, Author author@noreply.github.com<mailto:author@noreply.github.com> Subject: Re: [dsavransky/EXOSIMS] L2 Orbit: earth excursion too great (#36)

I found out the good way of doing this with astropy: c = SkyCoord(r_Earth_JPL[:,0],r_Earth_JPL[:,1],r_Earth_JPL[:,2], representation='cartesian').represent_as('spherical') coords = SkyCoord(c.lon.to('deg'),c.lat.to('deg'),c.distance.to('AU'),frame='heliocentrictrueecliptic')

This seems to fix all bodies coordinates to heliocentric, e.g. Sun coords: norm(r_Sun_JPL) [ 0.] AU heliocentrictrueecliptic [ 0.] AU icrs [ 0.00766731] AU barycentrictrueecliptic [ 0.00766731] AU

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/dsavransky/EXOSIMS/issues/36#issuecomment-304061909, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AMc20LO3shei7YMtTjn8LOMCqN1YTcxgks5r9bIhgaJpZM4NhKcf.

rhondamorgan commented 7 years ago

Christian, where was the code you were showing on your screen yesterday, that had the ~4 lines you did and the ~4 lines Gabe did? I’m sitting with a JPL orbit guy who is looking at the Python code. Thank you, Rhonda

From: Christian notifications@github.com<mailto:notifications@github.com> Reply-To: dsavransky/EXOSIMS reply@reply.github.com<mailto:reply@reply.github.com> Date: Thursday, May 25, 2017 at 9:53 AM To: dsavransky/EXOSIMS EXOSIMS@noreply.github.com<mailto:EXOSIMS@noreply.github.com> Cc: "Morgan, Rhonda M (383A)" rhonda.m.morgan@jpl.nasa.gov<mailto:rhonda.m.morgan@jpl.nasa.gov>, Author author@noreply.github.com<mailto:author@noreply.github.com> Subject: Re: [dsavransky/EXOSIMS] L2 Orbit: earth excursion too great (#36)

I found out the good way of doing this with astropy: c = SkyCoord(r_Earth_JPL[:,0],r_Earth_JPL[:,1],r_Earth_JPL[:,2], representation='cartesian').represent_as('spherical') coords = SkyCoord(c.lon.to('deg'),c.lat.to('deg'),c.distance.to('AU'),frame='heliocentrictrueecliptic')

This seems to fix all bodies coordinates to heliocentric, e.g. Sun coords: norm(r_Sun_JPL) [ 0.] AU heliocentrictrueecliptic [ 0.] AU icrs [ 0.00766731] AU barycentrictrueecliptic [ 0.00766731] AU

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/dsavransky/EXOSIMS/issues/36#issuecomment-304061909, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AMc20LO3shei7YMtTjn8LOMCqN1YTcxgks5r9bIhgaJpZM4NhKcf.

rhondamorgan commented 7 years ago

These two are incorrect: Earth-Sun distances (4 seasons): [ 0.988 0.989 1.012 1.012] AU Earth-WFIRST distances (4 seasons): [ 0.015 0.042 0.048 0.011] AU

The earth-sun distance should have a seasonal variability that is small-med-large-med. However, your numbers are small-small-large-large. From the JPL in house mission design calculator Quick, starting at 20240921, the season distances are [1.004, .984, .996, 1.016]AU.

Also, the Earth-WFIRST distance is too large. The largest it should be is <0.014 AU, not 0.042 AU.

ChrisDelaX commented 7 years ago

I fixed the heliocentric frame in my last commit: c658c2053092b5a0bf52bc633b5f24ef02f5882c but it does not affect the distances: Sun-Sun distances (4 seasons): [ 0. 0. 0. 0.] AU Sun-WFIRST distances (4 seasons): [ 1.002 0.998 1.019 1.023] AU Earth-Sun distances (4 seasons): [ 0.988 0.989 1.012 1.012] AU Earth-WFIRST distances (4 seasons): [ 0.015 0.042 0.048 0.011] AU Moon-Sun distances (4 seasons): [ 0.99 0.989 1.012 1.01 ] AU Moon-WFIRST distances (4 seasons): [ 0.013 0.044 0.051 0.014] AU Mercury-Sun distances (4 seasons): [ 0.373 0.354 0.336 0.321] AU Mercury-WFIRST distances (4 seasons): [ 0.955 1.307 1.294 0.953] AU Venus-Sun distances (4 seasons): [ 0.727 0.718 0.727 0.722] AU Venus-WFIRST distances (4 seasons): [ 1.063 0.382 0.653 1.302] AU Mars-Sun distances (4 seasons): [ 1.567 1.65 1.66 1.592] AU Mars-WFIRST distances (4 seasons): [ 0.871 0.755 1.561 2.222] AU Jupiter-Sun distances (4 seasons): [ 5.069 5.099 5.131 5.163] AU Jupiter-WFIRST distances (4 seasons): [ 4.117 4.779 6.015 5.878] AU Saturn-Sun distances (4 seasons): [ 9.643 9.616 9.588 9.56 ] AU Saturn-WFIRST distances (4 seasons): [ 9.348 10.541 10.082 8.686] AU Uranus-Sun distances (4 seasons): [ 19.56 19.545 19.529 19.514] AU Uranus-WFIRST distances (4 seasons): [ 18.56 19.608 20.548 19.551] AU Neptune-Sun distances (4 seasons): [ 29.895 29.893 29.891 29.888] AU Neptune-WFIRST distances (4 seasons): [ 29.4 30.753 30.442 29.034] AU Pluto-Sun distances (4 seasons): [ 35.143 35.205 35.267 35.33 ] AU Pluto-WFIRST distances (4 seasons): [ 35.608 36.098 34.838 34.408] AU

ChrisDelaX commented 7 years ago

Here is the new movie I generated. The maximum excursion is still too great.

2017-05-25 17:58 GMT-04:00 rhondamorgan notifications@github.com:

These two are incorrect: Earth-Sun distances (4 seasons): [ 0.988 0.989 1.012 1.012] AU Earth-WFIRST distances (4 seasons): [ 0.015 0.042 0.048 0.011] AU

The earth-sun distance should have a seasonal variability that is small-med-large-med. However, your numbers are small-small-large-large. From the JPL in house mission design calculator Quick, starting at 20240921, the season distances are [1.004, .984, .996, 1.016]AU.

Also, the Earth-WFIRST distance is too large. The largest it should be is <0.014 AU, not 0.042 AU.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/dsavransky/EXOSIMS/issues/36#issuecomment-304135884, or mute the thread https://github.com/notifications/unsubscribe-auth/AMUG7txuDWKZ_7hbsZ_4VULjE3RH2jWgks5r9flsgaJpZM4NhKcf .

rhondamorgan commented 7 years ago

Can you send me the movie via direct email? It didn't attach through the github issue thread.

ChrisDelaX commented 7 years ago

My time sampling (4 points) was simply not sufficient to see the small-med-large-med behavior. But here are the distances with 8 points, showing that Earth-Sun distances are correct. I am still getting 0.05 AU at maximum distance between Earth and WFIRST. I suspect an issue with the rotation from ecliptic coordinates into equatorial plane.

Sun-Sun distances (4 seasons): [ 0. 0. 0. 0. 0. 0. 0. 0.] AU Sun-WFIRST distances (4 seasons): [ 0.998 0.994 0.997 1.008 1.022 1.028 1.02 1.008] AU Earth-Sun distances (4 seasons): [ 0.988 0.983 0.989 1.001 1.012 1.017 1.012 1. ] AU Earth-WFIRST distances (4 seasons): [ 0.012 0.027 0.051 0.053 0.042 0.027 0.009 0.017] AU Moon-Sun distances (4 seasons): [ 0.99 0.982 0.989 1.001 1.012 1.018 1.01 1.002] AU Moon-WFIRST distances (4 seasons): [ 0.01 0.026 0.054 0.05 0.045 0.025 0.011 0.017] AU

ChrisDelaX commented 7 years ago

I met with Dmitry and we found the problem was mainly due to a wrong rotation angle in the ecliptic plane. I just pushed a fix to this issue. Here are the new generated distances (8 points over one year). I am also sending a new movie by email. Thanks for your feedback.

Sun-Sun distances (4 seasons): [ 0. 0. 0. 0. 0. 0. 0. 0.] AU Sun-WFIRST distances (4 seasons): [ 0.998 0.994 0.997 1.008 1.022 1.027 1.02 1.008] AU Earth-Sun distances (4 seasons): [ 0.988 0.983 0.989 1.001 1.012 1.017 1.012 1. ] AU Earth-WFIRST distances (4 seasons): [ 0.011 0.012 0.01 0.009 0.011 0.012 0.009 0.009] AU Moon-Sun distances (4 seasons): [ 0.99 0.982 0.989 1.001 1.012 1.018 1.01 1.002] AU Moon-WFIRST distances (4 seasons): [ 0.009 0.013 0.011 0.01 0.011 0.01 0.012 0.008] AU