.. include:: references.rst ================================ SKA Telemetry Archive Tutorial ================================ Overview -------- This document gives a tutorial introduction to the SKA Telemetry Archive (also known as the thermal database), including basic configuration and a number of examples. The telemetry archive consists of: * Tools to ingest and compress telemetry from the CXC Chandra archive. * Compressed telemetry files for data relevant to thermal, aspect, science instrument, and other spacecraft subsystems. These are FITS format files. * Observation summary SQL database (as a single SQLite3 file). * A tool to retrieve telemetry values. Configure to use the archive ----------------------------- To set up and to use the archive it is best to start with a "clean" environment by opening a new terminal window. It is assumed you are using ``csh`` or ``tcsh``. There are several ways that one can set up to use the archive, but the steps below are one simple way that will probably work for most users. In most cases in this tutorial the highlighted text (in gray boxes) can be cut-n-pasted directly into the terminal window. From a 32-bit linux machine, go to a directory where you intend to do archive-related analysis and create a working directory:: cd ~/my_working_area # for example.. mkdir thermal_work cd thermal_work The actual name ``thermal_work`` is not important. Next, create links to the archive retrieval script ``fetch`` and the observation SQL database ``db.sql3``:: # On the HEAD LAN setenv SKA /proj/sot/ska # # On the OCC Greta LAN setenv SKA /home/SOT/ska # # Make links ln -s $SKA/bin/fetch ./ ln -s $SKA/data/telem_archive/db.sql3 ./ Basic Functionality Test ---------------------------------------------- To test the basic functionality of your setup, try the following to get a short summary of the available command line options for the main archive retrieval script:: ./fetch --help Remember that this assumes you are in the ``thermal_work`` directory that was created in the initial setup. Depending on the way your PATH environment variable is set, you might not need the './' before the ``fetch`` command. Next try to get some actual data:: ./fetch --start 2006:329:23:00:00 --stop 2006:329:23:04:00 ephin2eng: You should see:: date,5ephint,5eiot,quality 2006:329:23:00:00.000,104.544090271,137.819366455,0 2006:329:23:00:32.790,104.544090271,137.819366455,0 2006:329:23:01:05.590,104.544090271,137.819366455,0 2006:329:23:01:38.390,104.544090271,137.819366455,0 2006:329:23:02:11.190,104.544090271,137.819366455,0 2006:329:23:02:44.000,104.544090271,137.819366455,0 2006:329:23:03:16.800,104.544090271,137.819366455,0 2006:329:23:03:49.600,104.544090271,137.819366455,0 Next try out the observation database:: sqlite3 db.sql3 You should get the SQLite interactive query tool prompt like ``sqlite>``. Now try to find the number of ACIS CCDs that were on for observations in a certain date range:: select obsid, kalman_datestart, kalman_datestop, num_ccd_on from observations where kalman_datestart > '2007:113' and kalman_datestop < '2007:116' order by kalman_datestart ; You should see:: sqlite> select obsid, kalman_datestart, kalman_datestop, num_ccd_on from observations ...> where kalman_datestart > '2007:113' ...> and kalman_datestop < '2007:116' ...> order by kalman_datestart ; 7606|2007:113:01:58:21.456|2007:113:02:05:11.456|6 7639|2007:113:23:02:15.060|2007:114:09:11:58.337|4 58424|2007:114:16:07:47.863|2007:114:17:41:37.163|6 58423|2007:114:19:46:27.863|2007:114:20:07:59.364|0 58422|2007:114:23:25:07.864|2007:115:02:33:17.215|6 8005|2007:115:11:33:17.466|2007:115:11:56:08.916|6 7790|2007:115:13:22:37.466|2007:115:13:40:43.967|1 Fetch: Basics and Examples ---------------------------------------------- The main tool for extracting telemetry data from the archive is the python script ``fetch``. Based on the directives given via the command line, ``fetch`` will output an ASCII table of telemetry values at a uniformly spaced time sampling. The basic syntax for calling ``fetch`` is:: fetch [options] table_col_spec1 [table_col_spec2 ...] ``Table_col_spec`` is a table column specifier that specifies one or more columns (MSIDs) within the `telemetry archive tables`_. The allowed formats are::