def test_make_fixed_length_events():
 raw = read_raw_fif(raw_fname)
 events = make_fixed_length_events(raw, id=1)
 assert_true(events.shape[1], 3)
 events_zero = make_fixed_length_events(raw, 1, first_samp=False)
 assert_equal(events_zero[(0, 0)], 0)
 assert_array_equal(events_zero[:, 0], (events[:, 0] - raw.first_samp))
 (tmin, tmax) = raw.times[[0, (-1)]]
 duration = (tmax - tmin)
 events = make_fixed_length_events(raw, 1, tmin, tmax, duration)
 assert_equal(events.shape[0], 1)
 assert_raises(ValueError, make_fixed_length_events, raw, 1, tmin, (tmax - 0.001), duration)
 assert_raises(ValueError, make_fixed_length_events, raw, 2.3)
 assert_raises(ValueError, make_fixed_length_events, 'not raw', 2)
 assert_raises(ValueError, make_fixed_length_events, raw, 23, tmin, tmax, 'abc')

def test_make_fixed_length_events ( ) : raw = read_raw_fif ( raw_fname ) events = make_fixed_length_events ( raw , id = 1 ) assert_true ( events . shape [ 1 ] , 3 ) events_zero = make_fixed_length_events ( raw , 1 , first_samp = False ) assert_equal ( events_zero [ ( 0 , 0 ) ] , 0 ) assert_array_equal ( events_zero [ : , 0 ] , ( events [ : , 0 ] - raw . first_samp ) ) ( tmin , tmax ) = raw . times [ [ 0 , ( - 1 ) ] ] duration = ( tmax - tmin ) events = make_fixed_length_events ( raw , 1 , tmin , tmax , duration ) assert_equal ( events . shape [ 0 ] , 1 ) assert_raises ( ValueError , make_fixed_length_events , raw , 1 , tmin , ( tmax - 0.001 ) , duration ) assert_raises ( ValueError , make_fixed_length_events , raw , 2.3 ) assert_raises ( ValueError , make_fixed_length_events , 'not raw' , 2 ) assert_raises ( ValueError , make_fixed_length_events , raw , 23 , tmin , tmax , 'abc' )
test making events of a fixed length .