Пример #1
0
    def process(self, _edObject=None):
        EDPluginControl.process(self)
        self.DEBUG("EDPluginWaitMultiFile.process  global time-out is set to: %s (default value)" % (self.getTimeOut()))
        self.setTimeInit()
################################################################################
# Initialize the accumulator with the query
################################################################################
        xsdiAccumulator = XSDataInputAccumulator()
        xsdQuery = XSDataQuery()
        xsdQuery.setRemoveItems(XSDataBoolean(1))
        xsdQuery.setItem(self.listXsdStrings)
        xsdiAccumulator.setQuery([xsdQuery])
        edPluginAccumulator = self.loadPlugin(self.__strControlledPluginAccumulator)
        edPluginAccumulator.setDataInput(xsdiAccumulator)
        edPluginAccumulator.connectSUCCESS(self.doSuccessAccumulator)
        edPluginAccumulator.connectFAILURE(self.doFailureAccumulator)
        edPluginAccumulator.execute()

        for oneXSDImage in self.listXsdFiles:
            xsdiWaitFile = XSDataInputWaitFile()
            xsdiWaitFile.setExpectedFile(oneXSDImage)
            xsdiWaitFile.setExpectedSize(self.dataInput.expectedSize)
            xsdiWaitFile.setTimeOut(self.dataInput.timeOut)
            edPluginWaitFile = self.loadPlugin(self.__strControlledPluginWaitFile)
            edPluginWaitFile.setDataInput(xsdiWaitFile)
            edPluginWaitFile.connectSUCCESS(self.doSuccessWaitFile)
            edPluginWaitFile.connectFAILURE(self.doFailureWaitFile)
            edPluginWaitFile.execute()
Пример #2
0
 def testCheckParameters(self):
     xsDataInput = XSDataInputWaitFile()
     xsDataInput.setExpectedFile(XSDataFile(XSDataString("toto")))
     xsDataInput.setExpectedSize(XSDataInteger(10))
     edPluginWaitFile = self.createPlugin()
     edPluginWaitFile.setDataInput(xsDataInput)
     edPluginWaitFile.checkParameters()
Пример #3
0
 def testCheckParameters(self):
     xsDataInput = XSDataInputWaitFile()
     xsDataInput.setExpectedFile(XSDataFile(XSDataString("toto")))
     xsDataInput.setExpectedSize(XSDataInteger(10))
     edPluginWaitFile = self.createPlugin()
     edPluginWaitFile.setDataInput(xsDataInput)
     edPluginWaitFile.checkParameters()
Пример #4
0
 def preProcess(self, _edObject=None):
     """
     """
     EDPluginControl.preProcess(self)
     self.DEBUG("EDPluginControlReadImageHeaderv10.preProcess")
     # First determine the type of image
     xsDataInputReadImageHeader = self.getDataInput()
     xsDataFileImage = xsDataInputReadImageHeader.getImage()
     self.strFileImagePath = xsDataFileImage.getPath().getValue()
     # Plugin for waiting for files
     self.edPluginExecWaitFile = self.loadPlugin(self.strPluginExecWaitFile)
     xsDataInputWaitFile = XSDataInputWaitFile()
     xsDataInputWaitFile.setExpectedFile(XSDataFile(XSDataString(self.strFileImagePath)))
     xsDataInputWaitFile.setExpectedSize(XSDataInteger(100000))
     xsDataInputWaitFile.setTimeOut(XSDataTime(self.fWaitFileTimeOut))
     self.edPluginExecWaitFile.setDataInput(xsDataInputWaitFile)
    def process(self, _edObject=None):
        EDPluginControl.process(self)
        EDVerbose.DEBUG("EDPluginControlDiffractionCTv1_2.process")
#===============================================================================
# Wait File
#===============================================================================
        edPluginWaitFile = self.loadPlugin(self.strControlledPluginWait)
        xsdin = XSDataInputWaitFile()
        xsdin.setExpectedFile(self.xsDataFileInputImage)
        xsdin.setExpectedSize(XSDataInteger(self.iImageSize))
        edPluginWaitFile.setDataInput(xsdin)
        edPluginWaitFile.connectSUCCESS(self.doSuccessWaitFile)
        edPluginWaitFile.connectFAILURE(self.doFailureWaitFile)
        edPluginWaitFile.executeSynchronous()

#===============================================================================
# #ReadHeader
#===============================================================================

        edPluginReadHeader = self.loadPlugin(self.strControlledPluginReadHeader)
        # Set the input data for the read header plugin
        xsDataInputReadHeader = XSDataInputReadHeader()

        xsDataInputReadHeader.setInputFile(self.xsDataFileInputImage)
        edPluginReadHeader.setDataInput(xsDataInputReadHeader)

        edPluginReadHeader.connectSUCCESS(self.doSuccessReadHeader)
        edPluginReadHeader.connectFAILURE(self.doFailureReadHeader)

        edPluginReadHeader.executeSynchronous()

