def test_eight_byte_real_to_float(self): data = b'>A\x897K\xc6\xa7\xf0' value = utils.eight_byte_real_to_float(data) self.assertEqual(value, 0.001)
def test_conversion_random(self): start_value = random.uniform(-1, 1) end_value = utils.eight_byte_real_to_float( utils.float_to_eight_byte_real(start_value)) self.assertEqual(start_value, end_value)
def read(cls, record: library.RawRecord) -> MAG: super().read(record) self = cls.__new__(cls) self.magnification_factor = utils.eight_byte_real_to_float(record.data) return self
def read(cls, record: library.RawRecord) -> ANGLE: super().read(record) self = cls.__new__(cls) self.angular_rotation_factor = utils.eight_byte_real_to_float( record.data) return self
def read(cls, record: library.RawRecord) -> UNITS: super().read(record) self = cls.__new__(cls) self.logical_unit = utils.eight_byte_real_to_float(record.data[:8]) self.physical_unit = utils.eight_byte_real_to_float(record.data[8:]) return self