Haven't tried this, but won't this raise a value error in the case where there are no ticks?