pdosmall.gif (6581 bytes)

The Minor Planet Observer
Palmer Divide Observatory

2007 Shoemaker Grant Recipient

Planetary.gif (18781 bytes)


External Links
(opens new window)

Buy MPO Software

MPO Support

CALL web site

Society for Astronomical Sciences




MPO Scripting - Tutorial

The best way to learn about scripts is to write and run them. However, it never hurts to have a nudge down the right road. In this section, we’ll start with some very basic scripts and build on each one.

A Script for a Single Target

For the first example, we’ll presume that you’re going to move the scope to a known target and stay on it all night, taking an image at periodic intervals. This is a good example for those working asteroid or variable star lightcurves.

Sample Script 1

starget1.gif (11613 bytes)

The above script does the following:

  1. Sets the camera imaging binning to 2x2

  2. Sets the frame mode to Dark Keep, Light. This means Connections will take a single dark frame when it takes the first exposure and apply that dark to all light frames. A better method is to use the LTOnly command, which would not take any darks. You would apply a master dark against the images later.

  3. Goes to the asteroid 8734 Warner, computing its position at the time the command is executed. This means you don’t have to know the position of the asteroid in advance and the script is not tied to a given date.

  4. Waits 15 seconds for the mount tracking to settle in.

  5. Takes a 60-second dark, then a 60-second light and applies the dark to the light image. The processed image is stored in the C:\Warner\20051021 directory.

This script manages to take one and only one exposure (the dark and light combination considered to be one exposure). That doesn’t get you through the night. So, let’s add a few steps.

Sample Script 2

starget2.gif (14746 bytes)

  1. The command ResetLoop was inserted after WaitFor (15) and TakeImage.

  2. A second WaitFor with a wait of 90 seconds was added to the end of the script. The result is that after the 15-second pause after the GoToAsteroid, Connections automatically sets a loop that includes steps 6 and 7. The loop runs indefinitely, taking a 60-second exposure every 90 seconds.

This is better but it's still lacking. For one, the asteroid could be moving and you want to keep the scope centered on its position. Another thing is that the script will run indefinitely - right up to and beyond sunrise! Some additional commands will take care of these issues.

Sample Script 3

starget3.gif (17001 bytes)

  1. Line 1 sets the binning to 2x2

  2. Line 2 sets the mode to Dark Keep, Take Light. The dark will be applied to all light images.

  3. Line 3 goes to asteroid 8734 Warner, computing its position at the time the command is executed.

  4. Line 4 waits 15 seconds before going to the next command.

  5. Line 5 creates a loop that includes steps 6 through 8.

  6. Line 6 takes a 60-second image and automatically saves it using the base name of "Warner" and directory of c:\Warner\20051021. Connections automatically increments the file name so each image has a unique name.

  7. Line 7 waits 90 seconds before executing the next step.

  8. Line 8 checks how many times the loop has been executed. If it is less than 10 (Arg1), the script returns to the first step in the loop (6). If this is the tenth time the loop has executed, the script jumps to step 3 (Arg2). This causes the scope to be repositioned on the newly calculated position for the asteroid and the process begins anew.

For many, especially those who don’t have focus problems, who have good polar alignment, and/or intend on getting up to stop the process before sunrise or the scope hits the walls, this is sufficient. A similar script is used at the Palmer Divide Observatory for most work. However, Connections can do more, lots more, and the next script is more typical of one used for a single target at the PDO.

Sample Script 4

starget4.gif (25783 bytes)

Here’s a full-blown scrip that can still do more but certainly takes advantage of many of the script commands in Connections that help assure success. This is typical script used at the Palmer Divide Observatory to work a single target. The only exceptions are that lines 1 and 2 are usually not included since the temperate is already set and the script is started manually at the time the first GoToAsteroid is appropriate, i.e., when it's dark enough and/or the asteroid is high enough.

  1. Line 1 the imaging camera temperature to 0 and waits 120 seconds before going to the next step (it’s assumed the camera is already linked - you could add a LinkCamera command at the very beginning of the script though it’s good to know it’s linked before you start the ball rolling).

  2. Line 2 then uses a WaitUntilEvent command to wait until Astronomical Twilight has ended.

  3. Line 3 moves to the asteroid. Connections computes the position of the asteroid at the time of the command so you don't need to know its position beforehand. Note the group number is set to 1.

  4. Line 4 does some cool things. The SyncLastPos command takes an image of the field and tries to AutoMatch the scope (Arg1 = 1). Before it does, it waits 10 seconds (Arg2) to allow the mount to settle in after the previous GoTo command. If the scope's position is more than 6 arcminutes off the intended position (Arg3), Connections will not update the scope's position. This is to avoid runaway conditions where the AutoMatch gets fooled. It's rare and happens usually only when clouds have moved in and the sync image has very few stars.

  5. Note that the group number is also 1. If the GoToAsteroid fails, there's no point in trying to sync on the scope's current position.

  6. Line 5 sets the camera binning to 2x2. The SyncLastPos commands resets the default exposure parameters. This command and the SetFrameMode in the next line are required to assure that the TakeImage commands to follow use the proper settings.

  7. Line 6 sets the frame mode to Dark keep, Take light.

  8. Line 7 resets the loop to steps 8 through 11. These steps are repeated until the condition set by either the JumpAfterEvent command in line 8 or the JumpAfterCount command in step 12 is met.

  9. Line 8 checks if Nautical Twilight has started. If it has, the script jumps to line 12 (Arg3). If not the script moves to the next command.

  10. Line 9 takes a 60-second image and automatically saves it with a unique file name based on the base name specified in Arg2 in the directory specified by Arg3.

  11. Line 10 pauses the script execution for 90 seconds.

  12. Line 11 checks how many times the loop has been executed. After the tenth pass (Arg1), the script jumps back to Line 3 (Arg2), where Connections moves the telescope to the calculated position of the asteroid. On average, a main belt asteroid moves about 0.25 a day, so this command can be useful even for average asteroids. For fast moving Near Earth Objects, calling GoToAsteroid periodically is almost a requirement if you want to keep the target in the field of the camera.

  13. Line 12 is reached only if the JumpAfterEvent command determines that Nautical Twilight has begun. If so, the shuts down the imaging camera (Arg1 = 1) and pauses 3 minutes (Arg2) before moving on. This gives the camera time to reach ambient temperature.

  14. Line 13, sends the telescope to its home position. It’s up to you to figure out how to stop the scope from tracking after this point.

If using a ScopeCraft mount, you could use the SendChars command to send the special command that shuts down the motors or set the appropriate characters in the Post Home Command in the configuration settings.

If you're using an LX-200 GPS/RCX, and are using the GPS home mode, then the scope stops tracking by itself and no extra steps or commands are required.

For a complete review of scripting and script commands in MPO Connections, download the MPO Connections manual.


This site is best viewed at 1024x768 and higher

This page was last updated on 01/19/11 15:31 -0700.
All contents copyright (c) 2005-2011, Brian D. Warner
Trademarks are the property of their respective owners