DataSetIndexer

When iterating over a data set, the DataSetIndexer provides a means to access the currently indexed point and to retrieve information about its position in the data set. For instance, it is possible to determine where in space a point is located and at what frequency. By using the indexed point, the index, name, unit and value of the associated axes can be determined.

Example

app = pf.GetApplication()
app:NewProject()
app:OpenFile(FEKO_HOME..[[/shared/Resources/Automation/startup.fek]])

    -- Create a new DataSet.
    
myDataSet = pf.DataSet.New()

    -- Build the axes and quantities:
    --    Frequency axis spanning from 1GHz to 2GHz with 11 values
    --    Add a X axis spanning from -1m to 1m with 11 values
    --    Add a Y axis spanning from -1m to 1m with 11 values
    --    Add a Z axis spanning from -1m to 1m with 11 values
    
myDataSet.Axes:Add( pf.Enums.DataSetAxisEnum.Frequency, "GHz", 1, 2, 11)
myDataSet.Axes:Add( pf.Enums.DataSetAxisEnum.X,"m", -1, 1, 11)
myDataSet.Axes:Add( pf.Enums.DataSetAxisEnum.Y,"m", -1, 1, 11)
myDataSet.Axes:Add( pf.Enums.DataSetAxisEnum.Z,"m", -1, 1, 11)              

--    Add a "Threshold" scalar quantity with no unit

myDataSet.Quantities:Add( "Threshold", pf.Enums.DataSetQuantityTypeEnum.Scalar, "")

    -- Iterator function that will be used by the ForAllValues function. It
    -- calculates the absolute distance from the origin and divides by the 
    -- square of the frequency (in GHz).  Similar calculations are common
    -- in radiation hazard applications.
    
function distanceOverFrequency(index, myDS)
    local fVal = myDS[index]:AxisValue(pf.Enums.DataSetAxisEnum.Frequency)
    local xVal = myDS[index]:AxisValue(pf.Enums.DataSetAxisEnum.X)
    local yVal = myDS[index]:AxisValue(pf.Enums.DataSetAxisEnum.Y)
    local zVal = myDS[index]:AxisValue(pf.Enums.DataSetAxisEnum.Z)
    
    myDS[index].Threshold = math.sqrt(xVal^2 + yVal^2 + zVal^2)/fVal^2
end
pf.DataSet.ForAllValues(distanceOverFrequency, myDataSet)

    -- Store the custom data set and plot it on a 3D view

storedCustomData = myDataSet:StoreData(pf.Enums.StoredDataTypeEnum.Custom)
app.Views[1].Plots:Add(storedCustomData)
app.Views[1]:ZoomToExtents()

Property List

Type
The object type string. (Read only string)

Method List

AxisIndex (index number)
The index specifies an axis in the axes collection and returns the current position on this axis as an index. (Returns a number object.)
AxisIndex (name string)
The name specifies an axis in the axes collection and returns the current position on this axis as an index. (Returns a number object.)
AxisName (index number)
The index specifies an axis in the axes collection and returns its name. (Returns a string object.)
AxisUnit (index number)
The index specifies an axis in the axes collection and returns its unit. (Returns a Unit object.)
AxisUnit (name string)
The name specifies an axis in the axes collection and returns its unit. (Returns a Unit object.)
AxisValue (index number)
The index specifies an axis in the axes collection and returns the value at the current position of this axis. (Returns a Variant object.)
AxisValue (name string)
The name specifies an axis in the axes collection and returns the value at the current position of this axis. (Returns a Variant object.)
FromComplexMatrix (matrix ComplexMatrix, quantityNames List of string)
Fills the data set from a matrix.
FromMatrix (matrix Matrix, quantityNames List of string)
Fills the data set from a matrix.
ToComplexMatrix (quantityNames List of string)
Extracts data from the data set. (Returns a ComplexMatrix object.)
ToMatrix (quantityNames List of string)
Extracts data from the data set. (Returns a Matrix object.)

Index List

[number]
Index into the next axis. (Read DataSetIndexer)
[string]
Set or get a quantity value. (Read Variant)
[string]
Set or get a quantity value. (Write Variant)

Property Details

Type
The object type string.
Type
string
Access
Read only

Method Details

AxisIndex (index number)
The index specifies an axis in the axes collection and returns the current position on this axis as an index.
Input Parameters
index(number)
The index specifies an axis in the axis collection.
Return
number
The current position as index of the axis at the specified index.
AxisIndex (name string)
The name specifies an axis in the axes collection and returns the current position on this axis as an index.
Input Parameters
name(string)
The name specifies an axis in the axis collection.
Return
number
The current position as index of the axis at the specified name.
AxisName (index number)
The index specifies an axis in the axes collection and returns its name.
Input Parameters
index(number)
The index specifies an axis in the axis collection.
Return
string
The name of the axis at the specified index.
AxisUnit (index number)
The index specifies an axis in the axes collection and returns its unit.
Input Parameters
index(number)
The index specifies an axis in the axis collection.
Return
Unit
The unit of the axis at the specified index.
AxisUnit (name string)
The name specifies an axis in the axes collection and returns its unit.
Input Parameters
name(string)
The name specifies an axis in the axis collection.
Return
Unit
The unit of the axis at the specified name.
AxisValue (index number)
The index specifies an axis in the axes collection and returns the value at the current position of this axis.
Input Parameters
index(number)
The index specifies an axis in the axis collection.
Return
Variant
The value of the axis at the specified index.
AxisValue (name string)
The name specifies an axis in the axes collection and returns the value at the current position of this axis.
Input Parameters
name(string)
The name specifies an axis in the axis collection.
Return
Variant
The value of the axis at the specified name.
FromComplexMatrix (matrix ComplexMatrix, quantityNames List of string)
Fills the data set from a matrix.
Input Parameters
matrix(ComplexMatrix)
Matrix to fill the dataset with.
quantityNames(List of string)
List of quantities the matrix represents.
FromMatrix (matrix Matrix, quantityNames List of string)
Fills the data set from a matrix.
Input Parameters
matrix(Matrix)
Matrix to fill the dataset with.
quantityNames(List of string)
List of quantities the matrix represents.
ToComplexMatrix (quantityNames List of string)
Extracts data from the data set.
Input Parameters
quantityNames(List of string)
List of quantities to extract.
Return
ComplexMatrix
A matrix with a quantity in each column.
ToMatrix (quantityNames List of string)
Extracts data from the data set.
Input Parameters
quantityNames(List of string)
List of quantities to extract.
Return
Matrix
A matrix with a quantity in each column.