AutoFocus Tool User's Guide
This is the user's guide for the AFTool
A reoccuring problem: IDL license server dying.
If (when) the IDL license server dies, we end up with the autofocus software dying every five minutes (IDL will come up in demo mode).
The license server runs on duke, and must be restarted by root (as root), using the sys5_idl_lmgrd, which can be run using:
service sys5_idl_lmgrd restart
update: The root of the problems seems to be MIRSI somehow issuing a command to duke to shut down the license server. We thought we'd fixed this, but the problem came back on 7/25, as reported by B. Golisch.
NOTES Regarding IDL:
- When things go bad in an IDL session: I have had IDL sessions and
software freeze up on me. You should be able to select the xterm
session from which you started IDL and use the ctrl-C key command
sequence to exit most IDL programs (this will dump you back to the idl
shell which you can then exit from using the "exit" command). On
occasion, and with the AFTool, I've had to select the xterm, enter the
ctrl-C key command sequence, then mouse over the AFTool GUI to get the
shell to process the ctrl-C.
Initial Setup
Step 1: Start a VNC server session on stefan as user autofocus using the appropriate instrument
The AFTool will be run in a VNC server session started by the TO on stefan.
1a.
AutoFocus should be run in a VNC session on stefan.
A VNC session for autofocus may already be running. To check,
executing the command "ps aux | grep vnc | grep autofocu" will print
out some information to indicate whether the VNC server process for
autofocus is running, and what the display number. For example,
when the VNC server is running for user autofocus on display 1, and the
"ps aux | grep vnc | grep autofocu" is executed, the following output
is given:
stefan:/home/lockhart 6> ps aux | grep vnc | grep autofocu
6031 3704 0.0 0.3 9344 6972 ? S 10:01 0:00 Xvnc :1 -desktop stefan:1 (autofocu) ...<snip>
6031 3707 0.0 0.0 5152 592 ? S 10:01 0:00 sh -c /home/autofocu/.vnc/xstartup >> ...<snip>
stefan:/home/lockhart 7>
(NOTE: both lines starting with 6031 are substantially longer, but were shortened for readability)
The line "6031 3704 0.0 0.3 9344 6972 ? S 10:01 0:00 Xvnc :1 -desktop stefan:1 (autofocu)" indicates that a VNC session for autofocus is already running on stefan using display 1 (indicated by the "stefan:1", format is machine_name:display_number).
If no VNC session is running for autofocus, start a vnc session on stefan using miranda's script.
vnc -start autofocu spex
The display number should be returned by running this command.
The display number of the autofocus VNC session will be used to connect the VNC client.
1b.
Start a vnc client and connect to the vncserver session running on
stefan (using the display number found or generated in step 1a).
From here, everything is done inside the VNC client
Step 2:
Start an xterm, and run the command xhost +
Step 3:
Start the GuideDog user interface and an instance of DV.
Open up two guidedog xterms, log in appropriately, and use the guidedogxui
and startdv commands as directed by the intsructions in the xterm
window. Take an image with guidedog to verify that DV is
receiving the images from guidedog.
If it does not, verify that
DV initialized properly by clicking on the DV Setup tab. You
should see something like "Dv socket port is 30123". If you see
"Dv socket was not initialized.", someone else has already started DV
on guidedog. In that case, open up a regular xterm on stefan,
start dv, and go into the Guide Dog XUI, select the Setup tab, click
the dv2.enable checkbox, and set the dv2.Hostname to stefan. Then
set the dv2.port value to the Dv socket port value on DV's Setup tab.
Take another image and verify that you are able to take images
and have them sent to your instance of DV.
Step 4:
The AFTool is an IDL program and must be run from the IDL shell. Start the IDL shell by running the command idl You should see something like:
IDL Version 6.2 (linux x86 m32). (c) 2005, Research Systems, Inc.
Installation number: 216038.
Licensed for use by: University of Hawaii
IDL>
Running Autofocus
Step 5: Start the AFTool
At the IDL> prompt, run the command @aftool
(yep, include the @ symbol). This should run the AFTool (which compiles
the apropriate source files, loads them into the IDL environment, and
then runs the autofocus program), and display the following window:
NOTE: if instead you get an error about file aftool not being found,
your IDL_PATH variable is not set correctly. Exit the IDL environment (exit), and try running source .cshrc
Your IDL_PATH setting should be already be set up in the .cshrc file,
but may not be getting loaded properly. The IDL_PATH variable should
include /usr/local/idl_irtf, and that is probably not being set correctly. If running source .cshrc fails, contact Miranda or Charles. If it succeeds, let Miranda or Charles know via email that you had the original problem.
Step 6: Setup Instrument using the Autofocus Setup button, customize, then point telescope at focus object
- Click the "Autofocus Setup" button located in the lower left
corner of the AFtool UI. This should set up the instrument to a
generic setup suitable for autofocus (this replaces the running of the
autofocus_setup macro in SPEX).
- Customize filters and instrument settings as you feel are
appropriate based on current conditions. The generic settings may
not be correct for the conditions you are in.
- Point the telescope at the object you are going to focus on.
Take an image with guidedog and verify the correct position using
DV. NOTE: The object you focus on must be a star of 7th or 8th
magnitude or brighter. Also, use single stars, NOT double stars.
Also, the star must be located AWAY from the slit, so that an out
of focus halo does not overlap the slit (both ABEAM position and BBEAM
position), and away from the edge of the image. The following is an example of two cases that should not be used:
Step 7: Set up AFTool
7a
Select the apropriate instrument and secondary mirror. If running in
demo mode, change the Data Mode from INSTRUMENT to ARCHIVE.
7b
The TO and support astronomers should have a fairly good idea where
focus should be based on current dome temperature. Please really
use the correct temperature, check that it is correct. If you do
not use the correct temperature, the AutoFocus tool will not work
correctly and time will be wasted. (At a later date we will be
generating a table and plot for correct focal positions based on
temperature) Use the Estimated Focal Position slider control to
set this value.
7c
Set the increments value ("At increments of:") to 0.10 or 0.05
(0.05 is recommended. 0.02 and less can be used, but takes
significantly longer) and the number of points to be used ("Number of
Points:"). These two numbers are used to indicate how many images
to take and how far apart. A wider spread would be selecting 0.10
for the increment value and 9 points for the number of points.
As an example, if the estimated focus is -0.20, the increments value
is 0.05, and the number of points is 5, aftool will sample data at
-0.30, -0.25, -0.20, -0.15, -0.10.
7d
Leave the Working Directory alone, unless you are working in demo
mode, in which case you must enter the directory in which your test
data resides.
7e
We currently recommend 1 image per set. This has worked fairly well for all cases tested to date.
7f
Leave the Number of Sets alone.
7g
Ensure that "Estimate Seeing By:" has the fwhm mode selected.
Step 8: Start Data Taking
Click the GO button. This will start the image acquisition portion
of the process. Quite a bit of debug is printed out to the shell. If
you are running the instrument with DV enabled, you should see the
acquired images show up.
Once the GO button is clicked, it should change from a green background
to a red background, and instead of reading "GO" it should read "Busy".
Once the image acquisition phase is complete, the GO button
background color will change again to yellow, and will read "Waiting".
The user will be
presented with a display window containing a sum of all the images
acquired:
Step 9: Determine box size around star
The focus object should be obvious. At the shell you will be asked
to right click on the center of the object. Please do so. After two
seconds the shell will ask you to right click on the right side of the
object. Please do so at a distance where the star has
transitioned to sky, but no further. These two points will be
used determine the size of the subarray extracted as useful data.
Step 10: Verify curve fit
The images will then be processed, plotted, and a curve fit to plot
points. A view of the plot will be shown, and a window will then appear
showing you the recommended focal position. If the data plotted and
curve fit seem reasonable, and the focal position seems reasonable, the
focal position presented is likely accurate and should be used. A
reasonably good example of a successful fit is:

NOTE: the From and To values in this case were from -0.8 to -0.2, centered around a suspected focal position of -0.5
However, if the data plotted and the curve fit shown seem overly
suspect, or the focal position seems unreasonable, most likely the
AFTool failed to succesfully generate reasonable data based on the
settings given, and the telescope will need to be focused manually.
Here is an example of a failed attempt to focus from -0.8 to 0.1 :
Step 11: Accept focal position
The final estimated focal position and FWHM value will then be
presented in a new window.
At this point you should select one of the four buttons presented. The functions of the buttons are:
- "Use and Restore" sets the focus position to the calculated
position and restores the instrument to it's original settings.
If everything goes successfully, this should be the button you
use.
- "Use" sets the focus position to the calculated position, but
does not restore the instrument. The instrument can be restored
by using the "Autofocus Restore" button on the main AFTool UI. If
you wanted to re-run AFTool using the calculated value as the center
point, you would use this button.
- "Origin" sets the focus to the position that was entered by the operator as the estimated focus value.
- "Cancel" closes the dialog immediately and does nothing.
For the first three buttons, once the operation has been completed the
Calculated Focal Position will disappear. The GO button will
return to having a green background and reading "GO."
The Info View Window
A window has been added to provide additional information to the operator, the info view window.
It provides a representation of the subarrayed sample actually used for
focussing. It also provides the timestamp of when the data was
taken, and holds the focus position and estimated best case seeing
value. It is persistent, and will not disappear when an option
from the Calculated Focal Position button is selected.
Returning to normal operation
Step 12: restore instrument parameters
If the AFTool performed correctly, and the "Use and Restore" button
from the Calculated Focal Position window was selected, there should be
nothing more to be done other than verifying that the results look
correct. If any other button was used, the instrument can be
restored using the "Autofocus Restore" button on the main UI.