carrien / free-speech

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

dataVals creating cell array structure for multiword experiments #26

Closed cwnaber closed 2 years ago

cwnaber commented 3 years ago

This is a companion PR with a PR in blab-lab/current-studies. This PR includes info about how the dataVals structure was changed for certain experiments.

The main function being changed here is gen_dataVals_from_wave_viewer.m. Backwards compatibility was retained. Currently, experiments named simonSingleWord (L45) will produce a different dataVals structure: some fields will be cell arrays, where each cell in the array represents one "vowel" or "word" in the trial. (In simonSingleWord, the stimulus word is "bedhead", so "bed" is the first vowel/word, and "head" is the second.) The following fields were affected in this way:

Unfortunately, git isn't diff'ing the function in a very helpful way. Basically, I just added another layer to the loop in L53 which sets the variable v. SimonSingleWord goes through the loop multiple times, once for each vowel, whereas other experiments only go through once. Other changes were necessary to accommodate only simonSingleWord using the cell array structure for the above fields. Anywhere that v is used is where code was added/changed.

CONSIDERATIONS: As mentioned earlier, the cue to make a cell array dataVals is by experiment name. We could use something more general, like length(expt.shifts.mels), where expt.shifts.mels is a cell array amounting to the number of different shifts happening in a trial. But not all experiments will have this field. And maybe we will even have experiments where we want the cell array, but they don't have multiple shifts in them?

cwnaber commented 3 years ago

Updated this based on comments in #smng. In short, when the input argument bMultiSyllable == 1, any two sequential user events is a "vowel" and a cell in dataVals.mat. We use the number of user events in the first trial as a pseudo-key to check if bMultiSyllable is set properly.

Once again, the github diff'er isn't doing us any favors. The main new things to look at are L50-L95 and the addition of the tooManyEvents error counter variable in gen_dataVals_from_wave_viewer.

The other functions that this commit touches (get_fs_from_taxis.m and setup_exptFigs.m) work the same way with the new vowel structure.

I also made a commit to check_dataVals in this. The change forces check_dataVals to call gen_dataVals_from_wave_viewer in single vowel mode. This means that single vowel experiments like vsaSentence's transfer words could use the "reload dataVals" button within the check_dataVals GUI and it would function properly. As far as I know, we don't have any current or planned use cases for using the check_dataVals GUI on non-single vowel experiments or trials, so this seems OK to me.