Skip to content

fix for SpecifySPMModel #1200

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

Merged
merged 3 commits into from
Sep 1, 2015
Merged

fix for SpecifySPMModel #1200

merged 3 commits into from
Sep 1, 2015

Conversation

MartinPerez
Copy link
Contributor

@satra you were right, I tested simply correcting the line you pointed out solved the problem. Fix for #1198.

@@ -476,7 +476,7 @@ def _concatenate_info(self, infolist):
sum(nscans[0:(i + 1)])
infoout.onsets[j].extend(onsets.tolist())
for j, val in enumerate(info.durations):
if len(val) > 1:
if len(val) > 0:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this can simply be: if len(val):

also could you please add your test to test_modelgen? it should fail without this change, and pass with it? there is already a section that checks concatenation.

@MartinPerez
Copy link
Contributor Author

@satra I implemented the test and corrected based on your comments. In the test I added some comments to separate the intention of the different tests and added mine at the end. Also modified the last test (before mine) to contrast the fact that when there are three sessions and they are not concatenated the durations are detected just fine.

satra added a commit that referenced this pull request Sep 1, 2015
@satra satra merged commit c6c949c into nipy:master Sep 1, 2015
@satra
Copy link
Member

satra commented Sep 1, 2015

thanks @MartinPerez

@MartinPerez
Copy link
Contributor Author

thanks @satra

@chrisgorgo
Copy link
Member

CircleCI tests are not passing on this PR. We should consider reverting the merge until this is resolved.

@satra
Copy link
Member

satra commented Sep 1, 2015

@chrisfilo - is there an error message? this should only affect the spm test.

@chrisgorgo
Copy link
Member

Both example SPM workflows fail to run. See https://circleci.com/gh/nipy/nipype/48 for details.

@MartinPerez
Copy link
Contributor Author

Effectively this should be reverted. The key problem is the same that I had (non matching number of onsets and events / Number of event onsets (16) does not match the number of durations (4)) but i guess now its about specifying all durations with only one number?

When I ran the simple test, the example with one duration to describe all onsets seemed to be fine too.

@satra
Copy link
Member

satra commented Sep 1, 2015

i think we should fix it to address both cases.

if len(val) == 1:
    # then replicate to number of onsets
else:
    if len(val) != len(number_onsets):
        raise ValueError('Mismatch in number of onsets and durations for session %d, condition %s')
    # append all durations

@MartinPerez
Copy link
Contributor Author

I would say that we have to check the number of onsets, like:

if len(ons) > 1 and len(val) == 1:
# fill ons with val
elif len(ons) ==  len(val):
# add the durations
else:
    raise ValueError('Mismatch in number of onsets and durations for session %d, condition %s')

you agree?

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.

3 participants