FCAP BASIC Pogram Example

------------------------------*------------------------------

REM ** EXAM_15.PRO **

REM Sets SetQuadrant x,y to have 90% of events in LL

SetFileTypes ListModeFile, "FCLM", "TEXT", "SFWF"
SelectFile ListModeFile, "LM file (4 parameters)"
OpenLMFile "", "LM file (4 parameters)"
NewHgr 1, 2, "All[FS,SS]" of All
HgrName$="All[FS,SS]"
NewHgr 1, "All[FS]" of All
NewGate "All[FS,SS]", "G1", Red, ( 195,124; 217,19; 589,27; 597,108; 336,165; 195,124 )
NewGate "All[FS,SS]", "G2", Green, ( 301,200; 583,124; 619,100; 793,108; 869,404; 529,554; 252,407; 301,200 )
NewGate "All[FS]", "G1", Red, (225,437 )

GateOff "All[FS]", "G1"
Classify
qhor=10:qver=10
minpercent=90:incr=300
SetQuadrant "All[FS,SS]",qhor, qver
LLNo=QuadEventNum ("All[FS,SS]",3)
if QuadPercent ("All[FS,SS]",3)>minpercent then goto @goodis
gosub @quadopt
@goodis:
ShowHgr "All[FS]", 0.7, 5.3, 49.2, 49.2, LP
ShowHgr "All[FS,SS]", 50.5, 5.3, 49.2, 49.2, MD
gosub @quadstat
end

@quadstat:
print "Histogram: ";HgrName$
print "Quadrant intersection at:"
print "   x = ";qhor

print "   y = ";qver
for i=1 to 4
  if i=1 then QName$="Upper Left":goto @tedd
  if i=2 then QName$="Upper Right":goto @tedd
  if i=3 then QName$="Lower Left":goto @tedd
  QName$="Lower Right"
@tedd:
  Print:print QName$+" Quadrant Statistics of histogram "+ HgrName$
  print "(1) Number and Percent of Events:"
  print "  No. =";QuadEventNum ("All[FS,SS]",i);

  print ", ";QuadPercent ("All[FS,SS]",i);" %"
  print "(2) Mean +/- SD:"
  print "  Hor: ";QuadMean  ("All[FS,SS]",i,1);
  print " +/- ";QuadSD  ("All[FS,SS]",i,1)
  print "  Ver: ";QuadMean  ("All[FS,SS]",i,2);
  print " +/- ";QuadSD ("All[FS,SS]",i,2)
  print "(3) Geometric Mean:"
  print "  Hor: ";QuadGMean ("All[FS,SS]",i,1)
  print "  Ver: ";QuadGMean ("All[FS,SS]",i,2)
  print "(4) Harmonic Mean:"

  print "  Hor: ";QuadHMean ("All[FS,SS]",i,1)
  print "  Ver: ";QuadHMean ("All[FS,SS]",i,2)
  print "(5) Median:"
  print "  Hor: ";QuadMedian ("All[FS,SS]",i,1)
  print "  Ver: ";QuadMedian ("All[FS,SS]",i,2)
  print "(6) Mode:"
  print "  Hor: ";QuadMode ("All[FS,SS]",i,1)
  print "  Ver: ";QuadMode ("All[FS,SS]",i,2)
next i
return

@quadopt:
    rem Subroutine: Finds quadrant intersection to have 90% of
    rem events in the lower right quadrant region
@setopt:
SetQuadrant "All[FS,SS]",qhor, qver
LLNo=QuadEventNum ("All[FS,SS]",3)
if QuadPercent ("All[FS,SS]",3)>minpercent then goto @lowerincr
SetQuadrant "All[FS,SS]",qhor+incr, qver
LLNohor=QuadEventNum ("All[FS,SS]",3)
SetQuadrant "All[FS,SS]",qhor, qver+incr
LLNover=QuadEventNum ("All[FS,SS]",3)
hincr=0:vincr=0
if LLNohor+LLNover=0 then hincr=incr:vincr=incr:goto @case0
if LLNohor>LLNover then  hincr=incr else vincr=incr
@case0:
qhor=qhor+hincr:qver=qver+vincr
if qhor>1023 then qhor=1023
if qver>1023 then qver=1023
goto @setopt
@lowerincr:
incr=incr/5
rem incr=int(incr)
if incr<2 then return
qhor=qhor-hincr:qver=qver-vincr
if qhor<10 then qhor=10
if qver<10 then qver=10
goto @setopt




Click here to Download FCAP BASIC Examples

Click here to Copy FCAP BASIC Examples from this CD-ROM

[------------------------------*------------------------------]

[SF Home Image]Soft Flow home page | List of Examples | Library of FCAP BASIC Applications


Last update on Friday, September 27, 1996