Identify a candidate leg movement
All required:
Duration ≥0.5 seconds AND ≤10 seconds.
AND EMG rises ≥8 µV above resting baseline.
AND At least part of the movement occurs in an epoch scored as sleep.
Onset: Start the movement at the point where the EMG reaches the onset threshold.
Ending: Find a period lasting at least 0.5 seconds during which the EMG stays no more than 2 µV above resting baseline. The movement ends at the START of that quiet period.
Do not add the 0.5-second confirmation period to the movement duration.
Review both tibialis anterior EMG channels. Confirm a stable baseline and exclude artifact.
