def getFluxAndBeamSizeFromISPyB(self, _xsDataFirstImage,
                                 _xsDataExperimentalCondition):
     """
     This method retrieves the flux and beamsize from ISPyB
     """
     xsDataExperimentalCondition = None
     if (_xsDataExperimentalCondition is not None):
         bFoundValidFlux = False
         xsDataExperimentalCondition = _xsDataExperimentalCondition.copy()
         xsDataInputRetrieveDataCollection = XSDataInputRetrieveDataCollection(
         )
         xsDataInputRetrieveDataCollection.setImage(
             XSDataImage(_xsDataFirstImage.getPath()))
         self.edPluginISPyBRetrieveDataCollection.setDataInput(
             xsDataInputRetrieveDataCollection)
         self.edPluginISPyBRetrieveDataCollection.executeSynchronous()
         xsDataResultRetrieveDataCollection = self.edPluginISPyBRetrieveDataCollection.getDataOutput(
         )
         if xsDataResultRetrieveDataCollection is not None:
             xsDataISPyBDataCollection = xsDataResultRetrieveDataCollection.getDataCollection(
             )
             if xsDataISPyBDataCollection is not None:
                 fFlux = xsDataISPyBDataCollection.getFlux()
                 if fFlux is not None:
                     self.screen(
                         "ISPyB reports flux to be: %g photons/sec" % fFlux)
                     if fFlux > self.fFluxThreshold:
                         xsDataExperimentalCondition.getBeam().setFlux(
                             XSDataFlux(fFlux))
                         bFoundValidFlux = True
                 fBeamSizeAtSampleX = xsDataISPyBDataCollection.beamSizeAtSampleX
                 fBeamSizeAtSampleY = xsDataISPyBDataCollection.beamSizeAtSampleY
                 if fBeamSizeAtSampleX is not None and fBeamSizeAtSampleY is not None:
                     self.screen("ISPyB reports beamsize X to be: %.3f mm" %
                                 fBeamSizeAtSampleX)
                     self.screen("ISPyB reports beamsize Y to be: %.3f mm" %
                                 fBeamSizeAtSampleY)
                     xsDataSize = XSDataSize()
                     xsDataSize.x = XSDataLength(fBeamSizeAtSampleX)
                     xsDataSize.y = XSDataLength(fBeamSizeAtSampleY)
                     xsDataExperimentalCondition.getBeam().setSize(
                         xsDataSize)
         if not bFoundValidFlux:
             self.screen(
                 "No valid flux could be retrieved from ISPyB! Trying to obtain flux from input data."
             )
             xsDataBeam = xsDataExperimentalCondition.getBeam()
             xsDataBeamFlux = xsDataBeam.getFlux()
             if xsDataBeamFlux is not None:
                 fFluxMXCuBE = xsDataBeamFlux.getValue()
                 self.screen("MXCuBE reports flux to be: %g photons/sec" %
                             fFluxMXCuBE)
                 if fFluxMXCuBE < self.fFluxThreshold:
                     self.screen("MXCuBE flux invalid!")
     return xsDataExperimentalCondition
    def getFluxAndBeamSizeFromISPyB(self, _xsDataFirstImage, _xsDataExperimentalCondition):
        """
        This method retrieves the flux and beamsize from ISPyB
        """
        xsDataExperimentalCondition = None
        if _xsDataExperimentalCondition is not None:
            bFoundValidFlux = False
            xsDataExperimentalCondition = _xsDataExperimentalCondition.copy()
            xsDataInputRetrieveDataCollection = XSDataInputRetrieveDataCollection()
            xsDataInputRetrieveDataCollection.setImage(XSDataImage(_xsDataFirstImage.getPath()))
            self.edPluginISPyBRetrieveDataCollection.setDataInput(xsDataInputRetrieveDataCollection)
            self.edPluginISPyBRetrieveDataCollection.executeSynchronous()
            xsDataResultRetrieveDataCollection = self.edPluginISPyBRetrieveDataCollection.getDataOutput()
            if xsDataResultRetrieveDataCollection is not None:
                xsDataISPyBDataCollection = xsDataResultRetrieveDataCollection.getDataCollection()
                if xsDataISPyBDataCollection is not None:
                    fFlux = xsDataISPyBDataCollection.getFlux_end()
                    if fFlux is not None:
                        self.screen("ISPyB reports flux to be: %g photons/sec" % fFlux)
                        if fFlux > self.fFluxThreshold:
                            xsDataExperimentalCondition.getBeam().setFlux(XSDataFlux(fFlux))
                            bFoundValidFlux = True
                    fBeamSizeAtSampleX = xsDataISPyBDataCollection.beamSizeAtSampleX
                    fBeamSizeAtSampleY = xsDataISPyBDataCollection.beamSizeAtSampleY
                    if fBeamSizeAtSampleX is not None and fBeamSizeAtSampleY is not None:
                        self.screen("ISPyB reports beamsize X to be: %.3f mm" % fBeamSizeAtSampleX)
                        self.screen("ISPyB reports beamsize Y to be: %.3f mm" % fBeamSizeAtSampleY)
                        xsDataSize = XSDataSize()
                        xsDataSize.x = XSDataLength(fBeamSizeAtSampleX)
                        xsDataSize.y = XSDataLength(fBeamSizeAtSampleY)
                        xsDataExperimentalCondition.getBeam().setSize(xsDataSize)
                    # Get transmission if it's not already there
                    if xsDataExperimentalCondition.beam.transmission is None:
                        fTransmission = xsDataISPyBDataCollection.transmission
                        xsDataExperimentalCondition.beam.transmission = XSDataDouble(fTransmission)
            if not bFoundValidFlux:
                self.screen("No valid flux could be retrieved from ISPyB! Trying to obtain flux from input data.")
                xsDataBeam = xsDataExperimentalCondition.getBeam()
                xsDataBeamFlux = xsDataBeam.getFlux()
                if xsDataBeamFlux is not None:
                    fFluxMXCuBE = xsDataBeamFlux.getValue()
                    self.screen("MXCuBE reports flux to be: %g photons/sec" % fFluxMXCuBE)
                    if fFluxMXCuBE < self.fFluxThreshold:
                        self.screen("MXCuBE flux lower than threshold flux %g photons/s!" % self.fFluxThreshold)
                        self.screen("Forcing flux to 0.0 photons/s")
                        xsDataExperimentalCondition.getBeam().setFlux(XSDataFlux(0.0))
                else:
                    # Force missing flux to 0.0
                    self.screen("No flux neither in ISPyB nor in mxCuBE, forcing flux to 0.0 photon/s")
                    xsDataExperimentalCondition.getBeam().setFlux(XSDataFlux(0.0))

        return xsDataExperimentalCondition
