Skip to content

Commit 50ea324

Browse files
committed
removed transpose. removed/correct tests
1 parent bc3556f commit 50ea324

File tree

2 files changed

+7
-25
lines changed

2 files changed

+7
-25
lines changed

diffpy/snmf/subroutines.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def construct_component_matrix(components):
108108
component_matrix = np.zeros((number_of_components, signal_length))
109109
for i, component in enumerate(components):
110110
component_matrix[i] = component.iq
111-
return component_matrix.T
111+
return component_matrix
112112

113113

114114
def initialize_arrays(number_of_components, number_of_moments, signal_length):

diffpy/snmf/tests/test_subroutines.py

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -187,40 +187,22 @@ def test_construct_stretching_matrix(tcso):
187187
np.testing.assert_allclose(actual[component.id,:], component.stretching_factors)
188188
#assert actual[component.id, :] == component.stretching_factors
189189

190-
tccm = [ # (ComponentSignal([0,.25,.5,.75,1],20,0),1,5), # Expected to fail
190+
tccm = [
191191
([ComponentSignal([0,.25,.5,.75,1],20,0)]),
192-
# ([ComponentSignal([0,.25,.5,.75,1],20,2)],1,5), # Expected to fail
193-
# ([ComponentSignal([0,.25,.5,.75,1],20,0)],1,2), # Expected to fail
194-
# ([ComponentSignal([0,.25,.5,.75,1],20,0)],1,5.5), # Expected to fail
195-
# ([ComponentSignal([0,.25,.5,.75,1],20,0)],1,-5), # Expected to fail
196-
# ([ComponentSignal([0,.25,.5,.75,1],20,0)],1,0), # Expected to fail
197-
# ([ComponentSignal([0,.25,.5,.75,1],20,0)],1,'bad'), # Expected to fail
198-
# ([ComponentSignal([0,.25,.5,.75,1],20,0)],1,[]), Expected to fail
199-
# ([ComponentSignal([0,.25,.5,.75,1],20,0)],1.2,5), # Expected to fail
200-
# ([ComponentSignal([0,.25,.5,.75,1],20,0)],0,5), # Expected to fail
201-
# ([ComponentSignal([0,.25,.5,.75,1],20,0)],-1,5), # Expected to fail
202-
# ([ComponentSignal([0,.25,.5,.75,1],20,0)],'bad',5), # Expected to fail
203-
# ([ComponentSignal([0,.25,.5,.75,1],20,0)],[],5), # Expected to fail
204-
# ([ComponentSignal([0,.25,.5,.75,1],-20,0)],1,5), # Expected to fail
205-
# ([ComponentSignal([0,.25,.5,.75,1],20.2,0)],1,5), # Expected to fail
206192
([ComponentSignal([0,.25,.5,.75,1],0,0)]),
207193
([ComponentSignal([0,.25,.5,.75,1],20,0),ComponentSignal([0,.25,.5,.75,1],20,1),ComponentSignal([0,.25,.5,.75,1],20,2)]),
208194
([ComponentSignal([0, .25, .5, .75, 1], 20, 0), ComponentSignal([0, .25, .5, .75, 1], 20, 1),
209195
ComponentSignal([0, .25, .5, .75, 1], 20, 2)]),
210196
([ComponentSignal([0, .25, .5, .75, 1], 20, 0), ComponentSignal([0, .25, .5, 2.75, 1], 20, 1),
211197
ComponentSignal([0, .25, .5, .75, 1], 20, 2)]),
212198
([ComponentSignal([.25], 20, 0), ComponentSignal([.25], 20, 1), ComponentSignal([.25], 20, 2)]),
213-
# ([ComponentSignal([0, .25, .5, .75, 1], 20, 0), ComponentSignal([0, .25, .5, .75, 1], 20, 1),
214-
# ComponentSignal([], 20, 2)], 1, 5), # Expected to fail
215-
# ([ComponentSignal([0, .25, .5, .75, 1], 2, 0), ComponentSignal([0, .25, .5, .75, 1], 4, 1),
216-
# ComponentSignal([0, .25, .5, .75, 1], 20, 2)], 1, 5), # Expected to fail
217-
# ([], 0, 5), Expected to fail
218-
# ([], 1, 5), Expected to fail
219-
# ([], -1, 5), # Expected to fail
220-
# ([], 0, 0), # Expected to fail
199+
([ComponentSignal([0, .25, .5, .75, 1], 20, 0), ComponentSignal([0, .25, .5, .75, 1], 20, 1)]),
200+
# ([ComponentSignal([[0, .25, .5, .75, 1],[0, .25, .5, .75, 1]], 20, 0), ComponentSignal([[0, .25, .5, .75, 1],[0, .25, .5, .75, 1]], 20, 1)]), # iq is multidimensional. Expected to fail
201+
# (ComponentSignal([], 20, 0)), # Expected to fail
202+
# ([]), #Expected to fail
221203
]
222204
@pytest.mark.parametrize('tccm',tccm)
223205
def test_construct_component_matrix(tccm):
224206
actual = construct_component_matrix(tccm)
225207
for component in tccm:
226-
np.testing.assert_allclose(actual[:,component.id], component.iq)
208+
np.testing.assert_allclose(actual[component.id], component.iq)

0 commit comments

Comments
 (0)