-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove some arguments in make_focal_grid() #36
Comments
While I think you're right that removing these would make the function cleaner, I believe having the option of either providing the In any case, this is a design choice that needs to be made, trading off between cleanliness from a software side, and intuition and physical versatility on the science side. I am curious to see which way @ehpor is leaning towards. |
Actually I could be persuaded both ways. Supporting the multiple calling conventions via overloaded functions (a la C++) would be by far the best solution. Python doesn't really support this though. Emulation of overloaded functions is of course possible, but is not really Pythonic, so I didn't choose that route. I went for the current function signature for the reason @ivalaginja mentioned: it allows you to use both calling conventions, making it easier for new people to use HCIPy. Also, when calling the function with keyword-style parameters, ie. The reasons outlined by @spbos for changing the signature are not really the reasons for which a change could be warranted. The simplification of library-internal code should never be the driver for changing the interface - the cleanliness of the interface is what matters. Removing the additional arguments would simplify the interface and documentation of this function, making it easier to understand at first glance. It would however force a user to know how to calculate spatial resolution, which is I think a prerequisite for using HCIPy in the first place, so that shouldn't be a valid reason. Also the documentation can help by listing the various ways of calculating the spatial resolution. An additional consideration for a third option: when the user has an F-number and a wavelength, they need to calculate the spatial resolution manually anyway, ie. |
I am noticing after the update to the new interface that I rather use the spatial_resolution than the other three parameters. It is a little bit cumbersome to constantly add the full three keywords as opposed to a single spatial_resolution. And as @ehpor mentioned why is there support for one way of calculating and not for the other. |
Fair point. This might really indicate that holding on to |
Okay, I think it's conclusion time. I'll add a third option of calling the function: |
Hi all,
Currently, when generating a grid with the make_focal_grid() function, the user can set the spatial resolution by either using the 'spatial_resolution' argument or the 'pupil_diameter' + 'focal_length' + 'reference_wavelength' arguments. The latter three arguments only save the user one line of code, namely 'spatial_resolution = lambda * f / D'. While adding 9 lines of code to the function, making it harder to read and understand.
Therefore, the suggestion is to remove the arguments 'pupil_diameter', 'focal_length' and 'reference_wavelength'. To make sure that the user knows what is expected, it should be clear in the documentation how to calculate the spatial resolution (which is already the case).
What do you think?
The text was updated successfully, but these errors were encountered: