#NEWLINE# def percent_close_to_median( x , window_frac = 0.1 ) : #NEWLINE# #INDENT# 'Percentage of values within window_frac*(max(x)-min(x)) of median.' #NEWLINE# window = ( ( x . max ( ) - x . min ( ) ) * window_frac ) #NEWLINE# return np . mean ( ( np . abs ( ( window - np . median ( x ) ) ) < window ) )