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


Python experiment_list.ExperimentList类代码示例

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


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

示例1: setup_models

def setup_models(args):
  """setup the experimental models"""

  # Setup experimental models
  master_phil = parse("""
      include scope dials.test.algorithms.refinement.geometry_phil
      """, process_includes=True)

  models = setup_geometry.Extract(master_phil, cmdline_args = args)

  detector = models.detector
  goniometer = models.goniometer
  crystal = models.crystal
  beam = models.beam

  # Build a mock scan for a 180 degree sweep
  sf = scan_factory()
  scan = sf.make_scan(image_range = (1,180),
                        exposure_times = 0.1,
                        oscillation = (0, 1.0),
                        epochs = range(180),
                        deg = True)
  sweep_range = scan.get_oscillation_range(deg=False)
  im_width = scan.get_oscillation(deg=False)[1]
  assert sweep_range == (0., pi)
  assert approx_equal(im_width, 1.0 * pi / 180.)

  experiments = ExperimentList()
  experiments.append(Experiment(
        beam=beam, detector=detector, goniometer=goniometer,
        scan=scan, crystal=crystal, imageset=None))

  return experiments
开发者ID:dials,项目名称:dials,代码行数:33,代码来源:tst_scan_varying_predictor.py

示例2: generate_reflections

  def generate_reflections(self):

    # Build a mock scan for a 3 degree sweep
    from dxtbx.model.scan import scan_factory
    sf = scan_factory()
    self.scan = sf.make_scan(image_range = (1,1),
                          exposure_times = 0.1,
                          oscillation = (0, 3.0),
                          epochs = range(1),
                          deg = True)
    sweep_range = self.scan.get_oscillation_range(deg=False)

    # Create a scans ExperimentList, only for generating reflections
    experiments = ExperimentList()
    experiments.append(Experiment(
          beam=self.beam, detector=self.detector, goniometer=self.gonio, scan=self.scan,
          crystal=self.crystal, imageset=None))

    # Create a ScansRayPredictor
    ray_predictor = ScansRayPredictor(experiments, sweep_range)

    # Generate rays - only to work out which hkls are predicted
    resolution = 2.0
    index_generator = IndexGenerator(self.crystal.get_unit_cell(),
                          space_group(space_group_symbols(1).hall()).type(),
                          resolution)
    indices = index_generator.to_array()
    rays = ray_predictor.predict(indices)

    # Make a standard reflection_table and copy in the ray data
    self.reflections = flex.reflection_table.empty_standard(len(rays))
    self.reflections.update(rays)

    return
开发者ID:biochem-fan,项目名称:dials,代码行数:34,代码来源:tst_stills_prediction_parameters.py

示例3: experiment_list_for_crystal

 def experiment_list_for_crystal(self, crystal):
   experiments = ExperimentList()
   for imageset in self.imagesets:
     experiments.append(Experiment(imageset=imageset,
                                   beam=imageset.get_beam(),
                                   detector=imageset.get_detector(),
                                   goniometer=imageset.get_goniometer(),
                                   scan=imageset.get_scan(),
                                   crystal=crystal))
   return experiments
开发者ID:biochem-fan,项目名称:dials,代码行数:10,代码来源:stills_indexer.py

示例4: find_lattices

 def find_lattices(self):
   self.real_space_grid_search()
   crystal_models = self.candidate_crystal_models
   experiments = ExperimentList()
   for cm in crystal_models:
     for imageset in self.imagesets:
       experiments.append(Experiment(imageset=imageset,
                                     beam=imageset.get_beam(),
                                     detector=imageset.get_detector(),
                                     goniometer=imageset.get_goniometer(),
                                     scan=imageset.get_scan(),
                                     crystal=cm))
   return experiments
开发者ID:dials,项目名称:dials,代码行数:13,代码来源:real_space_grid_search.py

示例5: flatten_experiments

def flatten_experiments(filename_object_list):
  '''
  Flatten a list of experiment lists

  :param filename_object_list: The parameter item
  :return: The flattened experiment lists

  '''
  from dxtbx.model.experiment.experiment_list import ExperimentList
  result = ExperimentList()
  for i in range(len(filename_object_list)):
    result.extend(filename_object_list[i].data)
  return result
