Scripts for Analysis Groups


#1

Is there any script command to add a built-in analysis group, like “grating order transmission”? I would like to have something like addrect or addplane.

Thanks in advance


#2

You can add Object Library analysis groups from the script by using the addobject script command. Details on the command are here:
https://kb.lumerical.com/en/index.html?ref_scripts_addobject.html

Each object from the Object Library has a unique “script_ID”, and from the following image you can see that the script_ID for the Grating Order Transmission analysis group is “grating_transmission”:

So the following code will add a new Grating Order Transmission analysis group:
addobject("grating_transmission");


#3

@nlui, And, How to modified the variable under this analysis group. For example, I am calling s_params analysis group. And I want to modified starting, stop frequency and propagation direction of this analysis group.
I tried as

Add analysis group.

addobject(“s_params”);
set(‘start frequency’ 199.862);
set(‘stop frequency’ 199.862);
set(‘propagation direction’ -1);

But, error. ! :cry:
It allow me to set x span and y span and z span but does not allow me to change these parameters.
The main problem occurs when you want to modified nested variable.

@aalam , Hi may be you can reply.


#4

Hi @visvas. The reason you are getting error messages is because the format of your script command is wrong.

You are missing a comma after the name of the property. Also, the frequency value should be in standard unit (Hz) which is the case when defining values from script. So the command should be

set("start frequency", 199.862e12);


#5

Thank @aalam, It was silly mistake. Just one more thing, what is the command to edit global monitor properties ? I want to make my simulation only for one frequency.
I found this, but It doesn’t work for me.

setglobalsource(“wavelength start”,1.55e-6);
setglobalsource(“wavelength stop”,1.55e-6);

I think something is missing.


#6

Hi @visvas, The script commands you have shared should work to change the global source settings. However what is probably happening in your case is that the source itself might be overwriting the global settings. If that is the case then the simulation wavelength will be determined by the source settings and not by the global source settings.


#7

I think I understood,Because I am writing whole simulation using script only (specially for my learning purpose). I am using S parameter analysis group(s_param), which contains plane wave source, so that might be a region. I have also set the source wavelength (starting and end value) of s_param analysis group same as 1.55e-6, but it doesn’t not reset global source setting as same.