Fix weights computation bug

Math.min/Math.max error was meaning that the loop checking for
frequencies with 1 partial in the band was messing up the previous loop
looking at frequencies with more than 1 partial.

Graph of weights looks much more sensible now (although not quite a
clean as the one in the paper - so definitely worth looking over).