Ejemplo n.º 1
0
    def test_get_subsampled_orig_events(self):
        sample = Sample(data1_fcs_path,
                        cache_original_events=True,
                        subsample=500)

        events = sample.get_events(source='orig', subsample=True)

        self.assertEqual(events.shape[0], 500)
Ejemplo n.º 2
0
    def test_get_subsampled_raw_events(self):
        sample = Sample(data1_fcs_path, subsample=500)

        events = sample.get_events(source='raw', subsample=True)

        self.assertEqual(events.shape[0], 500)
Ejemplo n.º 3
0
"""
Unit tests for Transform sub-classes
"""
import unittest
import numpy as np
import warnings

from flowkit import Sample, transforms

data1_fcs_path = 'examples/data/gate_ref/data1.fcs'
data1_sample = Sample(data1_fcs_path)
data1_raw_events = data1_sample.get_events(source='raw')

test_data_range1 = np.linspace(0.0, 10.0, 101)


class TransformsTestCase(unittest.TestCase):
    """Tests for loading FCS files as Sample objects"""
    def test_transform_sample_linear(self):
        xform = transforms.LinearTransform('lin',
                                           param_t=data1_raw_events.max(),
                                           param_a=0.0)
        data1_sample.apply_transform(xform)

        xform_events = xform.apply(data1_raw_events)

        self.assertIsInstance(xform_events, np.ndarray)
        self.assertEqual(np.max(xform_events), 1.0)
        self.assertEqual(np.min(xform_events), 0.0)

    def test_transform_sample_linear_1d(self):