This video is taken from the FDTD Learning Track on Ansys Innovation Courses.
Note: "Script Favorites" has been removed since 2019B.
Links
- Results Manager (information on usage of Result View window)
- Monitors (Optical) (Select a monitor type to find result definitions)
- Using the data visualizer and figure windows
- Datasets
- savedata (script command to export data)
- loaddata (script command to load data to script workspace)
Transcript
In the previous unit, we saw that it's possible to send monitor data to the script workspace
by right-clicking on the data in the Result View window and selecting the "Send to script"
option.
You can also use the script prompt or script files to define new variables in the script
workspace.
The variables that can be accessed from the scripting environment are all listed in the
Script Workspace window.
If this window is not already open, you can open it from the View then Windows menu in
the titlebar.
The script workspace lists the variable names with icons indicating the data type on the
left.
In the right column, if the data is a single number or string, the value of the data is
displayed, otherwise, for matrices, cells and structs the dimensions of the data are
displayed, and for datasets the attributes and parameters in the dataset are listed.
You can right-click to visualize the data, rename the variable or delete it.
Script workspace variables are not cleared when you load a different simulation file
so they will persist until they are manually deleted, or the instance of FDTD Solutions
is ended.
Script workspace variables do not get saved with the simulation file so if you want to
keep data from the script workspace you can export it.
For example, I will use the command Ex = E.Ex; to extract the x component of the E fields
from the E dataset, and I can export it to a Lumerical data file by using the command
savedata("filename",Ex);.
This generates a file which I can load again later by using the loaddata script command.
We'll see more about the different data export methods in the Data export methods
unit.
The Script Favorites window allows you to save a script command or a set of script commands
and run these commands from the graphical user interface.
This can be useful if you often use the same set of script commands to calculate a particular
result.
To add a set of script commands to the favorites list, right-click in the Script Favorites
window and select "New command".
Then type in the script commands that you want to save.
You can then run these commands by right-clicking on it and selecting "Run command".
For example, here I have saved a set of commands which will extract the electric field data
at a particular frequency point from the E variable in the script workspace and plot
the data.
I can send the E data from a monitor to the script workspace and run the command in the
Script Favorites window.
Then, I can do it again for the E data from a second monitor.