#NEWLINE# def remove_bias( x , axis ) : #NEWLINE# #INDENT# 'Subtracts an estimate of the mean from signal x at axis' #NEWLINE# padded_slice = [ slice ( d ) for d in x . shape ] #NEWLINE# padded_slice [ axis ] = np . newaxis #NEWLINE# mn = np . mean ( x , axis = axis ) #NEWLINE# return ( x - mn [ tuple ( padded_slice ) ] )