def test_average_flowgrams(self): """_average_flowgrams computes an averaged flowgram for each cluster.""" fc = FlowgramCollection({"a": "1.0 0.0 0.0 1.0 1.0 1.2 1.2 0.8", "b": "1.2 1.0 0.0 0.8 1.2 2.4 1.0 0.0"}) # return the centroid unmodified if sample_mapping = 1 actual = list(_average_flowgrams({"a": "b"}, fc, {"a": ["a"]})) self.assertEqual(actual, [(fc.getFlow("a"), "a")]) actual = list(_average_flowgrams({"a": "b"}, fc, {"a": ["a", "b"]})) self.assertEqual(actual, [(Flowgram(["1.1 0.5 0.0 0.9 1.1 1.8 1.1 0.4"]), "a")])
def test_average_flowgrams(self): """_average_flowgrams computes an averaged flowgram for each cluster.""" fc = FlowgramCollection({'a':'1.0 0.0 0.0 1.0 1.0 1.2 1.2 0.8', 'b':'1.2 1.0 0.0 0.8 1.2 2.4 1.0 0.0'}) #return the centroid unmodified if sample_mapping = 1 actual = list(_average_flowgrams({'a':'b'}, fc, {'a':['a']})) self.assertEqual(actual , [(fc.getFlow('a'), 'a')]) actual = list(_average_flowgrams({'a':'b'}, fc, {'a':['a','b']})) self.assertEqual(actual , [(Flowgram(['1.1 0.5 0.0 0.9 1.1 1.8 1.1 0.4']), 'a')])
def test_average_flowgrams(self): """_average_flowgrams computes an averaged flowgram for each cluster.""" fc = FlowgramCollection({'a': '1.0 0.0 0.0 1.0 1.0 1.2 1.2 0.8', 'b': '1.2 1.0 0.0 0.8 1.2 2.4 1.0 0.0'}) # return the centroid unmodified if sample_mapping = 1 actual = list(_average_flowgrams({'a': 'b'}, fc, {'a': ['a']})) self.assertEqual(actual, [(fc.getFlow('a'), 'a')]) actual = list(_average_flowgrams({'a': 'b'}, fc, {'a': ['a', 'b']})) self.assertEqual( actual, [(Flowgram(['1.1 0.5 0.0 0.9 1.1 1.8 1.1 0.4']), 'a')])