-
Notifications
You must be signed in to change notification settings - Fork 107
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
Move some of our test utilities to galsim.utilities #1240
Conversation
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.
LGTM. Minor comments.
galsim/utilities.py
Outdated
|
||
|
||
# Context to make it easier to profile bits of the code | ||
class profile: |
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.
FWIW, I'd actually love to rename this one so it doesn't conflict with using @profile
via line_profiler.
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.
OK. Suggestions? Maybe just capitalize? with Profile():
That would fit in with most of our GalSim style for classes.
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.
I was also thinking of renaming a couple others. do_pickle
and all_objs_diff
aren't great names either, tbh. I was thinking check_pickle
and check_all_diff
for those.
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.
Yeah, these all sound better to me.
obj: The object to test | ||
func: A function of obj to use to test for equivalence. [default: lambda x: x] | ||
irreprable: Whether to skip the eval(repr(obj)) test. [default: False] | ||
random: Whether the obj has some intrinsic randomness. [default: False, unless |
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.
Looks like default is None
?
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.
Right. I was describing what that default means, which is False normally, but tries to notice randomness.
Some of the things that are in our galsim_test_helpers, I've used in other projects and just copied them over. It would be easier if these lived in galsim.utilities instead, so I could just use them directly. This PR puts the ones that I think are potentially useful for other project in our installed code base: