grrrr/nsgt

master branch; python 3.5+

Closed this issue · 3 comments

hi!

i had to change the lambda expressions in

symm = lambda fc: chain(fc, map(fftsymm,fc[::-1]))

symm = lambda fc: chain(fc,map(fftsymm,fc[-2:0:-1]))

diff --git a/nsgt/nsigtf.py b/nsgt/nsigtf.py
index d441514..259f313 100644
--- a/nsgt/nsigtf.py
+++ b/nsgt/nsigtf.py
@@ -88,10 +88,15 @@ def nsigtf_sl(cseq, gd, wins, nn, Ls=None, real=False, reducedform=0, measurefft
         fftsymm = lambda c: np.hstack((c[0],c[-1:0:-1])).conj()
         if reducedform:
             # no coefficients for f=0 and f=fs/2
-            symm = lambda fc: chain(fc, map(fftsymm,fc[::-1]))
+            def symm(_fc):
+                fc = list(_fc)
+                return chain(fc, map(fftsymm, fc[::-1]))
+
             sl = lambda x: chain(x[reducedform:len(gd)//2+1-reducedform],x[len(gd)//2+reducedform:len(gd)+1-reducedform])
         else:
-            symm = lambda fc: chain(fc,map(fftsymm,fc[-2:0:-1]))
+            def symm(_fc):
+                fc = list(_fc)
+                return chain(fc, map(fftsymm, fc[-2:0:-1]))
             sl = lambda x: x
     else:
         ln = len(gd)

to make the tests work, in the version that only relies on numpy, and nothing else.

cheers,
-r

Thank you! I made these changes and backward nsgt pass worked

grrrr commented

Hi @rainerkelz, thank you for your contribution. I took the liberty to include the changes into the master branch.

thank you!