Skip to content
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

DM-17428: interpImage: allow transposition before interpolation #273

Merged
merged 1 commit into from Mar 1, 2019

Conversation

PaulPrice
Copy link
Contributor

This allows the interpolation to act over columns instead of rows.


def transposeImage(image):
"""Transpose an image"""
result = type(image)(transposeBox(image.getBBox()))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the stacky way of getting an image of the same type was:image.Factory(transposeBox(image.getBBox()))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In particular type doesn't work with proxies, although I'm not sure if they'll reappear

def transposeImage(image):
"""Transpose an image"""
result = type(image)(transposeBox(image.getBBox()))
result.array[:] = image.array.T
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really need the [:]? (See lines 229-231)

import lsst.pex.config as pexConfig
import lsst.afw.geom as afwGeom
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lsst.geom preferred over lsst.afw.geom

useImage = maskedImage
useDefects = defects
if self.config.transpose:
useImage = afwImage.makeMaskedImage(transposeImage(maskedImage.image),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add an inline comment that this doesn't modify maskedImage

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that should be obvious from the code. If you disagree, let me know and I'll write something.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Without the try/finally block, it's obvious. (The finally block had me thinking that you thought you had destroyed maskedImage)

transposeImage(maskedImage.mask),
transposeImage(maskedImage.variance))
useDefects = ipIsr.transposeDefectList(defects)
try:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unclear to me why you put this in a try/finally block here. If the code in the with block that uses this context throws an exception, yield rethrows it (regardless if the try block is here or not). If that happens, what's the point of putting the pre-interpolation pixels back in? This isn't restoring some previous state.

@PaulPrice PaulPrice force-pushed the tickets/DM-17428 branch 2 times, most recently from 284238f to 1b7f6ff Compare February 28, 2019 17:58
This allows the interpolation to act over columns instead of rows.
@PaulPrice PaulPrice merged commit 277928e into master Mar 1, 2019
@timj timj deleted the tickets/DM-17428 branch February 18, 2021 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants