Modelling optical fibres with arbitrary refractive-index profiles