Jashcraf / poke

Poke (pronounced poh-keh) is a Polarization Ray Tracing and Gaussian Beamlet module for Python
BSD 3-Clause "New" or "Revised" License
33 stars 7 forks source link

Rayfront.opd analysis functions #51

Closed Jashcraf closed 11 months ago

Jashcraf commented 1 year ago

We are storing the optical path difference of the rays in both CODE V and Zemax but need a way to actually make the data meaningful. As of now it's a raveled array of data, but diffraction calculations are done on square grids!

So, we need

Hyukmo was interested in this utility so we can work with him on that.

Jashcraf commented 1 year ago

@hyukmo I do think priority #1 is coming up with some code to do zernike decomposition in poke

do you think you can write some code in python to generate a zernike polynomial given some index?

edit: taking a given x,y coordinate as inputs would be great too

hyukmo commented 1 year ago

@Jashcraf I can try, captain. But it would take some time....

Jashcraf commented 1 year ago

No worries just need the contribution before SPIE haha

we can either write our own, or make poke dependent on another package. If possible i think it'd be nice to do our own for low order polynomials (say Z1-36 or whatever). I can also help out with it and we can use this issue to workshop the code.

trentjbrendel commented 1 year ago

Jaren, how much do we need to generate code from scratch? Would it be okay if I prompted ChatGPT for some boilerplate code?

Jashcraf commented 1 year ago

le mao I have a preference against it so that contributors can use this as a learning experience, also I have no clue how to cite ChatGPT or it's products.

but zernike decomposition is just a problem of generating the polynomials, which wikipedia tells you how to do, and computing the dot product of them with your data.

Jashcraf commented 1 year ago

Turns out it might be better to use np.linalg.lstq to solve for the coefficient vector!

Jashcraf commented 1 year ago

Emory added the ability to do Zernike decomposition, so now we can do that with OPD data. Might be worth the assertion that OPD has consistent units in poke.raytrace.