Using aesara tensor as indices

Yes thanks, I also had to change

 count = np.sum(map[xmin:xmax, ymin:ymax])

to

mapt = at.as_tensor(map)
count = mapt[xmin:xmax, ymin:ymax].sum()