Hermite-Gauss functions in the analysis of weakly non-uniform semiconductor optical devices