AOC Functions

Summary

Function  
aoc2rpc  
aoc_Socket_Functions (aoc_socket_functions.pro)  
aocsocket_help (aoc_socket_functions.pro)  
aocSocket_example (aoc_socket_functions.pro)  
aocSocket_open (aoc_socket_functions.pro)  
aocSocket_write (aoc_socket_functions.pro)  
aocSocket_readLine (aoc_socket_functions.pro)  
aocSocket_waitCommand (aoc_socket_functions.pro)  
aocSocket_close (aoc_socket_functions.pro)  
aocrpc_passthru  
bfcd  
biasall  
clear_aoc_flags  
closeall  
flatall  
get_current_tt  
new_extract_clipclean_types_from_telemetry  
new_extract_status_types_from_telemetry  
new_extract_tt_types_from_telemetry  
offset_wfscen_phase  
openall  
read_and_convert_timestamps  
rtc_command_close_loops  
rtc_command_close_ofc  
rtc_command_dumpdata  
rtc_command_open_loops  
rtc_command_open_ofc  
rtc_command_readconfig  
rtc_command_select_dark  
rtc_command_select_flat  
rtc_command_select_influence_function_gains  
rtc_command_select_references  
rtc_command_set_cam_rate  
rtc_command_set_cent_gains  
rtc_command_set_cent_thresh  
rtc_command_set_gain_filter  
rtc_command_set_tt  
rtc_command_Set_tt_gains  
rtc_command_Set_tt_offsets  
rtc_command_set_tweeter  
rtc_command_set_woofer  
rtc_do_centroids_ourselves  
rtc_do_ftr_ourselves  
rtc_do_ftr_ourselves  
rtc_do_inflprecomp_ourselves  
rtc_do_phase_from_volts_ourselves  
rtc_do_recombine_ourselves  
rtc_do_refs_from_phase  
new_shift2d_nowrap (rtc_do_refs_from_phase_new.pro)  
rtc_do_refs_from_phase_new (rtc_do_refs_from_phase_new.pro)  
rtc_do_slaving_ourselves  
rtc_do_split_ourselves  
rtc_do_ttrotfoc_projections  
rtc_issue_command  
rrd_message1 (rtc_retrieve_dumpdata.pro)  
rtc_retrieve_dumpdata (rtc_retrieve_dumpdata.pro)  
rtc_retrieve_dumpdata_longinterval_earlier_smart  
rtc_retrieve_dumpdata_longinterval_later  
rtc_retrieve_ofcdata  
rtc_send_apo_refcent  
rtc_standard_settings  
rtcerror_print  
zeroall  

Functions

aoc2rpc

function aoc2rpc, comm, stateAckOut, waitOut, host=host

 NAME:
       aoc2rpc
 PURPOSE:
       Convert calls from AOC socket syntax to RPC syntax
 EXPLANATION:
       Structured translation of commonly used AOC socket calls to
       equivalent inputs to gpAocRpcClientTester as outlined in
       aocCmdsToRpcCmds.dox

 CALLING SEQUENCE:
       out = aoc2rpc(comm,[host='...'])

 INPUT/OUTPUT:
       comm - String containing AOC call normally passed to
              rtc_issue_command
 OPTIONAL OUTPUT:
        out - String containing equivalent rpc call, ready for spawning

 EXAMPLE:
       out = aoc2rpc('cycleActuator 5060');

 DEPENDENCIES:
        No direct dependencies, but the produced commands assume
        access to executables in $TLC_ROOT  and
        accessible connection to server.

 NOTES:
      Library of known calls is stored in structure dat with the
      following fields:
      comm = AOC socket command
      args = # of AOC command arguments
      cmd = RPC command #
      rpcArgs = Format String for RPC call.  Assumes inputs are arrays of
                strings. If AOC call has zero arguments, this is just a
                string.
      argord = space spearated string if order of input arguments to
               rpc call is different from aoc call.  otherwise,
               blank.

      NB: The client testers will NOT parse hex or scientific
      notation.  The hex is taken care of in the code.  Anything that
      takes floating point data (rather than integers): be sure to
      write the format string with 'F's, rather than 'A's so that the
      values are automatically written as regular floats.

 REVISION HISTORY
       Alpha 12/13/2011. savransky1@llnl.gov
       2.29.12  Added dumpdata - ds
       3.5.12  Added setTTOff and readConfig - ds
       4.10.12  Deprecated bindir - ds
       5.23.12 Added wait times output - ds
       11.16.12 Finished adding command.  Added argord to defintion.
       01.24.12 Changed format string for setTT to explicitly cast
       floats.
;      11.03.2014 - LAP added support for CentThres with three args,
;                   not 1.

aoc_Socket_Functions (aoc_socket_functions.pro)

pro aoc_Socket_Functions

aocsocket_help (aoc_socket_functions.pro)

pro aocsocket_help

aocSocket_example (aoc_socket_functions.pro)

pro aocSocket_example

aocSocket_open (aoc_socket_functions.pro)

function aocSocket_open, host, stop=stopflag, verbose=verbose

aocSocket_write (aoc_socket_functions.pro)

pro aocSocket_write, cmdStr

aocSocket_readLine (aoc_socket_functions.pro)

function aocSocket_readLine, dataStr

aocSocket_waitCommand (aoc_socket_functions.pro)

function aocSocket_waitCommand, dataStr

aocSocket_close (aoc_socket_functions.pro)

pro aocSocket_close

NAME:
      aoc_socket_functions
PURPOSE:
      Direct communication with the aoc RTC socket

CALLING SEQUENCE:
      Calling aoc_socket_functions with no arguments prints out
      detailed information on all subfunctions

INPUT/OUTPUT:
      None.

OPTIONAL OUTPUT:
      None.

EXAMPLE:

DEPENDENCIES:
       None.

NOTES:
      Mostly deprecated.  RPC communications are default.

REVISION HISTORY
      Written at some point in the mists of time.
      modified by ds to be less verbose
      modified by bmac 11-29-2011 to print the wfs electronics temps

aocrpc_passthru

pro aocrpc_passthru, comm, host=host, verb=verb, debug=debug

NAME:
      aocrpc_passthru
PURPOSE:
      Pass calls to the aoc directly to the rpc using the PERFORM command
EXPLANATION:
      Rather than translating commands as in aoc2rpc.pro, send the
      command strings unchanged.

CALLING SEQUENCE:
      aocrpc_passthru,comm

INPUT/OUTPUT:
      comm - String containing AOC call normally passed to
             rtc_issue_command
OPTIONAL OUTPUT:


EXAMPLE:
      aocrpc_passthru,'cycleActuator 5060'

DEPENDENCIES:
       tlc_move_helper

NOTES:
      call is: PERFORM,activityID,cmdString
      PERFORM = 11

REVISION HISTORY
      Written 10.15.2012 - ds

bfcd

pro bfcd, phase=phase

No header information available.

biasall

pro biasall

NAME:
     biasall

PURPOSE:
     Send bias command to AO tip/tilt, woofer and tweeter.

CALLING SEQUENCE:
     biasall

INPUT/OUTPUT:
     None.

OPTIONAL OUTPUT:
     None.

EXAMPLES:
     biasall

DEPENDENCIES:
     rtc_command_set_tt
     trc_command_set_tweeter
     rtc_command_set_woofer

NOTES:
     Command are applied sequentially (tt then woofer then tweeter).

REVISION HISTORY

clear_aoc_flags

pro clear_aoc_flags

NAME:
     clear_aoc_flags

PURPOSE:
     Send a globalInit command to clear AOC flags.

CALLING SEQUENCE:
     clear_aoc_flags

INPUT/OUTPUT:
     None

OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:
     rtc_issue_command

NOTES:
     Prior to closing any loop (if running via the RPC) a globalInit
     1 must be issued to clear any AOC flags.  If the flags
     represent an ongoing condition, they will be re-set and the
     loops will fail to close.

REVISION HISTORY
     Written 12.12.2012 - ds

closeall

pro closeall, errout=errout, cal=calflag, correct=correct, rot=rotflag, foc=focflag

NAME:
     closeall

PURPOSE:
     Close the AO tip/tilt, woofer and tweeter loops, and
     (optinally) the CAL loop.

CALLING SEQUENCE:
     closeall[,/cal,errout=errout]

INPUT/OUTPUT:
     /cal - Close CAL loop
     /correct - Turn on CAL corrections to AO PnCs in track assembly
     /rot - Close rotation loop
     /foc - Close focus loop

