\documentclass{article}
\usepackage{fancyhdr}
\usepackage{natbib}
\makeindex{}

\include{gildas-def} % GILDAS specific definitions

% Float Positionning Behaviour Correction.
\renewcommand{\textfraction}{0.0}
\renewcommand{\topfraction}{1.0}
\renewcommand{\bottomfraction}{1.0}
\renewcommand{\floatpagefraction}{0.35}
\setcounter{totalnumber}{5}
\setcounter{topnumber}{4}

\newcommand{\emm}[1]{\ensuremath{#1}}   % Ensures math mode.
\newcommand{\emr}[1]{\emm{\mathrm{#1}}} % Uses math roman fonts.
\newcommand{\nds}[1]{\emm{\displaystyle#1}} % Normal display size for array and tabular environment.
\newcommand{\paren}[1]{\nds{\left(  #1 \right) }} % Parenthesis. 
\newcommand{\cbrace}[1]{\nds{\left\{ #1 \right\}}} % Curly Braces.
\newcommand{\bracket}[1]{\nds{\left[  #1 \right] }} % Brackets.
\newcommand{\abs}[1]{\emm{\left| #1 \right|}} % Absolute value.

% Makes fancy headings and footers.
\pagestyle{fancy}

\fancyhf{} % Clears all fields.

\lhead{\scshape Comparison of ATM versions}
\rhead{\scshape \nouppercase{\rightmark}}   %
\fancyfoot[C]{\bfseries \thepage{}}

\renewcommand{\headrulewidth}{0pt}    %
\renewcommand{\footrulewidth}{0pt}    %

\renewcommand{\sectionmark}[1]{%
  \markright{\thesection. \MakeLowercase{#1}}}
\renewcommand{\subsectionmark}[1]{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\kbolt}{\emm{k_\emr{bolt}}}
%
\newcommand{\temp}[2]{\emm{T_\emr{#1}\ifthenelse{\equal{#2}{}}{}{^\emr{#2}}}}
\newcommand{\Tas}[1][]{\temp{a}{\star}}
\newcommand{\Tant}[1][]{\temp{ant}{#1}}
\newcommand{\Tastro}[1][]{\temp{astro}{#1}}
\newcommand{\Trec}[1][]{\temp{rec}{#1}}
\newcommand{\Tsky}[1][]{\temp{sky}{#1}}
\newcommand{\Temi}[1][]{\temp{emi}{#1}}
\newcommand{\Tcal}[1][]{\temp{cal}{#1}}
\newcommand{\Tcaltrue}{\temp{cal}{true}}
\newcommand{\Tcalmeas}{\temp{cal}{meas}}
\newcommand{\Tatm}[1][]{\temp{atm}{#1}}
\newcommand{\Thot}[1][]{\temp{hot}{#1}}
\newcommand{\Tcold}[1][]{\temp{cold}{#1}}
\newcommand{\Tloss}[1][]{\temp{loss}{#1}}
\newcommand{\Tcab}[1][]{\temp{cab}{#1}}
\newcommand{\Tamb}[1][]{\temp{amb}{#1}}
\newcommand{\Trj}{\temp{}{RJ}}
\newcommand{\Tbg}{\temp{bg}{}}
%
\newcommand{\C}{\emm{C}}
\newcommand{\cdark}{\emm{c_\emr{dark}}}
\newcommand{\el}{\emr{elevation}}
\newcommand{\airmass}{\emm{a}}
\newcommand{\gcal}{\emm{\mathcal{G}}}
\newcommand{\gim}{\emm{G_\emr{im}}}
\newcommand{\gimtrue}{\emm{G_\emr{im}^\emr{true}}}
\newcommand{\gimmeas}{\emm{G_\emr{im}^\emr{meas}}}
\newcommand{\g}{\emm{g}}
\newcommand{\Feff}{\emm{F_\emr{eff}}}
\newcommand{\Fefftrue}{\emm{F_\emr{eff}^\emr{true}}}
\newcommand{\Feffmeas}{\emm{F_\emr{eff}^\emr{meas}}}
\newcommand{\opacity}[1]{\emm{\tau\ifthenelse{\equal{#1}{}}{}{_\emr{#1}}}}
\newcommand{\tausig}{\opacity{sig}}
\newcommand{\tauima}{\opacity{ima}}
\newcommand{\taudry}{\opacity{dry}}
\newcommand{\tauwet}{\opacity{wet}}
\newcommand{\tautrue}{\opacity{true}}
\newcommand{\taumodel}{\opacity{mod}}
\newcommand{\water}{\emr{w_{H_2O}}}
\newcommand{\awater}{\emr{\alpha_{H_2O}}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\title{IRAM Memo 2009-5\\[3\bigskipamount]
  Comparison of ATM versions:\\
  Impact on the calibration of IRAM instruments}%
\author{J. Pety$^{1,2}$, S. Bardeau$^{1}$ \& E. Reynier$^{1}$\\[0.5cm]
  1. IRAM (Grenoble) \\
  2. Observatoire de Paris}%
\date{Dec, 4th 2009\\
  Version 1.0}

\maketitle

\begin{abstract}
  Since its first introduction into GILDAS in 1985, the ATM modelling
  program completely changed. With the advent of large bandwidth receivers
  and submillimeter receivers, it is time to upgrade the version of ATM
  used in GILDAS to calibrate IRAM instruments. This memo tries to assess
  the impact of changing the atmospheric model on the calibration of IRAM
  instruments.
  
  After a short description 1) of the single-dish calibration, 2) of ATM
  2009 and 3) the GILDAS interface to ATM 1985 and ATM 2009, an in-depth
  comparison of the results obtained with ATM 1985 and ATM 2009 is
  described. From this study, we expect slight variations of the
  calibration results when swapping from ATM 1985 to ATM 2009.

\end{abstract}

\newpage{}

\tableofcontents{}
\newpage{}

\section{Rayleigh-Jeans or not Rayleigh-Jeans?}

Let $J(\nu,T)$ be the power radiated by a black-body at frequency $\nu$
and temperature $T$. It is always possible to define in a conventional way
a Rayleigh-Jeans temperature \Trj{} such as
\begin{equation}
  \kbolt\,\Trj = J(\nu,T).
\end{equation}
It happens that \Trj{} has a direct physical meaning, \ie{} $\Trj = T$,
when $h\nu<<\kbolt\,T$. However, \Trj{} can always be defined (even when
$h\nu >> \kbolt\,T$: \Trj{} just loses its physical meaning. The advantage
of doing this is that all the equations of calibrations are considerably
simpler to write and to implement in source code using the conventional
Rayleigh-Jeans temperature than the black-body formula. The only constraint
is to remember to transform physical temperature (in particular hot and
cold load temperature) in conventional Rayleigh-Jeans temperature for all
the input parameters. This is what is done in \gildas{}/\telcal{}, in
\atm{} and thus in this memo.

\section{Single-dish calibration in a nutshell}

The output of the (telescope + front-end + back-end) system is a signal
proportional to the sum of the atmospheric emission and the astronomical
signal attenuated by the atmospheric absorption. Various ON-OFF schemes are
used to subtract the atmospheric emission, leaving us with signal
proportional to the source brightness. The purpose of the calibration is to
disentangle the different effects to be able to convert the signal counts
into antenna temperatures.

\subsection{Description of the received signal}

A perfectly linear (front-end + back-end) system delivers a signal (\C{})
in counts which is defined as
\begin{equation}
  \C = \cdark + \g\,(\Tant[tot]+\Trec),
  \label{eq:linrec}
\end{equation}
where
\begin{itemize}
\item \cdark{} is the signal delivered when the (front-end + back-end)
  system is blind;
\item \g{} is the (front-end + back-end) system gain;
\item \Trec{} the noise added by the receiver and the optics, usually
  called receiver temperature;
\item \Tant[tot] the signal seen by the receiver, usually called antenna
  temperature.
\end{itemize}
As heterodyne receivers mix input signal from two different frequencies,
\Tant[tot] can be written as
\begin{equation}
  \Tant[tot] = \frac{\Tant[sig]+\gim\,\Tant[ima]}{1+\gim},
\end{equation}
where
\begin{itemize}
\item \Tant[sig] and \Tant[ima] are respectively the signal in the signal
  and image bands;
\item and \gim{} is the ratio of the receiver gain in the signal
  ($\g_\emr{sig}$) and image $\g_\emr{ima}$ bands (at least 0.1 for
  (sub-)millimeter receivers at IRAM).
\end{itemize}
\Tant{} is a combination of losses \Tloss{} and of the sum of the
atmospheric emission (\Tatm) and astronomical emission (\Tastro)
attenuated by the atmospheric absorption
\begin{equation}
  \Tant = \Feff\,\bracket{\Tatm\exp(-\airmass\tau)+\Tastro} + (1-\Feff)\,\Tloss
\end{equation}
where
\begin{itemize}
\item \Feff{} is the forward efficiency, describing the forward coupling to
  of the receiver to the signal;
\item $\tau$ is the atmopsheric zenith opacity at the observed frequency;
\item \airmass{} is the airmass, which relate the zenith opacity to the
  opacity at the elevation of the observation:
  \begin{equation}
    \airmass = 1/\sin(\el);
    \label{eq:airmass}
  \end{equation}
\end{itemize}
The losses come from the imperfect coupling of the receiver to the sky. It is here important
to note that \Tloss{} comes from two sources: 1) the (sub-)millimeter
emission inside the cabin, picked up by the receiver optic and proportional to
the cabin temperature \Tcab{} and 2) the (sub-)millimeter emission of the
ground, picked up by the antenna and proportional to the outside ambient
temperature \Tamb{}. Thus
\begin{equation}
  \Tloss = \alpha \Tcab + (1-\alpha) \Tamb,
\end{equation}
with $\alpha$ being a largely unknown coupling factor.

It is usually supposed that \Feff{} and \Tloss{} are identical for both
bands of an heterodyne receiver. This maybe should be revisited with the
large IF of today receivers.

\subsection{Description of the calibration scheme}

In order to disentangle the different effects, three steps are needed
\begin{enumerate}
\item Once in a while, skydips are measured to determine the telescope
  forward efficiency (\Feff{}) as a function of frequency;
\item Every 10 to 15 minutes, observations of 1) two references at very
  different temperatures (the hot and cold load) and 2) the atmosphere in a
  direction devoid of signal are used to deduce the opacity of the
  atmosphere and the calibration factor. In modern system, the hot load is
  a foam at roughly the room temperature and the cold load is the cryostat
  window of the receiver which is roughly at liquid nitrogen temperature;
\item The telescope is regularly switched on and off source to subtract the
  atmospheric contribution to the signal seen by the receiver.
\end{enumerate}

\subsubsection{Skydips and determination of the forward efficiency}

In a skydip, the atmospheric emission, as seen by the receiver (\Tsky), is
measured at equally spaced airmass (\airmass). \Tsky{} is a combination of
the atmospheric emission \Temi[tot] and of losses \Tloss{}
\begin{equation}
  \Tsky = \Feff\Temi[tot] + (1-\Feff)\Tloss.
  \label{eq:sky:1}
\end{equation}
And the atmospheric emission is the sum of the atmospheric emission in both
receiver bands
\begin{equation}
  \Temi[tot] = \frac{\Temi[sig]+\gim\,\Temi[ima]}{1+\gim},
  \label{eq:sky:2}
\end{equation}
each contribution computed from an equivalent atmospheric temperature
\Tatm{} and opacity $\tau$
\begin{equation}
  \Temi[sig] = \Tatm[sig]\,\cbrace{1-\exp\paren{-\airmass\tausig}}
  \quad \mbox{and} \quad
  \Temi[ima] = \Tatm[ima]\,\cbrace{1-\exp\paren{-\airmass\tauima}}.
  \label{eq:sky:3}
\end{equation}
The zenith opacity can be written as a combination of a dry and wet components
\begin{equation}
  \tau = \taudry + \tauwet,
\end{equation}
where \taudry{} is the opacity due to the permanent components of the
atmosphere (mainly oxygen) and \tauwet{} is proportional to the varying
amount of water vapor amount (\water{}) in the atmosphere: $\tauwet =
\awater\,\water$

Assuming that \Feff{} and \Tloss{} are independent of the elevation and
that \taudry{} and \awater{} are correctly modeled by an atmospheric model,
we obtain that \Tsky{} is a function of \Feff{}, \Tloss{}, \gim{}, \water{}
and the airmass (\airmass). If \gim{} and \Tloss{} are assumed to be
measured by other means, then \Feff{} and \water{} can be fitted through
the measured couples (\Tsky,\airmass).

\subsubsection{Load calibration and determination of the zenith opacity}
\label{sec:load}

The hot and cold load as well as the atmosphere in a region devoid of
signal are measured in turn. From Eq.~\ref{eq:linrec}, it is easy to show
that
\begin{equation}
  \frac{\Thot-\Tsky[tot]}{\C_\emr{hot}-\C_\emr{sky}^{tot}} = 
  \frac{\Thot-\Tcold}{\C_\emr{hot}-\C_\emr{cold}},
  \label{eq:load}
\end{equation}
where 
\begin{itemize}
\item \Thot{} and \Tcold{} are the Rayleigh-Jeans temperature of the loads;
\item $\C_\emr{hot}$ and $\C_\emr{cold}$ are the associated measured counts.
\end{itemize}
From this equation, we deduce \Tsky[tot]. Using an atmospheric model and
Eqs.~\ref{eq:sky:1}--\ref{eq:sky:3}, the total opacity of the
atmosphere at signal and image frequencies are then fitted.

\subsubsection{Data calibration}

The telescope is regularly switched on and off source. It can be shown (see
\eg{} Kramer, 1997) that the brightness temperature of the source can be
related to the measured counts (on and off-source) by
\begin{equation}
  \Tas = \Tcal\,\frac{\C_\emr{on}-\C_\emr{off}}{\C_\emr{hot}-\C_\emr{off}},
  \label{eq:cal:1}
\end{equation}
where \Tcal{}, the calibration factor, is given by
\begin{eqnarray}
  \Tcal &=& (1+\gim)\,\bracket{\Temi[sig]-\Tbg}\\
        &+& (1+\gim)\,\bracket{\Tloss-\Temi[sig]}\,\exp(\airmass\tausig)\\
        &+& \gim\,\bracket{\Temi[sig]-\Tbg}\,\bracket{\exp\cbrace{\airmass(\tausig-\tauima)}-1}\\
        &+& \frac{1+\gim}{\Feff}\,\bracket{\Thot-\Tloss}\,\exp(\airmass\tausig).
  \label{eq:cal:2}
\end{eqnarray}
If the cosmic background power (\Tbg{}) is negligeable compared to the
atmospheric emission (\Temi[sig]), then the last equation reduces to
\begin{equation}
  \Tcal = (\Thot-\Tsky)\frac{1+\gim}{\Feff\,\exp\paren{-\airmass\tausig}}.
  \label{eq:cal:3}
\end{equation}
From the previous steps, all the parameters are known to compute \Tcal{}
and thus \Tas{}.

\section{Description of ATM 2009}

A thorough description of the physics underlying recent version of ATM can
be found in Pardo et al. (2001a, 2001b, 2005). A brief summary is given
here.

\subsection{Atmospheric profile}

The atmospheric profile is computed from a combination of input parameters
and physical laws. The shape of the atmosphere density and pressure are
defined by the physical laws (hydrostatic equilibrium + mixture of ideal
gas). The shape of the temperature profile is defined by the following two
parameters.
\begin{description}
\item[Troposperic lapse rate,] which is used to fix the temperature
  gradient up to the tropopause. Its recommanded value is -5.6 K/km.
\item[Atmospheric type,] which is used to reproduce the shape of the
  temperature profile above the tropopause. For Pico Veleta and Plateau de
  Bure, it should be the well defined mid-latitude averaged
  profiles for summer and winter. Continuity of the temperature atmospheric
  profile is enforced at the tropopause.
\end{description}
The atmospheric model is computed assuming a plane-parallel geometry
defined by the following three parameters.
\begin{description}
\item[Atmospheric upper boundary,] which is the maximum altitude of the
  modeled atmosphere, typically 48~km.
\item[Primary pressure step,] which is the pressure step used to define the
  height of the first atmospheric layer, typically 10~mb.
\item[Pressure step factor,] which is the multiplicative factor used to
  define the next pressure step from the current one, typically 1.2.
\end{description}
The atmospheric profile of the minor components is defined by the following
two parameters.
\begin{description}
\item[Water vapor scale height,] which is used to define the exponential
  distribution of water, typically 2~km (could be between 1.5 and 3~km).
\item[Atmospheric type,] which is also used to define the profile
  repartition of the other minor components (\eg{} ozone) of the
  atmosphere.
\end{description}
For our applications (calibrating radio-astronomy data), most of these
parameters should have a minor impact (still to be checked). The 3
remaining parameters, \ie{} the ground temperature and pressure at the
telescope as well as the amount of precipitable water vapor at zenith, are
used to hook the atmospheric profile defined above to the current
conditions at the telescope site. These three parameters thus have a major
impact on the modeled results.

\subsection{(Sub-)mm radiative transfer}

\newcommand{\OO}{\emr{O_2}}
\newcommand{\OOO}{\emr{O_3}}
\newcommand{\HOH}{\emr{H_2O}}

\subsubsection{Line}

Under clear weather, the atmospheric absorption/emission at
(sub)-millimeter wavelengths is dominated by the rotational and fine
structure line of molecules in their ground electronic and low vibrational
states. Three molecules plays a major role
\begin{description}
\item[\HOH{}] is the most abundant polar molecule present in the
  atmosphere. Its electric dipole moment is 1.88 Debye. ATM 2009 also takes
  into account the water isotopomers.
\item[\OO{}] Being an homonuclear molecule, \OO{} has a zero-valued
  electric dipole moment. However, it has a triplet electronic ground
  state, with two electrons paired with parallel spins, implying a weak
  magnetic dipole moment. The weakness of this dipole moment is compensated
  by the large \OO{} abundance, implying \OO{} line intensities similar to
  \HOH{} ones.
\item[\OOO{}] is an asymmetric top molecule, such as \HOH{}. Despite the
  small ozone abundance, its lines have significant peak opacities,
  especially in the submillimeter domain. This is dues to linewidths much
  narrower than water. This can be explained by two facts: 1) the ozone
  dipole moment is 0.53 Debye, about 3 times less than water and 2) ozone
  is mostly concentrated between 11 and 40~km of altitude, implying
  linewidths 20 times narrower than sea level lindwidths.
\end{description}

\subsubsection{Continuum}

The continuum in ATM 2009 is divided into two components
\begin{description}
\item[The dry component,] which comes from collision induced absorption due
  to transient eletric dipole moments generated in binary interactions of
  symmetric molecules with eletric quadrupole moments such as N$_2$ and
  \OO{}, and the relaxation of the \OO{} absorption.
\item[The wet component,] which is indeed a pseudo-continuum. It is a
  modeling of the long-range linewidth of the water lines, whose true shape
  is not known accurately enough beyond a few times the halfwidth from the
  line centers.
\end{description}
Both components have been modeled from 200 GHz to 1.1 THz using FTS
measurements at CSO on Mauna Kea.

\subsection{\gildas{} interface}

The GILDAS interface to ATM 1985 and ATM 2009 was thought to enable an easy
swap from one version to the other. We first describe this interface at the
programmer level (\ie{} FORTRAN interface) and then at the user level
(\ie{} \astro{} interface).

\subsubsection{FORTRAN interface}

The different subroutines, which interface both version of ATM, are
extensively described in Appendix~\ref{sec:app:interfaces}. In short, the
programmer first calls
\begin{verbatim}
call atm_setup('1985',error)
\end{verbatim}
or 
\begin{verbatim}
call atm_setup('2009',error)
\end{verbatim}
to select the version of ATM to be used from this point on. If this call is
missing, \gildas{} assumes that it must use ATM 1985 (default
behavior). ATM 2009 enables the fine tuning of the atmospheric
profile. This is implemented in the \gildas{} interface by the call of two
subroutines
\begin{verbatim}
call atm_atmosp_get(ctype_out,humidity_out,wvsh_out,tlr_out,top_out,  &
    p_step_out,p_step_factor_out,error)
\end{verbatim}
which gets the default values and 
\begin{verbatim}
call atm_atmosp_set(ctype_in,humidity_in,wvsh_in,tlr_in,top_in,  &
    p_step_in,p_step_factor_in,error)
\end{verbatim}
which sets the wanted values. \texttt{ctype\_in} and \texttt{ctype\_out}
are the atmospheric types, which can be set to \texttt{tropical,
  midlatsummer, midlatwinter, subarcticsummer, subarcticwinter}.

The calls to the other ATM routines are unchanged compared to the
historical behavior, \ie{}
\begin{verbatim}
call atm_atmosp(t0,p0,h0)
\end{verbatim}
defines the atmosphere profiles,
\begin{verbatim}
call atm_transm(water,airmass,freq,temi,tatm,tauox,tauw,taut,ier)
\end{verbatim}
returns the atmospheric temperatures and opacities and 
\begin{verbatim}
call atm_path(water,airmass,freq,path,ier)
\end{verbatim}
returns the integrated optical length of current atmosphere.  Note that the
support for the \texttt{atm\_path} is not yet available with ATM 2009.

\subsubsection{\astro{} interface}

The \texttt{SET ATM 1985|2009|OLD|NEW} command switches the ATM version and
the \texttt{ATM} command computes the atmospheric parameters. In ATM 1985,
the atmosphere properties other than temperature, pressure and humidity,
are fixed while they can be changed for ATM 2009 through the following
\sic{} variables with their default values, their units and their definitions
\begin{verbatim}
  ATM%PROFILE%TYPE      MIDLATSUMMER        Atmospheric type
  ATM%PROFILE%HUMIDITY         1.000 [%]    Ground relative humidity (indicative)
  ATM%PROFILE%WVSH             2.000 [km]   Water vapor scale height
  ATM%PROFILE%TLR             -5.600 [K/km] Tropospheric lapse rate
  ATM%PROFILE%TOP             48.000 [km]   Upper atm. boundary for calculations
  ATM%PROFILE%DP              10.000 [hPa]  Primary pressure step
  ATM%PROFILE%DP_FACTOR        1.200 []     Pressure step ratio between two consecutive layers
\end{verbatim}
The other input parameters of the \texttt{ATM} command are the following \sic{} variables
\begin{verbatim}
  TEMPERATURE      Outside temperature
  ZERO_PRESSURE    Pressure at sea level.
  AIRMASS          Number of air masses
  WATER            Precipitable water vapor
  FORWARD_EFF      Forward efficiency
  GAIN_IMAGE       Receiver gain ratio
  TREC             Receiver temperature
  FREQ_SIG         Signal frequency (in GHz)
  FREQ_IMA         Image frequency (in GHz)
\end{verbatim}
These  variables  can  be assigned using the \texttt{LET} command. The
remaining input variable
\begin{verbatim}
  ALTITUDE         Site altitude
\end{verbatim}
is modified by the \texttt{OBSERVATORY} command. The output of the
\texttt{ATM} command consists in the following variables
\begin{verbatim}
  TRUE_PRESSURE    Local pressure, derived from the site altitude and
                   the sea level pressure by the scale height of 5.5 km
  TSYS             The system temperature in the signal sideband
  TAU_H2O          The water vapor opacity
  TAU_O2           The dry atmosphere opacity (mostly due to Oxygen,
                   but minor constituents like Ozone may also play a role)
  TAU_TOT          The total opacity: H2O + O2 (+ minor components for new ATM versions)
  EMIS_SIG         The atmospheric emission (Kelvin) in the signal side band
  EMIS_IMA         The atmospheric emission (Kelvin) in the image sideband
  PATH_SIG         The atmospheric excess optical path length (mm)
                   in the signal sideband
  PATH_IMA         The atmospheric excess optical path length (mm)
                   in the image sideband
\end{verbatim}
These variables can then be used to produce plots of atmospheric
transparency, system temperatures, etc...

\section{Comparison of ATM 1985 and ATM 2009}

\subsection{Comparison of the implementation}

There are at least 2 main differences between the implementations of ATM
1985 and ATM 2009.
\begin{itemize}
\item ATM 1985 gives sensible (\ie{} continuous) results even for negative
  amount of water vapor while ATM 2009 displays a discontinuity for an
  amount of water vapor equal to zero and then constant values for negative
  amount of water vapor (See Fig.~\ref{fig:TauvsWater}). The ATM 2009
  behavior comes from the fact that the atmospheric profile is first
  computed for an indicative humidity value and then scaled to the ture
  amount of water vapor. The current version of ATM 2009 just default to
  non continuous values for zero or negative amount of water vapor.
\item For \Temi{}, ATM 1985 gives just the emission of the atmosphere while
  ATM 2008 gives the sum of the atmosphere plus the cosmic microwave
  background emissions. The impact on the calibration has to do with the
  comparison of Eqs.~\ref{eq:cal:2} and~\ref{eq:cal:3}. A numeric
  comparison should be done.
\end{itemize}

\begin{figure}[htbp]
  \centering
  \includegraphics[height=0.45\textwidth,angle=270]{atm-comparison-1}
  \hspace*{1cm}
  \includegraphics[height=0.45\textwidth,angle=270]{atm-comparison-2}
  \caption{Opacities, \Tatm{} and \Temi{} as a function of precipitable
    water vapor for two different frequencies: 115.3~GHz (left) and
    230.5~GHz (right). ATM 2009 results are shown in red while ATM 1985 are
    shown in black.}
  \label{fig:TauvsWater}
\end{figure}

\subsection{Comparison at constant amount of water vapor}

Figures in Appendix~\ref{sec:app:comp} displays an exhaustive comparison of
the influence on the calibration of the different modeling by ATM 1985 and
ATM 2009. The columns of these figures display $1-\exp(-\airmass\tau)$,
\Temi{}, \Tsky{} and \Tcal{} as a function of the frequency. There are two
figures per frequency band of the EMIR generation of receivers at Pico
Veleta: one at medium elevation (\ie{} 45~deg) and one at low elevation
(\eg{} 20~deg) were the differences between models will be maximum. For
each band, realistic values of \Feff{}, \gim{}, \Trec{} and \Thot{} values
were used. The top rows displays the results for ATM 1985, the middle rows
displays the results for ATM 2009 and the bottom rows displays the relative
difference, \ie{} (ATM 1985 - ATM 2009)/ATM 2009 in percentage. The
computations (and in particular the relative differences) are done for one
value of water vapor at a time in the range between 0.1 and 8~mm.

The first fact arising from the comparison, is that both models have
clearly different behaviors as a function of frequency: ATM 1985 have a
much simpler dependency on the frequency than ATM 2009. This comes mainly
from the inclusion of water isotopologue lines (\eg{} the large line at
about 105~Ghz) and ozone lines (the many narrow lines) in ATM 2009 but also
from a finer modeling of water lines by ATM 2009.

Another general trend is that the differences between models for
$1-\exp(-\airmass\tau)$, \Temi{} and \Tsky{} decreases when the amount of
water vapor increases. This points toward a good consistency of the
treatment of water vapor in both models but a very different treatment of
the dry continuum emission/absorption of the atmosphere. However, this
result is inversed on \Tcal{}, \ie{} the differences on \Tcal{} increases
when the amount of water vapor increases. This surprising result probably
comes from the fact that $\Temi \propto \Tatm \,
\bracket{1-\exp(-\airmass\tau)}$ while $\Tcal \propto \exp(\airmass\tau)$.
In other words, while \Temi{} can have close values in both model, this may
require very different values of $\tau$. Also, the differences between
model results are much more pronounced on $1-\exp(-\airmass\tau)$ and
\Temi{} than on \Tsky{} and \Tcal{}. The reason of the decrease of the
differences between \Temi{} and \Tsky{} comes from the fact that the loss
term added in \Tsky{} is independent of the ATM model while it represents a
significant fraction of the \Tsky{} value. We guess that the large
differences in modeling between ATM versions have finally a relatively
small impact on \Tcal{} comes from the fact that \Tsky{} and
$\exp(-\airmass\tau)$ consistently cancel the modeling impact of ATM. Hence
at 45~deg of elevation, the relative difference in \Tcal{} is almost always
smaller than 5\%, while at 20~deg of elevation, this relative difference is
of the order of 10\%.

\subsection{Comparison of the full calibration scheme}

As described in sections~\ref{sec:load}, the actual calibration of data is
a two-steps process. In the first step, \Tsky{} is simply deduced from
Eq.~\ref{eq:load} and the ATM model is then just used to associate to this
\Tsky{} value, a value of the total opacity of the atmosphere at signal and
image frequencies. In the second step, the \Tcal{} value is computed with
Eq.~\ref{eq:cal:3} and then used on the data.

Hence, in Eq.~\ref{eq:cal:3}, the value of the term $(\Thot-\Tsky)$ is
independent of the ATM model and/or of the coupling factors, while the
value of the term
$\bracket{1+\gim}/\bracket{\Feff\,\exp\paren{-\airmass\tau}}$ is directly
dependent of the ATM modeling and/or of the coupling factors. Two different
situations arise: 1) the measured coupling parameters are at best known
only to a given accuracy and at worst biased and 2) the model is
inaccurate. To model both situations, we will assume that \tautrue{},
\gimtrue{}, \Fefftrue{} and \Tcaltrue{} are the actual values of those
different parameters while \taumodel{}, \gimmeas{}, \Feffmeas{}, and
\Tcalmeas{} are the modeled or measured values. It is easy to show that the
relative error on \Tcal{} is
\begin{equation}
  \label{eq:tcal:accuracy}
    \frac{\Tcalmeas-\Tcaltrue}{\Tcaltrue}
  = \frac{\Fefftrue(1+\gimmeas)}{\Feffmeas(1+\gimtrue)}
    \exp\bracket{\airmass(\taumodel-\tautrue)}-1
\end{equation}
Thus the accuracy of \Tcal{} directly depends on the accuracy of the
coupling factors and on the modeled opacity. It must be noted that 1) this
equation assumes that the load and data calibration are made at the same
airmass (\ie{} elevation) 2) \gim{} is close to zero for the EMIR
receivers, implying that the \Feff{} is one of the key parameter to get
high calibration accuracy and 3) it is better to underestimate the opacity
than to overestimate it.

Fig.~\ref{fig:TauvsWater} compares the values of opacities, \Tatm{} and
\Temi{} as a function of precipitable for both version of ATM. The
comparison is made at two different frequencies, which have a very
different opacity behavior: 
\begin{description}
\item[115.3~GHz] The opacity is dominated by the dry continuum due to the
  transparency of water at this frequency and to the presence of a close
  oxygen line. It is known that at 3mm under submillimeter weather
  conditions, the measured sky emission is lower than the modeled one with
  ATM 1985. This facts comes from the uncertainty on the knowledge of the
  \Feff{}, an incorrect modeling of the dry continuum with ATM 1985, or a
  combination of both. Anyway, this is why ATM 1985 authorizes negative
  amount of water vapor.  ATM 2009 makes the situation even worse because
  the total opacity and thus emission are larger with ATM 2009 than with
  ATM 1985. This comes mainly from the dry continuum opacity being larger
  with ATM 2009 than with ATM 1985... On the other hand, the same amount of
  atmospheric emission is reached with significantly less water vapor in
  ATM 2009.
\item[230.5~GHz] The opacity is dominated by its wet component, the dry
  continuum being almost negligeable. This is the reason why \Tatm{}
  sharply increases when the amount of water vapor goes to zero with ATM
  2009. It is unclear why such an effect is not seen with ATM 1985. Here
  also, the total opacity and thus emission are larger with ATM 2009 than
  with ATM 1985, and the wet opacity increases slowlier with ATM 2009 than
  with ATM 1985. But the effects are much less pronounced at 230.5 than at
  115.3~GHz. The consequence is that the amount of precipitable vapor (and
  thus of opacity) needed to reproduce the emission of the sky is similar
  in both ATM versions.
\end{description}

%% \subsection{Comparison of skydip results}

%% This works is on-going. Only preliminary results are available.

%% We are interested to see the impact of changing of version of ATM on the
%% derivation of one of the key parameter of the calibration, \ie{} the
%% forward efficiency (\Feff).

%% When fitting the skydip from one receiver, the derived \Feff{} is identical
%% for ATM 1985 or ATM 2009. However, the associated water amount needed is
%% much less with ATM 2009 than with ATM 1985. Now, it is easy to see that the
%% fit of the skydips is very much dependent on \Tloss{}, which is badly
%% defined. We thus are trying to fit several skydips together to get both the
%% associated \Feff{}, \Tloss{} values but using only one value of water
%% vapor amount.

\section{Recommendations}

ATM 2009 largely improves the modelling of the atmosphere emission and
absorption compared to ATM 1985 (\eg{} introduction of minor atmospheric
components, better (pseudo)-continuum modelling). However, the ATM 2009
version used in GILDAS shows a problem of continuum for a zero amount of
water vapor. In addition, a negative amount of water is forbidden by ATM
2009, while this possibility can be useful when systematic biases dominate
the measure (\eg{} 3mm observations during sub-millimeter conditions).
J.R.~Pardo is interested by 30m skydip results to constrain the dry and wet
continuum opacities under 200~GHz in ATM 2009.

From the implementation viewpoint, ATM 2009 version is robust. It can be
run routinely without risk of crashing. The GILDAS interface to ATM 1985
and ATM 2009 was thought to enable an easy swap from one version to the
other. When swapping from ATM 1985 to ATM 2009, variations of the
calibration results are expected. In particular, the accuracy of \Tcal{} is
given by Eq.~\ref{eq:tcal:accuracy}. It directly depends on the accuracy of
the coupling factors and on the modeled opacity.  It is better to
underestimate the opacity than to overestimate it.

\section{Acknowledgement}

The authors thank J.R.~Pardo, D.~Brogui\`ere, S.~Guilloteau and C.~Kramer
for useful discussions.

\section{Bibliography}

\begin{itemize}
\item J. R. Pardo, E. Serabyn and J. Cernicharo, "Submillimeter atmospheric
  transmission measurements on Mauna Kea during extremely dry El Ni\~no
  conditions: Implications for broadband opacity contributions" J.  Quant.
  Spectr. and Radiat. Transfer, 68/4, 419-433 (2001).
\item J. R. Pardo, J. Cernicharo, and E. Serabyn, "Atmospheric Transmission
  at Microwaves (ATM): An Improved Model for mm/submm applications" IEEE
  Trans. on Antennas and Propagation, 49/12, 1683-1694 (2001).
\item J.R. Pardo, E. Serabyn, M.C. Wiedner, and J. Cernicharo, "Measured
  telluric continuum-like opacity beyond 1 THz" J. Quant. Spec. and Radiat.
  Transfer 96/3-4, 537-545 (2005).
\end{itemize}


\newpage{}
\appendix{}

\section{\gildas{} fortran interfaces to ATM}
\label{sec:app:interfaces}

\begin{verbatim}
interface
  subroutine atm_setup(inversion,error)
     use atm_version
     !---------------------------------------------------------------------
     ! @ public
     ! Set the ATM version to be used. Supported versions are 1985,
     ! and 2009. 'OLD' (resp. 'NEW') is an alias for 1985 (resp. 2009).
     !---------------------------------------------------------------------
     character(len=*), intent(in)    :: inversion  ! User input version
     logical,          intent(inout) :: error      ! Error flag
  end subroutine atm_setup
  !
  subroutine atm_atmosp_get(ctype_out,humidity_out,wvsh_out,tlr_out,top_out,  &
    p_step_out,p_step_factor_out,error)
    use atm_version
    !---------------------------------------------------------------------
    ! @ public
    ! Public entry point to:
    !  1) get the C++ global variables into the Fortran-SIC ones,
    !  2) return these latter ones.
    ! Warning: these variables make sense only with ATM 2009. Return ATM
    ! 2009 values even if it is not currently used (not an error).
    !---------------------------------------------------------------------
    character(len=*), intent(out)    :: ctype_out          ! Atmospheric type (as a string)
    real(4),          intent(out)    :: humidity_out       ! [%]    Ground Relative Humidity (indication)
    real(4),          intent(out)    :: wvsh_out           ! [km]   Water vapor scale height
    real(4),          intent(out)    :: tlr_out            ! [K/km] Tropospheric lapse rate
    real(4),          intent(out)    :: top_out            ! [km]   Upper atm. boundary for calculations
    real(4),          intent(out)    :: p_step_out         ! [mb]   Primary pressure step
    real(4),          intent(out)    :: p_step_factor_out  ! []     Pressure step ratio between two consecutive layers
    logical,          intent(inout)  :: error              ! Logical error flag
  end subroutine atm_atmosp_get
  !
  subroutine atm_atmosp_set(ctype_in,humidity_in,wvsh_in,tlr_in,top_in,  &
    p_step_in,p_step_factor_in,error)
    use atm_version
    !---------------------------------------------------------------------
    ! @ public
    ! Public entry point to:
    !  1) set the Fortran-SIC global variables values,
    !  2) set the C++ global variables from these values.
    ! Warning: these variables make sense only with ATM 2009. Nothing
    ! will be done if ATM 2009 is not the version in use (not an error).
    ! NB: 'ctype_in' is not case-sensitive, and can be shorten as long
    ! as it is not ambiguous.
    !---------------------------------------------------------------------
    character(len=*), intent(in)    :: ctype_in          ! Atmospheric type (as a string)
    real(4),          intent(in)    :: humidity_in       ! [%]    Ground Relative Humidity (indication)
    real(4),          intent(in)    :: wvsh_in           ! [km]   Water vapor scale height
    real(4),          intent(in)    :: tlr_in            ! [K/km] Tropospheric lapse rate
    real(4),          intent(in)    :: top_in            ! [km]   Upper atm. boundary for calculations
    real(4),          intent(in)    :: p_step_in         ! [mb]   Primary pressure step
    real(4),          intent(in)    :: p_step_factor_in  ! []     Pressure step ratio between two consecutive layers
    logical,          intent(inout) :: error             ! Logical error flag
  end subroutine atm_atmosp_set
  !
  subroutine atm_atmosp(t0,p0,h0)
    use atm_version
    !---------------------------------------------------------------------
    ! @ public
    ! Setup the atmospheric structure
    !---------------------------------------------------------------------
    real(4), intent(in) :: t0  ! Ground temperature [K]
    real(4), intent(in) :: p0  ! Ground pressure [hPa]
    real(4), intent(in) :: h0  ! Altitude of the site [km]
  end subroutine atm_atmosp
  !
  subroutine atm_transm(water,airmass,freq,temi,tatm,tauox,tauw,taut,ier)
    use atm_version
    !---------------------------------------------------------------------
    ! @ public
    ! Return the atmospheric temperatures and opacities given the amount
    ! of water and the frequency, for current atmosphere previously set
    ! with 'atm_atmosp()'
    !---------------------------------------------------------------------
    real(4),    intent(in)  :: water    ! Precipitable water vapor [mm]
    real(4),    intent(in)  :: airmass  ! Number of air masses []
    real(4),    intent(in)  :: freq     ! Frequency [GHz]
    real(4),    intent(out) :: temi     ! Atmospheric emission [K]
    real(4),    intent(out) :: tatm     ! Mean temperature [K]
    real(4),    intent(out) :: tauox    ! Opacity (dry component) [neper]
    real(4),    intent(out) :: tauw     ! Opacity (wet component) [neper]
    real(4),    intent(out) :: taut     ! Total opacity [neper]
    integer(4), intent(out) :: ier      ! Error status
  end subroutine atm_transm
  !
  subroutine atm_path(water,airmass,freq,path,ier)
    use atm_version
    !---------------------------------------------------------------------
    ! @ public
    ! Integrated optical length of current atmosphere
    !---------------------------------------------------------------------
    real(4),    intent(in)  :: water    ! Precipitable water vapor [mm]
    real(4),    intent(in)  :: airmass  ! Number of air masses []
    real(4),    intent(in)  :: freq     ! Frequency [GHz]
    real(4),    intent(out) :: path     ! Optical length [cm]
    integer(4), intent(out) :: ier      ! Error status
  end subroutine atm_path
  !
end interface
\end{verbatim}

\newpage{}

\section{Comparison at constant amount of water vapor as a function of the frequency}
\label{sec:app:comp}

\newcommand{\FigATMvsFreq}[1]{%
  \begin{figure}[htbp]
    \centering
    \includegraphics[width=0.425\textheight,angle=270]{atm-comparison-#1-20deg}
  \end{figure}
  \begin{figure}[htbp]
    \centering
    \includegraphics[width=0.425\textheight,angle=270]{atm-comparison-#1-45deg}
  \end{figure}}

\FigATMvsFreq{e090}
\FigATMvsFreq{e150}
\FigATMvsFreq{e230}
\FigATMvsFreq{e300}

\section{Effect of Earth curvature}
\label{sec:app:curvature}

In \gildas{}, the effect of the Earth curvature is approximated by a
correction to the usual airmass definition (See Eq.~\ref{eq:airmass}).
Fig.~\ref{fig:EarthCurvature} displays the airmass as a function of the
elevation for 3 different atmosphere models: 1) a plane parallel
atmosphere, 2) a curved atmosphere with a scale height of 2.7~km, and 3) a
curved atmosphere with a scale height of 5.5~km. It is clear that as long
as the elevation is larger than 20~deg, the difference in airmass between
these different atmosphere models is negligeable.

\begin{figure}[htbp]
  \centering
  \includegraphics[height=\textwidth,angle=270]{atm-comparison-3}
  \caption{Top: Effect of the Earth curvature on the airmass as a function 
    of the elevation. Bottom: Relative difference as a function of the
    elevation.}
  \label{fig:EarthCurvature}
\end{figure}


\end{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 
