Git Product home page Git Product logo

Comments (20)

drammock avatar drammock commented on June 27, 2024 1

cc @apoorva6262

from eeglabio.

jackz314 avatar jackz314 commented on June 27, 2024

Correct me if I'm wrong, but I don't think MNE actually saves any referencing info unless it's an average reference in projection mode. So I think the best way to resolve this for export_mne_xxx is to just save 'common' in the ref field for now since that seems to be the default for EEGLAB. Then for the other methods, we could have another optional parameter that takes in the ref.

We should probably also call apply_proj on MNE instances just in case there are any projected references that aren't applied yet (I don't think EEGLAB supports projection)

Since @cbrnr worked on EEGLAB exports before, any thoughts on this? Maybe we should add a field to MNE like EEGLAB to store referencing info?

from eeglabio.

apoorva6262 avatar apoorva6262 commented on June 27, 2024

@jackz314 , yeah I did perform average referencing on my dataset.

from eeglabio.

cbrnr avatar cbrnr commented on June 27, 2024

@jackz314 can you reproduce with one of your test files? It is strange that we did not notice before.

You are right that currently MNE doesn't store the reference, although this has been discussed before (and I think it should be added). If setting ref to "common" works this is probably fine, but maybe you can also set it to something empty (e.g. empty string, empty list, None)?

from eeglabio.

jackz314 avatar jackz314 commented on June 27, 2024

@jackz314 can you reproduce with one of your test files? It is strange that we did not notice before.

The weird thing is all the files exported from my test files work fine in EEGLAB even without the ref field, the field seems to be created automatically by EEGLAB if it doesn't exist in the set file. I'm not sure what exactly happened here though, maybe it's the EEGLAB version? Or maybe there are some extra steps involved in getting this error? Either way, I think setting the ref field will be a safer bet.

@apoorva6262 can you provide some details on how you're getting the error? Is it just by loading in the set file alone? What version of the EEGLAB are you using?

from eeglabio.

apoorva6262 avatar apoorva6262 commented on June 27, 2024

@jackz314 , I actually opened a .set file that I initially saved on EEGLAB. I read this file on MNE , performed average referencing, filtering and ICA and then saved the file as .set and just loaded it on EEGLAB.

I use EEGLAB v2020.0 version. I get this error when using export_mne_epochs(epochs, "file_name.set") and export_mne_raw(raw, "file_name.set").

from eeglabio.

jackz314 avatar jackz314 commented on June 27, 2024

I pushed a fix that just adds the ref field to the set file, it's on the main branch, can you try it and see if it works?

from eeglabio.

jackz314 avatar jackz314 commented on June 27, 2024

@cbrnr I confirmed that if you leave the ref field as an empty string, or nothing at all just like before, EEGLAB (v2021.0) will create the ref field and set it to 'common'.

from eeglabio.

apoorva6262 avatar apoorva6262 commented on June 27, 2024

Do I need to reinstall the eeglabio package ?

from eeglabio.

jackz314 avatar jackz314 commented on June 27, 2024

You should be able to install like this

pip install https://github.com/jackz314/eeglabio/archive/main.zip

from eeglabio.

apoorva6262 avatar apoorva6262 commented on June 27, 2024

still the same error

from eeglabio.

apoorva6262 avatar apoorva6262 commented on June 27, 2024

I saved a different file using that using export_mne_raw(raw, "file_name.set", and loaded it on eeglab and that gave me this error :
Screenshot 2021-05-11 at 00 50 36

from eeglabio.

jackz314 avatar jackz314 commented on June 27, 2024

I just added explicit type conversion so the second error shouldn't appear again, but I'm not sure about the ref error.

from eeglabio.

cbrnr avatar cbrnr commented on June 27, 2024

@jackz314 but why did the error happen in the first place if the ref field gets created automatically? I think we should find out why @apoorva6262 encountered this issue and then implement a fix. If none of your test files produced the error, then we don't know the cause and implementing changes might be detrimental. I wouldn't set ref to "common" because we don't know if this is the true reference; EEGLAB will set this field automatically it seems.

from eeglabio.

cbrnr avatar cbrnr commented on June 27, 2024

Also, I'm pretty sure "common" also refers to average reference (some people call it common average reference).

from eeglabio.

jackz314 avatar jackz314 commented on June 27, 2024

@apoorva6262 I just downloaded the older version of EEGLAB (v2020.0) and tested out some of my exported files, it seems like the ref error is no longer thrown if the ref field is added. Can you verify that you actually installed the latest version of eeglabio? What might have happened is pip didn't install the latest version of the code because there's already a version with the same major version installed, so you might need to uninstall the existing eeglabio first before installing again.

@cbrnr I looked at the older version of EEGLAB's code and it doesn't create the ref field automatically, hence the error. The field is only created automatically in the 2021 version it seems.

I'm not sure why common is used as the default value by EEGLAB, but at least in EEGLAB there're "common" and "average" two different types.

from eeglabio.

cbrnr avatar cbrnr commented on June 27, 2024

I looked at the older version of EEGLAB's code and it doesn't create the ref field automatically, hence the error. The field is only created automatically in the 2021 version it seems.

Alright then!

I'm not sure why common is used as the default value by EEGLAB, but at least in EEGLAB there're "common" and "average" two different types.

OK, that's strange.

from eeglabio.

jackz314 avatar jackz314 commented on June 27, 2024

In EEGLAB, the code to add the default ref field is:

if ~isfield(EEG, 'ref')
    EEG.ref = 'common';
end

in the old version it has this code as well, but it also in some conditions (when chanlocs exists) reference the ref field before actually creating it, so that's probably why the error occurs.

from eeglabio.

cbrnr avatar cbrnr commented on June 27, 2024

OK, so setting it to 'common' makes sense as otherwise EEGLAB should have done it anyway.

from eeglabio.

apoorva6262 avatar apoorva6262 commented on June 27, 2024

works now! thank you so much!

from eeglabio.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.