def functionXMLout(_strXMLin, _strXMLout):
    """
    This is an example of XMLout function ... it prints only the name of the file created
    @param _srXMLin: The XML string used to launch the job
    @type _strXMLin: python string with the input XML
    @param _strXMLout: The XML string retrieved  job
    @type _strXMLout: python string with the output XML    
    @return: None     
    """
    xsDataInputGridScreening = XSDataInputGridScreening.parseString(_strXMLin)
    strImagePath = xsDataInputGridScreening.getImageFile().getPath().getValue()
    EDVerbose.screen("Successful processing of image %s" % strImagePath)
    strResultText = "%40s  " % os.path.basename(strImagePath)
    xsDataResultGridScreening = XSDataResultGridScreening.parseString(_strXMLout)
    fileNameParameters = xsDataResultGridScreening.getFileNameParameters()
    if fileNameParameters is None:
        strResultText += "%6s%10s%10s%6s" % ("NA", "NA", "NA","NA")
    else:
        strResultText += "%6s%10s%10s%6s" % (
                        fileNameParameters.getScanId1().getValue(),
                        fileNameParameters.getMotorPosition1().getValue(),
                        fileNameParameters.getMotorPosition2().getValue(),
                        fileNameParameters.getScanId2().getValue(),
                                                )
    imageQualityIndicators = xsDataResultGridScreening.getImageQualityIndicators()
    if imageQualityIndicators is None:
        strResultText += "%6s%6s%6s%6s%10s" % ("NA", "NA", "NA","NA", "NA")
    else:
        strMethod1Res = "%6s" % "NA"
        if imageQualityIndicators.getMethod1Res():
            strMethod1Res = "%6.1f" % imageQualityIndicators.getMethod1Res().getValue()
        strMethod2Res = "%6s" % "NA"
        if imageQualityIndicators.getMethod2Res():
            strMethod2Res = "%6.1f" % imageQualityIndicators.getMethod2Res().getValue()
        strSpotTotal = "%6s" % "NA"
        if imageQualityIndicators.getSpotTotal():
            strSpotTotal = "%6d" % imageQualityIndicators.getSpotTotal().getValue()
        strGoodBraggCandidates = "%6s" % "NA"
        if imageQualityIndicators.getGoodBraggCandidates():
            strGoodBraggCandidates = "%6d" % imageQualityIndicators.getGoodBraggCandidates().getValue()
        strTotalIntegratedSignal = "%10s" % "NA"
        if imageQualityIndicators.getTotalIntegratedSignal():
            strTotalIntegratedSignal = "%10.0f" % imageQualityIndicators.getTotalIntegratedSignal().getValue()
        strResultText += strMethod1Res + strMethod2Res + strSpotTotal + strGoodBraggCandidates + strTotalIntegratedSignal
    if xsDataResultGridScreening.getMosaicity() is None:
        strResultText += "%6s" % "NA"
    else:
        strResultText += "%6.1f" % xsDataResultGridScreening.getMosaicity().getValue()
    if xsDataResultGridScreening.getRankingResolution() is None:
        strResultText += "%6s" % "NA"
    else:
        strResultText += "%6.1f" % xsDataResultGridScreening.getRankingResolution().getValue()
    strResultText += "  " + xsDataResultGridScreening.getComment().getValue()
    writeToResultFile(strResultText)
 def finallyProcess(self, _edObject=None):
     EDPluginControl.finallyProcess(self)
     self.DEBUG("EDPluginControlGridScreeningv1_0.finallyProcess")
     # Synchronise if necessary
     if self.edPluginISPyBStoreImageQualityIndicators is not None:
         self.edPluginISPyBStoreImageQualityIndicators.synchronize()
     # Build up the output object
     strComment = ""
     xsDataResultGridScreening = XSDataResultGridScreening()
     if self.xsDataGridScreeningFileNameParameters is not None:
         xsDataResultGridScreening.setFileNameParameters(self.xsDataGridScreeningFileNameParameters)
     if self.xsDataImageQualityIndicators is None:
         strComment = "No image quality indicators"
     else:
         xsDataResultGridScreening.setImageQualityIndicators(self.xsDataImageQualityIndicators)
         if self.xsDataImageQualityIndicators.getIceRings() is not None:
             if self.xsDataImageQualityIndicators.getIceRings().getValue() > 1:
                 strComment = "Ice rings detected"
     if self.xsDataIndexingResult is None:
         if strComment == "":
             strComment = "No indexing result"
         else:
             strComment += ", no indexing result"
     else:
         xsDataSelectedSolution = self.xsDataIndexingResult.getSelectedSolution()
         xsDataResultGridScreening.setMosaicity(xsDataSelectedSolution.getCrystal().getMosaicity())
         if self.xsDataStrategyResult is None:
             if strComment == "":
                 strComment = "No strategy result"
             else:
                 strComment += ", no strategy result"
         else:
             xsDataCollectionPlan = self.xsDataStrategyResult.getCollectionPlan()[0]
             xsDataStrategySummary = xsDataCollectionPlan.getStrategySummary()
             xsDataResultGridScreening.setRankingResolution(xsDataStrategySummary.getRankingResolution())
     xsDataResultGridScreening.setResultIntegration(self.xsDataGridScreeningResultIntegration)
     xsDataResultGridScreening.setComment(XSDataString(strComment))
     if self.iImageQualityIndicatorsId is not None:
         xsDataResultGridScreening.setImageQualityIndicatorsId(XSDataInteger(self.iImageQualityIndicatorsId))
     # print xsDataResultGridScreening.marshal()
     self.setDataOutput(xsDataResultGridScreening)
