@gen.coroutine<EOL><INDENT>def get(self):<DEDENT>
provided_key = self.get_argument('<STR_LIT:key>',default=None)<EOL>if not provided_key:<EOL><INDENT>LOGGER.error('<STR_LIT>')<EOL>retdict = {'<STR_LIT:status>':'<STR_LIT:error>',<EOL>'<STR_LIT:message>':('<STR_LIT>'<EOL>'<STR_LIT>'),<EOL>'<STR_LIT:result>':None,<EOL>'<STR_LIT>':True}<EOL>self.set_status(<NUM_LIT>)<EOL>self.write(retdict)<EOL>raise tornado.web.Finish()<EOL><DEDENT>else:<EOL><INDENT>provided_key = xhtml_escape(provided_key)<EOL>if not _time_independent_equals(provided_key,<EOL>self.secret):<EOL><INDENT>LOGGER.error('<STR_LIT>')<EOL>retdict = {'<STR_LIT:status>':'<STR_LIT:error>',<EOL>'<STR_LIT:message>':('<STR_LIT>'<EOL>'<STR_LIT>'),<EOL>'<STR_LIT:result>':None,<EOL>'<STR_LIT>':True}<EOL>self.set_status(<NUM_LIT>)<EOL>self.write(retdict)<EOL>raise tornado.web.Finish()<EOL><DEDENT><DEDENT>LOGGER.info('<STR_LIT>')<EOL>checkplotfname = self.get_argument('<STR_LIT>', default=None)<EOL>if checkplotfname:<EOL><INDENT>try:<EOL><INDENT>cpfpath = xhtml_escape(<EOL>base64.b64decode(url_unescape(checkplotfname))<EOL>)<EOL><DEDENT>except Exception as e:<EOL><INDENT>msg = '<STR_LIT>'<EOL>LOGGER.error(msg)<EOL>resultdict = {'<STR_LIT:status>':'<STR_LIT:error>',<EOL>'<STR_LIT:message>':msg,<EOL>'<STR_LIT:result>':None,<EOL>'<STR_LIT>':True}<EOL>self.set_status(<NUM_LIT>)<EOL>self.write(resultdict)<EOL>raise tornado.web.Finish()<EOL><DEDENT>LOGGER.info('<STR_LIT>' % cpfpath)<EOL>if not os.path.exists(cpfpath):<EOL><INDENT>msg = "<STR_LIT>" % cpfpath<EOL>LOGGER.error(msg)<EOL>resultdict = {'<STR_LIT:status>':'<STR_LIT:error>',<EOL>'<STR_LIT:message>':msg,<EOL>'<STR_LIT:result>':None,<EOL>'<STR_LIT>':True}<EOL>self.set_status(<NUM_LIT>)<EOL>self.write(resultdict)<EOL>raise tornado.web.Finish()<EOL><DEDENT>cpdict = yield self.executor.submit(<EOL>_read_checkplot_picklefile, cpfpath<EOL>)<EOL>LOGGER.info('<STR_LIT>' % cpfpath)<EOL>objectid = cpdict['<STR_LIT>']<EOL>objectinfo = cpdict['<STR_LIT>']<EOL>varinfo = cpdict['<STR_LIT>']<EOL>if '<STR_LIT>' in cpdict:<EOL><INDENT>pfmethods = cpdict['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>pfmethods = []<EOL>for pfm in PFMETHODS:<EOL><INDENT>if pfm in cpdict:<EOL><INDENT>pfmethods.append(pfm)<EOL><DEDENT><DEDENT><DEDENT>neighbors = []<EOL>if ('<STR_LIT>' in cpdict and<EOL>cpdict['<STR_LIT>'] is not None and<EOL>len(cpdict['<STR_LIT>'])) > <NUM_LIT:0>:<EOL><INDENT>nbrlist = cpdict['<STR_LIT>']<EOL>for nbr in nbrlist:<EOL><INDENT>if '<STR_LIT>' in nbr:<EOL><INDENT>nbrmagdiffs = nbr['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>nbrmagdiffs = None<EOL><DEDENT>if '<STR_LIT>' in nbr:<EOL><INDENT>nbrcolordiffs = nbr['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>nbrcolordiffs = None<EOL><DEDENT>thisnbrdict = {<EOL>'<STR_LIT>':nbr['<STR_LIT>'],<EOL>'<STR_LIT>':{<EOL>'<STR_LIT>':nbr['<STR_LIT>'],<EOL>'<STR_LIT>':nbr['<STR_LIT>'],<EOL>'<STR_LIT>':nbr['<STR_LIT>'],<EOL>'<STR_LIT>':nbr['<STR_LIT>'],<EOL>'<STR_LIT>':nbr['<STR_LIT>'],<EOL>'<STR_LIT>':nbrmagdiffs,<EOL>'<STR_LIT>':nbrcolordiffs<EOL>}<EOL>}<EOL>try:<EOL><INDENT>nbr_magseries = nbr['<STR_LIT>']['<STR_LIT>']<EOL>thisnbrdict['<STR_LIT>'] = nbr_magseries<EOL><DEDENT>except Exception as e:<EOL><INDENT>LOGGER.error(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>% (nbr['<STR_LIT>'],<EOL>cpdict['<STR_LIT>'])<EOL>)<EOL><DEDENT>try:<EOL><INDENT>for pfm in pfmethods:<EOL><INDENT>if pfm in nbr:<EOL><INDENT>thisnbrdict[pfm] = {<EOL>'<STR_LIT>':nbr[pfm][<NUM_LIT:0>]['<STR_LIT>'],<EOL>'<STR_LIT>':nbr[pfm][<NUM_LIT:0>]['<STR_LIT>'],<EOL>'<STR_LIT>':nbr[pfm][<NUM_LIT:0>]['<STR_LIT>']<EOL>}<EOL><DEDENT><DEDENT><DEDENT>except Exception as e:<EOL><INDENT>LOGGER.error(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>% (nbr['<STR_LIT>'],<EOL>cpdict['<STR_LIT>'])<EOL>)<EOL><DEDENT>neighbors.append(thisnbrdict)<EOL><DEDENT><DEDENT>if '<STR_LIT>' in cpdict:<EOL><INDENT>objectcomments = cpdict['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>objectcomments = None<EOL><DEDENT>if '<STR_LIT>' in cpdict:<EOL><INDENT>objectxmatch = cpdict['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>objectxmatch = None<EOL><DEDENT>if '<STR_LIT>' in cpdict:<EOL><INDENT>colormagdiagram = cpdict['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>colormagdiagram = None<EOL><DEDENT>if '<STR_LIT>' in cpdict:<EOL><INDENT>finderchart = cpdict['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>finderchart = None<EOL><DEDENT>if ('<STR_LIT>' in cpdict and<EOL>isinstance(cpdict['<STR_LIT>'], dict) and<EOL>'<STR_LIT>' in cpdict['<STR_LIT>']):<EOL><INDENT>magseries = cpdict['<STR_LIT>']['<STR_LIT>']<EOL>time0 = cpdict['<STR_LIT>']['<STR_LIT>'].min()<EOL>magseries_ndet = cpdict['<STR_LIT>']['<STR_LIT>'].size<EOL><DEDENT>else:<EOL><INDENT>magseries = None<EOL>time0 = <NUM_LIT:0.0><EOL>magseries_ndet = <NUM_LIT:0><EOL>LOGGER.warning(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>if '<STR_LIT:status>' in cpdict:<EOL><INDENT>cpstatus = cpdict['<STR_LIT:status>']<EOL><DEDENT>else:<EOL><INDENT>cpstatus = '<STR_LIT>'<EOL><DEDENT>if '<STR_LIT>' in cpdict:<EOL><INDENT>uifilters = cpdict['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>uifilters = {'<STR_LIT>':None,<EOL>'<STR_LIT>':None,<EOL>'<STR_LIT>':None}<EOL><DEDENT>resultdict = {<EOL>'<STR_LIT:status>':'<STR_LIT>',<EOL>'<STR_LIT:message>':'<STR_LIT>' % os.path.basename(cpfpath),<EOL>'<STR_LIT>':True,<EOL>'<STR_LIT:result>':{<EOL>'<STR_LIT>':'<STR_LIT>' % time0,<EOL>'<STR_LIT>':objectid,<EOL>'<STR_LIT>':objectinfo,<EOL>'<STR_LIT>':colormagdiagram,<EOL>'<STR_LIT>':objectcomments,<EOL>'<STR_LIT>':varinfo,<EOL>'<STR_LIT>':uifilters,<EOL>'<STR_LIT>':neighbors,<EOL>'<STR_LIT>':objectxmatch,<EOL>'<STR_LIT>':finderchart,<EOL>'<STR_LIT>':magseries,<EOL>'<STR_LIT>':magseries_ndet,<EOL>'<STR_LIT>':cpstatus,<EOL>'<STR_LIT>':pfmethods<EOL>}<EOL>}<EOL>for key in pfmethods:<EOL><INDENT>periodogram = cpdict[key]['<STR_LIT>']<EOL>if <NUM_LIT:0> in cpdict[key] and isinstance(cpdict[key][<NUM_LIT:0>], dict):<EOL><INDENT>phasedlc0plot = cpdict[key][<NUM_LIT:0>]['<STR_LIT>']<EOL>phasedlc0period = float(cpdict[key][<NUM_LIT:0>]['<STR_LIT>'])<EOL>phasedlc0epoch = float(cpdict[key][<NUM_LIT:0>]['<STR_LIT>'])<EOL><DEDENT>else:<EOL><INDENT>phasedlc0plot = None<EOL>phasedlc0period = None<EOL>phasedlc0epoch = None<EOL><DEDENT>if (<NUM_LIT:0> in cpdict[key] and<EOL>isinstance(cpdict[key][<NUM_LIT:0>], dict) and<EOL>'<STR_LIT>' in cpdict[key][<NUM_LIT:0>] and<EOL>isinstance(cpdict[key][<NUM_LIT:0>]['<STR_LIT>'], dict)):<EOL><INDENT>phasedlc0fit = {<EOL>'<STR_LIT>':(<EOL>cpdict[key][<NUM_LIT:0>]['<STR_LIT>']['<STR_LIT>']<EOL>),<EOL>'<STR_LIT>':(<EOL>cpdict[key][<NUM_LIT:0>]['<STR_LIT>']['<STR_LIT>']<EOL>),<EOL>'<STR_LIT>':(<EOL>cpdict[key][<NUM_LIT:0>]['<STR_LIT>']['<STR_LIT>']<EOL>),<EOL>'<STR_LIT>':(<EOL>cpdict[key][<NUM_LIT:0>][<EOL>'<STR_LIT>'<EOL>]['<STR_LIT>']['<STR_LIT>'] if<EOL>'<STR_LIT>' in<EOL>cpdict[key][<NUM_LIT:0>]['<STR_LIT>']['<STR_LIT>'] else None<EOL>)<EOL>}<EOL><DEDENT>else:<EOL><INDENT>phasedlc0fit = None<EOL><DEDENT>if <NUM_LIT:1> in cpdict[key] and isinstance(cpdict[key][<NUM_LIT:1>], dict):<EOL><INDENT>phasedlc1plot = cpdict[key][<NUM_LIT:1>]['<STR_LIT>']<EOL>phasedlc1period = float(cpdict[key][<NUM_LIT:1>]['<STR_LIT>'])<EOL>phasedlc1epoch = float(cpdict[key][<NUM_LIT:1>]['<STR_LIT>'])<EOL><DEDENT>else:<EOL><INDENT>phasedlc1plot = None<EOL>phasedlc1period = None<EOL>phasedlc1epoch = None<EOL><DEDENT>if (<NUM_LIT:1> in cpdict[key] and<EOL>isinstance(cpdict[key][<NUM_LIT:1>], dict) and<EOL>'<STR_LIT>' in cpdict[key][<NUM_LIT:1>] and<EOL>isinstance(cpdict[key][<NUM_LIT:1>]['<STR_LIT>'], dict)):<EOL><INDENT>phasedlc1fit = {<EOL>'<STR_LIT>':(<EOL>cpdict[key][<NUM_LIT:1>]['<STR_LIT>']['<STR_LIT>']<EOL>),<EOL>'<STR_LIT>':(<EOL>cpdict[key][<NUM_LIT:1>]['<STR_LIT>']['<STR_LIT>']<EOL>),<EOL>'<STR_LIT>':(<EOL>cpdict[key][<NUM_LIT:1>]['<STR_LIT>']['<STR_LIT>']<EOL>),<EOL>'<STR_LIT>':(<EOL>cpdict[key][<NUM_LIT:1>][<EOL>'<STR_LIT>'<EOL>]['<STR_LIT>']['<STR_LIT>'] if<EOL>'<STR_LIT>' in<EOL>cpdict[key][<NUM_LIT:1>]['<STR_LIT>']['<STR_LIT>'] else None<EOL>)<EOL>}<EOL><DEDENT>else:<EOL><INDENT>phasedlc1fit = None<EOL><DEDENT>if <NUM_LIT:2> in cpdict[key] and isinstance(cpdict[key][<NUM_LIT:2>], dict):<EOL><INDENT>phasedlc2plot = cpdict[key][<NUM_LIT:2>]['<STR_LIT>']<EOL>phasedlc2period = float(cpdict[key][<NUM_LIT:2>]['<STR_LIT>'])<EOL>phasedlc2epoch = float(cpdict[key][<NUM_LIT:2>]['<STR_LIT>'])<EOL><DEDENT>else:<EOL><INDENT>phasedlc2plot = None<EOL>phasedlc2period = None<EOL>phasedlc2epoch = None<EOL><DEDENT>if (<NUM_LIT:2> in cpdict[key] and<EOL>isinstance(cpdict[key][<NUM_LIT:2>], dict) and<EOL>'<STR_LIT>' in cpdict[key][<NUM_LIT:2>] and<EOL>isinstance(cpdict[key][<NUM_LIT:2>]['<STR_LIT>'], dict)):<EOL><INDENT>phasedlc2fit = {<EOL>'<STR_LIT>':(<EOL>cpdict[key][<NUM_LIT:2>]['<STR_LIT>']['<STR_LIT>']<EOL>),<EOL>'<STR_LIT>':(<EOL>cpdict[key][<NUM_LIT:2>]['<STR_LIT>']['<STR_LIT>']<EOL>),<EOL>'<STR_LIT>':(<EOL>cpdict[key][<NUM_LIT:2>]['<STR_LIT>']['<STR_LIT>']<EOL>),<EOL>'<STR_LIT>':(<EOL>cpdict[key][<NUM_LIT:2>][<EOL>'<STR_LIT>'<EOL>]['<STR_LIT>']['<STR_LIT>'] if<EOL>'<STR_LIT>' in<EOL>cpdict[key][<NUM_LIT:2>]['<STR_LIT>']['<STR_LIT>'] else None<EOL>)<EOL>}<EOL><DEDENT>else:<EOL><INDENT>phasedlc2fit = None<EOL><DEDENT>resultdict['<STR_LIT:result>'][key] = {<EOL>'<STR_LIT>':cpdict[key]['<STR_LIT>'],<EOL>'<STR_LIT>':periodogram,<EOL>'<STR_LIT>':cpdict[key]['<STR_LIT>'],<EOL>'<STR_LIT>':{<EOL>'<STR_LIT>':phasedlc0plot,<EOL>'<STR_LIT>':phasedlc0period,<EOL>'<STR_LIT>':phasedlc0epoch,<EOL>'<STR_LIT>':phasedlc0fit,<EOL>},<EOL>'<STR_LIT>':{<EOL>'<STR_LIT>':phasedlc1plot,<EOL>'<STR_LIT>':phasedlc1period,<EOL>'<STR_LIT>':phasedlc1epoch,<EOL>'<STR_LIT>':phasedlc1fit,<EOL>},<EOL>'<STR_LIT>':{<EOL>'<STR_LIT>':phasedlc2plot,<EOL>'<STR_LIT>':phasedlc2period,<EOL>'<STR_LIT>':phasedlc2epoch,<EOL>'<STR_LIT>':phasedlc2fit,<EOL>},<EOL>}<EOL><DEDENT>self.set_header('<STR_LIT:Content-Type>','<STR_LIT>')<EOL>self.write(resultdict)<EOL>self.finish()<EOL><DEDENT>else:<EOL><INDENT>LOGGER.error('<STR_LIT>')<EOL>resultdict = {'<STR_LIT:status>':'<STR_LIT:error>',<EOL>'<STR_LIT:message>':"<STR_LIT>",<EOL>'<STR_LIT>':True,<EOL>'<STR_LIT:result>':None}<EOL>self.status(<NUM_LIT>)<EOL>self.write(resultdict)<EOL>self.finish()<EOL><DEDENT>
This handles GET requests.

        Returns the requested checkplot pickle's information as JSON.

        Requires a pre-shared secret `key` argument for the operation to
        complete successfully. This is obtained from a command-line argument.