Active Optics with IDL Routines

This LBTO package of IDL routines for Active Optics and Focal Station Commissioning has been created by D. L. Miller.

This wiki page is slowly being deprecated. See ComTools or BGTechProcedures for the most up-to-date instructions.

New Summary of Basic IDL Commands (Sep 2010)

  • iif_register, /TCS (use whichever focal stations are authorized)
    iif_register, NAME (connect to the IIF for sending telescope commands and select the focal station name, possible choices are: /TCS, LFBG, RFBG, LDG, RDG, LPOL, RPOL, LPFU, RPFU, MODS, IRTC, )

  • collimate_once, /send_zern, /dont_ask
    (To collimate just once -- get a new wfsc image from GCS -- without a popup window asking if you want to send the corrections to the PSF. GCS WFSing must be stopped so that IDL can request GCS to take wfs images.)

  • collimate_multiple, 3, /send_zern, LIMIT=400
    (use this for collimations and measurements, to collimate many times, without the popup box asking about sending to PSF)

  • field_collect, 'stars_field.list', START=1, LIMIT=400
    (use this for automatic collection of field aberration data)
    (omit the file name to have it open a chooser box) See ComTools field_collect (click to view description) for detailed instructions.

  • wfsc_process_file, 'filename'
    (If you want to process a historical wfsc***_dd.fits file)

  • gcs_wfsc_display, /show_pupil, /show_center
    (use for parallel idl post-processing and display of wfs images that GCS is taking)

  • mods_take_image
    (take a MODS image via the doMODS command)

  • catalog_show, 'Pollux'
    (display the catalog entry and finder chart for a catalog object)

  • ptmodel_collect, LIMIT=500, START=1

  • ptmodel_binoc_collect

New Details for Binocular Pointing and Collimation Model (March 2013)

The binocular point model collection routine is run on the LBTO account with the command:

IDL> ptmodel_binoc_collect

Remember to turn on the Pointing Log on PCS!

It automatically copies the required Marco Fortran routine and data files into the current directory. The grid has been modified for AO with stars above 30 elevation.

The routine watches collimate on the SX side first and when it is below the limit (500 nm by default, change with ", LIMIT=400" if needed, but at 500 level the hexapod is in almost the final position...could maybe be fine with 700) it then watched collimation on the DX side, but usually one iteration is needed as the DX side was collimating while the SX was collimating and only one iteration is needed to confirm.

If the routine exits, you can restart the routine at the same star or at the next. In the current directory there is a file "grid_num.txt". This contains the number of the last star a preset was sent to. Thus, if 8 is in grid_num.txt you can send to the star where the routine exited with

IDL> ptmodel_binoc_collect, START=8

To go to the next star

IDL> ptmodel_binoc_collect, START=9

This routine writes a file called "ptmodel.log" which looks like:
|  num  |  Star Name  |  GStar  |  WFSC Image  |  WFSC Image  |
|  1  |  ACT0363  |  2  |  left_wfscimage000353.fits  |   right_wfscimage000299.fits  |
|  num  |  Star Name  |  GStar  |  WFSC Image  |  WFSC Image  |
|  2  |  WT10_411  |  2  |  left_wfscimage000358.fits  |   right_wfscimage000304.fits  |
|  num  |  Star Name  |  GStar  |  WFSC Image  |  WFSC Image  |
|  3  |  ACT0397  |  1  |  left_wfscimage000368.fits  |   right_wfscimage000309.fits  |
|  4  |  WT10_348  |  1  |  left_wfscimage000374.fits  |   right_wfscimage000313.fits  |
|  5  |  ACT0301  |  35  |  left_wfscimage000378.fits  |   right_wfscimage000321.fits  |
Here you can see I had to restart the routine with START=2 and 3, thus the header

Other explanations

These are some other explanations from Doug about where stuff happens. They are not needed in normal observing.

The other active optics config parameter
you will need to determine is the rotator
offset (.rot_offset in my
idl/wfsc/agw/ file).
Currently I have it set to 180, the needed
value to make North up on the MODS
detector when the Position Angle is
set to 0.  There could be some offset
from this nominal value.

In the past, we have placed large
(500-1000nm) of higher order
aberrations on the primary to determine
the correct offset (or at least close).
If you want to see the higher order
measured zernikes (Z12-Z21) you need to
edit idl/wfsc/collimate/
Change the loop limits where the table
is printed to the screen from

   for i = 2, 11 do begin


  for i = 2, 21 do begin

BTW, I did not fix the inconsistancy
between the displayed z22 values
and the values sent to the PSF
(ie wfsc000014_irc.zern).

I set focal_station = 'MODS' in the
file idl/wfsc/ so the MODS
focal station and AGw will be the
default when you start idl.

  I think the only Active Optics parameter
that may need to be tweaked is the pupil
center.  The easiest way to get at least
close to the correct value is to take a
WFSC image on-axis, read the .fits
file into ds9, place a circle around the
pupil and its center is the new pupil
position. QED.


The following lists several parameters as output by the IDL code, and the names of the corresponding parameters as listed in the GCS info file.

1) (GCS) ZERNROT+ROTDELTA = (IDL) Doug's Angle
2) (GCS) ROTDELTA = (IDL) Zern_Rot_Delta
3) (GCS) ROTANGLE = (IDL) Rotator Angle
4) (GCS) FLDANGLE = (IDL) Field_Ang_Del
5) (GCS) phi (output in syslog, not info file) = (IDL) Field_Angle

Adjusting WFS camera position

There are only two parameters that determine where the S-H spots are located in the full WFSC image. This the is x and y pixels for the center of the pupil. In GCS this is in one of the GCS config files (AIP_L.cfg). In IDL, these values live in ~/LBTO/agw/idl/wfsc/

The parameters are 10-15 lines from the top of the file and are called:
wfsc_x_center_on_axis = 403.0
wfsc_y_center_on_axis = 212.0

There should be only one set of wfsc_*_center_* variables in this file so it should be obvious. The values are float values. Both GCS and IDL have routines the tweak these center value for each WFSC images, so if you get the center to within a pixel or two, the Wavefront reconstruction should be fine.

The second set of values defines the corner of the reference lenslet when the program is searching for the spot pattern. (Ask Doug if you want to know more than that.) See IT 7252, 7272 and beware IT 7833.
agw_x_lenslet_edge[0] = 381.65
agw_y_lenslet_edge[0] = 213.85

wfsc_rot_offset = 9.0

-- DougMiller - 21 May 2008
Topic revision: r46 - 22 Nov 2019, JohnHill
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback