Wednesday, January 08, 2014

Simple Mount Modeling and Long Exposure Unguided Imaging with Linux

I've written some software that provides simple mount modeling along a track in Right Ascension. This mechanism models the mount and telescope flexure, non-orthogonality, polar mis-alignment, as well as the varying sidereal tracking rate due to atmospheric refraction and the King rate. In short, the software allows long-exposure (10 minutes plus) unguided tracking, even at low altitudes where atmospheric refraction is greatest, and even with modest amounts of polar misalignment.

Many imagers wrongly believe that a "perfect" mount with minimal periodic error would allow very long exposure unguided images.  This is not true - even small amounts of polar misalignment would show up as declination drift. Also, the sidereal tracking rate is only accurate close to the zenith, as the object being imaged gets substantially lower than about 45 degrees of altitude, the tracking rate changes due to atmospheric refraction, and stars get elongated in spite of near-zero periodic error.

Several commercial products provide mount modeling for a small patch of sky and enable long-exposure unguided tracking - notably MLPT from Astro-Systeme Austria and ProTrack from Software Bisque.  To my knowledge, no one has offered a ProTrack-like functionality for generic mounts.

I have written some code in Perl, running on Intel Linux, which provides this functionality to Astro-Physics GTO mounts. Only tested on a (well-PEM-trained) Mach1, but should work with any AP mount, whether CP2 or CP3, so long as the residual periodic error is very small.  As the solution only sends guiding corrections in one direction, it should be insensitive to backlash.  The axes should be tight however, as the solution has no feedback loop and can't compensate for wind gusts or the mount being bumped (unlike encoders or an autoguider).

The code currently only has been tested on Santa Barbara Instruments Group (SBIG) USB cameras, specifically the ST8300M, and Astro-Physics GTO controllers over a serial port (or USB-to-serial dongle).

The workflow consists of the following steps:

1. Slew the mount to the object in question (using the hand pad)

2. Run the script; this script captures an image and then plate-solves the location, RCAL's the mount to the computed RA/DEC, then makes ten short slews in RA only (1.25 degrees per slew, corresponding to 5 minutes of tracking at sidereal rate), capturing and plate-solving images at every slew. After completing the sequence capture, the script slews the mount back to the original RA/DEC commanded in step 1.

Capture is done using a modified version of the SBIG sample testapp (the only modification I did was to accept the temperature setpoint on the command line). This is wrapped by the Perl script. Plate-solving is done using the blind plate solver, a local copy of which must be present on the Linux machine. Mount control is done using a set of helper functions that I bashed together over a few hours. Only a small subset of the AP GTO command set is used.

3. The captured model data (for this tracking path) is stored in the Model.csv file. This file contains the observation number (some may be skipped if the plate-solve failed), mount-reported RA/DEC,  mount-reported Alt and Az, plate-solved RA and DEC, and the RA and DEC deviation in arc-seconds. All RA/DEC and Alt/Az coordinates are in SDSS format (floating-point). The Perl library that wraps plate-solving and SBIG capture, and implements the AP GTO commands, also provides the coordinate conversion routines.

4. Run the file, which reads the model data and using ordinary least-squares linear fitting, calculates coefficients that describe the relationship between the plate-solved RA and DEC for each image, with the (mount-reported) Alt and Az for each image. The actual coefficients have RA and DEC error in arc-seconds (deviation from mount-reported RA/DEC and plate-solved RA/DEC) as the dependent variable, and mount-reported Alt/Az as the independent variables.

I used the standard Perl Statistics::Regression module to calculate the coefficients.

The file writes out the coefficients to the coefficients.txt file.

5. Run the file, which reads the coefficients from the file, and queries the mount RA/DEC and Alt/Az.  Using the coefficients, calculates the expected RA/DEC error for the current mount-reported Alt/Az, and calculates the necessary guide corrections needed to eliminate the computed RA/DEC errors.  The script then sends guide commands to the mount (blindly, because there is no guide camera, hence the name of the script) to correct for the computed RA/DEC errors.

Note that in this screenshot, is using 10-second sampling intervals, hence corrections are being done approximately every 20 seconds. Again, I used my bashed-together AP GTO support functions to implement pulse-guiding.

6. Capture unguided images!

Note that the coefficients for one particular patch of sky will not work for other patches of sky that are more than a few degrees away from the patch of sky where the model in step 2 was acquired. Hence this solution is not a general mount-modeling solution, but more like ASA's "Local Model," albeit with only ten data points.  Also, the least-squares fit is a linear fit, not a quadratic fit, and the derived tracking corrections don't work well for exposures well over 10 minutes.  By modifying the and scripts however a more complex model can be accommodated.

In the current model, RA = theta[0] + theta[1] * Alt + theta[2] * Az

(using the RA coefficients for RA, and the DEC coefficients for DEC).

And some results:

Unguided sub with the AT90EDT (no reducer/flattener) and ST8300M. Notice that the uncorrected image has significant RA drift due to the low altitude, and some declination drift due to polar misalignment. There's also a tiny bit of periodic error visible as the wavy pattern on the star trails.

Tracking-corrected sub. Stars are not perfectly round (1.85"/pixel) but there is a noticeable improvement in the tracking. Note also this is the corner of the image at 100% so there is some field curvature present due to my not using the flattener.

Another unguided example, from the area around Almach (a different part of the sky).

And the tracking-corrected image, using a different set of model data (and different coefficients). Note however that it only takes about 5-8 minutes to collect a set of ten images, plate-solve them, and derive a set of coefficients.

A stack of two 10-minute tracking-corrected subs of NGC 1499, the California Nebula. There's a large image artifact horizontally across the image. I don't know if this is dirt or some problem with the Linux SBIG driver. It does show however that round stars can be obtained at low altitudes, with a not-quite-perfectly polar aligned mount.

The setup. Look ma, no guider!