-
Notifications
You must be signed in to change notification settings - Fork 27
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
[FIX] AttributeError for _ApplyCoeffsFieldInputSpec #481
Conversation
Nipype expects the `xor` attribute for traits to always be a list. If it's just a string, then the individual characters of the string will be iterated, leading to an AttributeError when no single character attribute exists on the spec.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #481 +/- ##
==========================================
+ Coverage 83.85% 83.87% +0.01%
==========================================
Files 30 30
Lines 2819 2822 +3
Branches 365 366 +1
==========================================
+ Hits 2364 2367 +3
Misses 384 384
Partials 71 71 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, this looks reasonable - would you be up for a simple smoke test or doctest to catch this in the future?
5cabd76
to
9c1c0c0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a doctest. If I revert the @HippocampusGirl's fix, I get:
----------------------------------------------------- Captured log call ------------------------------------------------------
ERROR traits:trait_notifiers.py:220 Exception occurred in traits notification handler for object:
approx = True
data2fmap_xfm = ['/var/home/chris/Projects/nipreps/sdcflows/sdcflows/tests/data/epi2fmap_xfm.txt']
fmap2data_xfm = <undefined>
in_coeff = ['/var/home/chris/Projects/nipreps/sdcflows/sdcflows/tests/data/topup-coeff.nii.gz']
in_data = /var/home/chris/Projects/nipreps/sdcflows/sdcflows/tests/data/epi.nii.gz
in_xfms = <undefined>
jacobian = False
num_threads = <undefined>
pe_dir = ['j']
ro_time = [0.03125]
, trait: data2fmap_xfm, old value: <undefined>, new value: ['/var/home/chris/Projects/nipreps/sdcflows/sdcflows/tests/data/epi2fmap_xfm.txt']
Traceback (most recent call last):
File "/var/home/chris/Projects/nipreps/sdcflows/.tox/py312-latest/lib/python3.12/site-packages/traits/trait_notifiers.py", line 525, in _dispatch_change_event
self.dispatch(handler, *args)
File "/var/home/chris/Projects/nipreps/sdcflows/.tox/py312-latest/lib/python3.12/site-packages/traits/trait_notifiers.py", line 487, in dispatch
handler(*args)
File "/var/home/chris/Projects/nipreps/sdcflows/.tox/py312-latest/lib/python3.12/site-packages/nipype/interfaces/base/specs.py", line 110, in _xor_warn
if isdefined(getattr(self, trait_name)):
^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: '_ApplyCoeffsFieldInputSpec' object has no attribute 'f'
With the fix, the tests pass.
2.12.0 (March 21, 2025) Feature release in the 2.12.x series. This release migrates from the deprecated ``niworkflows.reporting`` module to the ``nireports`` package. * FIX: AttributeError for _ApplyCoeffsFieldInputSpec (#481) * ENH: Allow running SyN SDC without using prior (#480) * ENH: Allow estimated and fallback TotalReadoutTime (#477) * RF: Transition from niworkflows reporting interfaces (#473) * DOC: Fix broken link [skip ci] (#482) * MNT: Add `defaults` to `conda` channels in `build-test-publish` GHA (#474) * MNT: Update `niworkflows` version to 1.11.0 (#478)
I've been recently working with unstable fMRIPrep and have been getting the following error with SDCFlows 2.11.0 and Nipype 1.9.2:
As far as I can tell, Nipype expects the
xor
attribute for traits to always be a list. It's just a string here thoughsdcflows/sdcflows/interfaces/bspline.py
Lines 302 to 311 in 50ace2a
If it's just a string, then the individual characters of the string will be iterated, leading to an AttributeError when no single character attribute exists on the spec.
I believe this may be related to #386
My conda environment