|
3 | 3 | from diffpy.snmf.containers import ComponentSignal
|
4 | 4 | from diffpy.snmf.subroutines import objective_function, get_stretched_component, reconstruct_data, get_residual_matrix, \
|
5 | 5 | update_weights_matrix, initialize_arrays, lift_data, initialize_components, construct_stretching_matrix, \
|
6 |
| - construct_component_matrix, construct_weight_matrix, update_weights |
| 6 | + construct_component_matrix, construct_weight_matrix, update_weights, reconstruct_signal |
7 | 7 |
|
8 | 8 | to = [
|
9 | 9 | ([[[1, 2], [3, 4]], [[5, 6], [7, 8]], 1e11, [[1, 2], [3, 4]], [[1, 2], [3, 4]], 1], 2.574e14),
|
@@ -252,3 +252,17 @@ def test_construct_weight_matrix(tcwm):
|
252 | 252 | def test_update_weights(tuw):
|
253 | 253 | actual = update_weights(tuw[0], tuw[1], tuw[2])
|
254 | 254 | assert np.shape(actual) == (len(tuw[0]), len(tuw[0][0].weights))
|
| 255 | + |
| 256 | +trs = [([ComponentSignal([0, .25, .5, .75, 1], 2, 0), ComponentSignal([0, .25, .5, .75, 1], 2, 1), |
| 257 | + ComponentSignal([0, .25, .5, .75, 1], 2, 2)], 1), |
| 258 | + ([ComponentSignal([0, .25, .5, .75, 1], 2, 0), ComponentSignal([0, .25, .5, .75, 1], 2, 1), |
| 259 | + ComponentSignal([0, .25, .5, .75, 1], 2, 2)], 0), |
| 260 | + ([ComponentSignal([0, .25, .5, .75, 1], 3, 0), ComponentSignal([0, .25, .5, .75, 1], 3, 1), |
| 261 | + ComponentSignal([0, .25, .5, .75, 1], 3, 2)], 2), |
| 262 | + # ([ComponentSignal([0, .25, .5, .75, 1], 2, 0), ComponentSignal([0, .25, .5, .75, 1], 2, 1), |
| 263 | + # ComponentSignal([0, .25, .5, .75, 1], 2, 2)], -1), |
| 264 | +] |
| 265 | +@pytest.mark.parametrize('trs',trs) |
| 266 | +def test_reconstruct_signal(trs): |
| 267 | + actual = reconstruct_signal(trs[0], trs[1]) |
| 268 | + assert len(actual) == len(trs[0][0].grid) |
0 commit comments