Exemplo n.º 1
0
def inner_loop(fmodel, wam, missing, crystal_gridding, n, progress_counter,
               use_max_map):
    mac = maptbx.map_accumulator(n_real=crystal_gridding.n_real(),
                                 smearing_b=1,
                                 max_peak_scale=100,
                                 smearing_span=5,
                                 use_max_map=use_max_map)
    for j in range(n):
        mc_w = wam.random_weight_averaged_map_coefficients(
            missing=missing,
            random_scale=random.choice([0, 1, 2, 3, 4, 5]),
            random_seed=random.choice(range(1, 9754365, 10000)),
            n_cycles=100,
            fraction_keep=random.choice([0.9, 0.95, 1.0]))
        if (random.choice([True, False])):
            mc_w = kick.randomize_struture_factors(map_coeffs=mc_w,
                                                   number_of_kicks=100)
        m = get_map(mc=mc_w, cg=crystal_gridding)
        m = m / flex.max(m)
        sel = m < 0
        m = m.set_selected(sel, 0)
        mac.add(map_data=m)
        progress_counter.show()
    mm = mac.as_median_map()
    sd = mm.sample_standard_deviation()
    r = mm / sd
    return r
Exemplo n.º 2
0
 def outer_loop(self):
   missing_reflections_manager = mmtbx.map_tools.model_missing_reflections(
     coeffs=self.mc, fmodel=self.fmodel)
   missing = missing_reflections_manager.get_missing(deterministic=True)
   wam = kick.weighted_average(fmodel=self.fmodel, map_coefficients=self.mc)
   progress_counter = counter(
     n1=self.n_inner_loop, n2=self.n_outer_loop, log=self.log)
   map_accumulator = maptbx.map_accumulator(
     n_real = self.crystal_gridding.n_real(), smearing_b=1, max_peak_scale=100,
     smearing_span=5, use_max_map=self.use_max_map)
   for i in xrange(self.n_outer_loop):
     m = inner_loop(
       fmodel           = self.fmodel,
       wam              = wam,
       missing          = missing,
       crystal_gridding = self.crystal_gridding,
       n                = self.n_inner_loop,
       progress_counter = progress_counter,
       use_max_map      = self.use_max_map)
     m = low_volume_density_elimination(m=m, fmodel=self.fmodel,
       selection=self.selection)
     if(self.sharp and self.use_unsharp_masking):
       maptbx.sharpen(map_data=m, index_span=1, n_averages=2,
         allow_negatives=False)
       maptbx.gamma_compression(map_data=m, gamma=0.1)
     self.zero_below_threshold(m = m)
     m = m/flex.max(m)
     map_accumulator.add(map_data=m)
   m = map_accumulator.as_median_map()
   sd = m.sample_standard_deviation()
   print >> self.log
   return m/sd
Exemplo n.º 3
0
 def get_ma(n1,n2,n3, points):
   ma = maptbx.map_accumulator(n_real = (n1,n2,n3), use_max_map=False)
   for value in points:
     m = [value for i in xrange(n1*n2*n3)]
     m = flex.double(m)
     m.resize(flex.grid((n1,n2,n3)))
     ma.add(map_data=m)
   return ma
Exemplo n.º 4
0
def inner_loop(fmodel, wam, missing, crystal_gridding, n, progress_counter,
               use_max_map):
  mac = maptbx.map_accumulator(n_real = crystal_gridding.n_real(),
    smearing_b=1, max_peak_scale=100, smearing_span=5, use_max_map=use_max_map)
  for j in xrange(n):
    mc_w = wam.random_weight_averaged_map_coefficients(
      missing       = missing,
      random_scale  = random.choice([0,1,2,3,4,5]),
      random_seed   = random.choice(range(1, 9754365, 10000)),
      n_cycles      = 100,
      fraction_keep = random.choice([0.9, 0.95, 1.0]))
    if(random.choice([True,False])):
      mc_w = kick.randomize_struture_factors(map_coeffs=mc_w,
        number_of_kicks=100)
    m = get_map(mc=mc_w, cg=crystal_gridding)
    m = m/flex.max(m)
    sel = m<0
    m = m.set_selected(sel, 0)
    mac.add(map_data=m)
    progress_counter.show()
  mm = mac.as_median_map()
  sd = mm.sample_standard_deviation()
  r = mm/sd
  return r