Automatic detection of a phases of the cyclic alternating pattern during sleep.