#NEWLINE# def _get_epsilon( x , s , epsilon , n ) : #NEWLINE# #INDENT# if ( epsilon is None ) : #NEWLINE# #INDENT# h = ( ( EPS ** ( 1.0 / s ) ) * np . maximum ( np . abs ( x ) , 0.1 ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if np . isscalar ( epsilon ) : #NEWLINE# #INDENT# h = np . empty ( n ) #NEWLINE# h . fill ( epsilon ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# h = np . asarray ( epsilon ) #NEWLINE# if ( h . shape != x . shape ) : #NEWLINE# #INDENT# raise ValueError ( 'If h is not a scalar it must have the same shape as x.' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return h