def test_check_target_type(): audio_dir = join(_get_test_data_path(), 'audio') stim = AudioStim(join(audio_dir, 'barber.wav')) td = DictionaryExtractor(join(TEXT_DIR, 'test_lexical_dictionary.txt'), variables=['length', 'frequency']) with pytest.raises(TypeError): stim.extract([td])
def test_text_extractor(): stim = ComplexTextStim(join(TEXT_DIR, 'sample_text.txt'), columns='to', default_duration=1) td = DictionaryExtractor(join(TEXT_DIR, 'test_lexical_dictionary.txt'), variables=['length', 'frequency']) assert td.data.shape == (7, 2) timeline = stim.extract([td]) df = timeline.to_df() assert np.isnan(df.iloc[0, 3]) assert df.shape == (12, 4) target = df.query('name=="frequency" & onset==5')['value'].values assert target == 10.6