grating generation for fastsim microscope