当前位置: 首页>>代码示例>>Python>>正文


Python ExperimentList.crystals方法代码示例

本文整理汇总了Python中dxtbx.model.experiment.experiment_list.ExperimentList.crystals方法的典型用法代码示例。如果您正苦于以下问题:Python ExperimentList.crystals方法的具体用法?Python ExperimentList.crystals怎么用?Python ExperimentList.crystals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dxtbx.model.experiment.experiment_list.ExperimentList的用法示例。


在下文中一共展示了ExperimentList.crystals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: from dxtbx.model.experiment.experiment_list import ExperimentList [as 别名]
# 或者: from dxtbx.model.experiment.experiment_list.ExperimentList import crystals [as 别名]
  def run(self):
    '''Execute the script.'''
    from dials.algorithms.refinement.two_theta_refiner import \
      TwoThetaReflectionManager, TwoThetaTarget, \
      TwoThetaPredictionParameterisation

    start_time = time()

    # Parse the command line
    params, options = self.parser.parse_args(show_diff_phil=False)

    # set up global experiments and reflections lists
    from dials.array_family import flex
    reflections = flex.reflection_table()
    global_id = 0
    from dxtbx.model.experiment.experiment_list import ExperimentList
    experiments=ExperimentList()

    # loop through the input, building up the global lists
    nrefs_per_exp = []
    for ref_wrapper, exp_wrapper in zip(params.input.reflections,
                                        params.input.experiments):
      refs = ref_wrapper.data
      exps = exp_wrapper.data
      for i, exp in enumerate(exps):
        sel = refs['id'] == i
        sub_ref = refs.select(sel)
        nrefs_per_exp.append(len(sub_ref))
        sub_ref['id'] = flex.int(len(sub_ref), global_id)
        reflections.extend(sub_ref)
        experiments.append(exp)
        global_id += 1

    # Try to load the models and data
    nexp = len(experiments)
    if nexp == 0:
      print "No Experiments found in the input"
      self.parser.print_help()
      return
    if len(reflections) == 0:
      print "No reflection data found in the input"
      self.parser.print_help()
      return

    self.check_input(reflections)

    # Configure the logging
    log.config(info=params.output.log,
      debug=params.output.debug_log)
    logger.info(dials_version())

    # Log the diff phil
    diff_phil = self.parser.diff_phil.as_str()
    if diff_phil is not '':
      logger.info('The following parameters have been modified:\n')
      logger.info(diff_phil)

    # Convert to P 1?
    if params.refinement.triclinic:
      reflections, experiments = self.convert_to_P1(reflections, experiments)

    # Combine crystals?
    if params.refinement.combine_crystal_models and len(experiments) > 1:
      logger.info('Combining {0} crystal models'.format(len(experiments)))
      experiments = self.combine_crystals(experiments)

    # Filter integrated centroids?
    if params.refinement.filter_integrated_centroids:
      reflections = self.filter_integrated_centroids(reflections)

    # Get the refiner
    logger.info('Configuring refiner')
    refiner = self.create_refiner(params, reflections, experiments)

    # Refine the geometry
    if nexp == 1:
      logger.info('Performing refinement of a single Experiment...')
    else:
      logger.info('Performing refinement of {0} Experiments...'.format(nexp))

    # Refine and get the refinement history
    history = refiner.run()

    # get the refined experiments
    experiments = refiner.get_experiments()
    crystals = experiments.crystals()

    if len(crystals) == 1:
      # output the refined model for information
      logger.info('')
      logger.info('Final refined crystal model:')
      logger.info(crystals[0])
      logger.info(self.cell_param_table(crystals[0]))

    # Save the refined experiments to file
    output_experiments_filename = params.output.experiments
    logger.info('Saving refined experiments to {0}'.format(output_experiments_filename))
    from dxtbx.model.experiment.experiment_list import ExperimentListDumper
    dump = ExperimentListDumper(experiments)
    dump.as_json(output_experiments_filename)
#.........这里部分代码省略.........
开发者ID:dials,项目名称:dials,代码行数:103,代码来源:two_theta_refine.py


注:本文中的dxtbx.model.experiment.experiment_list.ExperimentList.crystals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。