#NEWLINE# def apply( self , dataset , can_fit = False ) : #NEWLINE# #INDENT# '\n        .. todo::\n\n            WRITEME\n        ' #NEWLINE# ( w_rows , w_cols ) = self . window_shape #NEWLINE# arr = dataset . get_topological_view ( ) #NEWLINE# try : #NEWLINE# #INDENT# axes = dataset . view_converter . axes #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# reraise_as ( NotImplementedError ( "I don't know how to tell what the axes of this kind of dataset are." ) ) #NEWLINE# #UNINDENT# needs_transpose = ( not ( axes [ 1 : 3 ] == ( 0 , 1 ) ) ) #NEWLINE# if needs_transpose : #NEWLINE# #INDENT# arr = numpy . transpose ( arr , ( axes . index ( 'c' ) , axes . index ( 0 ) , axes . index ( 1 ) , axes . index ( 'b' ) ) ) #NEWLINE# #UNINDENT# r_off = ( ( arr . shape [ 1 ] - w_rows ) // 2 ) #NEWLINE# c_off = ( ( arr . shape [ 2 ] - w_cols ) // 2 ) #NEWLINE# new_arr = arr [ : , r_off : ( r_off + w_rows ) , c_off : ( c_off + w_cols ) , : ] #NEWLINE# if needs_transpose : #NEWLINE# #INDENT# index_map = tuple ( ( ( 'c' , 0 , 1 , 'b' ) . index ( axis ) for axis in axes ) ) #NEWLINE# new_arr = numpy . transpose ( new_arr , index_map ) #NEWLINE# #UNINDENT# dataset . set_topological_view ( new_arr , axes = axes )