#!/usr/bin/env python # coding: utf-8 # This notebook demonstrates basic usage of the firefly_client API show_table for the file with multiple tables. # # Note that it may be necessary to wait for some cells (like those displaying an table) to complete before executing later cells. # ## 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 this example we assume the server is running locally, e.g. via a Firefly Docker image obtained from https://hub.docker.com/r/ipac/firefly/tags/. # In[ ]: url='http://127.0.0.1:8080/firefly' fc = FireflyClient(url) localbrowser, browser_url = fc.launch_browser() # The test files uesd below are available in git-lfs repo at https://github.com/lsst/firefly_test_data.
# In the following, please set `testdata_repo_path` to be the path where `firefly_test_data` is locally located. # In[ ]: import os testdata_repo_path = '/hydra/cm' # to be reset to where 'firefly_test_data' is located at. # ## Load a FITS containing multiple tables # In[ ]: localfile = os.path.join(testdata_repo_path, 'firefly_test_data/FileUpload-samples/fits/problemFits/src.fits') filename = fc.upload_file(localfile) fc.show_table(filename) # In[ ]: fc.show_table(filename, table_index=2) # ## Load a VOTable containing multiple tables # In[ ]: localfile = os.path.join(testdata_repo_path, 'firefly_test_data/FileUpload-samples/VOTable/tabledata/multiTables_Ned.xml') filename = fc.upload_file(localfile) fc.show_table(filename, tbl_id='votable-0') # In[ ]: fc.show_table(filename, tbl_id='votable-1', table_index=1) # In[ ]: