poldracklab / fitlins

Fit Linear Models to BIDS Datasets
https://fitlins.readthedocs.io
Apache License 2.0
76 stars 32 forks source link

Reports fail for models with only first-level analysis #366

Open shashankbansal6 opened 2 years ago

shashankbansal6 commented 2 years ago

Environment

Expected Behavior

Reports should work the same for models with only first-level analysis.

Observed Behavior

This model fails with the following errors:

Traceback (most recent call last):
  File "/Users/shashankbansal/miniconda/envs/spm_tuto/bin/fitlins", line 8, in <module>
    sys.exit(main())
  File "/Users/shashankbansal/miniconda/envs/spm_tuto/lib/python3.8/site-packages/fitlins/cli/run.py", line 432, in main
    sys.exit(run_fitlins(sys.argv[1:]))
  File "/Users/shashankbansal/miniconda/envs/spm_tuto/lib/python3.8/site-packages/fitlins/cli/run.py", line 425, in run_fitlins
    report_dict = build_report_dict(deriv_dir, work_dir, graph)
  File "/Users/shashankbansal/miniconda/envs/spm_tuto/lib/python3.8/site-packages/fitlins/viz/reports.py", line 130, in build_report_dict
    {analysis_dict['entities']['subject'] for analysis_dict in report['nodes'][0]['analyses']}
  File "/Users/shashankbansal/miniconda/envs/spm_tuto/lib/python3.8/site-packages/fitlins/viz/reports.py", line 130, in <setcomp>
    {analysis_dict['entities']['subject'] for analysis_dict in report['nodes'][0]['analyses']}
KeyError: 'subject'

This is because fitlins report generation is hard-coded to expect a subject level node.