In the framework of the MANOS program, I have been working on an automated data analysis pipeline for calibrated asteroid photometry and astrometry from imaging data. This pipeline, which can be applied to any kind of point source observations, is now in a robust state and available through github.

For details on the pipeline, please refer to Mommert 2017 (in press at Astronomy and Computing, arxiv).


Accessing the Gaia and Pan-STARRS catalogs using Python

The recently available Gaia and Pan-STARRS data releases are certainly interesting to the majority of astronomers for various reasons. If only there was a way to load the catalog data into Python…

Gaia DR1 catalog access using astroquery.vizier

The Gaia DR1 catalog is accessible through Vizier, which in turn can be accessed using the astroquery.vizier module, providing a comfortable astropy.table output. A simple query could look like this:

from astroquery.vizier import Vizier 
import astropy.units as u 
import astropy.coordinates as coord

def gaia_query(ra_deg, dec_deg, rad_deg, maxmag=20, 
    Query Gaia DR1 @ VizieR using astroquery.vizier
    parameters: ra_deg, dec_deg, rad_deg: RA, Dec, field 
                                          radius in degrees
                maxmag: upper limit G magnitude (optional)
                maxsources: maximum number of sources
    returns: astropy.table object
    vquery = Vizier(columns=['Source', 'RA_ICRS', 'DE_ICRS', 
                                    ("<%f" % maxmag)}, 
                    row_limit = maxsources) 
    field = coord.SkyCoord(ra=ra_deg, dec=dec_deg, 
                           unit=(u.deg, u.deg), 
    return vquery.query_region(field, 
                               width=("%fd" % rad_deg), 

# Example query
print(gaia_query(12.345, 67.89, 0.1))

Other columns are available, too. Simply add their names as provided here to the ‘columns’ list.

Pan-STARRS DR1 catalog access

The Pan-STARRS DR1 catalog resides at MAST, which unfortunately does not yet have an astroquery interface. Hence, we have to use a different approach: we download the data as an xml file and read that in using astroquery, again providing an astropy.table object:

import requests 
from import parse_single_table 
def panstarrs_query(ra_deg, dec_deg, rad_deg, mindet=1, 
    Query Pan-STARRS DR1 @ MAST
    parameters: ra_deg, dec_deg, rad_deg: RA, Dec, field 
                                          radius in degrees
                mindet: minimum number of detection (optional)
                maxsources: maximum number of sources
                server: servername
    returns: astropy.table object
    r = requests.get(server, 
    params= {'RA': ra_deg, 'DEC': dec_deg, 
             'SR': rad_deg, 'max_records': maxsources, 
             'outputformat': 'VOTable', 
             'ndetections': ('>%d' % mindet)}) 
    # write query data into local file 
    outf = open('panstarrs.xml', 'w') 
    # parse local file into astropy.table object 
    data = parse_single_table('panstarrs.xml')
    return data.to_table(use_names_over_ids=True) 
# Example query
print(panstarrs_query(12.345, 67.89, 0.1))

The file download makes this query significantly slower than comparable astroquery routines. Please note that STScI currently limits the Pan-STARRS queries on their servers to field radii smaller than 0.5 degrees.

Check Asteroid Observability with Python

Observers know the problem: there is a huge list of targets you want to observe – but what is the best time to observe them?

Use this Python script to find out:

The script requires the Python module CALLHORIZONS (see here) that can be easily installed using:

pip install callhorizons

In order to use the script, you have to modify it in three places (you can find those in the code by using a text search, looking for the word ‘user’):

  1. Target name list:
    simply create a file listing the names of your targets, one per line. You can use names, numbers, designations; make sure to use underscores in designations, e.g., 2001_AB123 instead of 2001 AB123. Each line can contain additional information on your targets, separated by a blank; this information is ignored by the script. The target name list file has to reside in the same directory as the script, unless you provide its path.
  2. Observation date range and step size:
    The script will query Horizons to obtain your targets’ ephemerides. You have to provide a start date (‘YYYY-MM-DD’; may include a UT time ‘YYYY-MM-DD HH-MM-SS’), end date, and a time step (e.g., ‘1m’ for 1 minute, ‘2h’ for 2 hours, ‘3d’ for 3 days…).
  3. Observability conditions:
    You may want to observe only targets that are brighter than a certain V magnitude, or have a maximum airmass. Enter those conditions here. See below for examples.

Run the script using:


The script will output for each target for how many time steps it is observable and write the data into two files:

  • observability.dat – observability information for each time step
  • peak_observability.dat – peak brightness information for each target over the entire period

Feel free to use, share, and modify this script. If you have questions or need help modifying the script, send me an email!

Setting Observability Conditions

You can specify you observability conditions in this line:

 observable =[((eph['V'] < 17.5) & (eph['airmass'] < 2.5))]

The conditions are given in the square brackets indexing In the given example, the target is considered observably only in those time steps when V<17.5 and when at the same time the airmass is less than 2.5. You can use all the properties specified here to setup your observability conditions.

Some examples:

observable =[((eph['V'] < 20.5) & (eph['airmass'] < 2.0) &
                       (numpy.sqrt(eph['RA_rate']**2 + 
                                   eph['DEC_rate']**2) < 0.1))]

This line also checks for the target’s total rate to be less than 0.1 arcsec/sec.

observable =[((eph['V'] < 18) & 
                      (eph['lunar_presence'] == 'dark'))]

Using this line, the script will only return those ephemerides when the Moon is below the horizon.


A Python Module to Query JPL HORIZONS

Working on Solar System small bodies, I make frequent use of the JPL HORIZONS system, which provides ephemerides and orbital elements at given times for any Solar System body. HORIZONS provides access through email, telnet, and a website that can be queried manually.

In order to conveniently query and investigate large amounts of data from HORIZONS, I wrote a Python module that provides access to ephemerides and orbital elements by parsing the html source code of the HORIZONS website. This method provides robust and fast access.

The module can be downloaded from github and is available through PyPi, which means you can install it using:

pip install callhorizons

Obtaining the coordinates for NEO 433 Eros as seen from Mauna Kea (observatory code 568) on a given Julian date is as easy as:

import callhorizons
eros = callhorizons.query('Eros')
eros.set_discreteepochs([2457446.177083, 2457446.182343])
print eros['RA'], eros['DEC'] 

Ephemerides and orbital elements for up to 15 discrete times, or over an arbitrary time range, can be queried for one object at a time. Data are stored in a numpy array, allowing for convenient access. Have a look at the documentation to learn more!

The module is publicly available without any warranty; feel free to use and modify it. If you have suggestions or comments, please let me know!

Observing Tools

A while back, I wrote some tools that I use for planning my observations. Now, I finally found the time to update them and turn them into publicly accessible websites. The tools are:

Observation Planner

This tool plots visibility curves indicating target elevation and airmass over the course of a whole night, which is either the current or coming night, or any night the user selects.  A number of moving and fixed targets can be displayed in the plot at a time, as shown in the example below. The purpose of this tool is to make it easier to decide which object to observe next. The black vertical represents the current time; dusk and dawn are also shown.


Pointing and Finder Tool

The idea behind this tool is to minimize the time necessary to obtain coordinates for moving targets and to create a finder chart to identify the target. Simply enter the target name and a time – or just select the current time – and the tool will provide pointing information including RA, Dec, the target’s rates, visual brightness, and airmass, as well as a finder chart indicating the target’s position at different times (see below). The tool can also be used to generate finder charts for fixed targets.



Both tools are currently set up for only a small number of observatories. If you would like to use these tools for your own observations, let me know and I can add your favorite observatory. Also, don’t hesitate to contact me if you have any other suggestions or comments!