% Concepts

\subsection{Objectives and Design}
\imager\ is an interferometric imaging package in the \gildas{} 
software, tailored for usage simplicity and efficiency for 
multi-spectral data sets.

Contrary to \casa{}, whose goal is to most accurately solve the (interferometer and single-dish) 
measurement equation in its whole generality (wide field, ultra-wide bandwidths, 
mosaicing, polarization, high dynamic range, sky curvature, etc...), at the expanse of complex  
and thus relatively slow algorithms, the \imager{} design was driven by the 4 main facts:
\begin{enumerate}
 \item ``\textit{Simple}'' cases (unpolarized signal, single fields or relatively 
 small mosaics, relatively limited bandwidths, polarization for compact sources only) 
 constitute 99 \% of the cases.
 \item there is no unique image that can be used to perform astrophysics from
 a given interferometric data set.
 \item All deconvolution methods require some tuning of control parameters,
  so speed is an important issue 
 \item All images are ultimately limited by signal to noise considerations 
\end{enumerate} 
Thus, speed is important (to allow trials), and numerical accuracy can be traded of
for speed provided the resulting ``errors'' remain smaller than the noise level.

The main goals of \imager{} are
\begin{enumerate}
\item to offer a proper implementation of imaging in case of
wide relative bandwidth, where the natural angular resolution
changes with frequency.
\item to implement a simple and efficient scheme to process Mosaics,
including short spacings from single dish data
\item to take advantage of improved capabilities of \NOEMA{} and 
\ALMA{}, by offering new tools like self-calibration or wide bandwidth 
analysis (and to some extent, polarization handling)
\item to simplify user interfaces, by providing sensible defaults.
\item to minimize image sizes 
\item to minimize processing time by using parallel programming as much 
as possible and reducing Input/Output to the strict minimum.
\end{enumerate}

\imager{} was developed and optimized to minimize Input/Output that
are the bottleneck of current computers. 
Therefore, \imager{}\  works mostly on internal buffers and avoids as 
much as possible saving data to intermediate files. File saving is done 
ultimately once the data analysis process is complete, which offers an 
optimum use of the disk Input/Output bandwidth. 

\imager{} also includes advanced display and image analysis tools, such as
simple overlaying of different data cubes, etc...



\subsection{IMAGER for you...}

If you do not know how to do something, just use the \com{HOW\_TO}
command to express your question in a (semi-) natural way, e.g.

\texttt{how to combine alma and aca}\\

Use the \com{HELP} command for more details on commands.
Use the \com{TIP} command for useful suggestions.


\subsection{IMAGER for beginners}
If you do not know SIC, you \textbf{must} read the (short) Section \ref{sub:sic},
and some of the SIC manual. 

If you have never done any interferometry before, or if you do not know 
what is a \uv{} table, we (\textbf{strongly}) suggest you read Sections \ref{sub:structure},
\ref{sec:uvtables} 
and \ref{sec:single} before doing anything at all. These sections are short 
enough to give you the basic tools (\com{HELP} plus the 5 main 
commands: \com{READ}, \com{UV\_MAP}, \com{CLEAN}, \com{VIEW} and 
\com{WRITE}), and will give you hints on why \imager{} behaves like 
this.

Remember two things: look at the results (command \com{VIEW}) at 
all steps, and ask more experienced users whether these results make sense if
any doubt arise.

\subsection{IMAGER for previous users of \mbox{\mapping{}} }
\imager{} offers a number of advantages against \mapping{} : higher
speed, simpler and more consistent user interface, integrated 
pipeline processing, and a number of improved image analysis tools.
However, the principles have not changed. 
Most commands remain quasi identical in \imager{} and \mapping{},
with basically the same control parameters.


Actions which were driven by widgets have often been replaced by simple 
commands (with intuitive names). A quick look at the \com{HELP} will 
guide you to the commands that will do what widgets were doing before. 
So you can skip over the fundamentals, and focus on the new tools 
offered by \imager{}. In practice, for you, commands will make fairly 
reasonable choices of default parameters. Just do not forget to 
\com{WRITE} your data.

In short, the biggest changes for  \mapping{} users are\\
- the lack of use of the \com{GO} command, 
and thus of the \sicvar{NAME} and \sicvar{TYPE} variables\\
- the suppression of \sicvar{MAP\_RA} \sicvar{MAP\_DEC} \sicvar{MAP\_ANGLE} and \sicvar{UV\_SHIFT}
which have been replaced by \sicvar{MAP\_CENTER} \\
- the replacement of all tasks by simpler, standard commands.

