#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") tablePathInfo = fc.uploadFile(path+"2mass-m31-2412rows.tbl") raw_input("Load table file. Press Enter to continue...") fc.showTable( tablePathInfo ) fc.run_forever() except KeyboardInterrupt: raw_input("Press enter key to exit...") print ("Exiting main") fc.disconnect() fc.session.close()
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'] # add user-defined action MyOp in the context menu of 'p1' FITS viewer status = fc.addExtension('AREA_SELECT', 'MyOp', 'p1', 'MyOpExtension') print 'addExtension success: %s' % status['success'] # show another FITS from the URL 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) print 'showFits success: %s' % status['success'] # wait for events - do not exit the script print 'Waiting for events. Press Ctrl C to exit.'
# 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'] # add user-defined action MyOp in the context menu of 'p1' FITS viewer status= fc.addExtension('AREA_SELECT','MyOp','p1','MyOpExtension') print 'addExtension success: %s' % status['success'] # show another FITS from the URL 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) print 'showFits success: %s' % status['success'] # wait for events - do not exit the script print 'Waiting for events. Press Ctrl C to exit.' fc.waitForEvents() except KeyboardInterrupt: fc.disconnect() fc.session.close()
status= fc.stretch('p1', rv) print 'stretch success: %s' % status['success'] tablePathInfo = fc.uploadFile(path+"2mass-m31-2412rows.tbl") raw_input("Load table file. Press Enter to continue...") status= fc.showTable( tablePathInfo ) print 'showTable success: %s' % status['success'] regPathInfo= fc.uploadFile(path+"c.reg") raw_input("Overlay a region file. Press Enter to continue...") status= fc.overlayRegion( regPathInfo ) raw_input("Add extension. Press Enter to continue...") status= fc.addExtension("AREA_SELECT", "testButton","myPlotID", "myID") delReg= ['physical;point 211 201 # color=pink point=cross 9', 'physical;point 100 180 # color=green point=cross 10 select=1' ] status= fc.removeRegionData(delReg,'reg3') fc.run_forever() except KeyboardInterrupt: raw_input("Press enter key to exit...") print ("Exiting main") fc.disconnect() fc.session.close()