SAY " "
SAY "Demonstration of IMAGER: Simple Spectral Line case"
SAY " "
!
@ gag_demo:demo-setup
!
SAY "-----------------------------------------------------------"
SAY " The first step: Reading UV data"
SAY " "
DO "read uv gag_demo:demo-line-imager.uvt"  "Read the UV data"
!
SAY "-----------------------------------------------------------"
SAY " "
SAY "Now, we will explore various aspects of the UV data"
SAY 
!
! UV table inspection
!
DO "uv_stat header" "List the UV buffer header"
DO "specify telescope NOEMA"  "Telescope is not defined, do it"
DO "show coverage"  "Show the UV coverage"
DO "show uv ?"      "List the input parameters of SHOW UV"
DO "let xtype time  "  "Change the type of data to be displayed"
DO "let ytype weight"  "Change the type of data to be displayed"
DO "show uv "       "xtype "'xtype'" vs ytype "'ytype'
DO "uv_stat weight"  "List the impact of the MAP_ROBUST parameter on beam size" 
!
! Imaging
SAY "-----------------------------------------------------------"
SAY " "
SAY "Now evaluating the impact of UV_MAP parameters"
say " "
!
DO "uv_map ?" "Check the UV_MAP input parameters"
DO "uv_map"   "Compute Dirty and Beam images"  
DO "view beam /nopause"  "VIEW falls back to SHOW if only one plane"
!
! Simple clean deconvolution
SAY "-----------------------------------------------------------"
SAY " "
SAY "Now evaluating the impact CLEAN parameters"
SAY " "
!
DO "clean ?" "CLEAN input parameters"
DO "clean"   "Compute the CLEAN image from DIRTY and BEAM"
DO "view cct"      "Show the flux convergence, all channels"
DO "show cct"      "Show the flux convergence, per channel"
DO "show sources"  "Show the Clean Components, position & relative flux"
DO "view clean /nopause"    "View the CLEAN image"
!
! Empirical noise definition
DO "view noise" "Look at the Noise of the CLEAN (last shown) image"
!
! Use noise information for contour plotting
! DO "let space_type noise" "Set the contour spacing as multiple of Noise"
DO "let spacing 2.5 SIGMA" "2.5 sigma level spacing"      
DO "let do_bit no" "No bitmap display"
DO "let size 24"   "Source does not go beyond that"
DO "show clean"  "The contour map with this spacing"
!
! Use of a support
!
SAY "-----------------------------------------------------------"
SAY " Using MASK "
SAY " "
DO "mask init" "Initialize a Mask"
DO "mask threshold 3 sigma"  "Automatic masking based on previous Clean"
DO "show mask"
DO "mask use" "Tell Clean to use this Mask"
DO "clean"
DO "show residual"
DO "show clean" 
!
SAY "-----------------------------------------------------------"
SAY " "
SAY 'ansi%bold'" ...Final VIEW, press H if you are lost !... "'ansi%none'
SAY " "
DO "view clean"    "View the CLEAN image, interactive mode, type E to exit this View"
!
SAY "Done --- Exiting "
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
