#NEWLINE# def test_map_overlap( ) : #NEWLINE# #INDENT# x = da . arange ( 10 , chunks = 5 ) #NEWLINE# y = x . map_overlap ( ( lambda x : ( x + len ( x ) ) ) , depth = 2 ) #NEWLINE# assert eq ( y , ( ( ( np . arange ( 10 ) + 5 ) + 2 ) + 2 ) ) #NEWLINE# x = np . arange ( 16 ) . reshape ( ( 4 , 4 ) ) #NEWLINE# d = da . from_array ( x , chunks = ( 2 , 2 ) ) #NEWLINE# exp1 = d . map_overlap ( ( lambda x : ( x + x . size ) ) , depth = 1 ) . compute ( ) #NEWLINE# exp2 = d . map_overlap ( ( lambda x : ( x + x . size ) ) , depth = { #NEWLINE# #INDENT# 0 : 1 , #NEWLINE# 1 : 1 , #NEWLINE# #UNINDENT# } , boundary = { #NEWLINE# #INDENT# 0 : 'reflect' , #NEWLINE# 1 : 'none' , #NEWLINE# #UNINDENT# } ) . compute ( ) #NEWLINE# assert eq ( exp1 , ( x + 16 ) ) #NEWLINE# assert eq ( exp2 , ( x + 12 ) )