\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{natbib} 

\makeindex{}

\makeatletter
\textheight 625pt
\textwidth 460pt
\oddsidemargin 0pt
\evensidemargin 0pt
\marginparwidth 50pt
\topmargin 0pt
\brokenpenalty=10000

\newcommand{\aap}{\emph{A\&A}}

\newcommand{\implication}{\emm{\Rightarrow}}

\newcommand{\ie} {{\em i.e.}}
\newcommand{\eg} {{\em e.g.}}

\newcommand{\emm}[1]{\ensuremath{#1}}   % Ensures math mode
\newcommand{\emr}[1]{\emm{\mathrm{#1}}} % Uses math roman fonts
\newcommand{\unit}[1]{\emm{\, \emr{#1}}}

%
\newcommand{\kms}{\unit{km\,s^{-1}}}
\newcommand{\mm}{\unit{mm}}
\newcommand{\kHz}{\unit{kHz}}

%
\newcommand{\nds}[1]{\emm{\displaystyle#1}} % Normal display size for array and tabular environment

% Makes usual math delimiters of the right size
\newcommand{\paren}[1]  {\emm{\left(  #1 \right) }} % Parenthesis 
\newcommand{\cbrace}[1] {\emm{\left\{ #1 \right\}}} % Curly Braces
\newcommand{\hbrace}[1] {\emm{\left\{ #1 \right.}}  % Left Curly Brace
\newcommand{\bracket}[1]{\emm{\left[ #1 \right] }} % Brackets
\newcommand{\sbracket}[1]{\emm{\left[ #1 \right]}} % Small brackets

% Relational
\newcommand{\Definition}{\emm{\equiv}} % Definition Symbol
\newcommand{\about}{\emm{\sim}}        % Order of Magnitude Equality

%
\newcommand{\tol}[1][]{\emm{T_{\emr{#1}}}}
\newcommand{\nc}[1][]{\emm{n_{\emr{#1}}}}
\newcommand{\ic}[1][]{\emm{i_{\emr{#1}}}}
\newcommand{\freq}[2][]{\emm{f_\emr{#2}^{\emr{#1}}}}
\newcommand{\wave}[2][]{\emm{\lambda_\emr{#2}^{\emr{#1}}}}
\newcommand{\velo}[2][]{\emm{v_{\emr{#2}}^{\emr{#1}}}}
\newcommand{\doppler}[2][]{\emm{d_{\emr{#2}}^{\emr{#1}}}}

\newcommand{\redshift}[1][]{\emm{z_{\emr{#1}}}}

\newcommand{\SBSign}[1][]{\emm{SB_\emr{sign}^{\emr{#1}}}}
\newcommand{\SBSep}[1][]{\emm{SB_{\emr{sep}}^{\emr{#1}}}}
\newcommand{\SBSrest}{\SBSep[rest]}
\newcommand{\SBSobs}{\SBSep[obs]}

\newcommand{\lrest}[1][]{\wave[rest]{#1}}
\newcommand{\lobs} [1][]{\wave[obs]{#1}}

\newcommand{\frest}[1][]{\freq[rest]{#1}}
\newcommand{\fmeas}[1][]{\freq[meas]{#1}}
\newcommand{\fred} [1][]{\freq[redshifted]{#1}}
\newcommand{\fobs} [1][]{\freq[obs]{#1}}
\newcommand{\fsou} [1][]{\freq[sou]{#1}}
\newcommand{\flsr} [1][]{\freq[lsr]{#1}}

\newcommand{\wrest}[1][]{\wave[rest]{#1}}
\newcommand{\wobs} [1][]{\wave[obs]{#1}}

\newcommand{\dfrest}[1][]{\emm{\delta \frest[#1]}}
\newcommand{\dfmeas}[1][]{\emm{\delta \fmeas[#1]}}
\newcommand{\dfobs}[1][]{\emm{\delta \fobs[#1]}}
\newcommand{\dflsr}[1][]{\emm{\delta \flsr[#1]}}
\newcommand{\dvelo}[1][]{\emm{\delta \velo[#1]{}}}
\newcommand{\dvmeas}[1][]{\emm{\delta \vmeas[#1]}}
\newcommand{\dvobs}[1][]{\emm{\delta \vobs[#1]}}
\newcommand{\dvrest}[1][]{\emm{\delta \vrest[#1]}}
\newcommand{\dvlsr}[1][]{\emm{\delta \vlsr[#1]}}
\newcommand{\dredshift}[1][]{\emm{\delta \redshift[#1]{}}}

\newcommand{\vmeas}[1][]{\velo[meas]{#1}}
\newcommand{\vlsr}[1][]{\velo[lsr]{#1}}
\newcommand{\vrest}[1][]{\velo[sou]{#1}}
\newcommand{\vobs}[1][]{\velo[obs]{#1}}
\newcommand{\vpara}{\vobs[\parallel]}
\newcommand{\vperp}{\vobs[\perp]}

\newcommand{\dmeas}[1][]{\doppler[meas]{#1}}
\newcommand{\dobs}[1][]{\doppler[obs]{#1}}
\newcommand{\dlsr}[1][]{\doppler[lsr]{#1}}

\newcommand{\Dvobs}[1][]{\emm{\Delta \vobs[#1]}}
\newcommand{\Dvrest}[1][]{\emm{\Delta \vrest[#1]}}

\newcommand{\clight}{\emm{c}}

\newcommand{\class}{\texttt{CLASS}}

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

\fancyhf{} % Clears all fields.

\lhead{\scshape \class{} spectral axis}
\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{\TabHeader}{%
  \begin{table}
    \centering
    \caption{\class{} header parameters used to describe the
      frequency/velocity axes and their translation in this document.}
    \begin{tabular}{cccc}
      \hline
      \hline
      \class{} name & Unit & Translation & Notation \\
      \hline
      \texttt{nchan}   &    --- & Number of channel           & ---               \\
      \texttt{rchan}   &    --- & Reference channel           & \ic[0]            \\
      \texttt{restf}   &    MHz & Tuned signal rest frequency & \frest[tuned,sig] \\
      \texttt{image}   &    MHz & Tuned image rest frequency  & \frest[tuned,ima] \\
      \texttt{fres}    &    MHz & Observatory channel spacing & \dfmeas{}         \\
      \texttt{vres}    & \kms{} & Velocity channel spacing    & \dvmeas{}         \\
      \texttt{voff}    & \kms{} & source systemic velocity    & \vmeas[sys]       \\
      \texttt{doppler} &    --- & Doppler factor              & \dmeas[sys]       \\
      \hline
    \end{tabular}
    \label{tab:header}
  \end{table}}

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

\begin{document}

\title{IRAM Memo 2011-4\\[3\bigskipamount]
  Handling the spectral axis in \class{}}
\author{J.~Pety$^{1,2}$ \& S.~Bardeau$^1$\\[0.5cm]
  1. IRAM (Grenoble) \\
  2. LERMA, Observatoire de Paris}
\date{January 8$^\emr{th}$, 2015\\
  Version 1.1\\
  (Version 1.0 released on October 20$^\emr{th}$, 2011)}
\maketitle{}

\begin{abstract}
  An observer is interested by the physical properties (line frequencies,
  velocity of the gas) of a source in its own reference frame. However, the
  observations happen in a different frame, namely the topocentric frame
  for ground-based observations. This implies a change of frame to infer
  the physical properties in the source frame from the measured frequencies
  in the measurement frame. Several difficulties arise in astronomy: 1) the
  Earth ... To be completed.
\end{abstract}

\newpage{}
\tableofcontents{}

\newpage{}

\section{Interpreting the spectral axis throught the Doppler effect}

% The Doppler effect is used to interpret the spectral axis of the measured
% spectrum.

% In radio-astronomy, regularly sampled frequency axis.

% Various precisions of the Doppler effect

\subsection{Natural expression of the spectral axis in radio-astronomy}

Typical radio-astronomy spectrometers (\eg{}, correlators or Fourier
transform spectrometers) deliver the brightness along a given line of sight
at regularly spaced frequencies \emph{in the observatory frame}. The
spectrum can be represented as a set of brightness temperatures $T(\ic)$,
where the frequency axis in the observatory frame is defined as
\begin{equation}
  \fobs(\ic) = \fobs[tuned] + (\ic-\ic[0]) \, \dfobs,
  \label{eq:fobs:rf}
\end{equation}
where \fobs(\ic) is the frequency at the channel \ic{}, \fobs[tuned] the
frequency at the reference channel \ic[0], and \dfobs{} the channel
spacing.

\subsection{Various approximations of the Doppler effect}
\label{sec:doppler}

The Doppler effect expresses that a source emitting in its rest frame at a
frequency \frest{} will appear to emit at a frequency \fobs{} in the
observation frame, which depends on the velocity of the source in the
observation frame, \vobs{}. Sections~\ref{sec:interpretation:local}
and~\ref{sec:interpretation:highz} will show how this property can be used
to interpret the spectral axis measured in the observatory frame in terms
of the property of the source in the source rest frame.

\subsubsection{The Special Relativity formula}

For sources lying at cosmological distances, General Relativity should be
used to express the Doppler effect in order to take into account the
effects of curvature of space. For a Euclidian cosmology where $q_0=0$, the
Doppler effect can be expressed with Special Relativity. 

In this case, the relation between \frest{} and \fobs{} is given by
\begin{equation}
  \fobs = \frest \, \frac{\sqrt{\clight^2-{\vobs}^2}}{\clight+\vpara},
  \label{eq:doppler:1}
\end{equation}
with ${\vobs}^2 = {\vpara}^2+{\vperp}^2$, where \vpara{} and \vperp{} are
respectively the velocity components along and perpendicular to the line of
sight. \vpara{} and \vperp{} are often called the radial and transverse
velocity components. 

\subsubsection{Approximation 1: Neglecting the transverse Doppler effect
  when $\vobs \ll \clight$}

Astronomers have very little access to the velocity component perpendicular
to the line of sight. They will thus assign the observed Doppler shift to
the line-of-sight motion, \ie{}, they will neglect the transverse Doppler
effect. 

The formula~\ref{eq:doppler:1} indicates that the dependency on \vperp{} is
of second order in $v/\clight$, while the dependency on \vpara{} is only of
first order in $v/\clight$. Hence, neglecting the transverse Doppler effect
is correct as long as
\begin{equation}
  \label{eq:cond:1}
  (\vperp)^2 \ll \clight^2-(\vpara)^2.
\end{equation}
In this case, the Doppler equation can be approximated to first order to
\begin{equation}
  \fobs = \frest \, \sqrt{\frac{\clight-\vpara}{\clight+\vpara}}.
  \label{eq:doppler:2}
\end{equation}
In other words, the frequency change under a change of frame is attributed
only to the radial velocity between the rest and observation frame. We note
that condition~\ref{eq:cond:1} is enforced if the velocities are
non-relativistic, \ie{}
\begin{equation}
  \vobs \ll \clight.
\end{equation}

\subsubsection{Approximation 2: First order developments and velocity
  conventions}

As formula~\ref{eq:doppler:2} is mostly correct when $\vobs \ll \clight$,
we can as well continue to develop in $\vpara/\clight$ and limit ourselves
to the first order term. However, there are two ways to do this
development, starting either from the frequency Doppler formula (radio
velocity convention) or from the wavelenght one (optical velocity
convention).

\paragraph{The radio velocity convention}
\label{sec:conv:radio}

Starting from Eq.~\ref{eq:doppler:2}, we obtain to first order in
$\vpara/\clight$
\begin{equation}
  \fobs = \frest \, \paren{1-\frac{\vpara}{\clight}}.
\end{equation}
In this case, we can establish a linear velocity scale (see
Sect.~\ref{sec:interpretation:frest})
\begin{equation}
  \vobs(\ic) = \vobs[sys] + (\ic-\ic[0]) \, \dvobs
  \quad \mbox{with} \quad
  \dvobs = -\clight\frac{\dfobs}{\frest[tuned]}.
\end{equation}
This linear velocity scale is only a first order approximation, which is
called the radio velocity convention. Indeed, it is well adapted to the
radio spectrometer because 1) their natural output is a spectral axis
regularly spaced in frequency and 2) the radio velocity convention gives a
linear relation between the velocity and the frequency scale. This is why
this convention is the default in \class{}.

\paragraph{The optical velocity convention}

Optical spectrometers (\eg{}, grates) naturally delivers a spectral axis
regularly spaced in wavelength. Eq.~\ref{eq:doppler:2} can then be
rewritten as
\begin{equation}
  \lobs = \lrest \, \sqrt{\frac{\clight+\vpara}{\clight-\vpara}}.
\end{equation}
The first order approximation gives
\begin{equation}
  \lobs = \lrest \, \paren{1+\frac{\vpara}{\clight}}.
\end{equation}
Following the same path as in Sect.~\ref{sec:interpretation:frest} but now
in wavelenght, it is easy to show that we can establish a linear velocity
scale proportional to the wavelength axis
\begin{equation}
  \vobs[opt](\ic) = \vobs[sys,opt] + (\ic-\ic[0]) \, \dvobs[opt]
  \quad \mbox{with} \quad
  \dvobs[opt] = +\clight \, \frac{\delta\lobs}{\lrest[tuned]}.
\end{equation}
This velocity scale is called the optical velocity convention. The relation
between this velocity scale and the frequency spectral axis is
non-linear. This is why it is not used in \class{}.

\subsection{Interpreting the spectral axis in the local universe}
\label{sec:interpretation:local}

Using the radio convention, the non-relativistic Doppler effect
in the observatory frame can be written as
\begin{equation}
  \frac{\vobs}{\clight} = \frac{\frest-\fobs}{\frest} = 1-\frac{\fobs}{\frest},
\end{equation}
where \vobs{} is the velocity of the source in the observatory frame,
\fobs{} and \frest{} are the frequency of the measured photon in the
observatory and rest frame respectively. \vobs{} is positive if the source
recesses and the rest frame is defined as the frame where the velocity of
the emitting gas cell is zero. Introducing the doppler parameter
\dobs{}, we obtain
\begin{equation}
  \frac{\fobs}{\frest} = 1+\dobs
  \quad \mbox{with} \quad
  \dobs \Definition -\frac{\vobs}{\clight}.
\end{equation}

\subsubsection{Interpretation 1: At fixed \vobs{}}
\label{sec:interpretation:vobs}

Let's assume that the same gas cell in the source emits two lines at
different frequencies. We are at fixed \vobs{} and thus \dobs{} because we
consider the same gas cell. The frequency axes in the rest and observatory
frames are thus given by
\begin{equation}
  \frest = \frac{\fobs}{1+\dobs}.
\end{equation}
This means that the frequency separation between the two lines is different
in the rest and observatory frames. The modeller has easily access to the
rest frame frequencies of the line. It is thus important to display the
spectrum frequency axis in the rest frequency axis. This can be achieved
only for one velocity (The reasoning is here done at fixed \vobs{}), which
is by default assumed to be the systemic velocity of the source in the
observatory frame, \ie{}, the mean velocity of the source gas in the
observatory frame, written \vobs[\emr{sys}].

As a convention, \class{} assumes that the tuned rest frequency and its
corresponding observatory frequency at the source systemic velocity are
associated to the common reference channel \ic[0]. \class{} then displays the
frequency axis in the rest frequency associated to the source systemic
velocity through
\begin{equation}
  \frest(\ic) = \frest[tuned] + (\ic-\ic[0]) \, \dfrest
  \quad \mbox{with} \quad
  \dfrest = \frac{\dfobs}{1+\dobs[\emr{sys}]}
  \quad \mbox{and} \quad
  \dobs[\emr{sys}] = -\frac{\vobs[\emr{sys}]}{\clight}.
  \label{eq:frest}
\end{equation}
The plotted spectrum thus correctly displays the line at rest frequency
positions, \ie{}, the brightnesses of the gas whose velocity is equal to
the systemic velocity in the observatory frame.

\subsubsection{Interpretation 2: At fixed \frest{}}
\label{sec:interpretation:frest}

Let's assume that the measured spectrum is made of a line centered around
\fobs[tuned] in the observatory frame. The associated rest frame frequency,
\ie{}, the frequency of the line at rest, will be \frest[tuned]. The
observation is naturally set up so that the source frame is also the rest
frame. This implies that \fobs[tuned], \frest[tuned] and \vobs[sys] are linked through
\begin{equation}
  \frac{\fobs[tuned]}{\frest[tuned]} = 1+\dobs[sys]
  \quad \mbox{with} \quad
  \dobs[sys] \Definition -\frac{\vobs[sys]}{\clight}.
\end{equation}

The modeler will use the Doppler effect to interpret the observed
frequency difference $\fobs(\ic)-\fobs[tuned]$ as a local velocity
difference (projected along the line of sight direction) around the
systemic velocity of the source.  Let's write \vobs(\ic) the velocity
associated to \fobs(\ic).  The velocity difference will be noted
\begin{equation}
  \Dvobs(\ic) \Definition \vobs(\ic)-\vobs[sys].
\end{equation}
In order to derive this velocity difference, we associate the velocity to
each observed frequency through the Doppler effect, \ie{},
\begin{equation}
  \frac{\fobs(\ic)}{\frest[tuned]} = 1+\dobs(\ic)
  \quad \mbox{with} \quad
  \dobs(\ic) \Definition -\frac{\vobs(\ic)}{\clight}.
\end{equation}
It is easy to deduce that
\begin{equation}
  \label{eq:interpretation:frest}
  \Dvobs(\ic) = \clight\,\frac{\fobs[tuned]-\fobs(\ic)}{\frest[tuned]},
\end{equation}
\ie{}, the local velocity difference is proportional to the observed
frequency difference. We can define a linear velocity axis associated to
the set of brightnesses, $T(\ic)$ as
\begin{equation}
  \vobs(\ic) = \vobs[sys] + (\ic-\ic[0]) \, \dvobs
  \quad \mbox{with} \quad
  \dvobs = -\clight\frac{\dfobs}{\frest[tuned]}.
\end{equation}
\emph{This velocity scale is only meaningful locally, \ie{}, as long as the
  brightnesses can be associated to the line rest frequency under
  consideration.}

\subsection{Interpreting the spectral axis at high redshift}
\label{sec:interpretation:highz}

When the source is far from the observer, the radial velocity may become a
sizable fraction of the light velocity (because of the universe expansion)
and the approximations of section~\ref{sec:doppler} are not valid anymore.
However, \citet{gordon92} propose a solution based on the observational
definition of the redshift.

\subsubsection{The redshift: An observational quantity}

In the first half of the twentieth century, optical astronomers noted that
a source emitting in its rest frame at a wavelength \wrest{} will appear to
emit at a larger wavelength \wobs{} in the observatory frame. To quantify
this phenomenon, they introduced the observational notion of redshift,
\redshift{}, defined with
\begin{equation}
  \wobs = \wrest \, (1+\redshift{}).
\end{equation}
The redshift is a positive quantity that can become extremely large. It is
straightforward to reexpress the redshift using frequency instead of
wavelength, \ie{},
\begin{equation}
  \fobs = \frac{\frest}{1+\redshift{}}.
\end{equation}
Some radio-astronomers used another definition of the redshift, called
radio redshift, but this definition is now deprecated and the optical
definition of the redshift is today universally used.

The redshift is of course linked to the Doppler effect. We however stress
that the redshift is an observational quantity, independent of any
mathematical expression of the Doppler effect. This is the key point to
understand the solution of \citet{gordon92}.

\subsubsection{Splitting the change of frame}

\citet{gordon92} proposed to split the problem of high redshift sources
by combining a double change of frame with a change of interpretation of
the spectral axis for each change of frame.

In the first change of frame, we consider a ``local'' observer in the
source frame (\ie{}, having the same systemic velocity viewed from
Earth). This observer will interpret the change of velocities as changes in
frequency for a fixed rest frequency chosen as reference, \frest[ref] (see
Section~\ref{sec:interpretation:frest}). Assuming that the velocity of the
gas in the source frame are non-relativistic, he can use
Eq.~\ref{eq:interpretation:frest} to convert from velocities to frequencies
in the source frame, \ie{}, the rest frame. The only differences in this
case are 1) that the observation frame is the source or rest frame, and 2)
the notion of tuned frequency is replaced by the notion of reference
frequency. There is no tuned frequency in this thought experiment. However,
just as a convenience, we will note this reference frequency,
\frest[tuned].  This yields
\begin{equation}
  \label{eq:split:frest}
  \quad \Dvrest(\ic) = \clight\,\frac{\frest[tuned]-\frest(\ic)}{\frest[tuned]}.
\end{equation}

The second change of frame goes from the rest/source frame to the
observatory frame. The key point here is that we are at fixed redshift. It
could be said that we are at fixed \vobs{}, as in
section~\ref{sec:interpretation:vobs}, except that for high redshift
source, the observational quantity is the redshift and not the source
systemic velocity. We thus define the tuned redshift \redshift[tuned] as
\begin{equation}
  \label{eq:split:tuned}
  \redshift[tuned] \Definition \frac{\frest[tuned]}{\fobs[tuned]} - 1.
\end{equation}
With this definition, we write
\begin{equation}
  \label{eq:split:vobs}
  \frest(\ic) = \fobs(\ic)\, (1+\redshift[tuned])
  \quad \mbox{with} \quad
  \forall \ic, \quad \redshift[tuned] = \mbox{constant}.
\end{equation}

\subsubsection{Interpretation 1: At fixed \redshift{} and fixed \frest{}}
\label{sec:interpretation:redshift:1}

Combining Eq.~\ref{eq:split:frest} to~\ref{eq:split:vobs}, we yield
\begin{equation}
  \Dvrest(\ic) = \clight\,(1+\redshift[tuned])\,\frac{\fobs[tuned]-\fobs(\ic)}{\frest[tuned]},
\end{equation}
\ie{}, the \emph{local} velocity difference in the \emph{source/rest} frame
is proportional to the \emph{observed} frequency difference in the
\emph{observatory} frame. We can define a linear velocity axis associated
to the set of brightnesses, $T(\ic)$ as
\begin{equation}
  \label{eq:redshift:velo}
  \vrest(\ic) = (\ic-\ic[0]) \, \dvrest
  \quad \mbox{with} \quad
  \dvrest = -\clight\,(1+\redshift[tuned])\,\frac{\dfobs}{\frest[tuned]}.
\end{equation}
This can be interpreted as follows. Let's assume that the measured spectrum
is made of a line centered around \fobs[tuned] in the observatory
frame. The associated rest frame frequency, \ie{}, the frequency of the
line at rest, will be \frest[tuned]. If the tuned frequency at channel
\ic{} in the observatory frame is set to the redshifted frequency
\begin{equation}
  \fobs[tuned] = \frac{\frest[tuned]}{1+\redshift[tuned]},
\end{equation}
the velocity axis defined in Eq.~\ref{eq:redshift:velo} can be interpreted
as the local variation of the gas velocity in the rest/source frame for the
line whose rest frequency is \frest[tuned].

\subsubsection{Interpretation 2: At fixed \redshift{} and fixed \vrest{}}
\label{sec:interpretation:redshift:2}

Let's assume that the same gas cell in the source emits two lines at
different frequencies. We are at fixed \redshift[tuned] because we consider
the same gas cell. The frequency axes in the rest and observatory frames
are thus given by
\begin{equation}
  \frest = \fobs\,(1+\redshift[tuned]).
\end{equation}
This means that the frequency separation between the two lines is different
in the rest and observatory frames. The modeller has easily access to the
rest frame frequencies of the line. It is thus important to display the
spectrum frequency axis in the rest frequency axis. This can be achieved
only for one redshift (The reasoning is here done at fixed
\redshift[tuned]), which is by default assumed to be the systemic redshift
of the source in the observatory frame, \ie{}, the mean redshift of the
source gas in the observatory frame.

As a convention, we can in addition assume that the tuned rest frequency
and its corresponding observatory frequency at the source systemic velocity
are associated to the common reference channel \ic[0]. The frequency axis
in the rest frame is then defined as
\begin{equation}
  \frest(\ic) = \frest[tuned] + (\ic-\ic[0]) \, \dfrest
  \quad \mbox{with} \quad
  \dfrest = \dfobs\,(1+\redshift[tuned]).
  \label{eq:redshift:frest}
\end{equation}
The plotted spectrum thus correctly displays the line at rest frequency
positions, \ie{}, the brightnesses of the gas at rest in the source frame.

\subsubsection{Interpretation 3: At fixed \frest{} and fixed \vrest{}}
\label{sec:interpretation:redshift:3}

Let's assume that we are interested to detect a given bright line, \eg{},
CO(1-0), at high redshift but the redshift of the source is unknown and/or
their would be a forest of this line at different redshift for the same
line of sight. We can also assume that the parcel of gas is at the same
local velocity (an interesting particular case being when the parcel of gas
is at rest) in the different source frames corresponding to the different
redshift. We thus wish to associate a redshift axis to the set of
brightnesses, $T(\ic)$. To do this, we use
\begin{equation}
  \redshift{} = \frac{\frest[tuned]}{\fobs} - 1,
\end{equation}
and, after differentiation,
\begin{equation}
  \dredshift = - \frac{\frest[tuned]}{\fobs[tuned]}\,\frac{\dfobs}{\fobs[tuned]}
             = - (1+\redshift[tuned])^2\,\frac{\dfobs}{\frest[tuned]}
             = (1+\redshift[tuned])\,\frac{\dvrest}{\clight}.
\end{equation}
This yields
\begin{equation}
  \redshift{}(\ic) = \frac{1+\redshift[tuned]}{1-(\ic-\ic[0])\,\frac{\dredshift}{1+\redshift[tuned]}} - 1
\end{equation}
\begin{equation}
  \mbox{with} \quad
  \redshift[tuned] = \frac{\frest[tuned]}{\fobs[tuned]}-1,
  \quad 
  \dredshift{} = (1+\redshift[tuned])\,\frac{\dvrest}{\clight},
  \quad \mbox{and} \quad
  \dvrest = \clight\,(1+\redshift[tuned])\,\frac{\dfobs}{\frest[tuned]}.  
\end{equation}
The sign in the definition of \dredshift{} ensures that an increase of
\ic{} implies an increase of \redshift{}(\ic). Moreover, the non-linear
character of this axis comes from the fact that the spectral axis is
regularly sampled in frequency unit while the adopted redshift definition
is the optical one. We retrieve a linear axis
\begin{equation}
  \redshift{}(\ic) \simeq \redshift[tuned]+(\ic-\ic[0])\,\dredshift,
  \quad \mbox{only as long as} \quad
  (\ic-\ic[0])\,\dredshift \ll (1+\redshift[tuned])
  \quad \mbox{or} \quad
  (\ic-\ic[0])\,\dfobs \ll \fobs[tuned].
\end{equation}
With current heterodyne detector in millimeter radioastronomy, the last
condition is difficult to satisfy as the radiofrequence bandwidth can cover
a significant fraction of the tune frequency, at least in the 3\mm{} band.
The non-linear formula is thus useful in \class{}.

\subsection{Validity of the radio velocity convention}

\subsubsection{Going from \fobs{} to \frest{}}

\newcommand{\fn}[1][]{\emr{f_{#1}}}

In this specific transform, the velocity between the source/rest frame and
the observatory frame (\ie{}, the source systemic velocity in the
observatory frame \vobs[sys]) is fixed. This implies that the Doppler
effect can be written as
\begin{equation}
  \frac{\frest{}}{\fobs{}} = \fn(\dobs[sys])
  \quad \mbox{with} \quad
  \dobs[sys] \Definition -\frac{\vobs[sys]}{\clight}.
\end{equation}
The first thing is that this transform is always linear. However, its
physical interpretation in term of \vobs[sys] is different in the two
following cases.

\paragraph{Case 1: High redshift universe}

This case is dealt with the redshift, \ie{},
\begin{equation}
  \fn(\dobs[sys])= 1+\redshift(\dobs[sys]).
\end{equation}
As stated before, the redshift is before all an observational
quantity. This means that the complex relationship between \dobs[sys] and
\redshift{} is hidden to the observer. This implies that the transformation
between the observatory frequency scale and the rest one is straightforward
and ``exact'' as a function of redshift, \ie{}, independent of the
interpretation as a function of \vobs[sys].

\paragraph{Case 2: Local universe}

In contrast to the previous case, the observer is used to express the
Doppler as a function of the source systemic velocity in a local frame
(observatory or Local Standard of Rest). Changing the frame to interpret
the frequency axis must thus use a given approximation for the Doppler
effect. As long as $\dobs[vsys] \ll 1$, we can use the Special Relativity
formula, \ie{},
\begin{equation}
  \fn[SR](x) = \sqrt{\frac{1-x}{1+x}}.
\end{equation}
Using the radio convention is an additional approximation in which
\begin{equation}
  \fn[RC](x) = \frac{1}{1+x}.
\end{equation}
The difference in the rest frequency between the two approximations is
\begin{equation}
  \frest[SR]-\frest[RC] = \fobs\,[\fn[SR](\dobs)-\fn[RC](\dobs)].
\end{equation}
This just means that the same observed spectrum will be assigned two
different systemic velocities, \vobs[SR] and \vobs[RC], depending on the
level of approximation used. In other words, if an observer uses \vobs[SR]
as systemic velocity to interpret a spectrum observed with the radio
velocity convention, he will find that the lines appear at slightly
different rest frequencies in a way that can be interpreted as a wrong
systemic velocity. He will thus fit another systemic velocity and find
\vobs[RC]. The relation between the two associated doppler factors
(\dobs[SR] and \dobs[RC]) is of course
\begin{equation}
  \dobs[RC] = \sqrt{\frac{1+\dobs[SR]}{1-\dobs[SR]}}-1,
\end{equation}
and, using the Taylor expansion in $x=0$,
\begin{equation}
  \frac{\dobs[RC]-\dobs[SR]}{\dobs[SR]} = \frac{\dobs[SR]}{2} + O(\dobs[SR]).
\end{equation}
As $\dobs[vsys] \ll 1$, this is a negligible difference in the systemic
velocities, \ie{}, the radio convention is good enough.

Nevertheless, the main use case is the following one. A ``naive'' observer
got time at a given observatory that uses the radio convention to make a
follow-up from an observation acquired in another observatory that uses the
special relativity formula. The difference in rest frequency can easily be
measurable as it is proportional to the tuned frequency. He probably does
not understand the subtleties between the different approximations of the
Doppler effect. He will then start to ask around what is wrong. This means
that the problem is mainly an interface issue between the different
observatories. The easiest solution to this problem would be to use the
current standard in (radio-)observatories (What about ALMA, VLA, GBT,
APEX). If most of them uses the special relativity formula, IRAM should
probably also adopt the special relativity formula.

\subsubsection{Going from the frequency to the velocity axis}

The velocity scale is only meaningful locally (\ie{}, at small values of
$(\ic-\ic[0])\delta \velo{}$) around a given rest frequency, \frest{}. It
is thus legitimate to use a linear relation between the frequency and the
velocity axis. There are 3 possibilities depending on the approximation
used to defined the systemic velocity. We stress that all these
possibilities are equivalent for observations of the high redshift universe
because, in this case, \vobs[sys] and thus \dobs[sys] are zero valued.

\paragraph{Solution 1: The radio convention is used to define both
  \vobs[sys] and \dvobs{}}

This is the simplest case, which is currently implemented in \class{}. It is
defined as
\begin{equation}
  \vobs(\ic) = \vobs[RC] + (\ic-\ic[0]) \, \dvobs[RC]
  \quad \mbox{with} \quad
  \dvobs[RC] = -\clight \, \frac{\dfobs}{\frest[tuned]}.
\end{equation}

The radio convention is the result of the first order term of the Taylor
expansion at $x=0$ of
\begin{equation}
  \frac{1}{\fn[SR](x)} = \sqrt{\frac{1+x}{1-x}}.
\end{equation}
To check the accuracy of the approximation on \dvobs[RC], let's use the
next term in this Taylor expansion, \ie{},
\begin{equation}
  \sqrt{\frac{1+x}{1-x}} \simeq 1+x+\frac{x}{2}.
\end{equation}
Differentiating this equation, we obtain the first order correction to the
velocity channel width
\begin{equation}
  \Delta \dvobs[RC] = -\dvobs[RC] \, \frac{\dobs[RC]}{1+\dobs[RC]}.
\end{equation}
Let's now assume that we want an accumulated error over \nc{} channel to be
less than a given tolerance \tol{}. This yields
\begin{equation}
  \vobs[sys] \le \frac{\clight}{\frac{\nc}{\tol}+1}
\end{equation}
This is the criterion to change from the local universe representation
(using \vobs[sys]) to the high redshift universe (using \redshift). If we
want a tolerance of one tenth of channel (\ie{}, $\tol=1/10$), we obtain
\begin{itemize}
\item $\vobs[sys] \le 3\,000\kms$ for $\nc = 10$, \ie{}, 1000\kms{} wide
  line at 100\kms{} resolution (\eg{} local galaxies);
\item $\vobs[sys] \le   300\kms$ for $\nc = 100$, \ie{}, 10\kms{} wide line
  at 0.1\kms{} resolution (\eg{}, a local GMC);
\item $\vobs[sys] \le    30\kms$ for $\nc = 1000$, \ie{}, 100\kms{} wide
  line at 0.1\kms{} resolution (\eg{}, a Galactic outflow).
\end{itemize}
This does not seem enough.

\paragraph{Solution 2: Special relativity is used to define \vobs[sys] but
  the radio convention is kept to define \dvobs{}}

This gives
\begin{equation}
  \vobs(\ic) = \vobs[SR] + (\ic-\ic[0]) \, \dvobs[RC]
  \quad \mbox{with} \quad
  \dvobs[RC] = -\clight \, \frac{\dfobs}{\frest[tuned]}.
\end{equation}
The accuracy of the approximation around \vobs[SR] is the same as in the
previous case.

\paragraph{Solution 3: Special relativity is used to define both \vobs[sys]
  and \dvobs{}}

If special relativity is used to define \vobs[sys], we would have a more
consistent solution by linearizing the above equation at
$x=-\vobs[sys]/\clight$. It is easy to yield
\begin{equation}
  \vobs(\ic) = \vobs[SR] + (\ic-\ic[0]) \, \dvobs[SR]
  \quad \mbox{with} \quad
  \dvobs[SR] = -\clight \, \frac{\dfobs}{\frest[tuned]} \, \paren{1-\dobs[sys]}^2
                        \, \sqrt{\frac{1-\dobs[sys]}{1+\dobs[sys]}}.
\end{equation}
I still need to check how the accuracy of the linearization is improved.

\subsection{Handling the local and high redshift universe with the same
  formalism}

In view of the importance of the high redshift studies in today
radio-astronomy, it is desirable to handle the observation of high redshift
sources in a better way than just replacing the rest frequency by the
redshifted frequency at observation time as it is done today at IRAM. It
would be better to generalize the formalism to handle both the local and
high-redshift universe observations.

In this generalization, the spectral axis would be described with 3
parameters (\frest{}, \vobs[sys], \redshift{}) with the convention that
$\vobs[sys] = 0$ when $\redshift \neq 0$, and vice-versa. This would enable
to keep the information about the redshift and the rest frequency when
observing the high-redshift universe.

\subsection{Using the radio velocity convention}

In this framework, the generalization is straightforward. The frequency
axis can then be described with
\begin{equation}
  \frest(\ic) = \frest[tuned] + (\ic-\ic[0]) \, \dfrest
  \quad \mbox{with} \quad
  \dfrest = \dfobs\,\frac{1+\redshift[tuned]}{1+\dobs[\emr{sys}]}
  \quad \mbox{and} \quad
  \dobs[\emr{sys}] = -\frac{\vobs[\emr{sys}]}{\clight},
\end{equation}
And the velocity axis with
\begin{equation}
  \velo{}(\ic) = \vobs[\emr{sys}] + (\ic-\ic[0]) \, \dvelo
  \quad \mbox{with} \quad
  \dvelo = -\clight\,(1+\redshift[tuned])\,\frac{\dfobs}{\frest[tuned]}.
\end{equation}
The velocity axis is given in the observation frame (\ie{} $\velo{}
\Definition \vobs$ and $\dvelo \Definition \dvobs$) when $\vobs[sys] \ne
0$, and in the source/rest frame (\ie{} $\velo{} \Definition \vrest$ and
$\dvelo \Definition \dvrest$) when $\redshift \ne 0$.

\subsection{Using the special relativity formula}

The generalization is slightly more complex. I will derive the formula once
some choice is made about the question raised in the previous section.

\section{Heterodyne receivers and signal/image frequency axes}

\subsection{USB and LSB frequency axes in the observatory frame}

Heterodyne receivers mix a local oscillator frequency, \fobs[LO], to the
astronomical signal to transfer the frequency axis from high radio
frequencies, \fobs[RF], to low intermediate frequencies, \fobs[IF], which
are then suitable for easy electronic processing. A consequence is that two
bands of radio frequencies, namely the lower side band (LSB) and the upper
side band (USB) are mixed in the observed spectrum, \ie{}, the set of
brightnesses, $T(\ic)$, are associated to one IF frequency axis and two RF
frequency axes linked through
\begin{equation}
  \fobs[IF](\ic) = \SBSign \, \bracket{\fobs[RF](\ic)-\fobs[LO]}
\end{equation}
with $\SBSign=-1$ for the RF frequency axis belonging to the lower side
band (LSB) tuning and $\SBSign=+1$ for the RF frequency axis belonging to
the upper side band (USB). The measured spectra is thus in the IF axis and
Eq.~\ref{eq:fobs:rf} must be modified as
\begin{equation}
  \fobs[IF](\ic) = \fobs[IFtuned] + (\ic-\ic[0]) \, \dfobs[IF],
  \label{eq:fobs:if}
\end{equation}
with
\begin{equation}
  \fobs[IFtuned] \Definition \SBSign \, (\fobs[RFtuned] -\fobs[LO])
                 \Definition  \emr{cste}.
\end{equation}
The constancy of \fobs[IFtuned] is a property of the heterodyne receivers.
Combining the last 3 equations, we yield
\begin{equation}
  \fobs[RF](\ic) = (\fobs[LO]+\SBSign \,\fobs[IFtuned]) 
                 + \SBSign \, (\ic-\ic[0]) \, \dfobs[IF].
\end{equation}

\subsection{Signal and image frequency axes in the observatory frame}

The RF tuning frequency, \fobs[RFtuned], can be choosen in either band.
This band is called the signal band. The other band is then called the
image band. The associated RF frequencies are written \fobs[sig] and
\fobs[ima]. We obtain
\begin{equation}
  \fobs[sig](\ic) = \fobs[sig,tuned] + \SBSign \, (\ic-\ic[0]) \, \dfobs[IF]
  \quad \mbox{with} \quad
  \fobs[sig,tuned] \Definition \fobs[LO]+\SBSign \,\fobs[IFtuned],
  \label{eq:sig}
\end{equation}
and
\begin{equation}
  \fobs[ima](\ic) = \fobs[ima,tuned] - \SBSign \, (\ic-\ic[0]) \, \dfobs[IF]
  \quad \mbox{with} \quad
  \fobs[ima,tuned] \Definition \fobs[LO]-\SBSign \,\fobs[IFtuned].
  \label{eq:ima}
\end{equation}
The sign of the product $\SBSign \,\dfobs[IF]$ is arbitrary. Indeed, it
only defines how the brightnesses are ordered in memory, \ie{}, whether the
frequency increases or decreases when \ic{} increases. It thus is simpler
to assume that this product is always positive. This implies that the
signal frequency increases and the image frequency decreases when \ic{}
increases. In other words, we adopt the convention that the signal
brightnesses are ordered by increasing frequency when \ic{} increases,
\ie{}, the product $\SBSign \,\dfobs[IF]$ is always positive.

As the absolute value of \SBSign{} is 1, we will greatly simplify the
equations by replacing $\SBSign \,\dfobs[IF]$ with \dfobs[IF] with the
convention that $\dfobs[IF] > 0$ in Eqs~\ref{eq:sig} and~\ref{eq:ima}. We
can then rewrite them as
\begin{equation}
  \fobs[sig](\ic) = \fobs[sig,tuned] + (\ic-\ic[0]) \, \dfobs[IF]
  \quad \mbox{with} \quad
  \fobs[sig,tuned] \Definition \fobs[LO]+\SBSign \,\fobs[IFtuned],
\end{equation}
and
\begin{equation}
  \fobs[ima](\ic) = \fobs[ima,tuned] - (\ic-\ic[0]) \, \dfobs[IF]
  \quad \mbox{with} \quad
  \fobs[ima,tuned] \Definition \fobs[LO]-\SBSign \,\fobs[IFtuned].
\end{equation}
with
\begin{equation}
  \dfobs[IF] > 0.
\end{equation}

\subsection{Signal and image frequency axes in the rest frame}

The discussion of Section~\ref{sec:interpretation:vobs} is still valid for
both the signal and image frequency axes. Eq.~\ref{eq:frest} can easily be
rewritten
\begin{equation}
  \frest[sig](\ic) = \frest[sig,tuned] + (\ic-\ic[0]) \, \dfrest,
\end{equation}
and
\begin{equation}
  \frest[ima](\ic) = \frest[ima,tuned] - (\ic-\ic[0]) \, \dfrest,
\end{equation}
with
\begin{equation}
  \dfrest = \frac{\dfobs[IF]}{1+\dobs[\emr{sys}]}
  \quad \mbox{and} \quad
  \dobs[\emr{sys}] = -\frac{\vobs[\emr{sys}]}{\clight}.  
\end{equation}
\frest[sig,tuned] is simply the tuning frequency entered by the user.
However, \frest[ima,tuned] must be computed. The easiest way is to define
the side band separation as
\begin{equation}
  \SBSobs \Definition \SBSign\bracket{\fobs[sig,tuned]-\fobs[ima,tuned]}.
\end{equation}
It is straightfoward to show that it is constant and equal to
\begin{equation}
  \SBSobs = \emr{cste} = 2\,\fobs[IFtuned].
\end{equation}
In the rest (source) frame, the following relations hold
\begin{equation}
  \frac{\fobs[sig,tuned]}{\frest[sig,tuned]} = 1+\dobs[sys]{}
  \quad \mbox{} \quad
  \frac{\fobs[ima,tuned]}{\frest[ima,tuned]} = 1+\dobs[sys]{}.
\end{equation}
The side band separation in the rest frame is defined as
\begin{equation}
  \SBSrest \Definition \SBSign\bracket{\frest[sig,tuned]-\frest[ima,tuned]}.
\end{equation}
It is then straightforward to show that
\begin{equation}
  \SBSobs = \SBSrest\,\bracket{1+\dobs[sys]},
\end{equation}
and
\begin{equation}
  \frest[ima,tuned] = \frest[sig,tuned]-\frac{\SBSobs}{\SBSign\,\bracket{1+\dobs[sys]}}.
\end{equation}

\section{Earth movements}

\subsection{Periodic shift and dilatation of the rest frequency axis}

For a Earth-based observatory, the observed velocity of the source changes
with time due to the rotation of the Earth around its axis and around the
sun. This implies that the change from the observatory to the rest
frame varies with time. The frequency scale in the observatory frame is
fixed by the hardware. The frequency scale in the rest frame thus changes
with time in two different ways, a shift and a dilatation. The tuned rest
frequency is shifted, while the frequency resolution dilates the frequency
axis around the tuned frequency.

If nothing is done, averaging spectra to increase the signal-to-noise ratio
would imply first a resampling to align the observed frequency scales. It
is desirable to avoid this because resampling has many unwanted
side-effects, as round-off errors or introduced correlations of the noise
levels between channels (see IRAM Memo 2009-4). We present here hardware
solutions to this problem.

\subsection{Stopping the periodic shift}
\label{sec:shift}

As the systemic velocity of the source in the observatory frame varies with
time in a predictable way, the radio-observatories tune the local
oscillator frequency in order to stop the shifting of the observed
frequency scale. For instance, the relation between the observatory
frequency and the LSR (Local Standard of Rest) frequency is
\begin{equation}
  \flsr = \fobs + \frest \, \frac{\vobs[sys]-\vlsr[sys]}{\clight},
\end{equation}
because
\begin{equation}
  \fobs = \frest \, \paren{1-\frac{\vobs[sys]}{\clight}}
  \quad \mbox{and} \quad
  \flsr = \frest \, \paren{1-\frac{\vlsr[sys]}{\clight}}.
\end{equation}
Thus adding $\bracket{\SBSign \, \frest \,
  (\vobs[sys]-\vlsr[sys])/\clight}$ to the local oscillator frequency makes
the signal frequency appear as if it was measured in the LSR frame. All the
velocities are then expressed in the LSR frame instead of the observatory
frame.

However, there is a single local oscillator frequency. Let's assume that
the correction is done at the tuned signal frequency, \ie{},
\begin{equation}
  \flsr[sig,tuned] = \fobs[sig,tuned] + \frest[sig,tuned] \, \frac{\vobs[sys]-\vlsr[sys]}{\clight}.
\end{equation}
The correction which is applied to another frequency is then
\begin{equation}
  \flsr(\ic) = \fobs(\ic) + \frest[sig,tuned] \, \frac{\vobs[sys]-\vlsr[sys]}{\clight},
\end{equation}
while the correction that should have been applied to another frequency is
\begin{equation}
  \flsr(\ic) = \fobs(\ic) + \frest(\ic) \, \frac{\vobs[sys]-\vlsr[sys]}{\clight}.
\end{equation}
The difference (or error) is
\begin{equation}
  \Delta\flsr(\ic) = (\ic-\ic[0])\,\dfrest \, \frac{\vobs[sys]-\vlsr[sys]}{\clight}.
\end{equation}
The correction is thus exact only in $\ic = \ic[0]$, \ie{}, for the tuned
signal frequency\footnote{In fact, there often are several local
  oscillators in a radio-observatory. At the Plateau de Bure
  Interferometer, two of them are used to stop both the signal and image
  tuned frequencies. This was useful at the time when the 1mm receivers
  were double-sideband and the sideband separation was obtained with Walsh
  phase modulation/demodulation.}. All the other signal and image
frequencies oscillates with time with a frequency amplitude which linearly
increases with the distance to the reference channel. In other words, this
corrects only the global frequency shift, not the dilatation around the
reference channel.

\subsection{Stopping the periodic dilatation}

At IRAM-30m, G.~Paubert proposes to stop the periodic dilatation in the
rest frequency by adapting the channel spacing of the spectrometer
frequency comb in real time. This in combination with LO tuning will stop
all temporal variations of the frequency axis, removing the need for
resampling when averaging spectra observed at different time of year.

This proposition is equal to a change of reference frame for the channel
spacing. Due to hardware limitation, this change of frame can only be done
from the observatory to the barycentric frame. This implies that adaptation
of the frequency channel spacing when going from the barycentric frame to
the source rest frame will still be needed.

\section{\class{} implementation}

\subsection{The header parameters}

\TabHeader{} %

Table~\ref{tab:header} describes the \class{} header parameters used to
describe the frequency/velocity axes and their translation in this
document. The signal and image frequency axis are given in the source (rest) frame
by
\begin{equation}
  \frest[sig](\ic) = \frest[sig,tuned] + (\ic-\ic[0]) \, \dfrest,
\end{equation}
and
\begin{equation}
  \frest[ima](\ic) = \frest[ima,tuned] - (\ic-\ic[0]) \, \dfrest,
\end{equation}
with
\begin{equation}
  \dfrest = \frac{\dfmeas[IF]}{1+\dmeas[\emr{sys}]}
  \quad \mbox{and} \quad
  \dmeas[\emr{sys}] = -\frac{\vmeas[\emr{sys}]}{\clight},
\end{equation}
where \dfmeas[IF] is the frequency channel spacing , and \vmeas[\emr{sys}]
is the source systemic velocity \emph{in the measurement frame}. The
corresponding velocity axis in the measurement frame is thus given by
\begin{equation}
  \vmeas(\ic) = \vmeas[sys] + (\ic-\ic[0]) \, \dvmeas
  \quad \mbox{with} \quad
  \dvmeas = -\clight\frac{\dfmeas}{\frest[tuned]}.
\end{equation}

\subsection{The \texttt{MODIFY FREQUENCY} command}

This command is used to assign a new rest frequency to the current
spectrum. The velocity axis is thus recomputed to set the source systemic
velocity at this new rest frequency (see
Section~\ref{sec:interpretation:frest}). For consistency the description of
the image frequency axis must also be changed.

This command exists because the line rest frequency is sometimes more
uncertain than the spectrometer resolution, implying that the line appeared
at velocity different from the source systemic velocity.  Nowdays, the
bandwidth of the receivers is moreover so large that many lines appear in
the same spectrum. For this latter use case, the only way to associate the
right velocity to different line rest frequency is to use this command.

\subsubsection{Signal frequency axis}

The signal frequency axis stays constant under this transform. Only its
description changes. This can be written as
\begin{eqnarray}
  \frest[sig](\ic) & = & \frest[sig,old] + (\ic-\ic[0,old]) \, \dfrest,\\
                   & = & \frest[sig,new] + (\ic-\ic[0,new]) \, \dfrest,
\end{eqnarray}
with
\begin{equation}
  \dfrest = \frac{\dfmeas[IF]}{1+\dmeas[\emr{sys}]}.
\end{equation}
It is then easy to deduce that only the reference channel must be changed as
\begin{equation}
    \ic[0,new]
  = \ic[0,old]
  + \frac{\frest[sig,new]-\frest[sig,old]}{\dfmeas[IF]} \, \paren{1+\dmeas[\emr{sys}]}
\end{equation}

\subsubsection{Image frequency axis}

The image frequency axis must also be kept fixed. This implies
\begin{eqnarray}
  \frest[ima](\ic) & = & \frest[ima,old] - (\ic-\ic[0,old]) \, \dfrest,\\
                   & = & \frest[ima,new] - (\ic-\ic[0,new]) \, \dfrest,
\end{eqnarray}
We thus yield for the new tuned signal and image frequency the following relations
\begin{eqnarray}
  \frest[sig,new] & = & \frest[sig,old] + (\ic[0,new]-\ic[0,old]) \, \dfrest,\\
  \frest[ima,new] & = & \frest[ima,old] - (\ic[0,new]-\ic[0,old]) \, \dfrest.
\end{eqnarray}
Adding them gives
\begin{equation}
  \frest[ima,new] + \frest[sig,new] = \frest[sig,old]+\frest[ima,old].
\end{equation}
This relation can be used to computes the new image frequency. It can be
interpreted as the LO tuning frequency is kept fixed under the
transformation. But the side band separation changed.

\subsubsection{Velocity axis}

The reference channel of the velocity axis was already changed. It only
remains to recompute the new velocity resolution associated to the new rest
frequency
\begin{equation}
  \dvmeas[new] =  - \clight \frac{\dfmeas}{\frest[ima,new]}.
\end{equation}

\subsection{The \texttt{MODIFY VELOCITY} command}

This command is used to assign a new source systemic velocity to the
current spectrum. This command is used when the line rest frequency is
known very accurately but the line appears shifted. This implies that the
source systemic velocity is slightly offset (see
Section~\ref{sec:interpretation:vobs}).

\subsubsection{Principle}

Changing the source systemic velocity is a change of source reference
frame. The signal and image frequency scales in the measurement frame must
stay constant under this transform. However they change in the source
reference frame. Indeed
\begin{equation}
  \fmeas = (1+\dmeas[old]) \, \frest[old] = (1+\dmeas[new]) \, \frest[new],
\end{equation}
with
\begin{equation}
  \dmeas[old] = -\frac{\vmeas[sys,old]}{\clight}
  \quad \mbox{and} \quad
  \dmeas[new] = -\frac{\vmeas[sys,new]}{\clight}.
\end{equation}
Hence
\begin{equation}
  \frest[new] = \frest[old] \, \frac{1+\dmeas[old]}{1+\dmeas[new]}.
\end{equation}

\subsubsection{The signal frequency axis}

The rest signal frequency must be kept fixed. Indeed, the user is trying to
characterize a line at the rest signal frequency. But the rest frequency
axis changed
\begin{eqnarray}
      \frest[sig,new](i)
  &=& \frest[sig,tuned] + (\ic-\ic[0,new]) \, \dfrest[new]\\
  &=& \bracket{\frest[sig,tuned] +  (\ic-\ic[0,old]) \, \dfrest[old]}
      \, \frac{1+\dmeas[old]}{1+\dmeas[new]}. 
\end{eqnarray}
This equality must be true whatever \ic{}. This implies that the reference
channel and the frequency resolution must be recomputed with
\begin{equation}
  \ic[0,new] = \ic[0,old] 
             + \frac{\frest[sig,tuned]}{\dfmeas[old]} \, \bracket{\dmeas[new]-\dmeas[old]},
\end{equation}
and 
\begin{equation}
  \dfrest[new] = \dfrest[old] \, \frac{1+\dmeas[old]}{1+\dmeas[new]},
  \quad \mbox{\ie{},} \quad
  \dfmeas[new] = \dfmeas[old].
\end{equation}
The last equation just indicates that the channel spacing, which were
measured in the measurement frame, did not changed. Indeed, this is the
source frame (and not the measurement frame) which is changed through this
transformation. The equation for the computation of the rest frequency
resolution from measurement frequency resolution is the usual one
(Eq.~\ref{eq:frest}).

\subsubsection{The image frequency axis}

Now that the reference channel has been computed to keep the rest signal
frequency fixed, the only free parameter to compute the new image frequency
axis is the tuned image frequency.

\begin{eqnarray}
      \frest[ima,new](i)
  &=& \frest[ima,tuned,new] - (\ic-\ic[0,new]) \, \dfrest[new]\\
  &=& \bracket{\frest[ima,tuned,old] -  (\ic-\ic[0,old]) \, \dfrest[old]}
      \, \frac{1+\dmeas[old]}{1+\dmeas[new]}. 
\end{eqnarray}
\begin{equation}
    \frest[ima,new]
  = \frest[ima,old] \, \frac{1+\dmeas[old]}{1+\dmeas[new]}
  - \frest[sig,tuned] \, \frac{\dmeas[new]-\dmeas[old]}{1+\dmeas[new]}.
\end{equation}

\subsubsection{The doppler factor}

Note that the systemic velocity is often given in a different frame (LSR,
heliocentric) than the measervatory frame. As long as the new systemic
velocity is given in the same frame as the old systemic velocity, it is
possible to compute the new doppler factor from the old one. Let's assume
that the systemic velocity is given in the LSR frame. We have
\begin{equation}
  \dmeas[old] = -\frac{\vmeas[lsr]+\vlsr[sys,old]}{\clight}
  \quad \mbox{and} \quad
  \dmeas[new] = -\frac{\vmeas[lsr]+\vlsr[sys,new]}{\clight}.  
\end{equation}
Subtracting both equation gives
\begin{equation}
  \dmeas[new] = \dmeas[old] + \frac{\vlsr[sys,old]-\vlsr[sys,new]}{\clight}.  
\end{equation}

\subsection{The \texttt{MODIFY REDSHIFT} command}

This could be added.

\subsection{The \texttt{CONSISTENCY} command}

This command is used to check whether all the spectra in the \class{}
current index are consistent. In particular, checking their spectroscopic
information ensures that their spectral axes are aligned before, \eg{},
averaging the spectra. The consistency status helps \class{} commands or
the end-user to decide whether further processing can be done channel by
channel, or whether resampling is needed to realign the spectra channels.

The spectroscopic consistency aims at checking the alignment of both the
signal frequency and the velocity axes. What should be done with the image
frequency axis is unclear as it depends on the kind of data (\eg{}, DSB
spectra). One kind of X axes is considered to be aligned when the four
following conditions are fulfilled:
\begin{enumerate}
\item The left edges of the X ranges covered by the spectra are the same to
  a given tolerance;
\item The right edges of the X ranges covered by the spectra are the same
  to the same tolerance;
\item The spectra have the same number of channels;
\item The resolution sign is the same.
\end{enumerate}
The tolerance in the two first conditions is set to a fraction of channel
(typically 10\%). It is not yet customizable by the user. These two
conditions ensure that the whole X range covered by all the spectra are
identical within the accepted tolerance (including the dilatation due to
the doppler effect that may vary from spectrum to spectrum). Combined with
the third condition, this yields a identical resolution within the accepted
tolerance. In particular, these three conditions tolerate a consistent
shift in the reference channel and physical value at the reference channel.
Finally, the last condition ensures that all the X axes increase or
decrease in the same direction, channelwise. In the \class{}
implementation, the tests 3 and 4 are done first, and only once for all
kind of axes. The conditions 1 and 2 are then applied successively for the
signal frequency and the velocity axes.

\section{The situation at the IRAM-30m}

\subsection{Velocity conventions}

For historical reasons, the velocity convention used to stop the periodic
shift due to Earth rotation (see Sect.~\ref{sec:shift}) is the optical
convention at the IRAM-30m. Let's assume that the systemic velocity of the
source is given in the radio convention as it is the natural convention for
radio-observatories (see Sect.~\ref{sec:conv:radio}). The tuned frequency
in the observatory frame is thus
\begin{equation}
  \fobs[tuned,opt] = \frac{\frest[tuned]}{1+\frac{\vobs[sys]}{\clight}},
\end{equation}
while it should be
\begin{equation}
  \fobs[tuned,rad] = \frest[tuned] \paren{1-\frac{\vobs[sys]}{\clight}}.
\end{equation}
The output spectrum will appear shifted in the observatory frame by
\begin{equation}
    \fobs[tuned,rad]-\fobs[tuned,opt]
  = \frest[tuned] \, \paren{1-\frac{\vobs[sys]}{\clight}- \frac{1}{1+\frac{\vobs[sys]}{\clight}}}
  = -\frest[tuned] \, \paren{\frac{\vobs[sys]}{\clight}}^2 \frac{1}{1+\frac{\vobs[sys]}{\clight}}.
\end{equation}
And the signal frequency in the rest frame is shifted by
\begin{equation}
    \frest[sig,tuned,rad]-\frest[sig,tuned,opt]
  = -\frest[tuned] \, \frac{{\dobs[sys]}^2}{1-{\dobs[sys]}^2}.
\end{equation}
At 115 GHz, this gives a shift of 3.2 kHz for a velocity of 50\kms{} and
1.3 MHz for a velocity of 1000\kms{}. Hence both Galactic and
extra-Galactic measurements are affected in a measurable way. Nevertheless,
this can be measured only by comparison of the lines measured at the
IRAM-30m with other radio-observatories. 

We recommend that the 30m changes the formula it uses to stop the periodic
shift due to Earth rotation and now use the radio convention.

\subsection{Systemic velocity in different frames}

The previous equations assume that the systemic velocity is given in the
same frame as the frequency channel spacing. However, at the 30m the
systemic velocity is usually given in the LSR frame (as requested by the
user) and the channel spacing and the doppler factor are given in the
observatory frame.

On one hand, the rest frequency scale is correctly computed by \class{}
because the channel spacing and the doppler factor are given in the same
frame. On the other hand, the velocity scale is only approximated because
the source systemic velocity is given in another frame, most often the LSR
frame.

The end-user (astronomer) is interested with the velocity scale in the LSR
frame
\begin{equation}
  \vlsr(\ic) = \vlsr[sys] + (\ic-\ic[0]) \, \dvlsr
  \quad \mbox{with} \quad
  \dvlsr = -\clight\frac{\dflsr}{\frest[tuned]}.
\end{equation}
But he actually gets
\begin{equation}
  \vlsr(\ic) = \vlsr[sys] + (\ic-\ic[0]) \, \dvobs
  \quad \mbox{with} \quad
  \dvobs = -\clight\frac{\dfobs}{\frest[tuned]}.
\end{equation}
The relative error can be expressed as
\begin{equation}
  \frac{\dvobs-\dvlsr}{\dvlsr} = \frac{\dfobs}{\dflsr}-1 = \frac{1+\dlsr[sys]}{1+\dobs[sys]}-1.
\end{equation}
We yield to first order in $v/\clight$
\begin{equation}
  \frac{\dvobs-\dvlsr}{\dvlsr} = \frac{\vobs[sys]-\vlsr[sys]}{\clight} \sim 10^{-4}.
\end{equation}
If we tolerate an error of 1/10th of a channel on the velocity, this
implies that the velocity scale is correct for about 1000 channels around
the systemic velocity. This translates into $\sim250\kms$ at 1\mm{} for a
spectral resolution of 195\kHz. This means that the interpretation of the
velocity scale of Galactic observations is correct. On the other hand, this
could be a problem for extra-galactic observations at extremely high
spectral resolution, assuming that the observers do not first downsample
their spectra to increase the signal-to-noise ratio per channel...

The easiest way out of the problem would be to write the parameters of the
header in the LSR frame in the calibration software that writes the \class{}
observation with
\begin{equation}
  \dflsr = \dfobs \, \frac{1+\dobs[sys]}{1+\dlsr[sys]},
  \quad
  \dvlsr = -\clight\frac{\dflsr}{\frest[tuned]},
  \quad \mbox{and} \quad
  \dlsr = 1-\frac{\vlsr}{\clight}.
\end{equation}
In other words, we trick \class{} into thinking that the measurement frame
is LSR, while the true measurement frame was the observatory.

\begin{verbatim}
***************************************************************************
Question: What about the image frequency? Should it be changed as in the
case of the MODIFY VELOCITY command?
***************************************************************************
\end{verbatim}

\section{Conclusions}

\section*{Acknowledgement}

The process to reach the final version of this memo took very long because
the problem is extremely subtle even though it seems straightforward at
first sight. We thank S.~Guilloteau, H.~Liszt, R.~Lucas, G~.Paubert,
V.~Piétu, and B.~Winkel for useful discussions. Without them, we would
probably still wander around.

\bibliographystyle{aa}
\bibliography{class-spectral-axis}

\end{document}

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

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