class_docstr: fft tools for arma processes
  
  This class contains several methods that are providing the same or similar
  returns to try out and test different implementations.
  
  Notes
  -----
  TODO:
  check whether we do not want to fix maxlags, and create new instance if
  maxlag changes. usage for different lengths of timeseries ?
  or fix frequency and length for fft
  
  check default frequencies w, terminology norw  n_or_w
  
  some ffts are currently done without padding with zeros
  
  returns for spectral density methods needs checking, is it always the power
  spectrum hw*hw.conj()
  
  normalization of the power spectrum, spectral density: not checked yet, for
  example no variance of underlying process is used
class_docstr_tok: ["fft","tools","for","arma","processes","This","class","contains","several","methods","that","are","providing","the","same","or","similar","returns","to","try","out","and","test","different","implementations",".","Notes","--","--","-","TODO",":","check","whether","we","do","not","want","to","fix","maxlags",",","and","create","new","instance","if","maxlag","changes",".","usage","for","different","lengths","of","timeseries","?","or","fix","frequency","and","length","for","fft","check","default","frequencies","w",",","terminology","norw","n_or_w","some","ffts","are","currently","done","without","padding","with","zeros","returns","for","spectral","density","methods","needs","checking",",","is","it","always","the","power","spectrum","hw","*","hw.conj","(",")","normalization","of","the","power","spectrum",",","spectral","density",":","not","checked","yet",",","for","example","no","variance","of","underlying","process","is","used"]
docstr: autocovariance from spectral density
  
  scaling is correct, but n needs to be large for numerical accuracy
  maybe padding with zero in fft would be faster
  without slicing it returns 2-sided autocovariance with fftshift
  
  >>> ArmaFft([1, -0.5], [1., 0.4], 40).invpowerspd(2**8)[:10]
  array([ 2.08    ,  1.44    ,  0.72    ,  0.36    ,  0.18    ,  0.09    ,
          0.045   ,  0.0225  ,  0.01125 ,  0.005625])
  >>> ArmaFft([1, -0.5], [1., 0.4], 40).acovf(10)
  array([ 2.08    ,  1.44    ,  0.72    ,  0.36    ,  0.18    ,  0.09    ,
          0.045   ,  0.0225  ,  0.01125 ,  0.005625])
docstr_tok: ["autocovariance","from","spectral","density","scaling","is","correct",",","but","n","needs","to","be","large","for","numerical","accuracy","maybe","padding","with","zero","in","fft","would","be","faster","without","slicing","it","returns","2-sided","autocovariance","with","fftshift",">",">",">","ArmaFft","(","[","1",",","-0.5","]",",","[","1.",",","0.4","]",",","40",")",".invpowerspd","(","2","*","*","8",")","[",":10","]","array","(","[","2.08",",","1.44",",","0.72",",","0.36",",","0.18",",","0.09",",","0.045",",","0.0225",",","0.01125",",","0.005625","]",")",">",">",">","ArmaFft","(","[","1",",","-0.5","]",",","[","1.",",","0.4","]",",","40",")",".acovf","(","10",")","array","(","[","2.08",",","1.44",",","0.72",",","0.36",",","0.18",",","0.09",",","0.045",",","0.0225",",","0.01125",",","0.005625","]",")"]
code: def invpowerspd(self, n):
      """autocovariance from spectral density
  
      scaling is correct, but n needs to be large for numerical accuracy
      maybe padding with zero in fft would be faster
      without slicing it returns 2-sided autocovariance with fftshift
  
      >>> ArmaFft([1, -0.5], [1., 0.4], 40).invpowerspd(2**8)[:10]
      array([ 2.08    ,  1.44    ,  0.72    ,  0.36    ,  0.18    ,  0.09    ,
              0.045   ,  0.0225  ,  0.01125 ,  0.005625])
      >>> ArmaFft([1, -0.5], [1., 0.4], 40).acovf(10)
      array([ 2.08    ,  1.44    ,  0.72    ,  0.36    ,  0.18    ,  0.09    ,
              0.045   ,  0.0225  ,  0.01125 ,  0.005625])
      """
      hw = self.fftarma(n)
      return np.real_if_close(fft.ifft(hw * hw.conj()), tol=200)[:n]
  
imports: import numpy
  import numpy.fft
  from scipy import signal
  from statsmodels.tsa.arima_process import ArmaProcess
label_desc: Use image node_id 17 for calling the ArmaFft obj's underlying member method code with example usage: obj.invpowerspd(n) and returns: np