def update_viewer(dataset, pv, vis_batch, rows, cols):
 mapback = hasattr(dataset, 'mapback_for_viewer')
 display_batch = dataset.adjust_for_viewer(vis_batch)
 if (display_batch.ndim == 2):
  display_batch = dataset.get_topological_view(display_batch)
 if mapback:
  mapped_batch = get_mapped_batch(dataset, vis_batch)
 for i in xrange(rows):
  row_start = (cols * i)
  for j in xrange(cols):
   pv.add_patch(display_batch[(row_start + j), :, :, :], rescale=False)
   if mapback:
    pv.add_patch(mapped_batch[(row_start + j), :, :, :], rescale=False)

def update_viewer ( dataset , pv , vis_batch , rows , cols ) : mapback = hasattr ( dataset , 'mapback_for_viewer' ) display_batch = dataset . adjust_for_viewer ( vis_batch ) if ( display_batch . ndim == 2 ) : display_batch = dataset . get_topological_view ( display_batch ) if mapback : mapped_batch = get_mapped_batch ( dataset , vis_batch ) for i in xrange ( rows ) : row_start = ( cols * i ) for j in xrange ( cols ) : pv . add_patch ( display_batch [ ( row_start + j ) , : , : , : ] , rescale = False ) if mapback : pv . add_patch ( mapped_batch [ ( row_start + j ) , : , : , : ] , rescale = False )
function to update the viewer with a new visible batch .