Skip to content

Unable to initialize sessions with duplicated file names #65

@areewitoelar

Description

@areewitoelar

If a project is initialized from a data location where session files/folders have the same name across different different subjects, the default selection of session ids (from folder/file name) will result in non-unique session ids.

In nansen.config.initializeSessionTable this will then cause an error in the following code block:

sessionIDs = {sessionArray.sessionID};
if numel(sessionIDs) ~= numel(unique(sessionIDs))
[sessionArray, wasAborted] = nansen.manage.uiresolveDuplicateSessions(sessionArray, hFigure);
numSessionPostExclusion = numel(sessionArray);
% Todo: Why are all duplicates excluded? I.e keep first one...
if numSessionPostExclusion == 0
% Todo: Add more detailed how-to solution
error('NANSEN:InitializeSessionArray:DuplicateSessionIDs', ...
['%d sessions were excluded because they share duplicate session IDs:\n%s\n' ...
'Please ensure all session IDs are unique before continuing.'], ...
numel(sessionIDs), strjoin(unique(sessionIDs), ', '));
end
% Todo: Rerun initialization from here if sessions were resolved
if wasAborted
return
end

There are two problems here:

  1. When duplicate session ids are identified, all the sessions are excluded, not just the duplicates
  2. The procedure for resolving duplicates is poorly documented and not user friendly.

Proposed solution:
When creating a session table, all the detected sessions should get assigned a unique internal identifier, and then it is up to the user (potentially via some provided utilities) to clean up duplicated sessions after creating a project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions