counts = misc. array
for i in counts:
if i < "(sum of the two integers next to i)/4"
return -1
What I am trying to do is set all values in the list which are less than half the average of their two neighbours to -1. i.e. for the list [10., 20., 10., 25., 30.] if i=3 then I want to see if 10 is less than (20+25)/4 and since that is 45/4 > 10 I want to then set 10 equal to -1. I will then filter for all values in the list >= 0.
This is further complicated by the fact that you should start with i+1 because this process doesn't work with the first value and then you should end with -1 because this process doesn't work with the last value. Any help would be greatly appreciated.