Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EdosL0Util
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SIPS
EdosL0Util
Commits
b4af1942
Commit
b4af1942
authored
8 years ago
by
Greg Quinn
Browse files
Options
Downloads
Patches
Plain Diff
Fix crgen problem handling packets w no stamp
parent
59b6afea
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
edosl0util/crgen.py
+15
-8
15 additions, 8 deletions
edosl0util/crgen.py
with
15 additions
and
8 deletions
edosl0util/crgen.py
+
15
−
8
View file @
b4af1942
...
...
@@ -177,17 +177,21 @@ def scan_packets(pds_file, prev_pds_file=None):
apid_map
=
{}
logger
.
info
(
'
scanning {}
'
.
format
(
pds_file
))
stream
=
jpss_packet_stream
(
open
(
pds_file
,
'
rb
'
))
first_pkt
=
stream
.
next
()
for
pkt
in
itertools
.
chain
([
first_pkt
],
stream
):
first_pkt_time
=
None
last_pkt_time
=
None
for
pkt
in
stream
:
entry
=
apid_map
.
get
(
pkt
.
apid
)
if
not
entry
:
entry_from_prev_pds
=
prev_apid_map
.
get
(
pkt
.
apid
)
apid_map
[
pkt
.
apid
]
=
init_entry
(
pkt
,
entry_from_prev_pds
)
else
:
update_entry
(
entry
,
pkt
)
last_pkt
=
pkt
return
{
'
first_packet_time
'
:
datetime_to_ccsds
(
first_pkt
.
stamp
),
'
last_packet_time
'
:
datetime_to_ccsds
(
last_pkt
.
stamp
),
if
pkt
.
stamp
:
if
not
first_pkt_time
:
first_pkt_time
=
pkt
.
stamp
last_pkt_time
=
pkt
.
stamp
return
{
'
first_packet_time
'
:
datetime_to_ccsds
(
first_pkt_time
),
'
last_packet_time
'
:
datetime_to_ccsds
(
last_pkt_time
),
'
apid_info
'
:
[
apid_map
[
k
]
for
k
in
sorted
(
apid_map
)]}
def
build_prev_apid_map
(
prev_pds_file
):
...
...
@@ -209,7 +213,10 @@ def scan_packets(pds_file, prev_pds_file=None):
def
update_entry
(
entry
,
new_pkt
):
prev_last_ssc
=
entry
[
'
last_packet_ssc
'
]
prev_last_time
=
entry
[
'
last_packet_time
'
]
entry
[
'
last_packet_time
'
]
=
datetime_to_ccsds
(
new_pkt
.
stamp
)
if
new_pkt
.
stamp
:
if
entry
[
'
first_packet_time
'
]
==
DaySegmentedTimecode
():
entry
[
'
first_packet_time
'
]
=
datetime_to_ccsds
(
new_pkt
.
stamp
)
entry
[
'
last_packet_time
'
]
=
datetime_to_ccsds
(
new_pkt
.
stamp
)
entry
[
'
last_packet_ssc
'
]
=
new_pkt
.
seqid
entry
[
'
total_packets
'
]
+=
1
entry
[
'
total_bytes
'
]
+=
new_pkt
.
size
...
...
@@ -235,12 +242,12 @@ def datetime_to_ccsds(dt):
Handles input of None by returning epoch value of 1958-01-01.
"""
if
dt
is
not
None
:
epoch
=
datetime
(
1958
,
1
,
1
)
days
=
(
dt
-
epoch
).
days
days
=
(
dt
-
idps_epoch
).
days
micros
=
int
((
dt
-
datetime
(
dt
.
year
,
dt
.
month
,
dt
.
day
)).
total_seconds
()
*
1e6
)
return
DaySegmentedTimecode
(
days
,
micros
//
1000
,
micros
%
1000
)
else
:
return
DaySegmentedTimecode
()
idps_epoch
=
datetime
(
1958
,
1
,
1
)
logger
=
logging
.
getLogger
(
__name__
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment