[Nipy-devel] attributes error
Jonathan Taylor
jonathan.taylor at stanford.edu
Sun May 28 10:56:42 CDT 2006
I wanted to change a read-only attribute (the slice attribute of
SliceIteratorNext) to
not read-only but "untyped". I changed "readonly" to "attribute" and got
the following message:
--------------
Traceback (most recent call last):
File "run.py", line 173, in ?
FIACrun(subj=subj, run=run)
File "run.py", line 134, in FIACrun
OLS.fit()
File
"/home/jtaylo/python/lib/python2.4/site-packages/neuroimaging/fmri/fmristat/__init__.py",
line 107, in fit
LinearModelIterator.fit(self, **keywords)
File
"/home/jtaylo/python/lib/python2.4/site-packages/neuroimaging/statistics/regression.py",
line 48, in fit
output.next(data=out)
File
"/home/jtaylo/python/lib/python2.4/site-packages/neuroimaging/fmri/regression.py",
line 40, in next
value.slice = value.slice[1]
File "/home/jtaylo/python/lib/python2.4/site-packages/attributes.py",
line 256, in set
self.validate(value)
File "/home/jtaylo/python/lib/python2.4/site-packages/attributes.py",
line 211, in validate
if not self.isvalid(value): raise ProtocolOmission(
protocols.ProtocolOmission: attribute slice implements ([slice(0, 191,
1), slice(0, 1, 1)],), value slice(0, 1, 1) of type <type 'slice'> does
not implement: ('__getslice__', 'pop', 'remove', '__rmul__', '__lt__',
'append', 'index', '__delslice__', '__getitem__', '__contains__',
'__len__', 'sort', '__ne__', 'extend', 'insert', '__iter__', '__add__',
'__gt__', '__eq__', 'reverse', 'count', '__delitem__', '__reversed__',
'__imul__', '__setslice__', '__setitem__', '__iadd__', '__le__',
'__mul__', '__ge__')
---------------------------
I am not sure how to get this to work. I want it to behave like a slice or a list of slices.
There is a very good example when you want to be able to change its value later: when the "iterator" driving the voxelwise analysis comes from an fMRI image, it spits out
slices of time series, but if you want to output slices of floats (i.e. a 3d image of means), you want to ignore the first part of this (python) slice but you can still use the same "SliceIteratorNext" instance to drive the next method of the images....
Thanks,
Jonathan
--
------------------------------------------------------------------------
I'm part of the Team in Training: please support our efforts for the
Leukemia and Lymphoma Society!
http://www.active.com/donate/tntsvmb/tntsvmbJTaylor
GO TEAM !!!
------------------------------------------------------------------------
Jonathan Taylor Tel: 650.723.9230
Dept. of Statistics Fax: 650.725.8977
Sequoia Hall, 137 www-stat.stanford.edu/~jtaylo
390 Serra Mall
Stanford, CA 94305
More information about the Nipy-devel
mailing list