sys.path.append('/hydra/cm/firefly/src/fftools/python/display/') from FireflyClient import * try: path= os.getcwd() + '/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,'tt') fitsPathInfo= fc.uploadFile(path+"c.fits") #push a fits file raw_input("Load a FITS file. Press Enter to continue...") fc.showFits( fitsPathInfo, 'p1' ) 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")
# add to the path directory with the data 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') print 'showFits success: %s' % status['success']
__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)
print "Event Received: "+json.dumps(event['data']); try: path= '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,'myChannel') fc.launchBrowser() raw_input("Add a listener. Press Enter to continue...") status= fc.addListener(myCallback) fitsPathInfo= fc.uploadFile(path+"c.fits") #push a fits file raw_input("Load a FITS file. Press Enter to continue...") status= fc.showFits( fitsPathInfo, plotId='p1' ) time.sleep(1) print 'showFits success: %s' % status['success'] raw_input("pan the plot. Press Enter to continue...") status= fc.pan('p1', 10, 10)
import sys import json # add to the path directory with the data 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)
elif fIdx < 0 and tIdx >= 0: fc.showTable(fc.uploadFile(xList[tIdx]), xList[tIdx + 1], xList[tIdx + 2]) elif len(xList == 4): fc.addExtension(xList[tIdx], xList[tIdx + 1], xList[tIdx + 2], xList[tIdx + 3]) else: print("this type of functionality =" + xList + " is not supported yet") true = 1 path = os.getcwd() + "/data/" print("===================help info=======================") help() fc = FireflyClient() print("===================================================") x = "" name = None while true: x = raw_input("input>") if x == "": pass fc.addListener(name, x) xList = split(x, ("," ";", " "))
elif fIdx < 0 and tIdx >= 0: fc.showTable(fc.uploadFile(xList[tIdx]), xList[tIdx + 1], xList[tIdx + 2]) elif len(xList == 4): fc.addExtension(xList[tIdx], xList[tIdx + 1], xList[tIdx + 2], xList[tIdx + 3]) else: print('this type of functionality =' + xList + ' is not supported yet') true = 1 path = os.getcwd() + '/data/' print('===================help info=======================') help() fc = FireflyClient() print('===================================================') x = '' name = None while true: x = raw_input("input>") if (x == ''): pass fc.addListener(name, x) xList = split(x, (',' ';', ' ')) if x == '-v':
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")