Changing the defaults may be needed only for practical reasons:
\begin{itemize}\itemsep 0pt
\item Optimizing computation time. This includes adjusting
the field of view (variable \sicvar{MAP\_FIELD}), resampling
in velocity (command \com{UV\_RESAMPLE}) and time averaging
(command \com{UV\_TIME})
\item Comparing strictly different images (on a pixel per pixel
basis). Adjusting \sicvar{MAP\_SIZE} and \sicvar{MAP\_CELL} will
become necessary in such a case.
\end{itemize}

The names of variables and most commands have been kept from 
\mapping{}, old names appear in the \com{HELP} whenever they have been 
replaced. 

\subsubsection{Forget \com{INPUT} and  \com{GO} command}

However, the \com{GO} command is totally obsolete. In general
any \qom{GO SOMETHING} is simply replaced by the equivalent
command \qom{SOMETHING}: e.g. type \com{VIEW} instead of \qom{GO VIEW}.
\comm{GO}{PLOT}  (or its variants \comm{GO}{BIT}, \comm{GO}{NICE} and \comm{GO}{MAP}) and 
\comm{GO}{UVSHOW} are replaced by the \com{SHOW} command, which offers
many more possibilities.

The capabilities given by the \com{INPUT} \mapping{} command have in
general be replaced by the more flexible use of the question mark
(\qom{?}, or \qom{??}, or even \qom{???}) as arguments to individual \imager{} commands.
Most commands display their control parameters with such arguments.

Take a little time to browse through \comm{HELP}{SHOW} and \comm{HELP}{VIEW}
to get familiar with \imager{} display capabilities.


\subsection{IMAGER for huge data sets: 100 000 channel imaging with \NOEMA{} or \ALMA{} }

For \NOEMA{}, with the advent of PolyFiX, the paradigm has changed: a spectral window
may contain a substantial number of interesting spectral lines, not
just one as with the previous narrow band spectral correlator. The same
can happen (although to a lesser extent) with \ALMA{}.

That is perhaps where \imager{} is most helpful. It contains new tools 
to help you automating this tedious part.  The primary tool is command 
\com{UV\_PREVIEW} which, provided one or more spectral line catalogs 
have been defined (see command \com{CATALOG}), allows to semi-automate 
the line identification among many UV tables. 

The script \qom{@ }\script{noema-scan} used after a \com{UV\_PREVIEW} on a 
wide band UV table will help you identify who is who among the 64 
spectral windows that PolyFix may provide. 

A widget (driven by script \script{imager\_init}) also allows simple 
image creation from
any UV table, including continuum subtraction, referencing to 
different frequencies and velocities, and
spectral resampling. Script \com{@}\script{imager-one} offers another 
alternative. Both can be useful examples for more advanced processing.

A much more advanced tool is the \com{PIPELINE} command 
that streamlines and even fully automates the imaging process of
a whole ensemble of UV tables. See Section \ref{sec:all} for details.

\subsection{IMAGER for lazy or overbooked ones}

If you have many spectral lines, and need results very quickly, 
the \qom{PIPELINE}s command. It can provide
you one image for each spectral line specified in your line catalog
that fall into the bandwidth of your data.

The default will do a pretty good job on most data sets, but
can be customized for a better result. 
See Section \ref{sec:all} for details.


\subsection{IMAGER for ALMA data}

\imager{} implements in CASA the \texttt{casagildas()} tool that automates
the transfer of calibrated visibilities from a CASA Measurement Set
to UVFITS files that can be readily imaged with \imager{}.


\subsection{IMAGER for image analysis and publication plots}

\imager{} also includes general data-cube handling tools, such as
spectral or spatial resampling, re-projection, image combinations,
and several elaborate viewers that can be used to explore data cubes
and/or prepare publications quality plots. See Section \ref{sec:visual}.

The display commands (but not the data handling tools) are also 
separately available in the \viewer{} program.

\subsection{IMAGER for Simulations}

\imager{} also includes an easy-to-use observation simulator that
can help you checking whether a modeled feature is observable
with a given array. See Section \ref{sec:simul} for details.
