Go to www.awrcorp.com
Back to search page Click to download printable version of this guide.
Sampling Fields At a Point

Starting from an analyst.IField object you can use scripting to evaluate the field at a given location using the Sample function:

          sample = Field_1.Sample((-.02, 0.005, 0.0025))
          print(sample)
        

The function takes 1 argument:

  1. Point - Tuple of doubles indicating the location to sample at in meters.

The function returns a tuple of doubles formatted as:

         [Field at Point]
        

Where the content of [Field at Point] depends on the various factors including:

  1. Dimension of the field (FDD_SCALAR, FDD_VECTOR. This can be checked by calling IField::GetDataDimension(). The scalar case will return 1 value per point and the vector case will return 3 values per point.

  2. Data type of the field (FDT_FLOAT, FDT_FLOAT_COMPLEX, FDT_DOUBLE, FDT_DOUBLE_COMPLEX). This can be checked by calling IField::GetDataType(). The real cases will return 1 value per component and the complex cases will return 2 values per component.

Taking this into consideration, sampling a complex vector field will a tuple of 6 values (x.real, x.imag, y.real, y.imag, z.real, z.imag). Sampling a real vector field will return a tuple of 3 (x, y, z).

Please send email to awr.support@ni.com if you would like to provide feedback on this article. Please make sure to include the article link in the email.

Legal and Trademark Notice