fixed get_counts_per_pixel() function to increase the size of the for loop upper bound to g.shape[0] + 1.