Example #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
    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
Example #3
0
    def getReferenceDataMOSFLMNewmat(self):

        xsDataMOSFLMNewmat = XSDataMOSFLMNewmat()

        XSDataMatrixDoubleA = XSDataMatrixDouble()
        XSDataMatrixDoubleA.setM11(-0.00826416)
        XSDataMatrixDoubleA.setM12(0.00885073)
        XSDataMatrixDoubleA.setM13(0.00937013)
        XSDataMatrixDoubleA.setM21(0.00126554)
        XSDataMatrixDoubleA.setM22(0.01251971)
        XSDataMatrixDoubleA.setM23(-0.00845341)
        XSDataMatrixDoubleA.setM31(-0.01484956)
        XSDataMatrixDoubleA.setM32(-0.00385867)
        XSDataMatrixDoubleA.setM33(-0.00593515)
        xsDataMOSFLMNewmat.setAMatrix(XSDataMatrixDoubleA)

        xsDataMOSFLMMissettingsAngles = XSDataMOSFLMMissettingsAngles()
        xsDataMOSFLMMissettingsAngles.setPhix(XSDataAngle(1.000))
        xsDataMOSFLMMissettingsAngles.setPhiy(XSDataAngle(2.000))
        xsDataMOSFLMMissettingsAngles.setPhiz(XSDataAngle(3.000))
        xsDataMOSFLMNewmat.setMissettingAngles(xsDataMOSFLMMissettingsAngles)

        XSDataMatrixDoubleU = XSDataMatrixDouble()
        XSDataMatrixDoubleU.setM11(-0.4849475)
        XSDataMatrixDoubleU.setM12(0.5598049)
        XSDataMatrixDoubleU.setM13(0.6718960)
        XSDataMatrixDoubleU.setM21(0.0742629)
        XSDataMatrixDoubleU.setM22(0.7918670)
        XSDataMatrixDoubleU.setM23(-0.6061614)
        XSDataMatrixDoubleU.setM31(-0.8713845)
        XSDataMatrixDoubleU.setM32(-0.2440595)
        XSDataMatrixDoubleU.setM33(-0.4255866)
        xsDataMOSFLMNewmat.setUMatrix(XSDataMatrixDoubleU)

        xsDataCellRefined = XSDataCell()
        xsDataCellRefined.setLength_a(XSDataLength(54.8079))
        xsDataCellRefined.setLength_b(XSDataLength(59.0751))
        xsDataCellRefined.setLength_c(XSDataLength(66.9736))
        xsDataCellRefined.setAngle_alpha(XSDataAngle(91.0000))
        xsDataCellRefined.setAngle_beta(XSDataAngle(92.0000))
        xsDataCellRefined.setAngle_gamma(XSDataAngle(93.0000))
        xsDataMOSFLMNewmat.setRefinedCell(xsDataCellRefined)

        return xsDataMOSFLMNewmat
    def getReferenceDataMOSFLMNewmat(self):

        xsDataMOSFLMNewmat = XSDataMOSFLMNewmat()

        XSDataMatrixDoubleA = XSDataMatrixDouble()
        XSDataMatrixDoubleA.setM11(-0.00826416)
        XSDataMatrixDoubleA.setM12(0.00885073)
        XSDataMatrixDoubleA.setM13(0.00937013)
        XSDataMatrixDoubleA.setM21(0.00126554)
        XSDataMatrixDoubleA.setM22(0.01251971)
        XSDataMatrixDoubleA.setM23(-0.00845341)
        XSDataMatrixDoubleA.setM31(-0.01484956)
        XSDataMatrixDoubleA.setM32(-0.00385867)
        XSDataMatrixDoubleA.setM33(-0.00593515)
        xsDataMOSFLMNewmat.setAMatrix(XSDataMatrixDoubleA)

        xsDataMOSFLMMissettingsAngles = XSDataMOSFLMMissettingsAngles()
        xsDataMOSFLMMissettingsAngles.setPhix(XSDataAngle(1.000))
        xsDataMOSFLMMissettingsAngles.setPhiy(XSDataAngle(2.000))
        xsDataMOSFLMMissettingsAngles.setPhiz(XSDataAngle(3.000))
        xsDataMOSFLMNewmat.setMissettingAngles(xsDataMOSFLMMissettingsAngles)

        XSDataMatrixDoubleU = XSDataMatrixDouble()
        XSDataMatrixDoubleU.setM11(-0.4849475)
        XSDataMatrixDoubleU.setM12(0.5598049)
        XSDataMatrixDoubleU.setM13(0.6718960)
        XSDataMatrixDoubleU.setM21(0.0742629)
        XSDataMatrixDoubleU.setM22(0.7918670)
        XSDataMatrixDoubleU.setM23(-0.6061614)
        XSDataMatrixDoubleU.setM31(-0.8713845)
        XSDataMatrixDoubleU.setM32(-0.2440595)
        XSDataMatrixDoubleU.setM33(-0.4255866)
        xsDataMOSFLMNewmat.setUMatrix(XSDataMatrixDoubleU)

        xsDataCellRefined = XSDataCell()
        xsDataCellRefined.setLength_a(XSDataLength(54.8079))
        xsDataCellRefined.setLength_b(XSDataLength(59.0751))
        xsDataCellRefined.setLength_c(XSDataLength(66.9736))
        xsDataCellRefined.setAngle_alpha(XSDataAngle(91.0000))
        xsDataCellRefined.setAngle_beta(XSDataAngle(92.0000))
        xsDataCellRefined.setAngle_gamma(XSDataAngle(93.0000))
        xsDataMOSFLMNewmat.setRefinedCell(xsDataCellRefined)

        return xsDataMOSFLMNewmat
Example #5
0
    def getDataMOSFLMNewmat(self, _strNewmatFileName=None):
        self.DEBUG("EDPluginMOSFLMv10.getDataMOSFLMNewmat")
        xsDataMOSFLMNewmat = None
        strNewmatFileName = None
        listOfListOfFloat = []
        if (_strNewmatFileName == None):
            strNewmatFileName = self.getNewmatFileName()
        else:
            strNewmatFileName = _strNewmatFileName
        strNewmat = None
        try:
            strNewmat = self.readProcessFile(strNewmatFileName)
        except:
            strError = self.readProcessErrorLogFile()
            if (strError is not None) and (strError != ""):
                strErrorMessage = "EDPluginMOSFLMv10.getDataMOSFLMNewmat: %s : error reading newmat file : %s" % \
                                (self.getClassName(), strError)
                self.error(strErrorMessage)
                self.addErrorMessage(strErrorMessage)
                self.setFailure()
            else:
                strErrorMessage = "EDPluginMOSFLMv10.getDataMOSFLMNewmat : Cannot read MOSFLM NEWMAT file : " + strNewmatFileName
                self.error(strErrorMessage)
                self.addErrorMessage(strErrorMessage)
                self.setFailure()
        #print strNewmat
        if (strNewmat is not None):
            listLine = strNewmat.split("\n")
            # Convert into list of lists of float
            for strLine in listLine:
                if not strLine.startswith("SYMM"):
                    listOfListOfFloat.append(self.splitStringIntoListOfFloats(strLine))
            # Fill in the data
            xsDataMOSFLMNewmat = XSDataMOSFLMNewmat()

            XSDataMatrixDoubleA = XSDataMatrixDouble()
            XSDataMatrixDoubleA.setM11(listOfListOfFloat[0][0])
            XSDataMatrixDoubleA.setM12(listOfListOfFloat[0][1])
            XSDataMatrixDoubleA.setM13(listOfListOfFloat[0][2])
            XSDataMatrixDoubleA.setM21(listOfListOfFloat[1][0])
            XSDataMatrixDoubleA.setM22(listOfListOfFloat[1][1])
            XSDataMatrixDoubleA.setM23(listOfListOfFloat[1][2])
            XSDataMatrixDoubleA.setM31(listOfListOfFloat[2][0])
            XSDataMatrixDoubleA.setM32(listOfListOfFloat[2][1])
            XSDataMatrixDoubleA.setM33(listOfListOfFloat[2][2])
            xsDataMOSFLMNewmat.setAMatrix(XSDataMatrixDoubleA)

            xsDataMOSFLMMissettingsAngles = XSDataMOSFLMMissettingsAngles()
            xsDataMOSFLMMissettingsAngles.setPhix(XSDataAngle(listOfListOfFloat[3][0]))
            xsDataMOSFLMMissettingsAngles.setPhiy(XSDataAngle(listOfListOfFloat[3][1]))
            xsDataMOSFLMMissettingsAngles.setPhiz(XSDataAngle(listOfListOfFloat[3][2]))
            xsDataMOSFLMNewmat.setMissettingAngles(xsDataMOSFLMMissettingsAngles)

            XSDataMatrixDoubleU = XSDataMatrixDouble()
            XSDataMatrixDoubleU.setM11(listOfListOfFloat[4][0])
            XSDataMatrixDoubleU.setM12(listOfListOfFloat[4][1])
            XSDataMatrixDoubleU.setM13(listOfListOfFloat[4][2])
            XSDataMatrixDoubleU.setM21(listOfListOfFloat[5][0])
            XSDataMatrixDoubleU.setM22(listOfListOfFloat[5][1])
            XSDataMatrixDoubleU.setM23(listOfListOfFloat[5][2])
            XSDataMatrixDoubleU.setM31(listOfListOfFloat[6][0])
            XSDataMatrixDoubleU.setM32(listOfListOfFloat[6][1])
            XSDataMatrixDoubleU.setM33(listOfListOfFloat[6][2])
            xsDataMOSFLMNewmat.setUMatrix(XSDataMatrixDoubleU)

            xsDataCellRefined = XSDataCell()
            xsDataCellRefined.setLength_a(XSDataLength(listOfListOfFloat[7][0]))
            xsDataCellRefined.setLength_b(XSDataLength(listOfListOfFloat[7][1]))
            xsDataCellRefined.setLength_c(XSDataLength(listOfListOfFloat[7][2]))
            xsDataCellRefined.setAngle_alpha(XSDataAngle(listOfListOfFloat[7][3]))
            xsDataCellRefined.setAngle_beta(XSDataAngle(listOfListOfFloat[7][4]))
            xsDataCellRefined.setAngle_gamma(XSDataAngle(listOfListOfFloat[7][5]))
            xsDataMOSFLMNewmat.setRefinedCell(xsDataCellRefined)

        return xsDataMOSFLMNewmat
