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-18530 Add Firefly verification notebooks to lsst-sqre notebook-demo repository #18

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
14 changes: 14 additions & 0 deletions firefly_features/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## Verification noteooks for `lsst.display.firefly`

The notebooks in this directory are used to test release candidates of the LSST Science Platform Notebook Aspect.

**Last verified to run:** 2019-10-07

**Verified release or release candidate:** 18.1.0

1. [afwDisplay_Firefly_docs.ipynb](afwDisplay_Firefly_docs.ipynb) : Nearly all the content from the [module documentation](https://pipelines.lsst.io/modules/lsst.display.firefly), excluding LSST Source Detection Footprints.
2. [intro-with-globular.ipynb](intro-with-globular.ipynb) : a source detection and crude deblending notebook used in workshops in Summer 2018.
A medium or larger-size container is recommended for this notebook.

Additionally, the [Firefly notebook](../Firefly.ipynb) demonstrating Firefly capabilities should also be tested
for every release.
361 changes: 361 additions & 0 deletions firefly_features/afwDisplay_Firefly_docs.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,361 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Test most of the module docs "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Last verified to run:** 2019-10-15\n",
"\n",
"**Verified Science Platform release or release candidate:** 18.1.0"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This notebook contains most of the content of the [module docs](https://pipelines.lsst.io/modules/lsst.display.firefly) for the Firefly backend of the afwDisplay visualization interface."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Initializing a Display instance"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import lsst.afw.display as afwDisplay"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"afwDisplay.setDefaultBackend('firefly')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"display1 = afwDisplay.Display(frame=1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Retrieve and display an image"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from lsst.daf.persistence import Butler\n",
"butler = Butler('/project/shared/data/Twinkles_subset/output_data_v2')\n",
"dataId = {'filter': 'r', 'raft': '2,2', 'sensor': '1,1', 'visit': 235}\n",
"calexp = butler.get('calexp', **dataId)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"display1.scale('asinh', 'zscale')\n",
"display1.setMaskTransparency(90)\n",
"display1.mtv(calexp)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Overlay symbols from a catalog"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"src = butler.get('src', **dataId)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"with display1.Buffering():\n",
" for record in src:\n",
" display1.dot('o', record.getX(), record.getY(), size=20, ctype='orange')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"display1.erase()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Making a display tab reopen after closing it"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"display1.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Reinitializing a display tab"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"display1.clearViewer()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Displaying a clickable link"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"display1.getClient().display_url()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Mask display and manipulation"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"display1.mtv(calexp)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"display1.setMaskPlaneColor('DETECTED', afwDisplay.GREEN)\n",
"display1.setMaskTransparency(30)\n",
"display1.mtv(calexp)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Rescale or restretch the image pixels display"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"display1.scale('log', -1, 10, 'sigma')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"display1.scale('asinh', 'zscale')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Zooming and panning"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"display1.pan(1064, 890)\n",
"display1.zoom(4)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"display1.zoom(2, 500, 800)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Overlay regions"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"with display1.Buffering():\n",
" for record in src:\n",
" display1.dot('o', record.getX(), record.getY(), size=20, ctype='orange')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"display1.line([[100,100], [100,200], [200,200], [200,100], [100,100]], ctype='blue')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"display1.erase()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Upload interactive table and chart"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fc = display1.getClient()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import firefly_client.plot as ffplt\n",
"ffplt.use_client(fc)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"tbl_id = ffplt.upload_table(src, title='Source Catalog')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ffplt.hist('log10(base_PsfFlux_flux)')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "LSST",
"language": "python",
"name": "lsst"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.2"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Loading