TRS Queries

The telemetry recorder/server (TRS) records all the WFC parameters and the WFC output quantities for every frame, except the raw pixel data which is available decimated to 100 Hz. This page describes how this data can be accessed.

Reference and documentation for TRS

TRS for Operations

  • There is a UNIX command to check how much TRS disk space has been filled: checktrsDiskSpace.
  • The AO keyword TRSREC is used to turn telemetry recording on and off:
    • TRSREC=0: Nothing is logged
    • TRSREC=1: WFC configuration is logged
    • TRSREC=7: WFC configuration and all telemetry is logged.
    TRSREC should never be set to 0! You can use MAORI → WFC to switch TRSREC between 1 (OFF) and 7 (ON).
  • TRS recording does not need to be on in order to access TRS data. The aoacq widget turns TRS recording on whenever a star is acquired. So TRS is basically on all night. End of night script turns it off.
  • One of the requirements for the AO system was that it must be able to run properly even if the TRS is not working. The non-essential tools that rely on TRS recording are the following:
    • Archiver in AO acquisition widget: aoacq
    • Optimization (bandwidth) widget: bw_widget
    • Seeing monitor: logseeing
    • Atmospheric characterization GUI: atmogui
    • Wavefront sensor camera display: rawimdisp
    • Deformable mirror voltage command display: dmdisp
    • DM temporal power spectrum display: wobble

Saving data to k1aoserver or k2aoserver

Often, we wish to save data to be analyzed either immediately and/or at a later time:

  1. Turn TRS recording ON
  2. cdn
  3. idl
  4. IDL> diagsetup or use bw_widget for residual wavefront data. The data is stored in the nightly directory.
To read and manipulate the data, do the following:
  1. IDL> restore, 'diag0.sav' or whatever the filename is
  2. IDL> help
  3. IDL> help, trsdata, /struct

Arbitrary TRS queries

For reference:
Examples and notes for TRS queries have been made available in ~k2obsao/trsScripts/. See also the IDL tools that are querying, sorting and analysing the telemetry.

Often, you will want to write your own query to collect arbitrary data at an arbitrary time. It is fairly straight forward to write your own query in IDL. The syntax for the queries is

IDL> a=trsquery(timestamp,samples,table,columns,cond=">=")
e.g.,
IDL> a=trsquery(-1,100,'ffb','timestamp','offsetcentroids','dmcommand')
or
IDL> a=trsquery('2007-Oct-19T011:30:01.0',1,'dfb','timestamp','rawpixel')

There are two formats for the timestamps: one is an integer that represents the number of hundreds of nanoseconds since the start of the year, or something like that. The other is a string containing the UTC date and time in ISO format. The command
IDL> b=trstimestamp(a.timestamp)
is used to convert from one timestamp format to another (e.g., 10^-7 seconds to a string).

Queries in recent past are cached and are obtained much faster than queries in the more distant past.

The tables are:
ffb dfb strap configuration nonrtc

The columns for each table are listed below:

ffb:
buffertype, recordlength, timestamp, framecounter, subapintensity, offsetcentroid, residualwavefront, dmcommand, dmcommandsclipped, residualrms, conf_id, ttcommands, ttstraingauge, ttcommandsclipped

dfb:
buffertype, recordlength, timestamp, framecounter, rawpixel, rawpixelsize

strap:
timestamp, framecounter, conf_id, apdcounts, dttcentroids, dttcommands, dttstraingauge, dttcommandsclipped

configuration:
conf_id, par_id, par_val

The residualwavefront column contains 352 elements, which represents the 352 rows of the output of the matrix multiplication between the reconstructor and the offset centroids. The elements 0:348 are the residual "DM voltages", 349:350 are the residual tip-tilt (in arcsec) and 351 is the focus term, used for open loop focus offloading.

The nonrtc column is currently empty, but can be upgraded to include non-WFC parameters, such as the OBS state, certain DCS keywords or parameters that are not stored in the Microgate WFC, such as frame rate or filenames.

Saving the WFC configuration

The current WFC configuration can be saved using an IDL command, saveconfig. IDL> saveconfig, 'strangeimages.cfg'
This command also saves non-WFC parameters as an IDL save file, strangeimages.sav. To read the configuration, use the IDL function readconfig:
IDL> config=readconfig('strangeimages.cfg')
IDL> help, config, /structure
The configuration, including the non-WFC parameters, can also be loaded at a later time using
IDL> loadconfig, 'strangeimages.cfg'

Configuration ID queries

The TRS can be used to determine the internal state of the WFC, either now or at any time in the past. For example, to determine whether the CLMP is closed now, do
IDL> trsdata=trsquery(-1,1,'ffb','timestamp')
IDL> PRINT, trsdata.timestamp
IDL> 109744732588147
IDL> a=trsquery("select conf_id from configuration where conf_id=ts2conf(109744732588147) ",/sqlstmt)
IDL> PRINT, a.config_id
IDL> 43777665
IDL> b=trsqueryconfig(196623,43777665)
Sometimes, this query will fail because of incorrect data type problems (I think). Please run the query again, and if it does not work then restart IDL and run the query again. The parameter ID for the CLMP in the configuration table is 196623, as can be seen in the table below.

Parameter ID for the Configuration Table

subaperture_size65537
background65539
flat_field_image65541
min_sub_flux65543
centroid_arcsec65545
centroid_origin65547
avg_sub_flux65549
den_free_centroid65551
wfs_temp65553
wfs_program65555
wfs_repetition_n65557
wfs_bias65559
wfs_gain65561
wfs_filter65563
wfs_ascii_cmd65566
subaperture_nr65568
ccd_lut65570
raw_pixel_nr65572
dm_focus_modal65574
reconstruction_matrix131073
dm_servo_coeffs 131075
dm_origin 131077
dm_loop131079
dm_limit131081
dm_actuator_map 131083
tt_sensor_input196609
dtt_offset196611
dtt_servo_coeffs196613
dtt_angular_offset196615
dtt_disturbance_data196617
dtt_disturbance196619
dtt_servo_loop196621
dtt_clmp_loop196623
dtt_clmp_rec_matrix196625
dtt_clmp_servo_coeffs196627
dtt_limit196629
strap_use262145
apd_avg_sub_flux262147
apd_den_free_centroid262149
apd_sky_background262151
apd_flux_threshold262153
apd_interaction_matrix262155
utt_offset327681
utt_servo_coeffs327683
utt_angular_offset327685
utt_disturbance_data327687
utt_disturbance327689
utt_servo_loop327691
utt_clmp_loop327693
utt_clmp_rec_matrix327695
utt_clmp_servo_coeffs327697
utt_limit327699
utt_rotation_angle327701
utt_fixed_act327703
avg_interval_cont393217
avg_interval_dem393220
debug_mgp458755
operating_mode458757
trs_recording458761
watchdog458765
chop_parameters524289
chop524291
chop_offset524293


.