mperrin / poppy

Physical Optics Propagation in Python
BSD 3-Clause "New" or "Revised" License
175 stars 41 forks source link

Zernike Noll indexing different from what Anand expects? #112

Closed josePhoenix closed 9 years ago

josePhoenix commented 9 years ago

Anand says tip and tilt are swapped, and maybe entries on lower rows of the Zernike pyramid as well. Note to self to check this and see if I can reproduce.

josePhoenix commented 9 years ago

Can confirm that at least tip/tilt are swapped: zernike.noll_indices(2) returns (1, 1) when it should be (1, -1) for the first entry on the second row of the triangle. Everything else looks fine up to Z_15

mperrin commented 9 years ago

I am confused.

Both wikipedia (https://en.wikipedia.org/wiki/Zernike_polynomials#Noll.27s_sequential_indices) and the Online Encyclopedia of Integer Sequences (https://oeis.org/A176988) indicate a mapping of j=2 --> (n,m) = (1,1). I.e. those agree with what is currently coded in poppy.

What reference are you using for j=2 --> (1, -1) ?

mperrin commented 9 years ago

See also:

In [7]: poppy.zernike.noll_indices(2)
Out[7]: (1, 1)

In [8]: poppy.zernike.str_zernike(1,1)
Out[8]: '\\sqrt{4}* ( 1 r^1  ) * \\cos(1 \\theta)'

This agrees with the definition for $Z_2 = 2 r \cos \theta$ given in Table 1 of Noll 1976. See the following horrible URL:

https://www.osapublishing.org/view_article.cfm?gotourl=https%3A%2F%2Fwww%2Eosapublishing%2Eorg%2FDirectPDFAccess%2FCEE5519A%2DB678%2D4BF5%2D371C8DC6335E764C%5F56041%2Fjosa%2D66%2D3%2D207%2Epdf%3Fda%3D1%26id%3D56041%26seq%3D0%26mobile%3Dno&org=

josePhoenix commented 9 years ago

Ah, Wikipedia is not in agreement with itself. I was going off what Anand said and this figure: https://upload.wikimedia.org/wikipedia/commons/9/9f/ZernikePolynome6.svg

mperrin commented 9 years ago

Argh. Perhaps the appropriate bug fix here is replacing that figure on wikipedia?

Wait, ha, if you click through to the figure page, the caption has an erratum that the Noll indices for tip and tilt are interchanged. See https://en.wikipedia.org/wiki/Zernike_polynomials#/media/File:ZernikePolynome6.svg

Yeah that should just flat out be fixed on wikipedia. Do you want to edit the svg or shall I?

josePhoenix commented 9 years ago

I can do it. Took me a minute to find my login info.

josePhoenix commented 9 years ago

Ugh, uploading proves more complicated than anticipated.

josePhoenix commented 9 years ago

https://commons.wikimedia.org/wiki/Commons:FAQ#How_can_I_upload_a_new_version_of_a_file.3F

Guess I'll check back next week!

josePhoenix commented 9 years ago

Fixed the picture on Wikipedia (and the copy I pinned to my wall)