Exemple #1
0
    def test_get_ads1299_scale_factors_volts(self):
        gains = [24, 24, 24, 24, 24, 24, 24, 24]
        expected_scale_factors = []
        for gain in gains:
            scale_factor = 4.5 / float((pow(2, 23) - 1)) / float(gain)
            expected_scale_factors.append(scale_factor)

        parser = ParseRaw()

        actual_scale_factors = parser.get_ads1299_scale_factors(gains)

        self.assertEqual(
            actual_scale_factors, expected_scale_factors,
            "should be able to get scale factors for gains in volts")
Exemple #2
0
    def test_get_channel_data_array(self):
        expected_gains = [24, 24, 24, 24, 24, 24, 24, 24]
        expected_sample_number = 0

        data = sample_packet(expected_sample_number)

        parser = ParseRaw(gains=expected_gains, scaled_output=True)

        scale_factors = parser.get_ads1299_scale_factors(expected_gains)

        expected_channel_data = []
        for i in range(k.NUMBER_OF_CHANNELS_CYTON):
            expected_channel_data.append(scale_factors[i] * (i + 1))

        parser.raw_data_to_sample.raw_data_packet = data

        actual_channel_data = parser.get_channel_data_array(
            parser.raw_data_to_sample)

        self.assertListEqual(actual_channel_data, expected_channel_data)