As @kchow has mentioned, the spatial filter can be also defined based on its geometry.

When you press the ‘Calculate Modes’ button in the Eigensolver Analsys window, a set of monitors are automatically generated corresponding to the order of modes.

To calculate the integration of |E(x,y)|^2 over a triangular region, you need to take the following steps:

- Get the |E(x,y)|^2 data from the ‘modeXXX’ monitor (‘XXX’ corresponds to the mode order)
- Create a spatial filter, Filter(x,y), (‘1’ for the inside of the triangular region and ‘0’ for the outside)
- Multiply |E(x,y)|^2 and Filter(x,y), and then do the integration.

I have attached a simple simulation file containing a triangular waveguide **[ FDE_tri_sf.lms (235.4 KB) ]**

The definition of the triangle and the spatial filter are as follows:

After running the simulation, execute the script file **[FDE_tri_sf.lsf (669 Bytes) ]**

The script will generate two plots for the spatial filter and the |E|^2 filtered:

Finally, it will calculate the integration of |E|^2 over the triangular region.