开发者ID:dials,项目名称:dials,代码行数:13,代码来源:options.py

示例6: combine_crystals

  def combine_crystals(experiments):
    '''Replace all crystals in the experiments list with the first crystal'''

    from dxtbx.model.experiment.experiment_list import Experiment, ExperimentList
    new_experiments=ExperimentList()
    ref_crystal = experiments[0].crystal
    for exp in experiments:
      new_experiments.append(Experiment(beam=exp.beam,
                                        detector=exp.detector,
                                        scan=exp.scan,
                                        goniometer=exp.goniometer,
                                        crystal=ref_crystal,
                                        imageset=exp.imageset))
    return new_experiments
开发者ID:dials,项目名称:dials,代码行数:14,代码来源:two_theta_refine.py

示例7: find_lattices

 def find_lattices(self):
   experiments = ExperimentList()
   for cm in self.known_orientations:
     # indexer expects crystals to be in primitive setting
     space_group = cm.get_space_group()
     cb_op_to_primitive \
       = space_group.info().change_of_basis_op_to_primitive_setting()
     cm = cm.change_basis(cb_op_to_primitive)
     for imageset in self.imagesets:
       experiments.append(Experiment(imageset=imageset,
                                     beam=imageset.get_beam(),
                                     detector=imageset.get_detector(),
                                     goniometer=imageset.get_goniometer(),
                                     scan=imageset.get_scan(),
                                     crystal=cm))
   return experiments
开发者ID:biochem-fan,项目名称:dials,代码行数:16,代码来源:known_orientation.py

示例8: create_models

  def create_models(self):

    # build models, with a larger crystal than default in order to get plenty of
    # reflections on the 'still' image
    overrides = """
    geometry.parameters.crystal.a.length.range=40 50;
    geometry.parameters.crystal.b.length.range=40 50;
    geometry.parameters.crystal.c.length.range=40 50;
    geometry.parameters.random_seed = 42"""

    master_phil = parse("""
        include scope dials.test.algorithms.refinement.geometry_phil
        """, process_includes=True)

    models = Extract(master_phil, overrides)

    # keep track of the models
    self.detector = models.detector
    self.gonio = models.goniometer
    self.crystal = models.crystal
    self.beam = models.beam

    # Create a stills ExperimentList
    self.stills_experiments = ExperimentList()
    self.stills_experiments.append(Experiment(beam=self.beam,
                                              detector=self.detector,
                                              crystal=self.crystal,
                                              imageset=None))

    # keep track of the parameterisation of the models
    self.det_param = DetectorParameterisationSinglePanel(self.detector)
    self.s0_param = BeamParameterisation(self.beam, self.gonio)
    self.xlo_param = CrystalOrientationParameterisation(self.crystal)
    self.xluc_param = CrystalUnitCellParameterisation(self.crystal)
开发者ID:biochem-fan,项目名称:dials,代码行数:34,代码来源:tst_stills_prediction_parameters.py

示例9: _refine

 def _refine(self):
   import copy
   from dxtbx.model.experiment.experiment_list import ExperimentList
   self._refinr_refined_experiment_list = ExperimentList()
   for epoch, idxr in self._refinr_indexers.iteritems():
     self._refinr_payload[epoch] = copy.deepcopy(idxr._indxr_payload)
     self._refinr_refined_experiment_list.extend(
       idxr.get_indexer_experiment_list())
开发者ID:xia2,项目名称:xia2,代码行数:8,代码来源:XDSRefiner.py

示例10: generate

  def generate(self):
    from dxtbx.model import Beam, Detector, Goniometer, Scan

    # Initialise a list of experiments
    experiments = ExperimentList()

    # Create a few beams
    b1 = Beam()
    b2 = Beam()
    b3 = Beam()

    # Create a few detectors
    d1 = Detector()
    d2 = Detector()
    d3 = Detector()

    # Create a few goniometers
    g1 = Goniometer()
    g2 = Goniometer()
    g3 = Goniometer()

    # Create a few scans
    s1 = Scan()
    s2 = Scan()
    s3 = Scan()

    # Create a list of models
    b = [b1, b2, b3, b2, b1]
    d = [d1, d2, d3, d2, d1]
    g = [g1, g2, g3, g2, g1]
    s = [s1, s2, s3, s2, s1]

    # Populate with various experiments
    for i in range(5):
      experiments.append(Experiment(
        beam=b[i],
        detector=d[i],
        goniometer=g[i],
        scan=s[i]))

    # Return the list of experiments
    return experiments
