1:Amax

fix for loop for patch density