Skip to content

Prevent absolute paths from propagating into EEGLAB setname#23

Merged
larsoner merged 2 commits intojackz314:mainfrom
laemtl:fname_to_setname_utils
Jan 20, 2026
Merged

Prevent absolute paths from propagating into EEGLAB setname#23
larsoner merged 2 commits intojackz314:mainfrom
laemtl:fname_to_setname_utils

Conversation

@laemtl
Copy link
Contributor

@laemtl laemtl commented Jan 20, 2026

Motivation

When exporting EEGLAB .set files, users commonly pass an absolute path as fname.
This path propagates into EEG.setname, resulting in dataset names like:
/full/path/to/sub-01_task-rest.set
This makes EEGLAB datasets non-portable when files are moved or reorganized within a pipeline.

What this PR does

This change ensures that EEG.setname is derived only from the basename stem of fname:
• directory components are removed
• the file extension is stripped

Example:

fname = "/tmp/sub-01_task-rest.set"
EEG.setname == "sub-01_task-rest"

This keeps dataset names portable while leaving all other export behavior unchanged.

Scope of change

•	Introduces a small helper to derive setname from fname
•	Applies this helper at export time in raw.py and epochs.py

Rationale

This aligns with common EEGLAB usage, where setname is a logical dataset identifier rather than a filesystem path, and improves downstream tooling (including MNE-based exports).

@laemtl laemtl force-pushed the fname_to_setname_utils branch from 4cef5ad to 9437eb3 Compare January 20, 2026 16:53
@larsoner
Copy link
Collaborator

Sounds totally reasonable, thanks @laemtl !

@larsoner
Copy link
Collaborator

@laemtl can you fix the style issues?

@laemtl
Copy link
Contributor Author

laemtl commented Jan 20, 2026

@larsoner Done! Not sure how are triggered the linting checks :)

@larsoner larsoner merged commit 51302fd into jackz314:main Jan 20, 2026
5 checks passed
@larsoner
Copy link
Collaborator

Thanks @laemtl !

@laemtl
Copy link
Contributor Author

laemtl commented Jan 20, 2026

@larsoner My pleasure! Can I ask when is scheduled the next release? I am using my fork in the meantime, but definitely want to rebase to the official repo as soon as it is available!

@larsoner
Copy link
Collaborator

Already cut 2h ago! https://pypi.org/project/eeglabio/0.1.3/

@laemtl
Copy link
Contributor Author

laemtl commented Jan 20, 2026

@larsoner Very impressive. Thank you!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants