예제 #1
0
 def process(self, _edPlugin=None):
     EDPluginExec.process(self, _edPlugin)
     self.DEBUG("EDPluginExecSimpleHTMLPagev1_0.process...")
     if self.xsDataResultCharacterisation is not None:
         # Create the simple characterisation result page
         self.page = markupv1_7.page(mode='loose_html')
         self.page.init( title="Characterisation Results", 
                    footer="Generated on %s" % time.asctime())
         self.page.div( align_="CENTER")
         self.page.h1()
         if self.xsDataResultCharacterisation is not None:
             self.page.strong( "Characterisation Results " )
         else:
             self.page.strong( "No Characterisation Results! " )
         # Link to the EDNA log file
         strPathToLogFile = self.findEDNALogFile()
         if strPathToLogFile is not None:
             self.page.strong("(")
             self.strPageEDNALog = os.path.join(self.getWorkingDirectory(), "edna_log.html")
             pageEDNALog = markupv1_7.page()
             pageEDNALog.h1("EDNA Log")
             pageEDNALog.a("Back to previous page", href_=self.strHtmlFileName)
             pageEDNALog.pre(cgi.escape(EDUtilsFile.readFile(strPathToLogFile)))
             pageEDNALog.a("Back to previous page", href_=self.strHtmlFileName)
             EDUtilsFile.writeFile(self.strPageEDNALog, str(pageEDNALog))
             self.page.a("EDNA log file", href_="edna_log.html")
             self.page.strong(")")
         self.page.h1.close()
         self.page.div.close()
         self.diffractionPlan()
         self.strategyResults()
         self.graphs()
         self.indexingResults()
         self.integrationResults()
         self.imageQualityIndicatorResults()
 def process(self, _edPlugin=None):
     EDPluginExec.process(self, _edPlugin)
     self.DEBUG("EDPluginExecSimpleHTMLPagev1_0.process...")
     if self.xsDataResultCharacterisation is not None:
         # Create the simple characterisation result page
         self.page = markupv1_7.page(mode='loose_html')
         self.page.init( title="Characterisation Results", 
                    footer="Generated on %s" % time.asctime())
         self.page.div( align_="CENTER")
         self.page.h1()
         if self.xsDataResultCharacterisation is not None:
             self.page.strong( "Characterisation Results " )
         else:
             self.page.strong( "No Characterisation Results! " )
         # Link to the EDNA log file
         strPathToLogFile = self.findEDNALogFile()
         if strPathToLogFile is not None:
             self.page.strong("(")
             self.strPageEDNALog = os.path.join(self.getWorkingDirectory(), "edna_log.html")
             pageEDNALog = markupv1_7.page()
             pageEDNALog.h1("EDNA Log")
             pageEDNALog.a("Back to previous page", href_=self.strHtmlFileName)
             pageEDNALog.pre(cgi.escape(EDUtilsFile.readFile(strPathToLogFile)))
             pageEDNALog.a("Back to previous page", href_=self.strHtmlFileName)
             EDUtilsFile.writeFile(self.strPageEDNALog, str(pageEDNALog))
             self.page.a("EDNA log file", href_="edna_log.html")
             self.page.strong(")")
         self.page.h1.close()
         self.page.div.close()
         self.diffractionPlan()
         self.strategyResults()
         self.graphs()
         self.indexingResults()
         self.integrationResults()
         self.imageQualityIndicatorResults()
예제 #3
0
 def integrationResults(self):
     # Was the integration successful?
     xsDataResultIntegration = self.xsDataResultCharacterisation.getIntegrationResult(
     )
     if xsDataResultIntegration:
         iIntegration = 1
         for xsDataIntegrationSubWedgeResult in xsDataResultIntegration.getIntegrationSubWedgeResult(
         ):
             strPathToIntegrationLogFile = xsDataIntegrationSubWedgeResult.getIntegrationLogFile(
             ).getPath().getValue()
             strIntegrationHtmlPageName = "integration_%d_log.html" % iIntegration
             strPageIntegrationLog = os.path.join(
                 self.getWorkingDirectory(), strIntegrationHtmlPageName)
             pageIntegrationLog = markupv1_7.page()
             pageIntegrationLog.h1("Integration Log No %d" % iIntegration)
             pageIntegrationLog.a("Back to previous page",
                                  href_=self.strHtmlFileName)
             pageIntegrationLog.pre(
                 cgi.escape(
                     EDUtilsFile.readFile(strPathToIntegrationLogFile)))
             pageIntegrationLog.a("Back to previous page",
                                  href_=self.strHtmlFileName)
             EDUtilsFile.writeFile(strPageIntegrationLog,
                                   str(pageIntegrationLog))
             self.page.a("Integration log file %d" % iIntegration,
                         href=strIntegrationHtmlPageName)
             self.page.br()
             iIntegration += 1
