def buildChildren(self, child_, nodeName_):
     if child_.nodeType == Node.ELEMENT_NODE and nodeName_ == "mxv1InputCharacterisation":
         obj_ = XSDataInputCharacterisation()
         obj_.build(child_)
         self.setMxv1InputCharacterisation(obj_)
     elif child_.nodeType == Node.ELEMENT_NODE and nodeName_ == "mxv1ResultCharacterisation_Reference":
         obj_ = XSDataResultCharacterisation()
         obj_.build(child_)
         self.setMxv1ResultCharacterisation_Reference(obj_)
     elif child_.nodeType == Node.ELEMENT_NODE and nodeName_ == "mxv2DataCollection":
         obj_ = XSDataCollection()
         obj_.build(child_)
         self.setMxv2DataCollection(obj_)
     elif child_.nodeType == Node.ELEMENT_NODE and nodeName_ == "mxv2DataCollection_Reference":
         obj_ = XSDataCollection()
         obj_.build(child_)
         self.setMxv2DataCollection_Reference(obj_)
     elif child_.nodeType == Node.ELEMENT_NODE and nodeName_ == "possibleOrientations":
         obj_ = kappa_alignment_response()
         obj_.build(child_)
         self.setPossibleOrientations(obj_)
     elif child_.nodeType == Node.ELEMENT_NODE and nodeName_ == "omega":
         obj_ = XSDataAngle()
         obj_.build(child_)
         self.setOmega(obj_)
     elif child_.nodeType == Node.ELEMENT_NODE and nodeName_ == "kappa":
         obj_ = XSDataAngle()
         obj_.build(child_)
         self.setKappa(obj_)
     elif child_.nodeType == Node.ELEMENT_NODE and nodeName_ == "phi":
         obj_ = XSDataAngle()
         obj_.build(child_)
         self.setPhi(obj_)
     XSDataInputInterface.buildChildren(self, child_, nodeName_)
Exemple #2
0
 def exportChildren(self, outfile, level, name_='XSDataInputInterfacev2_2'):
     XSDataInputInterface.exportChildren(self, outfile, level, name_)
     if self.__mxv1InputCharacterisation is not None:
         self.mxv1InputCharacterisation.export(
             outfile, level, name_='mxv1InputCharacterisation')
     else:
         warnEmptyAttribute("mxv1InputCharacterisation",
                            "XSDataInputCharacterisation")
     if self.__mxv1ResultCharacterisation_Reference is not None:
         self.mxv1ResultCharacterisation_Reference.export(
             outfile, level, name_='mxv1ResultCharacterisation_Reference')
     if self.__mxv2DataCollection is not None:
         self.mxv2DataCollection.export(outfile,
                                        level,
                                        name_='mxv2DataCollection')
     if self.__mxv2DataCollection_Reference is not None:
         self.mxv2DataCollection_Reference.export(
             outfile, level, name_='mxv2DataCollection_Reference')
     if self.__possibleOrientations is not None:
         self.possibleOrientations.export(outfile,
                                          level,
                                          name_='possibleOrientations')
     if self.__omega is not None:
         self.omega.export(outfile, level, name_='omega')
     if self.__kappa is not None:
         self.kappa.export(outfile, level, name_='kappa')
     if self.__phi is not None:
         self.phi.export(outfile, level, name_='phi')
def functionXMLout(_strXMLin, _strXMLout):
    """
    This is an example of XMLout function ... it prints only the name of the file created
    @param _srXMLin: The XML string used to launch the job
    @type _strXMLin: python string with the input XML
    @param _strXMLout: The XML string retrieved  job
    @type _strXMLout: python string with the output XML    
    @return: None     
    """
    xsDataInputInterface = XSDataInputInterface.parseString(_strXMLin)
    strImagePath = xsDataInputInterface.getImagePath()[0].getPath().getValue()
    EDVerbose.screen("Successful processing of image %s" % strImagePath)
    strResultText = os.path.dirname(strImagePath) + " " + os.path.basename(strImagePath) + " "
    xsDataResultInterface = XSDataResultInterface.parseString(_strXMLout)
    xsDataResultCharacterisation = xsDataResultInterface.getResultCharacterisation()
    # 
    xsDataIndexingResult = xsDataResultCharacterisation.getIndexingResult()
    #strResultText = _strDirectoryVisit + " " + strFileName + " "
    if (xsDataIndexingResult is None):
        strResultText += "Indexing failed"
    else:
        xsDataSelectedSolution = xsDataIndexingResult.getSelectedSolution()
        fMosaicityEstimation = xsDataSelectedSolution.getCrystal().getMosaicity().getValue()
        strResultText += "Mosaicity: %.2f " % fMosaicityEstimation
        xsDataStrategyResult = xsDataResultCharacterisation.getStrategyResult()
        if (xsDataStrategyResult is None):
            strResultText += "No strategy result"
        else:
            xsDataCollectionPlan = xsDataStrategyResult.getCollectionPlan()[0]
            xsDataStrategySummary = xsDataCollectionPlan.getStrategySummary()
            fRankingResolution = xsDataStrategySummary.getRankingResolution().getValue()
            strResultText += "Resolution: %.2f" % fRankingResolution
    writeToResultFile(strResultText)
	def __init__(self, inputCharacterisation=None, comments=None, shortComments=None, dataCollectionId=None, transmission=None, wavelength=None, beamPosY=None, beamPosX=None, resultsFilePath=None, generatedTemplateFile=None, templateMode=None, beamSizeY=None, beamSizeX=None, beamSize=None, minExposureTimePerImage=None, flux=None, imagePath=None, sample=None, diffractionPlan=None, experimentalCondition=None, phi=None, kappa=None, omega=None, possibleOrientations=None, mxv2DataCollection_Reference=None, mxv2DataCollection=None, mxv1ResultCharacterisation_Reference=None, mxv1InputCharacterisation=None):
		XSDataInputInterface.__init__(self, inputCharacterisation, comments, shortComments, dataCollectionId, transmission, wavelength, beamPosY, beamPosX, resultsFilePath, generatedTemplateFile, templateMode, beamSizeY, beamSizeX, beamSize, minExposureTimePerImage, flux, imagePath, sample, diffractionPlan, experimentalCondition)
		checkType("XSDataInputInterfacev2_2", "Constructor of XSDataInputInterfacev2_2", mxv1InputCharacterisation, "XSDataInputCharacterisation")
		self.__mxv1InputCharacterisation = mxv1InputCharacterisation
		checkType("XSDataInputInterfacev2_2", "Constructor of XSDataInputInterfacev2_2", mxv1ResultCharacterisation_Reference, "XSDataResultCharacterisation")
		self.__mxv1ResultCharacterisation_Reference = mxv1ResultCharacterisation_Reference
		checkType("XSDataInputInterfacev2_2", "Constructor of XSDataInputInterfacev2_2", mxv2DataCollection, "XSDataCollection")
		self.__mxv2DataCollection = mxv2DataCollection
		checkType("XSDataInputInterfacev2_2", "Constructor of XSDataInputInterfacev2_2", mxv2DataCollection_Reference, "XSDataCollection")
		self.__mxv2DataCollection_Reference = mxv2DataCollection_Reference
		checkType("XSDataInputInterfacev2_2", "Constructor of XSDataInputInterfacev2_2", possibleOrientations, "kappa_alignment_response")
		self.__possibleOrientations = possibleOrientations
		checkType("XSDataInputInterfacev2_2", "Constructor of XSDataInputInterfacev2_2", omega, "XSDataAngle")
		self.__omega = omega
		checkType("XSDataInputInterfacev2_2", "Constructor of XSDataInputInterfacev2_2", kappa, "XSDataAngle")
		self.__kappa = kappa
		checkType("XSDataInputInterfacev2_2", "Constructor of XSDataInputInterfacev2_2", phi, "XSDataAngle")
		self.__phi = phi
Exemple #5
0
 def buildChildren(self, child_, nodeName_):
     if child_.nodeType == Node.ELEMENT_NODE and \
      nodeName_ == 'mxv1InputCharacterisation':
         obj_ = XSDataInputCharacterisation()
         obj_.build(child_)
         self.setMxv1InputCharacterisation(obj_)
     elif child_.nodeType == Node.ELEMENT_NODE and \
      nodeName_ == 'mxv1ResultCharacterisation_Reference':
         obj_ = XSDataResultCharacterisation()
         obj_.build(child_)
         self.setMxv1ResultCharacterisation_Reference(obj_)
     elif child_.nodeType == Node.ELEMENT_NODE and \
      nodeName_ == 'mxv2DataCollection':
         obj_ = XSDataCollection()
         obj_.build(child_)
         self.setMxv2DataCollection(obj_)
     elif child_.nodeType == Node.ELEMENT_NODE and \
      nodeName_ == 'mxv2DataCollection_Reference':
         obj_ = XSDataCollection()
         obj_.build(child_)
         self.setMxv2DataCollection_Reference(obj_)
     elif child_.nodeType == Node.ELEMENT_NODE and \
      nodeName_ == 'possibleOrientations':
         obj_ = kappa_alignment_response()
         obj_.build(child_)
         self.setPossibleOrientations(obj_)
     elif child_.nodeType == Node.ELEMENT_NODE and \
      nodeName_ == 'omega':
         obj_ = XSDataAngle()
         obj_.build(child_)
         self.setOmega(obj_)
     elif child_.nodeType == Node.ELEMENT_NODE and \
      nodeName_ == 'kappa':
         obj_ = XSDataAngle()
         obj_.build(child_)
         self.setKappa(obj_)
     elif child_.nodeType == Node.ELEMENT_NODE and \
      nodeName_ == 'phi':
         obj_ = XSDataAngle()
         obj_.build(child_)
         self.setPhi(obj_)
     XSDataInputInterface.buildChildren(self, child_, nodeName_)
	def exportChildren(self, outfile, level, name_='XSDataInputInterfacev2_2'):
		XSDataInputInterface.exportChildren(self, outfile, level, name_)
		if self.__mxv1InputCharacterisation is not None:
			self.mxv1InputCharacterisation.export(outfile, level, name_='mxv1InputCharacterisation')
		else:
			warnEmptyAttribute("mxv1InputCharacterisation", "XSDataInputCharacterisation")
		if self.__mxv1ResultCharacterisation_Reference is not None:
			self.mxv1ResultCharacterisation_Reference.export(outfile, level, name_='mxv1ResultCharacterisation_Reference')
		if self.__mxv2DataCollection is not None:
			self.mxv2DataCollection.export(outfile, level, name_='mxv2DataCollection')
		if self.__mxv2DataCollection_Reference is not None:
			self.mxv2DataCollection_Reference.export(outfile, level, name_='mxv2DataCollection_Reference')
		if self.__possibleOrientations is not None:
			self.possibleOrientations.export(outfile, level, name_='possibleOrientations')
		if self.__omega is not None:
			self.omega.export(outfile, level, name_='omega')
		if self.__kappa is not None:
			self.kappa.export(outfile, level, name_='kappa')
		if self.__phi is not None:
			self.phi.export(outfile, level, name_='phi')
