Repository navigation
Conversation
134baf9 to
dfbf6fe
Compare
There was a problem hiding this comment.
@larrybradley - Are these changes ok with you? I've just flipped the ordering to ((ymin, ymax), (xmin, xmax)) to be consistent with #3909. Let me know if you have any concerns.
There was a problem hiding this comment.
@patti Yes, fine with me. I thought I had made them consistent based on #3823 (comment), but perhaps your PR changed later. Thanks.
There was a problem hiding this comment.
@larrybradley - You're right, that was my mistake in the comment or maybe that was before we switched to the Numpy indexing convention. Thanks!
There was a problem hiding this comment.
I also thought, that @larrybradley had already changed this, do you know what happended in between?
There was a problem hiding this comment.
@adonath - Without digging too deep, I assume from #3823 (comment) @larrybradley's change was just made before it was decided to go with the Numpy indexing order (z, y, x) rather than (x, y, z) in #3909. So the formatting in Cutout2D was consistent as ((xmin, xmax), (ymin, ymax)), but then we changed the ordering to ((ymin, ymax), (xmin, xmax)).
|
It unrelated to the changes in this PR, but I just noticed, that https://github.com/astropy/astropy/pull/4040/files#diff-78d4f451e670d4d6fee33e0c0053a673L32 doesn't render properly to a link. |
|
Again not related, but could fix the pep8 formatting here? https://github.com/astropy/astropy/pull/4040/files#diff-78d4f451e670d4d6fee33e0c0053a673R39 |
|
@adonath I'd go even further and ask what is the purpose of adding a |
|
@adonath - regarding the |
|
The link doesn't work on readthedocs: |
|
@nden I see what you mean. The reason to add a |
|
@adonath OK. This just looks too limited to me and not something that belongs in I wonder if Perhaps @perrygreenfield @embray @mdboom have some thoughts on this. |
|
I agree with @nden that the The code for it still looks useful though and is worth saving. Maybe instead it could be a method or property on the |
|
@embray @nden (also @adonath and @cdeil) I made several changes today but haven't yet updated all docs and tests so I'm not worried about the builds failing at this point. I removed the @embray - I think all of your comments on #3909 have now been addressed in this PR, except for reworking The |
There was a problem hiding this comment.
I think @embray (#3909 (comment)) suggested a different solution. You can define bounding_box_default in the Model class, but it should just raise an NotImplementedError. Specific models, that inherit from Modelthen override this method.
There was a problem hiding this comment.
Yes, much simpler and easier to reason about.
|
@adonath, @embray - ignore this for now, I might be coming around on some points as I work through tests but I'm about to get on a plane so I'll get back to you later. I think we want to set Secondary to that, I want to raise the At the end of the day, I'll do whatever you think is best, but just wanted to make my case. |
|
I would just set the default value @classmethod
def bounding_box_default(cls):
raise NotImplementedError('blah blah blah')
@property
def bounding_box(self):
not_implemented = False
if self._bounding_box is None:
not_implemented = True
elif self._bounding_box == 'auto':
try:
# In retrospect, this should be recomputed every time since the bb *may*
# change if any of the parameters are updated
return self.bounding_box_default()
except NotImplementedError:
not_implemented = True
if not_implemented:
raise NotImplementedError("blah blah blah")
return self._bounding_box
@bounding_box.setter
def bounding_box(self, limits):
if isinstance(limits, six.string_types) and limits.lower() == 'auto':
try:
self.bounding_box_defaults()
except NotImplementedError:
raise NotImplementedError("Can't set bounding_box blah blah blah")
limits = 'auto'
elif ...:
...
self._bounding_box = limitsI think most of the above should satisfy your requirements. This is a little different than before, since previously I think I suggested avoiding storing the actual value If that seems unsavory than a separate attribute could be used to flag whether auto-bb is enabled. I would avoid any solution that requires initializing |
|
@embray - thanks, that's nearly exactly where I landed - I'm missing the exception in the setter, but that makes sense to have. |
|
Great--glad we wound up on the same page. |
bounding_box and render_model function in `astropy.modelingbounding_box property and new Model.render() method in astropy.modeling
|
@patti is this ready for reviewing? If so, could you rebase? Thanks! |
|
I think @patti may be busy with school (?) which is fine if so. I'll need to finish this up if so, but getting this in for 1.1.0 is important. |
|
@embray - can we delay this to 1.2 if it's not going to be possible to merge today? Is there a reason it has to be included in 1.1? |
|
If I don't then I'll have to unmerge #3909. This PR makes changes to the API and I don't want to have to support the API that's in there... |
|
In any case, as far as the "feature freeze" is concerned, the "feature" is already done in #3909. But it needs some more work before the final release. |
|
@embray - I agree that as an exceptional case this could be merged after feature freeze since it's not adding a feature. But how soon do you think you could finish this up? |
|
Okay, I'm going to try to get this wrapped up. I'm also thinking of making a slight interface change, so that instead of defining a None of the rest will change--this is just an implementation tweak more than anything. |
|
@embray Thanks for taking this over! The change of the interface sounds reasonable to me. Unfortunately I don't have time to work on it myself, but I might find some time this week to review the code again, if necessary. |
|
@embray - what do you think about this: should we push it to 1.2 (or 1.1.1?) |
|
I'm trying to finish this today. It's mostly done, I just need to finish some doc updates. |
|
Hi all, Sorry for the silence. I was on vacation off the grid and this thread got lost in the deluge of emails I came back to. Thanks for picking it up @embray - is there anything I can do to help at this point? Patti |
|
@patti thanks for checking in and no problem. I'm about to put up a PR for my followup to this with my slight changes to the interface. It'd be great if you can take a look and let me know what you think (though I'm going to try to get it merged very soon...) |
|
Merged in #4264 |

This PR follows on #3909. The changes are:
bounding_box_defaultfunction to all functional models where it makes sense.Cutout2Dclass bounding box definitions for consistency.render_modelfunction withModel.render()method.Add WCS support to therender_modelfunction