From fe98d00fd0acfb649e0c1ff9fa8eadfe2b9c430a Mon Sep 17 00:00:00 2001
From: sldesnoo-Delft <s.l.desnoo@tudelft.nl>
Date: Wed, 19 Oct 2022 10:05:40 +0200
Subject: [PATCH] Added numpy reduce functions

---
 pulse_lib/segments/utility/looping.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/pulse_lib/segments/utility/looping.py b/pulse_lib/segments/utility/looping.py
index b2b8ff5e..dfebf3dc 100644
--- a/pulse_lib/segments/utility/looping.py
+++ b/pulse_lib/segments/utility/looping.py
@@ -218,9 +218,10 @@ class loop_obj():
             else:
                 cpy.data = ufunc(self.data, *args, **kwargs)
             return cpy
-        if len(inputs) > 1 and inputs[1] is self and method == '__call__':
-            data = ufunc(inputs[0], self.data, *inputs[2:], **kwargs)
-            return data
+        elif inputs[0] is self:
+            return getattr(ufunc, method)(self.data, *inputs[1:], **kwargs)
+        elif len(inputs) > 1 and inputs[1] is self and method == '__call__':
+            return ufunc(inputs[0], self.data, *inputs[2:], **kwargs)
         return NotImplemented
 
     def __copy__(self):
-- 
GitLab