Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
StdInPlot
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
technasium
StdInPlot
Commits
08146cf0
Commit
08146cf0
authored
1 year ago
by
Tammo Jan Dijkema
Browse files
Options
Downloads
Patches
Plain Diff
Automatic title
parent
98e8a761
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
makedata.py
+1
-1
1 addition, 1 deletion
makedata.py
power_plot.py
+14
-9
14 additions, 9 deletions
power_plot.py
with
15 additions
and
10 deletions
makedata.py
+
1
−
1
View file @
08146cf0
...
...
@@ -14,5 +14,5 @@ with open("doppler.txt", "r") as f:
print
(
line
,
end
=
''
,
flush
=
True
)
else
:
print
(
line
,
end
=
''
,
flush
=
True
)
if
a
>
10
00
:
if
a
>
5
00
:
sleep
(
1
)
This diff is collapsed.
Click to expand it.
power_plot.py
+
14
−
9
View file @
08146cf0
...
...
@@ -39,17 +39,17 @@ last_seconds = 10 * 60
class
PowerPlot
:
"""
A power plot with two time scales
"""
def
__init__
(
self
,
fig
):
def
__init__
(
self
,
fig
,
yname
):
self
.
fig
=
fig
self
.
ax
=
fig
.
add_subplot
()
self
.
ax
.
set_xlabel
(
"
Time (UTC)
"
)
self
.
ax
.
set_ylabel
(
"
Frequency
"
)
self
.
ax
.
set_ylabel
(
yname
)
self
.
ax
.
xaxis_date
()
self
.
min
,
self
.
max
=
None
,
None
self
.
ax
.
xaxis
.
set_major_formatter
(
FuncFormatter
(
lambda
x
,
pos
:
f
"
{
num2date
(
x
)
:
%
H
:
%
M
}
"
)
)
fig
.
suptitle
(
f
"
Maximum frequency
"
,
fontsize
=
16
)
fig
.
suptitle
(
yname
,
fontsize
=
16
)
fig
.
tight_layout
()
(
self
.
totalplot
,)
=
self
.
ax
.
plot
([],
[],
"
.
"
,
color
=
"
blue
"
)
(
self
.
totalplothighlight
,)
=
self
.
ax
.
plot
(
...
...
@@ -95,26 +95,30 @@ class MyToolbar(NavigationToolbar):
class
PowerPlotMainWindow
(
QMainWindow
):
"""
QT Application that reads data from stdin, plots in a PowerPlot
"""
def
__init__
(
self
):
def
__init__
(
self
,
col_num
=
1
):
super
().
__init__
()
self
.
setStyleSheet
(
"
background-color: white;
"
)
self
.
autoscale_x
=
True
self
.
autoscale_y
=
True
self
.
col_num
=
col_num
self
.
setWindowTitle
(
"
Dwingeloo Radio Telescope
"
)
self
.
setGeometry
(
100
,
100
,
800
,
600
)
central_widget
=
QWidget
(
self
)
layout
=
QVBoxLayout
(
central_widget
)
# Get metadata
# Get metadata
and ignore it
header_lines
=
[]
while
True
:
line
=
sys
.
stdin
.
readline
()
header_lines
.
append
(
line
)
if
line
[
0
]
!=
"
#
"
:
column_names
=
line
.
split
()
column_names
=
[
name
.
strip
()
for
name
in
line
.
split
()
]
break
yname
=
column_names
[
self
.
col_num
]
yname
=
yname
.
rstrip
(
"
,
"
).
capitalize
()
line
=
sys
.
stdin
.
readline
()
values
=
line
.
split
(
"
,
"
)
first_time
=
datetime
.
utcfromtimestamp
(
float
(
values
[
0
]))
...
...
@@ -125,7 +129,7 @@ class PowerPlotMainWindow(QMainWindow):
self
.
min_range
=
np
.
arange
(
-
last_seconds
,
1
,
1
)
self
.
data
=
np
.
array
([
float
(
values
[
1
])])
self
.
data
=
np
.
array
([
float
(
values
[
self
.
col_num
])])
self
.
start_time
=
first_time
self
.
stop_time
=
first_time
+
timedelta
(
hours
=
2
)
...
...
@@ -149,7 +153,7 @@ class PowerPlotMainWindow(QMainWindow):
# fig.canvas.manager.set_window_title("Dwingeloo Radio Telescope")
self
.
powerplot
=
PowerPlot
(
fig
)
self
.
powerplot
=
PowerPlot
(
fig
,
yname
)
self
.
read_stdin
()
self
.
stdin_notifier
=
QSocketNotifier
(
...
...
@@ -166,7 +170,7 @@ class PowerPlotMainWindow(QMainWindow):
self
.
output_counter
+=
1
values
=
line
.
split
(
"
,
"
)
time_now
=
float
(
values
[
0
])
power_now
=
float
(
values
[
1
])
power_now
=
float
(
values
[
self
.
col_num
])
self
.
time_dt
=
np
.
append
(
self
.
time_dt
,
date2num
(
datetime
.
utcfromtimestamp
(
time_now
))
...
...
@@ -210,4 +214,5 @@ if __name__ == "__main__":
main_window
=
PowerPlotMainWindow
()
main_window
.
show
()
signal
.
signal
(
signal
.
SIGINT
,
handle_interrupt_signal
)
sys
.
exit
(
app
.
exec_
())
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