diff --git a/firefly_features/afwDisplay_Firefly_docs.ipynb b/firefly_features/afwDisplay_Firefly_docs.ipynb new file mode 100644 index 0000000..f0b11f0 --- /dev/null +++ b/firefly_features/afwDisplay_Firefly_docs.ipynb @@ -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-03-29\n", + "\n", + "**Verified Science Platform release or release candidate:** 17.0.1" + ] + }, + { + "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.6.6" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}