Exemplo n.º 1
0
    def parseMosflmScriptsOutput(self, _strMOSFLMScript):
        """
        This method parses the MOSFLM script generated by Labelit and populates
        the A- and U-matrices in the XSDataLabelitMosflmScriptsOutput object.
        """
        self.DEBUG("EDPluginLabelitIndexingv1_1.parseMOSFLMMatrices")
        xsDataLabelitMosflmScriptsOutput = XSDataLabelitMosflmScriptsOutput()
        listMOSFLMScriptLines = _strMOSFLMScript.split("\n")

        XSDataMatrixDoubleA = XSDataMatrixDouble()
        # Fix for bug 315: it's not enough to just spit the lines
        listMOSFLMScriptLine2 = [ listMOSFLMScriptLines[2][0:12],
                                    listMOSFLMScriptLines[2][12:24],
                                    listMOSFLMScriptLines[2][24:] ]
        listMOSFLMScriptLine3 = [ listMOSFLMScriptLines[3][0:12],
                                    listMOSFLMScriptLines[3][12:24],
                                    listMOSFLMScriptLines[3][24:] ]
        listMOSFLMScriptLine4 = [ listMOSFLMScriptLines[4][0:12],
                                    listMOSFLMScriptLines[4][12:24],
                                    listMOSFLMScriptLines[4][24:] ]
        XSDataMatrixDoubleA.setM11(float(listMOSFLMScriptLine2[0]))
        XSDataMatrixDoubleA.setM12(float(listMOSFLMScriptLine2[1]))
        XSDataMatrixDoubleA.setM13(float(listMOSFLMScriptLine2[2]))
        XSDataMatrixDoubleA.setM21(float(listMOSFLMScriptLine3[0]))
        XSDataMatrixDoubleA.setM22(float(listMOSFLMScriptLine3[1]))
        XSDataMatrixDoubleA.setM23(float(listMOSFLMScriptLine3[2]))
        XSDataMatrixDoubleA.setM31(float(listMOSFLMScriptLine4[0]))
        XSDataMatrixDoubleA.setM32(float(listMOSFLMScriptLine4[1]))
        XSDataMatrixDoubleA.setM33(float(listMOSFLMScriptLine4[2]))
        xsDataLabelitMosflmScriptsOutput.setAMatrix(XSDataMatrixDoubleA)

        XSDataMatrixDoubleU = XSDataMatrixDouble()
        listMOSFLMScriptLine6 = [ listMOSFLMScriptLines[6][0:12],
                                    listMOSFLMScriptLines[6][12:24],
                                    listMOSFLMScriptLines[6][24:] ]
        listMOSFLMScriptLine7 = [ listMOSFLMScriptLines[7][0:12],
                                    listMOSFLMScriptLines[7][12:24],
                                    listMOSFLMScriptLines[7][24:] ]
        listMOSFLMScriptLine8 = [ listMOSFLMScriptLines[8][0:12],
                                    listMOSFLMScriptLines[8][12:24],
                                    listMOSFLMScriptLines[8][24:] ]
        XSDataMatrixDoubleU.setM11(float(listMOSFLMScriptLine6[0]))
        XSDataMatrixDoubleU.setM12(float(listMOSFLMScriptLine6[1]))
        XSDataMatrixDoubleU.setM13(float(listMOSFLMScriptLine6[2]))
        XSDataMatrixDoubleU.setM21(float(listMOSFLMScriptLine7[0]))
        XSDataMatrixDoubleU.setM22(float(listMOSFLMScriptLine7[1]))
        XSDataMatrixDoubleU.setM23(float(listMOSFLMScriptLine7[2]))
        XSDataMatrixDoubleU.setM31(float(listMOSFLMScriptLine8[0]))
        XSDataMatrixDoubleU.setM32(float(listMOSFLMScriptLine8[1]))
        XSDataMatrixDoubleU.setM33(float(listMOSFLMScriptLine8[2]))
        xsDataLabelitMosflmScriptsOutput.setUMatrix(XSDataMatrixDoubleU)

        return xsDataLabelitMosflmScriptsOutput
