-
Notifications
You must be signed in to change notification settings - Fork 106
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
Add center option to drawImage command #1053
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.
Works great. LGTM.
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.
Very nice! Thanks, Mike!
galsim/gsobject.py
Outdated
@@ -1604,14 +1638,15 @@ def drawImage(self, image=None, nx=None, ny=None, bounds=None, scale=None, wcs=N | |||
# Figure out what wcs we are going to use. | |||
wcs = self._determine_wcs(scale, wcs, image) | |||
|
|||
# Make sure offset is a PositionD | |||
# Make sure offset and center are PositionD if entered as tuples. |
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 think these convenience functions also work if offset/center are entered as lists or a numpy array? Maybe this documentation could be something like "Make sure offset and center are PositionD, converting as necessary from other formats. If center
was passed in as None, it will remain that way after _parse_center
is run"?
Thanks both. Let's plan to release 2.2.0 on Friday. So if you have any systems you want to check to make sure we didn't break installation or anything, please check them this week. |
Sorry, I lied. One more PR for version 2.2. This one is quick though. It's a feature I've wanted to add for a while now, but I never bothered to make an issue for.
I added
center
as an optional parameter to thedrawImage
command. It's kind of just a convenience option, since it doesn't add any real capability that isn't already possible with theoffset
parameter. But getting a galaxy drawn at the right position withoffset
, especially when letting GalSim automatically size the image for you, is kind of a pain. An example was in demo9, and it was pretty confusing.Now a whole bunch of code in demo9.py has gone away, and the draw command changed to
This makes me happy. :) I didn't propagate this change to anywhere else, but it wouldn't surprise me if there were other places where some code could look significantly simpler using
center
rather thanoffset
.