Setting up GCX (Linux astrometry program)

The first step is sudo apt-get install gcx

you will need the GSC ACT catalog, downloaded using wget. There are a lot of directories with lots of ~50KB files, so it will take a while even with a very fast internet connection. Maybe there is a better way to use wget to download a huge amount of small files

mkdir ~/gsc-act && cd ~/gsc-act
wget -r -nH --cut-dirs=5

set File>File and Device Options/GSC to /home/username/gsc-act
where username is your linux login
You will need the Tycho2 star catalog, downloaded using wget.

mkdir ~/tycho2 && cd ~/tycho2
wget -r -nH --cut-dirs=5

Once you see that they’ve downloaded correctly, do:

zcat tyc2.dat.??.gz >tycho2.dat

set File>File and Device Options/Tycho2 to /home/username/tycho2
where username is your linux login

Setting up program

Note: if you have Ubuntu 14.04, you can simply type: sudo apt-get install
Otherwise, or if you want the latest version, follow the steps below.

If you want a nice wrapper program I wrote that plots right ascension / declination and azimuth /elevation for your image, check out: the is what you want.

setup the prereqs:
sudo apt-get install libcairo2-dev libnetpbm10-dev netpbm \
libpng12-dev libjpeg-dev python-numpy \
python-pyfits python-dev zlib1g-dev \
swig cfitsio-dev

then download newest .bz2 file from:
extract it to your ~ directory, then go in and type in Terminal
make py
make extra
sudo make install

edit your .bashrc file, adding the line
export PATH="$PATH:/usr/local/astrometry/bin"

to increase performance, edit
sudo nano /usr/local/astrometry/etc/astrometry.cfg
(sometimes it’s in /etc/astrometry.cfg)
and uncomment the
and modify
add_path /opt/astrometry/data
note: TILDE won’t work! actually use /home/username
where username is your Linux login.

sudo mkdir -p /opt/astrometry/data
for i in {08..19}; do
wget -nc -nd -P /opt/astrometry/data"$i".fits

Installing PyEphem in Ubuntu–computing sunrise/sunset in Python

PyEphem has some of the functionality for Python that the NAIF SPICE package has for C, FORTRAN, IDL, and MATLAB–specifically, the ability to perform high-precision astronomical calculations.

PyEphem may be obtained from:

To install the PyEphem or Ephem packages for Python 2.7 or 3.x respectively, you must first have the python-dev or python3-dev respectively installed, or you will get an error something like:
extensions/_libastro.c:3:20: fatal error: Python.h: No such file or directory

This Python example computes Boston sunrise/sunset times at Fenway Park.

Step-by-step in Terminal
1) for Python 2:
sudo apt-get install python-dev
for Python 3:
sudo apt-get install python3-dev
2) download the PyEphem package,
unzip to your /tmp directory, then cd to that directory and
for Python 2.7 type:
sudo python install
for Python 3.x type:
sudo python3 install

Now you’re ready to use the PyEphem.

Example of PyEphem usage for local sunrise/sunset–note, this example uses Python 3.x syntax for “print” and WILL NOT work for Python 2.7 unless you modify the print statement.

import ephem
import datetime

now = #get current time

Boston.pressure = 1010 # millibar
Boston.temp = 25 # deg. Celcius
Boston.horizon = 0'42.3462'
Boston.elevation = 3 # meters = now

sun = ephem.Sun()

print("Next sunrise in Boston will be: ",ephem.localtime(Boston.next_rising(sun)))
print("Next sunset in Boston will be: ",ephem.localtime(Boston.next_setting(sun)))