This page describes how to generate and run a sweep using script commands. The same example used in the section "Parameter Sweeps" will be re-generated in this page. Using script commands to generate a sweep analysis is a convenient way when users already have the parameters at their hands. For additional information and detailed implementation of the script commands, please see the "Measurement and optimization data" section. Please note that, all the script commands used in this example could also be applied to optimization and yield analysis.
To generate and run the sweep using script commands, user can open the sweep_AR_coating_example_script.fsp file and follow the three steps listed below; or, open and run the script file sweep_AR_coating_example_script.lsf .
Creating the parameter sweep project
The following commands are used to generate and superficially define a new sweep named "thickness_sweep_script".
# add a new sweep and set basic properties
setsweep("sweep", "name", "thickness_sweep_script");
setsweep("thickness_sweep_script", "type", "Ranges");
setsweep("thickness_sweep_script", "number of points", 10);
When the sweep is superficially generated, the parameters can then be defined and added to it. The following commands define the name, type, range and the path of the parameter "thickness".
# define the parameter thickness
para = struct;
para.Name = "thickness";
para.Parameter = "::model::AR structure::thickness";
para.Type = "Length";
para.Start = 0.05e-6;
para.Stop = 0.15e-6;
para.Units = "microns";
This command adds the parameter "thickness" to the sweep "thickness_sweep_script". When the parameter is successfully added, the sweep will appear in the "Optimizations and Sweeps" tab as shown below.
# add the parameter thickness to the sweep
The next step is to add the results that we want to measure into the sweep. The commands listed below define and add the results "R" and "T" to the sweep as shown in the sweep editing window below. After this step, the sweep is well defined and ready to run.
# define results
result_1 = struct;
result_1.Name = "R";
result_1.Result = "::model::R::T";
result_2 = struct;
result_2.Name = "T";
result_2.Result = "::model::T::T";
# add the results R & T to the sweep
Running the parameter sweep
A well defined sweep can also be run by using script commands. The following command runs the sweep "thickness_sweep" and loads the results to it. After running, the results will be loaded back to the sweep and the sweep will be indicated by the red logo as shown below.
# run the sweep
Viewing the results
The sweep results could also be visualized by using script commands. The commands below stores the sweep results "R" and "T" to two same named datasets "R" and "T" and plots them.
# save & view the results
R = getsweepresult("thickness_sweep_script", "R");
T = getsweepresult("thickness_sweep_script", "T");
plot(R.thickness*1e9, R.T, "AR thickness (nm)","R");
# T is in the opposite direction of R
plot(T.thickness*1e9, abs(T.T), "AR thickness (nm)","T");
The following figures are the plots of the results R and T v.s. thickness, which show same results as in the section Parameter sweeps.