예제 #4
0
 def createThumbnailRowOfImages(self, _xsDataResultIndexing):
     # Thumbnail images of the predictions
     xsDataResultPrediction = _xsDataResultIndexing.getPredictionResult()
     listPaths = []
     self.page.div(align_="left")
     self.page.table(class_='imageRow')
     self.page.tr(align_="CENTER")
     listXSDataReferenceImage = _xsDataResultIndexing.getImage()
     for xsDataImagePrediction in xsDataResultPrediction.getPredictionImage(
     ):
         self.page.td()
         strPathToPredictionImage = xsDataImagePrediction.getPath(
         ).getValue()
         strFileName = os.path.basename(strPathToPredictionImage)
         strReferenceFileName = None
         for xsDataReferenceImage in listXSDataReferenceImage:
             if xsDataReferenceImage.getNumber().getValue(
             ) == xsDataImagePrediction.getNumber().getValue():
                 strReferenceFileName = os.path.basename(
                     xsDataReferenceImage.getPath().getValue())
         if strReferenceFileName is None:
             strReferenceFileName = strFileName
         strLocalPath = os.path.join(self.getWorkingDirectory(),
                                     strFileName)
         shutil.copyfile(strPathToPredictionImage, strLocalPath)
         listPaths.append(strLocalPath)
         self.page.table(class_='image')
         self.page.tr(align_="CENTER")
         self.page.td()
         strPageReferenceImage = os.path.splitext(strFileName)[0] + ".html"
         pageReferenceImage = markupv1_7.page()
         pageReferenceImage.init(title=strReferenceFileName,
                                 footer="Generated on %s" % time.asctime())
         pageReferenceImage.h1(strReferenceFileName)
         pageReferenceImage.a("Back to previous page",
                              href_=self.strHtmlFileName)
         pageReferenceImage.img(src=strFileName, title=strReferenceFileName)
         pageReferenceImage.a("Back to previous page",
                              href_=self.strHtmlFileName)
         EDUtilsFile.writeFile(
             os.path.join(self.getWorkingDirectory(),
                          strPageReferenceImage), str(pageReferenceImage))
         self.page.a(href=strPageReferenceImage)
         self.page.img(src=strFileName,
                       width=128,
                       height=128,
                       title=strFileName)
         self.page.a.close()
         self.page.td.close()
         self.page.tr.close()
         self.page.tr(align_="CENTER")
         self.page.td(strReferenceFileName, class_="caption")
         self.page.td.close()
         self.page.tr.close()
         self.page.table.close()
         self.page.td.close()
     self.page.table.close()
     self.page.div.close()
예제 #5
0
 def createTableWithIndexResults(self, _xsDataResultIndexing,
                                 _strForcedSpaceGroup):
     xsDataSolutionSelected = _xsDataResultIndexing.getSelectedSolution()
     xsDataCrystal = xsDataSolutionSelected.getCrystal()
     xsDataCell = xsDataCrystal.getCell()
     strSpaceGroup = xsDataCrystal.spaceGroup.name.value
     if _strForcedSpaceGroup is None:
         self.page.h3("Indexing summary: Selected spacegroup: %s" %
                      strSpaceGroup)
     else:
         if strSpaceGroup.upper() == _strForcedSpaceGroup.upper():
             self.page.h3("Indexing summary: Forced spacegroup: %s" %
                          strSpaceGroup)
         else:
             self.page.h3(
                 "Indexing summary: Selected spacegroup: %s, forced space group: %s"
                 % strSpaceGroup, _strForcedSpaceGroup)
     self.page.table(class_='indexResults', border_="1", cellpadding_="0")
     self.page.tr(align_="CENTER", bgcolor_=self.strTableColourTitle1)
     self.page.th("Refined unit cell parameters (Å/degrees)",
                  colspan_="6")
     self.page.tr.close()
     self.page.tr(align_="CENTER", bgcolor_=self.strTableColourTitle2)
     self.page.th("a (Å)")
     self.page.th("b (Å)")
     self.page.th("c (Å)")
     self.page.th("alpha (°)")
     self.page.th("beta (°)")
     self.page.th("gamma (°)")
     self.page.tr.close()
     self.page.tr(align_="CENTER", bgcolor_=self.strTableColourRows)
     self.page.td("%.3f" % xsDataCell.getLength_a().getValue())
     self.page.td("%.3f" % xsDataCell.getLength_b().getValue())
     self.page.td("%.3f" % xsDataCell.getLength_c().getValue())
     self.page.td("%.3f" % xsDataCell.getAngle_alpha().getValue())
     self.page.td("%.3f" % xsDataCell.getAngle_beta().getValue())
     self.page.td("%.3f" % xsDataCell.getAngle_gamma().getValue())
     self.page.td.close()
     self.page.tr.close()
     self.page.table.close()
     if _xsDataResultIndexing.getIndexingLogFile():
         strPathToIndexingLogFile = _xsDataResultIndexing.getIndexingLogFile(
         ).getPath().getValue()
         strPageIndexingLog = os.path.join(self.getWorkingDirectory(),
                                           "indexing_log.html")
         pageIndexingLog = markupv1_7.page()
         pageIndexingLog.h1("Indexing Log")
         pageIndexingLog.a("Back to previous page",
                           href_=self.strHtmlFileName)
         pageIndexingLog.pre(
             cgi.escape(EDUtilsFile.readFile(strPathToIndexingLogFile)))
         pageIndexingLog.a("Back to previous page",
                           href_=self.strHtmlFileName)
         EDUtilsFile.writeFile(strPageIndexingLog, str(pageIndexingLog))
         self.page.a("Indexing log file", href="indexing_log.html")
