This notebook demonstrates basic usage of the firefly_client API method show_table
for a 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.
Call the imports for firefly_client:
from firefly_client import FireflyClient
In this example, we use the IRSA Viewer - a public firefly server. The firefly server can also be run locally, e.g. via a Firefly Docker image obtained from https://hub.docker.com/r/ipac/firefly/tags/.
url='https://irsa.ipac.caltech.edu/irsaviewer'
# url=http://127.0.0.1:8080/firefly # if you have firefly server running locally
fc = FireflyClient.make_client(url)
The following example involves 2 files in different formats that contain multiple tables, 1 FITS and 1 VOTable (in XML style). If none are present, try to get a FITS from KOA (https://koa.ipac.caltech.edu/cgi-bin/KOA/nph-KOAlogin) and a XML VOTable through an Extended Name search on the classic version of NED (https://ned.ipac.caltech.edu/classic) and save them to a local computer path. To obtain the files directly, follow the links below:
FITS: https://koa.ipac.caltech.edu/cgi-bin/getKOA/nph-getKOA?filehand=/koadata40/MOSFIRE/20210502/lev0/MF.20210502.18830.fits
VOTable: https://ned.ipac.caltech.edu/cgi-bin/objsearch?objname=M31&extend=no&hconst=73&omegam=0.27&omegav=0.73&corr_z=1&out_csys=Equatorial&out_equinox=J2000.0&obj_sort=RA+or+Longitude&of=xml_all&zv_breaker=30000.0&list_limit=5&img_stamp=YES
Please set testdata_repo_path
to be the local path where the FITS and VOTable files are located:
import os
testdata_repo_path = '/hydra/cm' # to be reset to where test files are located on your system
Upload a file in FITS format that contains multiple tables and display it within the browser (noting that it may likely appear as though only the initial one is visible):
localfile = os.path.join(testdata_repo_path, 'MF.20210502.18830.fits')
filename = fc.upload_file(localfile)
fc.show_table(filename)
Look at another table within the FITS file in the browser (simply the only other one included for the case being looked at):
fc.show_table(filename, table_index=2)
Upload a file in XML format which functions as a VOTable that contains multiple tables display it within the browser (noting that it may likely appear as though only the initial one is visible):
localfile = os.path.join(testdata_repo_path, 'Mr31objsearch.xml')
filename = fc.upload_file(localfile)
fc.show_table(filename, tbl_id='votable-0')
Look at another table within the VOTable in the broswer (simply the only other one included for the case being looked at):
fc.show_table(filename, tbl_id='votable-1', table_index=1)