コード例 #1
0
def exercise_sort() :
  expected_unsorted_data="""    4 I 4
  1  0  0  0  1  0  0  0  1
  0  0  0
  0 -1  0  1  0  0  0  0  1
  0  0  0
  0  1  0 -1  0  0  0  0  1
  0  0  0
 -1  0  0  0 -1  0  0  0  1
  0  0  0
   0   0   4   0   0   4     0 1 0  1 80331.8  8648.0
   0   0  12   0   0  12     0 1 0  1104526.7 11623.3
   0   0  -4   0   0   4     0 2 0  1 44883.6  4527.6
   0   0  -8   0   0   8     0 2 0  1 41134.1  4431.9
   0   0   8   0   0   8     0 1 0  1 50401.8  5464.6
   0   0   8   0   0   8     0 1 0  1 53386.0  5564.1
   0   0  -8   0   0   8     0 2 0  1119801.4 12231.2
   0   0  12   0   0  12     0 1 0  1105312.9 12602.2
   0   0  16   0   0  16     0 1 0  1 14877.6  2161.5
"""
  expected_sorted_data="""    4 I 4
  1  0  0  0  1  0  0  0  1
  0  0  0
  0 -1  0  1  0  0  0  0  1
  0  0  0
  0  1  0 -1  0  0  0  0  1
  0  0  0
 -1  0  0  0 -1  0  0  0  1
  0  0  0
   0   0   4   0   0   4     0 1 0  1 80331.8  8648.0
   0   0  -4   0   0   4     0 2 0  1 44883.6  4527.6
   0   0   8   0   0   8     0 1 0  1 50401.8  5464.6
   0   0   8   0   0   8     0 1 0  1 53386.0  5564.1
   0   0  -8   0   0   8     0 2 0  1 41134.1  4431.9
   0   0  -8   0   0   8     0 2 0  1119801.4 12231.2
   0   0  12   0   0  12     0 1 0  1104526.7 11623.3
   0   0  12   0   0  12     0 1 0  1105312.9 12602.2
   0   0  16   0   0  16     0 1 0  1 14877.6  2161.5
"""

  from cctbx.xray import observation_types
  from cctbx.array_family import flex
  xs = crystal.symmetry((113.949,113.949,32.474,90.000,90.000,90.000), "I4")
  mi = flex.miller_index((
  (0,0,4),
  (0,0,12),
  (0,0,-4),
  (0,0,-8),
  (0,0,8),
  (0,0,8),
  (0,0,-8),
  (0,0,12),
  (0,0,16),
   ))
  data = flex.double(( 80331.8, 104526.7, 44883.6, 41134.1, 50401.8, 53386.0, 119801.4, 105312.9, 14877.6,))
  sigmas = flex.double((8648.0, 11623.3, 4527.6, 4431.9, 5464.6, 5564.1, 12231.2, 12602.2, 2161.5,))
  ms = miller.set(xs, mi,anomalous_flag=True)
  i_obs = miller.array(ms, data=data, sigmas=sigmas).set_observation_type(
    observation_types.intensity() )

  i_obs.export_as_scalepack_unmerged(file_name='unsorted.sca',
     scale_intensities_for_scalepack_merge=True)
  i_obs=i_obs.sort(by_value="asu_indices")
  i_obs.export_as_scalepack_unmerged(file_name='sorted.sca',
     scale_intensities_for_scalepack_merge=True)
  unsorted=open('unsorted.sca').read()
  sorted=open('sorted.sca').read()
  assert unsorted==expected_unsorted_data
  assert sorted==expected_sorted_data
