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

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

% 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{\spacetxet}{\quad\hspace{6.0\baselineskip}}

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

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

\fancyhf{} % Clears all fields.

\lhead{\scshape Cookbook to setup IRAM-30m observations}
\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{\FigVisibility}{%
  \begin{figure}[h!]
    \centering %
    \includegraphics[width=\linewidth]{astro-30m-setup-cookbook-vis}
    \caption{Source visibility plot}
    \label{fig:visi}
  \end{figure}}

\newcommand{\FigReprojection}{%
  \begin{figure*}[h!]
    \centering %
    \includegraphics[width=0.475\linewidth]{astro-30m-setup-cookbook-sourima}
    \includegraphics[width=0.475\linewidth]{astro-30m-setup-cookbook-sourrep}
    \caption{The original and reprojected images plots.}
    \label{fig:reproj}
  \end{figure*}}

\newcommand{\FigSetup}{%
  \begin{figure*}[h!]
    \centering
    \includegraphics[width=0.475\linewidth]{astro-30m-setup-cookbook-setup1}
    \includegraphics[width=0.475\linewidth]{astro-30m-setup-cookbook-setup2}
    \caption{Setups 1 and 2 observing strategies printed on the offset
      coordinates (Use {\texttt{[Optional]} commands to plot offset
        coordinates}).}
    \label{fig:Strategy}
  \end{figure*}}

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

\begin{document}

\title{IRAM Memo 2019-1}
\title{Cookbook to setup IRAM-30m observations}
\author{W.Kim$^{1}$, J. Pety$^{2,3}$ \\[0.5cm]
  1. IRAM (Granada)\\
  2. IRAM (Grenoble)\\
  3. Observatoire de Paris}
\date{Sep. 6th 2019\\
  Version 0.2}

\maketitle %

This cookbook gives a list of steps to enable the beginner or the
occasional user to produce On-The-Fly (OTF) mapping scripts for the 30m
telescope without any advanced knowledge. In the separated document, we
will cover some details of OTF mapping scripts, for example, how to
estimate all output OTF mapping parameters. The following steps allow the
user to make \texttt{Pako} OTF mapping scripts in addition to some of the
default scripts.



\begin{itemize}[noitemsep]
  \ttfamily
\item[1] ASTRO> @ 30m-setup.astro \qquad\qquad\qquad!Load basic parameters
  of 30m setup.
\item[Step1:] Project setup
\item[2] ASTRO> project pi ``PI\_name''\qquad\qquad!e.g., ``Pako''
\item[3] ASTRO> project obs ``Observe\_name''\quad!e.g., ``Pako''
\item[4] ASTRO> project id ``Project\_id''\qquad\,\,\,!e.g., ``156-18''
\item[5] ASTRO> project nick ``nickname''\qquad\,\,!e.g., ``m17''
\item[6] ASTRO> project clean
\item[7] ASTRO> project open\qquad\qquad\qquad\qquad\quad!Create
  directories and general.pako script.
\item[] ASTRO> \$ls
\item[] ha log m17\qquad\qquad\qquad\qquad\qquad\qquad\quad\,\,!new
  directories are created.
\item[] ASTRO> \$cat m17/general.pako
\item[]
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
\item[] !
\item[] sic priority
\item[] sic priority 1 pako
\item[] set project 156-18
\item[] set pi Pako
\item[] set observer Pako
\item[] set operator pako
\item[] set angleunit arcsec
\item[] set topology low
\item[] set level 3 3
\item[] show
\item[] set dosubmit no
\item[] catalog sou ~/m17/m17.sou
\item[] catalog lin ~/m17/m17-spec.lin
\item[] !
\item[]
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
\item[Step2:] New setup
\item[8] ASTRO> newsetup\qquad\qquad\qquad\qquad\qquad\qquad!Give setup
  number, e.g., setup1-XXX.Pako.
\item[Step3:] Source catalog setup
\item[9] ASTRO> sourcat open
\item[10] ASTRO> sourcat add m17 18:20:36.0 -16:10:18.0 21.33\,\,![J2000
  RA] [J2000 Dec] [km\,s$^{-1}$].
\item[11] ASTRO> sourcat close
\item[12] ASTRO> sourvis\qquad!Create a source catalog and save source
  visibility plot. See Figure 1.
\item[] I-OBSERVATORY, Selected VELETA observatory
\item[] I-CATALOG, New source catalog is m17/m17.sou
\item[] m17 Sun distance 82.9 No Avoidance
\item[] I-HARDCOPY, ha/m17-vis.png created
\item[] ASTRO> \$cat m17/m17.sou
\item[]
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
\item[] ! Source catalog for project 156-18
\item[]
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
\item[] !
\item[] m17 EQ 2000 18:20:36.0 -16:10:18.0 LSR 21.33
\item[] !
\item[]
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
\item[:] Visualize proposed observing field view
\item[13] ASTRO> let size 800\qquad\qquad\quad\quad\,\,\,!Size of GREG plot
  box [arcsec].
\item[14] ASTRO> sourima m17\_2d\_image.lm\quad\,\,!lmv or lm image
  extension. The left image of Figure 2.
\item[15] ASTRO> sourrep m17\_2d\_image.lm\quad\,\,!The right image of
  Figure 2.
\item[Optional] ASTRO> let do\_rcoord yes\qquad\qquad\,!Change from J2000
  RA-Dec coordinates to offset ones.
\item[Optional] ASTRO> go
\item[Optional] ASTRO> pointing\qquad\qquad\qquad\qquad\,\,\,!Create a
  pointing {\texttt{Pako}} script.
\item[] ASTRO> \$ls m17
\item[] general.pako m17.sou setup1-point.pako
\item[Step 4:] Reference positions for OTF mapping with position switch
  mode.
\item[16] ASTRO> psw -312 +1632\qquad\qquad\quad\,\,!Reference positions
  [arcsec].
\item[Step 5:] OTF setup
\item[17] ASTRO> let setup30m\%otf\%inp\%freq 116\,\,!Requested frequency
  for the target molecular line [GHz].
\item[18] ASTRO> otftime dump 1.0\qquad\qquad\qquad\,\,\,\,\,![second].
\item[19] ASTRO> otftime stab 90\qquad\qquad\qquad\quad\,\,!Time between
  two consecutive references [second].
\item[20] ASTRO> otftime cycle 9\qquad\qquad\qquad\quad\,\,!Time between
  two consecutive calibrations [minute].
\item[21] ASTRO> otfgeo m17 430 180 45 -100 -150\qquad![arcsec] [arcsec]
  [deg] [arcsec] [arcsec].
\item[]\spacetxet\spacetxet\qquad\qquad\quad\,\,!for details, see
  descriptions below.
\item[22] ASTRO> otfinput\spacetxet\qquad\quad!Dump user inputs.
\item[] Input parameters:
\item[] * Source name: m17
\item[] * Observing mode: psw
\item[] * OFF positions [arcsec]: -312 1632
\item[] * Size~~~[arcsec]: 430 180
\item[] * Center~[arcsec]: -100 -150
\item[] * Angle~~[degree]: 45
\item[] * Frequency [GHz]: 116
\item[] * Number of points per beam: 3\,\,!Default, 3.
\item[] * Overtime?~~~~~~~~~~~~YES\qquad\,\,!Default, YES. Take care of
  edge effect due to difficulties
\item[] \spacetxet\qquad\qquad\qquad\quad\,\,\,!to start OTF at the start
  of the line.
\item[Optional] If a user wants to change Number of points per beam and
  Overtime.
\item[Optional] ASTRO> let setup30m\%otf\%inp\%beamsampling
  4\qquad\qquad!It should be >= 3.
