from firefly_client import FireflyClient
using_lab = False
#url='https://irsa.ipac.caltech.edu/irsaviewer'
url = 'http://127.0.0.1:8080/firefly'
#FireflyClient._debug= True
fc = FireflyClient.make_lab_client() if using_lab else FireflyClient.make_client(url)
# Add a three color fits
# in cell 0, 0, 1, 1
target = '210.80227;54.34895;EQ_J2000' #Galaxy M101
viewer_id = '3C'
r = fc.add_cell(0, 0, 1, 1, 'images', viewer_id)
rv = '92,-2,92,8,NaN,2,44,25,600,120'
if r['success']:
threeC= [
{
'Type' : 'SERVICE',
'Service' : 'WISE',
'Title' : '3 color',
'SurveyKey' : '3a',
'SurveyKeyBand': '3',
'WorldPt' : target,
'RangeValues': rv,
'SizeInDeg' : '.14'
},
{
'Type' : 'SERVICE',
'Service' : 'WISE',
'Title' : '3 color',
'SurveyKey' : '3a',
'SurveyKeyBand': '2',
'WorldPt' : target,
'RangeValues': rv,
'SizeInDeg' : '.14'
},
{
'Type' : 'SERVICE',
'Service' : 'WISE',
'Title' : '3 color',
'SurveyKey' : '3a',
'SurveyKeyBand': '1',
'WorldPt' : target,
'RangeValues': rv,
'SizeInDeg' : '.14'
}]
fc.show_fits_3color(threeC, plot_id='wise_m101', viewer_id=viewer_id)
# Set stretch using hue-preserving algorithm with scaling coefficients .15 for RED, 1.0 for GREEN, and .4 for BLUE.
fc.set_stretch_hprgb(plot_id='wise_m101', asinh_q_value=4.2, scaling_k=[.15,1,.4])
{'success': True, 'rv_lst': ['88,1.000000,88,99.000000,4.200000,2.000000,50,25,600,120,1,NaN,0.150000', '88,1.000000,88,99.000000,4.200000,2.000000,50,25,600,120,1,NaN,1.000000', '88,1.000000,88,99.000000,4.200000,2.000000,50,25,600,120,1,NaN,0.400000']}
# Set per-band stretch
fc.set_stretch(plot_id='wise_m101', stype='ztype', algorithm='asinh', band='ALL')
{'success': True, 'rv_string': '88,1.000000,88,99.000000,NaN,2.000000,50,25,600,120,0,NaN,1.000000'}
# Set contrast and bias for each band
fc.set_rgb_colors(plot_id='wise_m101', bias=[0.4, 0.6, 0.5], contrast=[1.5, 1, 2])
{'success': True}
# Set to use red and blue band only, with default bias and contrast
fc.set_rgb_colors(plot_id='wise_m101', use_green=False)
{'success': True}