adding functions from Peter Kovesi for phase congruency