Exemplo n.º 2
0
    def testGenerateExecutiveSummary(self):
        """
        This method tests the generateExecutiveSummary of the Labelit plugin.
        It contains no assert call so the contents of the executive summary is not tested.
        """
        edPluginLabelitIndexingv1_1 = self.createPlugin()
        xmlInput1 = self.readAndParseFile(self.__strReferenceInputFile1)
        edPluginLabelitIndexingv1_1.setDataInput(xmlInput1, "referenceImage")
        xmlInput2 = self.readAndParseFile(self.__strReferenceInputFile1)
        edPluginLabelitIndexingv1_1.setDataInput(xmlInput2, "referenceImage")

        strLabelitScreenOutputFile = os.path.join(
            self.getPluginTestsDataHome(),
            "XSDataLabelitScreenOutput_reference.xml")
        strLabelitScreenOutputXML = self.readAndParseFile(
            strLabelitScreenOutputFile)
        from XSDataLabelitv1_1 import XSDataLabelitScreenOutput
        xsDataLabelitScreenOutputReference = XSDataLabelitScreenOutput.parseString(
            strLabelitScreenOutputXML)
        edPluginLabelitIndexingv1_1.setDataOutput(
            xsDataLabelitScreenOutputReference, "labelitScreenOutput")

        strLabelitMosflmScriptsOutputFile = os.path.join(
            self.getPluginTestsDataHome(),
            "XSDataLabelitMosflmScriptsOutput_reference.xml")
        strLabelitMosflmScriptsOutputXML = self.readAndParseFile(
            strLabelitMosflmScriptsOutputFile)
        from XSDataLabelitv1_1 import XSDataLabelitMosflmScriptsOutput
        xsDataLabelitMosflmScriptsOutputReference = XSDataLabelitMosflmScriptsOutput.parseString(
            strLabelitMosflmScriptsOutputXML)
        edPluginLabelitIndexingv1_1.setDataOutput(
            xsDataLabelitMosflmScriptsOutputReference, "mosflmScriptOutput")

        edPluginLabelitIndexingv1_1.generateExecutiveSummary(
            edPluginLabelitIndexingv1_1)
Exemplo n.º 3
0
 def testParseMosflmScriptsOutput(self):
     """
     This method tests the parsing of the MOSFLM script generated by Labelit.
     """
     edPluginLabelitIndexingv1_1 = self.createPlugin()
     # First file from version 1000rc11
     strPathToMOSFLMScript = os.path.join(
         self.getPluginTestsDataHome(), "integration05_csh_v1000rc11.txt")
     strMOSFLMScript = self.readAndParseFile(strPathToMOSFLMScript)
     xsDataLabelitMosflmScriptsOutput = edPluginLabelitIndexingv1_1.parseMosflmScriptsOutput(
         strMOSFLMScript)
     xsDataLabelitMosflmScriptsOutput.outputFile(
         "XSDataLabelitMosflmScriptsOutput_reference.xml")
     strLabelitMosflmScriptsOutputFile = os.path.join(
         self.getPluginTestsDataHome(),
         "XSDataLabelitMosflmScriptsOutput_reference.xml")
     strLabelitMosflmScriptsOutputXML = self.readAndParseFile(
         strLabelitMosflmScriptsOutputFile)
     from XSDataLabelitv1_1 import XSDataLabelitMosflmScriptsOutput
     xsDataLabelitMosflmScriptsOutputReference = XSDataLabelitMosflmScriptsOutput.parseString(
         strLabelitMosflmScriptsOutputXML)
     EDAssert.equal(xsDataLabelitMosflmScriptsOutputReference.marshal(),
                    xsDataLabelitMosflmScriptsOutput.marshal())
     # Second file from version 1000b1
     strPathToMOSFLMScript = os.path.join(self.getPluginTestsDataHome(),
                                          "integration05_csh_v1000b1.txt")
     strMOSFLMScript = self.readAndParseFile(strPathToMOSFLMScript)
     xsDataLabelitMosflmScriptsOutput = edPluginLabelitIndexingv1_1.parseMosflmScriptsOutput(
         strMOSFLMScript)
     #sDataLabelitMosflmScriptsOutput.outputFile("XSDataLabelitMosflmScriptsOutput_v1000b1_reference.xml")
     strLabelitMosflmScriptsOutputFile = os.path.join(
         self.getPluginTestsDataHome(),
         "XSDataLabelitMosflmScriptsOutput_v1000b1_reference.xml")
     strLabelitMosflmScriptsOutputXML = self.readAndParseFile(
         strLabelitMosflmScriptsOutputFile)
     xsDataLabelitMosflmScriptsOutputReference = XSDataLabelitMosflmScriptsOutput.parseString(
         strLabelitMosflmScriptsOutputXML)
     EDAssert.equal(xsDataLabelitMosflmScriptsOutputReference.marshal(),
                    xsDataLabelitMosflmScriptsOutput.marshal())
