nipreps / eddymotion

Open-source eddy-current and head-motion correction for dMRI.
https://nipreps.org/eddymotion
Apache License 2.0
15 stars 16 forks source link

`DWI` objects equality is broken #95

Closed arokem closed 6 months ago

arokem commented 2 years ago
File <attrs generated eq eddymotion.dmri.DWI>:4, in __eq__(self, other)
      2 if other.__class__ is not self.__class__:
      3     return NotImplemented
----> 4 return  (
      5     self.dataobj,
      6     self.affine,
      7     self.brainmask,
      8     self.bzero,
      9     self.gradients,
     10     self.em_affines,
     11     self.fieldmap,
     12     self._filepath,
     13 ) == (
     14     other.dataobj,
     15     other.affine,
     16     other.brainmask,
     17     other.bzero,
     18     other.gradients,
     19     other.em_affines,
     20     other.fieldmap,
     21     other._filepath,
     22 )

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Is this automagically created by the attr library? It apparently doesn't have enough magic to deal with array attributes.

oesteban commented 2 years ago

Correct - we will need to write our own dunder __eq__