__author__ = 'zhang' import sys import os sys.path.append('/hydra/cm/firefly/src/fftools/python/display/') from FireflyClient import * path= os.getcwd() + '/data/' #create a FireflyClient instance fc =FireflyClient() #push a fits file raw_input("Load a FITS file. Press Enter to continue...") fc.showFits( fc.uploadImage(path+"c.fits") )
sys.path.append('../python/display/') from FireflyClient import * host = 'localhost:8080' # from command line: ipython ./initFF.py # from prompt: execfile('./initFF.py') def myCallback(event): # print event print "Event Received: " + json.dumps(event['data']) fc = FireflyClient(host, 'myChannel') fc.launchBrowser() # walkaround to make sure other actions do not happen before the browser is ready to receive events raw_input( "Wait for browser to load Firefly Tools. Press Enter to continue...") try: fc.addListener(myCallback) # upload FITS file file = fc.uploadFile('data/c.fits') print 'uploadFile' # show uploaded FITS status = fc.showFits(file, 'p1')
from FireflyClient import * host = 'localhost:8080' # from prompt: execfile('./aCallback.py') # callback, where you can define what to do when an event is received # def myCallback(event): print "Event Received: " + json.dumps(event['data']) #print event if 'type' in event['data']: if event['data']['type'] == 'AREA_SELECT': #print '*************area select' pParams = { 'URL': 'http://web.ipac.caltech.edu/staff/roby/demo/wise-m51-band2.fits', 'ColorTable': '5' } status = fc.showFits(fileOnServer=None, plotId='p2', additionalParams=pParams) elif 'region' in event['data']: print 'selected region: %s' % event['data']['region'] fc = FireflyClient(host, 'tt') fc.addListener(myCallback)
from FireflyClient import * try: path = "../../test/data/" pythonVersion = sys.version_info[0] if (pythonVersion != 2): print( 'ERROR: this release only works with python major version 2, to make it work with version 3, please' 'change "raw_input" to "input_" ') #open the first browser host = 'localhost:8080' fc = FireflyClient(host) fitsPathInfo = fc.uploadFile(path + "c.fits") #push a fits file raw_input("Load a FITS file. Press Enter to continue...") fc.showFits(fitsPathInfo) #regPathInfo= fc.uploadFile(path+"c.reg") raw_input("Overlay a region file. Press Enter to continue...") fc.overlayRegion(regPathInfo) raw_input("Add extension. Press Enter to continue...") fc.addExtension("AREA_SELECT", "testButton", "myPlotID", "myID") tablePathInfo = fc.uploadFile(path + "2mass-m31-2412rows.tbl")