Description This function retrieves the interpolated power and phase efficiency values for the SS, PP, SP and PS components from a grating surface with the Full diffraction efficiency table specification. Incident polar angle, azimuth angle, wavelength, and diffraction order are provided as inputs to the function.
Syntax success = GetInterpolatedDiffractEfficiency( gNode, isPrimary, wavl, order, isReflect, xpos, ypos, zpos, azi, pol, pwrSS, pwrPP, pwrSP, pwrPS, phsSS, phsPP, phsSP, phsPS )
Parameters success (Boolean) Return value indicating whether the function execution was successful (True) or not (False).
gNode As Long Node number of the grating surface being queried. The grating surface should use the Full diffraction efficiency table specification.
isPrimary As Boolean If True, the Primary diffraction efficiency specification will be queried. Unless the user has specifically setup a Secondary efficiency specification, isPrimary should be set to True. Refer to the Grating Help topic for more information.
wavl As Double Wavelength in microns at which the efficiency values should be interpolated.
order As Long Diffraction order at which the efficiency values should be interpolated.
isReflect As Boolean Specifies whether the diffraction order is in reflection (True) or transmission (False).
xpos As Double Set value to zero. Reserved for future use.
ypos As Double Set value to zero. Reserved for future use.
zpos As Double Set value to zero. Reserved for future use.
azi As Double Azimuth angle in degrees at which the diffraction efficiency should be interpolated.
pol As Double Polar angle in degrees at which the diffraction efficiency should be interpolated.
pwrSS As Double After the function executes, this variable contains the interpolated power efficiency value for the SS component.
pwrPP As Double After the function executes, this variable contains the interpolated power efficiency value for the PP component.
pwrSP As Double After the function executes, this variable contains the interpolated power efficiency value for the SP component.
pwrPS As Double After the function executes, this variable contains the interpolated power efficiency value for the PS component.
phsSS As Double After the function executes, this variable contains the interpolated phase efficiency value for the SS component.
phsPP As Double After the function executes, this variable contains the interpolated phase efficiency value for the PP component.
phsSP As Double After the function executes, this variable contains the interpolated phase efficiency value for the SP component.
phsPS As Double After the function executes, this variable contains the interpolated phase efficiency value for the PS component.
Example The following example demonstrates how to use the GetInterpolatedDiffractEfficiency function to loop over a range of polar and azimuth angles, retrieve the power and phase efficiencies for the 1st order in reflection, and write the efficiency values back out to a file in FRED's full diffraction efficiency file format.
Sub Main
Dim gNode As Long gNode = FindFullName( "Geometry.Grating Test.Surface" )
'Open file for writing Dim fOut As String fOut = GetDocDir() & "\FREDInterpolatedEfficiency.txt" Open fOut For Output As #1
'Write header to output file Print #1, "1R,1r,lambda,theta,phi,type"
Dim wl As Double wl = 0.5
Dim curAzi As Double, curPol As Double Dim eSS As Double, pSS As Double Dim ePP As Double, pPP As Double Dim eSP As Double, pSP As Double Dim ePS As Double, pPS As Double For curPol = 0 To 90 Step 0.25 For curAzi = -180 To 180 Step 0.25
'Evaluate the grating at the polar and azimuth angles 'Grating operates in the +1 order in reflection GetInterpolatedDiffractEfficiency( gNode, True, wl, 1, True, 0, 0, 0, curAzi, curPol, eSS, ePP, eSP, ePS, pSS, pPP, pSP, pPS ) Print #1, CStr(eSS) & "," & CStr(pSS) & "," & CStr(wl) & "," & CStr(curPol) & "," & CStr(curAzi) & ",SS" Print #1, CStr(ePP) & "," & CStr(pPP) & "," & CStr(wl) & "," & CStr(curPol) & "," & CStr(curAzi) & ",PP" Print #1, CStr(ePS) & "," & CStr(pPS) & "," & CStr(wl) & "," & CStr(curPol) & "," & CStr(curAzi) & ",PS" Print #1, CStr(eSP) & "," & CStr(pSP) & "," & CStr(wl) & "," & CStr(curPol) & "," & CStr(curAzi) & ",SP"
Next Next
Close #1 print "Finished writing interpolated file."
End Sub
See Also Full diffraction efficiency table Diffraction Grating Script Commands
|