source: ammosreader/src/ammosreader/AmmosContainer.py@ dd9d498

AmmosSource guix
Last change on this file since dd9d498 was dd9d498, checked in by Enrico Schwass <ennoausberlin@…>, 3 years ago

small change to test sphinx-napoleon

  • Property mode set to 100644
File size: 948 bytes
Line 
1"""I store the content of an R&S Ammos file in a more accessible way."""
2
3class AmmosContainer():
4
5 def __init__(self, name, frames):
6 self.name = name
7 self.global_frames = frames
8 self.tags = []
9
10 def add_tag(self, tag):
11 self.tags.append(tag)
12
13 def add_frame(self, frame):
14 self.global_frames.append(frame)
15
16 def size(self):
17 len(self.global_frames)
18
19 def frequencies(self):
20 return set(list(filter(lambda frame: frame.global_frame_body.data_header.frequency, self.global_frames)))
21
22 def __str__(self):
23 start_time = self.global_frames[0].global_frame_body.data_header.timestamp
24 end_time = self.global_frames[-1].global_frame_body.data_header.timestamp
25
26 frq = str(self.global_frames[0].global_frame_body.data_header.frequency)
27
28 return ("Start time: " + str(start_time) +
29 "\nEnd time : " + str(end_time) + "\nFrequencies: " + frq)
Note: See TracBrowser for help on using the repository browser.