jacopoantonello / zernike

Python code for Zernike polynomials
Apache License 2.0
132 stars 36 forks source link

nm2noll addition #9

Closed Jufevic closed 3 years ago

Jufevic commented 3 years ago

Hello!

Thank you for sharing this code.

Goal

This pull request is just meant to improve code readability. In the rhotab creation part I introduced a function that converts a (n, m) indices pair into a Noll's index k. The explicit definition of such a function makes your code much shorter and clearer, in my opinion.

Following the convention in noll2nm, I made the indices start at 1, in order to keep the code consistent, so that noll2nm(nm2noll(k)) = k for any k >= 1

Old tests

The previous tests and this new test succesfully pass on the following configurations:

New tests

I added one test to assert correctness for this new function up to the 4th radial order. No need to test above the 4th radial order since the ordering only depends on n modulo 4.

Don't hesitate to ask if you have any issue.

jacopoantonello commented 3 years ago

Thank you. Great PR!