Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[build] Get the code compile under numpy 2.0 #1076

Merged
merged 3 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading