Ejemplo n.º 1
0
    def __init__(self):
        """
        """
        EDPluginControl.__init__(self)
        self.setXSDataInputClass(XSDataInputBioSaxsAsciiExportv1_0)
        self.__strControlledPluginSaxsCurves = "EDPluginExecSaxsCurvesv1_1"
        self.__strControlledPluginWaitFile = "EDPluginWaitFile"
        self.__strControlledPluginSaxsGetMetadata = "EDPluginBioSaxsMetadatav1_1"
        self.__edPluginSaxsCurves = None
        self.__edPluginWaitFile = None
        self.__edPluginSaxsGetMetadata = None

        self.integratedImage = None
        self.integratedCurve = None


        self.detector = None
        self.detectorDistance = None
        self.pixelSize_1 = None
        self.pixelSize_2 = None
        self.beamCenter_1 = None
        self.beamCenter_2 = None
        self.beamStopDiode = None
        self.wavelength = None
        self.maskFile = None
        self.normalizationFactor = None
        self.machineCurrent = None

        self.code = None
        self.comments = None
        self.concentration = None

        self.strProcessLog = ""
        self.xsdResult = XSDataResultBioSaxsAsciiExportv1_0()
    def testExecute(self):
        """
        """
        self.run()
        plugin = self.getPlugin()

################################################################################
# Compare XSDataResults
################################################################################

        strExpectedOutput = self.readAndParseFile (self.getReferenceDataOutputFile())
#        strObtainedOutput = self.readAndParseFile (self.m_edObtainedOutputDataFile)
        EDVerbose.DEBUG("Checking obtained result...")
        xsDataResultReference = XSDataResultBioSaxsAsciiExportv1_0.parseString(strExpectedOutput)
        xsDataResultObtained = plugin.getDataOutput()
        EDAssert.strAlmostEqual(xsDataResultReference.marshal(), xsDataResultObtained.marshal(), "XSDataResult output are the same", _strExcluded="bioSaxs")

################################################################################
# Compare spectrum ascii Files
################################################################################

        outputData = open(xsDataResultObtained.getIntegratedCurve().getPath().value, "rb").read()
        referenceData = open(os.path.join(self.getTestsDataImagesHome(), "bioSaxsAsciiExportv1_1.dat"), "rb").read()

        EDAssert.strAlmostEqual(referenceData, outputData, _strComment="3-column ascii spectra files are the same", _fRelError=0.1, _fAbsError=0.1, _strExcluded="bioSaxs")
 def preProcess(self):
     """
     PreProcess of the execution test: download a set of images  from http://www.edna-site.org
     and remove any existing output file 
     """
     EDTestCasePluginExecute.preProcess(self)
     self.loadTestImage([  "bioSaxsAsciiExportv1_1.dat", "bioSaxsIntegrated.edf"])
     strExpectedOutput = self.readAndParseFile (self.getReferenceDataOutputFile())
     EDVerbose.DEBUG("strExpectedOutput:" + strExpectedOutput)
     xsDataResultReference = XSDataResultBioSaxsAsciiExportv1_0.parseString(strExpectedOutput)
     self.integratedCurve = xsDataResultReference.getIntegratedCurve().getPath().value
     EDVerbose.DEBUG("Output file is %s" % self.integratedCurve)
     if not os.path.isdir(os.path.dirname(self.integratedCurve)):
         os.makedirs(os.path.dirname(self.integratedCurve))
     if os.path.isfile(self.integratedCurve):
         EDVerbose.DEBUG(" Output Integrated Curve file exists %s, I will remove it" % self.integratedCurve)
         os.remove(self.integratedCurve)
Ejemplo n.º 4
0
    def testExecute(self):
        """
        """
        self.run()
        plugin = self.getPlugin()

        ################################################################################
        # Compare XSDataResults
        ################################################################################

        strExpectedOutput = self.readAndParseFile(
            self.getReferenceDataOutputFile())
        #        strObtainedOutput = self.readAndParseFile (self.m_edObtainedOutputDataFile)
        EDVerbose.DEBUG("Checking obtained result...")
        xsDataResultReference = XSDataResultBioSaxsAsciiExportv1_0.parseString(
            strExpectedOutput)
        xsDataResultObtained = plugin.getDataOutput()
        EDAssert.strAlmostEqual(xsDataResultReference.marshal(),
                                xsDataResultObtained.marshal(),
                                "XSDataResult output are the same",
                                _strExcluded="bioSaxs")

        ################################################################################
        # Compare spectrum ascii Files
        ################################################################################

        outputData = open(
            xsDataResultObtained.getIntegratedCurve().getPath().value,
            "rb").read()
        referenceData = open(
            os.path.join(self.getTestsDataImagesHome(),
                         "bioSaxsAsciiExportv1_1.dat"), "rb").read()

        EDAssert.strAlmostEqual(
            referenceData,
            outputData,
            _strComment="3-column ascii spectra files are the same",
            _fRelError=0.1,
            _fAbsError=0.1,
            _strExcluded="bioSaxs")
Ejemplo n.º 5
0
 def preProcess(self):
     """
     PreProcess of the execution test: download a set of images  from http://www.edna-site.org
     and remove any existing output file 
     """
     EDTestCasePluginExecute.preProcess(self)
     self.loadTestImage(["bioSaxsAsciiExport.dat", "bioSaxsIntegrated.edf"])
     strExpectedOutput = self.readAndParseFile(
         self.getReferenceDataOutputFile())
     EDVerbose.DEBUG("strExpectedOutput:" + strExpectedOutput)
     xsDataResultReference = XSDataResultBioSaxsAsciiExportv1_0.parseString(
         strExpectedOutput)
     self.integratedCurve = xsDataResultReference.getIntegratedCurve(
     ).getPath().value
     EDVerbose.DEBUG("Output file is %s" % self.integratedCurve)
     if not os.path.isdir(os.path.dirname(self.integratedCurve)):
         os.makedirs(os.path.dirname(self.integratedCurve))
     if os.path.isfile(self.integratedCurve):
         EDVerbose.DEBUG(
             " Output Integrated Curve file exists %s, I will remove it" %
             self.integratedCurve)
         os.remove(self.integratedCurve)