AmmosSource
guix
Last change
on this file since 0da6808 was d88bd02, checked in by Enrico Schwass <ennoausberlin@…>, 3 years ago |
directory structure changed to reflect pip package structure
|
-
Property mode
set to
100644
|
File size:
975 bytes
|
Line | |
---|
1 | from datetime import datetime
|
---|
2 |
|
---|
3 | class 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(datetime.utcfromtimestamp(start_time/1000000)) +
|
---|
29 | "\nEnd time : " + str(datetime.utcfromtimestamp(end_time/1000000)) + "\nFrequencies: " + frq)
|
---|
Note:
See
TracBrowser
for help on using the repository browser.