Changeset 2a9faed in ammosreader


Ignore:
Timestamp:
06/29/22 16:12:34 (3 years ago)
Author:
Enrico Schwass <ennoausberlin@…>
Branches:
AmmosSource, guix
Children:
a81ab76
Parents:
4455f2b
Message:

more fixes to ensure proper IF data frame processing

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • ammosreader/AmmosIFDataBlockHeader.py

    r4455f2b r2a9faed  
    1212        assert len(bytes) == cls.HEADER_SIZE
    1313        elements = struct.unpack('<ccH', bytes)
    14         header = cls(bytes)
    15         header.invalidity = ((elements[0] & 1) == 1)
    16         header.blanking = ((elements[0] & 2) == 1)
    17         header.user_data = ((elements[0] & 252))
    18         header.reserved = elements[1]
     14        header = cls()
     15        first_entry = int.from_bytes(elements[0], byteorder='big')
     16        header.invalidity = ((first_entry & 1) == 1)
     17        header.blanking = ((first_entry & 2) == 1)
     18        header.user_data = ((first_entry & 252))
     19        header.reserved = int.from_bytes(elements[1], byteorder='big')
    1920        header.reciprocal_gain = elements[2]
    2021        return header
     
    6667
    6768    @reciprocal_gain.setter
    68     def reciprocal_setter(self, a_gain_value):
     69    def reciprocal_gain(self, a_gain_value):
    6970        assert 0 <= a_gain_value < pow(2, 16)
    7071        self.__reciprocal_gain = a_gain_value
  • ammosreader/AmmosIFDataBody.py

    r4455f2b r2a9faed  
    2222    @property
    2323    def data(self):
    24         b"".join([each.data for each in self.data_blocks])
     24        return b"".join([each.data for each in self.data_blocks])
  • ammosreader/AmmosIFReader.py

    r4455f2b r2a9faed  
    22import logging
    33
     4from ammosreader.AbstractAmmosReader import AbstractAmmosReader
    45from ammosreader.AmmosGlobalFrameBody import AmmosGlobalFrameBody
    56from ammosreader.AmmosIFDataHeader import AmmosIFDataHeader
     
    1011
    1112
    12 class AmmosIFReader():
     13class AmmosIFReader(AbstractAmmosReader):
    1314    """I read the IF data embedded in an R&S AMMOS recording."""
    1415
    1516    def __init__(self, file_name):
    16         super.__init__(file_name)
     17        super().__init__(file_name)
    1718
    1819    def read_next_global_frame_body_data_header(self):
     
    9495            return None
    9596
    96         if_data_body = self.read_next_if_data_blocks(if_data_header.block_count, if_data_header.block_length)
     97        if_data_body = self.read_next_if_data_body(if_data_header.block_count, if_data_header.block_length)
    9798
    9899        if if_data_body is None:
    99             # print("Data body missing")
     100            logging.debug("Data body missing")
    100101            return None
    101102
    102103        return AmmosGlobalFrameBody(if_data_header, if_data_body)
     104
     105    def data(self):
     106        return b"".join([each.global_frame_body.data_body.data for each in self.container.global_frames])
  • sample_scripts/iqdw_reader.py

    r4455f2b r2a9faed  
    1919
    2020    dat_file.read_all_frames_left()
    21     print(dat_file.container.size())
    22 
    23 #    for each in dat_file.container.global_frames:
    24 #        print(each)
     21    print(len(dat_file.data()))
Note: See TracChangeset for help on using the changeset viewer.