thresholds function

Calculates the thresholds