def functionXMLerror(_strXMLin):
    """
    @param _strXMLin: The XML string used to launch the job
    @type _strXMLin: python string with the input XML
    @return: None     
    """
    xsDataInputInterface = XSDataInputInterface.parseString(_strXMLin)
    strImagePath = xsDataInputInterface.getImagePath()[0].getPath().getValue()
    strResultText = os.path.dirname(strImagePath) + " " + os.path.basename(strImagePath) + " "
    strResultText = strResultText + "Processing failed."
    writeToResultFile(strResultText)
    return None
 def exportChildren(self, outfile, level, name_="XSDataInputInterfacev2_2"):
     XSDataInputInterface.exportChildren(self, outfile, level, name_)
     if self._mxv1InputCharacterisation is not None:
         self.mxv1InputCharacterisation.export(outfile, level, name_="mxv1InputCharacterisation")
     else:
         warnEmptyAttribute("mxv1InputCharacterisation", "XSDataInputCharacterisation")
     if self._mxv1ResultCharacterisation_Reference is not None:
         self.mxv1ResultCharacterisation_Reference.export(
             outfile, level, name_="mxv1ResultCharacterisation_Reference"
         )
     if self._mxv2DataCollection is not None:
         self.mxv2DataCollection.export(outfile, level, name_="mxv2DataCollection")
     if self._mxv2DataCollection_Reference is not None:
         self.mxv2DataCollection_Reference.export(outfile, level, name_="mxv2DataCollection_Reference")
     if self._possibleOrientations is not None:
         self.possibleOrientations.export(outfile, level, name_="possibleOrientations")
     if self._omega is not None:
         self.omega.export(outfile, level, name_="omega")
     if self._kappa is not None:
         self.kappa.export(outfile, level, name_="kappa")
     if self._phi is not None:
         self.phi.export(outfile, level, name_="phi")
    def testExecute(self):
        """
        Runs the plugin and marshals the obtained XML file into an XSDataInputInterface object 
        """
        self.run()
        edPlugin = self.getPlugin()
        xsDataOutputObtained = edPlugin.getDataOutput()
        strXMLFile = xsDataOutputObtained.getPath().getValue()
        
        strObtainedOutput = self.readAndParseFile(strXMLFile)
        xsDataInputInterfaceObtained = XSDataInputInterface.parseString(strObtainedOutput)

        EDVerbose.DEBUG("Checking obtained result...")
        EDVerbose.DEBUG("Found class of type: %s" % xsDataInputInterfaceObtained.__class__.__name__)
        # Just quickly check that we have an actual XSDataInputInterface object 
        EDAssert.equal(xsDataInputInterfaceObtained.__class__.__name__ == "XSDataInputInterface", True)
Exemple #10
0
    def testExecute(self):
        """
        Runs the plugin and marshals the obtained XML file into an XSDataInputInterface object 
        """
        self.run()
        edPlugin = self.getPlugin()
        xsDataOutputObtained = edPlugin.getDataOutput()
        strXMLFile = xsDataOutputObtained.getPath().getValue()

        strObtainedOutput = self.readAndParseFile(strXMLFile)
        xsDataInputInterfaceObtained = XSDataInputInterface.parseString(
            strObtainedOutput)

        self.DEBUG("Checking obtained result...")
        self.DEBUG("Found class of type: %s" %
                   xsDataInputInterfaceObtained.__class__.__name__)
        # Just quickly check that we have an actual XSDataInputInterface object
        EDAssert.equal(
            xsDataInputInterfaceObtained.__class__.__name__ ==
            "XSDataInputInterface", True)
def functionXMLin(_strFilename):
    """Here we create the XML string to be passed to the EDNA plugin from the input strFilename
    This can / should be modified by the final user
    
    @param _strFilename: full path of the input file
    @type _strFilename: python string representing the path
    @return: string  
    """
    EDVerbose.screen("Starting processing of image %s" % (_strFilename))
    # First check if the filename end with .img or .mccd:
    strXML = None
    if (_strFilename.endswith(".img") or _strFilename.endswith(".mccd") or _strFilename.endswith(".cbf")):
        xsDataInputInterface = XSDataInputInterface()
        xsDataDiffractionPlan = XSDataDiffractionPlan()
        xsDataDiffractionPlan.setMaxExposureTimePerDataCollection(XSDataTime(EDParallelExecuteMXv1Characterisation.m_fMaxExposureTime))
        xsDataInputInterface.setDiffractionPlan(xsDataDiffractionPlan)
        xsDataFile = XSDataFile()
        xsDataFile.setPath(XSDataString(_strFilename))
        xsDataInputInterface.addImagePath(xsDataFile)
        strXML = xsDataInputInterface.marshal()
    else:
        EDVerbose.screen("File name not ending with .img or .mccd - ignored : %s" % _strFilename)
    return strXML
