Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review 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
RadioObservatory
LOFAR
Commits
e0300fea
Commit
e0300fea
authored
15 years ago
by
Joris van Zwieten
Browse files
Options
Downloads
Patches
Plain Diff
Bug 1439: Fixed plotting of real valued parameters and improved plot labels.
parent
984b9fbb
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
CEP/Calibration/BBSControl/scripts/parmdbplot.py
+32
-26
32 additions, 26 deletions
CEP/Calibration/BBSControl/scripts/parmdbplot.py
with
32 additions
and
26 deletions
CEP/Calibration/BBSControl/scripts/parmdbplot.py
+
32
−
26
View file @
e0300fea
...
@@ -167,9 +167,9 @@ def normalize(phase):
...
@@ -167,9 +167,9 @@ def normalize(phase):
return
out
return
out
def
plot
(
sol
,
fig
,
clf
=
True
,
sub
=
None
,
scatter
=
False
,
stack
=
False
,
sep
=
5.0
,
def
plot
(
fig
,
y
,
x
=
None
,
clf
=
True
,
sub
=
None
,
scatter
=
False
,
stack
=
False
,
sep_abs
=
False
,
labels
=
None
,
show_legend
=
False
,
title
=
None
,
xlabel
=
None
,
sep
=
5.0
,
sep_abs
=
False
,
labels
=
None
,
show_legend
=
False
,
title
=
None
,
ylabel
=
None
):
xlabel
=
None
,
ylabel
=
None
):
"""
"""
Plot a list of signals.
Plot a list of signals.
...
@@ -205,29 +205,31 @@ def plot(sol, fig, clf=True, sub=None, scatter=False, stack=False, sep=5.0,
...
@@ -205,29 +205,31 @@ def plot(sol, fig, clf=True, sub=None, scatter=False, stack=False, sep=5.0,
if
not
ylabel
is
None
:
if
not
ylabel
is
None
:
axes
.
set_ylabel
(
ylabel
)
axes
.
set_ylabel
(
ylabel
)
if
x
is
None
:
x
=
[
range
(
len
(
yi
))
for
yi
in
y
]
offset
=
0.0
offset
=
0.0
for
i
in
range
(
0
,
len
(
sol
)):
for
i
in
range
(
0
,
len
(
y
)):
if
labels
is
None
:
if
labels
is
None
:
if
scatter
:
if
scatter
:
axes
.
scatter
(
range
(
0
,
len
(
sol
[
i
])),
sol
[
i
]
+
offset
,
axes
.
scatter
(
x
[
i
],
y
[
i
]
+
offset
,
edgecolors
=
"
None
"
,
edgecolors
=
"
None
"
,
c
=
__styles
[
i
%
len
(
__styles
)][
0
],
c
=
__styles
[
i
%
len
(
__styles
)][
0
],
marker
=
"
o
"
)
marker
=
"
o
"
)
else
:
else
:
axes
.
plot
(
sol
[
i
]
+
offset
,
__styles
[
i
%
len
(
__styles
)])
axes
.
plot
(
x
[
i
],
y
[
i
]
+
offset
,
__styles
[
i
%
len
(
__styles
)])
else
:
else
:
if
scatter
:
if
scatter
:
axes
.
scatter
(
range
(
0
,
len
(
sol
[
i
])),
sol
[
i
]
+
offset
,
axes
.
scatter
(
x
[
i
],
y
[
i
]
+
offset
,
edgecolors
=
"
None
"
,
edgecolors
=
"
None
"
,
c
=
__styles
[
i
%
len
(
__styles
)][
0
],
c
=
__styles
[
i
%
len
(
__styles
)][
0
],
marker
=
"
o
"
,
marker
=
"
o
"
,
label
=
labels
[
i
])
label
=
labels
[
i
])
else
:
else
:
axes
.
plot
(
sol
[
i
]
+
offset
,
__styles
[
i
%
len
(
__styles
)],
axes
.
plot
(
x
[
i
],
y
[
i
]
+
offset
,
__styles
[
i
%
len
(
__styles
)],
label
=
labels
[
i
])
label
=
labels
[
i
])
if
stack
:
if
stack
:
if
sep_abs
:
if
sep_abs
:
offset
+=
sep
offset
+=
sep
else
:
else
:
offset
+=
sol
[
i
].
mean
()
+
sep
*
sol
[
i
].
std
()
offset
+=
y
[
i
].
mean
()
+
sep
*
y
[
i
].
std
()
if
not
labels
is
None
and
show_legend
:
if
not
labels
is
None
and
show_legend
:
axes
.
legend
(
prop
=
FontProperties
(
size
=
"
x-small
"
),
markerscale
=
0.5
)
axes
.
legend
(
prop
=
FontProperties
(
size
=
"
x-small
"
),
markerscale
=
0.5
)
...
@@ -290,7 +292,7 @@ class Parm:
...
@@ -290,7 +292,7 @@ class Parm:
def
_readDomain
(
self
):
def
_readDomain
(
self
):
if
self
.
_elements
is
None
:
if
self
.
_elements
is
None
:
self
.
_domain
=
self
.
_db
.
getRange
(
self
.
name
())
self
.
_domain
=
self
.
_db
.
getRange
(
self
.
name
())
else
:
domain_el0
=
self
.
_db
.
getRange
(
self
.
_elements
[
0
])
domain_el0
=
self
.
_db
.
getRange
(
self
.
_elements
[
0
])
domain_el1
=
self
.
_db
.
getRange
(
self
.
_elements
[
1
])
domain_el1
=
self
.
_db
.
getRange
(
self
.
_elements
[
1
])
self
.
_domain
=
[
max
(
domain_el0
[
0
],
domain_el1
[
0
]),
min
(
domain_el0
[
1
],
domain_el1
[
1
]),
max
(
domain_el0
[
2
],
domain_el1
[
2
]),
min
(
domain_el0
[
3
],
domain_el1
[
3
])]
self
.
_domain
=
[
max
(
domain_el0
[
0
],
domain_el1
[
0
]),
min
(
domain_el0
[
1
],
domain_el1
[
1
]),
max
(
domain_el0
[
2
],
domain_el1
[
2
]),
min
(
domain_el0
[
3
],
domain_el1
[
3
])]
...
@@ -383,7 +385,7 @@ class PlotWindow(QFrame):
...
@@ -383,7 +385,7 @@ class PlotWindow(QFrame):
self
.
domain
=
common_domain
(
self
.
parms
)
self
.
domain
=
common_domain
(
self
.
parms
)
self
.
shape
=
(
0
,
0
)
self
.
shape
=
(
1
,
1
)
if
not
self
.
domain
is
None
:
if
not
self
.
domain
is
None
:
self
.
shape
=
(
self
.
parms
[
0
].
value
(
self
.
domain
,
self
.
resolution
)[
0
].
shape
)
self
.
shape
=
(
self
.
parms
[
0
].
value
(
self
.
domain
,
self
.
resolution
)[
0
].
shape
)
assert
(
len
(
self
.
shape
)
==
2
)
assert
(
len
(
self
.
shape
)
==
2
)
...
@@ -413,14 +415,18 @@ class PlotWindow(QFrame):
...
@@ -413,14 +415,18 @@ class PlotWindow(QFrame):
el1
.
append
(
value
[
1
][
self
.
index
,
:])
el1
.
append
(
value
[
1
][
self
.
index
,
:])
labels
.
append
(
parm
.
name
())
labels
.
append
(
parm
.
name
())
legend
=
self
.
show_legend
and
len
(
labels
)
>
0
legend
=
self
.
show_legend
and
len
(
labels
)
>
0
xlabel
=
[
"
Time (sample)
"
,
"
Freq (sample)
"
][
self
.
axis
]
if
self
.
polar
:
if
self
.
polar
:
plot
(
el0
,
self
.
fig
,
sub
=
"
211
"
,
labels
=
labels
,
show_legend
=
legend
,
title
=
"
Amplitude
"
)
plot
(
self
.
fig
,
el0
,
sub
=
"
211
"
,
labels
=
labels
,
show_legend
=
legend
,
xlabel
=
xlabel
,
ylabel
=
"
Amplitude
"
)
plot
(
el1
,
self
.
fig
,
clf
=
False
,
sub
=
"
212
"
,
stack
=
True
,
scatter
=
True
,
labels
=
labels
,
show_legend
=
legend
,
title
=
"
Phase
"
,
ylabel
=
"
Angl
e (rad)
"
)
plot
(
self
.
fig
,
el1
,
clf
=
False
,
sub
=
"
212
"
,
stack
=
True
,
scatter
=
True
,
labels
=
labels
,
show_legend
=
legend
,
xlabel
=
xlabel
,
ylabel
=
"
Phas
e (rad)
"
)
else
:
else
:
plot
(
el0
,
self
.
fig
,
sub
=
"
211
"
,
labels
=
labels
,
show_legend
=
legend
,
title
=
"
Real
"
)
plot
(
self
.
fig
,
el0
,
sub
=
"
211
"
,
labels
=
labels
,
show_legend
=
legend
,
xlabel
=
xlabel
,
ylabel
=
"
Real
"
)
plot
(
el1
,
self
.
fig
,
clf
=
False
,
sub
=
"
212
"
,
labels
=
labels
,
show_legend
=
legend
,
title
=
"
Imaginary
"
)
plot
(
self
.
fig
,
el1
,
clf
=
False
,
sub
=
"
212
"
,
labels
=
labels
,
show_legend
=
legend
,
xlabel
=
xlabel
,
ylabel
=
"
Imaginary
"
)
# Set x-axis scale in number of samples.
for
ax
in
self
.
fig
.
axes
:
ax
.
set_xlim
(
0
,
self
.
shape
[
self
.
axis
]
-
1
)
self
.
canvas
.
draw
()
self
.
canvas
.
draw
()
...
@@ -451,6 +457,8 @@ class MainWindow(QFrame):
...
@@ -451,6 +457,8 @@ class MainWindow(QFrame):
def
__init__
(
self
,
db
):
def
__init__
(
self
,
db
):
QFrame
.
__init__
(
self
)
QFrame
.
__init__
(
self
)
self
.
db
=
db
self
.
db
=
db
self
.
figures
=
[]
self
.
parms
=
[]
# self.setWindowTitle("parmdbplot")
# self.setWindowTitle("parmdbplot")
...
@@ -490,8 +498,6 @@ class MainWindow(QFrame):
...
@@ -490,8 +498,6 @@ class MainWindow(QFrame):
self
.
setLayout
(
layout
)
self
.
setLayout
(
layout
)
self
.
figures
=
[]
self
.
parms
=
[]
self
.
populate
()
self
.
populate
()
def
populate
(
self
):
def
populate
(
self
):
...
@@ -541,7 +547,7 @@ class MainWindow(QFrame):
...
@@ -541,7 +547,7 @@ class MainWindow(QFrame):
if
not
found
:
if
not
found
:
self
.
parms
.
append
(
Parm
(
self
.
db
,
name
,
elements
,
True
))
self
.
parms
.
append
(
Parm
(
self
.
db
,
name
,
elements
,
True
))
else
:
else
:
self
.
parms
.
append
(
Parm
(
self
.
db
,
name
))
self
.
parms
.
append
(
Parm
(
self
.
db
,
parm
))
self
.
parms
=
[
parm
for
parm
in
self
.
parms
if
not
parm
.
empty
()]
self
.
parms
=
[
parm
for
parm
in
self
.
parms
if
not
parm
.
empty
()]
self
.
parms
.
sort
(
cmp
=
lambda
x
,
y
:
cmp
(
x
.
name
(),
y
.
name
()))
self
.
parms
.
sort
(
cmp
=
lambda
x
,
y
:
cmp
(
x
.
name
(),
y
.
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