def image_coarsen(xlevel=<NUM_LIT:0>, ylevel=<NUM_LIT:0>, image="<STR_LIT>", method='<STR_LIT>'):
if image == "<STR_LIT>": image = _pylab.gca().images[<NUM_LIT:0>]<EOL>Z = _n.array(image.get_array())<EOL>global image_undo_list<EOL>image_undo_list.append([image, Z])<EOL>if len(image_undo_list) > <NUM_LIT:10>: image_undo_list.pop(<NUM_LIT:0>)<EOL>image.set_array(_fun.coarsen_matrix(Z, ylevel, xlevel, method))<EOL>_pylab.draw()<EOL>
This will coarsen the image data by binning each xlevel+1 along the x-axis
and each ylevel+1 points along the y-axis

type can be 'average', 'min', or 'max'