How to select a mode through the script

Dear users,

I am trying to set a condition (if loop) on selecting the calculated modes in 2D FDE through a script as below:



if (“TE Polarization fraction”==100){

The if condition (“TE…”) is not valid and the program gives me error in that line.
I am wondering how I can save the effective index of the modes based on their TE polarization fraction.
I would be grateful if you could help me with this,
Many thanks

1 Like

Hi @zeinab.mohammadi,

The script you are using is a good way to flag the polarization of a mode, and you just need a little tweak in it. The way to get the ‘TE polarization fraction’ is the same as the way you are using to get the effective index, you just need to replace the statement in the if condition to the following statement

if (getdata("mode1", "TE polarization fraction") > 0.97) {...}

then the script will be running okay. Please note that the polarization fraction is a percentage number, so it is always less or equal to 1, and I recommend not to use the exact value unless you know that the first mode is pure TE. Also, all the property names are case sensitive.

I hope this could help :slight_smile: