Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
su
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
dmeiss2s
su
Commits
42c18b34
Commit
42c18b34
authored
9 years ago
by
Daniel Meißner
Committed by
Daniel Meißner
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
live transmission: added comments
parent
72634d2e
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
gr_grc/scripts/show_live_transmissions.py
+8
-1
8 additions, 1 deletion
gr_grc/scripts/show_live_transmissions.py
with
8 additions
and
1 deletion
gr_grc/scripts/show_live_transmissions.py
+
8
−
1
View file @
42c18b34
...
@@ -136,11 +136,15 @@ def main(top_block_cls=top_block, options=None):
...
@@ -136,11 +136,15 @@ def main(top_block_cls=top_block, options=None):
output
[
'
tag
'
]
=
sys
.
argv
[
1
]
output
[
'
tag
'
]
=
sys
.
argv
[
1
]
while
True
:
while
True
:
# read data from msg queue and convert it to a numpy array
# counting ones in np array is faster then counting them in a sting
msg
=
tb
.
msgq_out
.
delete_head
()
msg
=
tb
.
msgq_out
.
delete_head
()
samples
=
np
.
fromstring
(
msg
.
to_string
(),
dtype
=
'
float32
'
)
samples
=
np
.
fromstring
(
msg
.
to_string
(),
dtype
=
'
float32
'
)
samples_len
=
len
(
samples
)
samples_len
=
len
(
samples
)
# skip samples with only zeros
if
np
.
count_nonzero
(
samples
)
!=
0
:
if
np
.
count_nonzero
(
samples
)
!=
0
:
# convert array to string
string
=
""
string
=
""
for
i
in
samples
:
for
i
in
samples
:
string
+=
str
(
int
(
i
))
string
+=
str
(
int
(
i
))
...
@@ -151,13 +155,17 @@ def main(top_block_cls=top_block, options=None):
...
@@ -151,13 +155,17 @@ def main(top_block_cls=top_block, options=None):
messages
.
append
(
string
)
messages
.
append
(
string
)
time_added
=
time
.
time
()
time_added
=
time
.
time
()
# output transmission block after 500ms
if
time_added
!=
0
and
(
time
.
time
()
-
time_added
)
>
0.5
:
if
time_added
!=
0
and
(
time
.
time
()
-
time_added
)
>
0.5
:
# join message blocks
msg
=
""
.
join
(
messages
)
msg
=
""
.
join
(
messages
)
# do some calculations
transmission_time
=
round
(
1
/
tb
.
samp_rate
*
(
int
(
msg
.
count
(
"
1
"
))
*
1000
),
2
)
transmission_time
=
round
(
1
/
tb
.
samp_rate
*
(
int
(
msg
.
count
(
"
1
"
))
*
1000
),
2
)
first_one
=
msg
.
index
(
"
1
"
)
first_one
=
msg
.
index
(
"
1
"
)
last_one
=
msg
.
rfind
(
"
1
"
)
last_one
=
msg
.
rfind
(
"
1
"
)
real_transmission_time
=
round
(
1
/
tb
.
samp_rate
*
(
int
(
last_one
-
first_one
)
*
1000
),
2
)
real_transmission_time
=
round
(
1
/
tb
.
samp_rate
*
(
int
(
last_one
-
first_one
)
*
1000
),
2
)
transmission_counter
+=
1
transmission_counter
+=
1
# magic value 700 ones in a row
if
msg
.
find
(
"
1
"
*
700
)
==
-
1
:
if
msg
.
find
(
"
1
"
*
700
)
==
-
1
:
modulation
=
"
ASK
"
modulation
=
"
ASK
"
else
:
else
:
...
@@ -184,7 +192,6 @@ def main(top_block_cls=top_block, options=None):
...
@@ -184,7 +192,6 @@ def main(top_block_cls=top_block, options=None):
transmission
[
'
transmission_time
'
]
=
transmission_time
transmission
[
'
transmission_time
'
]
=
transmission_time
transmission
[
'
real_transmission_time
'
]
=
real_transmission_time
transmission
[
'
real_transmission_time
'
]
=
real_transmission_time
signal_blocks
.
append
(
transmission
)
signal_blocks
.
append
(
transmission
)
output
[
'
signal_blocks
'
]
=
signal_blocks
output
[
'
signal_blocks
'
]
=
signal_blocks
...
...
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