예제 #6
0
 def graphs(self):
     self.page.table(class_='bestGraphs', border_="0", cellpadding_="0")
     if self.getDataInput().characterisationResult.strategyResult is None:
         return
     if self.getDataInput(
     ).characterisationResult.strategyResult.bestGraphFile == []:
         return
     listXSDataFile = self.getDataInput(
     ).characterisationResult.strategyResult.bestGraphFile
     if listXSDataFile != []:
         self.page.tr(align_="CENTER")
         iIndex = 1
         # If -damPar is used only three plots are available:
         if len(listXSDataFile) > 4:
             listPlotsToDisplay = [0, 1, 3, 6]
         else:
             listPlotsToDisplay = range(len(listXSDataFile))
         for iIndexPlot in listPlotsToDisplay:
             xsDataFile = listXSDataFile[iIndexPlot]
             strFileName = os.path.basename(xsDataFile.path.value)
             #print strFileName
             shutil.copy(
                 xsDataFile.path.value,
                 os.path.join(self.getWorkingDirectory(), strFileName))
             self.page.td()
             strPageGraphFileName = os.path.splitext(
                 strFileName)[0] + ".html"
             strPageGraphPath = os.path.join(self.getWorkingDirectory(),
                                             strPageGraphFileName)
             pageGraph = markupv1_7.page()
             pageGraph.init(title=strFileName,
                            footer="Generated on %s" % time.asctime())
             pageGraph.h1(strFileName)
             pageGraph.a("Back to previous page",
                         href_=self.strHtmlFileName)
             pageGraph.br()
             pageGraph.img(src=strFileName, title=strFileName)
             pageGraph.a("Back to previous page",
                         href_=self.strHtmlFileName)
             EDUtilsFile.writeFile(strPageGraphPath, str(pageGraph))
             self.page.a(href=strPageGraphFileName)
             self.page.img(src=strFileName,
                           width=175,
                           height=175,
                           title=strFileName)
             self.page.a.close()
             self.page.td.close()
             iIndex += 1
             if iIndex > 4:
                 iIndex = 1
                 self.page.tr.close()
                 self.page.tr(align_="CENTER")
         self.page.tr.close()
         self.page.table.close()
예제 #7
0
 def createHtmlPage(self):
     page = markupv1_7.page(mode='loose_html')
     page.init( title="Burn Strategy Results", 
                     footer="Generated on %s" % time.asctime())
     page.div( align_="CENTER")
     page.h1()
     page.strong("Burn Strategy  Results")
     page.h1.close()
     page.img(src=self.strScaleIntensityPlot, title=self.strScaleIntensityPlot)
     page.div.close()
     strHTML = str(page)
     EDUtilsFile.writeFile(os.path.join(self.getWorkingDirectory(), self.strHtmlPath), strHTML)
예제 #8
0
 def createHtmlPage(self):
     page = markupv1_7.page(mode='loose_html')
     page.init(title="Burn Strategy Results",
               footer="Generated on %s" % time.asctime())
     page.div(align_="CENTER")
     page.h1()
     page.strong("Burn Strategy  Results")
     page.h1.close()
     page.img(src=self.strScaleIntensityPlot,
              title=self.strScaleIntensityPlot)
     page.div.close()
     strHTML = str(page)
     EDUtilsFile.writeFile(
         os.path.join(self.getWorkingDirectory(), self.strHtmlPath),
         strHTML)
 def createThumbnailRowOfImages(self, _xsDataResultIndexing):
     # Thumbnail images of the predictions
     xsDataResultPrediction = _xsDataResultIndexing.getPredictionResult()
     listPaths = []
     self.page.div(align_="left")
     self.page.table( class_='imageRow' )
     self.page.tr( align_="CENTER" )
     listXSDataReferenceImage = _xsDataResultIndexing.getImage()
     for xsDataImagePrediction in xsDataResultPrediction.getPredictionImage():
         self.page.td()
         strPathToPredictionImage = xsDataImagePrediction.getPath().getValue()
         strFileName = os.path.basename(strPathToPredictionImage)
         strReferenceFileName = None
         for xsDataReferenceImage in listXSDataReferenceImage:
             if xsDataReferenceImage.getNumber().getValue() == xsDataImagePrediction.getNumber().getValue():
                 strReferenceFileName = os.path.basename(xsDataReferenceImage.getPath().getValue())
         if strReferenceFileName is None:
             strReferenceFileName = strFileName
         strLocalPath = os.path.join(self.getWorkingDirectory(), strFileName)
         if os.path.exists(strPathToPredictionImage):
             shutil.copyfile(strPathToPredictionImage, strLocalPath)
             listPaths.append(strLocalPath)
             self.page.table( class_='image' )
             self.page.tr( align_="CENTER" )
             self.page.td()
             strPageReferenceImage = os.path.splitext(strFileName)[0]+".html"
             pageReferenceImage = markupv1_7.page()
             pageReferenceImage.init( title=strReferenceFileName, 
                    footer="Generated on %s" % time.asctime())
             pageReferenceImage.h1(strReferenceFileName)
             pageReferenceImage.a("Back to previous page", href_=self.strHtmlFileName)
             pageReferenceImage.img(src=strFileName, title=strReferenceFileName)
             pageReferenceImage.a("Back to previous page", href_=self.strHtmlFileName)
             EDUtilsFile.writeFile(os.path.join(self.getWorkingDirectory(),strPageReferenceImage), str(pageReferenceImage))
             self.page.a( href=strPageReferenceImage)
             self.page.img( src=strFileName, width=128, height=128, title=strFileName )
             self.page.a.close()
             self.page.td.close()
             self.page.tr.close()
             self.page.tr( align_="CENTER" )
             self.page.td( strReferenceFileName, class_="caption")
             self.page.td.close()
             self.page.tr.close()
             self.page.table.close()
             self.page.td.close()
     self.page.table.close()
     self.page.div.close()
