!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! MAPPING specific definitions
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
if .not.exist(map%defined) then
   ! Generic
   define structure map /global
   define logical map%newnames /global
   !
   let map%newnames .false.
   !
   ! Plot
   !
   define structure plot /global
   define character plot%kind*32 /global
   let plot%kind "view"
   !
   ! uvstat
   !
   define structure uvstat /global
   define character uvstat%mode*16 /global
   !
   ! uvshort
   !
   define structure uvshort /global
   define character uvshort%action*16 /global
   !
   let uvshort%action "all"
   !
   define double uvshort%postol uvshort%spetol /global
   let uvshort%postol 0.1
   let uvshort%spetol 0.01
   !
   define structure uvshort%diam uvshort%beam /global
   define double uvshort%diam%int uvshort%diam%sd /global
   define double uvshort%beam%int uvshort%beam%sd /global
   define double uvshort%uvtrunc uvshort%uvstep /global
   define double uvshort%datfac uvshort%weifac /global
   define character uvshort%unit*12 /global
   define double uvshort%ipfac /global
   !
   let uvshort%unit "*"
   let uvshort%datfac 1.0
   let uvshort%weifac 1.0
   let uvshort%ipfac  1.0
   !
   define integer uvshort%ifield /global
   let uvshort%ifield 1
   !
   define structure uvshort%names /global
   define character uvshort%names%inter*256 /global
   define character uvshort%names%short*256 /global
   define character uvshort%names%merged*256 /global
   !
   ! Support
   define structure gosupport /global
   define character gosupport%kind*16 /global
   define double gosupport%center[2] gosupport%major gosupport%minor gosupport%pa /global
   !
   let gosupport%kind "interactive"
   !
   ! Clean
   define structure myclean /global
   define double myclean%ratio /global
   define logical myclean%support myclean%version /global
   !
   let myclean%support no
   let myclean%ratio 0
   !
   ! uvmap
   !
   if (.not.map%newnames) then
     let taper_expo 2
     let map_uvcell 7.5 ! Temporary patch for default value
     let uv_cell map_uvcell 1.0
     let weight_mode "NATURAL"
   endif
   define integer wcol mcol[2] /global
   let mcol 0 ! Weight channel: Use "automatic" determination
   let wcol 0 ! Weight channel: Use "automatic" determination
   !
   ! Cleaning
   !
   define character method*12 /global
   !   define integer niter beam_patch[2] blc[2] trc[2] positive /global
   !   define double gain fres ares major minor angle /global
   !
   let method "hogbom" ! Cleaning method
   let gain 0.2        ! Clean gain
   let niter   0       ! Maximum number of clean components
   let fres 0.025      ! Deconvolution will stop when | residuals | <= fres * max(dirty image)
   let ares 0.0        ! Deconvolution will stop when | residuals | <= ares
   let blc 0           ! Bottom, left corner: Default 0 0 for inner quarter
   let trc 0           ! Top, right corner:   Default 0 0 for inner quarter
   let major 0         ! Clean Beam major axis (arc sec):      Default 0 for automatic
   let minor 0         ! Clean Beam minor axis (arc sec):      determination by Gaussian
   let angle 0         ! Clean Beam position angle (degrees):  fit of dirty beam
   let beam_patch 0    ! Default 0 0 ==> Inner Quarter
   !
   ! UV merge
   !
   define structure uvmerge /global
   define character uvmerge%in1*256 uvmerge%in2*256 uvmerge%out*256 /global
   define double uvmerge%wei_fac uvmerge%dat_fac uvmerge%alpha /global
   !
   let uvmerge%in1 " "
   let uvmerge%in2 " "
   let uvmerge%out " "
   let uvmerge%wei_fac 1
   let uvmerge%dat_fac 1
   let uvmerge%alpha 0
   !
   ! UV list
   !
   define structure uvlist /global
   define integer uvlist%step uvlist%chan /global
   !
   let uvlist%chan 1
   let uvlist%step 1
   !
   ! UV clip
   !
   define structure uvclip /global
   define real uvclip%val /global
   define logical uvclip%all /global
   !
   ! UV circle
   !
   define structure uvcirc /global
   define character uvcirc%in*256 uvcirc%out*256 /global
   define real uvcirc%min uvcirc%max uvcirc%step /global
   !
   let uvcirc%in   " "
   let uvcirc%out  " "
   let uvcirc%min    0
   let uvcirc%max    0
   let uvcirc%step 7.5
   !
   ! UV fits
   !
   define structure uvfit /global
   define integer uvfit%nf /global
   define real uvfit%range[2] /global
   define real uvfit%param01[7] uvfit%range01[7] uvfit%start01[7] /global
   define real uvfit%param02[7] uvfit%range02[7] uvfit%start02[7] /global
   define real uvfit%param03[7] uvfit%range03[7] uvfit%start03[7] /global
   define real uvfit%param04[7] uvfit%range04[7] uvfit%start04[7] /global
   define logical uvfit%subsf01 uvfit%subsf02 uvfit%subsf03 uvfit%subsf04 /global
   define character uvfit%funct01*12 uvfit%funct02*12 uvfit%funct03*12 uvfit%funct04*12 /global
   !
   let uvfit%nf 1
   let uvfit%funct01 "point"
   let uvfit%funct02 "point"
   let uvfit%param01 0
   let uvfit%range01 0
   let uvfit%start01 0
   let uvfit%range 0 1700
   !
   ! UV fit plots
   !
   define character uvfit%xtype*120[6] uvfit%ytype*120[6] uvfit%mod*120 /global
   define integer uvfit%nx uvfit%ny uvfit%np uvfit%order[2] /global
   define logical uvfit%bars /global
   !
   let uvfit%np 1
   let uvfit%order[i] i
   let uvfit%nx 1
   let uvfit%xtype "velo * *" "freq * *" "channel * *" "ra * *" "dec * *" "flux * *"
   let uvfit%ny 3
   let uvfit%ytype "ra * *" "dec * *" "flux * *" "major * *" "minor * *" "angle * *"
   let uvfit%mod ""
   let uvfit%bars yes ! Plot error bars
   !
   ! UV display
   !
   define character xtype*6 ytype*6 /global
   define logical error_bars /global
   !
   define structure uvshow /global
   define character uvshow%marker*12 /global
   define integer uvshow%step /global
   define integer uvshow%antenna /global
   define logical uvshow%fit /global
   define logical uvshow%track /global
   define logical uvshow%zero  /global
   define logical uvshow%flag  /global
   !
   let xtype "radius"  ! time, number, u, v, radius, angle
   let ytype "amp"     ! amp, pha, real, imag, weight, scan
   let error_bars no   ! Do not plot error bars
   !
   let uvshow%marker "4 1 .1" ! Point markers
   let uvshow%zero  yes       ! Display zero level
   let uvshow%track yes       ! Give one color per track
   let uvshow%step 12         ! 12 hours to separate 2 tracks
   let uvshow%fit  no         ! Do not plot model from uv_fit
   let uvshow%flag no         ! But default, "go uvshow" is not
                              ! called by command UV_FLAG
   let uvshow%antenna 0       ! By default, no antenna highlighted
   !
   ! UV flagging
   !
   define structure uvflag /global
   define character uvflag%fdate*12 uvflag%ldate*12 /global
   define character uvflag%fut*12   uvflag%lut*12 /global
   define character uvflag%base*3 /global
   define logical   uvflag%reset /global
   !
   let uvflag%fut   "00:00:00.0"
   let uvflag%lut   "24:00:00.0"
   let uvflag%fdate "01-jan-2000"
   let uvflag%ldate "31-dec-1999"
   let uvflag%base  "all"
   let uvflag%reset no
   !
   symbol write "CLEAN\WRITE"
   symbol cle*ar "GTVL\CLEAR"
   !
   define command info "@ welcome.map" no-help.hlp
   let command "input"
   !
   ! Phase self-calibration
   !
   @ selfcal-tools
   !
   ! Success
   !
   define logical map%defined /global
   let map%defined yes
   !
endif
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
