Skip to content

Commit

Permalink
Reverted the behavior until future hypothetical release
Browse files Browse the repository at this point in the history
  • Loading branch information
bthirion committed May 21, 2014
1 parent f864107 commit 125e352
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 8 additions & 2 deletions nipy/modalities/fmri/experimental_paradigm.py
Expand Up @@ -22,6 +22,7 @@
import numpy as np

from ...utils.compat3 import open4csv
import warnings

##########################################################
# Paradigm handling
Expand Down Expand Up @@ -51,11 +52,16 @@ def __init__(self, con_id=None, onset=None, amplitude=None):
try:
# this is only for backward compatibility:
#if con_id were integers, they become a string
warnings.warn(
'The behavior will change,' +
'prepending by a c will disappear in the future')
self.con_id = np.array(['c' + str(int(float(c)))
for c in con_id])
for c in con_id])
except:
self.con_id = np.ravel(np.array(con_id)).astype('str')

# the following line should replace the try.. except statement
# self.con_id = np.ravel(np.array(con_id)).astype('str')

if onset is not None:
if len(onset) != self.n_events:
raise ValueError(
Expand Down
4 changes: 3 additions & 1 deletion nipy/modalities/fmri/tests/test_paradigm.py
Expand Up @@ -81,7 +81,9 @@ 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()
#assert (paradigm2.con_id == np.array(conditions).astype('str')).all()
ccon = np.array(['c0', 'c0', 'c0', 'c1', 'c1', 'c1', 'c2', 'c2', 'c2'])
assert (paradigm2.con_id == ccon).all()


if __name__ == "__main__":
Expand Down

0 comments on commit 125e352

Please sign in to comment.