From 6bf187c02224f59347d0ba3970caeb636f80dae0 Mon Sep 17 00:00:00 2001 From: "V. Armando Sole" Date: Tue, 7 May 2024 14:05:15 +0200 Subject: [PATCH] Use asarray --- PyMca5/PyMcaGraph/backends/_OpenGLPlotCanvas.py | 16 ++++++++-------- PyMca5/PyMcaGui/misc/NumpyArrayTableModel.py | 6 +++--- .../physics/xas/XASNormalizationWindow.py | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/PyMca5/PyMcaGraph/backends/_OpenGLPlotCanvas.py b/PyMca5/PyMcaGraph/backends/_OpenGLPlotCanvas.py index 1c27db326..0a798e9db 100644 --- a/PyMca5/PyMcaGraph/backends/_OpenGLPlotCanvas.py +++ b/PyMca5/PyMcaGraph/backends/_OpenGLPlotCanvas.py @@ -2,7 +2,7 @@ # # The PyMca X-Ray Fluorescence Toolkit # -# Copyright (c) 2004-2015 European Synchrotron Radiation Facility +# Copyright (c) 2004-2024 European Synchrotron Radiation Facility # # This file is part of the PyMca X-ray Fluorescence Toolkit developed at # the ESRF by the Software group. @@ -1323,7 +1323,7 @@ def addImage(self, data, legend=None, info=None, RuntimeWarning) data = np.array(data, dtype=np.float32, order='C') else: - data = np.array(data, copy=False, order='C') + data = np.asarray(data, order='C') assert data.dtype in (np.float32, np.uint8, np.uint16) if colormap is None: @@ -1447,8 +1447,8 @@ def addItem(self, xList, yList, legend=None, info=None, yMin, yMax = yList yList = np.array((yMin, yMax, yMax, yMin)) else: - xList = np.array(xList, copy=False) - yList = np.array(yList, copy=False) + xList = np.asarray(xList) + yList = np.asarray(yList) if self._plotFrame.xAxis.isLog and xList.min() <= 0.: raise RuntimeError( @@ -1501,13 +1501,13 @@ def addCurve(self, x, y, legend=None, info=None, if legend is None: legend = self._UNNAMED_ITEM - x = np.array(x, dtype=np.float32, copy=False, order='C') - y = np.array(y, dtype=np.float32, copy=False, order='C') + x = np.asarray(x, dtype=np.float32, order='C') + y = np.asarray(y, dtype=np.float32, order='C') if xerror is not None: - xerror = np.array(xerror, dtype=np.float32, copy=False, order='C') + xerror = np.asarray(xerror, dtype=np.float32, order='C') assert np.all(xerror >= 0.) if yerror is not None: - yerror = np.array(yerror, dtype=np.float32, copy=False, order='C') + yerror = np.asarray(yerror, dtype=np.float32, order='C') assert np.all(yerror >= 0.) behaviors = set() diff --git a/PyMca5/PyMcaGui/misc/NumpyArrayTableModel.py b/PyMca5/PyMcaGui/misc/NumpyArrayTableModel.py index f45947e76..2b7a87092 100644 --- a/PyMca5/PyMcaGui/misc/NumpyArrayTableModel.py +++ b/PyMca5/PyMcaGui/misc/NumpyArrayTableModel.py @@ -1,5 +1,5 @@ #/*########################################################################## -# Copyright (C) 2004-2023 European Synchrotron Radiation Facility +# Copyright (C) 2004-2024 European Synchrotron Radiation Facility # # This file is part of the PyMca X-ray Fluorescence Toolkit developed at # the ESRF. @@ -230,13 +230,13 @@ def setArrayColors(self, bgcolors=None, fgcolors=None): errmsg = "Inconsistent shape for color array, should be %s or %s" % valid_shapes if bgcolors is not None: - bgcolors = numpy.array(bgcolors, copy=False) + bgcolors = numpy.asarray(bgcolors) assert bgcolors.shape in valid_shapes, errmsg self._bgcolors = bgcolors if fgcolors is not None: - fgcolors = numpy.array(fgcolors, copy=False) + fgcolors = numpy.asarray(fgcolors) assert fgcolors.shape in valid_shapes, errmsg self._fgcolors = fgcolors diff --git a/PyMca5/PyMcaGui/physics/xas/XASNormalizationWindow.py b/PyMca5/PyMcaGui/physics/xas/XASNormalizationWindow.py index 7ba00579e..38bcc318f 100644 --- a/PyMca5/PyMcaGui/physics/xas/XASNormalizationWindow.py +++ b/PyMca5/PyMcaGui/physics/xas/XASNormalizationWindow.py @@ -2,7 +2,7 @@ # # The PyMca X-Ray Fluorescence Toolkit # -# Copyright (c) 2004-2023 European Synchrotron Radiation Facility +# Copyright (c) 2004-2024 European Synchrotron Radiation Facility # # This file is part of the PyMca X-ray Fluorescence Toolkit developed at # the ESRF. @@ -280,7 +280,7 @@ def __init__(self, parent, spectrum, energy=None): self.energy = numpy.arange(len(spectrum)).astype(numpy.float64) else: self.energy = energy - self.spectrum = numpy.array(spectrum, dtype=numpy.float64, copy=False) + self.spectrum = numpy.asarray(spectrum, dtype=numpy.float64) self.parametersWidget = XASNormalizationParametersWidget(self) self.graph = PlotWindow.PlotWindow(self, backend=backend, plugins=False, newplot=False)