code: def spkt_welch_density(x, param):
      
  
      freq, pxx = welch(x, nperseg=min(len(x), 256))
      coeff = [config["coeff"] for config in param]
      indices = ["coeff_{}".format(i) for i in coeff]
  
      if len(pxx) <= np.max(coeff):  # There are fewer data points in the time series than requested coefficients
  
          # filter coefficients that are not contained in pxx
          reduced_coeff = [coefficient for coefficient in coeff if len(pxx) > coefficient]
          not_calculated_coefficients = [coefficient for coefficient in coeff
                                         if coefficient not in reduced_coeff]
  
          # Fill up the rest of the requested coefficients with np.NaNs
          return zip(indices, list(pxx[reduced_coeff]) + [np.NaN] * len(not_calculated_coefficients))
      else:
          return zip(indices, pxx[coeff])
docs: This feature calculator estimates the cross power spectral density of the time series x at different frequencies.
      To do so, the time series is first shifted from the time domain to the frequency domain.
  
      The feature calculators returns the power spectrum of the different frequencies.
  
      :param x: the time series to calculate the feature of
      :type x: numpy.ndarray
      :param param: contains dictionaries {"coeff": x} with x int
      :type param: list
      :return: the different feature values
      :return type: pandas.Series