Example #1
0
class _fft_extension(oop.injector, miller.fft_map):
    """ We add those methods to fft_map so that they can be easily reused and
  tested independently of the charge flipping iterators. """
    def flipped_fraction_as_delta(self, fraction):
        rho = self.real_map_unpadded(in_place=False).as_1d()
        p = flex.sort_permutation(rho)
        sorted_rho = rho.select(p)
        return sorted_rho[int(fraction * sorted_rho.size())]

    flipped_fraction_as_delta = oop.memoize_method(flipped_fraction_as_delta)

    def c_flip(self, delta):
        rho = self.real_map_unpadded(in_place=False).as_1d()
        return flex.sum(flex.abs(rho.select(rho < delta)))

    c_flip = oop.memoize_method(c_flip)

    def c_tot(self):
        return flex.sum(self.real_map())

    c_tot = oop.memoize_method(c_tot)

    def skewness(self):
        return maptbx.more_statistics(self.real_map()).skewness()

    skewness = oop.memoize_method(skewness)

    def sigma(self):
        return maptbx.statistics(self.real_map()).sigma()

    sigma = oop.memoize_method(sigma)
 class foo(object):
   def __init__(self, a):
     self.a = a
   def f(self, x):
     """ Documentation for method f """
     diagnostic.append('+')
     return self.a + x
   f = oop.memoize_method(f)
 class _foo_extension(oop.injector, foo):
   def g(self, n):
     return 'x'*n
   g = oop.memoize_method(g)