|
!*****************************************************************************
! Sequence: RELI.SEQ
!
! Purpose: Macro to plot Relative illumination vs. Fileds
!
! Syntax: in RELI
!
!
! Notes: This macro uses and overwrites buffer B0.
!
! Author: Doffey Date: 2003-07-15
!
! History: 2003-07-15
!
!*****************************************************************************
lcl num ^numfld ^i ^j
lcl num ^fld(25) ^reli(25)
lcl str ^dim
lcl num ^maxfld
ver n
out n
^numfld == (num f)
!if (typ fld)="ANG"
! ^maxfld == (yan f^numfld)
!else if (typ fld)="OBJ"
^maxfld == (yob f^numfld)
!else if (typ fld)="IMG"
^maxfld == (yim f^numfld)
!else if (typ fld)="RIH"
! ^maxfld == (yri f^numfld)
!else
! ^maxfld == 0
!end if
!^f=='f'
!save
!del fa
!for ^i 1 20
!ins f^i+1
!^f==concat(^f,num_to_str(^i+1))
!in cv_macrcvsetfield Y ^i*^maxfld/20 $f
!^f=='f'
!end for
^numfld == (num f)
for ^i 1 ^numfld
if (typ fld)="ANG"
^fld(^i) == (yan f^i)
else if (typ fld)="OBJ"
^fld(^i) == (yob f^i)
else if (typ fld)="IMG"
^fld(^i) == (yim f^i)
else if (typ fld)="RIH"
^fld(^i) == (yri f^i)
else
^fld(^i) == 0
end if
end for
out n
BUF DEL B0 ! clear B0 buffer
BUF YES ! turn on output buffer to collect output
tra
go
BUF NO ! turn off output buffer
BUF FND "RELATIVE ILLUM:" ! find first occurrence
for ^i 1 ^numfld
for ^j 1 (num w)
buf mov ic jc+1
end for
if not ((buf.typ ic jc+1) = "NUM")
got ER
end if
^reli(^i) == (buf.num ic jc+1)/100 ! ic updated by each BUF FND
BUF FND ! find next occurrence
end for
out y
wri "Calculating the Relative Illumniation..."
wri
wri " Field Relative Illumination"
for ^i 1 ^numfld
wri Q" 'dd.ddd' 'dd.ddd'" ^fld(^i) ^reli(^i)
end for
out n
! plot the MTF vs Field curves using UGR
ugr
tit substr((tit),1,40)
if (dim)="I"
^dim == " (inches)"
else if (dim)="M"
^dim == " (mm)"
else if (dim)="C"
^dim == " (cm)"
else
^dim == ""
end if
if (typ fld)="ANG"
xla "FIELD ANGLE"
else if (typ fld)="OBJ"
xla concat("OBJECT HEIGHT",^dim)
else if (typ fld)="IMG"
xla concat("IMAGE HEIGHT",^dim)
else if (typ fld)="RIH"
xla concat("REAL IMAGE HEIGHT",^dim)
else
end if
yla "RELATIVE ILLUMINATION"
xax 0 ! x and y cross at zero
xde grd (^fld(^numfld))/10
yax 0
ymi 0 ! MTF range 0-1 by 0.1
yma 1.0
yde grd 0.1
yfo f 1 ! number formats for labels
xfo f 2
! create data point sets
dpo 'Relative Illumination'
spl 1 blu
for ^i 1 ^numfld
^fld(^i) ^reli(^i)
end for
end
go
GOT END
wri
lbl ER
out y
wri "ERROR: buffer error,Please check your lens!"
out n
lbl END
!res
ver y
OUT YES
[此贴子已经被作者于2004-5-22 7:44:46编辑过]
|