-
Notifications
You must be signed in to change notification settings - Fork 8
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
refactor: new parametrized unpack decorator requires function signature with kwargs #136
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## dev #136 +/- ##
==========================================
+ Coverage 89.34% 89.37% +0.03%
==========================================
Files 36 36
Lines 1942 1939 -3
==========================================
- Hits 1735 1733 -2
+ Misses 207 206 -1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments are about passing kwargs forward in method so that called method also have access to them
I think this is a very good PR. As discussed, all that is needed now is to implement the change in every method, make sure kwargs are passed forward. For documentation purposes, it would be nice if you could highlight some examples where this change impacts the API. In particular, how a user who wants to call directly a method without using the packed argument would interact with this feature and how it plays with dynamic/static parameters. Would make a neat jupyter notebook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to expand the scope of the tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comments are centered around the usage of the pack method, which should be considered more as a private method than a public method in caustics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great!
The
unpack
decorator now requires function signatures to be of the form:This allows for some notable benefits:
@unapck
is all that's needed as the decorator, no longer@unpack(<number>)
KeyError: "Missing parameter 'x0' in method 'jacobian_lens_equation' of module 'sie'"
unpack
decorator is much simplerThe only case we lose is parameters passed as args like this:
It would instead need to be:
and it would work.
Cases where everything is packed would still work, even passed as an arg, so long as it's the last arg:
That is just like before.