From 4d7525479c5f0c57404da4cc880a34c0c202e422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=2E=20Armando=20Sol=C3=A9?= Date: Tue, 26 Mar 2024 09:27:46 +0100 Subject: [PATCH 1/3] Replace string_ by bytes_ --- PyMca5/PyMcaPlugins/ImageAlignmentStackPlugin.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/PyMca5/PyMcaPlugins/ImageAlignmentStackPlugin.py b/PyMca5/PyMcaPlugins/ImageAlignmentStackPlugin.py index 901f42114..eac59a3d0 100644 --- a/PyMca5/PyMcaPlugins/ImageAlignmentStackPlugin.py +++ b/PyMca5/PyMcaPlugins/ImageAlignmentStackPlugin.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. @@ -32,7 +32,7 @@ This plugin also allows to apply the results from a file. """ -__author__ = "V.A. Sole - ESRF Data Analysis" +__author__ = "V.A. Sole - ESRF" __contact__ = "sole@esrf.fr" __license__ = "MIT" __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" @@ -686,8 +686,8 @@ def initializeHDF5File(self, fname): nxEntry = hdf.require_group(entryName) if 'NX_class' not in nxEntry.attrs: nxEntry.attrs['NX_class'] = 'NXentry'.encode('utf-8') - nxEntry['title'] = numpy.string_("PyMca saved 3D Array".encode('utf-8')) - nxEntry['start_time'] = numpy.string_(ArraySave.getDate().encode('utf-8')) + nxEntry['title'] = numpy.bytes_("PyMca saved 3D Array".encode('utf-8')) + nxEntry['start_time'] = numpy.bytes_(ArraySave.getDate().encode('utf-8')) alignmentGroup = nxEntry.require_group('Alignment') dataGroup = nxEntry.require_group('Data') @@ -697,7 +697,7 @@ def initializeHDF5File(self, fname): def finishHDF5File(self, hdf): #add final date toplevelEntry = hdf["entry_000"] - toplevelEntry['end_time'] = numpy.string_(ArraySave.getDate().encode('utf-8')) + toplevelEntry['end_time'] = numpy.bytes_(ArraySave.getDate().encode('utf-8')) hdf.flush() hdf.close() From 715a676948dbe2331ce60caaf314f69a427013b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=2E=20Armando=20Sol=C3=A9?= Date: Tue, 26 Mar 2024 13:48:23 +0100 Subject: [PATCH 2/3] Adapt to numpy > 2.0 --- PyMca5/PyMcaMath/PyMcaSciPy/signal/mediantools.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PyMca5/PyMcaMath/PyMcaSciPy/signal/mediantools.c b/PyMca5/PyMcaMath/PyMcaSciPy/signal/mediantools.c index 915eaf217..6c030ad0a 100644 --- a/PyMca5/PyMcaMath/PyMcaSciPy/signal/mediantools.c +++ b/PyMca5/PyMcaMath/PyMcaSciPy/signal/mediantools.c @@ -40,7 +40,7 @@ DAMAGE. /* adding next line may raise errors ... #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION */ -#include "numpy/noprefix.h" +#include "numpy/arrayobject.h" #include @@ -51,7 +51,7 @@ typedef struct { typedef struct { char *data; - intp numels; + npy_intp numels; int elsize; char *zero; /* Pointer to Representation of zero */ } Generic_Vector; @@ -59,9 +59,9 @@ typedef struct { typedef struct { char *data; int nd; - intp *dimensions; + npy_intp *dimensions; int elsize; - intp *strides; + npy_intp *strides; char *zero; /* Pointer to Representation of zero */ } Generic_Array; From 7fb3267acc818c03af1546e3659c1f206fac791c Mon Sep 17 00:00:00 2001 From: "V. Armando Sole" Date: Sat, 27 Apr 2024 18:55:12 +0200 Subject: [PATCH 3/3] Cleaner method signature. --- PyMca5/PyMcaGui/plotting/McaROIWidget.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/PyMca5/PyMcaGui/plotting/McaROIWidget.py b/PyMca5/PyMcaGui/plotting/McaROIWidget.py index d3f7ca90d..39198addd 100644 --- a/PyMca5/PyMcaGui/plotting/McaROIWidget.py +++ b/PyMca5/PyMcaGui/plotting/McaROIWidget.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. @@ -337,7 +337,11 @@ def __init__(self, *args,**kw): def build(self): self.fillFromROIDict(roilist=self.roilist,roidict=self.roidict) - def fillFromROIDict(self,roilist=[],roidict={},currentroi=None): + def fillFromROIDict(self, roilist=None, roidict=None, currentroi=None): + if roilist is None: + roilist = [] + if roidict is None: + roidict = {} self.building = True line0 = 0 self.roilist = []