Exemplo n.º 4
0
    def parseMosflmScriptsOutput(self, _strMOSFLMScript):
        """
        This method parses the MOSFLM script generated by Labelit and populates
        the A- and U-matrices in the XSDataLabelitMosflmScriptsOutput object.
        """
        self.DEBUG("EDPluginLabelitIndexingv1_1.parseMOSFLMMatrices")
        xsDataLabelitMosflmScriptsOutput = XSDataLabelitMosflmScriptsOutput()
        listMOSFLMScriptLines = _strMOSFLMScript.split("\n")

        XSDataMatrixDoubleA = XSDataMatrixDouble()
        # Fix for bug 315: it's not enough to just spit the lines
        listMOSFLMScriptLine2 = [
            listMOSFLMScriptLines[2][0:12], listMOSFLMScriptLines[2][12:24],
            listMOSFLMScriptLines[2][24:]
        ]
        listMOSFLMScriptLine3 = [
            listMOSFLMScriptLines[3][0:12], listMOSFLMScriptLines[3][12:24],
            listMOSFLMScriptLines[3][24:]
        ]
        listMOSFLMScriptLine4 = [
            listMOSFLMScriptLines[4][0:12], listMOSFLMScriptLines[4][12:24],
            listMOSFLMScriptLines[4][24:]
        ]
        XSDataMatrixDoubleA.setM11(float(listMOSFLMScriptLine2[0]))
        XSDataMatrixDoubleA.setM12(float(listMOSFLMScriptLine2[1]))
        XSDataMatrixDoubleA.setM13(float(listMOSFLMScriptLine2[2]))
        XSDataMatrixDoubleA.setM21(float(listMOSFLMScriptLine3[0]))
        XSDataMatrixDoubleA.setM22(float(listMOSFLMScriptLine3[1]))
        XSDataMatrixDoubleA.setM23(float(listMOSFLMScriptLine3[2]))
        XSDataMatrixDoubleA.setM31(float(listMOSFLMScriptLine4[0]))
        XSDataMatrixDoubleA.setM32(float(listMOSFLMScriptLine4[1]))
        XSDataMatrixDoubleA.setM33(float(listMOSFLMScriptLine4[2]))
        xsDataLabelitMosflmScriptsOutput.setAMatrix(XSDataMatrixDoubleA)

        XSDataMatrixDoubleU = XSDataMatrixDouble()
        listMOSFLMScriptLine6 = [
            listMOSFLMScriptLines[6][0:12], listMOSFLMScriptLines[6][12:24],
            listMOSFLMScriptLines[6][24:]
        ]
        listMOSFLMScriptLine7 = [
            listMOSFLMScriptLines[7][0:12], listMOSFLMScriptLines[7][12:24],
            listMOSFLMScriptLines[7][24:]
        ]
        listMOSFLMScriptLine8 = [
            listMOSFLMScriptLines[8][0:12], listMOSFLMScriptLines[8][12:24],
            listMOSFLMScriptLines[8][24:]
        ]
        XSDataMatrixDoubleU.setM11(float(listMOSFLMScriptLine6[0]))
        XSDataMatrixDoubleU.setM12(float(listMOSFLMScriptLine6[1]))
        XSDataMatrixDoubleU.setM13(float(listMOSFLMScriptLine6[2]))
        XSDataMatrixDoubleU.setM21(float(listMOSFLMScriptLine7[0]))
        XSDataMatrixDoubleU.setM22(float(listMOSFLMScriptLine7[1]))
        XSDataMatrixDoubleU.setM23(float(listMOSFLMScriptLine7[2]))
        XSDataMatrixDoubleU.setM31(float(listMOSFLMScriptLine8[0]))
        XSDataMatrixDoubleU.setM32(float(listMOSFLMScriptLine8[1]))
        XSDataMatrixDoubleU.setM33(float(listMOSFLMScriptLine8[2]))
        xsDataLabelitMosflmScriptsOutput.setUMatrix(XSDataMatrixDoubleU)

        return xsDataLabelitMosflmScriptsOutput
 def testParseMosflmScriptsOutput(self):
     """
     This method tests the parsing of the MOSFLM script generated by Labelit.
     """
     edPluginLabelitIndexingv1_1 = self.createPlugin()
     # First file from version 1000rc11
     strPathToMOSFLMScript = os.path.join(self.getPluginTestsDataHome(), "integration05_csh_v1000rc11.txt")
     strMOSFLMScript = self.readAndParseFile(strPathToMOSFLMScript)
     xsDataLabelitMosflmScriptsOutput = edPluginLabelitIndexingv1_1.parseMosflmScriptsOutput(strMOSFLMScript)
     xsDataLabelitMosflmScriptsOutput.outputFile("XSDataLabelitMosflmScriptsOutput_reference.xml")
     strLabelitMosflmScriptsOutputFile = os.path.join(self.getPluginTestsDataHome(), "XSDataLabelitMosflmScriptsOutput_reference.xml")
     strLabelitMosflmScriptsOutputXML = self.readAndParseFile(strLabelitMosflmScriptsOutputFile)
     from XSDataLabelitv1_1 import XSDataLabelitMosflmScriptsOutput
     xsDataLabelitMosflmScriptsOutputReference = XSDataLabelitMosflmScriptsOutput.parseString(strLabelitMosflmScriptsOutputXML)
     EDAssert.equal(xsDataLabelitMosflmScriptsOutputReference.marshal(), xsDataLabelitMosflmScriptsOutput.marshal())
     # Second file from version 1000b1
     strPathToMOSFLMScript = os.path.join(self.getPluginTestsDataHome(), "integration05_csh_v1000b1.txt")
     strMOSFLMScript = self.readAndParseFile(strPathToMOSFLMScript)
     xsDataLabelitMosflmScriptsOutput = edPluginLabelitIndexingv1_1.parseMosflmScriptsOutput(strMOSFLMScript)
     #sDataLabelitMosflmScriptsOutput.outputFile("XSDataLabelitMosflmScriptsOutput_v1000b1_reference.xml")
     strLabelitMosflmScriptsOutputFile = os.path.join(self.getPluginTestsDataHome(), "XSDataLabelitMosflmScriptsOutput_v1000b1_reference.xml")
     strLabelitMosflmScriptsOutputXML = self.readAndParseFile(strLabelitMosflmScriptsOutputFile)
     xsDataLabelitMosflmScriptsOutputReference = XSDataLabelitMosflmScriptsOutput.parseString(strLabelitMosflmScriptsOutputXML)
     EDAssert.equal(xsDataLabelitMosflmScriptsOutputReference.marshal(), xsDataLabelitMosflmScriptsOutput.marshal())
    def testGenerateExecutiveSummary(self):
        """
        This method tests the generateExecutiveSummary of the Labelit plugin.
        It contains no assert call so the contents of the executive summary is not tested.
        """
        edPluginLabelitIndexingv1_1 = self.createPlugin()
        xmlInput1 = self.readAndParseFile(self.__strReferenceInputFile1)
        edPluginLabelitIndexingv1_1.setDataInput(xmlInput1, "referenceImage")
        xmlInput2 = self.readAndParseFile(self.__strReferenceInputFile1)
        edPluginLabelitIndexingv1_1.setDataInput(xmlInput2, "referenceImage")

        strLabelitScreenOutputFile = os.path.join(self.getPluginTestsDataHome(), "XSDataLabelitScreenOutput_reference.xml")
        strLabelitScreenOutputXML = self.readAndParseFile(strLabelitScreenOutputFile)
        from XSDataLabelitv1_1 import XSDataLabelitScreenOutput
        xsDataLabelitScreenOutputReference = XSDataLabelitScreenOutput.parseString(strLabelitScreenOutputXML)
        edPluginLabelitIndexingv1_1.setDataOutput(xsDataLabelitScreenOutputReference, "labelitScreenOutput")

        strLabelitMosflmScriptsOutputFile = os.path.join(self.getPluginTestsDataHome(), "XSDataLabelitMosflmScriptsOutput_reference.xml")
        strLabelitMosflmScriptsOutputXML = self.readAndParseFile(strLabelitMosflmScriptsOutputFile)
        from XSDataLabelitv1_1 import XSDataLabelitMosflmScriptsOutput
        xsDataLabelitMosflmScriptsOutputReference = XSDataLabelitMosflmScriptsOutput.parseString(strLabelitMosflmScriptsOutputXML)
        edPluginLabelitIndexingv1_1.setDataOutput(xsDataLabelitMosflmScriptsOutputReference, "mosflmScriptOutput")

        edPluginLabelitIndexingv1_1.generateExecutiveSummary(edPluginLabelitIndexingv1_1)