예제 #10
0
 def createTableWithIndexResults(self, _xsDataResultIndexing, _strForcedSpaceGroup):
     xsDataSolutionSelected = _xsDataResultIndexing.getSelectedSolution()
     xsDataCrystal = xsDataSolutionSelected.getCrystal()
     xsDataCell = xsDataCrystal.getCell()
     strSpaceGroup = xsDataCrystal.spaceGroup.name.value
     if _strForcedSpaceGroup is None:
         self.page.h3("Indexing summary: Selected spacegroup: %s" % strSpaceGroup)
     else:
         if strSpaceGroup.upper() == _strForcedSpaceGroup.upper():
             self.page.h3("Indexing summary: Forced spacegroup: %s" % strSpaceGroup)
         else:
             self.page.h3(
                 "Indexing summary: Selected spacegroup: %s, forced space group: %s" % strSpaceGroup,
                 _strForcedSpaceGroup,
             )
     self.page.table(class_="indexResults", border_="1", cellpadding_="0")
     self.page.tr(align_="CENTER", bgcolor_=self.strTableColourTitle1)
     self.page.th("Refined unit cell parameters (Å/degrees)", colspan_="6")
     self.page.tr.close()
     self.page.tr(align_="CENTER", bgcolor_=self.strTableColourTitle2)
     self.page.th("a (Å)")
     self.page.th("b (Å)")
     self.page.th("c (Å)")
     self.page.th("alpha (°)")
     self.page.th("beta (°)")
     self.page.th("gamma (°)")
     self.page.tr.close()
     self.page.tr(align_="CENTER", bgcolor_=self.strTableColourRows)
     self.page.td("%.3f" % xsDataCell.getLength_a().getValue())
     self.page.td("%.3f" % xsDataCell.getLength_b().getValue())
     self.page.td("%.3f" % xsDataCell.getLength_c().getValue())
     self.page.td("%.3f" % xsDataCell.getAngle_alpha().getValue())
     self.page.td("%.3f" % xsDataCell.getAngle_beta().getValue())
     self.page.td("%.3f" % xsDataCell.getAngle_gamma().getValue())
     self.page.td.close()
     self.page.tr.close()
     self.page.table.close()
     if _xsDataResultIndexing.getIndexingLogFile():
         strPathToIndexingLogFile = _xsDataResultIndexing.getIndexingLogFile().getPath().getValue()
         strPageIndexingLog = os.path.join(self.getWorkingDirectory(), "indexing_log.html")
         pageIndexingLog = markupv1_7.page()
         pageIndexingLog.h1("Indexing Log")
         pageIndexingLog.a("Back to previous page", href_=self.strHtmlFileName)
         pageIndexingLog.pre(cgi.escape(EDUtilsFile.readFile(strPathToIndexingLogFile)))
         pageIndexingLog.a("Back to previous page", href_=self.strHtmlFileName)
         EDUtilsFile.writeFile(strPageIndexingLog, str(pageIndexingLog))
         self.page.a("Indexing log file", href="indexing_log.html")
 def integrationResults(self):
     # Was the integration successful?
     xsDataResultIntegration = self.xsDataResultCharacterisation.getIntegrationResult()
     if xsDataResultIntegration:
         iIntegration = 1
         for xsDataIntegrationSubWedgeResult in xsDataResultIntegration.getIntegrationSubWedgeResult():
             strPathToIntegrationLogFile = xsDataIntegrationSubWedgeResult.getIntegrationLogFile().getPath().getValue()
             strIntegrationHtmlPageName = "integration_%d_log.html" % iIntegration
             strPageIntegrationLog = os.path.join(self.getWorkingDirectory(), strIntegrationHtmlPageName)
             pageIntegrationLog = markupv1_7.page()
             pageIntegrationLog.h1("Integration Log No %d" % iIntegration)
             pageIntegrationLog.a("Back to previous page", href_=self.strHtmlFileName)
             pageIntegrationLog.pre(cgi.escape(EDUtilsFile.readFile(strPathToIntegrationLogFile)))
             pageIntegrationLog.a("Back to previous page", href_=self.strHtmlFileName)
             EDUtilsFile.writeFile(strPageIntegrationLog, str(pageIntegrationLog))
             self.page.a("Integration log file %d" % iIntegration, href=strIntegrationHtmlPageName) 
             self.page.br()
             iIntegration += 1               
 def graphs(self):
     self.page.table( class_='bestGraphs', border_="0", cellpadding_="0")
     if self.xsDataResultCharacterisation.strategyResult is None:
         return
     if self.xsDataResultCharacterisation.strategyResult.bestGraphFile == []:
         return
     listXSDataFile = self.xsDataResultCharacterisation.strategyResult.bestGraphFile
     if listXSDataFile != []:
         self.page.tr( align_="CENTER" )
         iIndex = 1
         # If -damPar is used only three plots are available:
         if len(listXSDataFile) >= 7:
             listPlotsToDisplay = [0, 1, 3, 6]
         elif len(listXSDataFile) >= 4:
             listPlotsToDisplay = [0, 1, 2, 3]
         else:
             listPlotsToDisplay = range(len(listXSDataFile))
         for iIndexPlot in listPlotsToDisplay:
             xsDataFile = listXSDataFile[iIndexPlot]
             strFileName = os.path.basename(xsDataFile.path.value)
             #print strFileName
             shutil.copy(xsDataFile.path.value, os.path.join(self.getWorkingDirectory(), strFileName))
             self.page.td()
             strPageGraphFileName = os.path.splitext(strFileName)[0]+".html"
             strPageGraphPath = os.path.join(self.getWorkingDirectory(), strPageGraphFileName)
             pageGraph = markupv1_7.page()
             pageGraph.init( title=strFileName, 
                    footer="Generated on %s" % time.asctime())
             pageGraph.img(src=strFileName, title=strFileName)
             pageGraph.br()
             pageGraph.a("Back to previous page", href_=self.strHtmlFileName)
             EDUtilsFile.writeFile(strPageGraphPath, str(pageGraph))
             self.page.a( href=strPageGraphFileName)
             self.page.img( src=strFileName, width=200, height=150, title=strFileName )
             self.page.a.close()
             self.page.td.close()
             iIndex += 1
             if iIndex > 4:
                 iIndex = 1
                 self.page.tr.close()
                 self.page.tr( align_="CENTER" )
         self.page.tr.close()
         self.page.table.close()
