Commit 14e272cc authored by Nathanael Schaeffer @lgit-1177's avatar Nathanael Schaeffer @lgit-1177
Browse files

fix in shtns_numpy.i: import_array() must be called from %init section.

parent 91696141
......@@ -53,7 +53,7 @@ CHANGE LOG:
- better python interface for rotations.
- performance improvement for OpenMP code without fftw3_omp.
- slightly faster SH_to_point() [5%] and SHqst_to_point() [20%].
- bugfix: in some rare cases, OpenMP code freed unallocate memory.
- bugfix: in some rare cases, OpenMP code freed unallocated memory.
- bugfix: fixed python interface compilation with clang.
v2.2.4 (25 Jun 2012)
- the previous critical bugfix had not been applied to parallel OpenMP transforms.
......
......@@ -24,6 +24,10 @@
%module (docstring="Python/NumPy interface to the SHTns spherical harmonic transform library") shtns
%init{
import_array(); // required by NumPy
}
%pythoncode{
import numpy as np
}
......@@ -149,7 +153,6 @@ inline PyObject* SpatArray_New(int size) {
if (mmax*mres > lmax) {
throw_exception(SWIG_ValueError,1,"lmax < mmax*mres invalid"); return NULL;
}
import_array(); // required by NumPy
shtns_use_threads(nthreads); // use nthreads openmp threads if available (0 means auto)
return shtns_create(lmax, mmax, mres, norm);
}
......
......@@ -3230,7 +3230,6 @@ SWIGINTERN struct shtns_info *new_shtns_info(int lmax,int mmax,int mres,int norm
if (mmax*mres > lmax) {
throw_exception(SWIG_ValueError,1,"lmax < mmax*mres invalid"); return NULL;
}
import_array(); // required by NumPy
shtns_use_threads(nthreads); // use nthreads openmp threads if available (0 means auto)
return shtns_create(lmax, mmax, mres, norm);
}
......@@ -5737,6 +5736,9 @@ SWIG_init(void) {
SWIG_InstallConstants(d,swig_const_table);
import_array(); // required by NumPy
SWIG_Python_SetConstant(d, "sht_orthonormal",SWIG_From_int((int)(sht_orthonormal)));
SWIG_Python_SetConstant(d, "sht_fourpi",SWIG_From_int((int)(sht_fourpi)));
SWIG_Python_SetConstant(d, "sht_schmidt",SWIG_From_int((int)(sht_schmidt)));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment