Project/afw display/brant - #109
Conversation
drphilmarshall
left a comment
There was a problem hiding this comment.
This is a really nice intro tutorial, thanks @brantr ! I'll send you a couple of fixes via a quick PR to your project branch, and then there's just a couple of tweaks you might make to protect the notebook against the future.
| "# **Demo of lsst.afw.display -- displaying images using the LSST DM Astronomical Framework library**\n", | ||
| "\n", | ||
| "**Owner:** Brant Robertson ([@brantr](https://github.com/LSSTScienceCollaborations/DMStackClub/issues/new?body=@brantr)) \n", | ||
| "**Level:** Introductory \n", |
There was a problem hiding this comment.
Nice! We should adopt this in our other notebooks too.
| "source": [ | ||
| "# **Demo of lsst.afw.display -- displaying images using the LSST DM Astronomical Framework library**\n", | ||
| "\n", | ||
| "**Owner:** Brant Robertson ([@brantr](https://github.com/LSSTScienceCollaborations/DMStackClub/issues/new?body=@brantr)) \n", |
There was a problem hiding this comment.
We should make sure all our URLs say "StackClub" and not "DMStackClub"
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "warnings.simplefilter(\"ignore\", category=FutureWarning) #prevent some helpful but ancillary warning messages from printing during LSST DM Release v16 calls\n", |
There was a problem hiding this comment.
This comment about v16 will go stale - better to just say "prevent some ... during LSST DM calls"
| "\n", | ||
| "To plot an image to the screen, we must first load some data. In this tutorial, we will use the `Twinkles` simulated images available in the StackClub data repository. These data sit in the data directory `/project/shared/data/Twinkles_subset/output_data_v2` and contain a set of data produced in generating a calibrated exposure by the DM Stack. These data are organized in a structure that enables a DM Stack `Butler` instance to be generated and provide access to a single filter image (in this case `r` band), a specific detector raft (2,2), a specific sensor in the raft (`1,1`) and a specific visit (in this case, 235 -- note only one band is available per visit in this example).\n", | ||
| "\n", | ||
| "Once we define a string that contains the data directory, we start the `Butler` instance using the `lsst.daf.persistence` library alias `dafPersist` and its function `Butler()`. The function `Butler()` takes as an argument a string containing the data directory we wish to access. Running the cell may take a few moments." |
There was a problem hiding this comment.
I think Butler is a class, not a function - I'll submit a small PR with better wording.
| "cell_type": "markdown", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "If you'd like to learn more about any given function, please see the [`lsst.afw.display` source code](https://github.com/lsst/afw/tree/master/python/lsst/afw/display)." |
There was a problem hiding this comment.
We can also recommend the notebook help() function for showing the docstrings to the above functions - I'll include this in my PR too.
…splay/drphilmarshall Butler description, help() examples. Thanks so much @drphilmarshall.
|
I've made the changes requested by @drphilmarshall . If further changes are needed, please let me know. |
drphilmarshall
left a comment
There was a problem hiding this comment.
Let's merge this, and issue improvements to it as needed. Thanks @brantr ! :-)
kadrlica
left a comment
There was a problem hiding this comment.
Sorry it took me so long to get to this review. I think this is a great tutorial, and I'm glad that it's been merged already.
There are many ways in which this notebook could be expanded if so desired. One straightforward idea would be to show the MaskedImage (the Twinkles calexp already has a DETECTION mask plane associated with it). This would be a simple way to demo some of the mask display features of afw display.
| "We are now set to display the image. To do this, we:\n", | ||
| "\n", | ||
| "* First create a `matplotlib.pyplot` figure using `plt.figure()` -- this will be familiar to anyone with experience using `matplotlib`.\n", | ||
| "* Then create an alias to the `lsst.afw.display.Display` method that will allow us to display the data to the screen. This alias will be called `afw_display`.\n", |
There was a problem hiding this comment.
I think that what you are actually doing is using the afw_display variable to persist the lsst.afw.display.interface.Display object that is returned by lsst.afw.display.Display.
I've created a brief tutorial to walk users through displaying a Twinkles calexp image using lsst.afw.display. This notebook is based on cells from the LowSurfaceBrightness notebook by @kadrlica. The notebook compiles and runs with the stack v16.
I'm sure this notebook could be extended to better exercise some of afw.display's functionality, but I thought it might be useful to pull this now, and then update with more examples at a later date.