OPTIONAL OUTPUT:
     errout - 1 if loops did not close, otherwise 0.

EXAMPLES:
     closeall,errout = looperr,/cal

DEPENDENCIES:
     rtc_command_close_loops
     tlc_cal_openclose

NOTES:

REVISION HISTORY
     Written by Lisa Poyneer at some point.
     01.24.2013 - Added correct keyword - ds

flatall

pro flatall, white=whiteflag

NAME:
     flatall

PURPOSE:
     Flatten the AO tip/tilt, woofer and tweeter.

CALLING SEQUENCE:
     flatall

INPUT/OUTPUT:
     None.

OPTIONAL OUTPUT:
     None

EXAMPLES:

DEPENDENCIES:
     rtc_command_set_tt
     rtc_command_set_woofer
     rtc_command_set_tweeter

NOTES:

REVISION HISTORY
     Written by Lisa Poyneer at some point.

get_current_tt

function get_current_tt, duration=duration, verbose=verbose, full=full

NAME:
      get_current_tt

PURPOSE:
      Function to return the current measured tip/tilt from aowfs

EXPLANATION:
      Wrapper for dumpdata and extract_tt_types.

Calling SEQUENCE:
      res = get_current_tt([duration=duration, /verbose, /full])

INPUT/OUTPUT:
      duration - duration to dump (seconds)
      /verbose - Print out tt information
      /full - dump full buffer (otherwise averages all frames)

OPTIONAL OUTPUT:
      None.

EXAMPLE:


DEPENDENCIES:
     rtc_retrieve_dumpdata
     new_extract_tt_types_from_telemetry


NOTES:

REVISION HISTORY
    written in 2012 by bmac.
    05.06.13 - ds - Folded into gpilib

new_extract_clipclean_types_from_telemetry

pro new_extract_clipclean_types_from_telemetry, clipclean, clip_twt=c0flag, clip_wfr=c1flag, clip_tt=c2flag, clip_ttonwfr=c3flag, clean_twt_piston=ct0flag, clean_twt_mode=ct1flag, clean_twt_amount=ct2flag, clean_wfr_piston=cw0flag, clean_wfr_mode=cw1flag, clean_wfr_amount=cw2flag

 NAME:
       new_extract_clipclean_types_from_telemetry

 PURPOSE:
       Final wrapper to get out specific types of telemetry from the
       big composite ttdata dump
     clipclean         0x4000000 = clipping and cleanup data
       Can only get certain ones.
      All extractions via keyword. No need to assign variables first.

 EXPLANATION:
       see above.

 Calling SEQUENCE:
             new_extract_clipclean_types_from_telemetry, clipclean, $
                                                clip_twt = c0flag, $
                                                clip_wfr = c1flag, $
                                                clip_tt = c2flag, $
                                                clip_ttonwfr = c3flag, $
                                                clean_twt_piston = ct0flag, $
                                                clean_twt_mode = ct1flag, $
                                                clean_twt_amount = ct2flag, $
                                                clean_wfr_piston = cw0flag, $
                                                clean_wfr_mode = cw1flag, $
                                                clean_wfr_amount = cw2flag


 INPUT/OUTPUT:
      input is a ttdata telemtry dump, obtained from 0x4000000 = clipping and cleanup data
      values, which is clipclean in retrieve_dumpdata.
      For each keyword that was a variable
      (e.g. clip_twt = c0flag,), the appropriate telemetry will
      be stored there.

 OPTIONAL OUTPUT:
       None.

 EXAMPLE:


 DEPENDENCIES:



 NOTES:

;; now check the cleanup
;; what's in those buffers?
;;; 0 : twt clip count
;;; 1 : wfr clip count
;;; 2 : tt clip count
;;; 3 : tt_wfr clip count (if woofer clips when it tries to apply TT)
;;; 4 : twt piston
;;; 5 : twt cleanup mode #
;;; 6 : twt cleanup value (coeff)
;;; 7 : wfr piston
;;; 8 : wfr cleanup mode #
;;; 9 : wfr cleanup value (coeff)


 REVISION HISTORY
     written in 2012 by LAP.

new_extract_status_types_from_telemetry

pro new_extract_status_types_from_telemetry, status, tweet_state=tsflag, woof_state=wsflag, ofc_state=osflag, ofc_step=ostepflag, tt_status=ttsflag

NAME:
      new_extract_status_types_from_telemetry

PURPOSE:
      Final wrapper to get out specific types of telemetry from the
      big composite status dump.
    status        0x200000 = status values ( float x 20)
      Can only get certain ones.
     All extractions via keyword. No need to assign variables first.

EXPLANATION:
      see above.

Calling SEQUENCE:
         new_extract_status_types_from_telemetry, status, $
                                            tweet_state = tsflag, $
                                            woof_state = wsflag, $
                                            ofc_state = osflag, $
                                            ofc_step = ostepflag, $
                                            tt_status = ttsflag


INPUT/OUTPUT:
     input is a ttdata telemtry dump, obtained from  0x200000 = status values
     values, which is status in retrieve_dumpdata.
     For each keyword that was a variable
     (e.g. tweet_state = tsflag), the appropriate telemetry will
     be stored there.

OPTIONAL OUTPUT:
      None.

EXAMPLE:


DEPENDENCIES:



NOTES:

 tweet_state is the Twt loop 0=open / 2=closing / 3=almost closed /
 4 = closed
 wfr_state is the Wfr loop 0=open / 2=closing / 3=almost closed /
 4 = closed
 tt_state is the tt loop  0=open / 2=closing / 3=almost closed /
 4 = closed
 ofc_state is the ofc loop open/about to close/closing/closed flag
 ofc_step is the operation phase of OFC (e.g. calculating temporal
 PSDs, minimizing gains. I don't have in my notes exactly
 what those numbers correspond to. Check with Daev Palmer's
 AOC documentation for exactly what those values are.


REVISION HISTORY
    written in 2012 by LAP.

new_extract_tt_types_from_telemetry

pro new_extract_tt_types_from_telemetry, ttdata, tt_error_cent =tecflag, tt_error_mas_prelqg=templqgflag, tt_error_mas_0 =temflag, tt_error_mas_to_tt =tem2ttflag, tt_error_mas_to_wfr=tem2wfrflag, tt_ttcomm_mas_uncl =tcmunclipflag, tt_ttcomm_mas_cl =tcmclipflag, tt_ttcomm_volts =tcvflag, tt_ttcomm_mas_wfr =tcmwfrflag, tt_piston_wfr =tpwflag, tt_cent_rotation=tcrflag, tt_cent_focus=tcfflag

NAME:
      new_extract_tt_types_from_telemetry


 ** WARNING ** this has changed as of late Feb, 2014.
 New format, as given by Dave in his planned interface changes
 document, is that the first two fields are the cent rotation coeff
 and the cent focus coeffi.

PURPOSE:
      Final wrapper to get out specific types of telemetry from the
      big composite ttdata dump
    ttvolts       0x002000 = TT values
      Can only get certain ones.
     All extractions via keyword. No need to assign variables first.

EXPLANATION:
      see above.

Calling SEQUENCE:
       new_extract_tt_types_from_telemetry, ttdata, $
                                        tt_error_cent       = tecflag, $
                                        tt_error_mas_prelqg = templqgflag, $
                                        tt_error_mas_0        = temflag, $
                                        tt_error_mas_to_tt  = tem2ttflag, $
                                        tt_error_mas_to_wfr = tem2wfrflag, $
                                        tt_ttcomm_mas_uncl    = tcmunclipflag, $
                                        tt_ttcomm_mas_cl      = tcmclipflag, $
                                        tt_ttcomm_volts       = tcvflag, $
                                        tt_ttcomm_mas_wfr     = tcmwfrflag, $
                                        tt_piston_wfr       = tpwflag


INPUT/OUTPUT:
     input is a ttdata telemtry dump, obtained from  0x002000 = TT
     values, which is ttvolts/ttdata in retrieve_dumpdata.
     For each keyword that was a variable
     (e.g. tt_error_cent=tt_error), the appropriate telemetry will
     be stored there.

OPTIONAL OUTPUT:
      None.

EXAMPLE:


DEPENDENCIES:



NOTES:

     tt_error_cent       - the error (in centroid units) (as
                           calcaulted from the centroid data)
     tt_error_mas_prelqg - the error (in mas) before LQG
                           tt_error_mas_0 - the error (in mas)
                                            after LGQ block. If
                                            no LQG in use,
                                            nothing
                                            happens. This is
                                            immediately before the
                                            temporal split
     tt_error_mas_to_tt  - the error after the temporal split that
                           goes to the TT stage
     tt_error_mas_to_wfr - the error after the temporal split that
                           goes to the Wfr surface
     tt_ttcomm_mas_uncl  - the TT command, after integration, in the
     tt_ttcomm_mas_cl    -
     tt_ttcomm_volts     -
     tt_ttcomm_mas_wfr   -
     tt_piston_wfr       -



REVISION HISTORY
    written in 2012 by LAP.

offset_wfscen_phase

pro offset_wfscen_phase, phasemap, zero=zero, caloff=caloff, cumul=cumul, debug=debug

NAME:
      offset_wfscen_phase
PURPOSE:
      Apply reference offsets to the AO

EXPLANATION:
      Convert phasemap to reference centroids, write to appropriate
      file in aoc/config and apply the references.

CALLING SEQUENCE:
      offset_wfscen_phase,phasemap,[/zero|/cumul,/caloff]

INPUT/OUTPUT:
      phasemap - 48x48 phase map (microns)
      /zero - Write all zeros to file and set references to measured
              only
      /cumul - Add to previous refs instead of overwriting
      /caloff - Write to call ofset file instead of ao offset file.

OPTIONAL OUTPUT:
      None.

EXAMPLE:


DEPENDENCIES:
      store_value
      retrive_value
      rtc_issue_command

NOTES:


REVISION HISTORY
      Written by Bruce Macintosh
      11.30.2012 - Folded into gpilib - ds

openall

pro openall, cal=calflag, correct=correct

NAME:
     openall

PURPOSE:
     Open the AO tip/tilt, woofer and tweeter loops, and
     (optinally) the CAL loop.  Also turns off `apply CAL
     corrections', the 'apply pupil offsets' and caldata unless the
     /correct flag is set.

CALLING SEQUENCE:
     openall[,/cal,/correct]

INPUT/OUTPUT:
     /cal - Open CAL loop
     /correct - If set, continue applying cal offsets
                (not recommended)

OPTIONAL OUTPUT:
     None.

EXAMPLES:
     openall,/cal

DEPENDENCIES:
     rtc_command_open_loops
     tlc_cal_openclose

NOTES:
     While CAL_CORRECT is always set to 0 (unless /correct is set),
     the AO PnC tracking state is not changed, so if you were
     tracking when the loops were opened, you'll continue to be
     tracking afterwards.

REVISION HISTORY
     Written by Lisa Poyneer at some point.
     1.17.13 - Added /correct keyword - ds
     2.05.13 - Turns off pupil offsets as well - ds

read_and_convert_timestamps

function read_and_convert_timestamps, timefilename, local=localflag

NAME:
     read_and_convert_timestamps

PURPOSE:
     convert reltimes text file to usable form

CALLING SEQUENCE:
     res = read_and_convert_timestamps(filename, [/local])

INPUT/OUTPUT:
     input is a filename to load in.
     /local is outdated - that allows you to set a file path. In
                          regular operation this is not used.

OPTIONAL OUTPUT:
     None.

EXAMPLES:
  reltimeflag = read_and_convert_timestamps(timefilename)

DEPENDENCIES:


NOTES:
    Used by retrieve_dumpdata variants.

REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtc_command_close_loops

pro rtc_command_close_loops, tweeter=tflag, woofer=wflag, tt=ttflag, errout=errout, noflags=noflags, rotation=rotflag, focus=focflag, noextend=noeflag

NAME:
     rtc_command_close_loops

PURPOSE:
     Close AO tip/tilt, tweeter, and/or woofer loop
    For the TT loop, also chose if you want to project out rotation,
    and if you want the special focus loop running.

CALLING SEQUENCE:
     rtc_command_close_loops,[/tweeter,/woofer,/tt,errout=errout]

INPUT/OUTPUT:
     /tweeter,/woofer,/tt - Set at least one of these to close the
                            corresponding loop.

OPTIONAL OUTPUT:
     errout - 1 if error occurs, otherwise zero.

EXAMPLES:

DEPENDENCIES:
     rtc_issue_command
     run_readwrite_query
     tlc_find_binary

NOTES:
     Prior to closing any loop (if running via the RPC) a globalInit
     1 will be issued to clear any AOC flags.  If the flags
     represent an ongoing condition, they will be re-set and the
     loops will fail to close.
     ***** significant changed late Feb 2014 to deal with focus and
     rotation projection and control/lack thereof.
     ***** significant changed late Feb 2014 to deal option to not use
     edge correction inside FTR!

REVISION HISTORY
     Written by Lisa Poyneer at some point.
     12.12.2012 - Added AOC flag clearing and checks - ds
     02.14 - Added /rot and /foc flags - LAP

rtc_command_close_ofc

pro rtc_command_close_ofc

NAME:
     rtc_command_close_ofc

PURPOSE:
     Start fourier optimizer.

CALLING SEQUENCE:
     rtc_command_close_ofs

INPUT/OUTPUT:
     None.

OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:
     rtc_issue_command

NOTES:

REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtc_command_dumpdata

function rtc_command_dumpdata, enf=enf, wfsimage=wfsflag, centroids=centflag, intensities=intenflag, phase=phaseflag, tweeterphase=tweetflag, wooferphase=woofflag, clpsd=clpsdflag, olpsd=olpsdflag, gain=gainflag, tweetercommphase=tcpflag, tweetercommvolt=tcvflag, woofercommphase=wcpflag, woofercommvolt=wcvflag, ttvolts=ttvflag, clippedttonwoofercommphase=cttwcpflag, clippedttonwoofercommvolt=cttwcvflag, caloffsets=calflag, references=refflag, status=statusflag, optphase=optphaseflag, integphase=integphaseflag, integtweeterphase=integtweetflag, integwooferphase=integwoofflag, clipclean=clipcleanflag, ttonwoofercommp=tonwflag, m1m2=m1m2, interval_length=intervalflag, decimationfac=decflag, goslow=gsflag, debug=debug

NAME:
     rtc_command_dumpdata

PURPOSE:
    Command the AOC to save various data products.

EXPLANATION:
    Issues dumpData command to AOC for requested data products and
    returns filenames to which these are written.

CALLING SEQUENCE:
    fnames = rtc_command_dumpdata([data products],[options]) (see below)

INPUT
    /wfsimage      0x000001 =  raw WFS camera data (pixel values)
    /centroids     0x000002 =  centroid data  (mas)
    /intensities   0x000004 =  subap  intensities
    /phase         0x000008  =  output of FTR (raw FFT modes, complex)
    /tweeterphase  0x000020  =  raw  tweeter phase
    /wooferphase   0x000040  =  raw  woofer phase
    /clpsd         0x000100  = closed loop temporal power spectra (from optimizer)
    /olpsd         0x000200  = derived open loop temporal power spectra (from optimizer)
    /gain          0x000400 =  modal gains (calculated by optimizer)
    /tweetercommphase & /tweetercommvolt
                   0x000800  = clipped tweeter actuator settings, phase (microns) and volts
    /woofercommphase & /woofercommvolt
                   0x001000  = clipped woofer  actuator settings, phase (microns) and volts
    /ttvolts       0x002000 = TT values
    /m1m2          0x004000 = M1/M2 offload data
    (no keyword)   0x008000 =  statistics
    /clippedttonwoofercommphase & clippedttonwoofercommvolt
                   0x010000 = clipped woofer  actuator settings with new TT, phase (microns) and volts
    (no keyword)   0x020000 = telescope pupil alignment data
    (no keyword)   0x040000 = Cal subsystem diag data
    /caloffsets    0x080000 = Cal reference centroid offsets
    /references    0x100000 = current reference centroids
    /status        0x200000 = status values ( float x 20)
    /optphase      0x400000 = ftr output with optimizer gains applied, but not yet integrated
    /integtweeterphase 0x1000000 = unclipped tweeter actuator settings, phase (microns)
    /integwooferphase  0x2000000 = unclipped woofer actuator settings, phase (microns)
    /clipclean         0x4000000 = clipping and cleanup data
    /ttonwoofercommp   0x8000000 = unclipped woofer  actuator settings with new TT, phase (microns)

    interval_length - Length of time to dump.  Defaults to
                      1./gpi_frame_rate (1 frame).
    decimationfac - Frame decimation.  Defaults to 1.
    /goslow  - Wait an additional gpi_rtc_waittime after issuing
               dumpData command.

OUTPUT:
     out - Array of filenames with data.

OPTIONAL OUTPUT:
     enf - On return will equal
           round(interval_length*rtc_framerate/decrate)
     errout - 1 if error occurs, otherwise zero.

EXAMPLES:

DEPENDENCIES:
     rtc_issue_command
     tlc_parse_client_output
     tlc_find_binary

NOTES:
     This routine is typically called by rtc_retrieve_dumpdata.  On
     its own, it only issues a dumpData command and returns
     filenames - it does not read in any of the data itself.

REVISION HISTORY
     Written by Lisa Poyneer at some point.
     06.10.2012 - Added explicit gmb filename lookup - ds

rtc_command_open_loops

pro rtc_command_open_loops, tweet=tflag, woof=wflag, tt=ttflag

NAME:
     rtc_command_open_loops

PURPOSE:
     Open AO tip/tilt, tweeter, and/or woofer loop

CALLING SEQUENCE:
     rtc_command_open_loops,[/tweeter,/woofer,/tt]

INPUT/OUTPUT:
     /tweeter,/woofer,/tt - Set at least one of these to close the
                            corresponding loop.

OPTIONAL OUTPUT:
     None

EXAMPLES:

DEPENDENCIES:
     rtc_issue_command

NOTES:

REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtc_command_open_ofc

pro rtc_command_open_ofc

NAME:
     rtc_command_open_ofc

PURPOSE:
     Stop fourier optimizer.

CALLING SEQUENCE:
     rtc_command_open_ofc

INPUT/OUTPUT:
     None.

OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:
     rtc_issue_command

NOTES:

REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtc_command_readconfig

pro rtc_command_readconfig

NAME:
     rtc_command_readconfig

PURPOSE:
     Issue readConfig command to AOC.

CALLING SEQUENCE:
     rtc_command_readconfig

INPUT/OUTPUT:
     None.

OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:
     rtc_issue_command

NOTES:

REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtc_command_select_dark

pro rtc_command_select_dark, zero=zflag, dark=dflag, sky=sflag

NAME:
     rtc_command_select_dark

PURPOSE:
     Select AO WFS Dark source.

CALLING SEQUENCE:
     rtc_command_select_dark,[/zero|/dark|/sky]

INPUT/OUTPUT:
     /zero - Use all zeros for dark
     /dark - Use stored dark frame
     /sky - Use sky backgrounds

OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:
     rtc_issue_command

NOTES:

REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtc_command_select_flat

pro rtc_command_select_flat, ones=oflag, flat=fflag

NAME:
     rtc_command_select_flat

PURPOSE:
     Select AO WFS Flat source.

CALLING SEQUENCE:
     rtc_command_select_flat,/ones|/flat

INPUT/OUTPUT:
    /ones - Use all ones
    /flat - Use stored WFS flat.

OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:
     rtc_issue_command

NOTES:

REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtc_command_select_influence_function_gains

pro rtc_command_select_influence_function_gains, ones=oflag, measure=mflag, host=hflag

NAME:
     rtc_command_select_influence_function_gains

PURPOSE:
     Select tweeter influence function gains.

CALLING SEQUENCE:
     rtc_command_select_influence_function_gains,/ones|/host

INPUT/OUTPUT:
     /ones - Use all ones
     /host - Use values from file (in parms)

OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:
     rtc_issue_command

NOTES:

REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtc_command_select_references

pro rtc_command_select_references, zero=zflag, measure=mflag, offsets=oflag, cal=cal, rephase=rephase, apod=apod, debug=debug

NAME:
     rtc_command_select_references

PURPOSE:
     Select AO WFS reference centroids

CALLING SEQUENCE:
     rtc_command_select_references,[/zero,/measure,/offsets]

INPUT/OUTPUT:
     /zero - Use all zeros (no offset)
     /offsets - Use reference offsets
     /meausre - Use base reference centroids
     /rephase - Use cal rephase
     /cal - Use cal offsets - DO NOT USE (redundant with CALDATAONOFF)
     apod - Use offsets associated with apodizer.  Input is 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). Or just the mask number.

OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:
     rtc_issue_command

NOTES:
     /zero and /measure are mutually exclusive.  Running with no
     flags is equivalent to /zero only.
     This function updates the global variable gpi_rtc_refcents.
     The /cal flag should typically never be set in normal
     operation.  These values should automatically be handled with
     calDataOnOff.

REVISION HISTORY
     Written by Lisa Poyneer at some point.
     02.01.2013 - Rewrite to account for apodizer offsets and
                  cleanup of code. - ds

rtc_command_set_cam_rate

pro rtc_command_set_cam_rate, rate0, default=dflag

NAME:
    rtc_command_set_cam_rate

PURPOSE:
     Set the frame rate of the WFS CCD (and hence the AO system)

CALLING SEQUENCE:
     rtc_command_set_cam_rate, rate0, [/default]

INPUT/OUTPUT:
     rate0 is the rate in Hz.
     /default will set to default frame rate (1 kHz)


OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:
     rtc_issue_command

NOTES:

REVISION HISTORY
     Written by Lisa Poyneer at some point.
     modified by bmac 8/17/2012 to not move the tip/tilt mirror

rtc_command_set_cent_gains

pro rtc_command_set_cent_gains, xgain, ygain

NAME:
     rtc_command_set_cent_gains

PURPOSE:
     wrapper to modified set CENT_THRESH thru AOC command
     !!!!!! per Dave's interface change Feb 2014, CENTROID_GAIN_X
     and CENTROID_GAIN_Y are set with the setCentThresh command.

CALLING SEQUENCE:
     rtc_command_set_cent_gains, xgain, ygain

INPUT/OUTPUT:
     xgain is the gain for the x centroids
     ygain is the gain for the y centroids


OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:
     rtc_issue_command

NOTES:
     DOes no kind of checking (e.g. is val < 0?)
REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtc_command_set_cent_thresh

pro rtc_command_set_cent_thresh, val

NAME:
     rtc_command_set_cent_thresh

PURPOSE:
     wrapper to set CENT_THRESH thru AOC command

CALLING SEQUENCE:
     rtc_command_set_cent_thresh, val

INPUT/OUTPUT:
     val is the CENT_THRESH desired value.



OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:
     rtc_issue_command

NOTES:
     DOes no kind of checking (e.g. is val < 0?)
REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtc_command_set_gain_filter

pro rtc_command_set_gain_filter, positive=pflag, neg=nflag, default=dflag, val=vflag

NAME:
     rtc_command_set_gain_filter

PURPOSE:
     WRapper to select the control loop gain filter.

CALLING SEQUENCE:
     rtc_command_set_gain_filter, positive=pflag, neg=nflag, default=dflag, val=vflag

INPUT/OUTPUT:
     /pos: sets to a positive gain. REquires an existing file. USed
     only for testing.
     /neg: sets to a negative gain. REquires an existing file. USed
     only for testing.
     /default: sets to the default value (0.2). REquires an existing file.
     val=vflag: sets to a specific value, e.g. 0.1

OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:
     rtc_issue_command

NOTES:
     THe filter that is specified here actually allow 48^2 unique
     values. In practice we only ever save a signal that has a
     uniform value.

REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtc_command_set_tt

pro rtc_command_set_tt, phase00, volts=voltflag, bias=biasflag, min=minflag, max=maxflag, flat=flatflag, white=whiteflag

NAME:
    rtc_command_set_tt

PURPOSE:
    command the TT stage

CALLING SEQUENCE:
     rtc_command_set_tt, phase00, volts=voltflag, bias=biasflag, $
     min=minflag, max=maxflag, flat=flatflag, white=whiteflag

INPUT/OUTPUT:
     phase00: 2-element vector with desired TT [x, y] in mas
     /volt: the phase00 numbers are volts, not mas.
     /bias: command the mirror to bias. Any value in phase00 will be
     added to bias.
     /flat: command the mirror to 'flat'. Any value in phase00 will be
     added to the flat position.
     /white: deprecated usage for differential pointing between
     narrow-band and white light sources.
     /min: set TT to minimum voltage (rarely used) WOrks only if no
     phase00 argument is given.
     /max: set TT to maximum voltage (rarely used) WOrks only if no
     phase00 argument is given.

OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:
     rtc_issue_command

NOTES:

REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtc_command_Set_tt_gains

pro rtc_command_Set_tt_gains, pos

NAME:
     rtc_command_Set_tt_gains

PURPOSE:
     wrapper to AOC command to set the TT_GAIN_STAGE/SURFACE keywords.

CALLING SEQUENCE:
     rtc_command_Set_tt_gains, pos

INPUT/OUTPUT:
     pos: a 2-element vector [TT stage, WFR surface] gains.



OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:
     rtc_issue_command

NOTES:

REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtc_command_Set_tt_offsets

pro rtc_command_Set_tt_offsets, pos

NAME:
     rtc_command_Set_tt_offsets

PURPOSE:
     A wrapper to AOC command to set TT_X/Y_OFFS keywords.

CALLING SEQUENCE:
     rtc_command_Set_tt_offsets, pos

INPUT/OUTPUT:
     pos: a w-element vector containing the offsets in mas



OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:
     rtc_issue_command

NOTES:

REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtc_command_set_tweeter

pro rtc_command_set_tweeter, phase00, volts=voltflag, flat=flatflag, dewarp=dflag, bias=bflag, stop=stopflag, xshift=xsflag, yshift=ysflag, crosspoke=cpflag, bigcrosspoke=bigcpflag, waffle=wafflag, noslaving=noslaveflag, slavewiththispingrid=pinflag

NAME:
     rtc_command_set_tweeter

PURPOSE:
     Wrapper to command Tweeter. Allows arbitrary phase or voltage
     signals, as well as adding arbitrary phase to specific known
     patterns (like flat0. Also allows commanding to specific shapes.

CALLING SEQUENCE:
     rtc_command_set_tweeter, phase00, volts=voltflag, flat=flatflag, dewarp=dflag, bias=bflag, $
                            stop=stopflag, xshift=xsflag, yshift=ysflag, $
                            crosspoke = cpflag, bigcrosspoke=bigcpflag, waffle=wafflag, $
                            noslaving=noslaveflag, slavewiththispingrid=pinflag

INPUT/OUTPUT:
     phase00: a 48 x 48 signal containing the phase/volts to put on
     the mirror. DEfault assumption is this is phase (microns).
     /volts: treat the phase00 signal as volts, not phase in mircons
     /flat: commad the mirror to flat, as specified by the
     AOC's 0x2 flat file. If phase00 is null, just go to
     flat. If phase00 has a signal, add this as a offset to that
     AOC's flat.
     /bias: commad the mirror to bias voltage for all actuators.
     If phase00 is null, just go to bias. If phase00 has a signal,
     command that phase directly with setShapes 0x4. This works
     since we define the bias voltage as the voltage which makes 0
     phase from the voltage calibration.
     /dewarp: Acts just like /flat but uses the AOC's flat in
     0x1. No idea why this is called 'dewarp'.
     /stop: stop convenietly to examine what's going on.
     xshift=xs: allows a shift of the phase signal by an amount
     specified. Used only in very specific testing circumstances.
     yshift=ys: allows a shift of the phase signal by an amount
     specified. Used only in very specific testing circumstances.
     /crosspoke: Place on a signal known as 'crosspoke'
     /bigcrosspoke: Place on a signal known as 'bigcrosspoke'
     /waffle: Place on waffle.
     /noslaving: Code does slaving itself on input phase
     commands. This should match closely what the AOC actually
     does. If you do not want the actuators outside the pupil to be
     slaved, set this flag.
     /slavewiththispingrid=pingrid: Pass in a 0-1 mask of the valid
     actautors to be used in slaving instead of the system default
     (as given in gpi_pingrid).



OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:
     rtc_issue_command

NOTES:

REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtc_command_set_woofer

pro rtc_command_set_woofer, phase00, volts=voltflag, flat=flatflag, dewarp=dflag, bias=bflag, centerpoke=cpflag

NAME:
     rtc_command_set_woofer

PURPOSE:
     Wrapper to command Woofer. Allows arbitrary phase or voltage
     signals, as well as adding arbitrary phase to specific known
     patterns (like flat0. Also allows commanding to specific shapes.

CALLING SEQUENCE:
     rtc_command_set_woofer, phase00, volts=voltflag, flat=flatflag, dewarp=dflag, bias=bflag, $
                            stop=stopflag, xshift=xsflag, yshift=ysflag, $
                            crosspoke = cpflag, bigcrosspoke=bigcpflag, waffle=wafflag, $
                            noslaving=noslaveflag, slavewiththispingrid=pinflag

INPUT/OUTPUT:
     phase00: a 9 x 9 signal containing the phase/volts to put on
     the mirror. DEfault assumption is this is phase (microns).
     /volts: treat the phase00 signal as volts, not phase in mircons
     /flat: commad the mirror to flat, as specified by the
     AOC's 0x20 flat file. If phase00 is null, just go to
     flat. If phase00 has a signal, add this as a offset to that
     AOC's flat.
     /bias: commad the mirror to bias voltage for all actuators.
     If phase00 is null, just go to bias. If phase00 has a signal,
     command that phase directly with setShapes 0x40. This works
     since we define the bias voltage as the voltage which makes 0
     phase from the voltage calibration.
     /dewarp: Acts just like /flat but uses the AOC's flat in
     0x10. No idea why this is called 'dewarp'.
     /centerpoke: POkes the center actuator on the Wfr.



OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:
     rtc_issue_command

NOTES:

REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtc_do_centroids_ourselves

function rtc_do_centroids_ourselves, wfsimg0, flatwfs=flat, dark=dark, pixels=pixflag, suboverride=sflag, flatfieldslopes=ffsflag, nozeromasking=nzflag

NAME:
     rtc_do_centroids_ourselves

PURPOSE:
     Calculte the centroids from a WFS image.
     *** THis algorithm is designed to duplicate AOC code.
     Running this on dumped data should produce the exact
     same output as the AOC calculates itself.

CALLING SEQUENCE:
     res = rtc_do_centroids_ourselves(wfsimg0,/flatwfs, /dark, /pixels, $
      suboverride=sflag, /flatfieldslopes, /nozeromasking)

INPUT/OUTPUT:
     wfsimg0: a raw WFS frame (such as that dumped by the AOC
     /flatwfs: apply the flat field that is currently in use
     /dark: apply the dark file that is currently in use
     /pixels: return the slopes in units of pixels (default is mas)
     suboverride=sflag: sflag is a 48 x 48 signal that is a 0-1 mask
     specifing teh valid subapertures over which to calculate the
     slopes. OTherwise only the valid subapertures given in
     gpi_subapmask will be used.
     /flatfieldslopes: Apply a flat field correction, given by the
     variable gpi_wfs_slope_flat_field. THis was used at some point
     in testing in 2011. Do not use.
     /nozeromasking: Passed on to calculate_slopes.pro. If not set,
     the default behavior is to set all negative valued pixels to
     zero. If this keyword is set, these negative pixels will be
     left alone.

     res:  the centroid (96 x 48) signal in mas.

OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:
     calculate_slopes

NOTES:

REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtc_do_ftr_ourselves

function rtc_do_ftr_ourselves, centsig, leaveintt=lflag, suboverride=sflag, boundaryopt=bflag, sidett=sideflag, removefocus=remfocflag, removerotation=remrotflag

NAME:
     rtc_do_ftr_ourselves

PURPOSE:
     Calculate the reconstructed phase via FTR from a slope signal
     *** THis algorithm is designed to duplicate AOC code.
     Running this on dumped data should produce the exact
     same output as the AOC calculates itself.

CALLING SEQUENCE:
     res = rtc_do_ftr_ourselves( centsig, /leaveintt,
                suboverride=sflag, boundaryopt=bflag, /sidett)

INPUT/OUTPUT:
     centisg: a 96 x 48 signal of the centroids (Units: mas)
     /leavintt: leave in any average value as we
     reconstruct. Default behavior emulates the AOC in subtracting
     out the average value from the slope signals and using that for
     TT control.
     suboverride=sflag: sflag is a 0-1 mask of the valid
     subapertures. Use this as the basis for valid subaps and
     actuators in reconstruction. Otherwise the gpi defaults
     (gpi_subapmask, gpi_pingrid) are used. Allows you to
     reconstruct the phase over an arbitrary pupil (e.g. you want
     the full GPI pupil with no dead actuators masked).
     boundaryopt=bflag: unused option. SEtting this keyword will
     result in  no boundary correction being applied. (which is
     probably not what you want)
     /sidett: Another seldom-used (testing only) option that allows
     the tip and tilt to be reconstructed inside the phase instead
     of zeroed out as is done in the AOC. THis option doesn't
     send it through the recontsructor, but instead calculates it
     directly and adds it back in after FTR.

    /removefocus: remove any focus from centroids via vectors in
    ttRotFocVectors.fits before reconstructing
    /removerotataion: remove any rotation from centroids via vectors in
    ttRotFocVectors.fits before reconstructing

     res: the reconstructed phase (48x48)


OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:


NOTES:

REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtc_do_ftr_ourselves

function rtc_do_ftr_ourselves, centsig, leaveintt=lflag, suboverride=sflag, boundaryopt=bflag, sidett=sideflag

No header information available.

rtc_do_inflprecomp_ourselves

function rtc_do_inflprecomp_ourselves, phase, backwards=bflag

NAME:
     rtc_do_inflprecomp_ourselves

PURPOSE:
     Calculate the Twt phase after influence function precompensation.
     *** THis algorithm is designed to duplicate AOC code.
     Running this on dumped data should produce the exact
     same output as the AOC calculates itself.

CALLING SEQUENCE:
     res = rtc_do_inflprecomp_ourselves( phase, /backwards)

INPUT/OUTPUT:
     phase: a 48 x 48 signal
     /backwards: instead of applying the influence function filter,
     it removes it, allowing you to inverse the process. THis can be
     useful when dealing with a signal (e.g. a
     tweetercommandedphase) that has had it applied.

     res: the phase signal, with Twt influence filtering applied


OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:


NOTES:

REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtc_do_phase_from_volts_ourselves

function rtc_do_phase_from_volts_ourselves, volts, tweet=tflag, woof=wflag

NAME:
     rtc_do_phase_from_volts_ourselves

PURPOSE:
     Calculate the phase from a voltage signal
     *** THis algorithm is designed to duplicate AOC code.
     Running this on dumped data should produce the exact
     same output as the AOC calculates itself.

CALLING SEQUENCE:
     res = rtc_do_phase_from_volts_ourselves( volts, /tweet, /woof)

INPUT/OUTPUT:
     volts: a signal to convert to phase.
     /tweet: set this flag is it is a tweeter signal
     /woof: set this flag if it is a woofer signal.

    res: the phase signal as derived from volts.

OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:


NOTES:
     THe code should probably be smart enough to recognize feorm the
     size of volts if this is a Twt or Wfr signal, but it doesn't.
REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtc_do_recombine_ourselves

function rtc_do_recombine_ourselves, tphase, wphase, removett=removeflag

NAME:


PURPOSE:
     Calculate the combined phase from a set of Wfr and Twt phases
     (which are the result of applying the split)
     *** UNlike the other _do_ourselves functions, this does NOT
     emulate an AOC calculation.

CALLING SEQUENCE:
     res = rtc_do_recombine_ourselves( tphase, wphase)

INPUT/OUTPUT:
     tphase: the 48 x 48 tweeter phase signal
     wphase: the 9 x 9 tweeter phase signal

     res:  the 48 x 48 tweeter phase before it was split.


OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:


NOTES:
     If you send it in any old wfr and twt signal, it will recombine
     them, But if you then split that result, you are not guaranteed
     to get back the same thing!
REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtc_do_refs_from_phase

function rtc_do_refs_from_phase, phase, squarepupil=sqflag, lowpass=lflag, stop=stopflag, cal_lowfs=calflag

NAME:
     rtc_do_refs_from_phase

PURPOSE:
     Calculate the reference centroids that when used as offsets
     will produce the desired phase signal. Used with CAL correction
     and speckle nulling.
     *** THis algorithm is designed to duplicate AOC code.
     Running this on dumped data should produce the exact
     same output as the AOC calculates itself.

CALLING SEQUENCE:
     res = rtc_do_refs_from_phase(phase, squarepupil=sqflag, $
           lowpass=lflag, stop=stopflag, cal_lowfs=calflag)

INPUT/OUTPUT:
     phase: a 48 x 48 phase that we want to calculate reference
     centroids to produce in closed loop. (e.g. speckle nulling).
     /squarepupil: calculate the filtering over a hull square pupil,
     not the gpi_pingrid.
     /lowpass: apply a lowpass filter to smooth out high-spat-freq
     artifacts.
     /stop: stop at a convenient place to explore code and variables.
     / cal_lowfs: do the filtering with the special CAL filter. THis
     is given in parms by CAL_FTR_FLTR. The default is to the the
     reconstruction filter, as given by TWT_FTR_FLTR.

    res: the 96 x 48 centroid signal in mas.

OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:


NOTES:
     Should probably have the word "ourselves" in the file
     name for consistency's sake, but it doesn't.
REVISION HISTORY
     Written by Lisa Poyneer at some point.

new_shift2d_nowrap (rtc_do_refs_from_phase_new.pro)

function new_shift2d_nowrap, sig, xs, ys

rtc_do_refs_from_phase_new (rtc_do_refs_from_phase_new.pro)

function rtc_do_refs_from_phase_new, phase, squarepupil=sqflag, pupil=pupflag, lowpass=lflag, stop=stopflag, cal_lowfs=calflag, extend=extflag, ptt_sep=pttflag, fullextend=fullflag, decayextend=decflag, returnphase=rpflag, fixlast=fixflag, notip=notiltflag

No header information available.

rtc_do_slaving_ourselves

function rtc_do_slaving_ourselves, phase0, nospecial=nsflag

NAME:
     rtc_do_slaving_ourselves

PURPOSE:
     Calculate the slaved phase on the Twt
     *** THis algorithm is designed to duplicate AOC code.
     Running this on dumped data should produce the exact
     same output as the AOC calculates itself.

CALLING SEQUENCE:
     res = rtc_do_slaving_ourselves( phase0, [/nospecial])

INPUT/OUTPUT:
     phase0: input phase to slave
     /nospecial: does not apply any special slaving. (At one time
     the AOC did special slaving. NOw it does not. THis has been deprecated.)

     res: the 48 x 48 slaved phase.

OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:


NOTES:

REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtc_do_split_ourselves

pro rtc_do_split_ourselves, phase, tweet=tflag, woof=wflag, nopiston=npflag, simulation=simflag

NAME:
     rtc_do_split_ourselves

PURPOSE:
     Calculate
     *** THis algorithm is designed to duplicate AOC code.
     Running this on dumped data should produce the exact
     same output as the AOC calculates itself.

CALLING SEQUENCE:
     rtc_do_split_ourselves, phase, tweet=tflag, woof=wflag, [/nopiston, /simulation]

INPUT/OUTPUT:
     phase: the 48 x 48 signal to split between Wfr and TWt
     tweet=tflag: tflag is the variable that the Twt portion (48 x
     48) is returned in
     wiif=wflag: wflag is the variable that the Wfr portion (9 x
     9) is returned in
     /nopiston: REmoves piston from the Wfr portion.
     /simulation: Uses old files to look at a simulated matrix. May
     not work. NO guarantees!

OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:


NOTES:

REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtc_do_ttrotfoc_projections

function rtc_do_ttrotfoc_projections, cents, nogain=ngflag, realunits=rflag

No header information available.

rtc_issue_command

pro rtc_issue_command, comm, retstr=retstr0, retval=retval0, longwait=longwait, gofast=gfflag, debug=debug, verb=verb

NAME:
      rtc_issue_command
PURPOSE:
      Send command to AOC
EXPLANATION:
      Sends commands to aoc either via RPC calls or directly through
      a tcp socket.

CALLING SEQUENCE:
      rtc_issue_command,comm,[options]

INPUT/OUTPUT:
      comm - String containing command. See ICD for details.
      /longwait - Wait an additional gpi_rtc_waittime
      /gofast - Wait only half the time

OPTIONAL OUTPUT:
      retstr - Contains any returned messages
      retval - Contains any returned values

EXAMPLE:
      rtc_issue_command,  'selectGainSrc 0x4'

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_socket_functions.pro

COMMON BLOCKS:
     gpi_globals

NOTES:

REVISION HISTORY
      Original implementation by Lisa Poyneer god knows when
      Tons of changes - see code for details/notes
      5.24.12 - ds -Deprecated gpi_bindir

rrd_message1 (rtc_retrieve_dumpdata.pro)

pro rrd_message1, nf, enf

rtc_retrieve_dumpdata (rtc_retrieve_dumpdata.pro)

function rtc_retrieve_dumpdata, fullbuffer=fullflag, grablast=gbflag, wfsimage=wfsflag, centroids=centflag, intensities=intenflag, phase=phaseflag, integphase=integphaseflag, optphase=optphaseflag, integtweeterphase=integtweetflag, integwooferphase=integwoofflag, clipclean=clipcleanflag, tweeterphase=tweetflag, wooferphase=woofflag, tweetercommphase=tcpflag, woofercommphase=wcpflag, tweetercommvolt=tcvflag, woofercommvolt=wcvflag, clippedttonwoofercommphase=cttwcpflag, clippedttonwoofercommvolt=cttwcvflag, ttonwoofercommp=tonwflag, ttvolts=ttvflag, gain=gainflag, caloffsets=calflag, references=refflag, clpsd=clpsdflag, olpsd=olpsdflag, status=statusflag, relativetime=reltimeflag, m1m2=m1m2, interval_length=intervalflag, decimationfac=decflag, debug=debug, onlytimes=otflag, namereturn=nameflag, goslow=gsflag, none=noneflag

NAME:
     rtc_retrieve_dumpdata

PURPOSE:
    Command the AOC to save various data products and then read them in.

EXPLANATION:
    Issues dumpData command to AOC for requested data products via
    rtc_command_dumpdata, reads in the returned filenames, and
    returns data in named variables.

CALLING SEQUENCE:
    res = rtc_retrieve_dumpdata([data products],[options]) (see below)

INPUT
    wfsimage      0x000001 =  raw WFS camera data (pixel values)
    centroids     0x000002 =  centroid data  (mas)
    intensities   0x000004 =  subap  intensities
    phase         0x000008  =  output of FTR (raw FFT modes, complex)
    tweeterphase  0x000020  =  raw  tweeter phase
    wooferphase   0x000040  =  raw  woofer phase
    clpsd         0x000100  = closed loop temporal power spectra (from optimizer)
    olpsd         0x000200  = derived open loop temporal power spectra (from optimizer)
    gain          0x000400 =  modal gains (calculated by optimizer)
    tweetercommphase & tweetercommvolt
                  0x000800  = clipped tweeter actuator settings, phase (microns) and volts
    woofercommphase & woofercommvolt
                  0x001000  = clipped woofer  actuator settings, phase (microns) and volts
    ttvolts       0x002000 = TT values
    m1m2          0x004000 = M1/M2 offload data
    (no keyword)  0x008000 =  statistics
    clippedttonwoofercommphase & clippedttonwoofercommvolt
                  0x010000 = clipped woofer  actuator settings with new TT, phase (microns) and volts
    (no keyword)  0x020000 = telescope pupil alignment data
    (no keyword)  0x040000 = Cal subsystem diag data
    caloffsets    0x080000 = Cal reference centroid offsets
    references    0x100000 = current reference centroids
    status        0x200000 = status values ( float x 20)
    optphase      0x400000 = ftr output with optimizer gains applied, but not yet integrated
    integtweeterphase 0x1000000 = unclipped tweeter actuator settings, phase (microns)
    integwooferphase  0x2000000 = unclipped woofer actuator settings, phase (microns)
    clipclean         0x4000000 = clipping and cleanup data
    ttonwoofercommp   0x8000000 = unclipped woofer  actuator settings with new TT, phase (microns)

    interval_length - Length of time to dump.  Defaults to
                      1./gpi_frame_rate (1 frame).
    decimationfac - Frame decimation.  Defaults to 1.
    /goslow  - Wait an additional gpi_rtc_waittime after issuing
               dumpData command.
    /onlytimes -
    /relativetime -
    /none - Don't read anything in (return after running
            command_dumpdata).
    /fullbuffer - Return all of dumped data.  If not set, returns
                  eitehr average of frames, or last frame (if
                  /grablast is set).
    /grablast - Return last frame of dumped data.  If not set,
                averages all frames.

OUTPUT:
     res - 0 for success, 1 otherwise.

OPTIONAL OUTPUT:
     namereturn - Return filenames from rtc_command_dumpdata.

EXAMPLES:

DEPENDENCIES:
     rtc_issue_command
     tlc_parse_client_output
     tlc_find_binary

NOTES:

REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtc_retrieve_dumpdata_longinterval_earlier_smart

function rtc_retrieve_dumpdata_longinterval_earlier_smart, iterations, commands=commandstring, close_sf_step_and_size_info=close_sf_step_and_size_info, wfsimage=wfsflag, centroids=centflag, intensities=intenflag, phase=phaseflag, integphase=integphaseflag, optphase=optphaseflag, integtweeterphase=integtweetflag, integwooferphase=integwoofflag, clipclean=clipcleanflag, tweeterphase=tweetflag, wooferphase=woofflag, tweetercommphase=tcpflag, woofercommphase=wcpflag, tweetercommvolt=tcvflag, woofercommvolt=wcvflag, ttonwoofercommp=tonwflag, ttvolts=ttvflag, gain=gainflag, references=refflag, clpsd=clpsdflag, olpsd=olpsdflag, interval_length=intervalflag, decimationfac=decflag, status=statusflag, relativetime=reltimeflag, onlytimes=otflag, namereturn=nameflag

NAME:
     rtc_retrieve_dumpdata_longinterval_earlier_smart,

PURPOSE:
    Command the AOC to dump various data products for a long period
    of time (e.g. greater than 6 seconds.) You must use a second
    procedure, rtc_retrieve_dumpdata_longinterval_later to actually
    load them in to the IDL session.

EXPLANATION:
    Issues dumpData command to AOC for requested data products via
    rtc_command_dumpdata, reads in the returned filenames, and
    returns data in named variables.

CALLING SEQUENCE:
    filenames =
    rtc_retrieve_dumpdata_longinterval_earlier_smart(iterations, [data products],[options]) (see below)

INPUT
    iterations:    a required arguement which specifies how many
                   6-second intervals to dump.
    wfsimage      0x000001 =  raw WFS camera data (pixel values)
    centroids     0x000002 =  centroid data  (mas)
    intensities   0x000004 =  subap  intensities
    phase         0x000008  =  output of FTR (raw FFT modes, complex)
    tweeterphase  0x000020  =  raw  tweeter phase
    wooferphase   0x000040  =  raw  woofer phase
    clpsd         0x000100  = closed loop temporal power spectra (from optimizer)
    olpsd         0x000200  = derived open loop temporal power spectra (from optimizer)
    gain          0x000400 =  modal gains (calculated by optimizer)
    tweetercommphase & tweetercommvolt
                  0x000800  = clipped tweeter actuator settings, phase (microns) and volts
    woofercommphase & woofercommvolt
                  0x001000  = clipped woofer  actuator settings, phase (microns) and volts
    ttvolts       0x002000 = TT values
    (no keyword)  0x004000 = M1/M2 offload data
    (no keyword)  0x008000 =  statistics
    clippedttonwoofercommphase & clippedttonwoofercommvolt
                  0x010000 = clipped woofer  actuator settings with new TT, phase (microns) and volts
    (no keyword)  0x020000 = telescope pupil alignment data
    (no keyword)  0x040000 = Cal subsystem diag data
    caloffsets    0x080000 = Cal reference centroid offsets
    references    0x100000 = current reference centroids
    status        0x200000 = status values ( float x 20)
    optphase      0x400000 = ftr output with optimizer gains applied, but not yet integrated
    integtweeterphase 0x1000000 = unclipped tweeter actuator settings, phase (microns)
    integwooferphase  0x2000000 = unclipped woofer actuator settings, phase (microns)
    clipclean         0x4000000 = clipping and cleanup data
    ttonwoofercommp   0x8000000 = unclipped woofer  actuator settings with new TT, phase (microns)

    interval_length - Length of time to dump.  Defaults to
                      1./gpi_frame_rate (1 frame).
    decimationfac - Frame decimation.  Defaults to 1.
    /goslow  - Wait an additional gpi_rtc_waittime after issuing
               dumpData command.
    /onlytimes -
    /relativetime -
    /none - Don't read anything in (return after running
            command_dumpdata).
    /fullbuffer - Return all of dumped data.  If not set, returns
                  eitehr average of frames, or last frame (if
                  /grablast is set).
    /grablast - Return last frame of dumped data.  If not set,
                averages all frames.

OUTPUT:
     filenames: this returns a string array that has a list of the
     file names of the files that were dumped. THis gets passed on
     in to the second procedure: rtc_retrieve_dumpdata_longinterval_later

OPTIONAL OUTPUT:
     namereturn - Return filenames from rtc_command_dumpdata.

EXAMPLES:
        later_info = rtc_retrieve_dumpdata_longinterval_earlier_smart(iterations, $
                                                             /relativetime, $
                                                             /ttvolts, /phase)
        print, 'Done dumping data'
        res = rtc_retrieve_dumpdata_longinterval_later(later_info, $
                                              relativetime=reltimes, $
                                              ttvolts=ttdata, phase=phase)
        print, 'Done loadingin data'


DEPENDENCIES:
     rtc_issue_command
     tlc_parse_client_output
     tlc_find_binary

NOTES:

REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtc_retrieve_dumpdata_longinterval_later

function rtc_retrieve_dumpdata_longinterval_later, laterflag, wfsimage=wfsflag, centroids=centflag, intensities=intenflag, phase=phaseflag, integphase=integphaseflag, optphase=optphaseflag, integtweeterphase=integtweetflag, integwooferphase=integwoofflag, clipclean=clipcleanflag, tweeterphase=tweetflag, wooferphase=woofflag, tweetercommphase=tcpflag, woofercommphase=wcpflag, tweetercommvolt=tcvflag, woofercommvolt=wcvflag, ttonwoofercommp=tonwflag, ttvolts=ttvflag, gain=gainflag, references=refflag, clpsd=clpsdflag, olpsd=olpsdflag, interval_length=intervalflag, decimationfac=decflag, status=statusflag, relativetime=reltimeflag, onlytimes=otflag, namereturn=nameflag, local=localflag, noalignment=noalignflag

NAME:
     rtc_retrieve_dumpdata_longinterval_later

PURPOSE:
    Command the AOC to dump various data products for a long period
    of time (e.g. greater than 6 seconds.) You must use a second
    procedure, rtc_retrieve_dumpdata_longinterval_later to actually
    load them in to the IDL session.

EXPLANATION:
    Issues dumpData command to AOC for requested data products via
    rtc_command_dumpdata, reads in the returned filenames, and
    returns data in named variables.

CALLING SEQUENCE:
    res =
    rtc_retrieve_dumpdata_longinterval_later(iterationslaterflag, [data products],[options]) (see below)

INPUT
    laterflag:    the srray of files names to load in. SEe example
    below.

    wfsimage      0x000001 =  raw WFS camera data (pixel values)
    centroids     0x000002 =  centroid data  (mas)
    intensities   0x000004 =  subap  intensities
    phase         0x000008  =  output of FTR (raw FFT modes, complex)
    tweeterphase  0x000020  =  raw  tweeter phase
    wooferphase   0x000040  =  raw  woofer phase
    clpsd         0x000100  = closed loop temporal power spectra (from optimizer)
    olpsd         0x000200  = derived open loop temporal power spectra (from optimizer)
    gain          0x000400 =  modal gains (calculated by optimizer)
    tweetercommphase & tweetercommvolt
                  0x000800  = clipped tweeter actuator settings, phase (microns) and volts
    woofercommphase & woofercommvolt
                  0x001000  = clipped woofer  actuator settings, phase (microns) and volts
    ttvolts       0x002000 = TT values
    (no keyword)  0x004000 = M1/M2 offload data
    (no keyword)  0x008000 =  statistics
    clippedttonwoofercommphase & clippedttonwoofercommvolt
                  0x010000 = clipped woofer  actuator settings with new TT, phase (microns) and volts
    (no keyword)  0x020000 = telescope pupil alignment data
    (no keyword)  0x040000 = Cal subsystem diag data
    caloffsets    0x080000 = Cal reference centroid offsets
    references    0x100000 = current reference centroids
    status        0x200000 = status values ( float x 20)
    optphase      0x400000 = ftr output with optimizer gains applied, but not yet integrated
    integtweeterphase 0x1000000 = unclipped tweeter actuator settings, phase (microns)
    integwooferphase  0x2000000 = unclipped woofer actuator settings, phase (microns)
    clipclean         0x4000000 = clipping and cleanup data
    ttonwoofercommp   0x8000000 = unclipped woofer  actuator settings with new TT, phase (microns)

    interval_length - Length of time to dump.  Defaults to
                      1./gpi_frame_rate (1 frame).
    decimationfac - Frame decimation.  Defaults to 1.
    /goslow  - Wait an additional gpi_rtc_waittime after issuing
               dumpData command.
    /onlytimes -
    /relativetime -
    /none - Don't read anything in (return after running
            command_dumpdata).
    /fullbuffer - Return all of dumped data.  If not set, returns
                  eitehr average of frames, or last frame (if
                  /grablast is set).
    /grablast - Return last frame of dumped data.  If not set,
                averages all frames.

OUTPUT:
     filenames: this returns a string array that has a list of the
     file names of the files that were dumped. THis gets passed on
     in to the second procedure: rtc_retrieve_dumpdata_longinterval_later

OPTIONAL OUTPUT:
     res - 0 for success, 1 otherwise.

EXAMPLES:
        later_info = rtc_retrieve_dumpdata_longinterval_earlier_smart(iterations, $
                                                             /relativetime, $
                                                             /ttvolts, /phase)
        print, 'Done dumping data'
        res = rtc_retrieve_dumpdata_longinterval_later(later_info, $
                                              relativetime=reltimes, $
                                              ttvolts=ttdata, phase=phase)
        print, 'Done loadingin data'


DEPENDENCIES:
     rtc_issue_command
     tlc_parse_client_output
     tlc_find_binary

NOTES:

REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtc_retrieve_ofcdata

function rtc_retrieve_ofcdata, ftrmodes=ftrmodes, optgains=optgains, olpsds=olpsds, clpsds=clpsds

NAME:
     rtc_retrieve_ofcdata

PURPOSE:
     Read in telemetry from the optimizer


CALLING SEQUENCE:


INPUT/OUTPUT:




OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:


NOTES:
     ************** THis only works when the AOC is running in a
     special debugging mode and dumping lots of data. THis does not
     work in regular operation, as the files won't exist. - LAP
REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtc_send_apo_refcent

pro rtc_send_apo_refcent, apod, phase, zero=zero, apply=apply

NAME:
      rtc_send_apo_refcent

PURPOSE:
      Send apodizer specific reference centroids to the AOC.

EXPLANATION:
      Convert phasemap to reference centroids, write to appropriate
      file in aoc/config and apply (if asked to).

CALLING SEQUENCE:
      rtc_send_apo_refcent,apod,phase,/zero,/apply

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).  Returns null if no match is found or
             multiple entries are matched.
      phasemap - 48x48 phase map (microns)
      /zero - Write all zeros to file
      /apply - Apply the offsets.

OPTIONAL OUTPUT:
      None.

EXAMPLE:


DEPENDENCIES:
      store_value
      retrive_value
      rtc_issue_command

NOTES:


REVISION HISTORY
      Written 02/01/2013 - ds

rtc_standard_settings

pro rtc_standard_settings, keep_camrate=kcflag

NAME:
     rtc_standard_settings

PURPOSE:
     issue all the commands that put the AOC in it's default
     operating state


CALLING SEQUENCE:
     rtc_standard_settings

INPUT/OUTPUT:
     none



OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:


NOTES:
     THis is designed to give you a single procedure which will
     'reset' the AOC to the standard configuration. Handy to use if
     you don't want to realign everything and someone else
     has been using the system and left it in an unknown state.

    As of 20-Feb-2013, this does the following things:
        - sets frame rate to default
        - sets WFS to use dark and flat files
        - selects measured references
        - selects standard influence function gains
        - sets Twt gains to default
        - puts TT/Wfr/Twt at flat voltages
        - sets CENT_THRES to 100 (limits performance to 8th magnitude)

REVISION HISTORY
     Written by Lisa Poyneer at some point.

rtcerror_print

pro rtcerror_print, data

NAME:
     rtcerror_print

PURPOSE:
     ridiculously short error print wrapper.


CALLING SEQUENCE:


INPUT/OUTPUT:




OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:


NOTES:

REVISION HISTORY
     Written by Lisa Poyneer at some point.

zeroall

pro zeroall

NAME:
     zeroall

PURPOSE:
     Puts TT/Wfr/Twt at 0V


CALLING SEQUENCE:
     zeroall

INPUT/OUTPUT:
     none



OPTIONAL OUTPUT:
     None.

EXAMPLES:

DEPENDENCIES:


NOTES:

REVISION HISTORY
     Written by Lisa Poyneer at some point.

Table Of Contents

Previous topic

Troubleshooting the AOC

Next topic

Configuration Functions

This Page