You cannot talk about science and researches about sleep without knowing how to track a person's sleep scientifically. There are two common method for researchers to study sleep, one is through Polysomnography, the other is through the movement of the body during the sleep.
Polysomnography is a comprehensive recording of the biophysiological changes that occur during sleep. It is usually performed at night, when most people sleep, though some labs can accommodate shift workers and people with circadian rhythm sleep disorders and do the test at other times of day. The polysomnography monitors many body functions including brain (Electroencephalography aka EEG), eye movements (Electrooculography aka EOG), muscle activity orskeletal muscle activation (Electromyography aka EMG) and heart rhythm (Electrocardiography aka ECG) during sleep. After the identification of the sleep disorder sleep apnea in the 1970s, the breathing functions respiratory airflow and respiratory effort indicators were added along with peripheral pulse oximetry.
Yet the problem with polysomnography is that, it usually require the test subject to sleep in an environment which is not their own, therefore it may accurately records all the data during the testing, it does not represent the test subject's sleep cycle or sleep state. All the wiring on the subject may also affect their sleep therefore the results are likely to be skewed.
The other method of tracking sleep is through the body's movement while at sleep. This is also the most common technique that is been used in modern mobile apps or products, they utilize the electronic component called "accelerometer", it monitors any slight movement at night and analyzed the data to calculate the result.
This method is much more common than Polysomnography as the subject can sleep in their own bed in their own room which should make them more comfortable for a better sleep, yet the single data of movement by accelerometer still suffers from accuracy, especially those mobile apps.
Red indicates wakefulness, black is REM sleep, and blue indicates light (light blue) to deep (darker blue) sleep. The graphic shows the comparison very clear, the devices more or less keep up the data with polysomnography, some are relatively similar to the results polysomnography shows yet some are just far out in comparison. This test allows us to understand that commercial products or app may generate the results for your sleep but they are not always (some are never) going to represent a true story of your own sleep cycles.