Ejemplo n.º 1
0
def test_run(dials_regression):
    filename = os.path.join(dials_regression, 'centroid_test_data',
                            'experiments.json')

    from dxtbx.model.experiment_list import ExperimentListFactory
    exlist = ExperimentListFactory.from_json_file(filename)
    assert len(exlist) == 1

    from dials.array_family import flex
    rlist = flex.reflection_table.from_predictions_multi(exlist)

    from dials.algorithms.integration import CorrectionsMulti, Corrections

    corrector = CorrectionsMulti()
    for experiment in exlist:
        corrector.append(
            Corrections(experiment.beam, experiment.goniometer,
                        experiment.detector))

    lp1 = corrector.lp(rlist['id'], rlist['s1'])

    lp2 = flex.double([
        LP_calculations(exlist[i], s1)
        for i, s1 in zip(rlist['id'], rlist['s1'])
    ])

    diff = flex.abs(lp1 - lp2)
    assert diff.all_lt(1e-7)
Ejemplo n.º 2
0
    def compute_corrections(self, experiments):
        """
        Helper function to correct the intensity.

        :param experiments: The list of experiments
        :return: The LP correction for each reflection
        """
        from dials.algorithms.integration import Corrections, CorrectionsMulti

        compute = CorrectionsMulti()
        for experiment in experiments:
            if experiment.goniometer is not None:
                compute.append(
                    Corrections(
                        experiment.beam, experiment.goniometer, experiment.detector
                    )
                )
            else:
                compute.append(Corrections(experiment.beam, experiment.detector))
        lp = compute.lp(self["id"], self["s1"])
        self["lp"] = lp
        if experiment.detector[0].get_mu() > 0:
            qe = compute.qe(self["id"], self["s1"], self["panel"])
            self["qe"] = qe
        return lp
Ejemplo n.º 3
0
    def run(self):
        from dials.algorithms.integration import CorrectionsMulti, Corrections
        from dials.array_family import flex

        corrector = CorrectionsMulti()
        for experiment in self.exlist:
            corrector.append(
                Corrections(experiment.beam, experiment.goniometer,
                            experiment.detector))

        lp1 = corrector.lp(self.rlist['id'], self.rlist['s1'])

        lp2 = self.compute_expected()

        diff = flex.abs(lp1 - lp2)
        assert (diff.all_lt(1e-7))
        print 'OK'
Ejemplo n.º 4
0
  def run(self):
    from dials.algorithms.integration import CorrectionsMulti, Corrections
    from dials.array_family import flex

    corrector = CorrectionsMulti()
    for experiment in self.exlist:
      corrector.append(Corrections(
        experiment.beam,
        experiment.goniometer,
        experiment.detector))

    lp1 = corrector.lp(self.rlist['id'], self.rlist['s1'])

    lp2 = self.compute_expected()

    diff = flex.abs(lp1 - lp2)
    assert(diff.all_lt(1e-7))
    print 'OK'
Ejemplo n.º 5
0
  def compute_corrections(self, experiments):
    '''
    Helper function to correct the intensity.

    :param experiments: The list of experiments
    :return: The LP correction for each reflection

    '''
    from dials.algorithms.integration import Corrections, CorrectionsMulti
    compute = CorrectionsMulti()
    for experiment in experiments:
      compute.append(Corrections(
        experiment.beam,
        experiment.goniometer,
        experiment.detector))
    lp = compute.lp(self['id'], self['s1'])
    self['lp'] = lp
    if experiment.detector[0].get_mu() > 0:
      dqe = compute.dqe(self['id'], self['s1'], self['panel'])
      self['dqe'] = dqe
    return lp
Ejemplo n.º 6
0
def test_run(dials_data):
    filename = dials_data("centroid_test_data").join("experiments.json").strpath

    exlist = ExperimentListFactory.from_json_file(filename)
    assert len(exlist) == 1

    rlist = flex.reflection_table.from_predictions_multi(exlist)

    corrector = CorrectionsMulti()
    for experiment in exlist:
        corrector.append(
            Corrections(experiment.beam, experiment.goniometer, experiment.detector)
        )

    lp1 = corrector.lp(rlist["id"], rlist["s1"])

    lp2 = flex.double(
        [LP_calculations(exlist[i], s1) for i, s1 in zip(rlist["id"], rlist["s1"])]
    )

    diff = flex.abs(lp1 - lp2)
    assert diff.all_lt(1e-7)
Ejemplo n.º 7
0
    def compute_corrections(self, experiments):
        '''
    Helper function to correct the intensity.

    :param experiments: The list of experiments
    :return: The LP correction for each reflection

    '''
        from dials.algorithms.integration import Corrections, CorrectionsMulti
        compute = CorrectionsMulti()
        for experiment in experiments:
            compute.append(
                Corrections(experiment.beam, experiment.goniometer,
                            experiment.detector))
        lp = compute.lp(self['id'], self['s1'])
        self['lp'] = lp
        if experiment.detector[0].get_mu() > 0:
            qe = compute.qe(self['id'], self['s1'], self['panel'])
            self['qe'] = qe
        return lp