Description Sets the simple diffraction efficiency table for a surface node with a grating property defined. Gratings have a primary and secondary efficiency specification that allows an accounting of which side of the grating a ray is incident from. This script command modifies the primary efficiency specification. For more information, refer to the gratings help topic.
Syntax SetDiffractEfficiencyTable n, efficiencies
Parameters n As Long Node number of the diffraction grating surface.
efficiencies() As Double A 2D array containing the efficiency data as well as the wavelengths and orders to which the efficiencies correspond. For an array of size (M,N), index M corresponds to a specific diffraction order and index N corresponds to a specific wavelength. The array value at index (0,0) is a dummy value. The array data in (1..M, 0) specify the diffraction order values. The array data in (0,1..N) specify the wavelength values. The remaining array values specify the efficiency for the wavelength and order combination
Example The following example sets the simple efficiency table for a grating surface using orders -2, -1, 0, 1, 2 and wavelengths 0.5, 0.6 and 0.7 microns.
Sub Main
'Node of the grating surface Dim gratingSurf As Long gratingSurf = FindFullName( "Geometry.Elem 1.Surf 1" )
'Populate the grating efficiency table 'The efficiency table will have three wavelengths: 0.5, 0.6 and 0.7 microns 'The efficiency table will have 5 orders: -2, -1, 0, 1, 2 'In the efficiency array, the (1...M,0) values define the 'diffraction orders. The (0,1...N) values define the corresponding 'wavelengths. The (0,0) value is a dummy and is not used.
Dim efficiencies(5,3) As Double 'Diffraction order header data efficiencies(1,0) = -2 efficiencies(2,0) = -1 efficiencies(3,0) = 0 efficiencies(4,0) = 1 efficiencies(5,0) = 2 'Wavelength header data efficiencies(0,1) = 0.5 efficiencies(0,2) = 0.6 efficiencies(0,3) = 0.7 'Efficiency data efficiencies(1,1) = 0.01 'Order -2, wavelength 0.5 efficiencies(2,1) = 0.02 'Order -1, wavelength 0.5 efficiencies(3,1) = 0.03 'Order 0, wavelength 0.5 efficiencies(4,1) = 0.04 'Order 1, wavelength 0.5 efficiencies(5,1) = 0.05 'Order 2, wavelength 0.5 efficiencies(1,2) = 0.06 'Order -2, wavelength 0.6 efficiencies(2,2) = 0.07 'Order -1, wavelength 0.6 efficiencies(3,2) = 0.08 'Order 0, wavelength 0.6 efficiencies(4,2) = 0.09 'Order 1, wavelength 0.6 efficiencies(5,2) = 0.10 'Order 2, wavelength 0.6 efficiencies(1,3) = 0.11 'Order -2, wavelength 0.7 efficiencies(2,3) = 0.12 'Order -1, wavelength 0.7 efficiencies(3,3) = 0.13 'Order 0, wavelength 0.7 efficiencies(4,3) = 0.14 'Order 1, wavelength 0.7 efficiencies(5,3) = 0.15 'Order 2, wavelength 0.7
'Assign the efficiency table SetDiffractEfficiencyTable( gratingSurf, efficiencies() )
'Update the document Update
End Sub
See Also Diffraction Grating Script Commands
|