added grating test loop for aa