Navigation: Scripting Reference Manual > Functions & Subroutines > ARNCreate2DSubsetByCellIndices

 

ARNCreate2DSubsetByCellIndices

 

Contact Us: fredsupport@photonengr.com

 

Description

This command creates a new 2D ARN from a subset of data in an existing 2D ARN by specifying axes index ranges.  Data in the originating grid with index positions along the A axis on the range aMin to aMax (inclusive) and along the B axis on the range bMin to bMax (inclusive) are included in the new data subset.

 

 

Syntax

subArn = ARNCreate2DSubsetByCellIndices( origArn, aMin, aMax, bMin, bmax, subArnName )

 

 

Parameters

subArn As Long

Returned index of the new ARN containing the data subset.

 

origArn As Long

Index of the ARN containing the original data set from which subArn is created.

 

aMin As Long

Designates the minimum index along the A axis of origArn for data which can be included in the subset.

 

aMax As Long

Designates the maximum index along the A axis of origArn for data which can be included in the subset.

 

bMin As Long

Designates the minimum index along the B axis of origArn for data which can be included in the subset.

 

bMax As Long

Designates the maximum index along the B axis of origArn for data which can be included in the subset.

 

subArnName As String

String name of the newly created ARN containing the data subset.

 

 

Example

The following example retrieves a 2D ARN created by a detector entity, calculates the ARN cell statistics to determine the A and B axis index ranges containing non-zero data, and then creates a new ARN containing the subset of non-zero data.

 

Sub Main

 

    'Prepare document

    ARNDeleteAllNodes()

    DeleteRays()

    ClearOutputWindow

 

    'Detector entity node

    Dim detSurf As Long

    detSurf = FindFullName( "Analysis Surface(s).Spherical Detector" )

 

    EnableTextPrinting False

    TraceCreate()

    EnableTextPrinting True

 

    'Detector entity auto-created ARN

    Dim mainArn As Long

    mainArn = DEGetMostRecentARNNum( detSurf )

 

    'Data statistics, find non-zero data window

    Dim tArnStats As T_ARN_2D_CELL_STATS

    Dim aMin As Long, aMax As Long, bMin As Long, bMax As Long

    ARNCompute2DCellStatistics( mainArn, tArnStats )

    aMin = tArnStats.MinNonZeroIdxA

    aMax = tArnStats.MaxNonZeroIdxA

    bMin = tArnStats.MinNonZeroIdxB

    bMax = tArnStats.MaxNonZeroIdxB

 

    'Create windowed ARN zoomed on non-zero data

    Dim subArn As Long

    subArn = ARNCreate2DSubsetByCellIndices( mainArn, aMin, aMax, bMin, bMax, _

        ARNGetName( mainArn ) & " - Windowed" )

 

    'Display

    ARNDisplayInChart( mainArn, "" )

    ARNDisplayInChart( subArn, "" )

 

    'Output Details

    Print "ARN ID" & Chr(9) & "A Dim" & Chr(9) & "B Dim"

    Print mainArn & Chr(9) & ARNGetAAxisDim( mainArn ) & Chr(9) & ARNGetBAxisDim( mainArn )

    Print subArn & Chr(9) & ARNGetAAxisDim( subArn ) & Chr(9) & ARNGetBAxisDim( subArn )

 

End Sub

 

See Also

ARN Script Commands

 

 

 

 

 

Copyright © Photon Engineering, LLC