!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
begin procedure show-fit-one
  define integer ix iy
  let ix &1
  let iy &2
  define character cubeid*256 scaling*3 scale*1 title*32
  let title "&3"
  let cubeid 'name'":*fit,parameters,&4,&5*"
  let scaling "&6"
  let scale "&7"
  !
  go\load 'cubeid' /shape /into n
  set\panel 'ix' 'iy' /aspect n%l/n%m
  if (scale.ne."=") then
     go\load 'cubeid' /extrema /into ext global
     define real ext%rmin ext%rmax /global
     let ext%rmin 'ext%min%val'
     let ext%rmax 'ext%max%val'
  endif
  go\load 'cubeid' /first image /into image
  greg1\limits /rg
  if (scaling.eq."lin") then
     greg2\plot /scaling lin 'ext%min%val' 'ext%max%val'
  else if (scaling.eq."log") then
     if (ext%rmax.le.0) then
        let ext%rmin 1
        let ext%rmax 1
     else if (ext%rmin.le.0) then
        go\load 'name'":*fit,parameters,&4,noise*" /extrema /into noiext
        let ext%rmin 'noiext%min%val'
     endif
     ! exa ext%rmin ext%rmax
     let ext%rmin 1
     greg2\plot /scaling log 'ext%rmin' 'ext%rmax'
  else
     return base
  endif
  if ((ix.eq.1).and.(iy.eq.1)) then
     greg1\box /unit sec
     greg1\label "\gdR.A." /x
     greg1\label "\gdDec" /y 3.5
  else if (ix.eq.1) then
     greg1\box n o /unit sec
     greg1\label "\gdDec" /y 3.5
  else if (iy.eq.1) then
     greg1\box p n /unit sec
     greg1\label "\gdR.A." /x
  else
     greg1\box n n /unit sec
  endif
  greg2\wedge right 0.3
  greg1\draw text 0 1 'title' 6 0 /char 7
  go\load 'cubeid' /unit /into unit
  greg1\draw text 0 1 "["'unit'"]" 5 0 /char 9
end procedure show-fit-one
!
begin procedure show-fit-all
  define character kind*12
  define integer icomp
  let kind "&1"
  if (kind.eq." ") then
     let kind "signal"
  else if ((kind.ne."signal").and.(kind.ne."noise").and.(kind.ne."snr")) then
     message e show-fit "Usage @ show-fit [signal|noise|snr]"
     return base
  endif
  define character scaling*3 scale*1
  if (kind.eq."signal") then
     let scale "="
     let scaling "lin"
  else
     let scale ""
     let scaling "log"
  endif
  if (pro%narg.eq.2) then
     let icomp &2
  else
     let icomp 1
  endif
  !
  gtvl\clear
  set\panel /def /nxy 3 1 /inter 0.3 0.2
  greg1\set expand 0.6
  gtvl\lut /blank black
  !
  @ show-fit-one 1 1 "Line Integrated Profile"    "gaussian,"'icomp'",area"     'kind' log
  @ show-fit-one 2 1 "Centroid Velocity"          "gaussian,"'icomp'",velocity" 'kind' lin
  @ show-fit-one 3 1 "Full Width at Half Maximum" "gaussian,"'icomp'",fwhm"     'kind' log
end procedure show-fit-all
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
@ show-fit-all &1 &2
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
