def aprint(a,decimals=2): """prints array / masked array of floats""" if isinstance(a, Numeric.ArrayType): print Numeric.around(a.astype(Numeric.Float0),decimals) elif type(a) == MA.MaskedArray: print MA.around(a.astype(Numeric.Float0),decimals)
def function(self,p): """ Return a square-wave grating (alternating black and white bars). """ return around(0.5 + 0.5*sin(p.frequency*2*pi*self.pattern_y + p.phase))