示例#1
0
    def test_filter_negative_scatter(self):
        # there are 2 negative SSC-A events in this file (of 65016 total events)
        fcs_file_path = "examples/data/100715.fcs"
        sample = Sample(fcs_path_or_data=fcs_file_path, subsample=50000)
        sample.filter_negative_scatter(reapply_subsample=False)

        # using the default seed, the 2 negative events are in the subsample
        common_idx = np.intersect1d(sample.subsample_indices,
                                    sample.negative_scatter_indices)
        self.assertEqual(len(common_idx), 2)

        sample.filter_negative_scatter(reapply_subsample=True)
        common_idx = np.intersect1d(sample.subsample_indices,
                                    sample.negative_scatter_indices)
        self.assertEqual(len(common_idx), 0)

        self.assertEqual(sample.negative_scatter_indices.shape[0], 2)
示例#2
0
    def test_export_exclude_negative_scatter(self):
        # there are 2 negative SSC-A events in this file (of 65016 total events)
        fcs_file_path = "examples/data/100715.fcs"
        sample = Sample(fcs_path_or_data=fcs_file_path)
        sample.filter_negative_scatter()

        neg_scatter_count = len(sample.negative_scatter_indices)

        exported_fcs_file = "examples/test_fcs_export.fcs"
        sample.export(exported_fcs_file,
                      source='raw',
                      exclude_neg_scatter=True)
        exported_sample = Sample(exported_fcs_file)
        os.unlink(exported_fcs_file)

        orig_event_count = sample.event_count
        exp_event_count = exported_sample.event_count

        self.assertEqual(exp_event_count, orig_event_count - neg_scatter_count)