Periodic Error Correction for Losmandy Gemini

What is periodic error and why is it a problem?

Periodic error is a repetitive variation in the sidereal tracking rate of a motor-driven telescope mount. It can result in blurred long-exposure images, where each star appears to be sretched into an oval shape. The size of the effect depends on the size of the error and the image scale: images taken with short focal length telescopes on good quality mounts may not show periodic error effects at all. But in many imaging situations with typical amateur telescope mounts, periodic error is a nuisance that has to be compensated for in some way.

What causes periodic error?

Telescope mounts in the amateur market typically use a motor driving a worm gear via a gear box. The worm gear meshes with a spur gear that is directly attached to the right ascension axis of the mount. (Note that there are some other designs available that use direct-drive motors or belt drives. These may show little or no error, or the error that does occur may be non-periodic).

The worm gear typically rotates once in a few minutes and causes the spur gear to advance by one tooth as it does so. Ideally, the worm gear would have a perfectly smooth and uniform spiral surface. Manufacturing tolerances mean that this is not achieved in practice so the worm does not cause completely uniform rotation of the spur gear. This non-uniform motion repeats for each period of rotation of the worm gear and gives rise to periodic error. Of course the spur gear is also subject to manufacturing tolerances and these affect the right ascension motion too, as do any non-uniformities arising in the gear box. The result is that the observed error over one worm cycle never exactly repeats for subsequent ones.

Periodic error correction

Most modern telescope controllers allow the user to program a periodic error correction so that the rate of rotation of the worm gear is modified by the controller. This can reduce the periodic error and may mean that fewer autoguiding corrections are required. It is also possible to remove any long term drift in a star's apparent position due to error in the mount's sidereal tracking rate. Periodic error corrections are usually calculated by determining a star's apparent drift over a number of worm cycles and then taking an average. So it is unlikely that periodic error will be removed completely, since the actual drift tends to vary from one cycle to the next, for reasons given above.

The following sections describe the operation of a straightforward program that will analyse star position data and calculate the necessary corrections for a Losmandy Gemini unit (this has been tested using Gemini I, but not yet with Gemini II). The program is a scilab script. You will need to download a recent version of scilab from if you don't already have it. You can use GoQat to obtain the star position data and load the resulting periodic error correction file into your Gemini unit.

Please note that there are other more sophisticated programs available for periodic error analysis that calculate the necessary corrections for various drive controllers.

Getting star position data with GoQat

The script requires three or four columns of data. The first column is time in seconds, the optional second column is the worm position, the next column is the declination position of the star and the last column is the right ascension position. You will need to provide a column of worm position data if you want to create a PEC file.

You can get the necessary data using GoQat with an autoguider camera. On the Autoguider tab, choose the options to write the star position and worm position data. Then edit the "star_pos.csv" file in the GoQat folder of your home directory and select the rows that you want. For GoQat version 0.9.8 and earlier, you need to remove the commas. One way to do this is to copy and paste into a recent version of LibreOffice or OpenOffice Calc, choosing 'comma' as the separator option. Then copy and paste from Calc into a blank text file in your favourite editor. This file will be the file that you load into the script for analysis. You could also paste directly from "star_pos.csv" into a blank text file, search for "," and replace with "". You will not need to do this step with later versions of GoQat because the commas will be replaced with tabs. Just select the rows you want from "star_pos.csv" and paste directly into a blank text file.

Note that if GoQat loses the star when recording the data, it will write "Nan" (Not a number) to "star_pos.csv". You will need to find and remove any Nan's before the script will read the file successfully.

Running the GeminiPEC script

Before you run the script, you might wish to customise some of the default values. To do that, load the script into your favourite editor and find the section near the top marked "// SET DEFAULT VALUES HERE". You can also override these values when you run the script.

Start scilab and load the script with the command:


where "/PATH" is the location where you have installed the script. Note the trailing ";" to stop scilab listing the enire script to the command window.

When the script has loaded, you will see the following dialog box:

Left-aligned image

