import pyfar as pf
import numpy as np
from scipy.signal import remez
import matplotlib.pyplot as plt
freq = [0, 0.2, 0.3, 1.0]
desired = [1, 0]
h_linear = pf.Signal(remez(151, freq, desired, Hz=2.), 44100)
h_min_hom = pf.dsp.minimum_phase(h_linear, method='homomorphic')
h_min_hil = pf.dsp.minimum_phase(h_linear, method='hilbert')
fig, axs = plt.subplots(3, figsize=(8, 6))
for h, style in zip(
        (h_linear, h_min_hom, h_min_hil),
        ('-', '-.', '--')):
    pf.plot.time(h, linestyle=style, ax=axs[0])
    axs[0].grid(True)
    pf.plot.freq(h, linestyle=style, ax=axs[1])
    pf.plot.group_delay(h, linestyle=style, ax=axs[2])
axs[1].legend(['Linear', 'Homomorphic', 'Hilbert'])
