Skip to content

Commit d3f7774

Browse files
committed
changed behavior of lift_data to add abs(min(data_input) * lift). Changed expections of test cases to reflect changed bahvior
1 parent cd46874 commit d3f7774

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

diffpy/snmf/subroutines.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def lift_data(data_input, lift=1):
2525
2626
"""
2727
data_input = np.asarray(data_input)
28-
return data_input - (np.min(data_input) * lift)
28+
return data_input + np.abs(np.min(data_input) * lift)
2929

3030

3131
def initialize_arrays(number_of_components, number_of_moments, signal_length):

diffpy/snmf/tests/test_subroutines.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ def test_reconstruct_data(trd):
139139
tld = [(([[[1, -1, 1], [0, 0, 0], [2, 10, -3]], 1]), ([[4, 2, 4], [3, 3, 3], [5, 13, 0]])),
140140
(([[[1, -1, 1], [0, 0, 0], [2, 10, -3]], 0]), ([[1, -1, 1], [0, 0, 0], [2, 10, -3]])),
141141
(([[[1, -1, 1], [0, 0, 0], [2, 10, -3]], .5]), ([[2.5, .5, 2.5], [1.5, 1.5, 1.5], [3.5, 11.5, -1.5]])),
142-
(([[[1, -1, 1], [0, 0, 0], [2, 10, -3]], -1]), ([[-2, -4, -2], [-3, -3, -3], [-1, 7, -6]])),
142+
(([[[1, -1, 1], [0, 0, 0], [2, 10, -3]], -1]), ([[4, 2, 4], [3, 3, 3], [5, 13, 0]])),
143143
(([[[0, 0, 0], [0, 0, 0], [0, 0, 0]], 100]), ([[0, 0, 0], [0, 0, 0], [0, 0, 0]])),
144-
(([[[1.5, 2], [10.5, 1], [0.5, 2]], 1]), ([[1, 1.5], [10, .5], [0, 1.5]])),
144+
(([[[1.5, 2], [10.5, 1], [0.5, 2]], 1]), ([[2, 2.5], [11, 1.5], [1, 2.5]])),
145145
(([[[-10, -10.5], [-12.2, -12.2], [0, 0]], 1]), ([[2.2, 1.7], [0, 0], [12.2, 12.2]])),
146146
]
147147
@pytest.mark.parametrize('tld', tld)

0 commit comments

Comments
 (0)