Example #6
0
    def getDataMOSFLMNewmat(self, _strNewmatFileName=None):
        self.DEBUG("EDPluginMOSFLMv10.getDataMOSFLMNewmat")
        xsDataMOSFLMNewmat = None
        strNewmatFileName = None
        listOfListOfFloat = []
        if (_strNewmatFileName == None):
            strNewmatFileName = self.getNewmatFileName()
        else:
            strNewmatFileName = _strNewmatFileName
        strNewmat = None
        try:
            strNewmat = self.readProcessFile(strNewmatFileName)
        except:
            strError = self.readProcessErrorLogFile()
            if (strError is not None) and (strError != ""):
                strErrorMessage = "EDPluginMOSFLMv10.getDataMOSFLMNewmat: %s : error reading newmat file : %s" % \
                                (self.getClassName(), strError)
                self.error(strErrorMessage)
                self.addErrorMessage(strErrorMessage)
                self.setFailure()
            else:
                strErrorMessage = "EDPluginMOSFLMv10.getDataMOSFLMNewmat : Cannot read MOSFLM NEWMAT file : " + strNewmatFileName
                self.error(strErrorMessage)
                self.addErrorMessage(strErrorMessage)
                self.setFailure()
        # print strNewmat
        if (strNewmat is not None):
            listLine = strNewmat.split("\n")
            # Convert into list of lists of float
            for strLine in listLine:
                if not strLine.startswith("SYMM"):
                    listOfListOfFloat.append(
                        self.splitStringIntoListOfFloats(strLine))
            # Fill in the data
            xsDataMOSFLMNewmat = XSDataMOSFLMNewmat()

            XSDataMatrixDoubleA = XSDataMatrixDouble()
            XSDataMatrixDoubleA.setM11(listOfListOfFloat[0][0])
            XSDataMatrixDoubleA.setM12(listOfListOfFloat[0][1])
            XSDataMatrixDoubleA.setM13(listOfListOfFloat[0][2])
            XSDataMatrixDoubleA.setM21(listOfListOfFloat[1][0])
            XSDataMatrixDoubleA.setM22(listOfListOfFloat[1][1])
            XSDataMatrixDoubleA.setM23(listOfListOfFloat[1][2])
            XSDataMatrixDoubleA.setM31(listOfListOfFloat[2][0])
            XSDataMatrixDoubleA.setM32(listOfListOfFloat[2][1])
            XSDataMatrixDoubleA.setM33(listOfListOfFloat[2][2])
            xsDataMOSFLMNewmat.setAMatrix(XSDataMatrixDoubleA)

            xsDataMOSFLMMissettingsAngles = XSDataMOSFLMMissettingsAngles()
            xsDataMOSFLMMissettingsAngles.setPhix(
                XSDataAngle(listOfListOfFloat[3][0]))
            xsDataMOSFLMMissettingsAngles.setPhiy(
                XSDataAngle(listOfListOfFloat[3][1]))
            xsDataMOSFLMMissettingsAngles.setPhiz(
                XSDataAngle(listOfListOfFloat[3][2]))
            xsDataMOSFLMNewmat.setMissettingAngles(
                xsDataMOSFLMMissettingsAngles)

            XSDataMatrixDoubleU = XSDataMatrixDouble()
            XSDataMatrixDoubleU.setM11(listOfListOfFloat[4][0])
            XSDataMatrixDoubleU.setM12(listOfListOfFloat[4][1])
            XSDataMatrixDoubleU.setM13(listOfListOfFloat[4][2])
            XSDataMatrixDoubleU.setM21(listOfListOfFloat[5][0])
            XSDataMatrixDoubleU.setM22(listOfListOfFloat[5][1])
            XSDataMatrixDoubleU.setM23(listOfListOfFloat[5][2])
            XSDataMatrixDoubleU.setM31(listOfListOfFloat[6][0])
            XSDataMatrixDoubleU.setM32(listOfListOfFloat[6][1])
            XSDataMatrixDoubleU.setM33(listOfListOfFloat[6][2])
            xsDataMOSFLMNewmat.setUMatrix(XSDataMatrixDoubleU)

            xsDataCellRefined = XSDataCell()
            xsDataCellRefined.setLength_a(XSDataLength(
                listOfListOfFloat[7][0]))
            xsDataCellRefined.setLength_b(XSDataLength(
                listOfListOfFloat[7][1]))
            xsDataCellRefined.setLength_c(XSDataLength(
                listOfListOfFloat[7][2]))
            xsDataCellRefined.setAngle_alpha(
                XSDataAngle(listOfListOfFloat[7][3]))
            xsDataCellRefined.setAngle_beta(
                XSDataAngle(listOfListOfFloat[7][4]))
            xsDataCellRefined.setAngle_gamma(
                XSDataAngle(listOfListOfFloat[7][5]))
            xsDataMOSFLMNewmat.setRefinedCell(xsDataCellRefined)

        return xsDataMOSFLMNewmat