Exemple #12
0
 def __init__(self,
              inputCharacterisation=None,
              comments=None,
              shortComments=None,
              dataCollectionId=None,
              transmission=None,
              wavelength=None,
              beamPosY=None,
              beamPosX=None,
              resultsFilePath=None,
              generatedTemplateFile=None,
              templateMode=None,
              beamSizeY=None,
              beamSizeX=None,
              beamSize=None,
              minExposureTimePerImage=None,
              flux=None,
              imagePath=None,
              sample=None,
              diffractionPlan=None,
              experimentalCondition=None,
              phi=None,
              kappa=None,
              omega=None,
              possibleOrientations=None,
              mxv2DataCollection_Reference=None,
              mxv2DataCollection=None,
              mxv1ResultCharacterisation_Reference=None,
              mxv1InputCharacterisation=None):
     XSDataInputInterface.__init__(
         self, inputCharacterisation, comments, shortComments,
         dataCollectionId, transmission, wavelength, beamPosY, beamPosX,
         resultsFilePath, generatedTemplateFile, templateMode, beamSizeY,
         beamSizeX, beamSize, minExposureTimePerImage, flux, imagePath,
         sample, diffractionPlan, experimentalCondition)
     checkType("XSDataInputInterfacev2_2",
               "Constructor of XSDataInputInterfacev2_2",
               mxv1InputCharacterisation, "XSDataInputCharacterisation")
     self.__mxv1InputCharacterisation = mxv1InputCharacterisation
     checkType("XSDataInputInterfacev2_2",
               "Constructor of XSDataInputInterfacev2_2",
               mxv1ResultCharacterisation_Reference,
               "XSDataResultCharacterisation")
     self.__mxv1ResultCharacterisation_Reference = mxv1ResultCharacterisation_Reference
     checkType("XSDataInputInterfacev2_2",
               "Constructor of XSDataInputInterfacev2_2",
               mxv2DataCollection, "XSDataCollection")
     self.__mxv2DataCollection = mxv2DataCollection
     checkType("XSDataInputInterfacev2_2",
               "Constructor of XSDataInputInterfacev2_2",
               mxv2DataCollection_Reference, "XSDataCollection")
     self.__mxv2DataCollection_Reference = mxv2DataCollection_Reference
     checkType("XSDataInputInterfacev2_2",
               "Constructor of XSDataInputInterfacev2_2",
               possibleOrientations, "kappa_alignment_response")
     self.__possibleOrientations = possibleOrientations
     checkType("XSDataInputInterfacev2_2",
               "Constructor of XSDataInputInterfacev2_2", omega,
               "XSDataAngle")
     self.__omega = omega
     checkType("XSDataInputInterfacev2_2",
               "Constructor of XSDataInputInterfacev2_2", kappa,
               "XSDataAngle")
     self.__kappa = kappa
     checkType("XSDataInputInterfacev2_2",
               "Constructor of XSDataInputInterfacev2_2", phi,
               "XSDataAngle")
     self.__phi = phi
    def preProcess(self, _edPlugin=None):
        """
        This method prepares the input for the CCP4i plugin and loads it.
        """
        EDPluginControl.preProcess(self, _edPlugin)
        self.DEBUG("EDPluginControlInterfaceToMXCuBEv1_3.preProcess...")

        self.tStart = time.time()

        xsDataInputMXCuBE = self.getDataInput()
        xsDataInputInterface = XSDataInputInterface()
        self.edPluginControlInterface = self.loadPlugin(self.strPluginControlInterface)
        for xsDataSetMXCuBE in xsDataInputMXCuBE.getDataSet():
            for xsDataFile in xsDataSetMXCuBE.getImageFile():
                xsDataInputInterface.addImagePath(xsDataFile)

        xsDataInputInterface.setExperimentalCondition(xsDataInputMXCuBE.getExperimentalCondition())
        xsDataInputInterface.setDiffractionPlan(xsDataInputMXCuBE.getDiffractionPlan())
        xsDataInputInterface.setSample(xsDataInputMXCuBE.getSample())
        xsDataInputInterface.setDataCollectionId(xsDataInputMXCuBE.getDataCollectionId())
        self.edPluginControlInterface.setDataInput(xsDataInputInterface)

        #self.edPluginExecOutputHTML = self.loadPlugin(self.strPluginExecOutputHTMLName, "OutputHTML")
        self.edPluginExecSimpleHTML = self.loadPlugin(self.strPluginExecSimpleHTMLName, "SimpleHTML")
        self.xsDataResultMXCuBE = XSDataResultMXCuBE()
