In [ ]:
""" setup """
import numpy as np
from pyhacores.dc_removal.model import DCRemoval
import matplotlib.pyplot as plt
plt.style.use(['classic'])
from redbaron import redbaron
redbaron.ipython_behavior = False
from pyha.simulation.simulation_interface import assert_sim_match
In [ ]:
""" ramp """
from pyha.simulation.simulation_interface import plot_assert_sim_match
l = list(range(-32, 32)) + list(range(32, -32, -1))
input = np.array(l) / 100
model = DCRemoval(4, 2)
ref = model.model_main(input)
plt.plot(input, label='input')
plt.plot(ref, label='output')
plt.legend()
plt.show()
assert_sim_match(model, ref, input)
In [6]:
""" harmonic """
input = np.sin(2 * np.pi * np.linspace(0, 40, 1024)) * 0.5
input[300:500] = input[300:500] + 0.25
input[600:900] = input[600:900] - 0.25
model = DCRemoval(128, 2)
ref = model.model_main(input)
plt.plot(input, label='input')
plt.plot(ref, label='output')
plt.legend()
plt.show()
assert_sim_match(model, ref, input)
In [ ]: