def __call__(self, f_calc, compute_derivatives):
   assert f_calc.is_similar_symmetry(self.f_obs())
   return ext.targets_correlation(
     obs_type="I",
     obs=flex.pow2(self.f_obs().data()),
     weights=self.weights(),
     r_free_flags=None,
     f_calc=f_calc.data(),
     derivatives_depth=int(compute_derivatives))
Example #2
0
 def __call__(self, f_calc, compute_derivatives):
     assert f_calc.is_similar_symmetry(self.f_obs())
     return ext.targets_correlation(
         obs_type="I",
         obs=flex.pow2(self.f_obs().data()),
         weights=self.weights(),
         r_free_flags=None,
         f_calc=f_calc.data(),
         derivatives_depth=int(compute_derivatives))
Example #3
0
 def check():
     for obs_type in ["F", "I"]:
         tg = ext.targets_correlation(obs_type=obs_type,
                                      obs=obs,
                                      weights=weights,
                                      r_free_flags=None,
                                      f_calc=flex.complex_double(a, b),
                                      derivatives_depth=2)
         assert tg.cc() is None
         assert tg.target_work() is None
         assert tg.target_test() is None
         assert tg.gradients_work().size() == 0
         assert tg.hessians_work().size() == 0
Example #4
0
 def check():
   for obs_type in ["F", "I"]:
     tg = ext.targets_correlation(
       obs_type=obs_type,
       obs=obs,
       weights=weights,
       r_free_flags=None,
       f_calc=flex.complex_double(a, b),
       derivatives_depth=2)
     assert tg.cc() is None
     assert tg.target_work() is None
     assert tg.target_test() is None
     assert tg.gradients_work().size() == 0
     assert tg.hessians_work().size() == 0
Example #5
0
 def get(O, derivatives_depth=0):
     if (O.target_type == "ls"):
         return ext.targets_least_squares(
             compute_scale_using_all_data=False,
             obs_type=O.obs_type,
             obs=O.obs,
             weights=O.weights,
             r_free_flags=O.r_free_flags,
             f_calc=flex.complex_double(O.a, O.b),
             derivatives_depth=derivatives_depth,
             scale_factor=O.scale_factor)
     if (O.target_type == "cc"):
         return ext.targets_correlation(obs_type=O.obs_type,
                                        obs=O.obs,
                                        weights=O.weights,
                                        r_free_flags=O.r_free_flags,
                                        f_calc=flex.complex_double(
                                            O.a, O.b),
                                        derivatives_depth=derivatives_depth)
     raise RuntimeError("Unknown target_type.")
Example #6
0
 def get(O, derivatives_depth=0):
   if (O.target_type == "ls"):
     return ext.targets_least_squares(
       compute_scale_using_all_data=False,
       obs_type=O.obs_type,
       obs=O.obs,
       weights=O.weights,
       r_free_flags=O.r_free_flags,
       f_calc=flex.complex_double(O.a, O.b),
       derivatives_depth=derivatives_depth,
       scale_factor=O.scale_factor)
   if (O.target_type == "cc"):
     return ext.targets_correlation(
       obs_type=O.obs_type,
       obs=O.obs,
       weights=O.weights,
       r_free_flags=O.r_free_flags,
       f_calc=flex.complex_double(O.a, O.b),
       derivatives_depth=derivatives_depth)
   raise RuntimeError("Unknown target_type.")