sccn / clean_rawdata

Cleaning Raw EEG data
GNU General Public License v3.0
42 stars 17 forks source link

fit_eeg_distribution in asr_calibrate crash #3

Open arnodelorme opened 4 years ago

arnodelorme commented 4 years ago

Transfered from https://sccn.ucsd.edu/bugzilla/show_bug.cgi?id=13115

The line: H = bsxfun(@times,X(1:m,:),nbins./X(m,:)); also crashes when m = 0;

[reply] [−]DescriptionTyler Grummett 2017-07-18 17:55:02 PDT

In the clean_rawdata0.32 toolbox, I am having an issue with the fit_eeg_distribution function, which is a function within the asr_calibration function. The error is as follows:

Error using bsxfun Non-singleton dimensions of the two input arrays must match each other.

Error in asr_calibrate>fit_eeg_distribution (line 377) kl = sum(bsxfun(@times,p,bsxfun(@minus,log(p),logq(1:end-1,:)))) + log(m);

Error in asr_calibrate (line 180) [mu(c),sig(c)] = fit_eeg_distribution(rms,min_clean_fraction,max_dropout_fraction);

Error in clean_asr (line 164) state = asr_calibrate(ref_section.data,ref_section.srate,cutoff);

Error in clean_artifacts (line 219) EEG = clean_asr(EEG,burst_crit,[],[],[],burst_crit_refmaxbadchns,burst_crit_reftolerances,[]); end

Error in clean_rawdata (line 83) cleanEEG = clean_artifacts(EEG, 'FlatlineCriterion', arg_flatline,...

Looking into it a little further, it appear as though logq only has one row of numbers, so it crashes when it tries to grab logq(1:end-1,:). This occurs when m = 1, n = 6 (X is a 3x6 matrix of numbers), and therefore H is a row of NaNs.

Please note that this is one set of data which didnt work out of a large number of tasks and subjects, so it is working for the vast majority of the time.

Regards, Tyler

chkothe commented 4 years ago

The most likely reason for this kind of error is that the data is too short (at least that was the only condition in which it has ever crashed).

On Tue, Dec 3, 2019, 2:43 PM Arnaud Delorme notifications@github.com wrote:

Transfered from https://sccn.ucsd.edu/bugzilla/show_bug.cgi?id=13115

The line: H = bsxfun(@times https://github.com/times,X(1:m,:),nbins./X(m,:)); also crashes when m = 0;

[reply] [−]DescriptionTyler Grummett 2017-07-18 17:55:02 PDT

In the clean_rawdata0.32 toolbox, I am having an issue with the fit_eeg_distribution function, which is a function within the asr_calibration function. The error is as follows:

Error using bsxfun Non-singleton dimensions of the two input arrays must match each other.

Error in asr_calibrate>fit_eeg_distribution (line 377) kl = sum(bsxfun(@times https://github.com/times,p,bsxfun(@minus https://github.com/minus,log(p),logq(1:end-1,:)))) + log(m);

Error in asr_calibrate (line 180) [mu(c),sig(c)] = fit_eeg_distribution(rms,min_clean_fraction,max_dropout_fraction);

Error in clean_asr (line 164) state = asr_calibrate(ref_section.data,ref_section.srate,cutoff);

Error in clean_artifacts (line 219) EEG =

clean_asr(EEG,burst_crit,[],[],[],burst_crit_refmaxbadchns,burst_crit_reftolerances,[]); end

Error in clean_rawdata (line 83) cleanEEG = clean_artifacts(EEG, 'FlatlineCriterion', arg_flatline,...

Looking into it a little further, it appear as though logq only has one row of numbers, so it crashes when it tries to grab logq(1:end-1,:). This occurs when m = 1, n = 6 (X is a 3x6 matrix of numbers), and therefore H is a row of NaNs.

Please note that this is one set of data which didnt work out of a large number of tasks and subjects, so it is working for the vast majority of the time.

Regards, Tyler

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sccn/clean_rawdata/issues/3?email_source=notifications&email_token=ABISL2BE6GEDWCGAGKRTBPTQW3OJ5A5CNFSM4JU7XS72YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H52QJYQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABISL2FBIOUSMBMECTEXKW3QW3OJ5ANCNFSM4JU7XS7Q .

vpKumaravel commented 4 years ago

Yes, I encountered the same issue when I used only 250 samples (1 second) as the input. It doesn't throw any error, however, if the samples were increased to 1250 (5 seconds). I confirm Dr.Kothe's comment on this issue.

best, Velu

arnodelorme commented 2 years ago

OK, closing because of data too short.

PTDZ commented 2 years ago

Hi,

Unfortunately, I encountered the same issue and it's a common error (every second or third dataset). In my case, ASR function works fine when the data are filtered with 1 Hz high-pass filter; and doesn't work (throwing that error described above) when the data are filtered with 0.1 Hz HPF (for some datasets) or 0.01 Hz HPF (for majority, but not all datasets). The sampling rate (256 Hz) and data length is identical (~151000 frames) in all three cases.

Additionally, it sometimes works for shorter data (~130000 frames, 256 Hz) and thrown that error for longer data. So, I guess it's not only related to data length, but it's a mix of something else (changing the sampling rate to 512 Hz helps, but the issue is probably more complicated).

Best regards, PD

arnodelorme commented 2 years ago

Would you mind sharing some datasets.

PTDZ commented 2 years ago

Hi,

Yes, I sent two sample datasets to your email address. Same data, filtered with 1 and 0.01 HPF filter.

Option "Perform Artficat Subspace (...)" works fine with the data filtered with 1 Hz HPF filter, and the described error occurs on 0.01 Hz HPF filtered data (same sampling rate, same length).

Best regards, PD

jfrohlich commented 1 year ago

Hi,

I am having this problem too, could someone please tell me if the issue raised by PTDZ was resolved?

Thanks, Joel

PTDZ commented 1 year ago

@jfrohlich I did not receive any reply in that matter, so I guess the issue was not resolved.

arnodelorme commented 1 year ago

In the previous report, the data was too short. Would you mind sharing some data?

jfrohlich commented 1 year ago

In my case, I don't think I have permission to share the data at the moment, sorry ... Perhaps @PTDZ has other data that are sharable and generate the same error?