def __get_results(self): needed = ['G_PARAMS', 'G_POS', 'difgpics', 'difmpics'] isbad = utils.isBad(needed, self.data) res = 'Gaussian fit output:' + BR() size = str(200) if 'difmpics' in self.data and 'difgpics' in self.data and 'gauspic' in self.data: res += A(IMG(src=self.data['gauspic'], width=size), href=self.data['gauspic']) i = 0 for s in self.data['difmpics']: res += A(IMG(src=s, width=size, alt='difm ' + str(i + 1)), href=s) res += A(IMG(src=self.data['difgpics'][i], width=size, alt='difg ' + str(i + 1)), href=self.data['difgpics'][i]) + BR() i += 1 form = FORM(action='/deconv', method='POST') l = ['G_PARAMS', 'G_POS'] for e in l: form <= BR() + SPAN(SPAN(help.entry[e]) + e + ':' + BR() + INPUT(type='text', Class=isbad[e], name=e, value=str(self.data[e]), size='60'), Class='param') form <= BR() + INPUT(type='submit', name='run', value='go to deconvolution') + BR() + BR() return H2('Results:') + BR() + form + res
def __get_params(self): needed = [ 'star_sel', 'SKY_BACKGROUND', 'SIGMA_SKY', 'IMG_GAIN', 'NPIX', 'S_FACT', 'G_RES' ] optp = ['CENTER', 'MOF_INIT', 'MAX_IT', 'MOF_PARAMS'] isbad = utils.isBad(needed, self.data) utils.checkDic(optp, self.data) content = FORM(action='/moffat/run_mof', method='POST') size = self.data['star_sel'] != None and 10 + 10 * len( self.data['star_sel']) or 10 c1 = H3('Mandatory parameters:') c1 += BR() + SPAN(INPUT(type='text', Class=isbad['star_sel'], name='star_sel', value=self.data['star_sel'], size=size) + 'Positions', Class='param') del needed[0] for e in needed: c1 += BR() + SPAN(SPAN(help.entry[e]) + INPUT( type='text', Class=isbad[e], name=e, value=self.data[e]) + e, Class='param') c2 = H3('Optional parameters:') + BR() for e in optp: c2 += BR() + SPAN(SPAN(help.entry[e]) + INPUT( type='text', Class='ok', name=e, value=self.data[e]) + e, Class='param') content <= LI(c1) content <= LI(c2) content <= INPUT(type='submit', name='run', value='run') + BR() + BR() return content
def __get_results(self): needed = ['MOF_PARAMS'] isbad = utils.isBad(needed, self.data) ds9 = '' if 'mof_res' in self.data: self.js = """ <script type="text/javascript"> function ds9() { var req = new XMLHttpRequest(); req.open("GET", "/moffat/ds9", true); req.onreadystatechange = function(){ return; }; req.send(null); } </script>""" ds9 = A('[Display with DS9]', href="javascript:ds9();", Class='opt') res = 'Moffat fit output: ' + ds9 + BR() size = str(200) gal = TABLE() if 'mofpic' in self.data: gal <= TR( TD( DIV(A(IMG(src=self.data['mofpic'], width='250'), href=self.data['mofpic'][5]) + DIV('Fitted moffat'), Class='imggal'))) if 'starpics' in self.data: for i, s in enumerate(self.data['starpics']): s = DIV(A(IMG(src=s, width=size, alt='star ' + str(i + 1)), href=s) + DIV('star ' + str(i + 1)), Class='imggal') m = '' if 'difmpics' in self.data: m = DIV(A(IMG(src=self.data['difmpics'][i], width=size, alt='difm ' + str(i + 1)), href=self.data['difmpics'][i]) + DIV('residuals'), Class='imggal') gal <= TR(TD(s) + TD(m)) res += gal if 'moftrace' in self.data: res += 'Parameters trace:'+BR()+\ A(IMG(src=self.data['moftrace'], width='600'), href=self.data['moftrace']) + BR() form = FORM(action='/gaussians', method='POST') form <= 'Moffat parameters:'+BR()+\ INPUT(type='text', Class=isbad['MOF_PARAMS'], name='MOF_PARAMS', value=str(self.data['MOF_PARAMS']), size='40')+BR() form <= INPUT(type='submit', name='gogaus', value='go to gaussian fit') + BR() + BR() return H2('Results:') + BR() + form + res
def __get_selection(self): needed = ['STARS'] isbad = utils.isBad(needed, self.data) tog = A("star selection", href="javascript:toggleContent('select');")+\ BR()+P(help.section['ssel'])+BR() togcont = FORM(action="/moffat", method='POST') #'/moffat') size = self.data['STARS'] != None and 10 + 10 * len( self.data['STARS']) or 10 togcont <= 'Candidates:' + BR() + INPUT(type='text', Class=isbad['STARS'], name='STARS', value=str(self.data['STARS']), size=size) + BR() togcont <= 'Or enter the candidates ids:' + BR() + INPUT( type='text', name='c_ids', value='[]', size=20) + BR() if isbad['STARS'] == 'ok': togcont <= BR() + 'Which candidates would you like to keep?' + BR() if 'star_sel' not in self.data: l = [] for e in self.data['STARS']: l += [e] self.data['star_sel'] = l i = 0 for s in self.data['STARS']: if s in self.data['star_sel']: togcont <= INPUT(type='checkbox', name='star' + str(i), id='star' + str(i), value=i, checked='yes') + '<label for=star' + str( i) + '>Candidate ' + str( i + 1) + '</label>' + BR() else: togcont <= INPUT(type='checkbox', name='star' + str(i), id='star' + str(i), value=i) + '<label for=star' + str( i) + '>Candidate ' + str( i + 1) + '</label>' + BR() i = i + 1 togcont <= INPUT(type='submit', name='gomof', value='proceed to fit') + BR() selB = LI(tog + DIV(togcont, id="select", style="display:block;") + BR()) return selB
def __get_params(self): needed = [ 'star_sel', 'SKY_BACKGROUND', 'SIGMA_SKY', 'IMG_GAIN', 'NPIX', 'S_FACT', 'G_RES', 'MOF_PARAMS', 'G_STRAT', 'G_SETTINGS', 'NB_RUNS' ] isbad = utils.isBad(needed, self.data) content = FORM(action='/gaussians/run_gaus', method='POST') size = self.data['star_sel'] != None and 10 + 10 * len( self.data['star_sel']) or 10 c = H3('Parameters:')+BR()+ 'Positions:'+BR()+\ INPUT(type='text', Class=isbad['star_sel'], name='star_sel', value=self.data['star_sel'], size=size)+BR() del needed[0] for e in needed: c += BR() + SPAN(SPAN(help.entry[e]) + INPUT( type='text', Class=isbad[e], name=e, value=self.data[e]) + e, Class='param') content <= c content <= BR() + INPUT(type='submit', name='run', value='run') + BR() + BR() return content
def __get_stars(self): img = utils.get_data('./img/' + self.data['FILENAME']) tog = A("star search", href="javascript:toggleContent('candidates');")+\ BR()+P(help.section['ssearch']) togcont = FORM(action='/prepare/run_stars', method='POST') sky, sig = None, None needed = ['SKY_BACKGROUND', 'SIGMA_SKY', 'IMG_GAIN', 'NOBJ'] allp = ['NOBJ', 'SKY_BACKGROUND', 'IMG_GAIN', 'SIGMA_SKY', 'VAL_BND'] isbad = utils.isBad(needed, self.data) for e in allp: togcont <= BR() + SPAN(SPAN(help.entry[e]) + INPUT( type='text', Class=isbad[e], name=e, value=self.data[e]) + e, Class='param') togcont <= BR() + INPUT(type='submit', name='run', value='run') + BR() togi = togimg = res = '' if 'candidates_pics' in self.data: res = DIV("Red: candidates, Green: accepted candidates"+BR()\ +A(IMG(src=self.data['candidates_pics'][6], width='600', onmouseover="TJPzoom(this,'"+self.data['candidates_pics'][5]+"');"), href=self.data['candidates_pics'][5]) + BR()) togi = BR() + A("Candidates details (toggle):", href="javascript:toggleContent('togimg');") + BR() # candmap = MAP(name='candmap') # for i, c in enumerate(self.data['clist']): # r = max(c.rad) # candmap <= AREA(shape='rect', coords='('+str(c.x-c)+','+str(c.y-c)+','+str(c.x+c)+','+str(c.x+c)+')', # Class='candpic', name=cand+str(i)) togimg = DIV( A(IMG(src=self.data['candidates_pics'][0], width='600'), href=self.data['candidates_pics'][0]) + BR()) # togimg += SCRIPT("preload(sig1,'"+self.data['candidates_pics'][2]+"');\n"+ # "preload(sig2,'"+self.data['candidates_pics'][3]+"');\n"+ # "preload(sig3,'"+self.data['candidates_pics'][4]+"');\n") togimg += DIV('Gaussian residuals:' + BR() + IMG(id='sig', src=self.data['candidates_pics'][1], usemap='#sigmap', alt='', href=self.data['candidates_pics'][1], width='600') + BR()) togimg += MAP(AREA(shape='rect', coords='(0,0,199,100%)', href=self.data['candidates_pics'][2], name='1sig', onMouseOver="flipsig('" + self.data['candidates_pics'][2] + "')", onMouseOut="flipsig('" + self.data['candidates_pics'][1] + "')", alt='one sigma') + AREA(shape='rect', coords='(200,0,399,100%)', href=self.data['candidates_pics'][3], name='2sig', onMouseOver="flipsig('" + self.data['candidates_pics'][3] + "')", onMouseOut="flipsig('" + self.data['candidates_pics'][1] + "')", alt='two sigma') + AREA(shape='rect', coords='(400,0,600,100%)', href=self.data['candidates_pics'][4], name='3sig', onMouseOver="flipsig('" + self.data['candidates_pics'][4] + "')", onMouseOut="flipsig('" + self.data['candidates_pics'][1] + "')", alt='three sigma'), name='sigmap') starB = LI(tog + res + DIV(togcont + togi + DIV(togimg, id="togimg", style="display:none;"), id="candidates", style="display:block;") + BR()) return starB