<commit_before>#!/usr/bin/env python
# DialsIndexer.py
#   Copyright (C) 2015 Diamond Light Source, <NAME>
#
#   This code is distributed under the BSD license, a copy of which is
#   included in the root directory of this package.
#
# An indexer using the DIALS methods.

import os
import sys
import math
import shutil

import libtbx

# wrappers for programs that this needs: DIALS

from xia2.Wrappers.Dials.Import import Import as _Import
from xia2.Wrappers.Dials.Spotfinder import Spotfinder as _Spotfinder
from xia2.Wrappers.Dials.DiscoverBetterExperimentalModel \
     import DiscoverBetterExperimentalModel as _DiscoverBetterExperimentalModel
from xia2.Wrappers.Dials.Index import Index as _Index
from xia2.Wrappers.Dials.Reindex import Reindex as _Reindex
from xia2.Wrappers.Dials.RefineBravaisSettings import RefineBravaisSettings as \
     _RefineBravaisSettings

# interfaces that this must implement to be an indexer

from xia2.Schema.Interfaces.MultiIndexer import MultiIndexer
from xia2.Modules.Indexer.DialsIndexer import DialsIndexer

# odds and sods that are needed

from xia2.lib.bits import auto_logfiler, nint
from xia2.Handlers.Streams import Chatter, Debug, Journal
from xia2.Handlers.Flags import Flags
from xia2.Handlers.Phil import PhilIndex
from xia2.Handlers.Files import FileHandler
from xia2.Experts.SymmetryExpert import lattice_to_spacegroup_number

class DialsMultiIndexer(DialsIndexer, MultiIndexer):

  def _index_prepare(self):
    for indxr in self._indxr_indexers:
      indxr._index_prepare()
    return

  def _do_indexing(self, method=None):
    indexer = self.Index()
    for indxr in self._indxr_indexers:
      indexer.add_spot_filename(indxr._indxr_payload["spot_list"])
      indexer.add_sweep_filename(indxr._indxr_payload["datablock.json"])
    if PhilIndex.params.dials.index.phil_file is not None:
      indexer.set_phil_file(PhilIndex.params.dials.index.phil_file)
    if PhilIndex.params.dials.index.max_cell:
      indexer.set_max_cell(PhilIndex.params.dials.index.max_cell)
    if Flags.get_small_molecule():
      indexer.set_min_cell(3)
    if PhilIndex.params.dials.fix_geometry:
      indexer.set_detector_fix('all')
      indexer.set_beam_fix('all')

    if self._indxr_input_lattice:
      indexer.set_indexer_input_lattice(self._indxr_input_lattice)
      Debug.write('Set lattice: %s' % self._indxr_input_lattice)
<commit_msg>remove unused imports<commit_after>#!/usr/bin/env python
# DialsIndexer.py
#   Copyright (C) 2015 <NAME>, <NAME>
#
#   This code is distributed under the BSD license, a copy of which is
#   included in the root directory of this package.
#
# An indexer using the DIALS methods.

import os

# interfaces that this must implement to be an indexer

from xia2.Schema.Interfaces.MultiIndexer import MultiIndexer
from xia2.Modules.Indexer.DialsIndexer import DialsIndexer

# odds and sods that are needed

from xia2.Handlers.Streams import Debug
from xia2.Handlers.Flags import Flags
from xia2.Handlers.Phil import PhilIndex

class DialsMultiIndexer(DialsIndexer, MultiIndexer):

  def _index_prepare(self):
    for indxr in self._indxr_indexers:
      indxr._index_prepare()
    return

  def _do_indexing(self, method=None):
    indexer = self.Index()
    for indxr in self._indxr_indexers:
      indexer.add_spot_filename(indxr._indxr_payload["spot_list"])
      indexer.add_sweep_filename(indxr._indxr_payload["datablock.json"])
    if PhilIndex.params.dials.index.phil_file is not None:
      indexer.set_phil_file(PhilIndex.params.dials.index.phil_file)
    if PhilIndex.params.dials.index.max_cell:
      indexer.set_max_cell(PhilIndex.params.dials.index.max_cell)
    if Flags.get_small_molecule():
      indexer.set_min_cell(3)
    if PhilIndex.params.dials.fix_geometry:
      indexer.set_detector_fix('all')
      indexer.set_beam_fix('all')

    if self._indxr_input_lattice:
      indexer.set_indexer_input_lattice(self._indxr_input_lattice)
      Debug.write('Set lattice: %s' % self._indxr_input_lattice)

{'fraction_non_alphanumeric': 0.07725, 'fraction_numerical': 0.00725, 'mean_word_length': 4.611500701262272, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7540141', 'n_tokens_mistral': 1395, 'n_tokens_neox': 1370, 'n_words': 304}