Navigation: Scripting Reference Manual > Functions & Subroutines > Intensity

 

Intensity

 

Contact Us: fredsupport@photonengr.com

 

This command has been deprecated, it is recommended to use IntensityToFileDAE instead.

 

Description

This function performs an intensity (power/steradian) calculation using rays which exist on a specific surface and stores the result of the calculation in an array variable.  The third argument of the command is a T_ANALYSIS structure, which defines a sampling grid (pixels, orientation and location) over which the intensity is computed but does not define any ray selection filter operations.  Depending on the number of rays traced, it may be necessary to dimension ray index and ray counter variables as data type Huge_ instead of Long.  Please see Multi-threaded Raytracing for more information.

 

Syntax

count = Intensity ( n, nCoordSys, ana, inten )

 

Parameters

count (Long or Huge_)

Returned number of rays that were included in the calculation.

 

n As Long

Node number of the surface to be used as the ray selection filter.  Only rays which exist on this surface at the time of the Intensity call will be included in the calculation.

 

nCoordSys As Long

Node number of the entity whose coordinate system the ana structure is expressed in.  If the ana structure was defined in global coordinates, the value of nCoordSys should be set to -1.

 

ana As T_ANALYSIS

Structure defining the direction space sampling grid over which the calculation is performed.  The interpretation of the parameters in this argument is slightly different than that for the other commands (such as Irradiance) because the Intensity command is concerned with directions rather than positions (as is the case for the other commands).  Due to the interpretation of the T_ANALYSIS parameters as direction cosine specifications, the LoadAnalysis function should not be used to populate the T_ANALYSIS structure when calling the Intensity function.

 

The unit cell vectors A and B of T_ANALYSIS define the plane on which the ray's direction vector will be projected.  The lengths of A and B define the sample spacing in direction cosine space.  Typically, 0 < length A <= 1, and similarly for length B.  The origin vector, O, specifies the 2 dimensional origin vector in direction cosine space (the Z component is ignored).

 

data() As Double

After the Intensity function has been called, this array contains the result of the calculation and has the same dimensionality as the number of pixels defined in the T_ANALYSIS structure.

 

Example

The example below demonstrates how to define a T_ANALYSIS structure manually for use with the Intensity function.

 

Sub Main

 

    'Document cleanup

    DeleteRays()

    ARNDeleteAllNodes()

    ClearOutputWindow()

 

    'We are interested in calculating the analysis for rays on this surface

    Dim nSurf As Long

    nSurf = FindFullName( "Geometry.Detector.Surface" )

 

    'Define the direction-cosine analysis grid

    '31x31 samples in a 14 degree full angle centered at 0,0 in direction cosine space

    Dim tAna As T_ANALYSIS

    Dim dX As Double, dY As Double

    dX = 7.0

    dY = 7.0

    tAna.Amin   = -15

    tAna.Amax   =  15

    tAna.Bmin   = -15

    tAna.Bmax   =  15

    tAna.AcellX = 2 * Sin(DegToRad(dX)) / (tAna.Amax - tAna.Amin + 1) 'pixel width in direction cosine space

    tAna.AcellY = 0.0

    tAna.AcellZ = 0.0

    tAna.BcellX = 0.0

    tAna.BcellY = 2 * Sin(DegToRad(dY)) / (tAna.Bmax - tAna.Bmin + 1) 'pixel width in direction cosine space

    tAna.BcellZ = 0.0

    tAna.posX   = 0.0

    tAna.posY   = 0.0

    tAna.posZ   = 0.0

 

    'Create and trace the active source

    EnableTextPrinting(False)

    TraceCreate()

    EnableTextPrinting(True)

 

    'Compute the analysis

    'Note that the second argument specifies the coordinate system of the

    'T_ANALYSIS structure.

    Dim data() As Double

    EnableTextPrinting(False)

    Intensity( nSurf, nSurf, tAna, data() )

    EnableTextPrinting(True)

 

    'Now that we have the array of data values, compute the statistics

    'of the result.

    Dim dMin As Double, dMax As Double, dAve As Double, dSd As Double

    Dim minLoc() As Long, maxLoc() As Long

    ArrayStats( data(), dMin, dMax, dAve, dSd, minLoc(), maxLoc() )

 

    'Print the result

    Print ""

    Print "Distribution statistics:"

    Print "Minimum value: " & Chr(9) & dMin

    Print "Maximum value: " & Chr(9) & dMax

    Print "Average value: " & Chr(9) & dAve

    Print "Standard deviation: " & Chr(9) & dSd

    Print "Pixel coordinates of minimum value: " & Chr(9) & minLoc(0) & Chr(9) & minLoc(1)

    Print "Pixel coordinates of maximum value: " & Chr(9) & maxLoc(0) & Chr(9) & maxLoc(1)

    Print ""

 

End Sub

 

See Also

IntensityAtSpecifiedDirections

IntensityToFileDAE

IntensityToARN

Irradiance

IrradianceToFile

IrradianceToFileAS

EnergyDensity

ScalarField

ScalarFieldToFile

ScalarFieldToFileAS

VectorField

VectorFieldToFile

VectorFieldToFileAS

ColorImage

ColorImageToFile

ColorImageToFileAS

LoadAnalysis

SetAnalysisParameters

T_ANALYSIS

CoherentRaySize

DisplayPlotFile

 

 

 

 

 

 

Copyright © Photon Engineering, LLC