code: def fdfilter(data, *filt, **kwargs):
      
      # parse keyword args
      inplace = kwargs.pop('inplace', False)
      analog = kwargs.pop('analog', False)
      fs = kwargs.pop('sample_rate', None)
      if kwargs:
          raise TypeError("filter() got an unexpected keyword argument '%s'"
                          % list(kwargs.keys())[0])
  
      # parse filter
      if fs is None:
          fs = 2 * (data.shape[-1] * data.df).to('Hz').value
      form, filt = parse_filter(filt, analog=analog, sample_rate=fs)
      lti = signal.lti(*filt)
  
      # generate frequency response
      freqs = data.frequencies.value.copy()
      fresp = numpy.nan_to_num(abs(lti.freqresp(w=freqs)[1]))
  
      # apply to array
      if inplace:
          data *= fresp
          return data
      new = data * fresp
      return new
docs: Filter a frequency-domain data object
  
      See Also
      --------
      gwpy.frequencyseries.FrequencySeries.filter
      gwpy.spectrogram.Spectrogram.filter