Correction of non-common path aberrations in pyramid wavefront sensors to recover the optimal magnitude gain using a deformable lens