1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
From: Roland Mas <lolando@debian.org>
Date: Sun, 16 Mar 2025 16:18:56 +0100
Subject: Get a writable copy of an array before byteswapping it
---
src/fabio/fit2dmaskimage.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/fabio/fit2dmaskimage.py b/src/fabio/fit2dmaskimage.py
index d2cb4ec..aab5999 100644
--- a/src/fabio/fit2dmaskimage.py
+++ b/src/fabio/fit2dmaskimage.py
@@ -92,6 +92,8 @@ class Fit2dMaskImage(FabioImage):
# Now to unpack it
data = numpy.frombuffer(data, numpy.uint8)
if not numpy.little_endian:
+ data = numpy.copy(data)
+ data.setflags(write=1)
data.byteswap(True)
data = numpy.reshape(data, (dim2, num_ints * 4))
|