def test_evoked_arithmetic():
 (raw, events, picks) = _get_data()
 epochs1 = Epochs(raw, events[:4], event_id, tmin, tmax, picks=picks)
 evoked1 = epochs1.average()
 epochs2 = Epochs(raw, events[4:8], event_id, tmin, tmax, picks=picks)
 evoked2 = epochs2.average()
 epochs = Epochs(raw, events[:8], event_id, tmin, tmax, picks=picks)
 evoked = epochs.average()
 evoked_sum = combine_evoked([evoked1, evoked2], weights='nave')
 assert_array_equal(evoked.data, evoked_sum.data)
 assert_array_equal(evoked.times, evoked_sum.times)
 assert_equal(evoked_sum.nave, (evoked1.nave + evoked2.nave))
 evoked_diff = combine_evoked([evoked1, evoked1], weights=[1, (-1)])
 assert_array_equal(np.zeros_like(evoked.data), evoked_diff.data)

def test_evoked_arithmetic ( ) : ( raw , events , picks ) = _get_data ( ) epochs1 = Epochs ( raw , events [ : 4 ] , event_id , tmin , tmax , picks = picks ) evoked1 = epochs1 . average ( ) epochs2 = Epochs ( raw , events [ 4 : 8 ] , event_id , tmin , tmax , picks = picks ) evoked2 = epochs2 . average ( ) epochs = Epochs ( raw , events [ : 8 ] , event_id , tmin , tmax , picks = picks ) evoked = epochs . average ( ) evoked_sum = combine_evoked ( [ evoked1 , evoked2 ] , weights = 'nave' ) assert_array_equal ( evoked . data , evoked_sum . data ) assert_array_equal ( evoked . times , evoked_sum . times ) assert_equal ( evoked_sum . nave , ( evoked1 . nave + evoked2 . nave ) ) evoked_diff = combine_evoked ( [ evoked1 , evoked1 ] , weights = [ 1 , ( - 1 ) ] ) assert_array_equal ( np . zeros_like ( evoked . data ) , evoked_diff . data )
test arithmetic of evoked data .