Exemplo n.º 1
0
class CFPOF_Identity(CFPOutputFn):
    """
    CFPOutputFn that leaves the CFs unchanged.

    Must never be changed or subclassed, because it might never
    be called. (I.e., it could simply be tested for and skipped.)
    """
    single_cf_fn = param.ClassSelector(TransferFn,default=IdentityTF(),constant=True)

    def __call__(self, iterator, **params):
        pass
Exemplo n.º 2
0
class CFPOF_Plugin(CFPOutputFn):
    """
    Applies the specified single_cf_fn to each CF in the CFProjection
    for which the mask is nonzero.
    """
    single_cf_fn = param.ClassSelector(TransferFn,default=IdentityTF(),
        doc="Accepts a TransferFn that will be applied to each CF individually.")

    def __call__(self, iterator, **params):
        if type(self.single_cf_fn) is not IdentityTF:
            single_cf_fn = self.single_cf_fn

            for cf,i in iterator():
                single_cf_fn(cf.weights)
                del cf.norm_total