# Variable calculations should be done in this file.
# It is read and interpreted by wims for all valid calls to the module.

!read defaults
insplot_colors= xffffff x000000 x404040 xff0000 x00c000 x0000ff xa0a0a0 \
	xadd8e6 x000000 xdda0dd x9500d3  
!distribute item 1,1 into curvecolor, pointcolor
range=2.5
plotrange=[-4:4] [-$range:$range] [-$range:$range]

!if $status=next
 !read var.prep
 !goto end
!endif

!if $cmd=reply and $status!=waiting
 error=double_reply
 !goto end
!endif

!if $cmd=reply and $status=waiting
 !bound good between integer 0 and 10 default 10
 !if $good=0
  !if $goodf>$askcnt
   test=yes
   !advance goodcnt
  !else
   test=no
  !endif
 !else
  !ifval $good=$goodf
   test=yes
   !advance goodcnt
  !else
   test=no
  !endif
 !endif
 !advance replycnt 
 !if $replycnt>=$repeat
  !if $askcnt<$present
   weight=8
  !else
   weight=$askcnt
  !endif
  module_score=$[max(0,rint(100*($goodcnt/$replycnt-1/$weight)*$weight/($weight-1))/10)]
  wims_module_log=Score $module_score
  status=done
 !else
  status=next
 !endif
!endif

:end
!exec pariplot $datasrc
size=!item $type of 0.5,0.275
insplot_set=size $[$size*0.8],$size; parametric; noborder; nozeroaxis; noxtics; noytics;\
	lmargin 0;rmargin 0;tmargin 0;bmargin 0;\
	pointsize 0.6;\
	arrow from -$range,0 to $range,0 lt 4;\
	arrow from 0,-$range to 0,$range lt 4;\
	label "Re" at $[$range*0.81],$[$range*0.1];\
	label "Im" at $[$range*0.07],$[$range*0.9]
