david-hoffman / pyotf

python functions for simulating optical transfer functions
Apache License 2.0
71 stars 14 forks source link

Problems regarding properly fitting Zernike Polynomials #32

Closed weiwei-wu123 closed 1 year ago

weiwei-wu123 commented 1 year ago

Hi @david-hoffman ! Thank you for providing and maintaining this package! I ran into some problems when putting a picture of Gaussian beam mode in tiff format into the algorithm and adjusted the "params" to my experimental setting. However, I am not getting a reasonable pupil magnitude image(also I don't know why there are two different magnitude graphs), which I assumed is the output from the objective.

My understanding of the parameters is:

wl represents the laser wavelength; na represents the numeral aperture of the objective ni is the refraction index of the medium. In my case it's air.

However, is res the dimension of the output pupil diagram? Does it have anything to do with the input? Also, I am not too sure about what is "zres" since the picture is 2D. What is resolution in z-direction? After I input a real detector picture, the pupil magnitude is pure yellow, and the pupil phase is pure grey. I do not understand the reason for this.

Would you please instruct me on how to properly prep the data? Also, besides these parameters, if so, what else in the script should I make modifications in order to properly fit Zernike Polynomials?

Thank you!

david-hoffman commented 1 year ago

I assume you're using the retrieve_phase function. That function assumes the image data is of a sub diffractive fluorescent point source. Basically, you have to give the function an accurate representation of the system's point spread function for it to work (and meet the requirements of the theory on which it's based).

On Mon, Oct 23, 2023 at 00:33 weiwei-wu123 @.***> wrote:

Hi! I put in a picture of Gaussian beam mode in tiff format into the algorithm, but the output pupil magnitude is not right. In order to make the input correct, should I do anything to the following lines? prep data

data = tif.imread("gaussian beam.tiff") data_prepped = prep_data_for_PR(data, None, 1) set up model params

params = dict(wl=520, na=0.85, ni=1.0, res=130, zres=300)`

The link here is the outputs I have: https://drive.google.com/file/d/135HkFn3NzNlqw-oZkzhscqEh0Lm7KnQo/view?usp=sharing http://url

Using some of my real experimental pictures, I cannot get anything. The output pupil magnitude is just a white circle, and no Zernike polynomials is fitted-the- the graph is empty.

Would you please instruct me on how to properly prep the data?

Thank you!

— Reply to this email directly, view it on GitHub https://github.com/david-hoffman/pyotf/issues/32, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4HKD47XK42IA4CYB5SMJDYAYMT5AVCNFSM6AAAAAA6LTONKWVHI2DSMVQWIX3LMV43ASLTON2WKOZRHE2TMNJTGYZTEOI . You are receiving this because you are subscribed to this thread.Message ID: @.***>