def test_edf_annotations():
 raw = read_raw_edf(edf_path, preload=True)
 edf_events = find_events(raw, output='step', shortest_event=0, stim_channel='STI 014')
 events = [[0.1344, 0.256, 2], [0.3904, 1.0, 2], [2.0, 0.0, 3], [2.5, 2.5, 2]]
 events = np.array(events)
 events[:, :2] *= 512
 events = np.array(events, dtype=int)
 events[:, 1] -= 1
 events[((events[:, 1] <= 0), 1)] = 1
 events[:, 1] += events[:, 0]
 onsets = events[:, [0, 2]]
 offsets = events[:, [1, 2]]
 events = np.zeros(((2 * events.shape[0]), 3), dtype=int)
 events[0::2, [0, 2]] = onsets
 events[1::2, [0, 1]] = offsets
 assert_array_equal(edf_events, events)

def test_edf_annotations ( ) : raw = read_raw_edf ( edf_path , preload = True ) edf_events = find_events ( raw , output = 'step' , shortest_event = 0 , stim_channel = 'STI 014' ) events = [ [ 0.1344 , 0.256 , 2 ] , [ 0.3904 , 1.0 , 2 ] , [ 2.0 , 0.0 , 3 ] , [ 2.5 , 2.5 , 2 ] ] events = np . array ( events ) events [ : , : 2 ] *= 512 events = np . array ( events , dtype = int ) events [ : , 1 ] -= 1 events [ ( ( events [ : , 1 ] <= 0 ) , 1 ) ] = 1 events [ : , 1 ] += events [ : , 0 ] onsets = events [ : , [ 0 , 2 ] ] offsets = events [ : , [ 1 , 2 ] ] events = np . zeros ( ( ( 2 * events . shape [ 0 ] ) , 3 ) , dtype = int ) events [ 0 : : 2 , [ 0 , 2 ] ] = onsets events [ 1 : : 2 , [ 0 , 1 ] ] = offsets assert_array_equal ( edf_events , events )
test if events are detected correctly in a typical mne workflow .