I am a beginner Python programmer. I am trying to get the code in the article "Calculating which satellites are visible" to function without success. My plan is to identify satellites that are visible at night and take open shutter images of the sky to record their streaks using a RPI and RPI camera.

I entered the code.

import ephem

I assume I run the three functions at the end?

seconds_between(d1, d2)


get_next_pass(-74.01, 40.01, 10, "iss.tle")

I'm not sure what d1, d2 and tr are.

Is there a complete version of the code or next steps to get it running. TY!

  • 2
    $\begingroup$ Can you provide a link to the article? $\endgroup$ Oct 11, 2021 at 13:48
  • $\begingroup$ @Jeff The same person who maintains PyEphem also created the new python package Skyfield which does this and many more things very nicely. You can just read the documentation there for the most up-to-date information. When I get to a computer I can write a short answer if somebody else doesn't do it first. For what you want to do I recommend just using one of the examples in Skyfield. RPi and PiCamera are a great combination for this! But it might be hard for some PyCamera packages to keep the shutter open for a whole minute. $\endgroup$
    – uhoh
    Oct 11, 2021 at 15:13
  • $\begingroup$ How to expose for longer than 1/3 of a second with PiCamera HQ using picamera? $\endgroup$
    – uhoh
    Oct 11, 2021 at 15:13
  • $\begingroup$ rhodesmill.org/skyfield/earth-satellites.html scroll down to "Finding when a satellite rises and sets" which uses satellite.find_events() and then "Find when a satellite is in sunlight" which uses satellite.at().is_sunlit() The third necessary test is a check the sky is sufficiently dark in your location at the time of the satellite pass. This is an excellent project to both learn more python (since Skyfield is so darn friendly and useful) and Raspbery Pi (for the same reasons). $\endgroup$
    – uhoh
    Oct 11, 2021 at 22:56


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.