Skip to content

Guided tour of a calexp object - #57

Merged
drphilmarshall merged 7 commits into
masterfrom
project/calexp-tour/stargaser
Aug 8, 2018
Merged

Guided tour of a calexp object#57
drphilmarshall merged 7 commits into
masterfrom
project/calexp-tour/stargaser

Conversation

@stargaser

@stargaser stargaser commented Jul 13, 2018

Copy link
Copy Markdown
Contributor

Ready for review.

Addresses #52

  • Read in a calexp, show various methods and how to display images
  • Show how to make cutouts various ways
  • Repeat for a coadded image

@kadrlica

Copy link
Copy Markdown
Contributor

Thanks @stargaser, this is very useful!

Something that I found confusing about lsst.afw.image.Exposure object hierarchy is that by default everything is done by reference. This makes sense when accessing the image, mask, etc. attributes, but becomes non-intuitive when creating cutouts. For example:

bbox = afwGeom.Box2I()
bbox.include(afwGeom.Point2I(xmin, ymin))
bbox.include(afwGeom.Point2I(xmin+width, ymin+height))
cutout = calexp.Factory(calexp, bbox, afwImage.LOCAL)

This will provide cutout, a new ExposureF that is still connected by reference to it's parent calexp. I think that it would be worthwhile discussing this a bit in the calexp tutorial. Specifically a discussion of the Factory and clone methods, and some discussion about the deep argument in the Exposure and MaskedImage constructors.

@drphilmarshall

Copy link
Copy Markdown
Contributor

Hi @stargaser ! Is this now ready for review? Great if we can merge it today, if possible. Feel free to request code reviews from anyone from the @LSSTScienceCollaborations/dm-stack-club - likewise others, feel free to volunteer to work through David's notebook!

@drphilmarshall drphilmarshall added this to the Launch milestone Aug 7, 2018
@stargaser

Copy link
Copy Markdown
Contributor Author

I need to address comments from @kadrlica and I think I need to rebase README.md. Let me try to do that quickly, early this afternoon.

@stargaser
stargaser force-pushed the project/calexp-tour/stargaser branch from c18596a to ddb0063 Compare August 7, 2018 22:04
@stargaser
stargaser force-pushed the project/calexp-tour/stargaser branch from 4793855 to 2e0980b Compare August 7, 2018 22:10
@stargaser

Copy link
Copy Markdown
Contributor Author

Ready for review now @drphilmarshall

@drphilmarshall drphilmarshall left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @stargaser ! I verified your calexp tour on v16.0, and put a note on what I needed to change. I also standardized the header. Good stuff, thank you!

"bbox = afwGeom.Box2I()\n",
"bbox.include(afwGeom.Point2I(2200,3200))\n",
"bbox.include(afwGeom.Point2I(2800,3800))\n",
"cutout = calexp.Factory(calexp, bbox, afwImage.LOCAL)"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Much preferred these days:

cutout = calexp[bbox, afwImage.LOCAL]

You can drop the LOCAL because you're not dealing with a subimage, making this even more cleaner:

cutout = calexp[bbox]

"metadata": {},
"outputs": [],
"source": [
"cutout_calexp = butler.get('calexp_sub', bbox=bbox, immediate=True, dataId=dataId)\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Don't need immediate=True.

"cell_type": "markdown",
"metadata": {},
"source": [
"The result of the `set` command above shows that a calexp and a coadd have the same methods."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's because they're the same class, lsst.afw.image.Exposure.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh, I see now, that makes this result expected!

Coadds have the same methods, but it seems to me that they have different contents...e.g. XY0 is non-zero; many more cosmic rays in the masks; overall masks look much different; PSFs must be an average from the coaddition process? And certainly the dataIds are a lot different. Maybe this part of the notebook needs to focus on those aspects.

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.

4 participants