Skip to content

dreamalligator/PySkyAlmanac

 
 

Repository files navigation

This program prepares a chart similar to Sky & Telescope's annual Skygazer's Almanac.

The code is written in Python. It uses PyX for preparing the PDF output, PyEphem for astronomical calculations, and SciPy for a simple root-finding calculation. PyEphem uses routines from XEphem.

This is in development stage and certainly has bugs. We're more than happy to help anyone trying to port this to a different locale (location, timeframe, language etc.).

Keywords: sky almanac, celestial events, astronomy

##Install Dependencies

  • PyEphem - pip install pyephem
  • PyX - If using Python2, need older version of PyX like 0.12.1. Python3, can use current stable release. Download tarball and run python ./setup.py install (or pip3 install pyx).
  • SciPy - Install full stack with apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose. See here.

Optional

  • git - apt-get install git - Git is assumed to have been installed. I don't know why you wouldn't have it :). Necessary if hosting your own city's almanac and want to link to it in the chart. See skyalmanac.py#L406.
  • goslate - pip install goslate - used in translations.py. (experimental)

##Instructions See local_info.py to see options for setting your location. There is minimal setup; you only have to change the obs_city field. That is, obs_city = 'San Francisco' or Istanbul.

It is of course possible your city isn't listed, so in that case switch the manually_set flag to True and fill in your latitude, longitude, year, and timezone at minimum. Set use_your_timezone to False if you are generating for a different city than where you are. See this quick reference on setting up your observer. elevation (m) is optional. Can also set epoch, temp and pressure if desired.

###Options

equation_of_time = False  # plot equation of time
display_moon_stuff = True # for moon stuff
display_bg = True         # display night gradient
display_dst_msg = True    # prints a note on accounting for DST
use_city = True           # use a city from the modest pyephem database
use_today = True          # use the year based on today
use_your_timezone = True  # are you printing for your timezone
output_pdf = True
output_png = True
png_transparency = False

###Languages Turkish, English, Chinese, and German languages are included. In translations.py change lang=None to either en, tr, zh or de. You can leave as None to leave as English default. Experimentally, you can also translate into any language by setting lang to a string of the language, for example lang='no' for Norwegian. I assume it takes all ISO 639-1 endonym abbreviation codes.

###Plotting Astronomical Catalog Objects You can plot Messier and other objects from astronomical catalogs as follows. There are plenty of catalogs like NGC. For this example, Xephem has a subset of astronomical catalogs. To add the Ring Nebula, I will look at messier.edb and copy M57 NGC6720,f|P,18:53:36,33:02,9,2000,86 into local_info.py as m57 = PyEph_body(ephem.readdb("M57,f|P,18:53:36,33:02,9,2000,86"), symbol='m57', tsize='tiny'). In addition, I'm also going to plot the Crab Nebula (M1) and the Owl Nebula (M97) to keep the format in the key. You don't have to add items to the key, but I'm going to mention it because if you would like to add items that people can use in other languages, modify translations.py to include the new object. For example, with the Ring Nebula, I added 'ring_nebula':'Ring Nebula', to the english dictionary, then in the other dictionaries (Turkish and Chinese at the time of writing) I added 'ring_nebula':en['ring_nebula'],. Later, I'll use google.translate or try to find somebody to translate. Then add to key with

c.text(llx+15.5, -1.4, r'{\footnotesize\sffamily M57: '+t['ring_nebula']+'}',
    [text.halign.left,text.valign.baseline,color.cmyk.Gray])

#Fork If you are generating this sky chart, please consider forking the repository and using github pages to host your city's custom sky almanac.

In your gh-pages branch, I made it super easy to just update your _config.yml!

You can also include this post-commit hook if you want to automatically publish updates from your readme onto your gh-pages branch.

My primary aim in this fork has been to get any location to generate with a clean format. Many thanks to atakan for creating such a great tool!! If you want to give a reference to the tool creating the chart, you can use the URL https://github.com/atakan/PySkyAlmanac. If you are curious on what is on my to-do list please check out my pull request and don't hesistate to use the issue tracker for this fork, or atakan's. There are definitely bugs, sorry :)

#License You can copy, modify and distribute the code under the terms of the GNU General Public License. See the file COPYING for more details. You can also freely distribute the end product, the chart itself.

Releases

No releases published

Packages

No packages published

Languages

  • Python 90.8%
  • TeX 9.2%