bids-matlab icon indicating copy to clipboard operation
bids-matlab copied to clipboard

[BUG] bids.diagnostic does not properly handle "trial_type_col" argument

Open kacross opened this issue 10 months ago • 2 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Operating system

  • [ ] Linux
  • [ ] Mac
  • [x] Windows

Operating system version

- Windows 10 Enterprise Version 22H2 OS build 19045.5131

Platform

  • [x] MATLAB
  • [ ] Octave

Platform version

- MATLAB 2023a

bids-matlab version

v0.1.0

branch / commit number


Expected Behavior

bids.diagnostic(mybids,'trial_type_col','type')

Use the column "type" to create a diagnostic events table

Current Behavior

Uses the default column "trial_type" even though a trial_type_col argument is provided.

Error message

Warning: Escaped character '\C' is not valid. See 'doc sprintf' for supported special characters. 
> In bids.internal.error_handling (line 51)
In bids.internal.list_all_trial_types (line 101)
In bids.internal.list_events (line 70)
In bids.diagnostic (line 177) 
Warning:
No "trial_type" column found in files:
	- D: 
> In bids.internal.error_handling (line 60)
In bids.internal.list_all_trial_types (line 101)
In bids.internal.list_events (line 70)
In bids.diagnostic (line 177)

Anything else?

I believe this is because the list_events.m does not pass the "trial_type_col" argument to the list_all_trial_types call on line 67:

current line 67 in list_events.m trial_type_list = bids.internal.list_all_trial_types(BIDS, task, ... 'tolerant', true, 'verbose', true);

should be: trial_type_list = bids.internal.list_all_trial_types(BIDS, task, ... 'trial_type_col', trial_type_col,... 'tolerant', true, 'verbose', true);

kacross avatar Feb 07 '25 17:02 kacross

I am struggling to reproduce the issue by adapting the test for this function: https://github.com/bids-standard/bids-matlab/blob/main/tests/tests_slow/test_diagnostic.m

can you attach a sample events.tsv from your dataset?

Also are you using a Windows machine?

Remi-Gau avatar Feb 10 '25 07:02 Remi-Gau

The tsv is attached (as a text file due to github not allowing my .tsv extension). I used and I called as bids.diagnostic(mybids,'split_by','task','trial_type_col','type','output_path',fullfile(bidsdir,'derivatives','import'),'verbose',false);

sub-CM40_task-reaching_run-1_events.txt

kacross avatar Feb 10 '25 16:02 kacross