%%%
%%% $Header:
%%%  
%%% It can be processed with the commands:
%%%   latex ReqSpec.tex
%%%   dvips -O 0in,-1in ReqSpec.dvi -o ReqSpec.ps
%%%   latex2html -dir ./ReqSpec -html_version 3.0 -split +1 -link 0 ReqSpec.tex


%%% ------------------------------------------
%%% Preliminary stuff - NOTHING TO EDIT
%%%
   \documentclass[12pt,a4paper]{article}
%
   \usepackage{makeidx}
   \usepackage{graphicx}
   \usepackage{ifthen}
   \usepackage{html}
   \include{gildas-def}
%
   \pagestyle{headings}
%
   \makeindex
%
   \addtolength{\textwidth}{20mm}
   \addtolength{\textheight}{10mm}
   \addtolength{\oddsidemargin}{-10mm}
   \addtolength{\evensidemargin}{0mm}
   \setlength{\marginparwidth}{20mm}
   \setlength{\marginparsep}{5mm}
   \addtolength{\topskip}{-30mm}

%%% ----------------------------------------------
%%% control over included parts -- EDIT or delete!
%%%
% \includeonly{Part1}


%%% -------------------------------------
%%% macro definitions  -- EDIT or delete!
%%%
% \input max.tex


%%%                          ******************************************
%%% stuff for title page     |-->EDIT-the right column!
%%%                          |
\newcommand{\versionText}    {}
\newcommand{\versionNumber}  {,v 2.3}
%
\newcommand{\TheTitle}{MIRA Manual - v. 2.3}
\title{\TheTitle}
\author                      {Helmut Wiesemeyer}
%


%%% ------------------------------------
%%% Start of document -- NOTHING TO EDIT
%%%
\thispagestyle{empty}
\begin{document}

\newsavebox{\savepar}
\newenvironment{boxit}{\begin{lrbox}{\savepar}
   \begin{minipage}[b]{\textwidth}}
  {\end{minipage}\end{lrbox}\fbox{\usebox{\savepar}}}

%%% -----------------------------------------------------------------------------
%%% HTML: links to Main and Links pages for project -- NOTHING TO EDIT
%%%
\begin{rawhtml}
 <A HREF="../../Main.html"  TARGET="_top"> Up to: Future Control System 30-m Main Page </A> <BR>
 <A HREF="../../Links.html" TARGET="_top"> Up to: Future Control System 30-m Links     </A> <BR>
\end{rawhtml}


%%% ----------------------------------------------------
%%% LaTeX and HTML: produce the Title -- NOTHING TO EDIT
%%%
\begin{latexonly}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\vspace*{\stretch{1}}
\noindent
\HRule
\begin{flushright}
\Huge{\TheTitle}
\end{flushright}
\HRule
\end{latexonly}
%%%
\begin{htmlonly}
\maketitle
\end{htmlonly}
%%%
\vspace*{\stretch{1}}


%%%                                *******************************************************
%%% standard fields for title page |--EDIT-the-right-column!
%%%
\begin{flushleft}
{\bf Identifier - Master URL:} \htmladdnormallink{http://www.iram.fr/}{ } \\

{\bf Revision:}                    miraManual.html\versionText \versionNumber   \\
{\bf Date:}                        2010-05-20                                 \\
{\bf Author:}                      Helmut Wiesemeyer 
\htmladdnormallink
                                  {(email: wiesemey@iram.fr)}
                                   {mailto:wiesemey@iram.fr}                                 \\
{\bf Contributors:}                A. Sievers, H. Ungerechts, C. Thum,
                                   K. Schuster, G. Paubert, W. Brunswig, \\ 
                                   J. Pety, P. Hily-Blant, the MBFITS 
                                   working group \\
{\bf Audience:}                    everybody involved with raw data reduction
				   at the 30m telescope \\
{\bf Publisher:}                   IRAM, Grenoble                             \\
{\bf Subject and Keywords:}        raw data, calibration, 30m telescope \\

%
\end{flushleft}
%
\vspace*{\stretch{1}}
%%% ---------------------------------------
%%% Description of document 
%%%
\noindent
{\bf Description - about this document:} \\
%%%
%%% *************************************************************
%%% - EDIT following text!!
%%%
This manual describes MIRA, a {\bf M}ultichannel {\bf I}maging and Calibration 
Software for {\bf R}eceiver {\bf A}rrays. MIRA succeeds OTFCAL for the 
calibration of the new IMBFITS raw data at the 30m telescope. 
%
\vspace*{\stretch{1}}


%%%                                       **********************************
%%% HTML: reference to Postscript version |--> EDIT file name in reference!!
%%%
\begin{rawhtml}            <A HREF="../report.ps"> 
PostScript version</A> of this document.
\end{rawhtml}

%%%                       *******************************************************
%%% LaTeX& HTML: 
%%% related documents     |-->EDIT-right-column!
%%%
\noindent
{\bf Related documents:}
\\
\noindent
\htmladdnormallink 
{http://www.iram.fr/IRAMFR/GILDAS/}{ }

%\begin{flushleft}
%
%{\bf Affiliations:}                ...                                                 \\
%{\bf Addresses:}                   ...                                                 \\
%
%\end{flushleft}

%%% ----------------------------------------------------------
%%% End of title page and table of contents -- NOTHING TO EDIT
%%%
\vspace*{\stretch{2}}
%
\newpage
%\tableofcontents
%\newpage


%%% *******************************************
%%% The body of the document text starts here: 
%%% EDIT THE FOLLOWING TEXT!

\section{Preface}

MIRA as in the current version is still under development. Parts of its 
capabilities depend on the work done for other program libraries (CLASS90, 
TELCAL, PAKO). Comments and suggestions from users are welcome, and will be a 
valuable tool to further improve MIRA. 

MIRA in its current version is exclusively used to reduce data written in the 
new IMBFITS raw data format. For old raw data, the old data processing software
(OTFCAL) will be kept and maintained.

As soon as MIRA is fully integrated into as the standard heterodyne data 
processing software for the new control system, it will further evolve to
provide tools for imaging with heterodyne receiver arrays.

This is a summary of recent changes in MIRA:

~\\[1.5ex]\noindent{\bf Version 1.1}
\begin{itemize}

\item For online data processing, a prototypical procedure 
\verb+mira_pro:reduce.mira+ has been commited to the CVS.

\item New default for \verb+MIRA\CAL+: the calibration parameters of {\it all}
frontend-backend combinations are computed.

\item Output message formats for \verb+MIRA\SCAN+ changed.

\item Calibration parameters are already computed and issued when a 
chopper-wheel calibration is loaded. For spectrometers with several basebands, 
mean values are given (for basebands belonging to the same spectrum).

\item Command syntax for \verb+MIRA\VIEW+ changed to \\
\verb+MIRA\VIEW [ifb] [/CAL] [/GAINS] [/PHASES] [/SIGNAL] [/MAP]+ \\
Useful defaults are provided.

\item Command syntax for \verb+MIRA\SOLVE [pointing|focus] [ifb]+ changed to 
\verb+MIRA\SOLVE [ifb]+. Whether a pointing is to be solved or a focus is 
automatically determined from the observing procedure of the current scan.

\item MIRA commands using the SIC macros in \verb+mira_pro:p_plot_*.mira+ can 
now be retrieved from SIC's command stack (concerns \verb+MIRA\SOLVE+ and 
\verb+MIRA\VIEW+).

\item \verb+MIRA\SOLVE+: for pointings, the execution can be halted after the 
subscan fits with QUIT.

\item MIRA command FIND has a new option \verb+ FIND /NEW+ (for online data 
processing). Only new data are put into the index list. If no new data are 
found, the index list remains unchanged.

\item Lists of MIRA commands FIND and LIST: by default, a "short" list is 
provided (without frontend names and spectral lines). The previous "long" list
can be retrieved with the new option \verb+LIST /LONG+. The telescope name is 
suppressed in any case. Note that the scan number is now listed in the first 
column, and the observation number in the last one.

\item The information is the current index list can now be retrieved from the 
new SIC structure list (type \verb+\MIRA\VARIABLE LIST r+).

\item Support of old raw data abandoned.

\end{itemize}

~\\[1.5ex]\noindent{\bf Version 1.2}
\begin{itemize}
\item Default for MIRA command CAL is now the first frontend-backend 
combination. If all frontend-backend combinations are to be calibrated, the 
argument ALL has to be specified, i.e. CAL ALL [/...options].

\item The option /OFF of MIRA command CAL now offers several modi for the 
subtraction of the reference signal in OTF maps with total-power mode. 
The reference signal is either a mean of all off-measurements (option NONE, 
the default), an unweighted mean of the reference measurements taken before and
after the on-measurement, and weighted means (weighting by total power or 
elapsed time). See the MIRA language internal help for more details.

\item MIRA command WRITE, option /FEBE has a new argument: 
\verb+ MIRA\WRITE+ {\it number} \verb+ /FEBE ALL+
writes all frontend-backend combinations into the CLASS output file, starting 
with the observation identification {\it number} (if specified, otherwise 
successively increased by default).
\end{itemize}

~\\[1.5ex]\noindent{\bf Version 1.3}
\begin{itemize}

\item MIRA stability is improved. If, for a given scan, the imbFits file of one
of the backends is faulty, this backend will be ignored in the index list (and
a warning message is issued).

\item The new imbFits keywords \verb+XOFFSET+i and \verb+YOFFSET+i (with 
$i=1$ to $n_{\rm offsets}$, where $n_{\rm offsets}$ is the number of offsets 
from the catalogue position) are accomodated in MIRA's \verb+SCAN%DATA+ section.The resulting offset is in \verb+SCAN%HEADER+.

\item The SIC macro \verb+reduce.mira+ now becomes \verb+reduceCont.mira+ and
\verb+reduceSpec.mira+. See section 2.1 for details.

\item New option \verb+/ZOOM+ for command \verb+MIRA\VIEW+. First the data is 
fully shown, and the interactive cursor is called to define a rectangle to be
zoomed in. The axis labels are correspondingly updated.

\item \verb+MIRA\VIEW /MAP /ZOOM+ can be used to plot a subset of data. In the
subset display, the range of \verb+ON+ positions covered by the subscan(s) is
indicated.

\item \verb+MIRA\CAL+, option \verb+/OFF+: the default weight mode for 
on-the-fly maps is now \verb+AVER+ (taking an average of all available 
off-source subscans). Option \verb+NONE+ does not remove any off-source signal,
but concatenates the spectral basebands.

\item MIRA's SIC variable \verb+ARRAYi\%DATAj\%ISWITCH+ (with \verb+i+
frontend-backend number, \verb+j+ baseband number) now becomes an 
array of character strings (instead of integer flags). See section 5 for 
details.
\end{itemize}

\newpage
~\\[1.5ex]\noindent{\bf Version 1.4}
\begin{itemize}

\item The header information provided by MIRA's command VIEW has been extended.

\item \verb+MIRA\CAL+:  if the setup of the backends used for an observation is
not strictly the same as for the previous (or, for offline data processing, the
subsequent) calibration, MIRA complained about an inconsistent calibration. In 
version 1.4, MIRA looks whether a calibration is available for exactly the same
spectral charactersistics. If so, the calibration is applied, even if the number
of the backend part has changed. If no calibration with the same spectral 
characteristics is available, MIRA issues a warning, and flags those data as 
uncalibrated.