\item[Optional] ASTRO> let setup30m\%otf\%inp\%overtime
  NO\qquad\qquad\quad\,\,\,!$[$YES|NO$]$.
\item[23] ASTRO> otfpro\spacetxet\qquad\qquad!Make procedures and dump
  outputs.
\item[]
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
\item[] !
\item[] ! J.Pety \& C.Buchbender (2007-2013)
\item[] !
\item[]
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
\item[] !
\item[] ! Procedure \#1/4
\item[] !
\item[] ! Coverage parameters (lambda scanning):
\item[] ! ~* General parameters:
\item[] !~~~~~~- FWHM~~~~~[arcsec]: 21.206896551724
\item[] !~~~~~~- Sampling [arcsec]: 8.4614988045581 (Yes, it is better than
  FWHM/2)
\item[] ! ~* Geometry:
\item[] ! ~~~~~- Number of lines: 22
\item[] ! ~~~~~- Line length [arcsec]: 473.62068965517
\item[] ! ~* Time distribution:
\item[] ! ~~~~~- Total time~~[hrs]: 0.64049889264555
\item[] ! ~~~~~- ON+OFF time [hrs]: 0.55716555931222
\item[] ! ~~~~~- CAL time~~~~[hrs]: 0.083333333333333
\item[] ! ~~~~~- Time between two calibrations [min]: 7.6936349743015
\item[] ! ~* OTF scan parameters:
\item[] ! ~~~~~- Number of subscans:
\item[] ! ~~~~~- ON parameters:
\item[] ! ~~~~~~~~~o Time per phase~~~~~~~[s]: 1
\item[] ! ~~~~~~~~~o Dump time~~~~~~~~~~~~[s]: 1
\item[] ! ~~~~~~~~~o Time to slew line~~~~[s]: 67
\item[] ! ~~~~~~~~~o Slew velocity [arcsec/s]: 7.0689655172414
\item[] ! ~~~~~~~~~o Beam sampling [pts/beam]: 3
\item[] ! ~~~~~- OFF parameters:
\item[] ! ~~~~~~~~~o Offsets [arcsec]: -312 1632
\item[] ! ~~~~~~~~~o Time per OFF [s]: 12.661809845809
\item[] ! ~* CAL scan parameters:
\item[] ! ~~~~~- Time per cal [s]: 60
\item[] ! ~~~~~- Number of cal: 5
\item[] !
\item[]
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
\item[] !
\item[] clear alpha
\item[] limits 500 -500 -500 500
\item[] box
\item[] !
\item[] ! Reset backends
\item[] @ ~/m17/setup1-back.pako
\item[] !
\item[] source m17
\item[] !
\item[] set angle arcsec
\item[] off /clear
\item[] !
\item[] swtotal /tphase 1
\item[] !
\item[] otfmap 0 0 0 0 /croloop ror -
\item[] ~~~~~~~~~~~~~~~/totf 67 /tref 12.661809845809 -
\item[] ~~~~~~~~~~~~~~~/ref -312 1632 proj -
\item[] ~~~~~~~~~~~~~~~/syst proj /zigzag yes
\item[] !
\item[] cal /def
\item[] start
\item[] otfmap -330.27 -45.37 4.63 -380.27 /step 5.98 5.98 /notf 5
\item[] start
\item[] !
\item[]
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
\item[] {$\cdot\cdot\cdot$}
\item[] {$\cdot\cdot\cdot$}
\item[] {$\cdot\cdot\cdot$}
\item[] ASTRO> \$ls m17
\item[]
  general.pako~~~~~~~~~~~~~~~~setup1-otf-psw-beta-4.pako~~~~~~setup1-otf-psw-lambda-4.pako
\item[]
  m17.sou~~~~~~~~~~~~~~~~~~~~~setup1-otf-psw-beta-5.pako~~~~~~setup1-otf-psw-lambda-5.pako
