Changeset 6808525 in ammosreader
- Timestamp:
- 05/05/22 16:00:45 (3 years ago)
- Branches:
- AmmosSource, guix
- Children:
- 94f7c24
- Parents:
- bfab5ea
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
sample_scripts/import_signal.py
rbfab5ea r6808525 5 5 from pathlib import Path 6 6 from ammosreader.AmmosIFReader import AmmosIFReader 7 from ammosreader.P DW import PDW7 from ammosreader.PPDWReader import PPDWReader 8 8 9 9 parser = argparse.ArgumentParser() … … 59 59 ammos_reader.read_all_frames_left() 60 60 print(ammos_reader.container) 61 62 ppdw_reader = PPDWReader(ppdw_file) 63 ppdw_reader.read_all_frames_left() 64 print(ppdw_reader.container) -
src/_version.py
rbfab5ea r6808525 2 2 # file generated by setuptools_scm 3 3 # don't change, don't track in version control 4 version = '0.1.dev 33+gcaee9d8.d20220504'5 version_tuple = (0, 1, 'dev 33', 'gcaee9d8.d20220504')4 version = '0.1.dev57+gbfab5ea.d20220505' 5 version_tuple = (0, 1, 'dev57', 'gbfab5ea.d20220505') -
src/ammosreader.egg-info/PKG-INFO
rbfab5ea r6808525 1 1 Metadata-Version: 2.1 2 2 Name: ammosreader 3 Version: 0.1.dev 33+gcaee9d8.d202205043 Version: 0.1.dev57+gbfab5ea.d20220505 4 4 Summary: ammosreader: tool to parse R&S Ammos files 5 5 Home-page: http://gitlab.kid.local/kidzg/ammosreader … … 19 19 Classifier: Programming Language :: Python :: 3.10 20 20 Classifier: Topic :: Utilities 21 Requires-Python: >=3. 821 Requires-Python: >=3.10 22 22 Description-Content-Type: text/text 23 23 Provides-Extra: testing -
src/ammosreader.egg-info/SOURCES.txt
rbfab5ea r6808525 115 115 sample_scripts/audio_socket_reader_test.py 116 116 sample_scripts/audio_socket_reader_test_streamer.py 117 sample_scripts/import_signal.py 117 118 sample_scripts/iqdw_reader.py 118 119 sample_scripts/pdw_reader.py … … 134 135 src/ammosreader/PDW.py 135 136 src/ammosreader/PPDWContainer.py 137 src/ammosreader/PPDWReader.py 136 138 src/ammosreader/__init__.py 137 139 src/ammosreader.egg-info/PKG-INFO -
src/ammosreader/PDW.py
rbfab5ea r6808525 1 """I store the information of a single PDW block.""" 2 1 3 import struct 2 4 import math 3 5 import numpy as np 4 6 5 # TODO: Use BitArray module in future versions6 7 7 8 8 class PDW(): … … 11 11 12 12 .. automethod:: __init__ 13 14 13 """ 15 14 16 15 @classmethod 17 16 def from_bytes(cls, byte_string): 18 19 """ 20 21 I create an instance of class PDW from data body (8 * 32 bits) 17 """ 18 I create an instance of class PDW from data body (8 * 32 bits). 22 19 23 20 :param byte_string: a byte string containing a single data body read from a ppdw file … … 26 23 :return: an instance of class PDW with attributes set according to the data of a data body 27 24 :rtype: PDW 28 29 """ 30 25 """ 31 26 assert(len(byte_string) == 32) 32 27 … … 165 160 166 161 def __str__(self): 162 """ 163 I return the string representation of myself. 164 165 :rtype: str 166 """ 167 167 output = ("Time of arrival: " + str(self.time_of_arrival) + "\n" + 168 168 "PDW Format identifier: " + str(self.pdw_format_identifier) + "\n" + -
src/ammosreader/PPDWContainer.py
rbfab5ea r6808525 12 12 self.signals = signals 13 13 14 def __str__(self): 15 return "\n".join(["Number of pulses:" + str(len(self.signals)), 16 "Start time:" + str(self.start_time()), 17 "End time:" + str(self.end_time())]) 18 14 19 def add(self, a_pdw): 15 20 self.signals.append(a_pdw) 16 21 22 def start_time(self): 23 return min([each.time_of_arrival for each in self.signals]) 24 25 def end_time(self): 26 return max([each.time_of_arrival for each in self.signals]) 17 27 18 28 if __name__ == '__main__': -
src/ammosreader/PPDWReader.py
rbfab5ea r6808525 6 6 class PPDWReader(): 7 7 8 def __init__(self, file_name):8 def __init__(self, a_file): 9 9 10 self.file = Path(file_name)10 self.file = a_file 11 11 assert self.file.is_file() 12 self.content = self.file.read_bytes() 13 self.cursor = 0 12 14 self.container = PPDWContainer(self.file.stem) 13 15 14 16 def read_all_frames_left(self): 15 with self.file.open() as f: 16 while True: 17 current_bytes = f.read(32) 18 if current_bytes == '': 19 print('End of file detected') 20 break 21 if len(current_bytes) != 32: 22 print('Can not read all 32 bytes of next PDW') 23 break 24 self.container.add(PDW.from_bytes(current_bytes)) 17 while self.cursor <= len(self.content) - 32: 18 current_bytes = self.content[self.cursor:self.cursor+32] 19 assert len(current_bytes) == 32 20 if not current_bytes: 21 print('End of file detected') 22 break 23 if self.cursor + 32 >= len(self.content): 24 print('Can not read all 32 bytes of next PDW') 25 break 26 self.container.add(PDW.from_bytes(current_bytes)) 27 self.cursor += 32 28 return self.container
Note:
See TracChangeset
for help on using the changeset viewer.