\item Ambigeous scan numbers: it may happen that a raw data directory contains
data from different observing dates, but with the same scan numbers. Until now,
the only way out was to preselect the data in the index list, using 
\verb+FIND /OBSERVED+. Otherwise, MIRA entered into a state of confusion and 
crashed when such a scan was read with \verb+MIRA\SCAN+.
In version 1.4, this is not so anymore: in case of ambigous scan numbers, the 
user is asked to enter the desired observing date (if nothing is entered, 
\verb+MIRA\SCAN+ returns to the command prompt, allowing to opt for the 
solution using \verb+FIND /OBSERVED+.

\item The pause between pointing solutions by subscans and coadded subscans, 
respectively, makes automatic online data processing impossible, since MIRA
waits for the use to type \verb+continue+. So, the pause was switched off in 
version 1.3. In version 1.4, it can be activated using MIRA's logical flag 
\verb+doPause+ (yes or .true. for interactive offline MIRA sessions, if the 
user wants to have a close look at the pointing subscans).

\item Sometimes there are still spikes in the pointings (although usually lower than or comparable to the signal). MIRA's despiking routine works best after 
calibration, and the spikes get attributed a blanking value. Therefore, the 
\verb+MIRA\SOLVE+ command has been upgraded to correctly handle blanked values
for either backend counts or equivalent temperature scales.

\item slight syntax change for \verb+MIRA\VIEW /PHASE idPhase irec+.
 \verb+idPhase+ can be one of the character strings 
\verb+ ON, OFF, LOAD, SKY, HOT, COLD, FLO, FHI+. The specified phase is 
averaged across the whole scan, unless a special record is specified with 
\verb+irec+.

\item If a backend part is disconnected, keeping the others, MIRA will work 
even if there will be a "hole" in the associated frontend-backend numbers
(e.g. using VESPA parts 1, 3 and 4). Not yet tested for more than one backend
part lacking.

\end{itemize}

\newpage
~\\[1.5ex]\noindent{\bf Version 1.5}
\begin{itemize}

\item The procedure for online data processing is now called 
onlineDataProcessing.mira. It can be called by
\\ 
\verb+mira.exe @onlineDataProcessing projId scan obsDate calScan obsDateCal+
\\
where \verb+projId+ is the Pico Veleta project id (e.g. 203-04), \verb+scan+ 
the scan number to be reduced, \verb+obsDate+ the corresponding observing date
(format yyymmdd), \verb+calScan+ the scan number of the calibration scan (may
be 0 if no calibration is to be done), and \verb+obsDateCal+ the observing date 
of the calibration scan (can be different from \verb+obsDate+). The MIRA SIC 
procedures \verb+reduceSpec.mira+ and \verb+reduceCont.mira+ are obsolete.

\item \verb+MIRA\SCAN+ has a new option \verb+/TRACKING trackingError+. If 
specified, all backend data with azimuth or elevation tracking errors larger 
than \verb+trackingError+ are flagged, i.e. attributed the blanking value for
raw data.

\item In VESPA polarimetry mode, the fourth subscan of the paKo command 
\verb+CAL /GRID+ is plotted in blue.
\end{itemize}

~\\[1.5ex]\noindent{\bf Version 1.6}
\begin{itemize}

\item MIRA commands \verb+VIEW+, \verb+CAL+ and \verb+WRITE+ have new options
for HERA pixels. See online help for details.

\item MIRA command \verb+FIND+ is too slow for online data processing if used 
for large data archives. There are two solutions: either use \verb+SCAN+ 
without a previous \verb+FIND+, or at least one of the following 
options: \verb+FIND /OBSERVED yyyy-mm-dd+, \verb+/SCAN+, \verb+/BACKEND+
(\verb+FIND /SCAN+ is fastest).

\item You {\it do not need} to use \verb+FIND+ to load a scan ! MIRA command 
\verb+SCAN+ loads a scan, even if no index list exists. In case the scan number
is ambigeous, MIRA takes by default the last observing date found (otherwise 
you have to use \verb+FIND /OBSERVED+). See the online help for details.

\item There is a new utility procedure, \verb+odp.mira+. It essentially does
the same job as the online data processing triggered by the NCS coordinator,
but is more interactive. Use: \verb+@ odp iRef idScan+, where \verb+iRef+ is 
the frontend-backend combination to be used for pointings and focus solutions,
and \verb+idScan+ is the scan to be reduced. The output CLASS file is called 
spectra.30m, in order to avoid confusion with spectraOdp.30m (produced by the
coordinator).

\item Large data sets with too short a dump time (e.g. frequency switched 
on-the-fly maps) can be compressed within MIRA with the new option
\verb+/COMPRESS+ for command \verb+SCAN+ (see MIRA language help).

\item For calibration measurements without sky counts, MIRA now issues the 
receiver temperature(s).

\end{itemize}

\newpage

~\\[1.5ex]\noindent{\bf Version 1.7}
\begin{itemize}

\item After extensive testing with the G95 compiler, all memory leaks within 
MIRA have been removed.

\item Under certain weather conditions, TelCal is not very tolerant regarding 
inaccurate calibration parameters (e.g. forward efficiency, 
cold load temperature). The new command \verb+MIRA\OVERRIDE+ allows to 
manually set the load temperatures and beam and forward efficiencies to values
different from the entries in the imbFits raw data file. For details, please 
read the MIRA language internal help. 

\item The cookbook section now contains a subsection on OTF and HERA data 
reduction, and another on the reduction of polarisation data. 

\item Pointing fits now also display the fitted width and peak flux of the 
Gaussian. Pointing corrections: both the previous and new corrections are 
displayed.

\item Thanks to recent developments in the telcal library (pety@iram.fr), double
beam fits for pointings using the wobbler are now supported.

\item Baselines for pointing drifts are now fitted simultaneously with the 
Gaussian. The baseline determined by MIRA (using dumps without the source
signal) is used as an initial guess.

\item CLASS output files get the default extension \verb+.30m+

\item For pointing drifts, all subscans are now written to the CLASS output file
(i.e. option \verb+WRITE /SUBSCAN+ is not needed anymore). See the MIRA 
language internal help, comand \verb+MIRA\WRITE+, for details.

\item For XPOL observations (VESPA in polarimetry mode), MIRA can calibrate
phases. The XPOL widgets for CLASS know whether MIRA has done a phase 
calibration (CLASS header variable \verb+CMODE = 10+) or not
(\verb+CMODE = 0+). See the MIRA language internal help, command 
\verb+MIRA\CAL+, for details.

\item Command \verb+MIRA\VIEW+ gets a new option \verb+/XPOL+ for viewing
the amplitude and phase of the cross correlation of orthogonally polarized 
receivers (for VESPA data in XPOL mode).

\item The SIC structure \verb+LIST+ has been simplified:
the structure \verb+LIST%ATTRIBUTE1+ becomes \verb+LIST1+, 
\verb+LIST%ATTRIBUTE2+ becomes \verb+LIST2+ etc. For details see section
5.2.11.

\item There is now one MONITOR section per frontend-backend combination, 
allowing to accomodate monitor data points that are specific for a given 
frontend. For details, see section 5.2.6. 

\item \verb+VIEW /CAL+ now also issues the calibration and weather parameters
on the GREG display (so they become visible even if MIRA is used in automatic
mode in the background). For HERA data, these parameters are only displayed if
option \verb+ VIEW /CAL /PIXEL+ is used (otherwise the plots are overcharged).

\end{itemize}

\newpage

~\\[1.5ex]\noindent{\bf Version 1.8}
\begin{itemize}

\item Removed a bug: now more than 9 simultaneous frontend-backend combinations
allowd.
\item Command \verb+FIND /NEW+ now behaves differently: if new data are found,
they are appended to the index list (if existing). This allos to load scans 
that are not in the index list, but whose data files are already written to 
disk (i.e. avoids a new FIND command in order to get those data).

\item New option \verb+/SHOW+ for MIRA command \verb+FILE+: \verb+FILE /SHOW+
displays the names of the current input and output files (if openend, otherwise 
a warning message is issued).

\item Calibrations of the sideband ratio are now automatically evaluated when 
MIRA reads in a corresponding scan. The resulting gain image may then be used
for further calibration by using the new keyword \verb+GAIN[IMAGE]+ for MIRA 
command \verb+OVERRIDE+.

\item On-offs with the continuum backend, when displayed with
\verb+VIEW /PHASE+, yield the flux and its error. A baseline linearly depending
on elapsed time is automatically fitted by MIRA at the on-off subtraction of
\verb+MIRA\CAL+.

\item MIRA now solves skydips.

\item Format of backend data becomes dynamic: integer, single or double 
precision floating point count rates, according to the TFORM3 keyword in the 
imbFits backend HDU.

\item New options \verb+/PROJECT+ and \verb+/STAT+ for command \verb+MIRA\FIND+,
for selecting data from one or several projects, and for writing the total
integration time of the observtions of the current index list into a hidden file .stat. 
Mainly for observing pool administration. \verb+LIST /PROJECT+ includes the 
project number into the index list.

\item Calibrations with less then 3 subscans (i.e. from \verb+PAKO\CAL /SKY NO+
are also plotted, and relevant calibration parameters are indicated on MIRA's
graphical display.

\item For image gain calibrations of continuum backends, the data are plotted 
by subscan. For spectrometers, the image gain vs. frequency is shown.

\item Command \verb+LIST /REDUCE+ write a procedure for off-line data reduction, instead
of listing the data. For details see the MIRA language documentation.

\item Option \verb+/MASK+ for command \verb+CAL /OFF+ also uses the OTF dumps as 
reference (masking the source). Works with OTF maps sufficiently exceeding the 
emission region.

\item New option \verb+/TAU+ for command \verb+SCAN+. For calibration scans
only. Allows to keep the opacity fixed and calculates the corresponding 
atmospheric model (instead of computing that corresponding to the measured
sky emission temperature). Mainly used for skydips (see next item).

\item Skydips are now solved by a two-step procedure: First, fit \verb#totalPower = a.[1-exp(-tauZenith.airMass)]+b# with fit parameters \verb+a+ and 
\verb+tauZenith+. Then calibrate the skydip with the atmospheric model 
corresponding to the measured zenith opacity, and derive the forward
efficiency from the fit parameters \verb+a+ and \verb+b+.

\item New option \verb+/TRACES+ for command \verb+VIEW+ for visualizing the
antenna speed, fast and slow traces. For identifying bad antenna data.

\end{itemize}

\newpage

\noindent{\bf Version 1.9}
\begin{itemize}

\item \verb+OVERRIDE+ now allows to set the calibration parameters once for a
whole MIRA session, until \verb+OVERRIDE /RESET+. After reset, a new
calibration has to be read.

\item \verb+VIEW /TRACES+ now also shows the antenna mount drive dumps between
the subscans (the previous versions only showed those data actually used for 
interpolation to the backend record times). To this end, a new structure has 
been created that can be examined and visualized via its SIC copy in 
\verb+ANTENNA%ENCODER_AZ_EL+ (encoder values for azimuth, elevation and their 
timestamp) and \verb+ANTENNA%TRACKING_AZ_EL+ (tracking errors).

\item New parameter \verb+calCheck+ (logical SIC variable) can be used to 
switch off the consistency check for an observation and its associated 
calibration measurement (default: \verb+.true.+). Use 
\verb+let calCheck .false.+ if you connect more than one part of the same 
backend to the same receiver, with identical spectral setup. With
\verb+let calCheck = .true.\+, MIRA tries to find for an observation the 
corresponding spectral backend part in the calibration data, even if its number
has changed (e.g. because a backend part was dropped between the calibration and
observation).

\item In this context, \verb+ CAL ifb /FEBECAL jfb+ allows the user to calibrate
the frontend-backend unit ifb with the channel gains and calibration temperature
of frontend-backend unit jfb (for particular circumstances only, e.g.
inconsistent calibrations).

\item For pointings, \verb+SOLVE ifb  jfb+ computes the alignment of frontend
\verb+jfb+ with respect to frontend \verb+ifb+, and writes the results into
an ASCII file {\it alignment.dat} (or appends them to it, if existing).
The receiver alignment is computed from fits to the difference signal (rather
from the differences between fit signals). The results are plotted for a
Nasmyth focus cabin.

\item Calibrations with switch mode \verb+FREQUENCY+ are supported, but still
experimental. Please contact the author for further enquiries.

\item New command \verb+FLAG+ allows to flag selected basebands, channels,
HERA pixels, records or subscans (e.g. to solve pointings with a bad subscan) .

\item New option \verb+LIST /FLUX+ prepares an ASCII table with pointing fluxes
in the current index list (calibrated in Ta* if the index list contains
calibrations).

\item Calibration parameters can be stored in an XML file if \verb+writeXML+ is
set: \verb+let writeXML yes+.

\end{itemize}
\noindent{From version 1.93 to 1.95:}

\begin{itemize}

\item fix atmospheric water vapour content for calibration:
\verb+scan /pwv value+. Preparations for EMIR nomenclature.

\item Observing mode DIY (OTF along Lissajous figures) 
now allowed. Plot figures with VIEW /OTF. 

\item Plot limits for tracking errors (command VIEW /TRACES) are variable.
This is to suppress visualization of data with too large tracking errors
(e.g. while telescope is slewing).

\item Skyslews can be read by MIRA and plotted. Fitting opacity and forward
efficiency still needs to be developed.

\item Doppler correction sign changed on 2008-10-29, to $d = -v_{\rm obs}/c$ where
$d$ is the Doppler correction (CLASS variable \verb+DOPPLER+ in the spectroscopy
section, and $v_{\rm obs}$ the observatory velocity with respect to the local standard
of rest ($>0$ if the observator recedes from the LSR).

\item Command \verb+list /flux argument+ produces an ASCII output file with
continuum fluxes (where argument is the backend name, e.g. 1MHz). \verb+list /flux+
deduces pointing fluxes, using the continuum backends, as before.

\item Command \verb+cal /off /mask+ now also works with option
\verb+ /off time+. Syntax for \verb+ /mask d1 [d2 d3 d4 ...]+ has changed:
if only argument d1 is given, this is the number of OTF dumps at the start and
end of each OTF subscan used as atmospheric refernce. If (d1,d2), (d3,d4), etc.
are given pairwise this is to indicate the respective first and last OTF dump
framing the source (up to 5 masks allowed, i.e. 10 arguments).


\end{itemize}

\noindent{\bf Version 2.0}
\begin{itemize}
\item Support for the new EMIR receiver.
\item It is now possible to write calibrated total power data to CLASS.
      Please use:\\
      \verb+cal all /gains /off none /tcal+
\item It is possible to concatenate spectral subbands for plotting. Command
syntax: \verb+VIEW ifb1 ifb2+ for concatenating subbands \verb+ifb1, ifb2+, or
\verb+ VIEW ifb1 to ifb2+ for concatenating all subbands between \verb+ifb1+ 
and \verb+ifb2+.
\item The following parameter can now be set in interactive mode:
\verb+badLevel+, this is the level with respect to median total power at which
spectral channels are blanked, default: factor 20 above or below median).
\item For continuum observations, the behaviour of 
\verb+ view ifb /phase iphase+ now is the following: \verb+iphase = 1, 2,...+
shows only total power phase \verb+iphase+. For one of \verb+iphase = on, off+
(for continuum on-offs) or \verb+iphase = sky, load+ (for beam-switched
scans) \verb+iphase+ is the leading phase in the signal difference.
\item \verb+MIRA\override+ now also allows us to change the weather data (e.g.
if the weather stations fails and if wrong weather data are written into the
imbfits files). Use: \verb+override tamb[_p_humid] Tamb Pamb+ where \verb+Tamb+
and \verb+Pamb+ are the values for the ambient outside temperature and
pressure ($^\circ$~C and hPa, respectively) e.g. measured by hand
or \verb+*+ to remain unchanged).
\item From 2009-06-17 11:00 UTC onwards, all CLASS spectra written with Mira versions
under gildas installations \verb+gag_dev+ and \verb+gag_may09+ at the 30m telescope are written with
the following convention: \verb+doppler = -vSource(Obs)/clight+, where \verb+vSource(Obs)+
is the source velocity in the observatory frame, in the same sign convention as in Astro
(vSource(Obs) < 0 for source approaching observatory).
\end{itemize}

\noindent{\bf Version 2.1}
\begin{itemize}
\item The parameter \verb+flagBSwSpikes+ allows to automatically blank spikes with abnormally
short integration times (shorter than actual values, hence normalization wrong,
resulting in spikes). Default: .false. (works both for old and EMIR data).
\item In the SIC variable section RAW, subsection ANTENNA, the new variables \verb+dateObs+
and \verb+dateEnd+ are the start and end times of a given subscan, as written into the imbfits
raw data (i.e., unlike \verb+subScanStart+ and \verb+subScanEnd+, not filtered by the safeguards
in Mira's subroutine syncData).
\item If \verb+CAL /off NONE+ was specified, \verb+MIRA\WRITE+ writes both
on-source and reference spectra to the output CLASS file.
\item New parameter \verb+timingCheck+ (logical flag, default: yes). Allows to switch off the 
automatic avoidance of hazardous extrapolation of antenna trace data). For details see section 5.1.
\end{itemize}

\noindent{\bf Version 2.2}
\begin{itemize}
\item Full support of 64bit processors. Tested with g95 and ifort compilers on Debian v. 5.0.3.
\item Support of data reduction of incomplete imbfits files (i.e., by subscan), except for focus
and skydip scans. NB: Currently WILMA and VESPA data are written to imbfits output only at scan
end.
\item New parameter \verb+traceExtrapolation+ (logical flag, default: yes). Only for \verb+timingCheck = no+.
Enables extrapolation of fast and slow traces before or after scan start, respectively end, and points
in time that still contain valid backend data. For details see section 5.1.
\end{itemize}

\noindent{\bf Version 2.3}
\begin{itemize}
\item Data reduction by subscan (pointings, on-off measurements, on-the-fly maps) is now fully supported
(for backends whose raw data are written subscanwise).
\item New option \verb+/BACKEND+ for \verb+MIRA\SCAN+ select backends from index list for reading and
further processing (default: all backends). \verb+/DROP+ drops the selected backends from the list of
data to be read and processed.
\end{itemize}

\newpage

\section{MIRA online use}
This section previously contained first thoughts how MIRA can be integrated in
an online data processing scheme for visualizing and writing calibrated data.
MIRA now has a procedure \verb+onlineDataProcessing.mira+, which is called by
the NCS coordinator (via a Python script) in the following way:
\begin{verbatim}
mira.exe @onlineDataProcessing projId scan obsDate calScan obsDateCal
\end{verbatim}
where \verb+projId+ is the Pico Veleta project id (e.g. 203-04), \verb+scan+
the scan number to be reduced, \verb+obsDate+ the corresponding observing date
(format yyymmdd), \verb+calScan+ the scan number of the calibration scan, and
\verb+obsDateCal+ the observing date of the calibration scan (can be different
from \verb+obsDate+). MIRA now allows to use two global SIC variables,
\verb+ncsData+ and \verb+visData+, in order to specify where the raw data
are located, and where the plots, XML result files and CLASS spectra should be
put. The procedure \verb+onlineDataProcessing.mira+ sets these variables to
\begin{verbatim}
ncsData = /ncsServer/mrt/ncs/data
visData = /vis/203-04
\end{verbatim}
The raw data are searched in \verb+$ncsData/yyyymmdd/scans/+ (where yyyymmdd is
the observing date), the calibrated CLASS file (spectra.30m) for the project is
in \verb+$visData/mira+, the plots are in \verb+$visData/mira/plots+, and the
XML result files (for the time being only for pointing and focus) are in
\verb+$visData/results+. The conventions for the names of plots and result files
are described in the document \verb+http://mrt-lx1/mainWiki/NCSFileStructure+
~\\[1.5ex]\noindent
There is also a new utility procedure, \verb+odp.mira+. It essentially does
the same job as the online data processing triggered by the NCS coordinator,
but is more interactive. Use: 
\begin{verbatim}
@ odp iRef idScan
\end{verbatim}
where \verb+iRef+ is 
the frontend-backend combination to be used for pointings and focus solutions,
and \verb+idScan+ is the scan to be reduced. The output CLASS file is called 
spectra.30m, in order to avoid confusion with spectraOdp.30m (produced by the
coordinator). The results (XML and CLASS files) are in \verb+$HOME/miraOdp+,
the plots in \verb+$HOME/miraOdp/plots+. If the respective directories do not
exist, \verb+odp.mira+ makes them.
~\\[1.5ex]\noindent
An interactive way to generate a CLASS file from a long list of observations is
\begin{verbatim}
list /reduce [reductionScript] [classFile]
\end{verbatim}
which creates a macro 'reductionScript' (default: reduce.mira) whose execution
within your MIRA session (@ reduce) calibrates the data in the current index list
(previously specified with \verb+MIRA\FIND+) and writes them to 'classFile'
(default: mira.30m).
\newpage

\section{A typical (offline) data reduction session}
~\\[3.0ex]
\subsection{Single-pointing observations}
For the sake of a cookbook recipe, here is an example of a MIRA session.
\\[6.0ex]
\begin{tabular}{ll}
\verb+file in "/ncsServer/mrt/ncs/data/2005-04-06"+   
& opens the input directory for reading \\
\verb+file out spectra.30m new + 
& opens output file for calibrated data \\
& (CLASS format by default)  \\
\verb+find /observed 2005-09-06 /scan 5 15 + 
& only puts scans 5 to 15 from September 6 \\
& into the index list. \\
\end{tabular}
~\\[3.0ex]
... and yields the following list (with column 1 - scan number, 
column 2 - object, column 3 - observing procedure, 
column 4 switch mode, column 5 - backend name, column 6 - date of observation, 
column 7 - observation number) :
\\[3.0ex]
\begin{verbatim}
   5 VENUS      calibrat      beamSwitching      CONTI   2005-09-06     1
   6 VENUS      pointing      beamSwitching      CONTI   2005-09-06     2
   9 VENUS      focus         beamSwitching      CONTI   2005-09-06     3
  12 IRC+10216  calibrat      beamSwitching      4MHZ    2005-09-06     4
  13 IRC+10216  onOff         beamSwitching      4MHZ    2005-09-06     5
  14 IRC+10216  calibrat      beamSwitching      4MHZ    2005-09-06     6
  15 IRC+10216  onTheFly      totalPower         4MHZ    2005-09-06     7
\end{verbatim}
~\\[3.0ex]
The same list can be displayed with MIRA command LIST, which also allows to 
write it to an output file and not to the screen (option /OUTPUT), and to issue
information on the frontends connected and spectral lines observed 
(option /LONG).
\\[4.5ex] \noindent
\begin{boxit}
{\bf Tip:} If you search with FIND in a large data archive, the search procedure
becomes slow, since it has to open each individual fits file. Note that FIND
is {\it not} a prerequesite for MIRA command SCAN (see below). You can also
accelerate the search by using at least one of the options /BACKEND, /OBSERVED 
or /SCAN (SCAN will be fastest). 
\end{boxit}
\newpage
A typical data reduction session looks like this:
\\[3.0ex]
\begin{tabular}{ll}
\verb+scan 5 +    
& loads scan 5 (calibration), computes the calibration paramters, \\
& and issues the following information:
\end{tabular}
\begin{verbatim}
  
FeBe Number              Frontend                   Backend
     
     1                     A100                      CONTI
     2                     B100                      CONTI
     3                     A230                      CONTI
     4                     B230                      CONTI
						   
				     
idFe THotLoad TColdLoad idBe  Pix  recTemp sysTemp calTemp tauZenith pwv
     ---- [Kelvin] ----            ------ [Kelvin] -------  [Neper]  [mm]
-------------------------------------------------------------------------
A100  295.199    86.000 CONTI  1     78.60  480.33  228.15    7.29   10.1
B100  295.199    88.000 CONTI  1     39.91  404.02  216.94    7.31   11.9
A230  295.199    86.000 CONTI  1    289.67 1515.64  350.22    0.39    5.6
B230  295.199    86.000 CONTI  1     91.00  800.64  305.18    0.43    6.2

\end{verbatim}
\begin{tabular}{ll}
\verb+scan 6 +    
& loads scan 6 (a pointing on Venus) \\
\end{tabular}
\\[4.5ex] \noindent
\begin{boxit}
{\bf Note:} It may happen that your index list contains observations from 
different days, but with the same scan number. By default, MIRA loads the 
last observation found. If you want to load another observation, you have to 
use option \verb+/OBSERVED+ of command \verb+FIND+.
\end{boxit}
\\[3.0ex]
\begin{tabular}{ll}
\verb+cal all+ 
& corrects all observations in the current scan for gains, \\
& applies the Ta* scale and subtracts off signals.        \\
& N.B. CAL is NOT a prerequisite for solving pointings or foci. \\
\verb+solve 4 + 
& solves the pointing measurement, using the receiver B230, plots \\
& the results (Fig.1, 2), and writes an XML file for the control system. \\
\end{tabular}
\\[4.5ex] \noindent
\begin{boxit}
{\bf Tip:} Occasionally, spikes appear in the raw data. If they are stronger 
than the total power level, they can be removed from the raw data with MIRA's 
command DESPIKE. If they are comparable to the total power level, you should 
first calibrate the pointing, then despike, and then solve the pointing fit.
\end{boxit}
\\[4.5ex] \noindent
\begin{boxit}
{\bf Tip:} By default, MIRA's pointing procedure halts for a while after the 
subscan plots, and then displays the results of the coadded azimuth respectively
elevation subscans. This is for online data processing. For offline data 
processing, you may want to have a close look at the subscans. In that case, 
please enter {\bf LET doPause yes}.
\end{boxit}
\\[3.0ex] \noindent
\begin{tabular}{ll}
\verb+scan 9 + 
& loads scan 9 \\
\verb+solve 1 + 
& solve and plot the focus for receiver B230 (Fig.3), and writes an XML \\
& file for the control system.\\
\verb+scan 12+
& loads scan 12 (a calibration for the 4MHz filterbank), and issues \\
\end{tabular}
\begin{verbatim}  

FeBe Number              Frontend                   Backend
     
     1                     A230                      4MHZ 
     2                     B230                      4MHZ 
     
       
idFe THotLoad TColdLoad idBe  Pix  recTemp sysTemp calTemp tauZenith pwv
     ---- [Kelvin] ----            ------ [Kelvin] -------  [Neper]  [mm]
-------------------------------------------------------------------------
A230  295.199    86.000 4MHZ   1    362.19 3018.86  240.79    0.40    5.8
B230  295.199    86.000 4MHZ   1    127.34 1658.64  213.17    0.42    6.0

\end{verbatim}
\begin{tabular}{ll}
\verb+scan 13 + 
& loads scan 13 (an on-off on IRC+10216) \\
\verb+view [1 /phases ON]+ 
& plots the uncalibrated spectrum of the A230 receiver. \\
& The text in brackets is the default for \verb+\view+ (uncalibrated data).\\
\verb+view 1 /phases OFF+
& You may want to look e.g. at the off-phase, too. \\
\verb+cal all +               
& calibrates the spectra of both the A230 and B230 receivers. \\
\verb+view [1 /signal] +
& plots the calibrated spectrum for the A230 receiver (Fig.4). \\
& The text in brackets is the default for \verb+\view+ (calibrated data). \\
\verb+write /febe ALL +
& writes the calibrated spectra into the output file for CLASS \\
 & (starting with observing number 1) \\
\end{tabular}
~\\[4.5ex]
MIRA offers possibilities to plot calibration counts, gainarrays of 
spectrometers, raw data (individual phases of the switch cycle), 
calibrated data (as spectra or pseudo-maps for OTF). For details, please
have a look at section 4.
\begin{figure}
  \centering
  \includegraphics[height=15cm,angle=270,keepaspectratio,clip]{fig1}
  \caption{Example for a pointing solution (first step).}
  \includegraphics[height=15cm,angle=270,keepaspectratio,clip]{fig2}
  \caption{Example for a pointing solution (subscans coadded).}
\end{figure}
\begin{figure}
  \includegraphics[height=15cm,angle=270,keepaspectratio,clip]{fig3}
\caption{Example for a focus solution.}
  \includegraphics[height=15cm,angle=270,keepaspectratio,clip]{fig4}
\caption{Example of a calibrated spectrum.}
\end{figure}

~\newpage \noindent 
\subsection{OTF maps}
In principle, data reduction for OTF maps is the same as described in the 
previous section. However, for switch mode "totalPower", there are different 
modes to weight the off-source reference measurement. This is to get the best 
estimate of the atmospheric total power contribution during an OTF subscan. 
The modes are specified as arguments for option \verb+/OFF+ of command \verb+MIRA\CAL+ (see the MIRA 
language internal help for the command syntax). This command subtracts the
atmospheric total power, and concatenates spectral basebands if necessary.

\begin{itemize}

\item Mode NONE: No atmospheric reference signal is subtracted, but spectral 
basebands are concatenated.

\item Mode AVER: Uses the unweighted average of {\it all} available off-source 
reference measurements.

\item Mode EQUAL: As mode AVER, but only the reference measurements done 
immediately before and after the OTF subscan are used.

\item Mode TIME: Uses as reference signal a weighted mean of the
off-measurements taken before respectively after the on-subscan. The
first reference has a weight decreasing with the time elapsed between the
on-the-fly record and the first reference measurement (and the weight of the
second reference increases correspondingly).
                                                                                
\item Mode TOTAL: as mode TIME, but uses the total power rather than the elapsed
time as weighting criterion, such that the total power of the on-the-fly record
equals the weighted sum of the total power of the reference measurements.
A spectral line contributing significantly to the total power may be masked
(see the MIRA language internal help for the command syntax).

\end{itemize}
\noindent
The default (also used by the automatic online data processing) is mode AVER. 
Depending on weather conditions, you may get flatter and lower baselines using 
one of the other options.
\\[4.5ex] \noindent
\begin{boxit}
{\bf Tip:} For large OTF maps, or HERA OTF maps, the amount of data shown makes
it impossible to show fine features in an appropriate way. In that case, the 
command \verb+VIEW /ZOOM+ allows the user to show a subset of the data: it calls
the interactive cursor, which is used to define two diagonally opposite corners
with two single mouse clicks). The plot is then re-displayed, with new ordinate
and abscissa scales. For HERA data, this option works for a single pixel only
(command syntax for pixel \verb+ipix+: \verb+VIEW /PIXEL ipix /ZOOM+).
\end{boxit}
\\[3.5ex] \noindent
\begin{boxit}
{\bf Tip:} For OTF maps observed with frequency switching, the amount of data
may become large for short switch cycles, and the calibration may be painfully 
slow. It can be accelerated by averaging dumps before calibration. Please use
\verb+SCAN /COMPRESS dumpTime+ (if the argument \verb+dumpTime+ is not an 
integer multiple of the uncompressed dump time, the compression factor is 
rounded to the next integer).
\end{boxit}
~\\[3.5ex] \noindent
\begin{boxit}
{\bf Tip:} If there are no (or not enough) data from the reference position,
it is possible to use the data from the OTF subscans themselves to get a 
reference spectrum (syntax: \verb+ CAL all /GAINS /TCAL /OFF /MASK n1 n2 [n3 n4 ...]\+
where n1 and n2 respectively n3 and n4 etc. are the first and last OTF dumps on
the source). This works only if the OTF map is large enough to contain
emission-free positions.  For weak sources, one has to work iteratively.
\end{boxit}
~\\[2.5ex] \noindent
For HERA data, command \verb+VIEW+ displays the pixel offsets (in PaKo's 
projection system, with respect to the reference pixel) in the plot's boxes, 
and (schematically) in the plot header. The pixel offsets are also 
given in the box labels, together with the offsets (pixel offsets plus scan 
offsets) of the ON position (and/or the OFF position, depending on the plot 
produced).


\begin{figure}
  \includegraphics[height=15cm,angle=270,keepaspectratio,clip]{fig5}
\caption{Example of a calibrated, large OTF map, as displayed by MIRA. The 
records masked by a blanking value correspond to the off-source reference 
measurements. The offset position of the reference measurement is displayed.}
  \includegraphics[height=15cm,angle=270,keepaspectratio,clip]{fig6}
\caption{The same plot after defining a sub-region with the cursor, using
VIEW /ZOOM. Note that now the offsets of the first and last record 
shown are also displayed.}
\end{figure}

~\newpage \noindent 
\subsection{Polarization measurements}
The VESPA backend at the 30m telescope can simultaneously measure the four
Stokes parameters, by computing the cross-correlation of an orthogonally
polarized receiver pair. However, the phase difference between the signals
from both receivers has to be calibrated, in order to attribute the real and
imaginary part of the complex cross correlation to the Stokes U and V 
parameters. This phase difference is measured by a dedicated observation
(a calibration with an additional subscan towards the cold load, equipped with
a polarizer). If VESPA is in its polarimetry mode, this calibration is the 
default. MIRA then calculates the amplitude and phase (step 1) and 
applies the corrections to the astronomical observations (step 2).
~\\[1.5ex]
\begin{tabular}{ll}
\verb+ SCAN calScan+ & Reads a calibration including a polarizer measurement \\
                     & in scan {\it calScan}. \\
                     & The spectra are (for each backend part) in order H, V, \\
                     & R, I (for horizontal, vertical, real part, imaginary part). \\
\verb+ CAL all [/GAINS /TCAL /PHASE]+ & Determines, for all backend parts, the
relative phase of \\
                     & the orthogonally polarized receiver pair, and the \\
                     & amplitude loss of the cross correlation due to phase \\
                     & noise. The options \verb+/GAINS /TCAL /PHASE + do not \\
                     & need to be specified, they are the default for \\
                     & polarisation calibrations.\\
\verb+ VIEW iPart /XPOL+ & Plots the phase and amplitude of the complex cross \\
                       & correlation of the polarizer measurement (Fig.~7) for\\
                       & an assessment the validity of the calibration.\\
& {\it iPart} is the number of the VESPA part to be plotted. \\
\verb+ SCAN obsScan+ & Reads the astronomical observation. \\
\verb+ CAL all [/GAINS /TCAL /OFF /PHASE]+ & Calibrates this observation, and
applies the phase \\
& calibration previously determined.
\end{tabular}
~\\[1.5ex]
Then the calibrated Stokes spectra can be written out to a CLASS file. The data
can then be further reduced using CLASS enhanced by the XPOL macros.
\begin{figure}
\includegraphics[height=10cm,angle=270,keepaspectratio,clip]{fig7}
\begin{minipage}[t]{8cm}
~\\[0.5ex]
Figure 7: Example of the phase (top) and amplitude (bottom) of a VESPA
phase calibration measurement towards a polarizer.
\end{minipage}
\end{figure}

~\noindent 

\section{MIRA language internal help}
\input{mira-help-mira}