\item[]
  setup1-otf-psw-beta-1.pako~~setup1-otf-psw-lambda-1.pako~~~~setup1-point.pako
\item[] setup1-otf-psw-beta-2.pako~~setup1-otf-psw-lambda-2.pako
\item[] setup1-otf-psw-beta-3.pako~~setup1-otf-psw-lambda-3.pako
\item[24] ASTRO> otfhard\qquad!Save a image of produced mapping strategy as
  the left image of Figure 3.
\item[] I-HARDCOPY, ha/m17-setup1-geo.png created
  % \item[24] track psw
\item[25] ASTRO> newsetup\qquad\qquad\qquad\qquad!Second setup, e.g.,
  setup2-XXX.pako, if it is required.
\item[26] ASTRO> pointing
\item[27] ASTRO> psw -312 +1632
\item[28] ASTRO> let setup30m\%otf\%inp\%freq 169
\item[29] ASTRO> otftime dump 1.0
\item[30] ASTRO> otftime stab 110
\item[31] ASTRO> otftime cycle 9
\item[32] ASTRO> otfgeo m17 430 180 190 00 120
\item[33] ASTRO> otfinput
\item[34] ASTRO> otfpro
\item[35] ASTRO> otfhard\spacetxet\spacetxet!the right image of Figure 3.
\item[] I-HARDCOPY, ha/m17-setup2-geo.png created
  % \item[35] track psw
\item[36] ASTRO> project close
\end{itemize}

\begin{itemize}
\item[1]Call all setup pipelines related to the 30m setup.
\item[2-4]Set PI and observer names, and project ID (i.e.,
  \texttt{``156-18''}).
\item[5]Set nickname that is the name of a directory to which all the
  created observing scripts are saved and is added in the name of a source
  catalog.
\item[6]Delete a directory with the same nickname specified by a command
  {\texttt{project nick ``nickname''}} and all files in the
  directory.
  \FigVisibility{} %
\item[7]Open a new project.
\item[8]After \texttt{newsetup}, all created observing \texttt{Pako}
  scripts contain 'setup1' in their names, e.g.,
  setup1-otf-psw-beta-1.pako. If setting another setup after the first one,
  files' name has 'setup2', e.g., setup2-otf-psw-beta-1.pako.
\item[9-12]Create a new source catalog. To add more than one source, add
  other sources like the line {\texttt{9}}.
\item[13-15]Read a 2D image file for visualization. Using either
  \texttt{lmv} or \texttt{lm} is available. Image files can be converted
  from any 2D image fits files by adding an extra command line,
  \texttt{fits IMAGE.fits to IMAGE.lm} before reading \texttt{sourima}
  command.
\item[14]Reproject the 2D image with source coordinates as a center of the
  image. If the image center and source coordinates are different, this
  step is necessary. %
  \FigReprojection{} %  
\item[16]Set reference positions for position switching (psw) mode.
\item[17]Set a requested frequency of the target molecular line.
\item[18-21]All input parameters to create OTF mapping \texttt{Pako}
  scripts. \texttt{otftime dump} means how often to collect
  data. \texttt{otftime stab} is maximum time between two consecutive
  references (maximum, 120 seconds). \texttt{otftime cycle} is maximum time
  between two consecutive calibrations (maximum, 15
  minutes). \texttt{otfgeo} is for setting a geometry of a requested area:
  \texttt{otfgeo SOURCE\_NAME OTFMAP\_SIZE\_XX OTFMAP\_SIZE\_YY OTFMAP\_PA
    OTFMAP\_CENTER\_XX OTFMAP\_CENTER\_YY}.
\item[22-24]Execute all processes to create OTF mapping scripts based on
  all the input parameters and visualize the mapping strategies on the
  selected 2D image in addition to dumping inputs and outputs.
\item[25-35]Make a new different setup.
\item[36]Close the project
  \FigSetup{} %
\end{itemize}

\end{document}

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