Changeset 94f7c24 in ammosreader
- Timestamp:
- 05/05/22 16:19:02 (3 years ago)
- Branches:
- AmmosSource, guix
- Children:
- 4180d6a
- Parents:
- 6808525
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sample_scripts/import_signal.py
r6808525 r94f7c24 56 56 # sys.exit(1) 57 57 58 ammos_reader = AmmosIFReader(str(iqdw_file)) 59 ammos_reader.read_all_frames_left() 60 print(ammos_reader.container) 58 ammos_if_reader = AmmosIFReader(str(iqdw_file)) 59 ammos_if_reader.read_all_frames_left() 60 # for each_frame in ammos_if_reader.container.global_frames: 61 # print(each_frame) 61 62 62 63 ppdw_reader = PPDWReader(ppdw_file) -
src/ammosreader/AmmosIFReader.py
r6808525 r94f7c24 17 17 self.file_name = file_name 18 18 self.file = open(self.file_name, "rb") 19 self.file_size = os.path.getsize(self.file_name)20 19 21 20 self.container = AmmosContainer(self.file_name, []) 22 21 23 22 self.tags = [] 24 25 def rewind_to_start(self):26 self.file.seek(0)27 23 28 24 def add_tag(self, tag): … … 34 30 35 31 while True: 36 print("Reading single frame", frames_read, '...')32 # print("Reading single frame", frames_read, '...') 37 33 current_frame = self.read_next_single_frame() 38 34 if current_frame is not None: 39 35 frames_read += 1 40 36 self.container.add_frame(current_frame) 41 if frames_read % 10000 == 0:42 print("#", end="")37 # if frames_read % 10000 == 0: 38 # print("#", end="") 43 39 else: 44 print("Frame:", frames_read+1, " incomplete")40 # print("Frame:", frames_read+1, " incomplete") 45 41 break 46 42 47 print(len(self.container.global_frames), "frames read")43 # print(len(self.container.global_frames), "frames read") 48 44 49 45 def read_next_global_frame_header(self): 50 46 bytes = self.file.read(24) 51 print("Reading next global frame header")47 # print("Reading next global frame header") 52 48 if ((not bytes) or (len(bytes) < 24)): 53 print("Can not read all 24 bytes of global frame header")49 # print("Can not read all 24 bytes of global frame header") 54 50 return None 55 51 … … 62 58 # print("\nReading global frame body standard data header\n") 63 59 if ((not bytes) or (len(bytes) < 56)): 64 print("Can not read all 56 bytes of global frame body data header")60 # print("Can not read all 56 bytes of global frame body data header") 65 61 return None 66 62 … … 75 71 76 72 if ((not bytes) or (len(bytes) < 76)): 77 print("Can not read all ", 76, "bytes of global frame extended data header")73 # print("Can not read all ", 76, "bytes of global frame extended data header") 78 74 return None 79 75 extended_data_header = AmmosExtendedIFDataHeader.from_bytes(bytes) … … 94 90 95 91 if len(byte_string) != total: 96 print("Can not read all", total, "bytes of data body")92 # print("Can not read all", total, "bytes of data body") 97 93 return None 98 94 … … 113 109 114 110 if if_data_header is None: 115 print("Data header missing")111 # print("Data header missing") 116 112 return None 117 113 … … 119 115 120 116 if if_data_body is None: 121 print("Data body missing")117 # print("Data body missing") 122 118 return None 123 119 … … 128 124 global_frame_header = self.read_next_global_frame_header() 129 125 130 print("\nReading next global frame header\n", global_frame_header)126 # print("\nReading next global frame header\n", global_frame_header) 131 127 # print("File pointer", self.file.tell()) 132 128 133 129 if global_frame_header is None: 134 print("Global frame header missing")130 # print("Global frame header missing") 135 131 return None 136 132 137 133 if global_frame_header.data_header_length is None: 138 print("Data header length empty")134 # print("Data header length empty") 139 135 return None 140 136 … … 146 142 147 143 else: 148 print("Unsupported frame type", global_frame_header.frame_type, "found")144 # print("Unsupported frame type", global_frame_header.frame_type, "found") 149 145 return None 150 146 -
src/ammosreader/AmmosSingleFrame.py
r6808525 r94f7c24 18 18 "Global frame header\n" + 19 19 "-------------------\n" + 20 "Frame ty oe:" + str(self.global_frame_header.frame_type) + "\n" +20 "Frame type:" + str(self.global_frame_header.frame_type) + "\n" + 21 21 "Frame count:" + str(self.global_frame_header.running_frame_number) + "\n" + 22 22 "Data header length:" + str(self.global_frame_header.data_header_length) + " bytes\n" + -
src/ammosreader/PPDWReader.py
r6808525 r94f7c24 19 19 assert len(current_bytes) == 32 20 20 if not current_bytes: 21 print('End of file detected')21 # print('End of file detected') 22 22 break 23 23 if self.cursor + 32 >= len(self.content): 24 print('Can not read all 32 bytes of next PDW')24 # print('Can not read all 32 bytes of next PDW') 25 25 break 26 26 self.container.add(PDW.from_bytes(current_bytes))
Note:
See TracChangeset
for help on using the changeset viewer.