Modeling and testing phase mask stitching error for writing fiber gratings