Closed aballet closed 1 year ago
Drat—I definitely agree that visibility should be commutative, so something must be wrong here.
Thanks so much for providing a script to get an investigation started.
I have a busy next few days, but hopefully I'll have some time to sit down, run the script and confirm that I get the same results on my own computer, and then take a look to see what the math is doing behind the scenes. I'll report back once I've found something! (Though any other investigators are welcome to weigh in in the meantime.)
@aballet I added
#!/usr/bin/env python3
to the top and installed via pip3
the module plotly
and then ran with the result:
$ python3 test.py
Traceback (most recent call last):
File "test.py", line 18, in <module>
def get_visibilities(satellite1: EarthSatellite, satellite2: EarthSatellite, datetimes=list[datetime]):
TypeError: 'type' object is not subscriptable
Oh right, I should have mentioned that this was written in Python 3.10. You can remove all the type annotations, they have no impact on the results.
Sorry about that.
To see the plot in an easy way, you can also run this in a Jupyter notebook.
If you use python3 ...
, the figure will not be saved. I will provide the edited piece of code in an hour to fix this.
Hi, I updated the code in my first message. The problem is now fully reproducible with hard-coded TLEs. To display the figure, the package kaleido
must be installed as well. If you don't want to install anything else, just delete the last 3 lines of code, the problem will show up in the standard output as well.
@aballet — I had a bit of time this evening, so I was able to sit down and run your script, and it turns out that the is_behind_earth()
method wasn't properly accounting for the situation where the Earth is on the line joining the two satellite positions, but where the Earth is actually out past the other satellite rather than sitting in between them. So I've edited the routine to properly recognize when the Earth's disc is in the background behind the other satellite, rather than in front of it.
The improvement should come out in the next version of Skyfield. But if you want to try it now, install the development version of this project:
pip install -U https://github.com/skyfielders/python-skyfield/archive/master.zip
Thanks again for letting me know about the problem!
And thank you for taking the time to investigate and fix it!
Hello,
I am working with inter-satellites visibilities, i.e. when satellite1 could have a line of sight towards satellite2 without being blocked by the Earth. I noticed that sometimes depending on the order of the vector subtraction (
satellite1 - satellite2
, orsatellite2 - satellite1
), we get different results.I think this could be a bug. I cannot find a reasonable explanation on why the order of operations matters: if satellite1 sees satellite2, then the opposite should be true as well.
Here's a working piece of code, with the results below. This should be run in Python 3.10. For the figure to be displayed, the package
kaleido
must be installed as well.Below, we notice a gap of visibility of two minutes in one direction. Depending on the pair of satellites and the time horizon, the duration of the gap can vary.