Skip to content

Commit

Permalink
Merge a6f066d into 1afc552
Browse files Browse the repository at this point in the history
  • Loading branch information
bthirion committed Apr 8, 2014
2 parents 1afc552 + a6f066d commit 1d0509e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 1 addition & 7 deletions nipy/modalities/fmri/experimental_paradigm.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,7 @@ def __init__(self, con_id=None, onset=None, amplitude=None):
self.amplitude = amplitude
if con_id is not None:
self.n_events = len(con_id)
try:
# this is only for backward compatibility:
#if con_id were integers, they become a string
self.con_id = np.array(['c' + str(int(float(c)))
for c in con_id])
except:
self.con_id = np.ravel(np.array(con_id)).astype('str')
self.con_id = np.ravel(np.array(con_id)).astype('str')

if onset is not None:
if len(onset) != self.n_events:
Expand Down
7 changes: 7 additions & 0 deletions nipy/modalities/fmri/tests/test_paradigm.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ def test_read_paradigm():
assert (read_paradigm.onset == paradigm.onset).all()


def test_paradigm_with_int_condition_ids():
paradigm1 = basic_paradigm()
conditions = [0, 0, 0, 1, 1, 1, 2, 2, 2]
paradigm2 = EventRelatedParadigm(conditions, paradigm1.onset)
assert (paradigm2.con_id == np.array(conditions).astype('str')).all()


if __name__ == "__main__":
import nose
nose.run(argv=['', __file__])

0 comments on commit 1d0509e

Please sign in to comment.