ehpor / hcipy

A framework for performing optical propagation simulations, meant for high contrast imaging, in Python.
https://hcipy.org
MIT License
93 stars 31 forks source link

probable issue with Shack hartmann wavefront sensor? #242

Closed AyanS13 closed 1 week ago

AyanS13 commented 1 week ago

https://github.com/ehpor/hcipy/blob/29118823140494935c688fc58104b0b6437e143f/hcipy/wavefront_sensing/shack_hartmann.py#L20

I have a few queries regarding this part of the code.

1) The array x is defined as (pupil_diameter, pupil_diameter) with a step size of lenslet_diameter. But shouldn't it be (-radius, radius) as the centre is at 0?

2) In the self.mla_grid command, do the grid points represent the corners of the lenslets or the centres ?

Thanks a lot!!

ehpor commented 1 week ago

Hi Ayan. Thanks for the questions.

  1. Indeed this is a very clunky way to set this up. The purpose of doing pupil_diameter instead of pupil_diameter/2 is to avoid edge effects. Having the MLA extend beyond the pupil edge helps avoiding diffraction effects. In practice, the MLA is larger than the pupil. Why not just one extra microlens? No clue: doubling the number of microlenses is a quick and easy choice. A bigger problem imo is that the resulting MLA is not symmetric, as they usually are in actual AO systems. The mla_grid should probably be a make_uniform_grid() call with appropriate extent and shape.
  2. The grid points represent the center of each microlenses.
AyanS13 commented 1 week ago

Thanks a lot!! I was finally able to make it work.