예제 #13
0
 def strategyResults(self):
     # Was the strategy successful?
     xsDataResultStrategy = self.xsDataResultCharacterisation.getStrategyResult()
     if xsDataResultStrategy is None:
         # Check if indexing and integration results
         xsDataResultIntegration = self.xsDataResultCharacterisation.getIntegrationResult()
         xsDataResultIndexing = self.xsDataResultCharacterisation.getIndexingResult()
         if xsDataResultIndexing is None:
             self.page.h2()
             self.page.strong("Strategy calculation not performed due to indexing failure, see the " )  
             self.page.a("EDNA log file", href=self.strPageEDNALog)
             self.page.strong(" for more details" )  
             self.page.h2.close()
         elif xsDataResultIntegration is None:
             self.page.h2()
             self.page.strong("Strategy calculation not performed due to integration failure, see the " )  
             self.page.a("EDNA log file", href=self.strPageEDNALog)
             self.page.strong(" for more details" )  
             self.page.h2.close()
         else:
             self.page.h2()
             self.page.strong( "Strategy calculation failed, see the " )
             self.page.a("EDNA log file", href=self.strPageEDNALog)
             self.page.strong(" for more details" )  
             self.page.h2.close()
     else:
         # Add link to BEST log file:
         if xsDataResultStrategy.getBestLogFile():
             strPathToBestLogFile = xsDataResultStrategy.getBestLogFile().getPath().getValue()
             strPageBestLog = os.path.join(self.getWorkingDirectory(), "best_log.html")
             pageBestLog = markupv1_7.page()
             pageBestLog.h1("BEST Log")
             pageBestLog.a("Back to previous page", href_=self.strHtmlFileName)
             pageBestLog.pre(cgi.escape(EDUtilsFile.readFile(strPathToBestLogFile)))
             pageBestLog.a("Back to previous page", href_=self.strHtmlFileName)
             EDUtilsFile.writeFile(strPageBestLog, str(pageBestLog))
         # Add link to RADDOSE log file:
         strPageRaddoseLog = None
         if xsDataResultStrategy.getRaddoseLogFile():
             strPathToRaddoseLogFile = xsDataResultStrategy.getRaddoseLogFile().getPath().getValue()
             strPageRaddoseLog = os.path.join(self.getWorkingDirectory(), "raddose_log.html")
             pageRaddoseLog = markupv1_7.page()
             pageRaddoseLog.h1("RADDOSE Log")
             pageRaddoseLog.a("Back to previous page", href_=self.strHtmlFileName)
             pageRaddoseLog.pre(cgi.escape(EDUtilsFile.readFile(strPathToRaddoseLogFile)))
             pageRaddoseLog.a("Back to previous page", href_=self.strHtmlFileName)
             EDUtilsFile.writeFile(strPageRaddoseLog, str(pageRaddoseLog))
         listXSDataCollectionPlan = xsDataResultStrategy.getCollectionPlan()
         iNoSubWedges = len(listXSDataCollectionPlan)
         self.page.h2()
         if iNoSubWedges != 1:
             self.page.strong("Multi-wedge collection plan strategy (")
         else:
             self.page.strong( "Collection plan strategy (" )
         if strPageRaddoseLog is not None:
             self.page.a("RADDOSE log file", href="raddose_log.html")
             self.page.strong(", ")
         self.page.a("BEST log file", href="best_log.html")
         self.page.strong(")")
         self.page.h2.close()
         # Check if ranking resolution is higher than the suggested strategy resolution(s)
         bHigherResolutionDetected = False
         fRankingResolution = None
         fResolutionMax = None
         fDistanceMin = None
         for xsDataCollectionPlan in listXSDataCollectionPlan:
             xsDataSummaryStrategy = xsDataCollectionPlan.getStrategySummary()
             xsDataCollectionStrategy = xsDataCollectionPlan.getCollectionStrategy()
             if xsDataSummaryStrategy.getRankingResolution():
                 # Retrieve the resolution...
                 fResolution = xsDataSummaryStrategy.getResolution().getValue()
                 # Retrieve the detector distance...
                 fDistance = xsDataCollectionStrategy.getSubWedge()[0].getExperimentalCondition().getDetector().getDistance().getValue()
                 if fResolutionMax is None:
                     fResolutionMax = fResolution
                     fDistanceMin = fDistance
                 elif (fResolution < fResolutionMax) and (abs(fResolution-fResolutionMax) > 0.1):
                     fResolutionMax = fResolution                        
                     fDistanceMin = fDistance
                 fRankingResolution = xsDataSummaryStrategy.getRankingResolution().getValue()
         
         if fRankingResolution != None and fResolutionMax != None:
             if fRankingResolution < fResolutionMax:
                 if not bHigherResolutionDetected:
                     self.page.font(_color="red", size="+2")
                     self.page.i()
                     self.page.h2("Best has detected that the sample can diffract to %.2f &Aring;!" % fRankingResolution)
                     self.page.i.close()
                     self.page.font.close()
                     self.page.font(_color="red", size="+1")
                     self.page.strong("The current strategy is calculated to %.2f &Aring;." % fResolutionMax)
                     #self.page.strong("In order to calculate a strategy to %.2f &Aring; set the detector distance to %.2f mm (%.2f &Aring;) and re-launch the EDNA characterisation." % (fRankingResolution,fDistanceMin,fRankingResolution))
                     self.page.strong("In order to calculate a strategy to %.2f &Aring; move the detector to collect %.2f &Aring; data and re-launch the EDNA characterisation." % (fRankingResolution,fRankingResolution))
                     self.page.font.close()
                 bHigherResolutionDetected = True
             
             
         for xsDataCollectionPlan in listXSDataCollectionPlan:
             xsDataSummaryStrategy = xsDataCollectionPlan.getStrategySummary()
             fResolutionMax = xsDataSummaryStrategy.getResolution().getValue()
             strResolutionReasoning = ""
             if xsDataSummaryStrategy.getResolutionReasoning():
                 strResolutionReasoning = xsDataSummaryStrategy.getResolutionReasoning().getValue()
             self.page.table( class_='indexResults', border_="1", cellpadding_="0")
             self.page.tr( align_="CENTER" )
             self.page.th(strResolutionReasoning, colspan_="9", bgcolor_=self.strTableColourTitle1)
             self.page.tr.close()
             self.page.tr( align_="CENTER", bgcolor_=self.strTableColourTitle2)
             self.page.th("Wedge")
             self.page.th("Subwedge")
             self.page.th("Start (&deg;)")
             self.page.th("Width (&deg;)")
             self.page.th("No images")
             self.page.th("Exp time (s)")
             self.page.th("Max res (&Aring;)")
             self.page.th("Rel trans (%)")
             self.page.th("Distance (mm)")
             self.page.tr.close()
             xsDataCollectionStrategy = xsDataCollectionPlan.getCollectionStrategy()
             for xsDataSubWegde in xsDataCollectionStrategy.getSubWedge():
                 xsDataExperimentalCondition = xsDataSubWegde.getExperimentalCondition()
                 iWedge = xsDataCollectionPlan.getCollectionPlanNumber().getValue()
                 iRunNumber = xsDataSubWegde.getSubWedgeNumber().getValue()
                 fRotationAxisStart = xsDataExperimentalCondition.getGoniostat().getRotationAxisStart().getValue()
                 fRotationAxisEnd = xsDataExperimentalCondition.getGoniostat().getRotationAxisEnd().getValue()
                 fOscillationWidth = xsDataExperimentalCondition.getGoniostat().getOscillationWidth().getValue()
                 iNumberOfImages = int((fRotationAxisEnd-fRotationAxisStart)/fOscillationWidth)
                 fExposureTime = xsDataExperimentalCondition.getBeam().getExposureTime().getValue()
                 fTransmission = xsDataExperimentalCondition.getBeam().getTransmission().getValue()
                 fDistance = xsDataExperimentalCondition.getDetector().getDistance().getValue()
                 self.page.tr( align_="CENTER", bgcolor_=self.strTableColourRows)
                 self.page.th(iWedge)
                 self.page.th(iRunNumber)
                 self.page.th("%.2f" % fRotationAxisStart)
                 self.page.th("%.2f" % fOscillationWidth)
                 self.page.th(iNumberOfImages)
                 self.page.th("%.2f" % fExposureTime)
                 self.page.th("%.2f" % fResolutionMax)
                 self.page.th("%.2f" % fTransmission)
                 self.page.th("%.2f" % fDistance)
                 self.page.tr.close()
             self.page.table.close()
 def strategyResults(self):
     # Was the strategy successful?
     xsDataResultStrategy = self.xsDataResultCharacterisation.getStrategyResult()
     if xsDataResultStrategy is None:
         # Check if indexing and integration results
         xsDataResultIntegration = self.xsDataResultCharacterisation.getIntegrationResult()
         xsDataResultIndexing = self.xsDataResultCharacterisation.getIndexingResult()
         if xsDataResultIndexing is None:
             self.page.font(_color="red", size="+2")
             self.page.h2()
             self.page.strong("Strategy calculation not performed due to indexing failure, see the " )  
             self.page.a("EDNA log file", href=self.strPageEDNALog)
             self.page.strong(" for more details" )  
             self.page.h2.close()
             self.page.font.close()                
         elif xsDataResultIntegration is None:
             self.page.font(_color="red", size="+2")
             self.page.h2()
             self.page.strong("Strategy calculation not performed due to integration failure, see the " )  
             self.page.a("EDNA log file", href=self.strPageEDNALog)
             self.page.strong(" for more details" )  
             self.page.h2.close()
             self.page.font.close()                
         else:
             self.page.font(_color="red", size="+2")
             self.page.h2()
             self.page.strong( "Strategy calculation failed, see the " )
             self.page.a("EDNA log file", href=self.strPageEDNALog)
             self.page.strong(" for more details" )  
             self.page.h2.close()
             self.page.font.close()                
     else:
         # Add link to BEST log file:
         if xsDataResultStrategy.getBestLogFile():
             strPathToBestLogFile = xsDataResultStrategy.getBestLogFile().getPath().getValue()
             if os.path.exists(strPathToBestLogFile):
                 strPageBestLog = os.path.join(self.getWorkingDirectory(), "best_log.html")
                 pageBestLog = markupv1_7.page()
                 pageBestLog.h1("BEST Log")
                 pageBestLog.a("Back to previous page", href_=self.strHtmlFileName)
                 pageBestLog.pre(cgi.escape(EDUtilsFile.readFile(strPathToBestLogFile)))
                 pageBestLog.a("Back to previous page", href_=self.strHtmlFileName)
                 EDUtilsFile.writeFile(strPageBestLog, str(pageBestLog))
         # Add link to RADDOSE log file:
         strPageRaddoseLog = None
         if xsDataResultStrategy.getRaddoseLogFile():
             strPathToRaddoseLogFile = xsDataResultStrategy.getRaddoseLogFile().getPath().getValue()
             strPageRaddoseLog = os.path.join(self.getWorkingDirectory(), "raddose_log.html")
             if os.path.exists(strPathToRaddoseLogFile):
                 pageRaddoseLog = markupv1_7.page()
                 pageRaddoseLog.h1("RADDOSE Log")
                 pageRaddoseLog.a("Back to previous page", href_=self.strHtmlFileName)
                 pageRaddoseLog.pre(cgi.escape(EDUtilsFile.readFile(strPathToRaddoseLogFile)))
                 pageRaddoseLog.a("Back to previous page", href_=self.strHtmlFileName)
                 EDUtilsFile.writeFile(strPageRaddoseLog, str(pageRaddoseLog))
         listXSDataCollectionPlan = xsDataResultStrategy.getCollectionPlan()
         if listXSDataCollectionPlan == []:
             self.page.font(_color="red", size="+2")
             self.page.h2()
             self.page.strong("Strategy calculation failed, see the ")
             self.page.a("BEST log file", href="best_log.html")
             self.page.strong(" for more details")
             if strPageRaddoseLog is not None:
                 self.page.a(" (RADDOSE log file)", href="raddose_log.html")
             self.page.h2.close()
             self.page.font.close()                
         else:
             iNoSubWedges = len(listXSDataCollectionPlan)
             self.page.h2()
             if iNoSubWedges != 1:
                 self.page.strong("Multi-wedge collection plan strategy (")
             else:
                 self.page.strong( "Collection plan strategy (" )
             if strPageRaddoseLog is not None:
                 self.page.a("RADDOSE log file", href="raddose_log.html")
                 self.page.strong(", ")
             self.page.a("BEST log file", href="best_log.html")
             self.page.strong(")")
             self.page.h2.close()
             # Check if ranking resolution is higher than the suggested strategy resolution(s)
             bHigherResolutionDetected = False
             fRankingResolution = None
             fResolutionMax = None
             fDistanceMin = None
             for xsDataCollectionPlan in listXSDataCollectionPlan:
                 xsDataSummaryStrategy = xsDataCollectionPlan.getStrategySummary()
                 xsDataCollectionStrategy = xsDataCollectionPlan.getCollectionStrategy()
                 if xsDataSummaryStrategy.getRankingResolution():
                     # Retrieve the resolution...
                     fResolution = xsDataSummaryStrategy.getResolution().getValue()
                     # Retrieve the detector distance...
                     fDistance = xsDataCollectionStrategy.getSubWedge()[0].getExperimentalCondition().getDetector().getDistance().getValue()
                     if fResolutionMax is None:
                         fResolutionMax = fResolution
                         fDistanceMin = fDistance
                     elif (fResolution < fResolutionMax) and (abs(fResolution-fResolutionMax) > 0.1):
                         fResolutionMax = fResolution                        
                         fDistanceMin = fDistance
                     fRankingResolution = xsDataSummaryStrategy.getRankingResolution().getValue()
             
             if fRankingResolution != None and fResolutionMax != None:
                 if fRankingResolution < fResolutionMax:
                     if not bHigherResolutionDetected:
                         self.page.font(_color="red", size="+2")
                         self.page.i()
                         self.page.h2("Best has detected that the sample can diffract to %.2f &Aring;!" % fRankingResolution)
                         self.page.i.close()
                         self.page.font.close()
                         self.page.font(_color="red", size="+1")
                         self.page.strong("The current strategy is calculated to %.2f &Aring;." % fResolutionMax)
                         #self.page.strong("In order to calculate a strategy to %.2f &Aring; set the detector distance to %.2f mm (%.2f &Aring;) and re-launch the EDNA characterisation." % (fRankingResolution,fDistanceMin,fRankingResolution))
                         self.page.strong("In order to calculate a strategy to %.2f &Aring; move the detector to collect %.2f &Aring; data and re-launch the EDNA characterisation." % (fRankingResolution,fRankingResolution))
                         self.page.font.close()
                     bHigherResolutionDetected = True
                 
                 
             for xsDataCollectionPlan in listXSDataCollectionPlan:
                 xsDataSummaryStrategy = xsDataCollectionPlan.getStrategySummary()
                 fResolutionMax = xsDataSummaryStrategy.getResolution().getValue()
                 strResolutionReasoning = ""
                 if xsDataSummaryStrategy.getResolutionReasoning():
                     strResolutionReasoning = xsDataSummaryStrategy.getResolutionReasoning().getValue()
                 self.page.table( class_='indexResults', border_="1", cellpadding_="0")
                 self.page.tr( align_="CENTER" )
                 self.page.th(strResolutionReasoning, colspan_="9", bgcolor_=self.strTableColourTitle1)
                 self.page.tr.close()
                 self.page.tr( align_="CENTER", bgcolor_=self.strTableColourTitle2)
                 self.page.th("Wedge")
                 self.page.th("Subwedge")
                 self.page.th("Start (&deg;)")
                 self.page.th("Width (&deg;)")
                 self.page.th("No images")
                 self.page.th("Exp time (s)")
                 self.page.th("Max res (&Aring;)")
                 self.page.th("Rel trans (%)")
                 self.page.th("Distance (mm)")
                 self.page.tr.close()
                 xsDataCollectionStrategy = xsDataCollectionPlan.getCollectionStrategy()
                 for xsDataSubWegde in xsDataCollectionStrategy.getSubWedge():
                     xsDataExperimentalCondition = xsDataSubWegde.getExperimentalCondition()
                     iWedge = xsDataCollectionPlan.getCollectionPlanNumber().getValue()
                     iRunNumber = xsDataSubWegde.getSubWedgeNumber().getValue()
                     fRotationAxisStart = xsDataExperimentalCondition.getGoniostat().getRotationAxisStart().getValue()
                     fRotationAxisEnd = xsDataExperimentalCondition.getGoniostat().getRotationAxisEnd().getValue()
                     fOscillationWidth = xsDataExperimentalCondition.getGoniostat().getOscillationWidth().getValue()
                     iNumberOfImages = int((fRotationAxisEnd-fRotationAxisStart)/fOscillationWidth)
                     fExposureTime = xsDataExperimentalCondition.getBeam().getExposureTime().getValue()
                     fTransmission = xsDataExperimentalCondition.getBeam().getTransmission().getValue()
                     fDistance = xsDataExperimentalCondition.getDetector().getDistance().getValue()
                     self.page.tr( align_="CENTER", bgcolor_=self.strTableColourRows)
                     self.page.th(iWedge)
                     self.page.th(iRunNumber)
                     self.page.th("%.2f" % fRotationAxisStart)
                     self.page.th("%.2f" % fOscillationWidth)
                     self.page.th(iNumberOfImages)
                     self.page.th("%.2f" % fExposureTime)
                     self.page.th("%.2f" % fResolutionMax)
                     self.page.th("%.2f" % fTransmission)
                     self.page.th("%.2f" % fDistance)
                     self.page.tr.close()
                 self.page.table.close()