Commit 1097bff3 authored by Marco Selig's avatar Marco Selig

major bugfix in nifty_explicit; several minor improvements.

parent d4d18b1c
This diff is collapsed.
This diff is collapsed.
......@@ -210,16 +210,16 @@ def smooth_power(spec,domain=None,kindex=None,mode="2s",exclude=1,sigma=-1,**kwa
## check power spectrum
if(isinstance(spec,field)):
spec = spec.val.astype(kindex.dtype)
spec = spec.val
elif(callable(spec)):
try:
spec = np.array(spec(kindex),dtype=kindex.dtype)
spec = np.array(spec(kindex),dtype=None)
except:
TypeError(about._errors.cstring("ERROR: invalid power spectra function.")) ## exception in ``spec(kindex)``
elif(np.isscalar(spec)):
spec = np.array([spec],dtype=kindex.dtype)
spec = np.array([spec],dtype=None)
else:
spec = np.array(spec,dtype=kindex.dtype)
spec = np.array(spec,dtype=None)
## drop imaginary part
spec = np.real(spec)
## check finiteness and positivity (excluding null)
......@@ -663,13 +663,13 @@ def interpolate_power(spec,mode="linear",domain=None,kindex=None,newkindex=None,
spec = spec.val.astype(kindex.dtype)
elif(callable(spec)):
try:
spec = np.array(spec(kindex),dtype=kindex.dtype)
spec = np.array(spec(kindex),dtype=None)
except:
TypeError(about._errors.cstring("ERROR: invalid power spectra function.")) ## exception in ``spec(kindex)``
elif(np.isscalar(spec)):
spec = np.array([spec],dtype=kindex.dtype)
spec = np.array([spec],dtype=None)
else:
spec = np.array(spec,dtype=kindex.dtype)
spec = np.array(spec,dtype=None)
## drop imaginary part
spec = np.real(spec)
## check finiteness and positivity (excluding null)
......
Markdown is supported
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