This video is taken from the Scripting Learning Track on Ansys Innovation Courses.
Transcript
When a simulation has run, any simulation objects containing results will be displayed
with a red marker on the bottom-right corner.
To access the results from those objects, you need to use data-retrieving script commands,
specifying the object name and the result you want to collect from it.
As you can see in the result view, there are two types of data available in an object such
as the DFT monitor 'T' in this example: results and rawdata.
While results contains datasets formed by related data, rawdata contains individual
data elements in matrix form.
To access the matrices under rawdata, use 'getdata' with the names of the object and
the data as arguments.
Similarly, to access the datasets under results, use 'getresult' with the names of the object
and dataset as arguments.
When you have many related data elements to retrieve, it might be more convenient to get
a complete dataset with getresult, rather than getting individual data elements with
getdata.
For example, if you want to get the x, y positions as well as the Ex, Ey, Ez from this monitor,
you can use the getdata for each of them.
Alternatively, you can get the whole dataset E containing all the position and E-field
data using getresult and then get the data within the dataset using the dot (.) operator.
In comparison to the rawdata, datasets have the advantage that they can be opened in the
visualizer to generate plots with proper axes.
In addition to the getdata and getresult commands, there are some commands that are dedicated
to retrieving specific data from monitor.
Getelectric and getmagnetic respectively return the intensity of the electric and magnetic
fields from the monitor.
Transmission returns the fraction of power transmitted through the monitor with respect
to the source power.
It should be noted that the sign of the transmission depends on the direction of propagation.
The transmission is positive when the power is flowing through the monitor in the positive
direction, that is in the +x, +y, or +z direction.
So for a planewave propagating in backward (negative) direction, you will get a negative
transmission.
The commands for retrieving the data from parameter sweep, optimization, yield analysis,
and S-parameter sweep objects are different from getdata and getresult.
To get the data from these objects, use getsweepdata and getsweepresult for the dataset.
To get all the names of available raw data from an object, use a question mark before
getsweepdata with the object name as argument.
Then you can use getsweepdata with the object and data names to get the desired data - in
this case, the reflection and thickness data from the thickness_sweep object.
Similar to getresult, you might find it more convenient to get datasets using getweepresult
instead of getting individual data elements with getsweepdata.
To get the same data as above, you can get the dataset 'R' using getsweepresult and then
use the dot operator to select the reflection data and the thickness data.