Exemple #14
0
    def process(self, _edPlugin=None):
        EDPluginControl.process(self, _edPlugin)
        self.DEBUG("EDPluginControlInterfaceToMXCuBEv1_3.process...")

        xsDataInputMXCuBE = self.getDataInput()
        xsDataInputInterface = XSDataInputInterface()
        self.edPluginControlInterface = self.loadPlugin(
            self.strPluginControlInterface)
        xsDataFirstImage = None
        for xsDataSetMXCuBE in xsDataInputMXCuBE.getDataSet():
            for xsDataFile in xsDataSetMXCuBE.getImageFile():
                xsDataInputInterface.addImagePath(xsDataFile)
                if xsDataFirstImage is None:
                    xsDataFirstImage = xsDataFile

        xsDataExperimentalCondition = self.getFluxAndBeamSizeFromISPyB(xsDataFirstImage, \
                                                            xsDataInputMXCuBE.getExperimentalCondition())

        xsDataInputInterface.setExperimentalCondition(
            xsDataExperimentalCondition)
        xsDataInputInterface.setDiffractionPlan(
            xsDataInputMXCuBE.getDiffractionPlan())
        xsDataInputInterface.setSample(xsDataInputMXCuBE.getSample())
        xsDataInputInterface.setDataCollectionId(
            xsDataInputMXCuBE.getDataCollectionId())
        self.edPluginControlInterface.setDataInput(xsDataInputInterface)

        if self.edPluginControlInterface is not None:
            self.connectProcess(
                self.edPluginControlInterface.executeSynchronous)
            self.edPluginControlInterface.connectSUCCESS(
                self.doSuccessActionInterface)
            self.edPluginControlInterface.connectFAILURE(
                self.doFailureActionInterface)
    def process(self, _edPlugin=None):
        EDPluginControl.process(self, _edPlugin)
        self.DEBUG("EDPluginControlInterfaceToMXCuBEv1_3.process...")

        xsDataInputMXCuBE = self.getDataInput()
        xsDataInputInterface = XSDataInputInterface()
        self.edPluginControlInterface = self.loadPlugin(self.strPluginControlInterface)
        xsDataFirstImage = None
        for xsDataSetMXCuBE in xsDataInputMXCuBE.getDataSet():
            for xsDataFile in xsDataSetMXCuBE.getImageFile():
                xsDataInputInterface.addImagePath(xsDataFile)
                if xsDataFirstImage is None:
                    xsDataFirstImage = xsDataFile
        
        xsDataExperimentalCondition = self.getFluxAndBeamSizeFromISPyB(xsDataFirstImage, \
                                                            xsDataInputMXCuBE.getExperimentalCondition())
        
        xsDataInputInterface.setExperimentalCondition(xsDataExperimentalCondition)
        xsDataInputInterface.setDiffractionPlan(xsDataInputMXCuBE.getDiffractionPlan())
        xsDataInputInterface.setSample(xsDataInputMXCuBE.getSample())
        xsDataInputInterface.setDataCollectionId(xsDataInputMXCuBE.getDataCollectionId())
        self.edPluginControlInterface.setDataInput(xsDataInputInterface)

        if self.edPluginControlInterface is not None:
            self.connectProcess(self.edPluginControlInterface.executeSynchronous)
            self.edPluginControlInterface.connectSUCCESS(self.doSuccessActionInterface)
            self.edPluginControlInterface.connectFAILURE(self.doFailureActionInterface)
    def process(self, _edPlugin=None):
        EDPluginControl.process(self, _edPlugin)
        self.DEBUG("EDPluginControlInterfaceToMXCuBEv1_4.process...")

        xsDataInputMXCuBE = self.getDataInput()
        xsDataInputInterface = XSDataInputInterface()
        self.edPluginControlInterface = self.loadPlugin(self.strPluginControlInterface)
        self.xsDataFirstImage = None
        for xsDataSetMXCuBE in xsDataInputMXCuBE.getDataSet():
            for xsDataFile in xsDataSetMXCuBE.getImageFile():
                if xsDataFile.path.value.endswith(".h5"):
                    self.bIsEigerDetector = True
                    self.xsDataFirstImage = xsDataFile
                    xsDataInputControlH5ToCBF = XSDataInputControlH5ToCBF()
                    xsDataInputControlH5ToCBF.hdf5File = XSDataFile(xsDataFile.path)
                    xsDataInputControlH5ToCBF.imageNumber = XSDataInteger(EDUtilsImage.getImageNumber(xsDataFile.path.value))
                    edPluginControlH5ToCBF = self.loadPlugin(self.strPluginControlH5ToCBF, "ControlH5ToCBF")
                    edPluginControlH5ToCBF.dataInput = xsDataInputControlH5ToCBF
                    edPluginControlH5ToCBF.executeSynchronous()
                    cbfFile = edPluginControlH5ToCBF.dataOutput.outputCBFFile
                    xsDataInputInterface.addImagePath(cbfFile)
                else:
                    xsDataInputInterface.addImagePath(xsDataFile)
                if self.xsDataFirstImage is None:
                    self.xsDataFirstImage = xsDataFile

        # Check that images are on disk, otherwise wait
        for xsDataImagePath in xsDataInputInterface.imagePath:
            imagePath = xsDataImagePath.path.value
            if os.path.exists(imagePath):
                message = "Input file ok: {0}".format(imagePath)
                self.screen(message)
                self.sendMessageToMXCuBE(message)
            else:
                self.sendMessageToMXCuBE("Waiting for file: {0}, timeout {1} s".format(imagePath, self.fMXWaitFileTimeOut))
                edPluginMXWaitFile = self.loadPlugin(self.strPluginMXWaitFileName)
                xsDataInputMXWaitFile = XSDataInputMXWaitFile()
                xsDataInputMXWaitFile.file = XSDataFile(XSDataString(imagePath))
                xsDataInputMXWaitFile.setSize(XSDataInteger(self.minImageSize))
                xsDataInputMXWaitFile.setTimeOut(XSDataTime(self.fMXWaitFileTimeOut))
                self.DEBUG("Wait file timeOut set to %f" % self.fMXWaitFileTimeOut)
                edPluginMXWaitFile.setDataInput(xsDataInputMXWaitFile)
                edPluginMXWaitFile.executeSynchronous()
                if edPluginMXWaitFile.dataOutput.timedOut.value:
                    errorMessage = "ERROR! File {0} does not exist on disk.".format(imagePath)
                    self.ERROR(errorMessage)
                    self.sendMessageToMXCuBE(errorMessage, "error")
                    self.setFailure()
                    break


        xsDataExperimentalCondition = self.getFluxAndBeamSizeFromISPyB(self.xsDataFirstImage, \
                                                            xsDataInputMXCuBE.getExperimentalCondition())

        xsDataInputInterface.setExperimentalCondition(xsDataExperimentalCondition)
        xsDataInputInterface.setDiffractionPlan(xsDataInputMXCuBE.getDiffractionPlan())
        xsDataInputInterface.setSample(xsDataInputMXCuBE.getSample())
        xsDataInputInterface.setDataCollectionId(xsDataInputMXCuBE.getDataCollectionId())
        self.edPluginControlInterface.setDataInput(xsDataInputInterface)

        if not self.isFailure() and self.edPluginControlInterface is not None:
            self.connectProcess(self.edPluginControlInterface.executeSynchronous)
            self.edPluginControlInterface.connectSUCCESS(self.doSuccessActionInterface)
            self.edPluginControlInterface.connectFAILURE(self.doFailureActionInterface)
    def process(self, _edPlugin=None):
        EDPluginControl.process(self, _edPlugin)
        self.DEBUG("EDPluginControlInterfaceToMXCuBEv1_4.process...")

        xsDataInputMXCuBE = self.getDataInput()
        xsDataInputInterface = XSDataInputInterface()
        self.edPluginControlInterface = self.loadPlugin(self.strPluginControlInterface)
        self.xsDataFirstImage = None
        for xsDataSetMXCuBE in xsDataInputMXCuBE.getDataSet():
            for xsDataFile in xsDataSetMXCuBE.getImageFile():
                if xsDataFile.path.value.endswith(".h5"):
                    self.bIsEigerDetector = True
                    self.xsDataFirstImage = xsDataFile
                    xsDataInputControlH5ToCBF = XSDataInputControlH5ToCBF()
                    xsDataInputControlH5ToCBF.hdf5File = XSDataFile(xsDataFile.path)
                    xsDataInputControlH5ToCBF.imageNumber = XSDataInteger(
                        EDUtilsImage.getImageNumber(xsDataFile.path.value)
                    )
                    edPluginControlH5ToCBF = self.loadPlugin(self.strPluginControlH5ToCBF, "ControlH5ToCBF")
                    edPluginControlH5ToCBF.dataInput = xsDataInputControlH5ToCBF
                    edPluginControlH5ToCBF.executeSynchronous()
                    cbfFile = edPluginControlH5ToCBF.dataOutput.outputCBFFile
                    xsDataInputInterface.addImagePath(cbfFile)
                else:
                    xsDataInputInterface.addImagePath(xsDataFile)
                if self.xsDataFirstImage is None:
                    self.xsDataFirstImage = xsDataFile

        xsDataExperimentalCondition = self.getFluxAndBeamSizeFromISPyB(
            self.xsDataFirstImage, xsDataInputMXCuBE.getExperimentalCondition()
        )

        xsDataInputInterface.setExperimentalCondition(xsDataExperimentalCondition)
        xsDataInputInterface.setDiffractionPlan(xsDataInputMXCuBE.getDiffractionPlan())
        xsDataInputInterface.setSample(xsDataInputMXCuBE.getSample())
        xsDataInputInterface.setDataCollectionId(xsDataInputMXCuBE.getDataCollectionId())
        self.edPluginControlInterface.setDataInput(xsDataInputInterface)

        if self.edPluginControlInterface is not None:
            self.connectProcess(self.edPluginControlInterface.executeSynchronous)
            self.edPluginControlInterface.connectSUCCESS(self.doSuccessActionInterface)
            self.edPluginControlInterface.connectFAILURE(self.doFailureActionInterface)
 def __init__(self,
              inputCharacterisation=None,
              comments=None,
              shortComments=None,
              dataCollectionId=None,
              transmission=None,
              wavelength=None,
              beamPosY=None,
              beamPosX=None,
              resultsFilePath=None,
              generatedTemplateFile=None,
              templateMode=None,
              beamSizeY=None,
              beamSizeX=None,
              beamSize=None,
              minExposureTimePerImage=None,
              flux=None,
              imagePath=None,
              sample=None,
              diffractionPlan=None,
              experimentalCondition=None,
              phi=None,
              kappa=None,
              omega=None,
              possibleOrientations=None,
              mxv2DataCollection_Reference=None,
              mxv2DataCollection=None,
              mxv1ResultCharacterisation_Reference=None,
              mxv1InputCharacterisation=None):
     XSDataInputInterface.__init__(
         self, inputCharacterisation, comments, shortComments,
         dataCollectionId, transmission, wavelength, beamPosY, beamPosX,
         resultsFilePath, generatedTemplateFile, templateMode, beamSizeY,
         beamSizeX, beamSize, minExposureTimePerImage, flux, imagePath,
         sample, diffractionPlan, experimentalCondition)
     if mxv1InputCharacterisation is None:
         self._mxv1InputCharacterisation = None
     elif mxv1InputCharacterisation.__class__.__name__ == "XSDataInputCharacterisation":
         self._mxv1InputCharacterisation = mxv1InputCharacterisation
     else:
         strMessage = "ERROR! XSDataInputInterfacev2_2 constructor argument 'mxv1InputCharacterisation' is not XSDataInputCharacterisation but %s" % self._mxv1InputCharacterisation.__class__.__name__
         raise BaseException(strMessage)
     if mxv1ResultCharacterisation_Reference is None:
         self._mxv1ResultCharacterisation_Reference = None
     elif mxv1ResultCharacterisation_Reference.__class__.__name__ == "XSDataResultCharacterisation":
         self._mxv1ResultCharacterisation_Reference = mxv1ResultCharacterisation_Reference
     else:
         strMessage = "ERROR! XSDataInputInterfacev2_2 constructor argument 'mxv1ResultCharacterisation_Reference' is not XSDataResultCharacterisation but %s" % self._mxv1ResultCharacterisation_Reference.__class__.__name__
         raise BaseException(strMessage)
     if mxv2DataCollection is None:
         self._mxv2DataCollection = None
     elif mxv2DataCollection.__class__.__name__ == "XSDataCollection":
         self._mxv2DataCollection = mxv2DataCollection
     else:
         strMessage = "ERROR! XSDataInputInterfacev2_2 constructor argument 'mxv2DataCollection' is not XSDataCollection but %s" % self._mxv2DataCollection.__class__.__name__
         raise BaseException(strMessage)
     if mxv2DataCollection_Reference is None:
         self._mxv2DataCollection_Reference = None
     elif mxv2DataCollection_Reference.__class__.__name__ == "XSDataCollection":
         self._mxv2DataCollection_Reference = mxv2DataCollection_Reference
     else:
         strMessage = "ERROR! XSDataInputInterfacev2_2 constructor argument 'mxv2DataCollection_Reference' is not XSDataCollection but %s" % self._mxv2DataCollection_Reference.__class__.__name__
         raise BaseException(strMessage)
     if possibleOrientations is None:
         self._possibleOrientations = None
     elif possibleOrientations.__class__.__name__ == "kappa_alignment_response":
         self._possibleOrientations = possibleOrientations
     else:
         strMessage = "ERROR! XSDataInputInterfacev2_2 constructor argument 'possibleOrientations' is not kappa_alignment_response but %s" % self._possibleOrientations.__class__.__name__
         raise BaseException(strMessage)
     if omega is None:
         self._omega = None
     elif omega.__class__.__name__ == "XSDataAngle":
         self._omega = omega
     else:
         strMessage = "ERROR! XSDataInputInterfacev2_2 constructor argument 'omega' is not XSDataAngle but %s" % self._omega.__class__.__name__
         raise BaseException(strMessage)
     if kappa is None:
         self._kappa = None
     elif kappa.__class__.__name__ == "XSDataAngle":
         self._kappa = kappa
     else:
         strMessage = "ERROR! XSDataInputInterfacev2_2 constructor argument 'kappa' is not XSDataAngle but %s" % self._kappa.__class__.__name__
         raise BaseException(strMessage)
     if phi is None:
         self._phi = None
     elif phi.__class__.__name__ == "XSDataAngle":
         self._phi = phi
     else:
         strMessage = "ERROR! XSDataInputInterfacev2_2 constructor argument 'phi' is not XSDataAngle but %s" % self._phi.__class__.__name__
         raise BaseException(strMessage)
Exemple #19
0
    def preProcess(self, _edPlugin=None):
        """
        This method prepares the input for the CCP4i plugin and loads it.
        """
        EDPluginControl.preProcess(self, _edPlugin)
        self.DEBUG("EDPluginControlInterfaceToMXCuBEv1_3.preProcess...")

        self.tStart = time.time()

        xsDataInputMXCuBE = self.getDataInput()
        xsDataInputInterface = XSDataInputInterface()
        self.edPluginControlInterface = self.loadPlugin(
            self.strPluginControlInterface)
        for xsDataSetMXCuBE in xsDataInputMXCuBE.getDataSet():
            for xsDataFile in xsDataSetMXCuBE.getImageFile():
                xsDataInputInterface.addImagePath(xsDataFile)

        xsDataInputInterface.setExperimentalCondition(
            xsDataInputMXCuBE.getExperimentalCondition())
        xsDataInputInterface.setDiffractionPlan(
            xsDataInputMXCuBE.getDiffractionPlan())
        xsDataInputInterface.setSample(xsDataInputMXCuBE.getSample())
        xsDataInputInterface.setDataCollectionId(
            xsDataInputMXCuBE.getDataCollectionId())
        self.edPluginControlInterface.setDataInput(xsDataInputInterface)

        #self.edPluginExecOutputHTML = self.loadPlugin(self.strPluginExecOutputHTMLName, "OutputHTML")
        self.edPluginExecSimpleHTML = self.loadPlugin(
            self.strPluginExecSimpleHTMLName, "SimpleHTML")
        self.xsDataResultMXCuBE = XSDataResultMXCuBE()
 def __init__(
     self,
     inputCharacterisation=None,
     comments=None,
     shortComments=None,
     dataCollectionId=None,
     transmission=None,
     wavelength=None,
     beamPosY=None,
     beamPosX=None,
     resultsFilePath=None,
     generatedTemplateFile=None,
     templateMode=None,
     beamSizeY=None,
     beamSizeX=None,
     beamSize=None,
     minExposureTimePerImage=None,
     flux=None,
     imagePath=None,
     sample=None,
     diffractionPlan=None,
     experimentalCondition=None,
     phi=None,
     kappa=None,
     omega=None,
     possibleOrientations=None,
     mxv2DataCollection_Reference=None,
     mxv2DataCollection=None,
     mxv1ResultCharacterisation_Reference=None,
     mxv1InputCharacterisation=None,
 ):
     XSDataInputInterface.__init__(
         self,
         inputCharacterisation,
         comments,
         shortComments,
         dataCollectionId,
         transmission,
         wavelength,
         beamPosY,
         beamPosX,
         resultsFilePath,
         generatedTemplateFile,
         templateMode,
         beamSizeY,
         beamSizeX,
         beamSize,
         minExposureTimePerImage,
         flux,
         imagePath,
         sample,
         diffractionPlan,
         experimentalCondition,
     )
     if mxv1InputCharacterisation is None:
         self._mxv1InputCharacterisation = None
     elif mxv1InputCharacterisation.__class__.__name__ == "XSDataInputCharacterisation":
         self._mxv1InputCharacterisation = mxv1InputCharacterisation
     else:
         strMessage = (
             "ERROR! XSDataInputInterfacev2_2 constructor argument 'mxv1InputCharacterisation' is not XSDataInputCharacterisation but %s"
             % self._mxv1InputCharacterisation.__class__.__name__
         )
         raise BaseException(strMessage)
     if mxv1ResultCharacterisation_Reference is None:
         self._mxv1ResultCharacterisation_Reference = None
     elif mxv1ResultCharacterisation_Reference.__class__.__name__ == "XSDataResultCharacterisation":
         self._mxv1ResultCharacterisation_Reference = mxv1ResultCharacterisation_Reference
     else:
         strMessage = (
             "ERROR! XSDataInputInterfacev2_2 constructor argument 'mxv1ResultCharacterisation_Reference' is not XSDataResultCharacterisation but %s"
             % self._mxv1ResultCharacterisation_Reference.__class__.__name__
         )
         raise BaseException(strMessage)
     if mxv2DataCollection is None:
         self._mxv2DataCollection = None
     elif mxv2DataCollection.__class__.__name__ == "XSDataCollection":
         self._mxv2DataCollection = mxv2DataCollection
     else:
         strMessage = (
             "ERROR! XSDataInputInterfacev2_2 constructor argument 'mxv2DataCollection' is not XSDataCollection but %s"
             % self._mxv2DataCollection.__class__.__name__
         )
         raise BaseException(strMessage)
     if mxv2DataCollection_Reference is None:
         self._mxv2DataCollection_Reference = None
     elif mxv2DataCollection_Reference.__class__.__name__ == "XSDataCollection":
         self._mxv2DataCollection_Reference = mxv2DataCollection_Reference
     else:
         strMessage = (
             "ERROR! XSDataInputInterfacev2_2 constructor argument 'mxv2DataCollection_Reference' is not XSDataCollection but %s"
             % self._mxv2DataCollection_Reference.__class__.__name__
         )
         raise BaseException(strMessage)
     if possibleOrientations is None:
         self._possibleOrientations = None
     elif possibleOrientations.__class__.__name__ == "kappa_alignment_response":
         self._possibleOrientations = possibleOrientations
     else:
         strMessage = (
             "ERROR! XSDataInputInterfacev2_2 constructor argument 'possibleOrientations' is not kappa_alignment_response but %s"
             % self._possibleOrientations.__class__.__name__
         )
         raise BaseException(strMessage)
     if omega is None:
         self._omega = None
     elif omega.__class__.__name__ == "XSDataAngle":
         self._omega = omega
     else:
         strMessage = (
             "ERROR! XSDataInputInterfacev2_2 constructor argument 'omega' is not XSDataAngle but %s"
             % self._omega.__class__.__name__
         )
         raise BaseException(strMessage)
     if kappa is None:
         self._kappa = None
     elif kappa.__class__.__name__ == "XSDataAngle":
         self._kappa = kappa
     else:
         strMessage = (
             "ERROR! XSDataInputInterfacev2_2 constructor argument 'kappa' is not XSDataAngle but %s"
             % self._kappa.__class__.__name__
         )
         raise BaseException(strMessage)
     if phi is None:
         self._phi = None
     elif phi.__class__.__name__ == "XSDataAngle":
         self._phi = phi
     else:
         strMessage = (
             "ERROR! XSDataInputInterfacev2_2 constructor argument 'phi' is not XSDataAngle but %s"
             % self._phi.__class__.__name__
         )
         raise BaseException(strMessage)