Пример #1
0
def calc_partiality_mproc(i_sel, observations, crystal_init_orientation):

  h = observations.indices()[i_sel]
  partiality_c_set = flex.double()

  a_star_init = sqr(crystal_init_orientation.reciprocal_matrix())

  eh = energy_handler()
  eh.get_energy_info(file_name_in_img, file_name_in_energy, pickle_filename)


  #calculate spot_radisu (rs) from mean_wavelength
  spot_radius = calc_spot_radius(a_star_init, observations.indices(), eh.mean_wavelength)

  for wavelength, c_weight in zip(eh.wavelength_at_counts, eh.photon_counts_normalized):

    ph = partiality_handler(wavelength, spot_radius)
    p, dummy = ph.calc_partiality(a_star_init, h)

    partiality_c_set.append(p*c_weight)

  #correct intensity usinging single color
  ph = partiality_handler(eh.mean_wavelength, spot_radius)
  p_single, dummy = ph.calc_partiality(a_star_init, h)
  I_p_single = observations.data()[i_sel]/p_single
  sigI_p_single = observations.sigmas()[i_sel]/p_single

  p_multi = sum(partiality_c_set)/sum(eh.photon_counts_normalized)
  I_p_multi = observations.data()[i_sel]/p_multi
  sigI_p_multi = observations.sigmas()[i_sel]/p_multi

  return i_sel, h, p_single, I_p_single, sigI_p_single, p_multi, I_p_multi, sigI_p_multi
Пример #2
0
def calc_partiality_mproc(calc_partiality_arg, frames):

  calc_partiality_arg_tag = calc_partiality_arg.split(':')
  frame_no = int(calc_partiality_arg_tag[0])
  ry_shift = float(calc_partiality_arg_tag[1])

  pickle_filename = frames[frame_no]

  trial_results = pickle.load(open(pickle_filename,"rb"))
  crystal_init_orientation = trial_results["current_orientation"][0]
  wavelength = trial_results["wavelength"]
  observations = trial_results["observations"][0]
  crystal_pointgroup = trial_results["pointgroup"]
  unit_cell = trial_results["current_orientation"][0].unit_cell()
  target_unit_cell = unit_cell.parameters()

  a_star_init = sqr(crystal_init_orientation.reciprocal_matrix())

  eh = energy_handler()
  eh.get_energy_info(file_name_in_img, file_name_in_energy, pickle_filename)

  #calc spot_radius y and z component
  spot_radius = calc_spot_radius(a_star_init, observations.indices(), wavelength)
  ry = spot_radius + ry_shift
  rz = ry * 0.5

  #calc alpha_angle
  two_theta = observations.two_theta(wavelength=wavelength).data()

  ph = partiality_handler(wavelength, spot_radius)
  I_p_aniso = flex.double()
  sigI_p_aniso = flex.double()
  I_p = flex.double()
  sigI_p = flex.double()
  for i_sel in range(len(observations.indices())):
    h = observations.indices()[i_sel]

    p, dummy = ph.calc_partiality(a_star_init, h)
    I_p.append(observations.data()[i_sel]/ p)
    sigI_p.append(observations.sigmas()[i_sel]/ p)

    alpha_angle = two_theta[i_sel]
    p_aniso, rs_aniso = ph.calc_partiality_anisotropy(a_star_init, h, ry, rz, alpha_angle)
    I_p_aniso.append(observations.data()[i_sel]/ p_aniso)
    sigI_p_aniso.append(observations.sigmas()[i_sel]/ p_aniso)



  observations_p = observations.customized_copy(data=I_p, sigmas=sigI_p)
  observations_p_aniso = observations.customized_copy(data=I_p_aniso, sigmas=sigI_p_aniso)

  return frame_no, observations_p, observations_p_aniso, (ry, rz, spot_radius)