# Reference Centroids¶

The AOC has a very flexible framework for setting, combining and applying WFS reference centroids. These include:

Name Description
Base Base references - should always be applied
Offset General offset references, used in nulling phase probes and to apply test shapes to the DM in closed loop
CAL Re-phase Currently unused
CAL offsets Offset supplied by the CAL
Apodizer Apodizer specific offsets - typically derived from nulling

Except for the CAL offsets, which are supplied directly to the AOC by the CAL, these are written to FITS files in the AOC config directory (with filenames specified in parms.txt). See AOC Calibration files and parameter values for more details.

## Managing References¶

References are manged in gpilib via the function rtc_command_select_references. This function accepts five flags corresponding to the five classes of references listed above, which toggle the combination of references used. New references are supplied to the AOC via offset_wfscen_phase and rtc_send_apo_refcent. The former writes new values to either the offset or CAL offsets, whereas the latter write to the apodizer specific references.

The current set of references being applied is stored in common block variable gpi_rtc_refcents (see Common Blocks for more details). This variable holds a decimal representation of the hex string encoding the combination of references begin applied, as described in the AOC ICD. A helper function, get_curr_refcents, is used to parse this variable and return the state of each individual reference type.

To check which references are loaded run:

IDL> get_curr_refcents,base=base,offset=offset,rephase=rephase,cal=cal,apod=apod
IDL> print,base,offset,rephase,cal,apod
1   0  0  0   0


The first four values are boolean while the last is the apodizer offset index (0 for none). The output in the example above means only the base references are being applied. This procedure is also wrapped by ult_check_ref_mode.

Warning

gpi_rtc_refcents is only updated by rtc_command_select_references. Manual setting of references will cause confusion.

## Apodizers¶

The AOC supports separate reference offsets for up to 8 apodizers. The indexing of these has been selected such that APOD_Y through APOD_K2 are numbered 1 through 5, with the last three slots to be determined as needed. The indexing of the masks is defined in function validate_apod_name and can be changed by reordering the masks array defined in the code.

## Updating Base References¶

You will want to update your base (measured) reference centroids on a regular basis to compensate for changes in the system. This is done by setting up a pinhole with the spatial filter, flood illuminating the AO WFS, issuing the AOC measure references command, and then selecting the measured reference centroids:

IDL> ult_task_make_pinhole
IDL> ult_measure_refs
IDL> rtc_command_select_references,/measure


Note

Don’t forget to turn up the attenuation and open up the spatial filter before attempting to re-close the loops.

## Restoring Old Base References¶

Occasionally you will want to restore older measured references. All references taken via ult_measure_refs are automatically archived in \$AOC_ROOT/config/ (/mnt/aoc/gpi_root/aoc/config on 17-33) in dated directories - i.e., 130522/refcentQ_000.fits. In order to make the AOC use an old reference you must update the parms.txt file REF_BASE entry with the reference filename (relative to the config directory and without the extension), then issue a readconfig and finally select the measured reference centroid:

IDL> store_value,'REF_BASE','130522/refcentQ_000',/changename