{"id":41077,"date":"2018-10-06T03:01:37","date_gmt":"2018-10-05T17:01:37","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=41077"},"modified":"2018-10-05T18:04:15","modified_gmt":"2018-10-05T08:04:15","slug":"php-and-python-pyephem-astronomy-helper-star-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-and-python-pyephem-astronomy-helper-star-tutorial\/","title":{"rendered":"PHP and Python PyEphem Astronomy Helper Star Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/ephem_astronomy.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PHP and Python PyEphem Astronomy Helper Star Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/pyephem_various.jpg\" title=\"PHP and Python PyEphem Astronomy Helper Star Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">PHP and Python PyEphem Astronomy Helper Star Tutorial<\/p><\/div>\n<p>Yes, today we have a &#8220;Star Tutorial&#8221;?  Thank you, thank you very much, well you shouldn&#8217;t have.  <font size=2>Ohhh, so you didn&#8217;t.  No, you&#8217;re not.<\/font> <font size=1>Well, that &#8230; sure &#8230; was &#8230; embarrassing.<\/font>   Anyway, further to yesterday&#8217;s <a title='PHP and Python PyEphem Astronomy Helper Observer Tutorial' href='#phpppeahot'>PHP and Python PyEphem Astronomy Helper Observer Tutorial<\/a> work, today, we &#8230;<\/p>\n<ul>\n<li>allow for Stars to be &#8220;objects&#8221; allowable within the (Python) <a target=_blank title='Star List, thanks' href='http:\/\/github.com\/brandon-rhodes\/pyephem\/blob\/master\/ephem\/stars.py'>PyEphem<\/a> calculations<\/li>\n<li>add some emojis (mainly for decorative purposes &#8230; but have a small internationalization advantage, we think)<\/li>\n<li>interface it to the work of <a target=_blank title='HTML Image Map Solar System More Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/html-image-map-solar-system-more-tutorial\/'>HTML Image Map Solar System More Tutorial<\/a> (as another source of information)<\/li>\n<li>some highlighting CSS to help not swamp the original calculation data<\/li>\n<li>not mentioned yesterday was the interfacing to <a target=_blank href='https:\/\/www.rjmprogramming.com.au\/ITblog\/html5-device-orientation-events-game-tutorial\/' title='HTML5 Device Orientation Events Game Tutorial'>HTML5 Device Orientation Events Game Tutorial<\/a> device orientation ideas available to some device\/platform combinations, we thought might help with rough orientation thoughts (for observers without a telescope)<\/li>\n<li>interface it to the sublunar (introducing new Python <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Python\/sublunar.py_GETME\" title=\"sublunar.py_GETME\">sublunar.py<\/a>) and subsolar (introducing new Python <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Python\/subsolar.py_GETME\" title=\"subsolar.py_GETME\">subsolar.py<\/a>) thinking (thanks <a target=_blank title='Useful link' href='https:\/\/stackoverflow.com\/questions\/17262428\/computing-sub-solar-point'>very useful link<\/a>) behind <a target=_blank href='https:\/\/www.rjmprogramming.com.au\/ITblog\/?s=Moon+Angle' title='Moon Angle blog posts'>Moon Angles<\/a> and <a target=_blank href='https:\/\/www.rjmprogramming.com.au\/ITblog\/?s=Sun+Angle' title='Sun Angle blog posts'>Sun Angles<\/a> respectively and using the emoji on <a target=_blank href='https:\/\/developers.google.com\/chart\/interactive\/docs\/index' title='Google Chart Tools provide a perfect way to visualize data on your website. From simple line charts to complex hierarchical tree maps, the chart galley provides a large number of well-designed chart types. Populating your data is easy using the provided client- and server-side tools.'>Google Chart<\/a> <a target=_blank href='https:\/\/developers.google.com\/chart\/interactive\/docs\/gallery\/geochart' title='Google Geo Charts'>Geo Chart<\/a> work of <a target=_blank href='https:\/\/www.rjmprogramming.com.au\/ITblog\/google-geo-chart-co-ordinate-emojis-tutorial\/' title='Google Geo Chart Co-ordinate Emojis Tutorial'>Google Geo Chart Co-ordinate Emojis Tutorial<\/a><\/li>\n<li>add in some PyEphem derived <a target=_blank title='Moon phase information, thanks' href='https:\/\/rhodesmill.org\/pyephem\/quick.html#phases-of-the-moon'>Moon phase<\/a> information<\/li>\n<li>not mentioned yesterday was the addition of Moon names not associated with Earth&#8217;s Moon as (Celestial Body &#8230; Milky Way) objects that can be worked with<\/li>\n<li>not mentioned yesterday was the (very quiet) link back to an original call of the web application<\/li>\n<li>not mentioned yesterday was the (client) Javascript geolocation ideas inherent with providing &#8220;Observer&#8221; default latitude and longitude that you can read more about at <a target=_blank href='https:\/\/www.rjmprogramming.com.au\/ITblog\/html5-geolocation-api-primer-tutorial\/' t5itle='HTML5 Geolocation API Primer Tutorial'>HTML5 Geolocation API Primer Tutorial<\/a><\/li>\n<\/ul>\n<p>A mixed bag of improvements we hope you like, and try out for yourself at a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/ephem_astronomy.php\">live run<\/a>&#8216;s PHP <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/ephem_astronomy.php--GETME\" title=\"ephem_astronomy.php\">ephem_astronomy.php<\/a> code <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/ephem_astronomy.php--GETME\" title=\"ephem_astronomy.php\">changed this way<\/a> for this work.<\/p>\n<hr>\n<p id='phpppeahot'>Previous relevant <a target=_blank title='PHP and Python PyEphem Astronomy Helper Observer Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/php-and-python-pyephem-astronomy-helper-observer-tutorial\/'>PHP and Python PyEphem Astronomy Helper Observer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/ephem_astronomy.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PHP and Python PyEphem Astronomy Helper Observer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/pyephem_observer.jpg\" title=\"PHP and Python PyEphem Astronomy Helper Observer Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">PHP and Python PyEphem Astronomy Helper Observer Tutorial<\/p><\/div>\n<p>Following on from yesterday&#8217;s <a title='PHP and Python PyEphem Astronomy Helper Primer Tutorial' href='#phpppeahpt'>PHP and Python PyEphem Astronomy Helper Primer Tutorial<\/a> &#8220;PyEphem Python module Hello World&#8221; 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 &#8220;Observer&#8221; object, in the Python.  So the web application user can click\/touch the &#8220;Observer&#8221; button to optionally define their (<a target=_blank title='Observers' href='https:\/\/rhodesmill.org\/pyephem\/quick.html#observers'>as per<\/a> (thanks)) &#8230;<\/p>\n<ul>\n<li>date \u2014 Date and time<\/li>\n<li>epoch \u2014 Epoch for astrometric RA\/dec<\/li>\n<li>lat \u2014 Latitude (+N)<\/li>\n<li>lon \u2014 Longitude (+E)<\/li>\n<li>elevation \u2014 Elevation (m)<\/li>\n<li>temp \u2014 Temperature (\u00b0C)<\/li>\n<li>pressure \u2014 Atmospheric pressure (mBar)<\/li>\n<\/ul>\n<p> &#8230; so that what gets calculated in this scenario, as part of the <a target=_blank title='Horizontal Co-ordinate System information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Horizontal_coordinate_system'>Horizontal Co-ordinate System<\/a> is &#8230;<\/p>\n<ul>\n<li>Altitude<\/li>\n<li>Azimuth<\/li>\n<\/ul>\n<p> &#8230; which, following the leads of PyEphem, would be what interests those practising astronomers out there.<\/p>\n<p>The <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/ephem_astronomy.php\">live run<\/a>&#8216;s PHP <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/ephem_astronomy.php-GETME\" title=\"ephem_astronomy.php\">ephem_astronomy.php<\/a> code <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/ephem_astronomy.php-GETME\" title=\"ephem_astronomy.php\">changed this way<\/a> for this new &#8220;Observer&#8221; functionality.<\/p>\n<hr>\n<p id='phpppeahpt'>Previous relevant <a target=_blank title='PHP and Python PyEphem Astronomy Helper Primer Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/php-and-python-pyephem-astronomy-helper-primer-tutorial\/'>PHP and Python PyEphem Astronomy Helper Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/ephem_astronomy.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PHP and Python PyEphem Astronomy Helper Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/pyephem.jpg\" title=\"PHP and Python PyEphem Astronomy Helper Primer Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">PHP and Python PyEphem Astronomy Helper Primer Tutorial<\/p><\/div>\n<p>&#8220;The Three P&#8217;s&#8221;, 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 <a target=_blank title='Thanks for heads up' href='https:\/\/rl.se\/sub-solar-point'>&#8220;heads up&#8221;<\/a>, thanks, to a stupendous Python module called <a target=_blank title='PyEphem ... thanks' href='\/\/rhodesmill.org\/pyephem\/'>PyEphem<\/a> that we are introducing at this blog today via &#8230;<\/p>\n<ul>\n<li>installing onto a (MacBook Pro) Mac OS X <a target=_blank title='MAMP Mac OS X local Apache\/PHP web server landing page' href='http:\/\/www.mamp.info'>MAMP<\/a> local web server environment via (you may not need &#8220;sudo &#8221; below) &#8230;<br \/>\n<code><br \/>\nsudo pip install pyephem<br \/>\n<\/code>\n<\/li>\n<li>unit testing just Python on that local web server via good test code on  <a target=_blank title='PyEphem ... thanks' href='\/\/rhodesmill.org\/pyephem\/'>this webpage<\/a><\/li>\n<li>install on (Apache\/PHP\/MySql Linux CentOS) rjmprogramming.com.au web server<\/li>\n<li>unit testing just Python on that rjmprogramming.com.au web server web server via good test code on  <a target=_blank title='PyEphem ... thanks' href='\/\/rhodesmill.org\/pyephem\/'>this webpage<\/a><\/li>\n<li>write some supervisory interfacing PHP featuring &#8230;\n<ol>\n<li>table of Celestial Body (list in a dropdown) and its <a target=_blank title='Right Asension information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Right_ascension'>Right Ascension<\/a> (angle from Earth) and its <a target=_blank title='Declination information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Declination'>Declination<\/a> (angle from Earth) &#8230; and if &#8230;<\/li>\n<li>dropdown selection causes some template Python for <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Python\/Jupiter.py_GETME\" title=\"Jupiter.py_GETME\">Jupiter<\/a>.py to be amended with name of Celestial Body of choice and any epoch (date) information to arrive at filled out table cells<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<p> &#8230; for a simple PHP supervisory arrangement (via PHP <a target=_blank title='PHP exec() method information' href='http:\/\/php.net\/manual\/en\/function.exec.php'>exec<\/a>) for the (hard working duck underneath the water) Python PyEphem module controlled astronomy calculation brilliance underneath.<\/p>\n<p>We have a short <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/pyephem.pdf\">&#8220;stream of consciousness&#8221; PDF slideshow<\/a> (of installing, coding and running) to augment your PHP <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/ephem_astronomy.php\">live run<\/a>&#8216;s PHP <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/ephem_astronomy.php_GETME\" title=\"ephem_astronomy.php\">ephem_astronomy.php<\/a> code for your perusal.  Early days, but exciting days!<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d41044' onclick='var dv=document.getElementById(\"d41044\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/python\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d41044' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d41065' onclick='var dv=document.getElementById(\"d41065\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/sun\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d41065' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d41077' onclick='var dv=document.getElementById(\"d41077\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/astronomy\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d41077' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Yes, today we have a &#8220;Star Tutorial&#8221;? Thank you, thank you very much, well you shouldn&#8217;t have. Ohhh, so you didn&#8217;t. No, you&#8217;re not. Well, that &#8230; sure &#8230; was &#8230; embarrassing. Anyway, further to yesterday&#8217;s PHP and Python PyEphem &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-and-python-pyephem-astronomy-helper-star-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,29,37],"tags":[109,2693,385,405,1619,483,513,518,611,1577,652,714,744,802,2695,2694,932,2550,997,2691,1012,2692,1122,2696,2445,1319,1411],"class_list":["post-41077","post","type-post","status-publish","format-standard","hentry","category-elearning","category-operating-system","category-tutorials","tag-astronomy","tag-declination","tag-emoji","tag-exec","tag-geo-chart","tag-geolocation","tag-google","tag-google-chart","tag-install","tag-interface","tag-javascript","tag-local-web-server","tag-mamp","tag-module","tag-moon","tag-observer","tag-php","tag-pip","tag-programming","tag-pyephem","tag-python","tag-right-ascension","tag-server","tag-star","tag-sun","tag-tutorial","tag-web-server"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/41077"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=41077"}],"version-history":[{"count":9,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/41077\/revisions"}],"predecessor-version":[{"id":41086,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/41077\/revisions\/41086"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=41077"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=41077"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=41077"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}