15 #ifdef BORNAGAIN_PYTHON
23 npy_int ndim_numpy = ndim;
24 npy_intp* ndimsizes_numpy =
new npy_intp[ndim];
25 ndimsizes_numpy[0] = data.size();
28 PyObject* pyarray = PyArray_SimpleNew(ndim_numpy, ndimsizes_numpy, NPY_DOUBLE);
29 delete[] ndimsizes_numpy;
30 if (pyarray ==
nullptr)
34 double* array_buffer = (
double*)PyArray_DATA((PyArrayObject*)pyarray);
36 for (
size_t index = 0; index < data.size(); ++index)
37 *array_buffer++ = data[index];
Defines various functions to interact from numpy on Python side.
Includes python header and takes care of warnings.
PyObject * createNumpyArray(const std::vector< double > &data)