...
The focus script is a Tcl script that runs under lois. In the case of LMI, it is available after LOIS has been started and initialized with the green UI button in the usual way. There should be an inplacefocus button under the User Buttons tab on the LMI UI to run the script. It is necessary for the TCS and AOS to be running and the usual connections via JOE established to perform the focus changes that this script will make. There is also a
setfocus script and User Button available to unconditionally set the focus value.
...
When the acquisition is complete, the routine initiates a "focus sweep" in which the focus setting is moved in steps from a value considerably lower than the focbase to one considerably higher. At each setting a "focus image" is taken , and another analysis is performed. If the brightness and fwhm meet similar criteria as those for acquisition, the focus is moved to the next step. Otherwise the image is retried; when retries are exhausted, the script usually terminates without a result. This could happen, for example, if clouds covered the star in midsweep. The focus script can also adjust the exposure time during after a measure in taken during the focus sweep, prior to a retry, but within narrower limits than those used at acquisition. On LMI, there is one retry available during acquisition, and also one per individual measure within the sweep.
...
The focus value is ordinarily defined to be the position of a focusing element. On LMI, the definition is somewhat abstract: it is the offset in microns from the nominal focus selection of the AOS for M2 as mentioned above. This is typically between 750-900 microns. Note that there is no internal focusing element in the LMI instrument.
The focbase mentioned above, along with the size of the focus step, are arguments to inplacefocus, with reasonable defaults. The number of focus measures is usually 9, including the central value, but that can be redefined if necessary with the focstep argument as well.focus script can be performed in any filter; however, at present this filter must be selected with the filter wheel icon on the UI prior to running the script. The focus value obtained by the script will be used as-is whenever the observer is in that filter. If another filter is selected, the tabulated focus-filter offset for the UI will be applied to the existing focus value.
The focbase mentioned above, along with the size of the focus step, are arguments to inplacefocus, with reasonable defaults. The number of focus measures is usually 9, including the central value, but that can be redefined if necessary with the focstep argument as well.
The method for The method for taking images for measurement at each focus step is also selectable. You may take a single , or n multiple singles, or on some instruments, a subframe basic occultation with n frames (ie NAXIS3=n). In either case, if multiple frames or singles are used, the fwhm or other figure of merit for that step is an average of the analysis values obtained for the group. On LMI the basic occultation is not supported; such exposures can be taken, but are subject to image contamination due to lack of an optically masked transfer area.
...
- minimum fwhm
- maximum ratio of peak pxl to flux ("fom"figure of merit, or fom)
- minimum of parabolic fit to fwhm values, if within the focus sweep rage
- maximum of parabolic fit to fom values, if within the focus sweep range
...
The images taken with this routine are test.fits images. The "save" flags setting will make a special directory subdirectory for this focus run, in the main image data path for the rundate, to save named images for each focus step position. The name of the directory matches the hh:mm:ss timestamp used for the focus run in the focus log.
...
- Go to the home directory for obslemi in the console where you started LOIS.
- type ./abscript
- wait some seconds, and the LOIS log should indicate the script is aborting.
- The script will set the focus back to the value of focbase.
- now type ./abscript clear; if you fail to do this the focus and other scripts will abort immediately on startup.
TESTFOCUS LOG
TBW
A sample log entry:
Note: The entries for focus steps 950 and 1000 have saturated maximum pixel values (65535). This degrades the quality of the fwhm, and thus focus, measured.
...
PROCEDURE
The TCL code to run inplace_focus is loaded, after inplacefocus is sourced automatically during startup and initialization of LOIS.
It can be resourced by
- using the SrcLMITools user button.
It is no longer necessary to source the focus script in a separate command.
which is done during testing. Resourcing at any time should be harmless, but unnecessary for observers ordinarily.
You need It is also necessary to move to the desired filter with the LOUI UI filter wheel view first, since LOIS cannot move the LMI filter wheel , at the moment.at present. The filter argument for inplacefocus should likewise always be left blank.
You should preset the focus offset to 850 microns (or any known happy focus value from experience) using the stdfocus button or asking the telescope operator. You will also use this for focbase.
A star is acquired and A star is acquired and a full frame test single (binned 2:2 on LMI) taken with a 1 or 2 second exposure. The star is moved to should not be too far from the center as needed, and an exposure time suitable to provide good input to the focus sweep is estimated. This needs to be long enough to provide adequate counts at each end of the range. The focbase is selected as a focus setting not too distant from the actual correct value. The step size is usually already known as a function of the instrument. It is usually best to use the full 10 steps in the sweep as provided by default, and be significantly brighter than anything in its vicinity. You'd like to get 10-20K ADUs for the peak pixel with this exposure ideally. The focus script will do some autoadjust of the exposure time if needed, but you want to avoid getting an exposure time shorter than a second or very long. A short exposure will not average the seeing very well.
Since the script must pass through the focus minimum to obtain a useful result, it's important to use a large enough step to catch the minimum and also large enough to give a clean focus 'signal'. On nights of average seeing 40-50 micron steps are good for LMI (really TBD!). At present the script is happy to give a 'focus setting' based on bad, noisy data that you might get with
- A focbase that is some distance from the correct value.
- A focstep that is too small.
- Bad seeing.
A good choice for a star upon which to focus is one
...
enough to give a clean focus 'signal'. On nights of average seeing 40-50 micron steps are good for LMI. The steps might be increased if the seeing is bad. The two obvious ways that a script of this kind can give you a bad focus setting are
- Using a focstep size too small for the seeing conditions.
- Running the sweep very far out of focus- this should not occur on LMI.
You want to see something like a parabola with decently distinguishable minimum when plotting fwhm against focus, as with focnext (q.v.).
In principle, a focus setting once made will be maintained through the night by the AOS automatic update, irrespective of elevation angle. If this were strictly true, only one focus run would be needed per night, and the best place to do that would be at
...
an elevation of 60-70 degrees
...
Since the AOS corrects for zenith distance automatically, the focus obtained at the above position should hold good elsewherefrom the horizon, where the seeing is better. This is probably not true as yet, and the jury is out as to how often focus runs need to be done. This question interacts with the similar question of how often the AOS needs a WFS correction update.
ARGUMENTS LIST
inplace_focus x y title bin exptime filter focstep focbase flags
If the user button is used for this command, there should be neither quotes nor curly braces embedded in the fields for these arguments. The arguments are ordinarily single strings without embedded spaces, or empty strings (all spaces) in each button field. But, the exptime, focstep, title and flags fields can accept strings with multiple tokens, i.e., separate options separated by one or more spaces.
...
Exptime is a floating point value for exposure time in seconds, defaulted as 1.0. If specified as two tokens, the second value is the number of singles to be taken, defaulted is as 1. If specified as three tokens, the second value is the number of basic occultations to be taken, and the third value is the number of frames (NAXIS3) for each occultation. Occultations not currently available for LMI.
filter | name (like "R") of the filter setting to do the focus sweep. "Nominal" means use the filter as previously set. Leave this blank for LMI. |
---|---|
focstep | delta for focus setting per sweep position. (defaulted to 40 microns on LMI) |
If focstep specified as two tokens, the second value is the number of steps in the focus sweep, which defaults on LMI as 10.
Note: LOIS cannot set the filter currently on LMI, and the filter field should always be left blankon LMI as 9.
focbase | setting of focus for acquisition and sweep center. This has a reasonable default (850 microns on LMI). | |
---|---|---|
flags | strings, all optional, defined in any order, as follows: | |
| save | put images taken in focus sweeps in a subdirectory in the main image directory. |
| conditioning | focus run is a dry-run; the final focus setting is always focbase.. |
| noexptimeadjust | suppress autoadjust of exposure times for both acquisition and focus measures. |
The name of the save subdirectory includes the timestamp, which is also used in the focus log and represents the start of the focus sweep properThe name of the save subdirectory includes timestamp; the file names used include the focus setting.
Script runs to completion with conditioning irrespective of image contents; it can be run without any star.
...
each of which is a subframe image for the corresponding focus step.
Bugs
- The script can "may still occasionally throw TCL errors " and create ugly log messages for some situations, such as setting an invalid filter name (or any filter name on LMI except nominal or having a star coordinates mismatched in the x, y arguments.
- The script should generate clear and succinct error messages at the end of execution, or report success. Error messages should use log level 0 to appear in red in the LOUI log window.
- The smallest intensity of the maximum pixel in the star image that is acceptable is currently 3000 ADUs. (~2300 above bias). We might want to change this.
- (ugly multi-line error messages with UI popups). These should be reported with the time of occurrence.
- The script may still occasionally terminate without a clear indication that it has completed, or whether it succeeded or not.
- The script probably does not work for camera binning factors other than 2:2.
- It would be useful to put some temperatures data in the focus log.
- It would be extremely helpful if the LOIS analysis measured image ellipticity and this were logged and displayed during focus runs.
- The LMI version of focus can't adjust the filter (because LMI LOIS can'tIt would be useful to have a means of plotting the results of focus runs on demand. (There is an idl solution to this being worked).