Ejemplo n.º 3
0
 def finallyProcess(self, _edObject=None):
     EDPluginControl.finallyProcess(self)
     self.DEBUG("EDPluginControlGridScreeningv1_0.finallyProcess")
     # Synchronise if necessary
     if self.edPluginISPyBStoreImageQualityIndicators is not None:
         self.edPluginISPyBStoreImageQualityIndicators.synchronize()
     # Build up the output object
     strComment = ""
     xsDataResultGridScreening = XSDataResultGridScreening()
     if self.xsDataGridScreeningFileNameParameters is not None:
         xsDataResultGridScreening.setFileNameParameters(
             self.xsDataGridScreeningFileNameParameters)
     if self.xsDataImageQualityIndicators is None:
         strComment = "No image quality indicators"
     else:
         xsDataResultGridScreening.setImageQualityIndicators(
             self.xsDataImageQualityIndicators)
         if self.xsDataImageQualityIndicators.getIceRings().getValue() > 1:
             strComment = "Ice rings detected"
     if self.xsDataIndexingResult is None:
         if strComment == "":
             strComment = "No indexing result"
         else:
             strComment += ", no indexing result"
     else:
         xsDataSelectedSolution = self.xsDataIndexingResult.getSelectedSolution(
         )
         xsDataResultGridScreening.setMosaicity(
             xsDataSelectedSolution.getCrystal().getMosaicity())
         if self.xsDataStrategyResult is None:
             if strComment == "":
                 strComment = "No strategy result"
             else:
                 strComment += ", no strategy result"
         else:
             xsDataCollectionPlan = self.xsDataStrategyResult.getCollectionPlan(
             )[0]
             xsDataStrategySummary = xsDataCollectionPlan.getStrategySummary(
             )
             xsDataResultGridScreening.setRankingResolution(
                 xsDataStrategySummary.getRankingResolution())
     xsDataResultGridScreening.setResultIntegration(
         self.xsDataGridScreeningResultIntegration)
     xsDataResultGridScreening.setComment(XSDataString(strComment))
     if self.iImageQualityIndicatorsId is not None:
         xsDataResultGridScreening.setImageQualityIndicatorsId(
             XSDataInteger(self.iImageQualityIndicatorsId))
     #print xsDataResultGridScreening.marshal()
     self.setDataOutput(xsDataResultGridScreening)