```
elif np.isscalar(result):
     result = np.ma.array(result, mask=mask_update)
else:
     raise ...
```