-
Notifications
You must be signed in to change notification settings - Fork 7
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
U/danielsf/rmjarvis/cut gsco #67
Conversation
@@ -120,9 +142,32 @@ def galSimType(self, value): | |||
raise RuntimeError("You should not be setting galSimType on the fly; " \ | |||
+ "just instantiate a new GalSimCelestialObject") | |||
|
|||
@property | |||
def npoints(self): | |||
return self._float_values[15] |
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.
npoints is an int. Probably should either (a) leave that out of _float_values
and keep it as a regular attribute or (b) explicitly cast back to an int here in the getter.
Double precision should be fine to capture any int value we would use without weird rounding errors, so (b) is probably fine. But it might cause problems if it's allowed to turn into a float.
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.
It looks like Francois already casts it into an int
when it gets used
I'm not sure how zealous we want to be in cutting every possible bit of python overhead from our memory footprint. If you still think it would be safer to go back to storing self._npoints
as an int
, I can do that.
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.
It might be slightly paranoid of me, but if you want to be absolutely sure that we're safe, I'd make the getter here return int(self._float_values[15] + 0.5)
. Just to make sure some floating point imprecision doesn't convert an int into something like 3.3999999999987e1
and get messed up by the (implicit) floor in the conversion back to int.
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.
But again, I do think that we would be safe even without that. I'm just not 100% positive. But rounding will definitely be safe over the range of npoints values we'll ever be using.
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 have implemented your suggestion.
I will run this through Jenkins. If it passes (and no one objects) I will merge this at the end of the day. |
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
Great... confused by one thing though: are the differences in run time from other speed changes? Or is this really only the GSCO change? |
The only runtime variation that's apparent to me is the disk access part. The linear ramp for the |
OK that explains it. Thanks. |
And that is not an input catalog difference -- that's because of your reordering, right? I think you said it used to process a bunch of things that ended up getting cut out at the end, so were actually wasted. So that's a real speedup. |
This adds a unit test on top of @rmjarvis 's PR storing floats in a numpy array in
GalSimCelestialObject