def add_filter(self, filter_, frequencies=None, dB=True,<EOL>analog=False, sample_rate=None, **kwargs):
if not analog:<EOL><INDENT>if not sample_rate:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>sample_rate = Quantity(sample_rate, '<STR_LIT>').value<EOL>dt = <NUM_LIT:2> * pi / sample_rate<EOL>if not isinstance(frequencies, (type(None), int)):<EOL><INDENT>frequencies = numpy.atleast_1d(frequencies).copy()<EOL>frequencies *= dt<EOL><DEDENT><DEDENT>_, fcomp = parse_filter(filter_, analog=False)<EOL>if analog:<EOL><INDENT>lti = signal.lti(*fcomp)<EOL><DEDENT>else:<EOL><INDENT>lti = signal.dlti(*fcomp, dt=dt)<EOL><DEDENT>w, mag, phase = lti.bode(w=frequencies)<EOL>if not dB:<EOL><INDENT>mag = <NUM_LIT:10> ** (mag / <NUM_LIT>)<EOL><DEDENT>mline = self.maxes.plot(w, mag, **kwargs)[<NUM_LIT:0>]<EOL>pline = self.paxes.plot(w, phase, **kwargs)[<NUM_LIT:0>]<EOL>return mline, pline<EOL>
Add a linear time-invariant filter to this BodePlot

        Parameters
        ----------
        filter_ : `~scipy.signal.lti`, `tuple`
            the filter to plot, either as a `~scipy.signal.lti`, or a
            `tuple` with the following number and meaning of elements

                 - 2: (numerator, denominator)
                 - 3: (zeros, poles, gain)
                 - 4: (A, B, C, D)

        frequencies : `numpy.ndarray`, optional
            list of frequencies (in Hertz) at which to plot

        dB : `bool`, optional
            if `True`, display magnitude in decibels, otherwise display
            amplitude, default: `True`

        **kwargs
            any other keyword arguments accepted by
            :meth:`~matplotlib.axes.Axes.plot`

        Returns
        -------
        mag, phase : `tuple` of `lines <matplotlib.lines.Line2D>`
            the lines drawn for the magnitude and phase of the filter.