コード例 #2
0
def exercise_sort():
    expected_unsorted_data = """    4 I 4
  1  0  0  0  1  0  0  0  1
  0  0  0
  0 -1  0  1  0  0  0  0  1
  0  0  0
  0  1  0 -1  0  0  0  0  1
  0  0  0
 -1  0  0  0 -1  0  0  0  1
  0  0  0
   0   0   4   0   0   4     0 1 0  1 80331.8  8648.0
   0   0  12   0   0  12     0 1 0  1104526.7 11623.3
   0   0  -4   0   0   4     0 2 0  1 44883.6  4527.6
   0   0  -8   0   0   8     0 2 0  1 41134.1  4431.9
   0   0   8   0   0   8     0 1 0  1 50401.8  5464.6
   0   0   8   0   0   8     0 1 0  1 53386.0  5564.1
   0   0  -8   0   0   8     0 2 0  1119801.4 12231.2
   0   0  12   0   0  12     0 1 0  1105312.9 12602.2
   0   0  16   0   0  16     0 1 0  1 14877.6  2161.5
"""
    expected_sorted_data = """    4 I 4
  1  0  0  0  1  0  0  0  1
  0  0  0
  0 -1  0  1  0  0  0  0  1
  0  0  0
  0  1  0 -1  0  0  0  0  1
  0  0  0
 -1  0  0  0 -1  0  0  0  1
  0  0  0
   0   0   4   0   0   4     0 1 0  1 80331.8  8648.0
   0   0  -4   0   0   4     0 2 0  1 44883.6  4527.6
   0   0   8   0   0   8     0 1 0  1 50401.8  5464.6
   0   0   8   0   0   8     0 1 0  1 53386.0  5564.1
   0   0  -8   0   0   8     0 2 0  1 41134.1  4431.9
   0   0  -8   0   0   8     0 2 0  1119801.4 12231.2
   0   0  12   0   0  12     0 1 0  1104526.7 11623.3
   0   0  12   0   0  12     0 1 0  1105312.9 12602.2
   0   0  16   0   0  16     0 1 0  1 14877.6  2161.5
"""

    from cctbx.xray import observation_types
    from cctbx.array_family import flex
    xs = crystal.symmetry((113.949, 113.949, 32.474, 90.000, 90.000, 90.000),
                          "I4")
    mi = flex.miller_index((
        (0, 0, 4),
        (0, 0, 12),
        (0, 0, -4),
        (0, 0, -8),
        (0, 0, 8),
        (0, 0, 8),
        (0, 0, -8),
        (0, 0, 12),
        (0, 0, 16),
    ))
    data = flex.double((
        80331.8,
        104526.7,
        44883.6,
        41134.1,
        50401.8,
        53386.0,
        119801.4,
        105312.9,
        14877.6,
    ))
    sigmas = flex.double((
        8648.0,
        11623.3,
        4527.6,
        4431.9,
        5464.6,
        5564.1,
        12231.2,
        12602.2,
        2161.5,
    ))
    ms = miller.set(xs, mi, anomalous_flag=True)
    i_obs = miller.array(ms, data=data, sigmas=sigmas).set_observation_type(
        observation_types.intensity())

    i_obs.export_as_scalepack_unmerged(
        file_name='unsorted.sca', scale_intensities_for_scalepack_merge=True)
    i_obs = i_obs.sort(by_value="asu_indices")
    i_obs.export_as_scalepack_unmerged(
        file_name='sorted.sca', scale_intensities_for_scalepack_merge=True)
    unsorted = open('unsorted.sca').read()
    sorted = open('sorted.sca').read()
    assert unsorted == expected_unsorted_data
    assert sorted == expected_sorted_data
コード例 #3
0
ファイル: test_cc_half.py プロジェクト: zhuligs/cctbx_project
            tagbase = "PSIfulls"
            tag = "%s_N%04d_tE%1d" % (tagbase, N, -math.log10(trans))
            for half_data_flag in [1, 2, 0]:
                case = test.execute_case(datadir,
                                         n_frame=N,
                                         transmittance=trans,
                                         apply_noise=True,
                                         plot=plot_flag,
                                         esd_plot=esd_plot_flag,
                                         half_data_flag=half_data_flag)
                model_subset = case.ordered_intensities[0:len(case.Fit_I)]
                from cctbx.xray import observation_types
                fitted_miller_array = model_subset.customized_copy(
                    data=case.Fit_I,
                    sigmas=case.Fit_I_stddev,
                    observation_type=observation_types.intensity())
                output_result = fitted_miller_array.select(case.I_visited == 1)
                outfile = "%s_s%1d_levmar.mtz" % (tag, half_data_flag)
                output_result.show_summary(prefix="%s: " % outfile)
                mtz_out = output_result.as_mtz_dataset(
                    column_root_label="Iobs", title=outfile, wavelength=None)
                mtz_obj = mtz_out.mtz_object()
                mtz_obj.write(outfile)
                written_files.append(outfile)
                print "OK"
                #raw_input("OK")
                sys.stdout.flush()

            from xfel.command_line.cxi_merge import master_phil
            import iotbx.phil
            args = [
コード例 #4
0
  esd_plot_flag=False
  written_files = []

  #for N in [25, 200, 300, 400, 500, 800, 1000, 2000, 5000]:
  for N in [400]:
    #for trans in [1.0, 0.1, 0.01, 0.001, 0.0001, 0.00001]:
    for trans in [0.001,]:
      tagbase = "PSIfulls"
      tag = "%s_N%04d_tE%1d"%(tagbase,N,-math.log10(trans))
      for half_data_flag in [1,2,0]:
        case = test.execute_case(datadir, n_frame=N, transmittance=trans, apply_noise=True,
               plot=plot_flag, esd_plot = esd_plot_flag,half_data_flag = half_data_flag)
        model_subset = case.ordered_intensities[0:len(case.Fit_I)]
        from cctbx.xray import observation_types
        fitted_miller_array = model_subset.customized_copy(data = case.Fit_I, sigmas = case.Fit_I_stddev,
          observation_type=observation_types.intensity())
        output_result = fitted_miller_array.select(case.I_visited==1)
        outfile = "%s_s%1d_levmar.mtz"%(tag,half_data_flag)
        output_result.show_summary(prefix="%s: "%outfile)
        mtz_out = output_result.as_mtz_dataset(column_root_label="Iobs",title=outfile,wavelength=None)
        mtz_obj = mtz_out.mtz_object()
        mtz_obj.write(outfile)
        written_files.append(outfile)
        print "OK"
        #raw_input("OK")
        sys.stdout.flush()

      from xfel.command_line.cxi_merge import master_phil
      import iotbx.phil
      args = ["output.prefix=%s"%tag,"scaling.algorithm=levmar",
              "d_min=%f"%(case.d_min),"output.n_bins=%d"%(case.n_bins),"model=%s"%(os.path.join(datadir,"not_used.pdb")),