
% desired criteria: select epochs that
%  - occur between 11pm and 3am
%  - are in persistent sleep as defined above (i.e. at least 10 minutes of sleep prior)
%  - are during stage 2 NREM sleep
%  - do not contain any apnea or hypopnea events

% with `annot`, HYPNO will add annotations to the EDF starting hyp_
HYPNO annot

% not needed, but start by ensuring mask is reset
MASK none

% first select epochs based on clock-time
MASK hms=23:00:00-03:00:00

% equivalently - at resolution of 1hr at least - could have
% used annotations added by `HYPNO annot`
%MASK mask-ifnot=h_clock_23,h_clock_00,h_clock_01,h_clock_02

% next, include only if in persistent sleep
MASK mask-ifnot=h_persistent_sleep

% select only N2 epochs
MASK mask-ifnot=N2

% and reject epochs with any respiratory event
MASK mask-if=Obstructive_Apnea,Hypopnea

% finally, output the mask
DUMP-MASK