开发者ID:dalekreitler,项目名称:cctbx-playground,代码行数:42,代码来源:tst_experiment_list.py

示例11: __init__

  def __init__(self,params):
    import cPickle as pickle
    from dxtbx.model.beam import beam_factory
    from dxtbx.model.detector import detector_factory
    from dxtbx.model.crystal import crystal_model
    from cctbx.crystal_orientation import crystal_orientation,basis_type
    from dxtbx.model.experiment.experiment_list import Experiment, ExperimentList
    from scitbx import matrix
    self.experiments = ExperimentList()
    self.unique_file_names = []

    self.params = params
    data = pickle.load(open(self.params.output.prefix+"_frame.pickle","rb"))
    frames_text = data.split("\n")

    for item in frames_text:
      tokens = item.split(' ')
      wavelength = float(tokens[order_dict["wavelength"]])

      beam = beam_factory.simple(wavelength = wavelength)

      detector = detector_factory.simple(
        sensor = detector_factory.sensor("PAD"), # XXX shouldn't hard code for XFEL
        distance = float(tokens[order_dict["distance"]]),
        beam_centre = [float(tokens[order_dict["beam_x"]]), float(tokens[order_dict["beam_y"]])],
        fast_direction = "+x",
        slow_direction = "+y",
        pixel_size = [self.params.pixel_size,self.params.pixel_size],
        image_size = [1795,1795],  # XXX obviously need to figure this out
        )

      reciprocal_matrix = matrix.sqr([float(tokens[order_dict[k]]) for k in [
'res_ori_1','res_ori_2','res_ori_3','res_ori_4','res_ori_5','res_ori_6','res_ori_7','res_ori_8','res_ori_9']])
      ORI = crystal_orientation(reciprocal_matrix, basis_type.reciprocal)
      direct = matrix.sqr(ORI.direct_matrix())
      crystal = crystal_model(
        real_space_a = matrix.row(direct[0:3]),
        real_space_b = matrix.row(direct[3:6]),
        real_space_c = matrix.row(direct[6:9]),
        space_group_symbol = "P63",  # XXX obviously another gap in the database paradigm
        mosaicity = float(tokens[order_dict["half_mosaicity_deg"]]),
      )
      crystal.domain_size = float(tokens[order_dict["domain_size_ang"]])
      #if isoform is not None:
      #  newB = matrix.sqr(isoform.fractionalization_matrix()).transpose()
      #  crystal.set_B(newB)

      self.experiments.append(Experiment(beam=beam,
                                  detector=None, #dummy for now
                                  crystal=crystal))
      self.unique_file_names.append(tokens[order_dict["unique_file_name"]])

    self.show_summary()
开发者ID:keitaroyam,项目名称:cctbx_fork,代码行数:53,代码来源:merging_database_flex.py

示例12: prepare_dxtbx_models

  def prepare_dxtbx_models(self,setting_specific_ai,sg,isoform=None):

    from dxtbx.model.beam import beam_factory
    beam = beam_factory.simple(wavelength = self.inputai.wavelength)

    from dxtbx.model.detector import detector_factory
    detector = detector_factory.simple(
      sensor = detector_factory.sensor("PAD"),
      distance = setting_specific_ai.distance(),
      beam_centre = [setting_specific_ai.xbeam(), setting_specific_ai.ybeam()],
      fast_direction = "+x",
      slow_direction = "+y",
      pixel_size = [self.pixel_size,self.pixel_size],
      image_size = [self.inputpd['size1'],self.inputpd['size1']],
      )

    direct = matrix.sqr(setting_specific_ai.getOrientation().direct_matrix())
    from dxtbx.model.crystal import crystal_model
    crystal = crystal_model(
      real_space_a = matrix.row(direct[0:3]),
      real_space_b = matrix.row(direct[3:6]),
      real_space_c = matrix.row(direct[6:9]),
      space_group_symbol = sg,
      mosaicity = setting_specific_ai.getMosaicity()
    )
    if isoform is not None:
      newB = matrix.sqr(isoform.fractionalization_matrix()).transpose()
      crystal.set_B(newB)

    from dxtbx.model.experiment.experiment_list import Experiment, ExperimentList
    experiments = ExperimentList()
    experiments.append(Experiment(beam=beam,
                                  detector=detector,
                                  crystal=crystal))

    print beam
    print detector
    print crystal
    return experiments
开发者ID:cctbx,项目名称:cctbx-playground,代码行数:39,代码来源:dials_refinement_preceding_integration.py

示例13: __call__

  def __call__(self, experiments, reflections):

    self.working_phil.show()
    params = self.working_phil.extract()

    for iexp, exp in enumerate(experiments):

      print "Refining crystal", iexp
      # reflection subset for a single experiment
      refs = reflections.select(reflections['id'] == iexp)
      refs['id'] = flex.size_t(len(refs),0)
      # experiment list for a single experiment
      exps=ExperimentList()
      exps.append(exp)
      refiner = RefinerFactory.from_parameters_data_experiments(
        params, refs, exps, verbosity=1)
      # do refinement
      refiner.run()
      refined_exps = refiner.get_experiments()
      # replace this experiment with the refined one
      experiments[iexp] = refined_exps[0]

    return experiments
开发者ID:dials,项目名称:dials_scratch,代码行数:23,代码来源:refine_quadrants_hybrid.py

示例14: find_lattices

  def find_lattices(self):
    self.d_min = self.params.refinement_protocol.d_min_start

    from rstbx.phil.phil_preferences import indexing_api_defs
    import iotbx.phil
    hardcoded_phil = iotbx.phil.parse(
      input_string=indexing_api_defs).extract()

    sel = (self.reflections['id'] == -1)
    if self.d_min is not None:
      sel &= (1/self.reflections['rlp'].norms() > self.d_min)
    reflections = self.reflections.select(sel)
    solutions = candidate_basis_vectors_fft1d(
      reflections['rlp'], hardcoded_phil, max_cell=self.params.max_cell)
    self.candidate_basis_vectors = solutions[0]
    self.debug_show_candidate_basis_vectors()
    if self.params.debug_plots:
      self.debug_plot_candidate_basis_vectors()
    self.candidate_crystal_models = self.find_candidate_orientation_matrices(
      self.candidate_basis_vectors,
      max_combinations=self.params.basis_vector_combinations.max_try)
    crystal_model, n_indexed = self.choose_best_orientation_matrix(
      self.candidate_crystal_models)
    if crystal_model is not None:
      crystal_models = [crystal_model]
    else:
      crystal_models = []
    experiments = ExperimentList()
    for cm in crystal_models:
      for imageset in self.imagesets:
        experiments.append(Experiment(imageset=imageset,
                                      beam=imageset.get_beam(),
                                      detector=imageset.get_detector(),
                                      goniometer=imageset.get_goniometer(),
                                      scan=imageset.get_scan(),
                                      crystal=cm))
    return experiments
开发者ID:biochem-fan,项目名称:dials,代码行数:37,代码来源:fft1d.py

示例15: do_work

  def do_work(item):
    iexp, exp = item

    print "Refining crystal", iexp
    # reflection subset for a single experiment
    refs = reflections.select(reflections['id'] == iexp)
    refs['id'] = flex.int(len(refs),0)

    # DGW commented out as reflections.minimum_number_of_reflections no longer exists
    #if len(refs) < params.refinement.reflections.minimum_number_of_reflections:
    #  print "Not enough reflections to refine experiment"
    #  return

    # experiment list for a single experiment
    exps=ExperimentList()
    exps.append(exp)
    try:
      refiner = RefinerFactory.from_parameters_data_experiments(
        params, refs, exps)
      # do refinement
      refiner.run()
    except Exception, e:
      print "Error,", str(e)
      return
开发者ID:dials,项目名称:dials,代码行数:24,代码来源:stills_detector_hybrid_refine.py


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