Skip to content

bug in pop_chanedit #867

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jiversen opened this issue May 8, 2025 · 3 comments
Open

bug in pop_chanedit #867

jiversen opened this issue May 8, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@jiversen
Copy link
Contributor

jiversen commented May 8, 2025

Description

pop_chanedit returns a malformed command to eegh. Running that command does not recreate the behaviour that was done in the gui.

Steps to Reproduce:

  1. I started pop_chanedit from the menu on a 7-channel dataset that has only 1020 channel labels , but no channel locations or channel types. [The main window lists channel locations "No (labels only)"].

    I picked the standard head model then set all of the channel types to 'EEG'--this properly populates the channels with all of the standard coordinate values and returns a dataset with full chanlocs. Fine.

  2. However, I then took the command string returned by eegh and added it to my own code

  3. Running this command on a new dataset does not work: it returns an EEG.chanlocs with empty coordinates!

Expected behavior:

Running the code returned by pop_chanedit should properly lookup the electrode coordinates, and recreate the GUI behavior, not return empty coordinates.

Actual behavior:

The command string that was returned to eegh for the action was malformed and does not run properly:

EEG=pop_chanedit(EEG, {'lookup','/XXXX/eeglab/plugins/dipfit/standard_BEM/elec/standard_1005.elc'},'changefield',{1,'type','EEG'},'changefield',{2,'type','EEG'},'changefield',{3,'type','EEG'},'changefield',{4,'type','EEG'},'changefield',{5,'type','EEG'},'changefield',{6,'type','EEG'},'changefield',{7,'type','EEG'});

Notice how the second argument is a cell array -- this case is not handled in the pop_chanedit argument parsing code around line 248 (the case when orichaninfo is a cell is not handled, only the case when is a char).

This leads to the lookup param/value pair to be completly ignored, so the returned EEG.chanlocs has no coordinate values.

Suggested fix:

Fix the code that builds the command string. It should return:

EEG=pop_chanedit(EEG, 'lookup', '/XXXX/eeglab/plugins/dipfit/standard_BEM/elec/standard_1005.elc', 'changefield',{1,'type','EEG'},'changefield',{2,'type','EEG'},'changefield',{3,'type','EEG'},'changefield',{4,'type','EEG'},'changefield',{5,'type','EEG'},'changefield',{6,'type','EEG'},'changefield',{7,'type','EEG'});

Note there are no brackets around the lookup/path PV pair. This will be properly parsed by pop_chanedit

Workaround

Manually reformat the command you copied from eegh to remove those curly brackets.

Versions

OS version macos 15.4.1
Matlab version 2024b
EEGLAB version 2025.0.0
@jiversen jiversen added the bug Something isn't working label May 8, 2025
@arnodelorme
Copy link
Collaborator

I am pretty sure this was fixed in 2025.1. Would you mind checking?

@jiversen
Copy link
Contributor Author

jiversen commented May 8, 2025

Sorry, should have checked that first! Sure, I'll update.

@arnodelorme
Copy link
Collaborator

arnodelorme commented May 8, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants