Exemple #1
0
 def test_add_population(self):
     test = ChildPopulationCollection(gate_type='threshold_1d')
     test.add_population('pos', definition='+')
     test.add_population('neg', definition='-')
     self.assertListEqual(['pos', 'neg'], list(test.populations.keys()))
     self.assertEqual(test.populations.get('pos').properties.get('definition'), '+')
     self.assertEqual(test.populations.get('neg').properties.get('definition'), '-')
Exemple #2
0
 def test_serialise(self):
     test = ChildPopulationCollection(gate_type='threshold_1d')
     test.add_population('pos', definition='+')
     test.add_population('neg', definition='-')
     test = test.serialise()
     self.assertDictEqual(test, dict(gate_type='threshold_1d',
                                     populations=[dict(name='pos', definition='+'),
                                                  dict(name='neg', definition='-')]))
Exemple #3
0
 def test_create_from_dict(self):
     test = dict(gate_type='threshold_1d', populations=[dict(name='pos', definition='+'),
                                                        dict(name='neg', definition='-')])
     test = ChildPopulationCollection(json_dict=test)
     self.assertListEqual(['pos', 'neg'], list(test.populations.keys()))
     self.assertEqual(test.populations.get('pos').properties.get('definition'), '+')
     self.assertEqual(test.populations.get('neg').properties.get('definition'), '-')
    def _build(return_data: bool = False, blobs=3, **kwargs):
        example_data = make_example_date(n_samples=1000, centers=blobs)
        example_data['labels'] = example_data['blobID']

        populations = ChildPopulationCollection(gate_type='geom')
        populations.add_population('positive', definition='+')
        populations.add_population('negative', definition='-')

        gate = mixturemodel.MixtureModel(data=example_data,
                                         child_populations=populations,
                                         x='feature0',
                                         y='feature1',
                                         transform_x=None,
                                         transform_y=None,
                                         **kwargs)
        if return_data:
            return gate, example_data
        return gate
Exemple #5
0
 def test_fetch_by_def(self):
     test2d = ChildPopulationCollection(gate_type='threshold_2d')
     test2d.add_population('pospos', definition='++')
     test2d.add_population('other', definition=['--', '-+', '+-'])
     self.assertEqual(test2d.fetch_by_definition('++'), 'pospos')
     self.assertEqual(test2d.fetch_by_definition('--'), 'other')
Exemple #6
0
 def test_remove_population(self):
     test = ChildPopulationCollection(gate_type='threshold_1d')
     test.add_population('pos', definition='+')
     test.add_population('neg', definition='-')
     test.remove_population('pos')
     self.assertListEqual(['neg'], list(test.populations.keys()))
Exemple #7
0
 def test_create(self):
     test = ChildPopulationCollection(gate_type='threshold_1d')
     self.assertEqual(test.gate_type, 'threshold_1d')