A non-transitory computer readable storage medium for an adaptive optics system, which includes a spatial light modulator configured to spatially modulate a phase of an optical image incident on a modulation surface including N (N is a natural number) two-dimensionally arranged regions, a wavefront sensor including a lens array having N two-dimensionally arranged lenses corresponding to the N regions and an optical detection element for detecting a light intensity distribution including M (M is a natural number and M N) converging spots formed by the lens array and configured to receive the optical image after the modulation from the spatial light modulator, and a control unit configured to compensate for the wavefront distortion by controlling a phase pattern displayed in the spatial light modulator based on a wavefront shape of the optical image obtained from the light intensity distribution, wherein the program for the adaptive optics system causes the control unit to specify a correspondence relation between the region of the spatial light modulator and the converging spot formed in the wavefront sensor while the compensation for the wavefront distortion is executed, the program for the adaptive optics system causing the control unit to execute:
- a first detecting step of detecting the light intensity distribution through the optical detection element in a state in which a phase pattern for compensating for the wavefront distortion is displayed in a specific target region among the N regions of the spatial light modulator;
- a second detecting step of detecting the light intensity distribution through the optical detection element in a state in which a spatially non-linear phase pattern is displayed in the specific target region before or after the first detecting step;
- and
- a first specifying step of specifying a converging spot corresponding to the specific target region among the M converging spots based on a change in the light intensity distribution between the first detecting step and the second detecting step.