Beispiel #3
0
    def getFluxAndBeamSizeFromISPyB(self, _xsDataFirstImage, _xsDataExperimentalCondition):
        """
        This method retrieves the flux and beamsize from ISPyB
        """
        xsDataExperimentalCondition = None
        if (_xsDataExperimentalCondition is not None):
            bFoundValidFlux = False
            xsDataExperimentalCondition = _xsDataExperimentalCondition.copy()
            xsDataInputRetrieveDataCollection = XSDataInputRetrieveDataCollection()
            xsDataInputRetrieveDataCollection.setImage(XSDataImage(_xsDataFirstImage.getPath()))
            self.edPluginISPyBRetrieveDataCollection.setDataInput(xsDataInputRetrieveDataCollection)
            self.edPluginISPyBRetrieveDataCollection.executeSynchronous()
            xsDataResultRetrieveDataCollection = self.edPluginISPyBRetrieveDataCollection.getDataOutput()
            if xsDataResultRetrieveDataCollection is not None:
                xsDataISPyBDataCollection = xsDataResultRetrieveDataCollection.getDataCollection()
                if xsDataISPyBDataCollection is not None:
                    fFlux = xsDataISPyBDataCollection.getFlux_end()
                    if fFlux is not None:
                        self.screen("ISPyB reports flux to be: %g photons/sec" % fFlux)
                        if fFlux > self.fFluxThreshold:
                            xsDataExperimentalCondition.getBeam().setFlux(XSDataFlux(fFlux))
                            bFoundValidFlux = True
                    fBeamSizeAtSampleX = xsDataISPyBDataCollection.beamSizeAtSampleX
                    fBeamSizeAtSampleY = xsDataISPyBDataCollection.beamSizeAtSampleY
                    if fBeamSizeAtSampleX is not None and fBeamSizeAtSampleY is not None:
                        self.screen("ISPyB reports beamsize X to be: %.3f mm" % fBeamSizeAtSampleX)
                        self.screen("ISPyB reports beamsize Y to be: %.3f mm" % fBeamSizeAtSampleY)
                        xsDataSize = XSDataSize()
                        xsDataSize.x = XSDataLength(fBeamSizeAtSampleX)
                        xsDataSize.y = XSDataLength(fBeamSizeAtSampleY)
                        xsDataExperimentalCondition.getBeam().setSize(xsDataSize)
                    # Get transmission if it's not already there
                    if xsDataExperimentalCondition.beam.transmission is None:
                        fTransmission = xsDataISPyBDataCollection.transmission
                        xsDataExperimentalCondition.beam.transmission = XSDataDouble(fTransmission)
            if not bFoundValidFlux:
                self.screen("No valid flux could be retrieved from ISPyB! Trying to obtain flux from input data.")
                xsDataBeam = xsDataExperimentalCondition.getBeam()
                xsDataBeamFlux = xsDataBeam.getFlux()
                if xsDataBeamFlux is not None:
                    fFluxMXCuBE = xsDataBeamFlux.getValue()
                    self.screen("MXCuBE reports flux to be: %g photons/sec" % fFluxMXCuBE)
                    if fFluxMXCuBE < self.fFluxThreshold:
                        self.screen("MXCuBE flux lower than threshold flux %g photons/s!" % self.fFluxThreshold)
                        self.screen("Forcing flux to 0.0 photons/s")
                        xsDataExperimentalCondition.getBeam().setFlux(XSDataFlux(0.0))
                else:
                    # Force missing flux to 0.0
                    self.screen("No flux neither in ISPyB nor in mxCuBE, forcing flux to 0.0 photon/s")
                    xsDataExperimentalCondition.getBeam().setFlux(XSDataFlux(0.0))

        return xsDataExperimentalCondition
 def getFluxAndBeamSizeFromISPyB(self, _xsDataFirstImage, _xsDataExperimentalCondition):
     """
     This method retrieves the flux and beamsize from ISPyB
     """
     xsDataExperimentalCondition = None
     if (_xsDataExperimentalCondition is not None):
         bFoundValidFlux = False
         xsDataExperimentalCondition = _xsDataExperimentalCondition.copy()
         xsDataInputRetrieveDataCollection = XSDataInputRetrieveDataCollection()
         xsDataInputRetrieveDataCollection.setImage(XSDataImage(_xsDataFirstImage.getPath()))
         self.edPluginISPyBRetrieveDataCollection.setDataInput(xsDataInputRetrieveDataCollection)
         self.edPluginISPyBRetrieveDataCollection.executeSynchronous()
         xsDataResultRetrieveDataCollection = self.edPluginISPyBRetrieveDataCollection.getDataOutput()
         if xsDataResultRetrieveDataCollection is not None:
             xsDataISPyBDataCollection = xsDataResultRetrieveDataCollection.getDataCollection()
             if xsDataISPyBDataCollection is not None:
                 fFlux = xsDataISPyBDataCollection.getFlux()
                 if fFlux is not None:
                     self.screen("ISPyB reports flux to be: %g photons/sec" % fFlux)
                     if fFlux > self.fFluxThreshold:
                         xsDataExperimentalCondition.getBeam().setFlux(XSDataFlux(fFlux))
                         bFoundValidFlux = True
                 fBeamSizeAtSampleX = xsDataISPyBDataCollection.beamSizeAtSampleX
                 fBeamSizeAtSampleY = xsDataISPyBDataCollection.beamSizeAtSampleY
                 if fBeamSizeAtSampleX is not None and fBeamSizeAtSampleY is not None:
                     self.screen("ISPyB reports beamsize X to be: %.3f mm" % fBeamSizeAtSampleX)
                     self.screen("ISPyB reports beamsize Y to be: %.3f mm" % fBeamSizeAtSampleY)
                     xsDataSize = XSDataSize()
                     xsDataSize.x = XSDataLength(fBeamSizeAtSampleX)
                     xsDataSize.y = XSDataLength(fBeamSizeAtSampleY)
                     xsDataExperimentalCondition.getBeam().setSize(xsDataSize)
         if not bFoundValidFlux:
             self.screen("No valid flux could be retrieved from ISPyB! Trying to obtain flux from input data.")
             xsDataBeam = xsDataExperimentalCondition.getBeam()
             xsDataBeamFlux = xsDataBeam.getFlux()
             if xsDataBeamFlux is not None:
                 fFluxMXCuBE = xsDataBeamFlux.getValue()
                 self.screen("MXCuBE reports flux to be: %g photons/sec" % fFluxMXCuBE)
                 if fFluxMXCuBE < self.fFluxThreshold:
                     self.screen("MXCuBE flux invalid!")
     return xsDataExperimentalCondition
 def getFluxFromISPyB(self, _xsDataFirstImage, _xsDataExperimentalCondition):
     """
     This method retrieves the flux from ISPyB
     """
     xsDataExperimentalCondition = None
     if (_xsDataExperimentalCondition is not None):
         xsDataExperimentalCondition = _xsDataExperimentalCondition.copy()
         bFoundValidFlux = False
         xsDataBeam = xsDataExperimentalCondition.getBeam()
         if xsDataBeam is None:
             xsDataBeam = XSDataBeam()    
             xsDataExperimentalCondition.setBeam(xsDataBeam)
         xsDataBeamFlux = xsDataBeam.getFlux()
         if xsDataBeamFlux is not None:
             fFluxMXCuBE = xsDataBeamFlux.getValue()
             self.screen("MXCuBE reports flux to be: %g photons/sec" % fFluxMXCuBE)
             if fFluxMXCuBE > self.fFluxThreshold:
                 bFoundValidFlux = True
             else:
                 self.screen("MXCuBE flux invalid! Trying to obtain flux from ISPyB.")
         if not bFoundValidFlux:
             # Here we try to retrieve the flux from ISPyB
             xsDataInputRetrieveDataCollection = XSDataInputRetrieveDataCollection()
             xsDataInputRetrieveDataCollection.setImage(XSDataImage(_xsDataFirstImage.getPath()))
             self.edPluginISPyBRetrieveDataCollection.setDataInput(xsDataInputRetrieveDataCollection)
             self.edPluginISPyBRetrieveDataCollection.executeSynchronous()
             xsDataResultRetrieveDataCollection = self.edPluginISPyBRetrieveDataCollection.getDataOutput()
             if xsDataResultRetrieveDataCollection is not None:
                 xsDataISPyBDataCollection = xsDataResultRetrieveDataCollection.getDataCollection()
                 if xsDataISPyBDataCollection is not None:
                     fFlux = xsDataISPyBDataCollection.getFlux()
                     if fFlux is not None:
                         self.screen("ISPyB reports flux to be: %g photons/sec" % fFlux)
                         xsDataExperimentalCondition.getBeam().setFlux(XSDataFlux(fFlux))
                         bFoundValidFlux = True
             if not bFoundValidFlux:
                 self.screen("No valid flux could be retrieved from ISPyB!")
     return xsDataExperimentalCondition