################################################################################
# Powder Integration
################################################################################

        self.edPluginPowderIntegration.connectSUCCESS(self.doSuccessPowderIntegration)
        self.edPluginPowderIntegration.connectFAILURE(self.doFailurePowderIntegration)
        self.edPluginPowderIntegration.executeSynchronous()


        self.edPluginHDF5MapSpectra.connectSUCCESS(self.doSuccessWriteSinogram)
        self.edPluginHDF5MapSpectra.connectFAILURE(self.doFailureWriteSinogram)
        self.edPluginHDF5MapSpectra.execute()

        self.edPluginExportAsciiPowder.connectSUCCESS(self.doSuccessExportAsciiPowder)
        self.edPluginExportAsciiPowder.connectFAILURE(self.doFailureExportAsciiPowder)
        self.edPluginExportAsciiPowder.execute()
Пример #6
0
 def preProcess(self, _edObject=None):
     """
     """
     EDPluginControl.preProcess(self)
     self.DEBUG("EDPluginControlReadImageHeaderv10.preProcess")
     # First determine the type of image
     xsDataInputReadImageHeader = self.getDataInput()
     xsDataFileImage = xsDataInputReadImageHeader.getImage()
     self.strFileImagePath = xsDataFileImage.getPath().getValue()
     # Plugin for waiting for files
     self.edPluginExecWaitFile = self.loadPlugin(self.strPluginExecWaitFile)
     xsDataInputWaitFile = XSDataInputWaitFile()
     xsDataInputWaitFile.setExpectedFile(
         XSDataFile(XSDataString(self.strFileImagePath)))
     xsDataInputWaitFile.setExpectedSize(XSDataInteger(100000))
     xsDataInputWaitFile.setTimeOut(XSDataTime(self.fWaitFileTimeOut))
     self.edPluginExecWaitFile.setDataInput(xsDataInputWaitFile)
 def process(self, _edObject=None):
     EDPluginControl.process(self)
     EDVerbose.DEBUG("EDPluginBioSaxsAsciiExportv1_0.process")
     xsdiWaitFile = XSDataInputWaitFile()
     xsdiWaitFile.setExpectedFile(XSDataFile(self.dataInput.integratedImage.path))
     xsdiWaitFile.setExpectedSize(XSDataInteger(8196))  # size of the header
     self.__edPluginWaitFile.setDataInput(xsdiWaitFile)
     self.__edPluginWaitFile.connectSUCCESS(self.doSuccessWaitFile)
     self.__edPluginWaitFile.connectFAILURE(self.doFailureWaitFile)
     self.__edPluginWaitFile.executeSynchronous()
     if not self.isFailure():
         self.__edPluginSaxsGetMetadata.connectSUCCESS(self.doSucessGetMetadata)
         self.__edPluginSaxsGetMetadata.connectFAILURE(self.doFailureGetMetadata)
         self.__edPluginSaxsGetMetadata.executeSynchronous()
     if not self.isFailure():
         self.__edPluginSaxsCurves.connectSUCCESS(self.doSuccessSaxsCurves)
         self.__edPluginSaxsCurves.connectFAILURE(self.doFailureSaxsCurves)
         self.__edPluginSaxsCurves.executeSynchronous()
Пример #8
0
 def process(self, _edObject=None):
     EDPluginControl.process(self)
     EDVerbose.DEBUG("EDPluginBioSaxsAsciiExportv1_1.process")
     xsdiWaitFile = XSDataInputWaitFile()
     xsdiWaitFile.setExpectedFile(XSDataFile(self.dataInput.integratedImage.path))
     xsdiWaitFile.setExpectedSize(XSDataInteger(8196)) #size of the header
     self.__edPluginWaitFile.setDataInput(xsdiWaitFile)
     self.__edPluginWaitFile.connectSUCCESS(self.doSuccessWaitFile)
     self.__edPluginWaitFile.connectFAILURE(self.doFailureWaitFile)
     self.__edPluginWaitFile.executeSynchronous()
     if not self.isFailure():
         self.__edPluginSaxsGetMetadata.connectSUCCESS(self.doSucessGetMetadata)
         self.__edPluginSaxsGetMetadata.connectFAILURE(self.doFailureGetMetadata)
         self.__edPluginSaxsGetMetadata.executeSynchronous()
     if not self.isFailure():
         self.__edPluginSaxsCurves.connectSUCCESS(self.doSuccessSaxsCurves)
         self.__edPluginSaxsCurves.connectFAILURE(self.doFailureSaxsCurves)
         self.__edPluginSaxsCurves.executeSynchronous()
