You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In attempting to add a new function, callable from Python, similar to electron_count, the function gives a segmentation fault on returning an ElectronCountedData object if no py::array_t objects are included as parameters to that function. However, if one or more py::array_t arrays are given as parameters, it seems to work without problems.
For some reason (which could be machine-dependent, as this has only been tested on one machine), the method that takes the array as a parameter does not produce any problems, but the one without any array parameters gives a segmentation fault, which appears to occur on line 28 of https://github.com/OpenChemistry/stempy/blob/master/python/image.cpp:
In attempting to add a new function, callable from Python, similar to
electron_count
, the function gives a segmentation fault on returning anElectronCountedData
object if nopy::array_t
objects are included as parameters to that function. However, if one or morepy::array_t
arrays are given as parameters, it seems to work without problems.The addition of the function follows the general methodology used in: https://github.com/OpenChemistry/stempy/blob/master/python/image.cpp
A simple example is given here: https://github.com/jerenner/stempy/tree/example
(diff is here: jerenner@60ae390)
The example runs the following code:
using 2 different methods, one which takes a
py::array_t
and the other that does not.ElectronCountedData testMethodBasic(int test)
ElectronCountedData testMethodArray(int test, const float test_arr[])
A Jupyter notebook showing the functions run in Python is here: https://github.com/jerenner/4dstem/blob/main/pybind_test.ipynb
For some reason (which could be machine-dependent, as this has only been tested on one machine), the method that takes the array as a parameter does not produce any problems, but the one without any array parameters gives a segmentation fault, which appears to occur on line 28 of https://github.com/OpenChemistry/stempy/blob/master/python/image.cpp:
The text was updated successfully, but these errors were encountered: