In my simulations I would like to calculate return loss (RL) and insertion losss (IL) of a multimode fiber system. I am using EME Solver to obtain s-matrix and then to calculate the desired parameters according to this article.

The issue here is that it works just fine for singlemode simulations and not for multimode ones.

I tried to use 20 modes and get 40x40 *user s-matrix*. From what I understand, each element corresponds to a specific combination of mode from port 1 and/or mode from port 2 - so if I am not wrong it is similar to having 20 input and 20 output ports.

Knowing this how can I calculate the overall RL and IL? I can calculate those losses for each separate mode, but I do not know how to combine it into one value for the whole multimode system.