def bilinear_zpk(zeros, poles, gain, fs=<NUM_LIT:1.0>, unit='<STR_LIT>'):
zeros = numpy.array(zeros, dtype=float, copy=False)<EOL>zeros = zeros[numpy.isfinite(zeros)]<EOL>poles = numpy.array(poles, dtype=float, copy=False)<EOL>gain = gain<EOL>unit = Unit(unit)<EOL>if unit == Unit('<STR_LIT>'):<EOL><INDENT>zeros *= -<NUM_LIT:2> * pi<EOL>poles *= -<NUM_LIT:2> * pi<EOL><DEDENT>elif unit != Unit('<STR_LIT>'):<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>fs = <NUM_LIT:2> * Quantity(fs, '<STR_LIT>').value<EOL>dpoles = (<NUM_LIT:1> + poles/fs) / (<NUM_LIT:1> - poles/fs)<EOL>dzeros = (<NUM_LIT:1> + zeros/fs) / (<NUM_LIT:1> - zeros/fs)<EOL>dzeros = numpy.concatenate((<EOL>dzeros, -numpy.ones(len(dpoles) - len(dzeros)),<EOL>))<EOL>dgain = gain * numpy.prod(fs - zeros)/numpy.prod(fs - poles)<EOL>return dzeros, dpoles, dgain<EOL>
Convert an analogue ZPK filter to digital using a bilinear transform

    Parameters
    ----------
    zeros : array-like
        list of zeros

    poles : array-like
        list of poles

    gain : `float`
        filter gain

    fs : `float`, `~astropy.units.Quantity`
        sampling rate at which to evaluate bilinear transform, default: 1.

    unit : `str`, `~astropy.units.Unit`
        unit of inputs, one or 'Hz' or 'rad/s', default: ``'Hz'``

    Returns
    -------
    zpk : `tuple`
        digital version of input zpk