Skip to content
This repository has been archived by the owner on Oct 14, 2023. It is now read-only.

Attractor surface visibility #1298

wants to merge 6 commits into
base: main
Choose a base branch


Copy link

@Yash-10 Yash-10 commented Aug 5, 2021

This is an attempt inspired by section 5.2 ("Direct Visibility of a Planetary Surface") of Escobal's book and uses equation 5.5.

  • Trying to find what tests can be included.

As mentioned in the book, this might have application for planetary probes to study some properties of a planet, its composition, atmosphere, etc.

Just added a test to check if it doesn't give any errors.

Copy link

codecov bot commented Aug 5, 2021

Codecov Report

Merging #1298 (f48862c) into main (48c854a) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1298      +/-   ##
+ Coverage   92.25%   92.29%   +0.03%     
  Files          81       81              
  Lines        4260     4281      +21     
  Branches      358      358              
+ Hits         3930     3951      +21     
  Misses        248      248              
  Partials       82       82              
Impacted Files Coverage Δ
src/poliastro/core/ 100.00% <100.00%> (ø)
src/poliastro/twobody/ 99.02% <100.00%> (+0.08%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 48c854a...f48862c. Read the comment docs.

@Yash-10 Yash-10 force-pushed the satellite-view branch 2 times, most recently from a16799b to 6ef408c Compare August 6, 2021 08:16
Copy link
Member Author

Yash-10 commented Aug 6, 2021

We had discussed whether the addition of elevation wouldn't get too complicated. It seems we could add the elevation parameter without changing the "visibility function" much, barring some more additional computations.

Copy link

I guess this is somewhat related to #1299, could you clarify what are the differences between the two?

Copy link
Member Author

Yash-10 commented Aug 9, 2021

Satellite visibility aims to detect when a satellite becomes visible from a ground station on an attractor whereas satellite view (here) tries to detect the case when a satellite will be able to view the sunlit part of its attractor. So the satellite view event:

  • Doesn't account for any specified ground station.
  • Instead, thinks from the point of view of the satellite instead of the ground station.

From Escobal's book:

Screenshot from 2021-08-09 13-08-04

Hence, the geometry seems to be almost the opposite of the eclipse event

@Yash-10 Yash-10 force-pushed the satellite-view branch 2 times, most recently from 3abaa88 to 2735350 Compare August 9, 2021 08:52
@Yash-10 Yash-10 marked this pull request as ready for review August 9, 2021 09:22
Copy link
Member Author

Yash-10 commented Aug 9, 2021

As decided earlier, the added test checks eclipse doesn't trigger when satellite view triggers. This might not be as robust as a check since I think there could be situations where neither event is triggered. But such a test could be a good starting point.

I think this is ready to be reviewed.

Copy link

@astrojuanlu astrojuanlu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good to go!

Copy link

I did a very short-sighted review and @Yash-10 rightly told me that the tests are incomplete. Removing the approval, sorry for the noise 🙏🏽

Copy link
Member Author

Yash-10 commented Sep 10, 2021

For validating this event, I am trying to use this equation from Escobal's book (Page 155 under Analytics of the Two-body problem):

Screenshot from 2021-09-10 13-28-44

I believe the variable t would give the event occurrence time. It needs T, the time of latest perigee pass. I am thinking whether what I added is plausible. Below is the diff:

diff --git a/tests/tests_twobody/ b/tests/tests_twobody/
index 898a568a..08de0603 100644
--- a/tests/tests_twobody/
+++ b/tests/tests_twobody/
@@ -11,7 +11,7 @@ from import line_of_sight
 from poliastro.core.perturbations import atmospheric_drag_exponential
 from poliastro.core.propagation import func_twobody
 from poliastro.twobody import Orbit
-from poliastro.twobody.angles import nu_to_E
+from poliastro.twobody.angles import nu_to_E, E_to_M
 from poliastro.twobody.elements import mean_motion
 from import (
@@ -484,11 +484,11 @@ def test_satellite_view_event():
     epoch = Time("2020-01-01", scale="utc")
     coe = (
         6828137.0 * u.m,
         0.0073 *,
         87.0 * u.deg,
         20.0 * u.deg,
         10.0 * u.deg,
         0 * u.deg,
     orbit = Orbit.from_classical(attractor, *coe, epoch=epoch)
@@ -515,7 +515,8 @@ def test_satellite_view_event():
     n = mean_motion(orb.attractor.k, orb.a)
     # Equation 5.14 from Escobal.
-    expected_view_t = t_perigee + (E - ecc * np.sin(E) * u.rad) / n
+    M = E_to_M(E, ecc)
+    expected_view_t = t_perigee + M / n
     assert_quantity_allclose(satellite_view_event.last_t, expected_view_t)

Copy link

Hi @Yash-10, you may also use the logic from the t_p property of Orbit class to compute the time since periapsis, see:

def t_p(self):
"""Elapsed time since latest perifocal passage."""
t_p = (
self.attractor.k.to_value( ** 3 / u.s ** 2),
* u.s
return t_p

@astrojuanlu astrojuanlu changed the title Satellite view Attractor surface visibility Sep 13, 2021
Copy link

(Renaming this PR for clarity)

Copy link
Member Author

Yash-10 commented Sep 30, 2021

I wonder if:

could be used somehow for validation?

Also, using the above equation from Escobal was a bit tough for me. Even though one could get the eccentric anomaly and mean motion at the event instance, getting the time of perifocal passage (and not since the perifocal passage) is still confusing. One idea might be to get the time of perifocal passage from the orbit epoch.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

3 participants