Coverage for m_pool\transform.py : 49%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
return x*x
return pow(10.0, x)
return np.power(10.0, x)
'''Used to transform a data array into a more linear data array'''
self.func = log self.npfunc = np.log self.r_func = exp self.r_npfunc = np.exp self.func = sqrt self.npfunc = np.sqrt self.r_func = square self.r_npfunc = square else: print('WARNING... Unknown Transform "%s"'%name) self.func = None self.npfunc = None self.r_func = None self.r_npfunc = None
'''reverse transform either float value or numpy array and return same type.'''
if self.r_func==None: return value
if hasattr(value,'__len__'): return self.r_npfunc( value ) else: return self.r_func( value )
'''transform either float value or numpy array and return same type.'''
else:
T = Transform( 'log10' )
print('T(2.2)=',T(2.2), type(T(2.2)))
arr = np.array( [1.1, 2.2, 3.3, 4.4] ) print('T(arr)=',T(arr))
print() T2 = Transform('What???') print('T2(2.2)=',T2(2.2)) print('T2(arr)=',T2(arr))
|