#NEWLINE# def _get_legen_lut_fast( x , lut , block = None ) : #NEWLINE# #INDENT# 'Return Legendre coefficients for given x values in -1<=x<=1' #NEWLINE# n_interp = ( lut . shape [ 0 ] - 1.0 ) #NEWLINE# mm = ( x * ( n_interp / 2.0 ) ) #NEWLINE# mm += ( 0.5 * n_interp ) #NEWLINE# idx = np . round ( mm ) . astype ( int ) #NEWLINE# if ( block is None ) : #NEWLINE# #INDENT# vals = lut [ idx ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# vals = lut [ idx , : , block ] #NEWLINE# #UNINDENT# return vals