New sweep analysis code

Also made the frequency checking somewhat robust to small differences
in frequency / rounding errors.