Example #1
0
    def base_logicle_test(self, original_file, transed_file):
        diff_threshold = 1.0
        fcs, fcs_trans = load_test_data(original_file, transed_file)
        compensate(fcs)
        # Currently applying logicle transform takes a lot of time, and
        # we want to run this script inside CircleCI without timeout.
        # So we put the processing into subprocess and periodically print
        # status.
        run_and_check(lambda: apply_logicle_transform(fcs, ), 300)

        channel_info = fcs.meta['_channels_']
        result = {}
        fail = False
        for channel in channel_info['$PnN']:
            if channel == 'Time':
                continue
            val0 = fcs[channel].values
            val1 = fcs_trans[channel].values
            denom = (val0 + val1) / 2 + 1
            numer = np.abs(val0 - val1)
            diff = 100 * np.mean(numer / denom)
            result[channel] = diff
            if diff > diff_threshold:
                fail = True
        _LG.info(result)
        self.assertTrue(not fail)
Example #2
0
    def base_logicle_test(self, original_file, transed_file):
        diff_threshold = 1.0
        fcs, fcs_trans = load_test_data(original_file, transed_file)
        compensate(fcs)
        # Currently applying logicle transform takes a lot of time, and
        # we want to run this script inside CircleCI without timeout.
        # So we put the processing into subprocess and periodically print
        # status.
        run_and_check(lambda: apply_logicle_transform(fcs,), 300)

        channel_info = fcs.meta['_channels_']
        result = {}
        fail = False
        for channel in channel_info['$PnN']:
            if channel == 'Time':
                continue
            val0 = fcs[channel].values
            val1 = fcs_trans[channel].values
            denom = (val0 + val1) / 2 + 1
            numer = np.abs(val0 - val1)
            diff = 100 * np.mean(numer/denom)
            result[channel] = diff
            if diff > diff_threshold:
                fail = True
        _LG.info(result)
        self.assertTrue(not fail)
Example #3
0
def _process_fcs_file(filename):
    # TODO: Remove this script
    fcs = FCMeasurement(ID='Test Sample', datafile=filename)
    fcs_format = fcs.meta['__header__']['FCS format']
    if int(float(fcs_format[3:])) not in [2, 3]:
        raise RuntimeError('{} is not supported.'.format(fcs_format))
    if fcs.meta['$DATATYPE'] == 'I':
        _LG.info('Not processing integer type')
        return fcs
    compensate(fcs)
    apply_logicle_transform(fcs)