#!/usr/bin/env python # coding: utf-8 # 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 # ## Setup # Imports for Python 2/3 compatibility # In[ ]: from __future__ import print_function, division, absolute_import # Imports for firefly_client # In[ ]: from firefly_client import FireflyClient # In[ ]: import astropy.utils.data # In this example we use the local Firefly server. # In[ ]: url = 'http://127.0.0.1:8080/firefly' # Instantiate `FireflyClient`. # In[ ]: fc = FireflyClient(url) # ## Download some data # 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. # In[ ]: localbrowser, browser_url = fc.launch_browser() # The data used in this example are taken from http://web.ipac.caltech.edu/staff/shupe/firefly_testdata # In[ ]: 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' # In[ ]: status = fc.show_fits(file_on_server=imval, plot_id=plotid, title='footprints HSC R-band') # In[ ]: 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) # In[ ]: 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)') # In[ ]: