carrien / free-speech

Analysis and plotting code for speech neuroimaging experiments.
MIT License
4 stars 5 forks source link

fix for using check_audio after MFA in waverunner #100

Closed rpkarlin closed 1 year ago

rpkarlin commented 1 year ago

Issue: if you have run MFA on a dataset, when you run waverunner, it adds those events to trialparams.event_params. That in itself is fine, but it doesn't add anything else to event_params.

The main problem is that, specifically, it does not add the field is_good_trial. If you try to run check_audio on the data again, it will error out on a trial.mat file that was only created during waverunner because check_audio runs this check:

if ~isfield(trialparams,'event_params') || trialparams.event_params.is_good_trial

In the trials with MFA info but nothing else, event_params is a field, but is_good_trial does not exist.

Both solutions have been implemented:

  1. In waverunner, when it adds the event information from MFA, also check for if is_good_trial exists. If it doesn't, generate field and set to 0.
  2. In check_audio, also check for is_good_trial existing as a field before doing the dataVals assignment
cwnaber commented 1 year ago

@rpkarlin Looks like this is ready to merge?