Esempio n. 1
0
    def postProcess(self, _edObject=None):
        EDPluginExecProcessScript.postProcess(self)
        self.DEBUG("EDPluginExecDatcmpv2_0.postProcess")

        strResultFile = os.path.join(os.path.dirname(self.getScriptFilePath()), self.getScriptLogFileName())
        if os.path.isfile(strResultFile):
            for line in open(strResultFile):
                words = line.split()
                if (self.atsasVersion == "2.5.2") and (len(words) == 5):
                    try:
                        self.fChi = float(words[-2])
                        self.fFidelity = float(words[-1])
                    except ValueError:
                        self.WARNING("Strange ouptut from %s:%s %s" % (strResultFile, os.linesep, line))
                    else:
                        break
                if (self.atsasVersion == "2.6.1") and (len(words) == 6):
                    try:
                        self.fChi = float(words[-3]) ** 0.5
                        self.fFidelity = float(words[-1].strip('*'))
                    except ValueError:
                        self.DEBUG("Strange ouptut from %s:%s %s" % (strResultFile, os.linesep, line))
                    else:
                        break

        # Create some output data
        xsDataResult = XSDataResultDatcmp()
        if self.fChi is not None:
            xsDataResult.chi = XSDataDouble(self.fChi)
        if self.fFidelity is not None:
            xsDataResult.fidelity = XSDataDouble(self.fFidelity)

        self.setDataOutput(xsDataResult)
Esempio n. 2
0
    def postProcess(self, _edObject=None):
        EDPluginExecProcessScript.postProcess(self)
        self.DEBUG("EDPluginExecDatcmpv1_0.postProcess")

        strResultFile = os.path.join(os.path.dirname(self.getScriptFilePath()),
                                     self.getScriptLogFileName())
        if os.path.isfile(strResultFile):
            for line in open(strResultFile):
                words = line.split()
                if len(words) == 2:
                    try:
                        self.fChi = float(words[0])
                        self.fFidelity = float(words[1])
                    except ValueError:
                        self.WARNING("Strange ouptut from %s:%s %s" %
                                     (strResultFile, os.linesep, line))
                    else:
                        break

        # Create some output data
        xsDataResult = XSDataResultDatcmp()
        if self.fChi is not None:
            xsDataResult.chi = XSDataDouble(self.fChi)
        if self.fFidelity is not None:
            xsDataResult.fidelity = XSDataDouble(self.fFidelity)

        self.setDataOutput(xsDataResult)
Esempio n. 3
0
    def postProcess(self, _edObject=None):
        EDPluginExecProcessScript.postProcess(self)
        self.DEBUG("EDPluginExecDatcmpv2_0.postProcess")

        strResultFile = os.path.join(os.path.dirname(self.getScriptFilePath()),
                                     self.getScriptLogFileName())
        if os.path.isfile(strResultFile):
            for line in open(strResultFile):
                words = line.split()
                if (self.atsasVersion == "2.5.2") and (len(words) == 5):
                    try:
                        self.fChi = float(words[-2])
                        self.fFidelity = float(words[-1])
                    except ValueError:
                        self.WARNING("Strange ouptut from %s:%s %s" %
                                     (strResultFile, os.linesep, line))
                    else:
                        break
                elif (self.atsasVersion
                      == "2.6.1") and (len(words) == 6) and ('vs.' in words):
                    if self.testType == 'CHI-SQUARE':
                        try:
                            self.fChi = float(words[-3].strip('*'))**0.5
                            self.fFidelity = float(words[-1].strip('*'))
                        except ValueError:
                            self.WARNING("Strange ouptut from %s:%s %s" %
                                         (strResultFile, os.linesep, line))
                        else:
                            break
                    else:
                        try:
                            self.fFidelity = float(words[-1].strip('*'))
                            self.naFidelity = float(words[-2].strip('*'))
                        except ValueError:
                            self.WARNING("Strange ouptut from %s:%s %s" %
                                         (strResultFile, os.linesep, line))
                        else:
                            break

        # Create some output data
        xsDataResult = XSDataResultDatcmp()
        if self.fChi is not None:
            xsDataResult.chi = XSDataDouble(self.fChi)
        if self.fFidelity is not None:
            xsDataResult.fidelity = XSDataDouble(self.fFidelity)
        if self.naFidelity is not None:
            xsDataResult.nonadjustedFidelity = XSDataDouble(self.naFidelity)
        self.setDataOutput(xsDataResult)
 def testExecute(self):
     """
     """
     self.run()
     xsdOut = self.getPlugin().getDataOutput()
     EDAssert.strAlmostEqual(XSDataResultDatcmp.parseFile(self.getReferenceDataOutputFile()).marshal(),
                             xsdOut.marshal() , "XSData are almost the same", _fAbsError=0.1)
     EDAssert.lowerThan(xsdOut.chi.value, 1.0, "Chi2 is lower than 1")
     EDAssert.equal(xsdOut.fidelity.value, 1.0, "Fidelity is 1")
 def testExecute(self):
     """
     """
     self.run()
     xsdOut = self.getPlugin().getDataOutput()
     EDAssert.strAlmostEqual(XSDataResultDatcmp.parseFile(self.getReferenceDataOutputFile()).marshal(),
                             xsdOut.marshal() , "XSData are almost the same", _fAbsError=0.1)
     EDAssert.lowerThan(xsdOut.chi.value, 1.0, "Chi2 is lower than 1")
     EDAssert.equal(xsdOut.fidelity.value, 1.0, "Fidelity is 1")