This notebook demonstrates basic usage of the firefly_client API, overlay_footprints, which overlays the footprint described in image pixel of JSON format on the fits image
Imports for Python 2/3 compatibility
from __future__ import print_function, division, absolute_import
Imports for firefly_client
from firefly_client import FireflyClient
import astropy.utils.data
In this example we use the local Firefly server.
url = 'http://127.0.0.1:8080/firefly'
Instantiate FireflyClient
.
fc = FireflyClient(url)
Open a browser to the firefly server in a new tab. The browser open only works when running the notebook locally, otherwise a link is displayed.
localbrowser, browser_url = fc.launch_browser()
The data used in this example are taken from http://web.ipac.caltech.edu/staff/shupe/firefly_testdata
image_url = 'http://web.ipac.caltech.edu/staff/shupe/firefly_testdata/calexp-subset-HSC-R.fits'
filename = astropy.utils.data.download_file(image_url, cache=True, timeout=120)
imval = fc.upload_file(filename)
plotid = 'footprinttest'
status = fc.show_fits(file_on_server=imval, plot_id=plotid, title='footprints HSC R-band')
table_url = 'http://web.ipac.caltech.edu/staff/shupe/firefly_testdata/footprints-subset-HSC-R.xml'
footprint_table = astropy.utils.data.download_file(table_url, cache=True, timeout=120)
tableval = fc.upload_file(footprint_table)
status = fc.overlay_footprints(tableval, title='footprints HSC R-band',
footprint_layer_id='footprint_layer_1',
plot_id=plotid,
highlightColor='yellow',
selectColor='cyan',
style='fill',
color='rgba(74,144,226,0.30)')