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
cbe61b5f
Unverified
Commit
cbe61b5f
authored
Jun 11, 2021
by
Tammo Jan Dijkema
Browse files
Add plot_eclipse_data
parent
cc97c399
Changes
1
Hide whitespace changes
Inline
Side-by-side
plot_eclipse_data.py
0 → 100644
View file @
cbe61b5f
#!/usr/bin/env python
# coding: utf-8
from
datetime
import
datetime
import
matplotlib.pyplot
as
plt
import
matplotlib.dates
as
mdates
import
matplotlib
import
pandas
as
pd
from
pandas.plotting
import
register_matplotlib_converters
register_matplotlib_converters
()
df_23
=
pd
.
read_csv
(
"data1623310995.txt"
,
parse_dates
=
[
0
],
skiprows
=
1
)
df_70
=
pd
.
read_csv
(
"data1623311707.txt"
,
parse_dates
=
[
0
],
skiprows
=
1
)
eclipse_starttime
=
datetime
(
2021
,
6
,
10
,
9
,
21
)
eclipse_endtime
=
datetime
(
2021
,
6
,
10
,
11
,
34
)
matplotlib
.
rcParams
.
update
({
'font.size'
:
16
})
plot_start
=
datetime
(
2021
,
6
,
10
,
8
,
30
,
0
)
plot_end
=
datetime
(
2021
,
6
,
10
,
12
,
0
,
0
)
df_70_selected
=
df_70
[(
df_70
[
"time (UTC)"
]
>
plot_start
)
&
(
df_70
[
"time (UTC)"
]
<
plot_end
)]
df_23_selected
=
df_23
[(
df_23
[
"time (UTC)"
]
>
plot_start
)
&
(
df_23
[
"time (UTC)"
]
<
plot_end
)]
fig
,
ax
=
plt
.
subplots
(
figsize
=
(
16
,
9
))
sc1
=
ax
.
scatter
(
df_23_selected
[
"time (UTC)"
],
df_23_selected
[
"signal"
]
/
5050
,
s
=
2
,
label
=
"Signal at 1330MHz"
,
)
ax
.
margins
(
x
=
0
)
ax2
=
ax
.
twinx
()
ax
.
xaxis
.
set_major_formatter
(
mdates
.
DateFormatter
(
"%H:%M:%S"
))
ax2
.
xaxis
.
set_major_formatter
(
mdates
.
DateFormatter
(
"%H:%M:%S"
))
sc2
=
ax2
.
scatter
(
df_70_selected
[
"time (UTC)"
],
df_70_selected
[
"signal"
]
/
8e6
,
s
=
2
,
color
=
"red"
,
label
=
"Signal at 410MHz"
,
)
# ax.set_xticks([])
ax
.
set_ylim
([
0.85
,
None
])
ax2
.
set_ylim
(
0.65
,
None
)
ax2
.
set_ylabel
(
"Signal at 410MHz"
,
color
=
"red"
,
fontsize
=
20
)
ax
.
set_ylabel
(
"Signal at 1330MHz"
,
color
=
plt
.
rcParams
[
"axes.prop_cycle"
].
by_key
()[
"color"
][
0
],
fontsize
=
20
)
ax
.
set_xlabel
(
"Time (UTC)"
)
if
True
:
ax
.
axvline
(
eclipse_starttime
,
linestyle
=
"--"
,
linewidth
=
1
,
color
=
"black"
)
ax
.
text
(
eclipse_starttime
,
0.1
,
"Start: "
+
datetime
.
strftime
(
eclipse_starttime
,
"%H:%M"
),
rotation
=
90
,
color
=
"black"
,
transform
=
ax
.
get_xaxis_transform
(),
)
ax
.
axvline
(
eclipse_endtime
,
linestyle
=
"--"
,
linewidth
=
1
,
color
=
"black"
)
ax
.
text
(
eclipse_endtime
,
0.1
,
"End: "
+
datetime
.
strftime
(
eclipse_endtime
,
"%H:%M"
),
rotation
=
90
,
color
=
"black"
,
transform
=
ax
.
get_xaxis_transform
(),
)
fig
.
savefig
(
"eclipseplot.png"
,
transparent
=
False
,
facecolor
=
'white'
)
Write
Preview
Supports
Markdown
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