lrkrol / SEREEGA

SEREEGA: Simulating Event-Related EEG Activity
64 stars 17 forks source link

Error obtaining 'motorcortex_right_beta_rest_ersp' using S64 with fromnyhead #1

Closed GallVp closed 6 years ago

GallVp commented 6 years ago

Note: Sorry if I'm missing something. In Matlab 2017b MacOS High Sierra, with following test code:

% configuring for 100 epochs of 1000 ms at 1000 Hz
config      = struct('n', 10, 'srate', 1000, 'length', 1000);

% obtaining a 64-channel lead field from ICBM-NY
leadfield   = lf_generate_fromnyhead('montage', 'S64');

% packing source locations and activations together into components
components = utl_get_component_fromtemplate('motorcortex_right_beta_rest_ersp', leadfield);

% simulating data
data        = generate_scalpdata(components, leadfield, config);

% converting to EEGLAB dataset format, adding ICA weights
EEG         = utl_create_eeglabdataset(data, config, leadfield);
EEG         = utl_add_icaweights_toeeglabdataset(EEG, components, leadfield);
pop_timtopo(EEG);

I get following output in command window:

readlocs(): 'polhemus' format assumed from file extension readlocs(): Could not read Polhemus coords. Trying to read BESA .elp file. readlocs(): 'besa' format assumed from file extension BESA header detected, skipping three lines... Readlocs: BESA spherical coords. converted, now deleting BESA fields to avoid confusion (these fields can be exported, though) Error using ersp_check_class (line 300) band edge frequencies must always be in ascending order; keep deviations and slopes in mind

Error in utl_check_class (line 70) class = check_class(class);

Error in utl_set_dvslope (line 90) class = utl_check_class(class);

Error in utl_get_component_fromtemplate (line 311) ersp_mcr_mu = utl_set_dvslope(ersp_mcr_mu, 'dv', .1);

Error in testSEREEGA (line 8) components = utl_get_component_fromtemplate('motorcortex_right_beta_rest_ersp', leadfield);

lrkrol commented 6 years ago

This was an error in the template code. It was trying to apply a frequency deviation that would make the band edge frequencies overlap. It has been fixed now by adding and using the frequencyShift parameter, which shifts all frequencies equally, rather than the frequencyDv parameter, which shifts them all individually (and thus, potentially, in different directions).