Skip to content
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

[bugfix] import snirf with event having only one occurance #694

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Edouard2laire
Copy link
Contributor

@Edouard2laire Edouard2laire commented Mar 13, 2024

Fix the following bug happening when importing a snirf where one event has only one occurrence:

Maybe its not the best fix.

***************************************************************************
** Error: Line 258: Index in position 2 exceeds array bounds. Index must not exceed 1.
** 
** Call stack:
** >in_data_snirf.m at 258
** >in_fopen.m at 221
** >import_raw.m at 132
** >bst_call.m at 28
** >tree_callbacks.m>@(h,ev)bst_call(@import_raw,[],[],iSubject) at 672
** 
********

Edit: maybe its not the best fix. jnirs.nirs.stim(iEvt).data should be nEvent x 3

@rcassani
Copy link
Member

Based on the SNIRF specification, a better approach would be to search first for the optional record /nirs(i)/stim(j)/dataLabels to decide if transpose or not. If this is not available, transpose could be required in this condition:

if size(data, 1) < 3 && diff(size(data) < 0)
  % Transpose

with the hope that if it's 3 by 3, it's correct

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.

None yet

2 participants