def testExecute(self):
        self.run()

        plugin = self.getPlugin()
        output = plugin.dataOutput
        reference = XSDataResCutoffResult.parseFile(self.getReferenceDataOutputFile())

        EDAssert.strAlmostEqual(output.marshal(),
                                reference.marshal(),
                                "output looks good")
예제 #2
0
    def testExecute(self):
        self.run()

        plugin = self.getPlugin()
        output = plugin.dataOutput
        reference = XSDataResCutoffResult.parseFile(
            self.getReferenceDataOutputFile())

        EDAssert.strAlmostEqual(output.marshal(), reference.marshal(),
                                "output looks good")
예제 #3
0
    def process(self, _edObject=None):
        EDPlugin.process(self)
        detector_max_res = self.dataInput.detector_max_res
        if detector_max_res is not None:
            detector_max_res = detector_max_res.value

        completeness_cutoff_param = self.dataInput.completeness_cutoff
        if completeness_cutoff_param is None:
            completeness_cutoff = 80
        else:
            completeness_cutoff = completeness_cutoff_param.value

        isig_cutoff_param = self.dataInput.isig_cutoff
        if isig_cutoff_param is None:
            isig_cutoff = 3
        else:
            isig_cutoff = isig_cutoff_param.value

        cc_half_cutoff_param = self.dataInput.cc_half_cutoff
        if cc_half_cutoff_param is not None:
            cc_half_cutoff = cc_half_cutoff_param.value
        else:
            cc_half_cutoff = 30

        res_override = self.dataInput.res_override

        bins = list()

        # for the first iteration
        # comment from max's code: "less stringent at low res"
        local_completeness_cutoff = 70
        # declared but not initialized in the perl code
        prev_isig = prev_res = 0

        # XXX: if res is still not defined at the end it is set to
        # detector_max_res, which we should somehow defined (in the
        # data model?) and used as the default value before we start
        # the processing
        res = detector_max_res

        for entry in self.dataInput.completeness_entries:
            current_res = entry.res.value
            complete = entry.complete.value
            rfactor = entry.rfactor.value
            isig = entry.isig.value
            cc_half = entry.half_dataset_correlation.value

            # isig < isig_cutoff or \
            if cc_half < cc_half_cutoff or \
               (res_override is not None and current_res < res_override.value):
                continue
            else:
                bins.append(current_res)

        # Now the implementation of what max does when he encouters
        # the total values, which are conveniently already parsed in
        # our case
        if len(bins) < 2:
            strErrorMessage = "No bins with CC1/2 greater than %s" % cc_half_cutoff
            self.ERROR(strErrorMessage)
            self.addErrorMessage(strErrorMessage)
            self.ERROR(
                "Something could be wrong, or the completeness could be too low!"
            )
            self.ERROR(
                "bravais lattice/SG could be incorrect or something more insidious like"
            )
            self.ERROR(
                "incorrect parameters in XDS.INP like distance, X beam, Y beam, etc."
            )
            self.ERROR("Stopping")
            self.setFailure()
            return
        if res is None:
            res = sorted(bins)[0]
        if res_override is not None:
            res = res_override.value

        retbins = [XSDataDouble(x) for x in bins]

        data_output = XSDataResCutoffResult()
        data_output.res = XSDataDouble(res)
        data_output.bins = retbins
        totals = self.dataInput.total_completeness
        data_output.total_complete = totals.complete
        data_output.total_rfactor = totals.rfactor
        data_output.total_isig = totals.isig

        self.dataOutput = data_output
예제 #4
0
 def __init__(self):
     EDPlugin.__init__(self)
     self.setXSDataInputClass(XSDataResCutoff)
     self.setDataOutput(XSDataResCutoffResult())
예제 #5
0
    def process(self, _edObject=None):
        EDPlugin.process(self)
        detector_max_res = self.dataInput.detector_max_res
        if detector_max_res is not None:
            detector_max_res = detector_max_res.value

        completeness_cutoff_param = self.dataInput.completeness_cutoff
        if completeness_cutoff_param is None:
            completeness_cutoff = 80
        else:
            completeness_cutoff = completeness_cutoff_param.value

        isig_cutoff_param = self.dataInput.isig_cutoff
        if isig_cutoff_param is None:
            isig_cutoff = 3
        else:
            isig_cutoff = isig_cutoff_param.value

        cc_half_cutoff_param = self.dataInput.cc_half_cutoff
        if cc_half_cutoff_param is not None:
            cc_half_cutoff = cc_half_cutoff_param.value
        else:
            cc_half_cutoff = 30

        res_override = self.dataInput.res_override

        bins = list()

        # for the first iteration
        # comment from max's code: "less stringent at low res"
        local_completeness_cutoff = 70
        # declared but not initialized in the perl code
        prev_isig = prev_res = 0

        # XXX: if res is still not defined at the end it is set to
        # detector_max_res, which we should somehow defined (in the
        # data model?) and used as the default value before we start
        # the processing
        res = detector_max_res

        for entry in self.dataInput.completeness_entries:
            current_res = entry.res.value
            complete = entry.complete.value
            rfactor = entry.rfactor.value
            isig = entry.isig.value
            cc_half = entry.half_dataset_correlation.value

            # isig < isig_cutoff or \
            if cc_half < cc_half_cutoff or \
               (res_override is not None and current_res < res_override.value):
                continue
            else:
                bins.append(current_res)

        # Now the implementation of what max does when he encouters
        # the total values, which are conveniently already parsed in
        # our case
        if len(bins) < 2:
            strErrorMessage = "No bins with CC1/2 greater than %s" % cc_half_cutoff
            self.ERROR(strErrorMessage)
            self.addErrorMessage(strErrorMessage)
            self.ERROR("Something could be wrong, or the completeness could be too low!")
            self.ERROR("bravais lattice/SG could be incorrect or something more insidious like")
            self.ERROR("incorrect parameters in XDS.INP like distance, X beam, Y beam, etc.")
            self.ERROR("Stopping")
            self.setFailure()
            return
        if res is None:
            res = sorted(bins)[0]
        if res_override is not None:
            res = res_override.value

        retbins = [XSDataDouble(x) for x in bins]


        data_output = XSDataResCutoffResult()
        data_output.res = XSDataDouble(res)
        data_output.bins = retbins
        totals = self.dataInput.total_completeness
        data_output.total_complete = totals.complete
        data_output.total_rfactor = totals.rfactor
        data_output.total_isig = totals.isig

        self.dataOutput = data_output