def match(self, other): """ Match reflections with another set of reflections. :param other: The reflection table to match against :return: A tuple containing the matches in the reflection table and the other reflection table """ from dials.algorithms.spot_finding.spot_matcher import SpotMatcher match = SpotMatcher(max_separation=2) oind, sind = match(other, self) return sind, oind
def _match_with_reference(self, predicted, reference): ''' Match predictions with reference spots. ''' from dials.algorithms.spot_finding.spot_matcher import SpotMatcher from dials.util.command_line import Command Command.start("Matching reference spots with predicted reflections") match = SpotMatcher(max_separation=1) rind, pind = match(reference, predicted) h1 = predicted.select(pind)['miller_index'] h2 = reference.select(rind)['miller_index'] mask = (h1 == h2) predicted.set_flags(pind.select(mask), predicted.flags.reference_spot) Command.end("Matched %d reference spots with predicted reflections" % mask.count(True)) return predicted