Skip to content

Commit

Permalink
Merge pull request #916 from neuroscout/fix/hrf_dur
Browse files Browse the repository at this point in the history
Fix HRF duration
  • Loading branch information
adelavega committed Apr 28, 2021
2 parents 51fb1c5 + 5148813 commit e38fd57
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions neuroscout/tasks/utils/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,17 @@ def build_analysis(analysis, predictor_events, bids_dir,

tmp_dir = Path(mkdtemp())

# Get set of entities across analysis
# Get durations and set of entities across analysis runs
if run_ids is None:
run_entities = [_get_entities(run) for run in analysis['runs']]
run_entities = [(run['duration'], _get_entities(run)) for run in analysis['runs']]
else:
run_entities = []
for rid in run_ids:
for run in analysis['runs']:
if rid == run['id']:
run_entities.append(_get_entities(run))
run_entities.append((run['duration'], _get_entities(run)))
break

scan_length = max([r['duration'] for r in analysis['runs']])

# Write out all events
paths = writeout_events(
analysis, predictor_events, tmp_dir, run_ids)
Expand All @@ -107,11 +105,8 @@ def build_analysis(analysis, predictor_events, bids_dir,
bids_analysis = BIDSAnalysis(
bids_layout, deepcopy(analysis.get('model')))

if run_entities:
for ents in run_entities:
bids_analysis.setup(**ents, scan_length=scan_length)
else:
bids_analysis.setup(scan_length=scan_length)
for dur, ents in run_entities:
bids_analysis.setup(**ents, scan_length=dur)

return tmp_dir, paths, bids_analysis

Expand Down

0 comments on commit e38fd57

Please sign in to comment.