Configuration Functions¶
Summary¶
Functions¶
create_my_idl_mode
pro create_my_idl_mode, ao=aoflag, cal=calflag, ifs=ifsflag
NAME:
create_my_idl_mode
PURPOSE:
Create a FITS file containing information about an operating mode
CALLING SEQUENCE:
create_my_idl_mode, /ao|/cal|/ifs
INPUT/OUTPUT:
/ao,/cal,/ifs - Select the mode
OPTIONAL OUTPUT:
None.
EXAMPLES:
DEPENDENCIES:
NOTES:
This routine is only used to create descriptive fits files with
mode specific information and need only be run once per
installation of gpilib.
REVISION HISTORY
Written by Lisa Poyneer at some point.
free_aoc
pro free_aoc, status=status
NAME:
free_aoc
PURPOSE:
Remove lock file created by lock_aoc
EXPLANATION:
See above.
CALLING SEQUENCE:
free_aoc
INPUT/OUTPUT:
None.
OPTIONAL OUTPUT:
status = 1 for success, 0 for failure
EXAMPLE:
DEPENDENCIES:
Requires access to AOC mount point
NOTES:
REVISION HISTORY
Written 2012-??-?? - ds
generate_central_obsc_slave_list_for_dave
pro generate_central_obsc_slave_list_for_dave, test=testflag
No header information available.
generate_deadneighbor_slave_list_for_dave
pro generate_deadneighbor_slave_list_for_dave, test=testflag
No header information available.
generate_ring_slave_list_for_dave
pro generate_ring_slave_list_for_dave, test=testflag
No header information available.
get_curr_refcents
pro get_curr_refcents, base=base, offset=offset, rephase=rephase, cal=cal, apod=apod
NAME:
get_curr_refcents
PURPOSE:
Unpackage hex code stored in common block variable
gpi_rtc_refcents into components and return array of which are
set.
CALLING SEQUENCE:
res = get_curr_refcents()
OUTPUT:
base - Boolean. True if base ref cents are set
offset - Boolean. True if ref offsets are set
rephase - Boolean. True if cal rephase offsets are set
cal - Boolean. True if cal offsets are set.
apod - Integer. Index for apodizer offsets. 0 for none.
OPTIONAL OUTPUT:
None.
EXAMPLES:
get_curr_refcents,base=base,offset=offset,rephase=rephase,cal=cal,apod=apod & print,base,offset,rephase,cal,apod
DEPENDENCIES:
NOTES:
REVISION HISTORY
Written 02.04.2013 - ds
gpierror_print
pro gpierror_print, data
NAME:
gpierror_print
PURPOSE:
Print input with standard formatting
CALLING SEQUENCE:
gpierror_print, data
INPUT/OUTPUT:
data - Value to be printed
OPTIONAL OUTPUT:
None.
EXAMPLES:
DEPENDENCIES:
NOTES:
Known bug: header is longer than the routine.
REVISION HISTORY
Written by Lisa Poyneer at some point.
gpimessage_print
pro gpimessage_print, data
NAME:
gpimessage_print
PURPOSE:
Print input with standard formatting
CALLING SEQUENCE:
gpimessage_print, data
INPUT/OUTPUT:
data - Value to be printed
OPTIONAL OUTPUT:
None.
EXAMPLES:
DEPENDENCIES:
NOTES:
Known bug: header is longer than the routine.
REVISION HISTORY
Written by Lisa Poyneer at some point.
gpitv_obsnotes
pro gpitv_obsnotes, fname, mark, msg, errout=errout, curlpath=curlpath
NAME: gpitv_obsnotes
Write to observation notes database table
INPUTS:
fname - Full path on local disk to image file
mark - Binary (0|1) indicating good|bad
msg - Text string note (optional)
KEYWORDS:
curlpath - Full path to curl executable (optional)
errout - Returns 1 on error, otherwise 0
OUTPUTS:
None
HISTORY:
Written at some point
12/4/2015 - Changing over to html POST method - ds
load_actuator_types
pro load_actuator_types, dead, sick, calout, halfresp, lowresp, zeroout, maskout
No header information available.
load_best_tt
function load_best_tt, white=whiteflag
NAME:
load_best_tt
PURPOSE:
Load current TT flattening commands
EXPLANATION:
See above.
CALLING SEQUENCE:
res = load_best_tt()
INPUT/OUTPUT:
res - 2x1 array of tilt,tip (mas)
OPTIONAL OUTPUT:
None.
EXAMPLE:
DEPENDENCIES:
None.
NOTES:
The whiteflag has been deprecated.
REVISION HISTORY
Written at some point by LAP.
2-10-2011 changed this to conform to other mirrors and save in mas, not volts!
load_default_apod
function load_default_apod, apod
NAME:
load_default_apod
PURPOSE:
Load default apodizer (used by tlc_move_apod)
EXPLANATION:
See above.
CALLING SEQUENCE:
res = load_default_apod(apod)
INPUT/OUTPUT:
apod - Name of apodizer mask (run with no arguments to get
list). Can omit leading 'APOD_',but trailing end of
name must be exact match (i.e., 'H' works, but 'K'
doesn't)
Set to "" to override (rot & xoff must be set)
res - [x-offset (in mm),Rotation (in degrees)]
OPTIONAL OUTPUT:
None.
EXAMPLE:
DEPENDENCIES:
validate_apod_name.pro
NOTES:
REVISION HISTORY
Written Februrary 1, 2013 - savransky1@llnl.gov
load_default_cal_pnc_pc
function load_default_cal_pnc_pc, lyot=lyot
NAME:
load_default_cal_pnc_pc
PURPOSE:
Load default pnc_pc values (used by tlc_command_cal_pnc_pc)
EXPLANATION:
See above.
CALLING SEQUENCE:
res = load_default_cal_pnc_pc([lyot='...'])
INPUT/OUTPUT:
res - 5 element float array of x point, y point, x cent, y
cent, focus
lyot - lyot name to read lyot specific file
OPTIONAL OUTPUT:
None.
EXAMPLE:
DEPENDENCIES:
validate_lyot_name.pro
NOTES:
REVISION HISTORY
Written June 17, 2012 - savransky1@llnl.gov
load_default_inputfold
function load_default_inputfold
NAME:
load_default_inputfold
PURPOSE:
Load default inputfold values (used by tlc_command_inputfold)
EXPLANATION:
See above.
CALLING SEQUENCE:
res = load_default_pnc_pc()
INPUT/OUTPUT:
res - 2 element array of cent x, y in mm
OPTIONAL OUTPUT:
None.
EXAMPLE:
DEPENDENCIES:
None.
NOTES:
REVISION HISTORY
Originally written by Lisa Poyneer
07.19.12 - Minor rewrite for greater flexibility - ds
load_default_pnc_pc
function load_default_pnc_pc
NAME:
load_default_pnc_pc
PURPOSE:
Load default pnc_pc values (used by tlc_command_pnc_pc)
EXPLANATION:
See above.
CALLING SEQUENCE:
res = load_default_pnc_pc()
INPUT/OUTPUT:
res - 5 element float array of x point, y point, x cent, y
cent, focus
OPTIONAL OUTPUT:
None.
EXAMPLE:
DEPENDENCIES:
None.
NOTES:
REVISION HISTORY
Originally written by Lisa Poyneer
07.13.12 - Minor rewrite for greater flexibility - ds
load_default_sfpos
function load_default_sfpos
NAME:
load_default_sfpos
PURPOSE:
Load default SF position values (used by tlc_command_sf)
EXPLANATION:
See above.
CALLING SEQUENCE:
res = load_default_sfpos()
INPUT/OUTPUT:
res - 2 element float array of x, y positions (mm)
OPTIONAL OUTPUT:
None.
EXAMPLE:
DEPENDENCIES:
None.
NOTES:
REVISION HISTORY
Originally written by Lisa Poyneer
load_subapmask
function load_subapmask
NAME:
load_subapmask
PURPOSE:
Load in the subapmask properly from the right config file
(since it is not specified in parms.txt)
CALLING SEQUENCE:
res = load_subapmask()
INPUT/OUTPUT:
res: the 0-1 mask of valid subapertures, usually stored in gpi_subapmask
OPTIONAL OUTPUT:
None.
EXAMPLES:
DEPENDENCIES:
NOTES:
Only used in config/start_us_up.pro
REVISION HISTORY
Written by Lisa Poyneer at some point.
load_wfs_indices
pro load_wfs_indices, x=xind, y=yind
NAME:
load_wfs_indices
PURPOSE:
Load in the subapmask properly from the right config file
(since it is not specified in parms.txt)
CALLING SEQUENCE:
res = load_wfs_indices()
INPUT/OUTPUT:
res: x-y indices (first and second frames of a 48x48x2 signal)
as to pixels to grab in the WFS image to get correct subaps.
OPTIONAL OUTPUT:
None.
EXAMPLES:
DEPENDENCIES:
NOTES:
Only used in config/start_us_up.pro
REVISION HISTORY
Written by Lisa Poyneer at some point.
lock_aoc
pro lock_aoc, status=status
NAME:
lock_aoc
PURPOSE:
Generate lock file to avoid user collision.
EXPLANATION:
See above.
CALLING SEQUENCE:
lock_aoc
INPUT/OUTPUT:
None.
OPTIONAL OUTPUT:
status = 1 for success, 0 for failure, -1 if failed because
lock file already exists.
EXAMPLE:
DEPENDENCIES:
Requires access to AOC mount point
NOTES:
REVISION HISTORY
Written 2012-??-?? - ds
log_cal_bias
pro log_cal_bias
NAME:
log_cal_bias
PURPOSE:
Save current CAL TT bias values (to be used after an alignFPM)
EXPLANATION:
See above.
CALLING SEQUENCE:
log_cal_bias
INPUT/OUTPUT:
None.
OPTIONAL OUTPUT:
None.
EXAMPLE:
DEPENDENCIES:
None.
NOTES:
The log will contain 3 values: CAL Bias Tilt, Tip, and the OMSS
AO Bench temperature.
REVISION HISTORY
Written 05/29/13 - ds
make_dummy_config_files
pro make_dummy_config_files
No header information available.
read_modify_rewrite_parms
pro read_modify_rewrite_parms, fname, key, value
No header information available.
read_parms
pro read_parms, fname
NAME:
read_parms
PURPOSE:
Read AOC parameters file and load keys & values into common
block.
CALLING SEQUENCE:
read_parms,[fname]
INPUT/OUTPUT:
fname - Optional full path to params file (defaults to
parms.txt in AOC config path).
OPTIONAL OUTPUT:
None.
EXAMPLES:
DEPENDENCIES:
AOC disk must be cross-mounted for access to default parms file.
NOTES:
This routine must be issued any time parms are modified to keep
key/value pairs up to date in common block.
REVISION HISTORY
Written by Lisa Poyneer at some point.
retrieve_value
function retrieve_value, deskey, override=oflag
NAME:
retrieve_value
PURPOSE:
Read value/file pointed to by specified key in the AOC
parameters file and reformat as necessary.
CALLING SEQUENCE:
res = retrieve_value(deskey,[/override])
INPUT/OUTPUT:
deskey - Scalar string, name of desired key.
/override - If set, returns raw value as read from AOC parms
file (i.e., if value is filename, returns the
filename rather than reading in the file)
res - If key points to a value, returns value, if key points to
filename, returns contents of file, formatted in most
convenient way (depending on what the file is). If /over
is set, returns filename only.
OPTIONAL OUTPUT:
None.
EXAMPLES:
DEPENDENCIES:
AOC disk must be cross-mounted for access to default parms
file.
read_parms
NOTES:
REVISION HISTORY
Written by Lisa Poyneer at some point.
save_best_tt
pro save_best_tt, phase00, flat=flatflag, white=whiteflag
NAME:
save_best_tt
PURPOSE:
Save current TT zeroing commands in FITS format
EXPLANATION:
See above.
CALLING SEQUENCE:
save_best_tt,in,[/flat]
INPUT/OUTPUT:
in - 2 element array of tip,tilt commands (mas)
/flat - Offset from values already present on disk.
OPTIONAL OUTPUT:
None.
EXAMPLE:
DEPENDENCIES:
load_best_tt
NOTES:
/whiteflag has been deprecated.
REVISION HISTORY
Written at some point by LAP
2-10-2011 changed this to conform to other mirrors and save in
mas, not volts!
save_default_apod
pro save_default_apod, apod, des_ppm, default=dflag
NAME:
save_default_apod
PURPOSE:
Save default PPM filter wheel values (used by tlc_move_apod) in
FITS format.
EXPLANATION:
See above.
CALLING SEQUENCE:
save_default_apod,apod,des_pp,[/default]
INPUT/OUTPUT:
apod - Name of apodizer mask (run with no arguments to get
list). Can omit leading 'APOD_',but trailing end of
name must be exact match (i.e., 'H' works, but 'K'
doesn't)
Set to "" to override (rot & xoff must be set)
des_ppm - [x-offset (in mm),Rotation (in degrees)]
/default - Offset from default values already present on disk.
OPTIONAL OUTPUT:
None.
EXAMPLE:
DEPENDENCIES:
load_default_apod.pro
validate_apod_name.pro
NOTES:
REVISION HISTORY
Written February 1, 2013 - savransky1@llnl.gov
save_default_cal_pnc_pc
pro save_default_cal_pnc_pc, des_pos0, default=dflag, lyot=lyot
NAME:
save_default_cal_pnc_pc
PURPOSE:
Save default pnc_pc values (used by tlc_command_cal_pnc_pc) in
FITS format.
EXPLANATION:
See above.
CALLING SEQUENCE:
save_default_cal_pnc_pc,[des_pos,/default]
INPUT/OUTPUT:
des_pos - Desired setting. If 5 elements, then [point x,
point y, center x, center y, focus]. Alternatively,
can be 4 elements (omit focus defaults to zero).
lyot - if set, write to a lyot-specific save file as well as
the current default file.
/default - Offset from default values.
OPTIONAL OUTPUT:
None.
EXAMPLE:
DEPENDENCIES:
load_default_cal_pnc_pc.pro
validate_lyot_name.pro
NOTES:
REVISION HISTORY
Written June 17, 2012 - savransky1@llnl.gov
save_default_inputfold
pro save_default_inputfold, des_pos, default=dflag, current=curflag
NAME:
save_default_inputfold
PURPOSE:
Save default inputfold values (used by tlc_command_inputfold) in
FITS format.
EXPLANATION:
See above.
CALLING SEQUENCE:
save_default_inputfold,des_pos,[/current,/default]
INPUT/OUTPUT:
des_pos - Desired setting. cent x, cent y in mm.
/current - Use values read from tlc
/default - Offset from default values.
OPTIONAL OUTPUT:
None.
EXAMPLE:
DEPENDENCIES:
load_default_inputfold.pro
NOTES:
REVISION HISTORY
Originally written by Lisa Poyneer
07.19.12 - Minor rewrite for greater flexibility - ds
save_default_pnc_pc
pro save_default_pnc_pc, des_pos0, default=dflag
NAME:
save_default_pnc_pc
PURPOSE:
Save default pnc_pc values (used by tlc_command_pnc_pc) in
FITS format.
EXPLANATION:
See above.
CALLING SEQUENCE:
save_default_pnc_pc,[des_pos,/default]
INPUT/OUTPUT:
des_pos - Desired setting. If 5 elements, then [point x,
point y, center x, center y, focus]. Alternatively,
can be 4 elements (omit focus defaults to zero).
/default - Offset from default values.
OPTIONAL OUTPUT:
None.
EXAMPLE:
DEPENDENCIES:
load_default_pnc_pc.pro
NOTES:
REVISION HISTORY
Originally written by Lisa Poyneer
07.13.12 - Minor rewrite for greater flexibility - ds
save_default_sfpos
pro save_default_sfpos, des_pos, default=dflag, current=curflag
NAME:
save_default_sfpos
PURPOSE:
Save default SF position values (used by tlc_command_sf)
EXPLANATION:
See above.
CALLING SEQUENCE:
save_default_sfpos,des_pos,[/default,/current]
INPUT/OUTPUT:
des_pos - [x,y] (in mm)
/default - Offset from default values already present on disk.
/current - get current position from TLC
OPTIONAL OUTPUT:
None.
EXAMPLE:
DEPENDENCIES:
update_log
NOTES:
REVISION HISTORY
Written by LAP
2012-??-?? updated current position code - ds
set_my_idl_mode
pro set_my_idl_mode, ao=aoflag, cal=calflag, ifs=ifsflag, observer=observer, quiet=quiet
NAME:
set_my_idl_mode
PURPOSE:
Select system mode (which files are used for storing/loading
defaults).
CALLING SEQUENCE:
set_my_idl_mode,/ao|/cal|/ifs, [observer=observer]
INPUT/OUTPUT:
/ao,/cal,/ifs - Select one of these modes
observer - Observer name for mode /ifs. If unset, and mode is
/ifs user will be queried for observer name.
OPTIONAL OUTPUT:
None
EXAMPLE:
set_my_idl_mode,/ifs,observer = 'OBSERVERNAME'
DEPENDENCIES:
Assumes writeable defs directory identified in common block
var gpi_idl_private_datapath
COMMON BLOCKS:
gpi_globals
NOTES:
REVISION HISTORY
Original implementation by Lisa Poyneer god knows when
2013-03-07 gpi_mode_White deprecated by LAP
03.10.13 - ds - Added setting IFS sticky vars
05.02.13 - ds - Added observer passthru capability.
setup_globals
pro setup_globals, quiet=quiet
NAME:
setup_globals
PURPOSE:
Define and partially populate gpi_globals common block
required for gpilib to work properly.
EXPLANATION:
See above.
CALLING SEQUENCE:
setup_globals
INPUT/OUTPUT:
/quiet - Don't print any messages
OPTIONAL OUTPUT:
None.
EXAMPLE:
DEPENDENCIES:
None.
NOTES:
This program should not be run manually, but should be included
in the idl startup routine so that it runs whenever IDL is started.
REVISION HISTORY
Written by LAP
2013-06 - moved some of the block population from start_us_up
and general cleanup - ds & LAP.
2014-04-18 Added quiet flag - ds
shut_us_down
pro shut_us_down, sc_off=sc_off, noifs=noifs
NAME:
shut_us_down
PURPOSE:
Puts GPI into a sane shutdown state.
EXPLANATION:
See above.
CALLING SEQUENCE:
shut_us_down,[/sc_on,/noifs]
INPUT/OUTPUT:
/sc_off - Power off SC source at powerbar (and set ASU to sim)
/noifs - Do not move any IFS components.
OPTIONAL OUTPUT:
None.
EXAMPLE:
DEPENDENCIES:
None.
NOTES:
Opens all loops, zeros all mirrors, removes nulling offsets,
zeros CAL biases, powers off AO control surfaces, powers off
the SC source, extracts the ASU, puts the source assembly into
SIM and closes all shutters.
REVISION HISTORY
Written by ds
start_us_up
pro start_us_up, noaoc=nflag, nosocket=nosocket, grabsocket=grabsocket, verbose=verbose, mode_ifs=modeifsflag, mode_cal=modecalflag, mode_ao=modeaoflag, datum_all=datum_all, telSim=telSim, ttlqg=ttlqg, foclqg=foclqg, autolqg=autolqg, observer=observer, errout=errout
NAME:
start_us_up
PURPOSE:
Initialize AO system.
EXPLANATION:
Sets up communication with AOC and runs through
initialization/alignment tasks
CALLING SEQUENCE:
start_us_up,[/mode_ifs|/mode_cal|/mode_ao],[options]
INPUT/OUTPUT:
/mode_ao,/mode_cal,/mode_ifs - Select which operating mode to
use. Defaults to IFS.
/noaoc - Set up all globals but do not connect to
socket/execute any commands
/datum_all - Send datum commands to a variety of components.
/telSim - using the telsim (doesn't deploy the ASU after
datuming)
ttlqg - TT controller case to use (-1 for integral)
autolqg - Set have AOC select the best LQG
automatically. (overrides ttlqg and foclqg)
observer - Observer name (optional)
/nosocket - Use RPC calls rather than direct socket interface
(default)
/grabsocket - Use direct socket communication (do not use
unless strictly necessary)
/verbose - toggle maximum verbosity
OPTIONAL OUTPUT:
errout - 1 on return if error occured. Otherwise 0
EXAMPLE:
start_us_up,/mode_ifs
DEPENDENCIES:
Assumes access to aoc, either through socket or via RPC calls
which assume access to executables in $TLC_ROOT. Requires
active crossmount with aoc to read/write data ($AOC_ROOT ->
aoc:/exports/home/gpi)
COMMON BLOCKS:
gpi_globals
NOTES:
REVISION HISTORY
Original implementation by Lisa Poyneer god knows when
Tons of changes - see code for details/notes
Dec 2, 2011 - LAP - Added active state structure
March 19,2012 - LAP - Added operating modes
5.24.12 - ds -Deprecated gpi_bindir, and kewyords /basic,
/nofarfield, /setup_only, /stop
7.17.12 - ds - Added datum_all,telSim keywords
12.3.12 - ds - Changing default to /nosocket
03.07.13 - LAP - moved global var definition to
setup_globals.pro
04.19.13 - ds - changed default to /mode_ifs
04.22.13 - ds - Added errout, added check for WFS init. Some
more cleanup. Deprecated fancy flag
05.02.13 - ds - Added observer passthru capability. Added lqg
case toggle.
07-08.15 - bmac & ds - changing ttlqg defulats to always use
integral-like lqg
store_value
pro store_value, deskey, data0, changename=changenameflag, filename=filename, value=value
NAME:
store_value
PURPOSE:
Update AOC parameters. Either update the parms.txt file, or
the file pointed to by a specific entry.
CALLING SEQUENCE:
store_value,deskey,data, [changename=changename,/filename|/value]
INPUT/OUTPUT:
deskey - Key to update
data - New filename, value, or data array to apply to key.
/changename - Update the filename pointed to by this key's
entry in parms.txt
/filename - Data is a filename
/value - Data is a value (or data array).
OPTIONAL OUTPUT:
None
EXAMPLES:
DEPENDENCIES:
NOTES:
/filename and /value are mutually exclusive. If neither is
set, the convention is that if the input is a string with a '/'
in it, it's a filename, otherwise its a value.
REVISION HISTORY
Written 06/05/2012 LAP
02/04/2013 - Minor updates - ds
switch_subapmask
pro switch_subapmask, nocent=ncflag, shrink=shrinkflag, blockbads=bbflag, flip=flipflag, telsim=tsflag, nointrusions=niflag, neighbors_masked_at_subaplevel=nmflag, enlarge_centobs=ecflag
No header information available.
switch_subapmask_nosave
pro switch_subapmask_nosave, nocent=ncflag, shrink=shrinkflag, blockbads=bbflag, flip=flipflag, telsim=tsflag, nointrusions=niflag, maskout=maskout
No header information available.
toggle_aoc_verb
pro toggle_aoc_verb, on=on, off=off
NAME:
toggle_aoc_verb
PURPOSE:
Toggle aoc command verbosity on/off .
CALLING SEQUENCE:
toggle_aoc_verb,[/on,/off]
INPUT/OUTPUT:
/on - switch on
/off - switch off
If neither are set, reverses current setting
OPTIONAL OUTPUT:
None.
EXAMPLE:
toggle_aoc_verb,/on
DEPENDENCIES:
Assume aocIF common block has been set
NOTES:
REVISION HISTORY
Written 10/26/2011. savransky1@llnl.gov
verify_parms_value
pro verify_parms_value, key, limit, max=maxflag, min=minflag, equal=eflag
NAME:
verify_parms_value
PURPOSE:
check the value stored in parms for a keyword. An IDL
procedure, though you could always just open parms.txt and look
at it.
CALLING SEQUENCE:
verify_parms_value, key, limit, max=maxflag, min=minflag, equal=eflag
INPUT/OUTPUT:
key: the KEY in parms
limit: the value that you want to check
/min: KEY must have at least the value given by limit
/max: KEY must have at most the value given by limit
/equal: KEY must equal the value given by limit
OPTIONAL OUTPUT:
None.
EXAMPLES:
DEPENDENCIES:
NOTES:
REVISION HISTORY
Written by Lisa Poyneer at some point.
write_parms
pro write_parms, fname, toscreen=toflag
NAME:
write_parms
PURPOSE:
Write out key/value pairs from common block to AOC parameters
file.
CALLING SEQUENCE:
write_parms,[fname,/toscreen]
INPUT/OUTPUT:
fname - Optional full path to params file (defaults to
parms.txt in AOC config path).
/toscreen - Display output
OPTIONAL OUTPUT:
None.
EXAMPLES:
DEPENDENCIES:
AOC disk must be cross-mounted for access to default parms file.
NOTES:
This routine must be issued any time parms are modified in
memory to keep key/value pairs up to date in the parms file (and
actually tell the AOC about the change).
REVISION HISTORY
Written by Lisa Poyneer at some point.