class_docstr: This is the modified version of :func:`~nnAudio.Spectrogram.Combined_Frequency_Periodicity`. This version different from the original version by returnning only ``Z`` and the number of timesteps fits with other classes.
  
  Parameters
  ----------
  fr : int
      Frequency resolution. The higher the number, the lower the resolution is.
      Maximum frequency resolution occurs when ``fr=1``. The default value is ``2``
  
  fs : int
      Sample rate of the input audio clips. The default value is ``16000``
  
  hop_length : int
      The hop (or stride) size. The default value is ``320``.
  
  window_size : str
      It is same as ``n_fft`` in other Spectrogram classes. The default value is ``2049``
  
  fc : int
      Starting frequency. For example, ``fc=80`` means that `Z` starts at 80Hz.
      The default value is ``80``.
  
  tc : int
      Inverse of ending frequency. For example ``tc=1/8000`` means that `Z` ends at 8000Hz.
      The default value is ``1/8000``.
  
  g: list
      Coefficients for non-linear activation function. ``len(g)`` should be the number of activation layers.
      Each element in ``g`` is the activation coefficient, for example ``[0.24, 0.6, 1]``.
  
  device : str
      Choose which device to initialize this layer. Default value is 'cpu'
  
  Returns
  -------
  Z : torch.tensor
      The Combined Frequency and Period Feature. It is equivalent to ``tfrLF * tfrLQ``
  
  tfrL0: torch.tensor
      STFT output
  
  tfrLF: torch.tensor
      Frequency Feature
  
  tfrLQ: torch.tensor
      Period Feature
  
  Examples
  --------
  >>> spec_layer = Spectrogram.Combined_Frequency_Periodicity()
  >>> Z, tfrL0, tfrLF, tfrLQ = spec_layer(x)
class_docstr_tok: ["This","is","the","modified","version","of",":","func",":","`","~nnAudio.Spectrogram.Combined_Frequency_Periodicity","`",".","This","version","different","from","the","original","version","by","returnning","only","``","Z","``","and","the","number","of","timesteps","fits","with","other","classes",".","Parameters","--","--","--","--","--","fr",":","int","Frequency","resolution",".","The","higher","the","number",",","the","lower","the","resolution","is",".","Maximum","frequency","resolution","occurs","when","``","fr=1","``",".","The","default","value","is","``","2","``","fs",":","int","Sample","rate","of","the","input","audio","clips",".","The","default","value","is","``","16000","``","hop_length",":","int","The","hop","(","or","stride",")","size",".","The","default","value","is","``","320","``",".","window_size",":","str","It","is","same","as","``","n_fft","``","in","other","Spectrogram","classes",".","The","default","value","is","``","2049","``","fc",":","int","Starting","frequency",".","For","example",",","``","fc=80","``","means","that","`","Z","`","starts","at","80Hz",".","The","default","value","is","``","80","``",".","tc",":","int","Inverse","of","ending","frequency",".","For","example","``","tc=1\/8000","``","means","that","`","Z","`","ends","at","8000Hz",".","The","default","value","is","``","1\/8000","``",".","g",":","list","Coefficients","for","non-linear","activation","function",".","``","len","(","g",")","``","should","be","the","number","of","activation","layers",".","Each","element","in","``","g","``","is","the","activation","coefficient",",","for","example","``","[","0.24",",","0.6",",","1","]","``",".","device",":","str","Choose","which","device","to","initialize","this","layer",".","Default","value","is","'cpu'","Returns","--","--","--","-","Z",":","torch.tensor","The","Combined","Frequency","and","Period","Feature",".","It","is","equivalent","to","``","tfrLF","*","tfrLQ","``","tfrL0",":","torch.tensor","STFT","output","tfrLF",":","torch.tensor","Frequency","Feature","tfrLQ",":","torch.tensor","Period","Feature","Examples","--","--","--","--",">",">",">","spec_layer","=","Spectrogram.Combined_Frequency_Periodicity","(",")",">",">",">","Z",",","tfrL0",",","tfrLF",",","tfrLQ","=","spec_layer","(","x",")"]
code: def create_logfreq_matrix(self, f, q, fr, fc, tc, NumPerOct, fs):
      StartFreq = fc
      StopFreq = 1 / tc
      Nest = int(np.ceil(np.log2(StopFreq / StartFreq)) * NumPerOct)
      central_freq = []  # A list holding the frequencies in log scale
  
      for i in range(0, Nest):
          CenFreq = StartFreq * pow(2, float(i) / NumPerOct)
          if CenFreq < StopFreq:
              central_freq.append(CenFreq)
          else:
              break
  
      Nest = len(central_freq)
      freq_band_transformation = np.zeros(
          (Nest - 1, len(f)), dtype=np.double
      )
  
      # Calculating the freq_band_transformation
      for i in range(1, Nest - 1):
          l = int(round(central_freq[i - 1] / fr))
          r = int(round(central_freq[i + 1] / fr) + 1)
          # rounding1
          if l >= r - 1:
              freq_band_transformation[i, l] = 1
          else:
              for j in range(l, r):
                  if (
                      f[j] > central_freq[i - 1]
                      and f[j] < central_freq[i]
                  ):
                      freq_band_transformation[i, j] = (
                          f[j] - central_freq[i - 1]
                      ) / (central_freq[i] - central_freq[i - 1])
                  elif (
                      f[j] > central_freq[i]
                      and f[j] < central_freq[i + 1]
                  ):
                      freq_band_transformation[i, j] = (
                          central_freq[i + 1] - f[j]
                      ) / (central_freq[i + 1] - central_freq[i])
  
      # Calculating the quef_band_transformation
      f = 1 / q  # divide by 0, do I need to fix this?
      quef_band_transformation = np.zeros(
          (Nest - 1, len(f)), dtype=np.double
      )
      for i in range(1, Nest - 1):
          for j in range(
              int(round(fs / central_freq[i + 1])),
              int(round(fs / central_freq[i - 1]) + 1),
          ):
              if f[j] > central_freq[i - 1] and f[j] < central_freq[i]:
                  quef_band_transformation[i, j] = (
                      f[j] - central_freq[i - 1]
                  ) / (central_freq[i] - central_freq[i - 1])
              elif (
                  f[j] > central_freq[i] and f[j] < central_freq[i + 1]
              ):
                  quef_band_transformation[i, j] = (
                      central_freq[i + 1] - f[j]
                  ) / (central_freq[i + 1] - central_freq[i])
  
      return freq_band_transformation, quef_band_transformation
  
file_path: nnAudio/Installation/nnAudio/features/cfp.py
imports: import numpy
  import torch
  import torch.nn
  import time
  from ..utils import *
  import scipy
label_desc: Use image node_id 5 for calling the CFP obj's underlying member method code with example usage: obj.create_logfreq_matrix(f, q, fr, fc, tc, NumPerOct, fs) and returns: freq_band_transformation,  quef_band_transformation