EEG EEG_to_EEG_bss (EEG me, double startTime, double endTime, long ncovars, double lagTime, const wchar_t *channelRanges, int whiteningMethod, int diagonalizerMethod, long maxNumberOfIterations, double tol) { try { // autowindow if (startTime == endTime) { startTime = my xmin; endTime = my xmax; } // don't allow times outside domain if (startTime < my xmin) { startTime = my xmin; } if (endTime > my xmax) { endTime = my xmax; } long numberOfChannels; autoNUMvector <long> channelNumbers (NUMstring_getElementsOfRanges (channelRanges, my d_numberOfChannels, & numberOfChannels, NULL, L"channel", true), 1); autoEEG thee = my f_extractPart (startTime, endTime, true); if (whiteningMethod != 0) { bool fromCorrelation = whiteningMethod == 2; autoPCA pca = EEG_to_PCA (thee.peek(), thy xmin, thy xmax, channelRanges, fromCorrelation); autoEEG white = EEG_and_PCA_to_EEG_whiten (thee.peek(), pca.peek(), 0); thee.reset (white.transfer()); } autoMixingMatrix mm = Sound_to_MixingMatrix (thy d_sound, startTime, endTime, ncovars, lagTime, maxNumberOfIterations, tol, diagonalizerMethod); autoEEG him = EEG_copyWithoutSound (me); his d_sound = Sound_and_MixingMatrix_unmix (my d_sound, mm.peek()); EEG_setChannelNames_selected (him.peek(), L"ic", channelNumbers.peek(), numberOfChannels); // Calculate the cross-correlations between eye-channels and the ic's return him.transfer(); } catch (MelderError) { Melder_throw (me, ": no independent components determined."); } }
INTEGER (U"Number of components", U"0 (=all)") OK DO EEG me = FIRST (EEG); PCA thee = FIRST (PCA); autoEEG him = EEG_and_PCA_to_EEG_principalComponents (me, thee, GET_INTEGER (U"Number of components")); praat_new (him.move(), my name, U"_pc"); END FORM (EEG_and_PCA_to_EEG_whiten, U"EEG & PCA: To EEG (whiten)", U"EEG & PCA: To EEG (whiten)...") INTEGER (U"Number of components", U"0 (=all)") OK DO EEG me = FIRST (EEG); PCA thee = FIRST (PCA); autoEEG him = EEG_and_PCA_to_EEG_whiten (me, thee, GET_INTEGER (U"Number of components")); praat_new (him.move(), my name, U"_white"); END FORM (EEG_to_Sound_modulated, U"EEG: To Sound (modulated)", 0) POSITIVE (U"Start frequency (Hz)", U"100.0") POSITIVE (U"Channel bandwidth (Hz)", U"100.0") TEXTFIELD (U"Channel ranges", U"1:64") LABEL (U"", U"To supply rising or falling ranges, use e.g. 2:6 or 5:3.") OK DO LOOP { iam (EEG); autoSound thee = EEG_to_Sound_modulated (me, GET_REAL (U"Start frequency"), GET_REAL (U"Channel bandwidth"), GET_STRING (U"Channel ranges")); praat_new (thee.move(), my name);