\section{MIRA / SIC variables}
Most of the variables in the internal MIRA structure can be copied to and 
examine (e.g. plotted with GREG) as SIC variables. MIRA provides the 
following commands for defining and initialising these variables. For an 
explanation of the sections and their contents, I also refer to the document 
"Multi-Beam FITS Raw Data Format", revision 1.4. Variables derived from 
WCS ( = {\it world coordinate system}) FITS keywords have their leading number
appended to the end of the keywords' names, for the sake for compatibility with
FORTRAN (e.g. \verb+CRVL4_1+ instead of \verb+1CRVL4+).
~\\[1.5ex] \noindent
\subsection{Global SIC default variables}
By default, i.e. without reading any data, MIRA defines the following SIC 
variables:

\begin{verbatim}
doPause                      ! Logical GLOBAL
\end{verbatim}
\noindent
which can be set to \verb+.true.+ or \verb+.false.+ with
\begin{verbatim}
let doPause yes
\end{verbatim}
\noindent respectively 
\begin{verbatim}
let doPause no
\end{verbatim}
\noindent It is used to halt the execution of \verb+MIRA\SOLVE+ until the 
user types \verb+continue+.
~\\[1.5ex] \noindent
\begin{verbatim}
writeXML                     ! Logical GLOBAL
\end{verbatim}
is used to write (\verb+let writeXML yes+) XML files with pointing, focus, and
calibration solutions applied to the data (respectively to suppress this via
\verb+let writeXML no+). The files are named 
\verb+iram30-pointing-20071022s99.xml+ for pointings, and 
\verb+iram30m-focus-...+ and \verb+iram30m-calibration-...+ for focus
solutions and calibration parameters, respectively.

