!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
if .not.exist(window_init) then
   @ window_tools.greg
endif
!
clear
@ window_init
let inter 0.25
let aspect_ratio no
@ window_xy 1 1 1
draw text 0 1 "Solve for focus by subreflector translation" 8 0 /char 8 
!
define integer my_marker_sides my_marker_style
define real    my_marker_size 
define double  sfcz dfcz
!
my_marker_size  = marker_size
my_marker_sides  = marker_sides
my_marker_style = marker_style
!
greg1\set marker 32 3 .3
!
for idir 1 to 2 
  @ window_xy 1 2 'idir'
  if (zfocus%fun'idir'%flag.eq.0) then
     limits /var zfocus%sol'idir'%x zfocus%sol'idir'%y
     limits = = < > /var zfocus%dat'idir'%x zfocus%dat'idir'%y
     pen 0
     points zfocus%dat'idir'%x zfocus%dat'idir'%y
     pen 1
     connect zfocus%sol'idir'%x zfocus%sol'idir'%y
  else if (zfocus%fun'idir'%flag.eq.-1000) then
     pen 1
     draw text 0 0 "Waiting for data" 5 0 /char 5
  else
     pen 1
     exa zfocus%fun'idir'%flag
     draw text 0 0 "Something wrong" 5 0 /char 5     
  endif
  pen 0
  box
  draw text 1 -1.5 'zfocus%dir[idir]' 6 0 /char 7
  if (zfocus%fun'idir'%name.eq."POLYNOMIAL") then
    sfcz = -zfocus%fun'idir'%par2%value/(2.*zfocus%fun'idir'%par3%value)
    dfcz = -1
  else
    sfcz = zfocus%fun'idir'%par2%value
    dfcz = zfocus%fun'idir'%par2%error
  endif
  draw text 1 -3.0 "SFCZ = " 6 0 /char 7
  if (zfocus%fun'idir'%flag.ne.-1000) then
     label 'nint(100*sfcz)/100' /center 6
     if dfcz.gt.0 then
       label " +/- "'nint(100*dfcz)/100' /center 6
     endif
     label " mm" /center 6
  endif
  label "Displacement [mm]" /x
  draw text -3 0 "Intensity" 5 90 /char 4
next
!
greg1\set marker 'my_marker_sides' 'my_marker_style' 'my_marker_size'
!
return
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
