def test_new_average(): obj = Ta() obj.data = np.ones((5, 5)) obj.sweeps = [np.ones((5, 5)) * k for k in range(3)] obj.n_sweeps = len(obj.sweeps) obj.new_average([1, 1, 1]) assert obj.inc_sweeps == [1, 1, 1] assert list(obj.data.ravel()) == [1] * 25 obj.new_average([1, 1, 0]) assert obj.inc_sweeps == [1, 1, 0] assert list(obj.data.ravel()) == [0.5] * 25
def test_invert_sweeps(): obj = Ta() obj.sweeps = [np.ones((5, 5)) * k for k in range(3)] obj.n_sweeps = len(obj.sweeps) obj.new_average([1, 1, 1]) obj.invert_sweeps([1, 1, 0]) assert list(obj.data.ravel()) == [1 / 3] * 25 obj.inc_sweeps = [1, 0, 1] obj.invert_sweeps([1, 1, 0]) assert list(obj.data.ravel()) == [1] * 25 obj.invert_sweeps([1, 1, 1]) assert list(obj.data.ravel()) == [-1] * 25