def test_modulate_simple_pi(): test_data = pd.DataFrame({ 'time (ms)': [0, 1, 2, 3, 4.0, 5, 6, 7], 'Val (V)': [0, 1, 0, -1.0, 0, 1, 0, -1], 'Sync': [0, 0, 1, 0, 0, 0, 1, 0] }) lia = LIA(test_data) actual_data = lia.modulate(test_data, 250 * ureg.Hz, sync_phase_delay=np.pi, window='boxcar') desired_data = pd.DataFrame({ 'time (ms)': np.array([0, 1.0, 2, 3, 4, 5, 6, 7]), 'Val (V)': np.sqrt(2) * np.array([0, 1.0, 0, 1, 0, 1, 0, 1]), 'Sync': np.array([0, 0, 1, 0, 0, 0, 1, 0]) }) assert_frame_equal(actual_data, desired_data)
def test_modulate_simple_zero_phase(): test_data = pd.DataFrame({ 'time (ms)': [0, 1, 2, 3, 4.0, 5, 6], 'Val (V)': [0, 1, 0, -1.0, 0, 1, 0], 'Sync': [1, 0, 0, 0, 1, 0, 0] }) lia = LIA(test_data) actual_data = lia.modulate(test_data, 250 * ureg.Hz, sync_phase_delay=0, window='boxcar') desired_data = pd.DataFrame({ 'time (ms)': np.array([0, 1.0, 2, 3, 4, 5, 6]), 'Val (V)': np.sqrt(2) / 0.857142857 * np.array([0, 0.9, 0, 1.2, 0, 0.9, 0]), 'Sync': np.array([1, 0, 0, 0, 1, 0, 0]) }) assert_frame_equal(actual_data, desired_data)