Click the "Choose input file..." button and choose the file of star position data. A window is displayed showing the right ascension and declination positions of the star plotted against time. You can select the region of data that you want to analyse by entering values in the "Start time (s)" and "Num. worm periods" fields in the dialog box. The script fills these values in for you depending on the data in the file but you can change them if you wish. Note that the minimum number of worm periods must be at least three. The other dialog box fields are filled according to the defaults in the GeminiPEC script; you can override them here if you want.

The fields are as follows:

  • "Start time (s)" - the start time in seconds of the data to be analysed.
  • "Worm period (s)" - the worm period in seconds.
  • "Num. worm periods" - the number of worm periods to be analysed, starting at the given start time.
  • "Steps per revolution" - the number of encoder steps for each worm revolution.
  • "PEC shift (steps)" - the number of encoder steps to shift the periodic error correction curve forwards or backwards.
  • "Running avg. (s)" - the number of seconds to smooth the right ascension data before calculating the periodic error correction. A value of around 5s or so is about right.
  • "RA arcsec/pixel" - the number of arcseconds per pixel in right ascension in the star position data.
  • "Dec arcsec/pixel" - the number of arcseconds per pixel in declination in the star position data.
  • "Camera angle (deg)" - the number of degrees to 'rotate' the data to allow for the camera not being properly aligned east-west.
  • "Guide speed" - the guide speed to use when generating the PEC data.

The other items are described below.

When you have selected the desired data range for analysis, click "Run". There may be a pause of several seconds whilst scilab analyses the data. When the calculations are done, the following three windows are displayed:

Left-aligned image

The first window shows the selected range of data, with the vertical axes of the graphs in units of pixels:

  • The top two graphs show the right ascension and declination position of the star against time.
  • The next two graphs show the same data with the long-term trend removed. The periodic nature of the error is evident in the right acension data in the left hand graph.
  • The bottom pair of graphs show the fourier analysis of the data, plotting the amplitude of each component against its period. The three main peaks contribute periods of 80s, 120s and 240s to the right ascension data (reading from left to right).
Left-aligned image

The second window shows the selected data, with the graph axes in units of arcsec, using the pixel to arcsec conversion factors entered in the "RA arcsec/pixel" and "Dec arcsec/pixel" fields of the initial dialog box.

  • The top two graphs show the right ascension and declination position of the star against time with any long-term trend removed. In this example, an Ovision worm and Mclennan gear box were used and the maximum amplitude of the error lies within the 5 arcsec Ovision guarantee.
  • The bottom left hand graph plots the measured declination position against the measured right ascension position (after removal of long-term drift). This gives some idea of the expected shape of a star on a long-exposure image resulting from periodic error alone. (Actually this exaggerates the effect because the central areas, where the star spends more time, would be brighter in practice). The orientation of the camera is estimated from the shape of this plot and is displayed with a red line. The angle of orientation (relative to zero degrees if aligned exactly east-west) is given on the plot and also displayed in scilab's command window. If the camera was poorly aligned, you can correct for this by 'rotating' the data. Enter the value given for the camera angle in the "Camera angle (deg)" field of the initial dialog box and click "Run" again to re-calculate.
  • The bottom right hand pair of graphs show histograms of the star's right ascension and declination positions after removal of long-term drift. The declination positon shows a good gaussian distribution as might be expected from seeing effects alone, whereas the right acension histogram is smeared by periodic error.
Left-aligned image

The third window shows the effects of correcting for periodic error based on an average curve that repeats exactly for each worm cycle, with the graph axes in units of arcsec.

  • The top graph shows the range of data that has actually been used to calculate an average star postion curve. This is always one worm cycle fewer than the number selected originally. The red curve is the star's measured right ascension position plotted against time, with any long-term trend removed. The blue curve is the average of all selected worm cycles and repeats exactly from one worm period to the next. The black curve is a smoothed version of the blue curve, using a running average specified in the "Running avg. (s)" field of the initial dialog box. It is this smoothed version of the star's position, averaged over a number of worm cycles, that is used to generate the periodic error correction data.
  • The second graph shows what would happen if the black curve were to be subtracted from the red curve - in other words it is the residual right ascension motion of the star if the periodic error was exactly corrected. This is the absolute best that you could expect to see. In practice, the correction is never this good and there is always some residual periodic error.
  • The bottom left hand graph plots the measured declination position against the residual right ascension position from the second graph. This gives some idea of the expected shape of a star on a long-exposure image after perfect periodic error correction. It will not be this good in reality.
  • The bottom right hand pair of graphs show histograms of the star's residual right ascension position and measured declination positions. The right acension histogram is now much tighter compared with the same graph in the second graphics window, but the remaining periodic error that always occurs in practice will make it worse than this.

