How to get mode info without knowing mode number

I use the selectmode(bestoverlap(“test_mode”)); command to select a mode that matches the test mode I’ve saved to the deck. I don’t know what mode I’ve selected, only that it matches the test mode. I next want to extract field information from that mode (Ex, Ey, Ez, etc.). How can I do this, since I don’t know the number of the mode? The selectmode(); command doesn’t return any information but the number of the mode I’ve selected must be stored somewhere, right?

Hi,
@pweigel

Actually, the bestoverlap command returns information about the mode as output (https://kb.lumerical.com/en/ref_scripts_bestoverlap.html).
If you first do bestoverlap with assigning its output to a variable, you can use it in selectmode, as well as where needed further.

1 Like

Hi @msaygin,

Thanks for the help, this does what I was trying to do.

Best,
Peter