Skip to content

Project/afw display/brant - #109

Merged
drphilmarshall merged 6 commits into
masterfrom
project/afw-display/brant
Aug 27, 2018
Merged

Project/afw display/brant#109
drphilmarshall merged 6 commits into
masterfrom
project/afw-display/brant

Conversation

@brantr

@brantr brantr commented Aug 24, 2018

Copy link
Copy Markdown
Contributor

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.

@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.

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",

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.

Nice! We should adopt this in our other notebooks too.

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.

Great, thanks.

Comment thread Visualization/AFW_Display_Demo.ipynb Outdated
"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",

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.

We should make sure all our URLs say "StackClub" and not "DMStackClub"

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.

Fixed, thanks.

Comment thread Visualization/AFW_Display_Demo.ipynb Outdated
"metadata": {},
"outputs": [],
"source": [
"warnings.simplefilter(\"ignore\", category=FutureWarning) #prevent some helpful but ancillary warning messages from printing during LSST DM Release v16 calls\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.

This comment about v16 will go stale - better to just say "prevent some ... during LSST DM calls"

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.

Fixed, thanks.

Comment thread Visualization/AFW_Display_Demo.ipynb Outdated
"\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."

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.

I think Butler is a class, not a function - I'll submit a small PR with better wording.

Comment thread Visualization/AFW_Display_Demo.ipynb Outdated
"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)."

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.

We can also recommend the notebook help() function for showing the docstrings to the above functions - I'll include this in my PR too.

brantr and others added 2 commits August 26, 2018 18:40
@brantr

brantr commented Aug 27, 2018

Copy link
Copy Markdown
Contributor Author

I've made the changes requested by @drphilmarshall . If further changes are needed, please let me know.

@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.

Let's merge this, and issue improvements to it as needed. Thanks @brantr ! :-)

@drphilmarshall
drphilmarshall merged commit 2c63acc into master Aug 27, 2018

@kadrlica kadrlica 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.

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",

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.

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.

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.

3 participants