PHP and Python PyEphem Astronomy Helper Star Tutorial

PHP and Python PyEphem Astronomy Helper Star Tutorial

PHP and Python PyEphem Astronomy Helper Star Tutorial

Yes, today we have a “Star Tutorial”? Thank you, thank you very much, well you shouldn’t have. Ohhh, so you didn’t. No, you’re not. Well, that … sure … was … embarrassing. Anyway, further to yesterday’s PHP and Python PyEphem Astronomy Helper Observer Tutorial work, today, we …

  • allow for Stars to be “objects” allowable within the (Python) PyEphem calculations
  • add some emojis (mainly for decorative purposes … but have a small internationalization advantage, we think)
  • interface it to the work of HTML Image Map Solar System More Tutorial (as another source of information)
  • some highlighting CSS to help not swamp the original calculation data
  • not mentioned yesterday was the interfacing to HTML5 Device Orientation Events Game Tutorial device orientation ideas available to some device/platform combinations, we thought might help with rough orientation thoughts (for observers without a telescope)
  • interface it to the sublunar (introducing new Python sublunar.py) and subsolar (introducing new Python subsolar.py) thinking (thanks very useful link) behind Moon Angles and Sun Angles respectively and using the emoji on Google Chart Geo Chart work of Google Geo Chart Co-ordinate Emojis Tutorial
  • add in some PyEphem derived Moon phase information
  • not mentioned yesterday was the addition of Moon names not associated with Earth’s Moon as (Celestial Body … Milky Way) objects that can be worked with
  • not mentioned yesterday was the (very quiet) link back to an original call of the web application
  • not mentioned yesterday was the (client) Javascript geolocation ideas inherent with providing “Observer” default latitude and longitude that you can read more about at HTML5 Geolocation API Primer Tutorial

A mixed bag of improvements we hope you like, and try out for yourself at a live run‘s PHP ephem_astronomy.php code changed this way for this work.


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

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.


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>