#NEWLINE# def update_viewer( dataset , pv , vis_batch , rows , cols ) : #NEWLINE# #INDENT# '\n    Function to update the viewer with a new visible batch.\n\n    Parameters\n    ----------\n    dataset: pylearn2 dataset\n    pv: PatchViewer\n    vis_batch: numpy array\n    rows: int\n    cols: int\n    ' #NEWLINE# mapback = hasattr ( dataset , 'mapback_for_viewer' ) #NEWLINE# display_batch = dataset . adjust_for_viewer ( vis_batch ) #NEWLINE# if ( display_batch . ndim == 2 ) : #NEWLINE# #INDENT# display_batch = dataset . get_topological_view ( display_batch ) #NEWLINE# #UNINDENT# if mapback : #NEWLINE# #INDENT# mapped_batch = get_mapped_batch ( dataset , vis_batch ) #NEWLINE# #UNINDENT# for i in xrange ( rows ) : #NEWLINE# #INDENT# row_start = ( cols * i ) #NEWLINE# for j in xrange ( cols ) : #NEWLINE# #INDENT# pv . add_patch ( display_batch [ ( row_start + j ) , : , : , : ] , rescale = False ) #NEWLINE# if mapback : #NEWLINE# #INDENT# pv . add_patch ( mapped_batch [ ( row_start + j ) , : , : , : ] , rescale = False )