Generating periodic error correction data

If your input file contains worm postion data, you can generate periodic error correction instructions for a Losmandy Gemini controller.

  • It is strongly recommended that you choose the lowest possible value for the "Guide speed" parameter. For the Gemini I controller, this is 0.2 times sidereal rate. This permits more corrections to be made per worm cycle and gives a smoother result. If you load the PEC corrections file with GoQat, your controller will be set to this selected speed automatically. Any autoguiding corrections that you may make must also be done at this speed. But a value of 0.2 should be ideal for all but the most wildly erratic mounts.
  • If you want to correct any long-term drift in right ascension, such as shown in the first graphics window in the above example, click the "Correct RA drift?" checkbox.
  • You can shift the entire correction curve forwards or backwards by entering the number of steps to shift in the "PEC shift (steps)" field. The number of steps for a single revolution of the worm is given in the "Steps per revolution" field.
  • If you used GoQat version 0.9.8 or earlier to get the star position data, you will probably need to click the "Invert PEC?" checkbox. Later versions of GoQat will invert the right ascension data before writing it, so this can be left unchecked for future versions. In any case, if the periodic error is much worse after applying the correction, then click the "Invert PEC?" checkbox.

To generate the PEC data, click the "Write data files?" checkbox and then click "Run". Scilab will take several seconds to re-do the calculations and write the following data files, where FILENAME is the full path and file name of your input data file:

  • FILENAME.fft - Contains the fourier transform data. The first column is the period in seconds, the second column is the amplitude of any component in the right ascension data with that period and the third column is the amplitude of any component in the declination data with that period.
  • FILENAME.RaDec - Contains the selected right ascension and declination data in arcsec, optionally rotated according to the value in the "Camera angle (deg)" field, with any long-term trend removed. The first column is the time in seconds, the second column is the right acension data and the third column is the declination data.
  • FILENAME.wp_Ra - Contains one worm cycle of right ascension star position data, in arcsec. The right ascension data is the mean over the number of worm cycles selected for analysis and is smoothed by the specified running average. The first column is the worm position and the second column is the right ascension data.
  • FILENAME.PEC - Contains the east and west corrections and durations for loading into the Gemini controller to correct the periodic error. The first column is the guide correction direction (east or west), the second column is the worm position at which to apply this correction and the third column is the number of steps to apply the correction. There are two header records; the first is the number of encoder steps for one worm rotation and the second is the guide speed for which the corrections have been calculated. GoQat uses these values when loading the data into the Gemini controller. If you aren't using GoQat, then remove these first two records and load the file into the controller by some other method.

When you have created the PEC file, you can load it into the Gemini controller using GoQat. The GoQat manual tells you how to do this. Remember to turn PEC on from GoQat's "Miscellaneous" menu after loading the data.

An example of periodic error correction

The following graph shows an example of residual error after applying PEC. Actually, it's about the best example. Often it is not as good as this. The periodic error seems to vary with mount loading, pointing direction and maybe temperature as the gears engage slightly differently. (Of course it would be possible to generate a number of PEC correction files for different conditions and use them as appropriate). Nonetheless, in the best cases the error is very much reduced. The sudden changes in speed that make guiding so hard have been eliminated - see the top graph of the third graphics window above for comparison.

There is still some long-term eastward drift, but the initial substantial drift has largely been removed. The initial drift was about 1.5 arcsec per minute east as a result of the mount tracking too quickly. (This is a sometimes reported feature of Losmandy Gemini-controlled mounts). In practice, for the conditions in which these data were obtained, an apparent eastward drift relative to the sidereal rate of about 1 arcsec every 4 minutes is to be expected from refraction.

Left-aligned image