cpp-lln-lab / bidspm

an SPM centric BIDS app
https://bidspm.readthedocs.io/en/latest/general_information.html
GNU General Public License v3.0
5 stars 13 forks source link

[BUG] Transformation for event.tsv also applied to the motion.tsv #966

Closed avanaudenhaege closed 1 year ago

avanaudenhaege commented 1 year ago

Is there an existing issue for this?

Operating system

Operating system version

SPM 12 version

Platform

Platform version

bidspm version

v3.0.0

bidspm branch / commit number

branch = 'HEAD' commit = '0beefd61'

Expected Behavior

I used the following transformer to remove targets in my modelization :

"Transformations": {
        "Transformer": "cpp_spm",
        "Instructions": [
          {
            "Name": "Filter",
            "Input": "actor",
            "Query": "target < 1"
          }
        ]
      }

It works well for my first run, it removes the targets and only keeps 'actor' for trials that have 'target = 0' Then I get an error. It seems that bidspm want to apply the transformation to the motion.tsv file as well, and therefore complains that there is no 'actor' or 'target' variable in this file.

Current Behavior & Error message

error_2023-03-27T16-48.log

Anything else?

No response

github-actions[bot] commented 1 year ago

We found the following entry in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

Remi-Gau commented 1 year ago

do you think you can send the TSVs of one participants and the model.json so I can try to debug this on my side?

avanaudenhaege commented 1 year ago

Here they are. Thank you ! :) debug-issue#966.zip

Remi-Gau commented 1 year ago

I can reproduce the error.

Congratulation: you found a bug!!!

πŸŽ‰ πŸ› πŸŽ‰

opt.taskName = 'MVAVis';
opt = checkOptions(opt);

opt.model.file = fullfile(pwd, 'model-MVPAVis-speakTRANSFORM.json');
opt.model.bm = BidsModel('file', opt.model.file);

tsvFile = fullfile(pwd, 'sub-05_ses-01_task-MVPAVis_run-01_space-individual_desc-stc_motion.tsv');

counfoundMatFile = createAndReturnCounfoundMatFile(opt, tsvFile)

Warning:
missing variable(s): "actor"

> In bids.internal.error_handling (line 57)
  In bids.transformers_list.check_field (line 22)
  In bids.transformers_list.get_input (line 44)
  In bids.transformers_list.Filter (line 69)
  In bids.transformers>apply_munge (line 146)
  In bids.transformers>apply_transformer (line 106)
  In bids.transformers (line 83)
  In createAndReturnCounfoundMatFile (line 47)
  In untitled (line 8) 
Warning:
missing variable(s): "actor"

> In bids.internal.error_handling (line 57)
  In bids.transformers_list.check_field (line 22)
  In bids.transformers_list.get_input (line 44)
  In bids.transformers_list.get_output (line 23)
  In bids.transformers_list.Filter (line 70)
  In bids.transformers>apply_munge (line 146)
  In bids.transformers>apply_transformer (line 106)
  In bids.transformers (line 83)
  In createAndReturnCounfoundMatFile (line 47)
  In untitled (line 8) 
Error using bids.internal.error_handling (line 53)

missing variable(s): "target"

Error in bids.transformers_list.check_field (line 22)
    bids.internal.error_handling(mfilename(), ['missing' field_type], msg, tolerant, true);
Error in bids.transformers_list.Filter (line 73)
  bids.transformers_list.check_field(left, data, 'query', false);
Error in bids.transformers>apply_munge (line 146)
      output = bids.transformers_list.Filter(trans, data);
Error in bids.transformers>apply_transformer (line 106)
      output = apply_munge(trans, data);
Error in bids.transformers (line 83)
    data = apply_transformer(this_transformer, data);
Error in createAndReturnCounfoundMatFile (line 47)
  content = bids.transformers(transformers, content);
Error in untitled (line 8)
counfoundMatFile = createAndReturnCounfoundMatFile(opt, tsvFile)
Remi-Gau commented 1 year ago

OK so to explain a couple of things:

It is normal that the bidspm is trying to apply the model to the motion.tsv file (that contains the realignment parameter from the preprocessing).

For example you could specify in your bids stats model that you want to exclude time points where the subjects moved too much.

What is not normal is that it would crash when it cannot find the variables it is supposed to work on.

Will fix this.

Remi-Gau commented 1 year ago

OK this is going to be a bids matlab issue

Remi-Gau commented 1 year ago

@all-contributors add @avanaudenhaege for bug, userTesting

allcontributors[bot] commented 1 year ago

@Remi-Gau

I've put up a pull request to add @avanaudenhaege! :tada: