Closed ryohiguchi closed 9 months ago
Hi @ryohiguchi This is, as you have seen, a known problem. But to my knowledge nobody is currently working on it. In case you you find a fix we would be happy to include it.
It was successful when I change the numpy version==1.18.0 The problem seems to be that they are calling a deprecated numpy function PyArray_GetArrayParamsFromObject https://numpy.org/devdocs/release/1.19.0-notes.html#deprecation-of-probably-unused-c-api-functions
@ryohiguchi can you pleas check if #466 fixed this issue. Please reopen if the problem persists.
I have the same issue.
I checked new version and the problem still exists:
System Information:
Cmake version: 3.16.3
Problem disappears on NumPy version==1.18.0 as mentioned @ryohiguchi. Now time I am using conda virtual env with old version of NumPy.
I've checked difference of last pull request and code of python/4_lens.i was a little bit refactored but its logic is absolutely same.
I've made some tests. The segmentation fault happens on lens.transformModelVector(outputMap, rigidity * crpropa.EeV)
and I think that @ryohiguchi is right. Unfortunately, I don't understand SWIG NumPy API and can't help you today. I've tried removing this line and replacing double *dataPointer = (double*) PyArray_DATA(arr);
to simple double *dataPointer = (double*) PyArray_DATA((PyArrayObject *)arr);
. It raises another behavior: transformModelVector
doesn't crush, but object outputMap
will be broken and cannot be read from Python. I don't understand how these structures work.
I'm trying the same code as in the documentation page: https://crpropa.github.io/CRPropa3/pages/example_notebooks/galactic_lensing/lensing_maps.v4.html
The example code works until the plot of unlensed map, but transformModelVector command outputs: zsh: segmentation fault
The information of my current system is as follows:
I also read the similar issue (https://github.com/CRPropa/CRPropa3/issues/397) and tested changing some versions of python & swig and also CRPropa 3.1.7, but the results are same.