Navigation: Scripting Reference Manual > Functions & Subroutines > ARNComputeWavefront

 

ARNComputeWavefront

 

Contact Us: fredsupport@photonengr.com

 

Description

Extracts the wavefront data from an ARN containing complex scalar field data.  The extracted wavefront data is extracted as an array of Doubles.

 

Syntax

ARNComputeWavefront( arn, wfData() )

 

Parameters

arn As Long

Node number of the complex scalar field ARN whose wavefront data is being extracted.

 

wfData() As Double

Passed in as an argument, this array contains the wavefront data (in units of waves) after the subroutine executes.

 

Example

The following example demonstrates how to call a raytrace, perform a scalar field analysis and store the resulting complex field in an ARN, extract the wavefront data from the ARN and then decompose the wavefront data into Zernike terms.  The decomposed Zernike coefficients are reported to the output window.

 

Sub Main

          

    'Document prep

    DeleteRays()

    ARNDeleteAllNodes()

 

    Dim src As Long, ana As Long, wfimager As Long

    src      = FindFullName( "Optical Sources.Plane Wave (coherent) 1" )

    ana      = FindFullName( "Analysis Surface(s).Wavefront Grid" )

    wfimager = FindFullName( "Geometry.Wavefront Imager" )

 

    'Perform raytrace and complex field analysis

    CreateSource( src )

    TraceExisting()

 

    'Wavefront analysis and decomposition

    Dim maxCoef As Long, curCoef As Long, sfArn As Long

    Dim coefs() As Double, xcen As Double, ycen As Double, zcen As Double

    Dim xsemi As Double, ysemi As Double, wfdata() As Double

    Dim tAna As T_ANALYSIS

    Dim isWaves As Boolean

    Dim zstring As String

    isWaves = True

    maxCoef = 15

    xsemi   = 3.1

    ysemi   = 3.1

    ScalarFieldToARN( ana, "Scalar Field", sfArn )

    ARNGetOriginPos( sfArn, xcen, ycen, zcen )

    ARNComputeWavefront( sfArn, wfdata() )

    LoadAnalysis( ana, tAna )

    DecomposeWavefrontToZernikes( -1, tAna, wfdata(), xcen, ycen, zcen, xsemi, ysemi, maxCoef, coefs() )

 

    'Reporting

    Print ""

    Print "Zernike decomposition result:"

    Print "" & Chr(9) & "Term" & Chr(9) & "Coef (" & If(isWaves,"waves",GetUnits()) & ")" & Chr(9) & "Form"

    For curCoef = 0 To UBound(coefs)

        Print Chr(9);

        Print curCoef;

        Print coefs(curCoef);

        Print GetZernikeSurfIthTermText( curCoef )

    Next

 

End Sub

 

See Also

All ARN Scripting Commands

 

 

 

 

 

Copyright © Photon Engineering, LLC