Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tammo Jan Dijkema
zonnedemo
Commits
9e416d70
Commit
9e416d70
authored
Aug 25, 2021
by
Tammo Jan Dijkema
Browse files
Add dB scale
parent
df9e2c1f
Changes
1
Hide whitespace changes
Inline
Side-by-side
zonnewaarneming.py
View file @
9e416d70
...
@@ -37,6 +37,8 @@ def set_stoprequest(event):
...
@@ -37,6 +37,8 @@ def set_stoprequest(event):
signal
=
0.
signal
=
0.
prev_signal
=
0.
prev_signal
=
0.
y_scale_is_logarithmic
=
False
datafile
=
open
(
f
"data
{
int
(
Time
.
now
().
unix
)
}
.txt"
,
"w"
)
datafile
=
open
(
f
"data
{
int
(
Time
.
now
().
unix
)
}
.txt"
,
"w"
)
print
(
"Time (UTC),separation (deg),azimuth from north (deg), elevation (deg), signal, source"
,
file
=
datafile
)
print
(
"Time (UTC),separation (deg),azimuth from north (deg), elevation (deg), signal, source"
,
file
=
datafile
)
...
@@ -180,6 +182,7 @@ while not stoprequest:
...
@@ -180,6 +182,7 @@ while not stoprequest:
maxsignal
=
signal
maxsignal
=
signal
if
signal
<
minsignal
:
if
signal
<
minsignal
:
minsignal
=
signal
minsignal
=
signal
noiselevel
=
75
# TODO: infer this from data
scatter_data
=
scatterplot
.
get_offsets
()
scatter_data
=
scatterplot
.
get_offsets
()
scatter_data
=
np
.
vstack
((
scatter_data
,
[
separation
.
deg
,
signal
]))
scatter_data
=
np
.
vstack
((
scatter_data
,
[
separation
.
deg
,
signal
]))
...
@@ -188,10 +191,29 @@ while not stoprequest:
...
@@ -188,10 +191,29 @@ while not stoprequest:
prev_points
=
ax
.
scatter
([
separation
.
deg
],
[
signal
],
s
=
50
,
color
=
'red'
)
prev_points
=
ax
.
scatter
([
separation
.
deg
],
[
signal
],
s
=
50
,
color
=
'red'
)
ax
.
set_ylim
((
0.9
*
minsignal
,
1.1
*
maxsignal
))
ax
.
set_ylim
((
0.9
*
minsignal
,
1.1
*
maxsignal
))
if
minsignal
<
1000
:
if
(
not
y_scale_is_logarithmic
)
and
minsignal
<
1000
:
# Attenuator on
# Attenuator on
y_scale_is_logarithmic
=
True
ax
.
set_yscale
(
"log"
)
ax
.
set_yscale
(
"log"
)
yticks
=
[]
yticklabels
=
[]
ytick
=
noiselevel
db
=
0
while
ytick
<
ax
.
get_ylim
()[
1
]:
yticks
.
append
(
ytick
)
yticklabels
.
append
(
f
"
{
db
}
dB"
)
ytick
*=
10
**
0.1
db
+=
1
while
len
(
yticks
)
>
15
:
yticks
=
yticks
[::
2
]
yticklabels
=
yticklabels
[::
2
]
ax
.
set_yticks
(
yticks
)
ax
.
set_yticklabels
(
yticklabels
)
ax
.
get_yaxis
().
set_tick_params
(
which
=
'minor'
,
size
=
0
)
ax
.
get_yaxis
().
set_tick_params
(
which
=
'minor'
,
width
=
0
)
ax
.
set_ylabel
(
"Relatieve intensiteit"
)
update_legend
(
ax
,
closest_source
)
update_legend
(
ax
,
closest_source
)
# show the plot
# show the plot
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment