Skip to content

Commit

Permalink
Merge pull request #1076 from vasole/np2
Browse files Browse the repository at this point in the history
[build] Get the code compile under numpy 2.0
  • Loading branch information
vasole authored May 7, 2024
2 parents 1332831 + 7fb3267 commit a06cfd9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
8 changes: 6 additions & 2 deletions PyMca5/PyMcaGui/plotting/McaROIWidget.py
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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 = []
Expand Down
8 changes: 4 additions & 4 deletions PyMca5/PyMcaMath/PyMcaSciPy/signal/mediantools.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <setjmp.h>

Expand All @@ -51,17 +51,17 @@ typedef struct {

typedef struct {
char *data;
intp numels;
npy_intp numels;
int elsize;
char *zero; /* Pointer to Representation of zero */
} Generic_Vector;

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;

Expand Down
10 changes: 5 additions & 5 deletions PyMca5/PyMcaPlugins/ImageAlignmentStackPlugin.py
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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__ = "[email protected]"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
Expand Down Expand Up @@ -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')
Expand All @@ -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()

Expand Down

0 comments on commit a06cfd9

Please sign in to comment.