Python: modify some DataContainer methods to fall back to numpy
I suggest to modify https://github.com/SyneRBI/SIRF/blob/8fbfe5294e4efd57d12ae15d87b97f64e96d09d4/src/common/SIRF.py#L268-L276 to something like this
def norm(self):
if (self.supports_array_view):
return numpy.linalg.norm(self.asarray())
# original code
@evgueni-ovtchinnikov @casperdcl good idea?
Yes, though as @ckolbPTB mentioned there may be cases where self.norm() should not be calculated over the whole self.asarray() 🤷.
Also related: https://github.com/SyneRBI/SIRF/pull/1332#pullrequestreview-3051782870
Yes, though as @ckolbPTB mentioned there may be cases where
self.norm()should not be calculated over the wholeself.asarray()🤷.
sure, but I don't think that's we should worry about this here. The current norm() would then be inappropriate already anyway.
@KrisThielemans I am afraid your suggestion will only work for DataContainer objects, but views may be numpy arrays.
re Christoph remark: if he meant ignoring some acquisitions then this is already covered by the ignore mask, but it is easy to extend this feature to any subset by adding optional list argument in the constructor of AcquisitionDataView - will ask him next time we meet.