PHP and Python PyEphem Astronomy Helper Observer Tutorial

PHP and Python PyEphem Astronomy Helper Observer Tutorial

PHP and Python PyEphem Astronomy Helper Observer Tutorial

Following on from yesterday’s PHP and Python PyEphem Astronomy Helper Primer Tutorial “PyEphem Python module Hello World” feeling tutorial, we get a bit more into the innards of PyEphem today, by allowing the Astronomer details to become part of the mix, as an “Observer” object, in the Python. So the web application user can click/touch the “Observer” button to optionally define their (as per (thanks)) …

  • date β€” Date and time
  • epoch β€” Epoch for astrometric RA/dec
  • lat β€” Latitude (+N)
  • lon β€” Longitude (+E)
  • elevation β€” Elevation (m)
  • temp β€” Temperature (Β°C)
  • pressure β€” Atmospheric pressure (mBar)

… so that what gets calculated in this scenario, as part of the Horizontal Co-ordinate System is …

  • Altitude
  • Azimuth

… which, following the leads of PyEphem, would be what interests those practising astronomers out there.

The live run‘s PHP ephem_astronomy.php code changed this way for this new “Observer” functionality.


Previous relevant PHP and Python PyEphem Astronomy Helper Primer Tutorial is shown below.

PHP and Python PyEphem Astronomy Helper Primer Tutorial

PHP and Python PyEphem Astronomy Helper Primer Tutorial

“The Three P’s”, for us, namely, PHP and Python and Perl, are all great choices as serverside programming languages. You will find, as a result of this, that programmers have written great code for one or other of them, and perhaps for all three. We came across a “heads up”, thanks, to a stupendous Python module called PyEphem that we are introducing at this blog today via …

  • installing onto a (MacBook Pro) Mac OS X MAMP local web server environment via (you may not need “sudo ” below) …

    sudo pip install pyephem
  • unit testing just Python on that local web server via good test code on this webpage
  • install on (Apache/PHP/MySql Linux CentOS) rjmprogramming.com.au web server
  • unit testing just Python on that rjmprogramming.com.au web server web server via good test code on this webpage
  • write some supervisory interfacing PHP featuring …
    1. table of Celestial Body (list in a dropdown) and its Right Ascension (angle from Earth) and its Declination (angle from Earth) … and if …
    2. dropdown selection causes some template Python for Jupiter.py to be amended with name of Celestial Body of choice and any epoch (date) information to arrive at filled out table cells

… for a simple PHP supervisory arrangement (via PHP exec) for the (hard working duck underneath the water) Python PyEphem module controlled astronomy calculation brilliance underneath.

We have a short “stream of consciousness” PDF slideshow (of installing, coding and running) to augment your PHP live run‘s PHP ephem_astronomy.php code for your perusal. Early days, but exciting days!

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

This entry was posted in eLearning, Operating System, Tutorials and tagged , , , , , , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>