fahrenfort / ADAM

the Amsterdam Decoding And Modeling (ADAM) toolbox
Other
37 stars 15 forks source link

Error running adam_detrend_and_epoch #136

Closed romquentin closed 3 years ago

romquentin commented 3 years ago

Hello,

I am trying to run adam_detrend_and_epoch (Matlab R2018b, ADAM 1.13 and EEGLAB2021.0) on MEG data.

The function stops with this error:

[Undefined function or variable 'topcs'.

Error in nt_regw (line 78)
            if nargout>1; z(:,iChan)=x*(topcs*b(iChan,1:size(topcs,2))') + mn(:,iChan); end

Error in nt_detrend (line 87)
    [~,y]=nt_regw(x,r,w);

Error in detrend_and_epoch (line 236)
        [~, w2,~,regressline2] = nt_detrend(tmp,polynomial_order,w1); % then nth order with mask of previous
        step

Error in adam_detrend_and_epoch (line 148)
        detrend_and_epoch(datadir,filenames{cSubj},outputdir, start_epoch, end_epoch, polynomial_order,
        pad_length, start_mask, end_mask, mask_only_current, mask_bad_data, channelpool, remove_bad_chans,
        event_codes);

Error in script (line 23)
adam_detrend_and_epoch(cfg);](url)

Also, I have this warning several times before the function stops.

Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND =  1.030416e-07. 
> In nt_regw (line 76)
  In nt_detrend (line 87)
  In detrend_and_epoch (line 236)
  In adam_detrend_and_epoch (line 148)
  In script (line 23)

Do you have an idea of what is going wrong?

Thank you very much!

fahrenfort commented 3 years ago

Hi Romain,

That looks like an error from the NoiseTools toolbox, not from my toolbox. The NoiseTools toolbox is included in my package, but I don’t update or modify it. You can find it here: http://audition.ens.fr/adc/NoiseTools/ http://audition.ens.fr/adc/NoiseTools/

I have encountered this error once or twice before but not very often at all, for most datasets it never occurs. It can typically be solved by simply removing the trial on which the error occurs. Have you tried running the code on the other subjects in your dataset?

About the warning regarding a close to singular or badly scaled matrix: this is just a standard warning message that may occur when fitting polynomials. It cannot really be solved as far as I know, it just means that your fit in some cases may be inaccurate. I haven’t found this to be problematic.

Cheers,

Johannes

On 25 Feb 2021, at 22:09, Romain Quentin notifications@github.com wrote:

Hello,

I am trying to run adam_detrend_and_epoch (Matlab R2018b, ADAM 1.13 and EEGLAB2021.0) on MEG data.

The function stops with this error:

[Undefined function or variable 'topcs'.

Error in nt_regw (line 78) if nargout>1; z(:,iChan)=x(topcsb(iChan,1:size(topcs,2))') + mn(:,iChan); end

Error in nt_detrend (line 87) [~,y]=nt_regw(x,r,w);

Error in detrend_and_epoch (line 236) [~, w2,~,regressline2] = nt_detrend(tmp,polynomial_order,w1); % then nth order with mask of previous step

Error in adam_detrend_and_epoch (line 148) detrend_and_epoch(datadir,filenames{cSubj},outputdir, start_epoch, end_epoch, polynomial_order, pad_length, start_mask, end_mask, mask_only_current, mask_bad_data, channelpool, remove_bad_chans, event_codes);

Error in script (line 23) adam_detrend_and_epoch(cfg);](url) Also, I have this warning several times before the function stops.

Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.030416e-07.

In nt_regw (line 76) In nt_detrend (line 87) In detrend_and_epoch (line 236) In adam_detrend_and_epoch (line 148) In script (line 23) Do you have an idea of what is going wrong?

Thank you very much!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fahrenfort/ADAM/issues/136, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACM6ZIB6GO42DBNDMITZQ2LTA24B5ANCNFSM4YHHPIOA.

romquentin commented 3 years ago

Hi Johannes,

Thank you for your quick answer! I just tried one participant yet. I will run other participants and remove trials that create this bug if not too often.

Cheers,

Romain