Пример #9
0
 def preProcess(self, _edObject=None):
     EDPluginControl.preProcess(self)
     EDVerbose.DEBUG("EDPluginControlPyarchThumbnailGeneratorv1_0.preProcess")
     # Check that the input image exists and is of the expected type
     strPathToDiffractionImage = self.getDataInput().getDiffractionImage().getPath().getValue()
     strImageFileNameExtension = os.path.splitext(strPathToDiffractionImage)[1]
     if not strImageFileNameExtension in [".img", ".marccd", ".mccd", ".cbf"]:
         print strImageFileNameExtension
         EDVerbose.error("Unknown image file name extension for pyarch thumbnail generator: %s" % strPathToDiffractionImage)
         self.setFailure()
     else:
         # Load the waitFile plugin
         xsDataInputWaitFile = XSDataInputWaitFile()
         xsDataInputWaitFile.setExpectedSize(XSDataInteger(self.__iExpectedSize))
         xsDataInputWaitFile.setExpectedFile(self.getDataInput().getDiffractionImage())
         if self.getDataInput().getWaitForFileTimeOut():
             xsDataInputWaitFile.setTimeOut(self.getDataInput().getWaitForFileTimeOut())
         self.__edPluginWaitFile = EDPluginWaitFile()
         self.__edPluginWaitFile.setDataInput(xsDataInputWaitFile)
         # Load the execution plugin
         self.__edPluginExecThumbnail = self.loadPlugin(self.__strExecThumbnailPluginName)
         xsDataInputExecThumbnail = XSDataInputExecThumbnail()
         xsDataInputExecThumbnail.setInputImagePath(self.getDataInput().getDiffractionImage())
         xsDataInputExecThumbnail.setLevelsInvert(XSDataBoolean(True))
         xsDataInputExecThumbnail.setLevelsMin(XSDataDoubleWithUnit(0.0))
         xsDataDoubleWithUnitLevelsMax = XSDataDoubleWithUnit(99.95)
         xsDataDoubleWithUnitLevelsMax.setUnit(XSDataString("%"))
         xsDataInputExecThumbnail.setLevelsMax(xsDataDoubleWithUnitLevelsMax)
         xsDataInputExecThumbnail.setFilterDilatation([XSDataInteger(4)])
         xsDataInputExecThumbnail.setLevelsColorize(XSDataBoolean(False))
         xsDataInputExecThumbnail.setThumbHeight(XSDataInteger(1024))
         xsDataInputExecThumbnail.setThumbWidth(XSDataInteger(1024))
         xsDataInputExecThumbnail.setKeepRatio(XSDataBoolean(False))
         # Output path
         strImageNameWithoutExt = os.path.basename(os.path.splitext(strPathToDiffractionImage)[0])
         strImageDirname = os.path.dirname(strPathToDiffractionImage)
         if self.getDataInput().getForcedOutputDirectory():
             strForcedOutputDirectory = self.getDataInput().getForcedOutputDirectory().getPath().getValue()
             if not os.access(strForcedOutputDirectory, os.W_OK):
                 EDVerbose.error("Cannot write to forced output directory : %s" % strForcedOutputDirectory)
                 self.setFailure()
             else:
                 self.strOutputPathWithoutExtension = os.path.join(strForcedOutputDirectory, strImageNameWithoutExt)
         else:
             # Try to store in the ESRF pyarch directory
             strOutputDirname = EDHandlerESRFPyarchv1_0.createPyarchFilePath(strImageDirname)
             # Check that output pyarch path exists and is writeable:
             bIsOk = False
             if strOutputDirname:
                 if not os.path.exists(strOutputDirname):
                     # Try to create the directory
                     try:
                         os.makedirs(strOutputDirname)
                         bIsOk = True
                     except BaseException, e:
                         EDVerbose.WARNING("Couldn't create the directory %s" % strOutputDirname)
                 elif os.access(strOutputDirname, os.W_OK):
                     bIsOk = True
             if not bIsOk:
                 EDVerbose.warning("Cannot write to pyarch directory: %s" % strOutputDirname)
                 strOutputDirname = tempfile.mkdtemp("", "EDPluginPyarchThumbnailv10_", "/tmp")
                 EDVerbose.warning("Writing thumbnail images to: %s" % strOutputDirname)
             self.strOutputPathWithoutExtension = os.path.join(strOutputDirname, strImageNameWithoutExt)
         self.strOutputPath = os.path.join(self.strOutputPathWithoutExtension + ".jpeg")
         xsDataInputExecThumbnail.setOutputPath(XSDataFile(XSDataString(self.strOutputPath)))
         self.__edPluginExecThumbnail.setDataInput(xsDataInputExecThumbnail)