Thanks for checking out the site.
The information I emailed to the user in that old forum thread is available in the Actigraphy and polysomnography overlap section on the other documentation link you provided (https://sleepdata.org/datasets/mesa/pages/actigraphy-introduction.md).
Yes, the process could "more or less be a cut and paste". The Profusion XML files contain a SleepStaging section that provides 30-second by 30-second sleep staging output (https://sleepdata.org/datasets/mesa/pages/polysomnography-introduction.md). You could take those staging indicators and paste/insert them into the actigraphy CSV files at the epoch line number indicated in the special overlap dataset. The rpoints files utilized the staging information from the XML files, so you could also merge them with the actigraphy CSVs.
I can't think of any other variables to give sleep/wake to compare with the actigraphy data.
Perfect! Thankyou for your assistance.
I had a follow up clarification question about the PSG data. As I understand it is 1 night only (from what I can see the first night of actigraphy).
For the XML file it only mentions the epoch length, the sleep stage measurements seem to start quite a bit into the file. Is it safe to assume that the the first sleep stage measurement in the XML corresponds to the start time for the PSG mentioned in the overlap document (i.e., the first overlap time indicated in the reference document)?
Thank-you for you help.
Yes, the PSG was only one night and it was intended to overlap with the first night of actigraphy.
The XML sleep staging section begins at the PSG recording start time (starttime_psg). Most PSG files will have varying periods of wake before the first epoch of scored sleep (N1/N2/N3/REM). As part of this "overlapping" process you should include all epochs from the XML file (though you may only ultimately concern yourself with staged NREM/REM sleep).
Perfect thankyou so much.
I had a few more clarification, in the XML files there are several blank cells before I start to see values in the sleep stage. Would the start time be at the top (i.e., first blank cell) or when the first number in the sleep stage column appears? (i.e., would we skip the blank cells? Are they indicitive of a sleep stage e.g., active?)
The total time for the PSG recording would be until the values are present in the sleep staging column? Would there be a reference time length for each PSG recording?
Thanks again for all your help.
Can you clarify what you mean by "several blank cells" and provide example filenames for me to look at? I opened mesa-sleep-0085-profusion.xml and see this at the beginning of the <SleepStages> section, which corresponds to the first 3 epochs of the recording being scored as wake.
Note the reference for the Profusion XML stage coding can be found here: https://github.com/nsrr/edf-editor-translator/wiki/Compumedics-Annotation-Format
Sleep stages: hypnogram is broken into periods of 30 seconds (epoch). 0 is wake stage, 1-4: sleep stage 1-4 and 5 is REM sleep. 9 is Active.
The total recording time (TRT) for PSG is available: https://sleepdata.org/datasets/mesa/variables/stdurm5 (column is present in 'mesa-sleep-dataset' CSV file here: https://sleepdata.org/datasets/mesa/files/datasets)
Thankyou again for you detailed reply.
For the blank cells. When we open the profusion xml file (e.g., 0001) in excel the format gives us a series of blank cells before we get values for sleep stage. We think it may just be the way excel converts the xml but we want to confirm incase the blank cells are important.
(Moving things down so they don't get so nested)
Yes, I agree the blank cells are likely some quirk then of opening the XML in Excel. You can open the XML in a text editor and the beginning of the SleepStages element should look like what I posted above.
Perfect, thankyou again.