# emepropagate used in Analysis Script

#1

I have been trying to make the MODE calculations more automated and I wanted to use function emepropagate instead of clicking the button. The problem is that it works just fine when I type it in the script window, but when I tried to put it in the Analysis Script of the model, I get an error saying:

start running analysis script of ::model … …
in ::model: analysis script start>
Error: prompt line 3: emepropagate is not a valid function or variable name
in ::model: analysis script complete>

Is there a way to make it work right after the simulation?

#2

@mdudek The emepropagate command is not supposed to work in the Analysis Script. The reason is similar to that the Analysis Script does not take the run command. That said, I can definitely see this use case where users will want to compute the S-matrix is an automated way. I will file an feature request to the R&D team.

For now, I guess you could try to make use of the Script File Editor:

run;
emepropagate;
S=getresult("EME","user s-matrix");


#3

I do not know what kind of analysis group you would use, and what do you want to do, but in EME analysis group is rarely used. If you want to sweep or optimize, you can first get S parameter from EME in “model”, then you will be able to get swept S parameters and optimized one-valued S element.
here is my example:

here is my modified bragg grating file:
Bragg_EME-3.lms (357.6 KB)

S_model=getsweepresult(“sweep”,“S_model”);
SS=getsweepresult(“sweep”,“S”);
?S_model.S;

However, you cannot get the S parameter from S which is directly from “EME”, since its internal name is “user s matrix”, which has space in the vaiable name.

How can we plot wavelength vs. transmission curves in Lumerical mode solutions while using EME solvers?
EME中如何用Optimization来优化某个S参数？