Comments (6)
Just a small change may fix this? c0e3849 uses a different include for numpy. It looks like including that specific header was a mistake from the beginning (2012) as none of the noprefix names are ever used anywhere. The linux build seem to still work, if this looks good I can create another release.
from scikit-fmm.
I should add I tested this with numpy 1.26.4
from scikit-fmm.
I tried patching it but I got the following error:
../skfmm/fmm.cpp:115:48: error: 'PyArray_DOUBLE' was not declared in this scope; did you mean 'PyArray_DTYPE'?
from scikit-fmm.
I used the following patch:
From c0e384906a1017c4e49d9da1534a0bddf5230e28 Mon Sep 17 00:00:00 2001
From: Jason Furtney <[email protected]>
Date: Thu, 30 May 2024 13:05:44 -0500
Subject: [PATCH] change numpy header include
---
skfmm/fmm.cpp | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletion(-)
diff --git a/skfmm/fmm.cpp b/skfmm/fmm.cpp
index 351a51d..5714206 100644
--- a/skfmm/fmm.cpp
+++ b/skfmm/fmm.cpp
@@ -2,7 +2,8 @@
// implementation of the fast marching method in fast_marching.cpp
#include "Python.h"
-#include "numpy/noprefix.h"
+#include "numpy/ndarraytypes.h"
+#include "numpy/ufuncobject.h"
#include "distance_marcher.h"
#include "travel_time_marcher.h"
@@ -112,7 +112,7 @@ static PyObject *distance_method(PyObject *self, PyObject *args)
return NULL;
}
- phi = (PyArrayObject *)PyArray_FROMANY(pphi, PyArray_DOUBLE, 1,
+ phi = (PyArrayObject *)PyArray_FROMANY(pphi, NPY_DOUBLE, 1,
10, NPY_IN_ARRAY);
if (!phi)
{
@@ -121,7 +121,7 @@ static PyObject *distance_method(PyObject *self, PyObject *args)
return NULL;
}
- dx = (PyArrayObject *)PyArray_FROMANY(pdx, PyArray_DOUBLE, 1,
+ dx = (PyArrayObject *)PyArray_FROMANY(pdx, NPY_DOUBLE, 1,
1, NPY_IN_ARRAY);
if (!dx)
{
@@ -130,7 +130,7 @@ static PyObject *distance_method(PyObject *self, PyObject *args)
return NULL;
}
- flag = (PyArrayObject *)PyArray_FROMANY(pflag, PyArray_LONG, 1,
+ flag = (PyArrayObject *)PyArray_FROMANY(pflag, NPY_LONG, 1,
10, NPY_IN_ARRAY);
if (!flag)
{
@@ -144,7 +144,7 @@ static PyObject *distance_method(PyObject *self, PyObject *args)
if (mode == TRAVEL_TIME || mode == EXTENSION_VELOCITY)
{
{
- speed = (PyArrayObject *)PyArray_FROMANY(pspeed, PyArray_DOUBLE, 1,
+ speed = (PyArrayObject *)PyArray_FROMANY(pspeed, NPY_DOUBLE, 1,
10, NPY_IN_ARRAY);
if (!speed)
{
@@ -213,16 +213,16 @@ static PyObject *distance_method(PyObject *self, PyObject *args)
// make a new array for the return value
distance = (PyArrayObject *)PyArray_ZEROS(PyArray_NDIM(phi),
- shape2, PyArray_DOUBLE, 0);
+ shape2, NPY_DOUBLE, 0);
if (! distance) return NULL;
if (mode == EXTENSION_VELOCITY)
{
f_ext = (PyArrayObject *)PyArray_ZEROS(PyArray_NDIM(phi),
- shape2, PyArray_DOUBLE, 0);
+ shape2, NPY_DOUBLE, 0);
if (! f_ext) return NULL;
- ext_mask = (PyArrayObject *)PyArray_FROMANY(pext_mask, PyArray_LONG, 1,
+ ext_mask = (PyArrayObject *)PyArray_FROMANY(pext_mask, NPY_LONG, 1,
10, NPY_IN_ARRAY);
if (! ext_mask)
{
from scikit-fmm.
OK, this patch also works in the current code with the 1.x versions of numpy. I added you to the contributors.txt, I should have acknowledged you in the commit message, but forgot.
from scikit-fmm.
Thanks
from scikit-fmm.
Related Issues (20)
- GIL is held while marching HOT 3
- Pip install broken on CIs HOT 4
- about cfmm HOT 1
- ValueError: the array phi contains no zero contour (no zero level set) HOT 1
- cannot import skfmm due to arm64 incompatibility? HOT 1
- Support for python 3.11 HOT 2
- Installation went well, but unable to import HOT 2
- Marching issue in a skeleton HOT 2
- numpy.distutils is no longer available in Python 3.12 HOT 26
- Inaccurate travel paths HOT 2
- Add a less formal introduction of FMM and what it can be used for in the README HOT 1
- error: Multiple top-level packages discovered in a flat-layout: ['skfmm', 'profile']. HOT 5
- Negative curvature of signed distance HOT 9
- a relevant way to cite scikit-fmm
- [Enhancement] Release GIL HOT 3
- Exact representation of contour HOT 13
- pip instal scikit-fmm error HOT 1
- DEPENDENCY - Update code to use numpy 2.0 HOT 1
- Provide Wheels for scikit-fmm HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scikit-fmm.