Пример #1
0
def exercise_worker(worker_class):
    """ Boilerplate code for testing a worker class """
    from xfel.merging.application.phil.phil import phil_scope
    from dials.util.options import OptionParser
    # Create the parser
    parser = OptionParser(phil=phil_scope)

    # Parse the command line. quick_parse is required for MPI compatibility
    params, options = parser.parse_args(show_diff_phil=True, quick_parse=True)

    # Load the data for the worker
    if 'simple_file_loader' in str(worker_class):
        experiments = reflections = None
    else:
        from xfel.merging.application.input.file_loader import simple_file_loader
        loader = simple_file_loader(params)
        loader.validate()
        experiments, reflections = loader.run(None, None)

    worker = worker_class(params)
    worker.validate()
    experiments, reflections = worker.run(experiments, reflections)

    prefix = worker_class.__name__
    reflections.as_msgpack_file(prefix + ".mpack")
    experiments.as_file(prefix + ".expt")
Пример #2
0
 def from_parameters(params, additional_info=None):
   """ Only one kind of loading supported at present, so construct a simple file loader """
   return [simple_file_loader(params)]