~\\[1.5ex] \noindent
The following variables are used by the automatic online data processing (see 
section 2), and specify, for the 30m file system, the paths to the imbFits raw 
data location (ncsData) and to the MIRA data products (visData), respectively: 
\begin{verbatim}
ncsData                      ! Character*  256 GLOBAL
visData                      ! Character*  256 GLOBAL
\end{verbatim}
~\\[1.5ex] \noindent
Global SIC variables for calibration purposes:
\begin{verbatim}
calByChannel                 ! Logical GLOBAL
\end{verbatim}
By default, one separate calibration temperature is applied for each spectral
baseband. If you want to use a different calibration temperature for each 
spectral channel, use \verb+let calByChannel yes+) before reading a calibration
scan. This feature is to be used e.g. if the image gain is not neglectable (e.g.
DSB tuning) and varies significantly across the spectral bandpass.
~\\[1.5ex] \noindent
\begin{verbatim}
calCheck                     ! Logical GLOBAL
\end{verbatim}
The SIC logical variable \verb+calCheck+ (default: \verb+.true.+) allows to
check the consistency of an observation and its calibration measurement. If
only part of the backend units are calibrated, then MIRA tries to identify
backend units that can be calibrated. Use \verb+let calCheck = no+ when you
connect two or more parts of the same backend to the same receiver, with 
identical spectral setup (otherwise the assignment of the calibration
parameters will not be unique anymore).
~\\[1.5ex] \noindent
\begin{verbatim}
ignoreTraceflag              ! Logical GLOBAL
\end{verbatim}
The \verb+TRACEFLAG+ parameter in the raw data indicates whether the antenna was
in a defined state (e.g. tracking or scanning) or not. The latter may happen in
the data if synthesizer data are taken while the antenna is in stow position (thus
simulating astronomical observations). The default is \verb+let ignoreTraceflag no+.
For data taken while the antenna is in stow position please set it to \verb+yes+.
~\\[1.5ex] \noindent
\begin{verbatim}
badLevel                     ! Real GLOBAL
\end{verbatim}
The \verb+badLevel+ parameter allows to automatically flag bad spectral
channels. Default: if in the calibration the total power of a spectral
channel is more than a factor 20 above or below the median total power
across the baseband under consideration, this raw data point will be 
flagged (and the calibrated spectral channel too).
~\\[1.5ex] \noindent
\begin{verbatim}
flagBSwSpikes                ! Logical GLOBAL
\end{verbatim}
A recent analysis has shown that some dumps in beam switched pointings have
abnormally short integration times (5 msec and more below the nomincal value).
However, the actual integration times are longer. The wrong normalization 
(from counts to count rates) thus results in spikes. With
\verb+let flagBSwSpikes .true.+ this data are automatically flagged (default:
no flagging).
~\\[1.5ex] \noindent
\begin{verbatim}
timingCheck                  ! Logical GLOBAL
\end{verbatim}
By default (\verb+timingCheck = yes+) MIRA checks that each backend data
point is framed in time by data point from the other data streams (subreflector,
antenna, fast and slow traces). If this is not the case although the data point
is between the nominal subscan start and end time, the latter are modified 
accordingly in order to avoid hazardous extrapolations. This automatic correction
can be switched off by setting \verb+let timingCheck no+ (after a change of the
\verb+timingCheck+ flag, the scan needs to be read again in order to validate the
new settings.
~\\[1.5ex] \noindent
\begin{verbatim}
traceExtrapolation           ! Logical GLOBAL
\end{verbatim}
Only for \verb+timingCheck = no+. Allows for extrapolation of antenna trace data
(fast and slow) for backend data at scan start without a trace data point before, 
or for backend data at scan end without a trace data point after.
~\\[1.5ex]
\subsection{SIC variable corresponding to MIRA's data structure}
~\\[1.5ex]
\begin{tabular}{ll}
\verb+var prim r [w]+  & retrieves primary header as SIC variables for \\
                & reading (default) or writing. \\
\verb+var scan r [w]+  & same for the scan header and table sections \\
\verb+var febe r [w]+  & frontend-backend header and table sections \\
\verb+var array r [w]+ & arraydata headers and table sections \\
\verb+var data r [w]+  & data headers and table sections \\
\verb+var mon r [w]+   & monitoring headers and table sections \\
\verb+var gains r [w]+ & MIRA variables \\
\verb+var choice r [w]+ & search options for MIRA command \verb+find+ \\
\verb+var reduce r [w]+ & MIRA internal flags for calibration history \\
\end{tabular}

~\\[1.5ex]\noindent
Here is a listing of the corresponding SIC variables. The array dimensions are 
specified by the following parameters:
\\[1.5ex]
\begin{tabular}{ll}
$n_{\rm fb}   $ & number of frontend-backend combinations \\
$n_{\rm pix}  $ & number of pixels \\
$n_{\rm bd}   $ & number of basebands \\
$n_{\rm cpb}  $ & number of spectral channels per baseband \\
$n_{\rm chan} $ & number of spectral channels (concatenated basebands) \\
$n_{\rm off}  $ & number of off positions from catalogue position \\
$n_{\rm rec}  $ & number of records (= backend data) \\
$n_{\rm ph}   $ & number of phases (e.g. 2 = on, off) \\
$n_{\rm subsc}$ & number of subscans \\
$n_{\rm subr} $ & number of subreflector monitor points \\
$n_{\rm slow}$ & number of antenna monitor points (slow rate) \\
$n_{\rm fast}$ & number of antenna monitor points (fast rate) \\
\end{tabular}
~\\[1.5ex]
Variable types are denoted as S (structure), I (integer), R (real, single 
precision), D (real, double precision), C (character string) and L (logical).
\\[1.5ex]
{\bf Caveats:} (1) Neither the MIRA data structures nor the corresponding SIC 
structures are exactly mapped from the MBFITS V1.54 file definition. However, I
tried to keep them as close as possible.~~~~(2) Not all of the following items 
are already copied from the IMBFITS file to SIC variables (even if the SIC 
variable is declared).
\newpage
\small
\subsubsection{PRIMARY section}
~\\[1.5ex]
\begin{tabular}{lll}
PRIM                 & S &  \\
                     &   &  \\
PRIM\%HEADER          & S &  \\
PRIM\%HEADER\%MBFTSVER & C*11 &  MBFITS version \\
PRIM\%HEADER\%CREATOR  & C*32 &  Softwrae (including version) \\
PRIM\%HEADER\%ORIGIN   & C*32 &  Organisation or Institution \\
PRIM\%HEADER\%TELESCOP & C*13 &  Telescope Name \\
PRIM\%HEADER\%EXTEND   & L &  \\
PRIM\%HEADER\%BITPIX   & I &  \\
PRIM\%HEADER\%SIMPLE   & L &  \\
PRIM\%HEADER\%NAXIS    & I &  \\
\end{tabular}

\subsubsection{SCAN section}
General scan information. 
\\[1.5ex]
\begin{tabular}{llll}
SCAN                 & S & & \\
                     &   & & \\
SCAN\%HEADER          & S & & \\
SCAN\%HEADER\%ZFLX     & R & deg & Pointing coefficient (Flexure) \\
SCAN\%HEADER\%ECEC     & R & deg & Pointing coefficient (P8) \\  
SCAN\%HEADER\%IE       & R & deg & Pointing coefficient (P7) \\   
SCAN\%HEADER\%AW       & R & deg & Pointing coefficient (-P4) \\   
SCAN\%HEADER\%AN       & R & deg & Pointing coefficient (P5) \\   
SCAN\%HEADER\%NPAE     & R & deg & Pointing coefficient (P3) \\   
SCAN\%HEADER\%CA       & R & deg & Pointing coefficient (P2) \\   
SCAN\%HEADER\%IA       & R & deg & Pointing coefficient (P1) \\   
SCAN\%HEADER\%NFEBE    & I & & number of frontend-backend combinations \\
SCAN\%HEADER\%WOBMODE  & C*20 & & wobbler mode (SQUARE/TRIANGULAR) \\
SCAN\%HEADER\%WOBCYCLE & R & sec & wobbler period \\
SCAN\%HEADER\%WOBDIR   & C*4 & & wobbler throw direction \\
SCAN\%HEADER\%WOBTHROW & D & deg & wobbler throw (can also be used for beam \\
                       &   &     & switching) \\
SCAN\%HEADER\%WOBUSED  & L & & Wobbler used ? \\
SCAN\%HEADER\%TRANFOCU & I & m & (optional, HOLO) transmitter offset from prime \\
                       &   &   &  focus\\
SCAN\%HEADER\%TRANFREQ & I & Hz & (optional, HOLO) transmitter frequency \\
SCAN\%HEADER\%TRANDIST & I & m  & (optional, HOLO) transmitter distance \\
SCAN\%HEADER\%ZIGZAG   & L & & (optional, OTF/RASTER) Scan in zigzag ? \\
SCAN\%HEADER\%CROCYCLE & C*20 & & CAL/REF/ON loop string \\
SCAN\%HEADER\%SCANPAR1 & D & & (optional) spare scan parameter \\ 
SCAN\%HEADER\%SCANPAR2 & D & & (optional) spare scan parameter \\
SCAN\%HEADER\%SCANSKEW & D & user def. & (optional, OTF/RASTER) offset in scan \\
                       &   &           & direction between lines \\
\end{tabular}
\newpage \noindent
\begin{tabular}{llll}
SCAN\%HEADER\%SCANYSPC & D & user def. & (optional, OTF/RASTER) step \\
                       &   &           & between scan/raster lines \\
SCAN\%HEADER\%SCANXSPC & D & user def. & (optional, OTF/RASTER) step along line\\
                       &   &           &  between samples\\
SCAN\%HEADER\%SCANTIME & D & user def. & (optional, OTF) time for one line \\
SCAN\%HEADER\%SCANXVEL & D & user def. & (optional, OTF) tracking rate along line \\
SCAN\%HEADER\%SCANLEN  & D & user def. & (optional, OTF/RASTER) line length \\
SCAN\%HEADER\%SCANRPTS & I & & (optional) number of repeats of each scan line.\\
                       &   & & Default 1.\\
SCAN\%HEADER\%SCANLINE & I & & (optional) number of lines in a scan. Default 1.\\
SCAN\%HEADER\%SCANDIR  & C*4 & & (optional) scan direction \\
SCAN\%HEADER\%SCANGEOM & C*20 & & Scan geometry \\
SCAN\%HEADER\%SCANMODE & C*20 & & Mapping mode \\
SCAN\%HEADER\%SCANTYPE & C*20 & & Scan astronomical type \\
SCAN\%HEADER\%DISTANCE & D & AU & geocentric distance \\
SCAN\%HEADER\%ORBEQUNX & D & & Elements equinox: J2000.0 or B1950.0 \\ 
SCAN\%HEADER\%ORBEPOCH & D & Julian days& EPOCH, Epoch of orbital elements \\ 
SCAN\%HEADER\%ECCENTR  & D & & EC, Eccentricity \\ 
SCAN\%HEADER\%INCLINAT & D & & IN, Inclination \\ 
SCAN\%HEADER\%OMEGA    & D & & W, Angle from ascending node to perihelion\\ 
SCAN\%HEADER\%LONGASC  & D & & OM, Longitude of ascending node (in degrees)\\ 
SCAN\%HEADER\%PERIDIST & D & AU & QR, perihelion distance \\ 
SCAN\%HEADER\%PERIDATE & D & Julian days & TP, Full Julian date of perihelion passage\\ 
SCAN\%HEADER\%MOVEFRAM & L & & True if tracking a moving frame. If true,\\
                       &   & & the above orbital elements are stored.   \\
SCAN\%HEADER\%CALCODE  & C*4 & & Calibrator code \\
SCAN\%HEADER\%LATOBJ   & D & deg & Source latitude in native frame. \\
SCAN\%HEADER\%LONGOBJ  & D & deg & Source longitude in native frame. \\
SCAN\%HEADER\%LONGOFF  & D & deg & Longitude offset from catalogue position. \\
SCAN\%HEADER\%LATOFF   & D & deg & Latitude offset from catalogue position. \\
SCAN\%HEADER\%OBJECT   & C*10 & & Source name. \\
SCAN\%HEADER\%LATPOLE  & D & deg & Basis latitude of native pole. \\
SCAN\%HEADER\%LONPOLE  & D & deg & Native longitude of celestial pole. \\
SCAN\%HEADER\%CRVAL1   & D & deg & Native frame zero in basis system (long.)\\
SCAN\%HEADER\%CRVAL2   & D & deg & Native frame zero in basis system (lat.)\\
SCAN\%HEADER\%EQUINOX  & R & Julian years & Equinox \\
SCAN\%HEADER\%RADECSYS & C*32 & & additional system definition for ecliptic/ \\
                       &      & & equatorial coordinates \\
SCAN\%HEADER\%CTYPE1   & C*8 & & Basis system (longitude) XLON-SFL \\
SCAN\%HEADER\%CTYPE2   & C*8 & & Basis system (latitude) XLAT-SFL\\
SCAN\%HEADER\%ETUTC    & D & s & Ephemeris Time - UTC time translation \\
SCAN\%HEADER\%GPSTAI   & D & s & GPS time - TAI translation \\
SCAN\%HEADER\%TAIUTC   & D & s & TAI-UTC time translation \\
SCAN\%HEADER\%UT1UTC   & D & s & UT1-UTC time translation \\
SCAN\%HEADER\%NOBS     & I & & Number of observations in this scan \\
SCAN\%HEADER\%NOBSTOTAL& I & & Number of subscans upon correct completion \\
SCAN\%HEADER\%LST      & D & s & Local apparent sidereal time (scan start) \\
SCAN\%HEADER\%MJD      & D & day & Scan start time (modified Julian date) in \\
                       &   &     & TIMESYS system\\
SCAN\%HEADER\%DATE\_OBS & C*23 & & Scan date/time (in TIMESYS system) \\
SCAN\%HEADER\%SCANNUM  & I & & Scan number \\
SCAN\%HEADER\%OBSID    & C*12 & & Observer and Operator initials \\
SCAN\%HEADER\%PROJID   & C*12 & & Project ID \\
SCAN\%HEADER\%SITEELEV & R & m & Observatory elevation \\
\end{tabular}
\newpage \noindent
\begin{tabular}{llll}
SCAN\%HEADER\%SITELONG & D & deg & Observatory longitude \\
SCAN\%HEADER\%SITELAT  & D & deg & Observatory latitude \\
SCAN\%HEADER\%TELESCOP & C*13 & & Telescope name \\
                       &      & &                \\
SCAN\%DATA            & S & & \\
SCAN\%DATA\%LONGOFF   & $n_{\rm off}$ D & deg & 
longitude offset from catalogue position \\
SCAN\%DATA\%LATOFF    & $n_{\rm off}$D & deg & 
latitude offset from catalogue position \\
SCAN\%DATA\%FE         & $n_{\rm fb}$ I & & frontend ID of each frontend-backend combination\\
                       & &  & 0 = unknown \\
                       & &  & 1 = A100~~~~2 = B100 \\
                       & &  & 3 = C150~~~~4 = D150 \\
                       & &  & 5 = A230~~~~6 = B230 \\
                       & &  & 7 = C270~~~~8 = D270 \\
                       & &  & 9 = HERA~~~10 = HERB \\
                       & &  &                      \\
SCAN\%DATA\%BE         & $n_{\rm fb}$ I & & backend  ID of each frontend-backend combination \\
                       & &    &  0 = unknown~~~~1 = continuum \\
                       & &    &  4 = VESPA~~~~~~5 = WILMA \\
                       & &    &  7 = 4MHz \\
\end{tabular}
\subsubsection{FEBE section}
There is one FEBE (=frontend-backend description) section per frontend-backend
combination. The following list is for frontend-backend combination 1 (the 
corresponding items for combination 2 were FEBE2\%HEADER and FEBE2\%DATA, and
so on).
\\[1.5ex]
\begin{tabular}{llll}
FEBE1                    & S & & \\
                         &   & & \\
FEBE1\%HEADER             & S & & \\
FEBE1\%HEADER\%ZFLXRX      & R & deg & Pointing Coefficient (receiver), adds to ZFLX \\
FEBE1\%HEADER\%ECECRX      & R & deg & Pointing Coefficient (receiver), adds to ECEC (P8) \\
FEBE1\%HEADER\%IERX        & R & deg & Pointing Coefficient (receiver), adds to IE (P7) \\
FEBE1\%HEADER\%CARX        & R & deg & Pointing Coefficient (receiver), adds to CA (P2) \\
FEBE1\%HEADER\%IARX        & R & deg & Pointing Coefficient (receiver), adds to\\
FEBE1\%HEADER\%FRQTHROW    & R & Hz & Frequency switching throw \\
FEBE1\%HEADER\%NPHASES     & I & & number of switch phases in a switch cycle \\
FEBE1\%HEADER\%SWTCHMOD    & C*20 & & Switch mode \\
FEBE1\%HEADER\%NUSEFEED    & I & & number fo feeds in use. \\
FEBE1\%HEADER\%FEBEFEED    & I & & total number of feeds. \\
FEBE1\%HEADER\%FEBEBAND    & I & & total number of basebands for this frontend-backend \\
                           &   & & combination \\
FEBE1\%HEADER\%DEWANG      & R & deg & dewar angle \\
FEBE1\%HEADER\%DEWRTMOD    & C*5 & & dewar tracking system\\
FEBE1\%HEADER\%DATE\_OBS   & C*23 & & observing date (Y2K format with time) in TIMESYS \\
                           &      & & system (scan start) \\
FEBE1\%HEADER\%SCANNUM     & I & & scan number \\   
FEBE1\%HEADER\%FEBE        & C*17 & & frontend-backend combination identification \\
\end{tabular}
~\\[1.5ex]
\begin{tabular}{lrll}
FEBE1\%DATA                & S & & \\
FEBE1\%DATA\%GAINELE1      & $n_{\rm bd}$ R & deg & Gain-elevation correction parameter 1 \\
                           &                &     & (see MBFITS manual) \\
FEBE1\%DATA\%GAINELE2      & $n_{\rm bd}$ R & deg & Gain-elevation correction parameter 2 \\
                           &                &     & (see MBFITS manual) \\
FEBE1\%DATA\%GAINIMAG      & $n_{\rm pix} \times n_{\rm bd} $ R & & Gain ratio image/signal sideband\\
FEBE1\%DATA\%FLATFIEL      &  $n_{\rm pix} \times n_{\rm bd}$ R & & receiver array flat field (relative gains) \\
FEBE1\%DATA\%BOLCALFC      & $n_{\rm pix}$ R & Jy/counts & bolometer calibration factor \\
FEBE1\%DATA\%ANTGAIN       &  $n_{\rm pix} \times n_{\rm bd}$ R & K/Jy & Antenna gain \\
FEBE1\%DATA\%HPBW          &  $n_{\rm pix} \times n_{\rm bd}$ R & deg & Half-power beam width \\
FEBE1\%DATA\%ETAFSS        & $n_{\rm pix} \times n_{\rm bd}$ R & & forward efficiency \\
FEBE1\%DATA\%BEAMEFF       & $n_{\rm pix} \times n_{\rm bd}$ R & & beam efficiency \\
FEBE1\%DATA\%APEREFF       & $n_{\rm pix} \times n_{\rm bd}$ R & & aperture efficiency \\
FEBE1\%DATA\%POLA          & $n_{\rm pix}$ R & deg & feed orientation \\
FEBE1\%DATA\%POLTY         &             C*1 & & feed type (X, Y, L, R)\\
FEBE1\%DATA\%REFFEED       & I & & feed number of reference feed \\
FEBE1\%DATA\%FEEDOFFX      & $n_{\rm pix}$ D & deg & feed x offset \\
FEBE1\%DATA\%FEEDOFFY      & $n_{\rm pix}$ D & deg & feed y offset \\
FEBE1\%DATA\%DATA\%FEEDTYPE & $n_{\rm pix}$ C*1 & & feed type (see MBFITS manual) \\
FEBE1\%DATA\%USEFEED       & $n_{\rm pix}$ I & & list of feeds which are in use\\ 
\end{tabular}

\subsubsection{ARRAY section}
There is one ARRAY (= receiver array description) section per frontend-backend
combination and per baseband. The following list is for frontend-backend 
combination 1 and baseband 1 (the corresponding structure names for 
frontend-backend combination 2 were FEBE2\%HEADER1 and FEBE2\%DATA1, 
respectively FEBE2\%HEADER2 and FEBE2\%DATA2 for baseband 2, and so on).
\\[1.5ex]
\begin{tabular}{llll}
ARRAY1                  & S & & \\
                        &   & & \\
ARRAY1\%HEADER1          & S & & \\
ARRAY1\%HEADER1\%VSYS4R\_2 & R & km/s & observer velocity in rest frame \\
ARRAY1\%HEADER1\%VSOU4R\_2 & R & km/s & source velocity in rest frame \\
ARRAY1\%HEADER1\%SOBS4R\_2 & C*8 & 'TOPOCENT' & observing frame \\
ARRAY1\%HEADER1\%SPEC4R\_2 & C*8 & e.g. 'LSRK' & standard of rest frame for velocities \\
ARRAY1\%HEADER1\%CD4R\_21  & D & km/s & velocity channel separation \\
ARRAY1\%HEADER1\%CUNI4R\_2 & C*8 & 'km/s' & Unit \\
ARRAY1\%HEADER1\%CRVL4R\_2 & D & km/s & velocity at reference channel \\
ARRAY1\%HEADER1\%CRPX4R\_2 & R & & reference channel \\
ARRAY1\%HEADER1\%CTYP4R\_2 & C*8 & e.g. 'VARD-FRQ' & velocity axis for col.3\\
ARRAY1\%HEADER1\%WCSNM4R  & C*8 & e.g. 'LsrkVRad' & axis name \\
ARRAY1\%HEADER1\%SOBS4F\_2 & C*8 & 'TOPOCENT' & observing frame \\
ARRAY1\%HEADER1\%SPEC4F\_2 & C*8 & e.g. 'LSRK' & standard of rest for frequencies \\
ARRAY1\%HEADER1\%CD4F\_21  & D & Hz & channel separation \\
ARRAY1\%HEADER1\%CUNI4F\_2 & C*8 & 'Hz' & Unit \\
\end{tabular}
\newpage \noindent
\begin{tabular}{llll}
ARRAY1\%HEADER1\%CRVL4F\_2 & D & Hz & frequency at reference channel in \\
                           &   &    & rest frame \\
ARRAY1\%HEADER1\%CRPX4F\_2 & R & Hz & reference channel. \\
ARRAY1\%HEADER1\%CTYP4F\_2 & C*8 & 'FREQ-FRQ' & frequency axis for col. 3\\
ARRAY1\%HEADER1\%WCSNM4F  & C*8 & e.g. 'LsrkFreq' & axis name \\
ARRAY1\%HEADER1\%CD3A\_11  & I & & pixel index separation = 1 \\
ARRAY1\%HEADER1\%CRVL4\_1  & I & & pixel index value at this position = 1 \\
ARRAY1\%HEADER1\%CRPX4\_1  & I & & ref. position = 1 \\
ARRAY1\%HEADER1\%CTYP4\_1  & C*8 & 'PIX-INDX' & Pixel/feed index in USEPIX array \\
ARRAY1\%HEADER1\%SBSEP    & D & Hz & sideband separation \\
ARRAY1\%HEADER1\%SIDEBAND & C*3 & & main sideband (USB or LSB) \\
ARRAY1\%HEADER1\%RESTFREQ & D & Hz & rest frequency of line (optional) \\
ARRAY1\%HEADER1\%TRANSITI & C*20 & & main line transition (optional) \\
ARRAY1\%HEADER1\%MOLECULE & C*20 & & main line molecule (optional) \\
ARRAY1\%HEADER1\%BANDWID  & D & Hz & bandwidth for this band \\
ARRAY1\%HEADER1\%FREQRES  & D & Hz & frequency resolution \\
ARRAY1\%HEADER1\%CHANNELS & I & & number of channels for this baseband \\
ARRAY1\%HEADER1\%DATE\_OBS & C*23 & & observation start in TIMESYS system \\
ARRAY1\%HEADER1\%OBSNUM   & I & & observation number \\
ARRAY1\%HEADER1\%SCANNUM  & I & & scan number \\
ARRAY1\%HEADER1\%BASEBAND & I & & baseband number \\
ARRAY1\%HEADER1\%FEBE     & C*17 & & frontend-backend combination ID \\
\end{tabular}
~\\[1.5ex]
\begin{tabular}{lrll}
ARRAY1\%DATA1\%ISWITCH   & $n_{\rm rec}$ C*4 &   & integration type     \\
                         &   &   & NONE             \\
                         &   &   & ON~~~~~~~~OFF  \\
                         &   &   & LOAD~~~~SKY  \\
                         &   &   & HOT~~~~~~COLD \\
                         &   &   & FHI~~~~~~FLO \\ 
ARRAY1\%DATA1\%MJD       & $n_{\rm rec}.n_{\rm ph} $ D & day & MJD at integration midpoint \\
                         &                 &     &  in TIMESYS system \\
ARRAY1\%DATA1\%DATA      & $n_{\rm pix} \times n_{\rm cpb} \times n_{\rm rec} \times n_{\rm ph} $ R & & backend data \\
\end{tabular}
\newpage
\subsubsection{DATA section}
There is one DATA section per frontend-backend combination. The following list 
is for frontend-backend combination 1 (the corresponding structure names for 
combination 2 were DATA2\%HEADER and DATA2\%DATA, and so on). Data associated
parameters are interpolated from the monitor data (next section) at the MIDTIME
timestamp of the backend data.
\\[1.5ex]
\begin{tabular}{lrll}
DATA1\%HEADER          & S & & \\
                       &   & & \\
DATA1\%HEADER\%CHANNELS & I & & number of channels (for concatenated basebands) \\
DATA1\%HEADER\%OBSTATUS & C*10 & & Observation o.k. ? (OK/ABORT) \\
DATA1\%HEADER\%DPBLOCK  & L & & Data blocking ? \\
DATA1\%HEADER\%OBSTYPE  & C*1 & & observation type (CAL, REF, ON, HOT, COLD, SKY) \\
DATA1\%HEADER\%LST      & D & s & Local apparent sidereal time (obs. start) \\
DATA1\%HEADER\%DATE\_OBS & C*23 & & observation start in TIMESYS system \\
DATA1\%HEADER\%OBSNUM   & I & & observation number \\
DATA1\%HEADER\%SCANNUM  & I & & scan number \\
DATA1\%HEADER\%FEBE     & C*17 & & frontend-backend identification \\
                        &      & &                                 \\
DATA1\%DATA\%AZIMUTH      & $n_{\rm rec}$ D & deg & azimuth inc. wobbler offsets\\
DATA1\%DATA\%BASLONG      & $n_{\rm rec}$ D & deg & actual long. in astronomical basis frame, \\
                          &                &     & inc. wobbler offsets \\
DATA1\%DATA\%BASLAT       & $n_{\rm rec}$ D & deg & actual lat. in astronomical basis frame, \\
                          &                 &     & inc. wobbler offsets \\
DATA1\%DATA\%CBASLONG     & $n_{\rm rec}$D & deg & commanded long. in astr. basis frame, \\
                          &                &     & inc. wobbler offsets \\
DATA1\%DATA\%CBASLAT      & $n_{\rm rec}$D & deg & commanded lat. in astr. basis frame, \\
                          &                &     & inc. wobbler offsets\\
DATA1\%DATA\%ELEVATIO     & $n_{\rm rec}$D & deg & elevation inc. wobbler offsets\\
DATA1\%DATA\%DFOCUS\_X\_Y\_Z & $n_{\rm rec} \times 3$ D & mm & (opt.) focus offsets X, Y, Z (subrefl. position) \\
DATA1\%DATA\%FOCUS\_X\_Y\_Z  & $n_{\rm rec} \times 3$ D & mm & focus (subreflector position) X, Y, Z \\
DATA1\%DATA\%INTEGTIM     & $n_{\rm rec}$ D & s & integration time \\
DATA1\%DATA\%INTEGNUM     & $n_{\rm rec}$ I &   & integration point number \\
DATA1\%DATA\%LST          & $n_{\rm rec}$ D & s & local apparent sidereal time\\
DATA1\%DATA\%LONGOFF      & $n_{\rm rec}$ D & deg & long. offset from source in user native frame \\
DATA1\%DATA\%LATOFF       & $n_{\rm rec}$ D & deg & lat. offset from source in user native frame \\
DATA1\%DATA\%MLONPOLE     & $n_{\rm rec}$ D & deg & (opt.) longitude of basis celestial pole in \\
                          &                 &     & body system \\
DATA1\%DATA\%MLATPOLE     & $n_{\rm rec}$ D & deg & (opt.) basis latitude of body frame pole\\
DATA1\%DATA\%MCRVAL1      & $n_{\rm rec}$ D & deg & (opt.) body apparent long. in basis system\\
DATA1\%DATA\%MCRVAL2      & $n_{\rm rec}$ D & deg & (opt.) body apparent lat. in basis system \\
DATA1\%DATA\%MIDTIME      & $n_{\rm rec}$ D & day & MJD at integration midpoint in TIMESYS \\
                          &                 &     & system \\
DATA1\%DATA\%MJD       & $n_{\rm rec}$ D & day & MJD at integration endpoint in TIMESYS \\
                       &                 &     & system\\
DATA1\%DATA\%NINTS        & $n_{\rm rec}$ I & & integrations in block \\
\end{tabular}
\newpage \noindent
\begin{tabular}{lrll}
DATA1\%DATA\%PHI\_X\_Y\_Z    & $n_{\rm rec}$ D & deg & Phi (subreflector rotation) \\
                           &   & & X, Y, Z (see MBFITS manual) \\
DATA1\%DATA\%PC\_11        & D & & matrix elements of \\
                           &   & & transformation from pixel \\ 
                           &   & & coordinates to intermediate \\
                           &   & & pixel coordinates\\
                           &   & & (projection of user frame)\\
DATA1\%DATA\%PC\_12        & D & & \\
DATA1\%DATA\%PC\_21        & D & & \\
DATA1\%DATA\%PC\_22        & D & & \\
DATA1\%DATA\%PARANGLE     & $n_{\rm rec}$ D & deg & parallactic angle \\
DATA1\%DATA\%SUBSCAN      & $n_{\rm rec}$ I & & subscan number of data point \\
DATA1\%DATA\%OTFDATA      & $n_{\rm pix} \times n_{\rm chan} \times n_{\rm rec}$ R & counts, $T_{\rm A}^*$ [K] & OTF data with basebands \\
   &              &              & concatenated and off subtracted \\
DATA1\%DATA\%RDATA        & $n_{\rm pix} \times n_{\rm ch}$ R & counts, $T_{\rm A}^*$ [K] & single pointing data, basebands \\
        & & & concatenated and off subtracted \\
\end{tabular}

~\\[1.5ex]

\subsubsection{MONITOR section}
The MONITOR section describes all parameters associated with the data. MONITOR 
data are recorded independently from the backend data (DATA section). The 
interpolation of data associated parameters at the backend timestamps is 
written into the data substructure of the DATA section (see above).
\\[1.5ex]
Each frontend-backend combination has its own MONITOR section, i.e. MON1\%HEADER
and MON1\%DATA for frontend-backend combination 1, MON2\%HEADER and MON2\%DATA
for frontend-backend combination 2, etc.
\\[1.5ex]
Weather data and load temperatures are expected to be monitored several times 
per scan. For the time being, there is only one entry per imbFits file 
(except for HERA cold load temperatures).
\\[1.5ex]
\begin{tabular}{lrll}
MON1                          & S & & \\
                             &   & & \\
MON1\%HEADER                   & S & & \\
MON1\%HEADER\%DATE\_OBS      & C*23 & & observing date in TIMESYS \\ 
                            &      & & system \\
MON1\%HEADER\%FOCOBS\_X\_Y\_Z      & 3 D & mm & X,Y,Z focus correction \\
MON\%HEADER\%IAOBS\_CAOBS\_IEOBS & 3 D & arcsec & Pointing corrections, to be 
added \\
                                 & & & to IA (P1), CA (P2) and IE (P7). \\
                                 & & & In old 30m control system terms: \\
                                 & & & IAOBS = NULA, \\
                                 & & & CAOBS = COL*, \\
                                 & & & IEOBS = NULE \\
MON1\%HEADER\%OBSNUM            & I & & observation number \\
MON1\%HEADER\%SCANNUM           & I & & scan number \\
\end{tabular}
\newpage
\begin{tabular}{lrll}
MON1\%DATA                 & S & & \\
MON1\%DATA\%REFRACTIO      & D & arcsec & refraction correction \\
MON1\%DATA\%THOTCOLD       & $1 \times 2$ D & K & hot \& cold load temperature \\
MON1\%DATA\%TAMB\_P\_HUMID & $1 \times 3$ D & C, hPa, \% & ambient temperature, \\
                          &     &            & pressure and rel. humidity \\
MON1\%DATA\%ANTENNA\_AZ\_EL & 2 D & deg & SAZM \& SELV from old \\
                           &     &     & control system \\
MON1\%DATA\%LONGOFF         & $n_{\rm slow}$ D & deg & long. offset from source in \\
                           &                  &     & user native frame \\
MON1\%DATA\%LATOFF         & $n_{\rm slow}$ D & deg & lat. offset from source in\\
                          &                  &     & user native frame \\
MON1\%DATA\%BASLONG        & $n_{\rm slow}$ D & deg & actual long. in astronomical \\
                          &                  &     & basis frame, inc. wobbler\\
                          &                  &     & offsets \\
MON1\%DATA\%BASLAT         & $n_{\rm slow}$ D & deg & actual lat. in astronomical\\
                          &                  &     & basis frame, inc. wobbler\\
                          &                  &     & offsets\\
MON1\%DATA\%PARANGLE       & $n_{\rm slow}$ D & deg & parallactic angle \\
MON\%DATA\%PHI\_X\_Y\_Z   & $n_{\rm subr} \times 3$ D & deg  & Phi (subrefl. rotation) X, Y, Z \\
                          &                          &   &(see MBFITS manual) \\
MON1\%DATA\%FOCUS\_X\_Y\_Z    & $n_{\rm subr} \times 4 $ D & & focus offsets and timestamp: \\
                             &                              & mm & X subreflector position \\
                             &                              & mm & Y subreflector position \\
                             &                              & mm & Z subreflector position \\
                             &                              & day & MJD timestamp in IMBF--\\
                             &         & & subreflector binary table \\
MON1\%DATA\%DFOCUS\_X\_Y\_Z   & $n_{\rm subr} \times 3$ D & mm & focus (subreflector position) \\
                             &                           &    & offsets X, Y, Z \\
MON1\%DATA\%TRACKING\_AZ\_EL & $n_{\rm fast} \times 2$ D & deg & antenna tracking errors in \\
                            &                           &     & azimuth and elevation \\
MON1\%DATA\%ENCODER\_AZ\_EL  & $n_{\rm fast} \times 3$ D &  & encoder azimuth \& 
elevation \\
                            &                           &  & and timestamp \\
                            &                       & deg & encoder azimuth \\
                            &                       & deg & encoder elevation \\
                            &                       & day & MJD time of
IMBF--antenna \\
                            &                 & & binary table (fast track) \\ 
MON1\%DATA\%MJD              & $n_{\rm slow} $D & day & MJD time of 
IMBF--antenna \\
                          &                  &     & binary table (slow track) \\
\end{tabular}

The \verb+MON+ structure only contains data that are used for interpolation.
Daten taken e.g. between subsequent subscans, before scan start or after scan
end do not have a SIC copy, except for the encoder values and tracking errors,
written into structure \verb+ANTENNA+. This structure is activated together
with the \verb+MON+ structure (i.e. upon \verb+ MIRA\VARIABLE mon+), and
contains (with $n_{\rm allFast} \ge n_{\rm fast}$):
\\[1.5ex]
\begin{tabular}{lrll}
ANTENNA\%TRACKING\_AZ\_EL  & $n_{\rm allFast} \times 2$ D & deg & antenna tracking errors in \\
                           &                              &     & azimuth and elevation \\
ANTENNA\%ENCODER\_AZ\_EL   & $n_{\rm allFast} \times 3$ D &     & encoder azimuth \& 
elevation \\
                           &                              &     & and timestamp \\
                           &                              & deg & encoder azimuth \\
                           &                              & deg & encoder elevation \\
                           &                              & day & MJD timestamp \\

\end{tabular}

\newpage

\subsubsection{GAINS section}
The GAINS section is not a part of the MBFITS raw-data format, and contains 
information relevant to data calibration (together with the weather data, that 
are written to the MONITOR section). There is a separate GAINS section for each
frontend-backend combination (i.e. GAINS1, GAINS2 etc.).
\\[1.5ex]
\begin{tabular}{lrll}
GAINS1\%PCOLD       & $n_{\rm bd} \times n_{\rm pix} \times n_{\rm cpb}$ D & & 
backend count rate of cold load \\
GAINS1\%PHOT        & $n_{\rm bd} \times n_{\rm pix} \times n_{\rm cpb}$ D & & 
backend count rate on ambient load \\
GAINS1\%PSKY        & $n_{\rm bd} \times n_{\rm pix} \times n_{\rm cpb}$ D & & 
backend count rate on sky \\
GAINS1\%LCALOF      & D & deg & longitude offset for sky measurement \\
GAINS1\%BCALOF      & D & deg & latitude offset for sky measurement \\ 
GAINS1\%TAUZEN      & $n_{\rm bd} \times n_{\rm pix}$D & Np  & 
zenith opacity \\
GAINS1\%TAUZENIMAGE & $n_{\rm bd} \times n_{\rm pix}$ D & Np & 
zenith opacity in image band \\
GAINS1\%TATMS       & $n_{\rm bd} \times n_{\rm pix}$D & K & 
atmospheric emission temperature \\
GAINS1\%TATMI       & $n_{\rm bd} \times n_{\rm pix}$D & K & 
atmospheric emission temperature (image band) \\
GAINS1\%TSYS        & $n_{\rm bd} \times n_{\rm pix}$D & K & 
system temperature \\
GAINS1\%TRX         & $n_{\rm bd} \times n_{\rm pix}$ D & K & 
receiver temperature \\
GAINS1\%H2OMM       & $n_{\rm bd} \times n_{\rm pix}$D & mm & 
precipitable water vapour \\
GAINS1\%GAINARRAY   & $n_{\rm bd} \times n_{\rm pix} \times n_{\rm cpb}$ D & & 
gain array (= PHOT$-$PSKY) \\
GAINS1\%FEBE        & C*17 & & frontend-backend identification \\
\end{tabular}

\subsubsection{CHOICE section}
The CHOICE section is not a part of the MBFITS raw-data format, and describes
the selection criteria for MIRA's find command.
\\[1.5ex]
\begin{tabular}{lll}
CHOICE            & S & \\
CHOICE\%TELESCOPE  & C*13 & \\
CHOICE\%OBJECT     & C*20 & \\
CHOICE\%SCAN1      & C*4 & first scan of selected scan range \\
CHOICE\%SCAN2      & C*4 & last scan of selected scan range \\
CHOICE\%PROCEDURE  & C*8 & observing procedure \\
CHOICE\%DATE\_OBS1  & C*23 & starting date for selection \\
CHOICE\%DATE\_OBS2  & C*23 & end date for selection \\
CHOICE\%TRANSITION & C*20 & spectral line name \\
CHOICE\%FRONTEND   & C*8 & frontend selection \\
CHOICE\%BACKEND    & C*8 & backend selection \\
\end{tabular}

\subsubsection{REDUCE section}
The REDUCE section is not a part of the MBFITS raw-data format, and contains 
MIRA-internal flags describing the calibration history. There is one REDUCE 
section per frontend-backend combination, i.e. REDUCE1, REDUCE2, etc.
\\[1.5ex]
\begin{tabular}{lrl}
REDUCE1                    & S &                          \\
REDUCE1\%DESPIKE\_DONE     & L & Data despiked (yes/no) ? \\
REDUCE1\%BASE\_DONE        & L & Baseline subtracted (yes/no) ? \\
REDUCE1\%CALIBRATION\_DONE & 4 I & Calibration done ? \\
                           &     & (1) Normalized by gainarray (yes /no) ? \\
                           &     & (2) Backend count rates (no) or temp. scale (yes) ? \\
                           &     & (3) Off signal subtracted (yes /no) ? \\
                           &     & (4) Cross correlation phases calibrated 
                                       (yes /no) ? \\
                           &     & ~~(for polarimetry only) \\
\end{tabular}

\newpage

\subsubsection{RAW section}
The RAW section is not part of the MBFITS raw-data format, and contains time 
stamps for subscan start and end in the IMBF raw-data. There is {\it one} RAW
section per subscan (i.e. RAW1, RAW2,...).
\\[1.5ex]
\begin{tabular}{llll}
RAW1 & S & & \\
     &   & & \\
RAW1\%ANTENNA & S & & structure for antenna monitoring data \\
RAW1\%ANTENNA\%SUBSCANTYPE   & C*40 & & subscan type \\
RAW1\%ANTENNA\%SUBSCANSTART  & D & day & subscan start (MJD in TIMESYS system) \\
RAW1\%ANTENNA\%SUBSCANEND    & D & day & subscan end (MJD in TIMESYS system) \\
RAW1\%ANTENNA\%dateObs       & D & day & subscan start (as written to 
imbfits file) \\ 
RAW1\%ANTENNA\%dateEnd       & D & day & subscan end (as written to 
imbfits file) \\
RAW1\%ANTENNA\%SEGMENTXSTART & D & deg & offset at subscan start on abscissa \\
                             &   &     & in user native system \\
RAW1\%ANTENNA\%SEGMENTXEND   & D & deg & offset on abscissa at subscan end \\ 
RAW1\%ANTENNA\%SEGMENTYSTART & D & deg & offset at subscan start on ordinate \\
                             &   &     & in user native system \\ 
RAW1\%ANTENNA\%SEGMENTYEND   & D & deg & offset on ordinate at subscan end \\
     &   & & \\
RAW1\%SUBREF & S & & structure for subreflector monitoring data \\
RAW1\%SUBREF\%SUBSCANSTART  & D & day & subscan start (MJD in TIMESYS system) \\
RAW1\%SUBREF\%SUBSCANEND    & D & day & subscan end (MJD in TIMESYS system) \\
RAW1\%SUBREF\%SEGMENTXSTART & D & deg & offset at subscan start on abscissa in\\
                            &   &     &  user native system \\
RAW1\%SUBREF\%SEGMENTXEND   & D & deg & offset on abscissa at subscan end \\ 
RAW1\%SUBREF\%SEGMENTYSTART & D & deg & offset at subscan start on ordinate in \\
                            &   &     & user native system \\ 
RAW1\%SUBREF\%SEGMENTYEND   & D & deg & offset on ordinate at subscan end \\
     &   & & \\
RAW1\%BACKEND & S & & structure for backend data \\
RAW1\%BACKEND\%SUBSCANSTART  & D & day & subscan start (MJD in TIMESYS system) \\
\end{tabular}

\subsubsection{LIST section}

The LIST section is not part of the MBFITS raw-data format, and contains the 
information in the current index list. LIST consists of LIST%FOUND (the number
of observations found), and -- for each observation -- LIST1, LIST2,... etc.
\\[1.5ex]
\begin{tabular}{llll}
LIST              & S    & & \\
                  & S    & & \\
LIST\%FOUND       & I    & & number of observations in the current index list \\
                  &      & & \\
LIST1             & S    & & \\
LIST1\%NCFE       & I    & & number of connected frontends \\
LIST1\%DATEOBS    & C*23 & & scan start (yyyy-mm-ddThh:mm:ss.sss)\\
LIST1\%BACKEND    & C*8  & & backend name \\ 
LIST1\%SWITCHMODE & C*20 & & switching mode \\
LIST1\%PROCEDURE  & C*8  & & observing procedure \\
LIST1\%TELESCOPE  & C*13 & & observatory /telescope name \\
LIST1\%OBJECT     & C*20 & & source name \\ 
LIST1\%SCAN       & I    & & scan number \\
LIST1\%INDX       & I    & & observation number \\
\end{tabular}

\newpage
\printindex{}
\end{document}
 
