def subimage(imagedata, center, window = 20):
    """returns a subimage of size 'window' about a certain (x,y) pixel, 
       passed as 'center'"""
    y0 , x0 = center
    xmin = int(x0 - round(window/2))
    xmax = int(x0 + round(window/2))
    ymin = int(y0 - round(window/2))
    ymax = int(y0 + round(window/2))
    print(xmin,xmax, ymin,ymax)
    return imagedata[xmin:xmax, ymin:ymax]