Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bliss
bliss
Commits
31c9b0a3
Commit
31c9b0a3
authored
Jun 11, 2021
by
Valentin Valls
Browse files
Normalize time curve with curve plot
parent
5caf3c50
Changes
6
Hide whitespace changes
Inline
Side-by-side
bliss/common/regulation.py
View file @
31c9b0a3
...
...
@@ -1985,13 +1985,13 @@ class RegPlot:
self
.
fig
.
submit
(
"setGraphGrid"
,
which
=
True
)
# Define the plot content
self
.
fig
.
select
_time_curve
(
"setpoint"
,
color
=
"blue"
,
linestyle
=
"-"
,
z
=
2
)
self
.
fig
.
select
_time_curve
(
"input"
,
color
=
"red"
,
linestyle
=
"-"
,
z
=
2
)
self
.
fig
.
select
_time_curve
(
self
.
fig
.
add
_time_curve
_item
(
"setpoint"
,
color
=
"blue"
,
linestyle
=
"-"
,
z
=
2
)
self
.
fig
.
add
_time_curve
_item
(
"input"
,
color
=
"red"
,
linestyle
=
"-"
,
z
=
2
)
self
.
fig
.
add
_time_curve
_item
(
"output"
,
color
=
"green"
,
linestyle
=
"-"
,
yaxis
=
"right"
,
z
=
2
)
self
.
fig
.
select
_time_curve
(
"deadband_high"
,
color
=
"blue"
,
linestyle
=
"--"
,
z
=
2
)
self
.
fig
.
select
_time_curve
(
"deadband_low"
,
color
=
"blue"
,
linestyle
=
"--"
,
z
=
2
)
self
.
fig
.
add
_time_curve
_item
(
"deadband_high"
,
color
=
"blue"
,
linestyle
=
"--"
,
z
=
2
)
self
.
fig
.
add
_time_curve
_item
(
"deadband_low"
,
color
=
"blue"
,
linestyle
=
"--"
,
z
=
2
)
def
is_plot_active
(
self
):
if
self
.
fig
is
None
:
...
...
bliss/flint/client/plots.py
View file @
31c9b0a3
...
...
@@ -517,7 +517,7 @@ class TimeCurvePlot(BasePlot):
"""
self
.
submit
(
"setXDuration"
,
second
)
def
select
_time_curve
(
self
,
yname
,
**
kwargs
):
def
add
_time_curve
_item
(
self
,
yname
,
**
kwargs
):
"""
Select a dedicated data to be displayed against the time.
...
...
@@ -525,7 +525,7 @@ class TimeCurvePlot(BasePlot):
name: Name of the data to use as y-axis
kwargs: Associated style (see `addCurve` from silx plot)
"""
self
.
submit
(
"
select
Curve"
,
yname
,
**
kwargs
)
self
.
submit
(
"
addTime
Curve
Item
"
,
yname
,
**
kwargs
)
def
set_data
(
self
,
**
kwargs
):
"""
...
...
bliss/flint/custom_plots/time_curve_plot.py
View file @
31c9b0a3
...
...
@@ -211,7 +211,7 @@ class TimeCurvePlot(qt.QWidget):
data
=
newData
self
.
__data
[
name
]
=
data
def
select
Curve
(
self
,
yName
,
**
kwargs
):
def
addTime
Curve
Item
(
self
,
yName
,
**
kwargs
):
"""Update the plot description"""
self
.
__description
[
yName
]
=
kwargs
self
.
__safeUpdatePlot
()
...
...
doc/docs/flint/flint_data_plotting.md
View file @
31c9b0a3
...
...
@@ -260,9 +260,9 @@ p = f.get_plot(plot_class="timecurveplot", name="My plot")
# Setup the plot to display a dedicated data name
# The data will be provided later
# the `time` data name is used as x-axis
p
.
select
_time_curve
(
"diode1"
)
p
.
add
_time_curve
_item
(
"diode1"
)
# The curve style can be specified
p
.
select
_time_curve
(
"diode2"
,
color
=
"red"
)
p
.
add
_time_curve
_item
(
"diode2"
,
color
=
"red"
)
# The data can be set
# The time have to be provided in epoch second UTC (see python API `time.time()`)
...
...
tests/flint_client/test_custom_plots.py
View file @
31c9b0a3
...
...
@@ -508,8 +508,8 @@ def test_time_curve_plot(flint_session):
p
=
f
.
get_plot
(
plot_class
=
"timecurveplot"
,
name
=
"timecurveplot"
)
p
.
select
_time_curve
(
"diode1"
)
p
.
select
_time_curve
(
"diode2"
)
p
.
add
_time_curve
_item
(
"diode1"
)
p
.
add
_time_curve
_item
(
"diode2"
)
# set_data update the curves
p
.
set_data
(
time
=
[
0
,
1
,
2
],
diode1
=
[
0
,
1
,
1
],
diode2
=
[
1
,
5
,
1
])
...
...
tests/qt/flint/custom_plots/test_time_curve_plot.py
View file @
31c9b0a3
...
...
@@ -27,8 +27,8 @@ def test_time_curve_plot__set_data(time_curve_plot_widget):
We expect curves to be displayed
"""
w
=
time_curve_plot_widget
w
.
select
Curve
(
"value1"
)
w
.
select
Curve
(
"value2"
)
w
.
addTime
Curve
Item
(
"value1"
)
w
.
addTime
Curve
Item
(
"value2"
)
w
.
setData
(
time
=
[
0
,
1
,
2
,
3
,
4
,
5
],
value1
=
[
0
,
1
,
2
,
3
,
4
,
5
],
value2
=
[
0
,
1
,
2
,
3
,
4
,
5
]
)
...
...
@@ -42,8 +42,8 @@ def test_time_curve_plot__clear(time_curve_plot_widget):
We expect no curves to be displayed
"""
w
=
time_curve_plot_widget
w
.
select
Curve
(
"value1"
)
w
.
select
Curve
(
"value2"
)
w
.
addTime
Curve
Item
(
"value1"
)
w
.
addTime
Curve
Item
(
"value2"
)
w
.
setData
(
time
=
[
0
,
1
,
2
,
3
,
4
,
5
],
value1
=
[
0
,
1
,
2
,
3
,
4
,
5
],
value2
=
[
0
,
1
,
2
,
3
,
4
,
5
]
)
...
...
@@ -58,8 +58,8 @@ def test_time_curve_plot__append_data(time_curve_plot_widget):
We expect the plot to contains curves witch grow up.
"""
w
=
time_curve_plot_widget
w
.
select
Curve
(
"value1"
)
w
.
select
Curve
(
"value2"
)
w
.
addTime
Curve
Item
(
"value1"
)
w
.
addTime
Curve
Item
(
"value2"
)
w
.
appendData
(
time
=
[
0
,
1
,
2
],
value1
=
[
0
,
1
,
2
],
value2
=
[
0
,
1
,
2
])
plot
=
w
.
getPlotWidget
()
curve
=
plot
.
getAllCurves
()[
0
]
...
...
@@ -77,8 +77,8 @@ def test_time_curve_plot__drop_data(time_curve_plot_widget):
"""
w
=
time_curve_plot_widget
w
.
setXDuration
(
5
)
w
.
select
Curve
(
"value1"
)
w
.
select
Curve
(
"value2"
)
w
.
addTime
Curve
Item
(
"value1"
)
w
.
addTime
Curve
Item
(
"value2"
)
w
.
appendData
(
time
=
[
0
,
1
,
2
],
value1
=
[
0
,
1
,
2
],
value2
=
[
0
,
1
,
2
])
w
.
appendData
(
time
=
[
3
,
4
,
5
],
value1
=
[
0
,
1
,
2
],
value2
=
[
0
,
1
,
2
])
w
.
appendData
(
time
=
[
6
,
7
,
8
],
value1
=
[
0
,
1
,
2
],
value2
=
[
0
,
1
,
2
])
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment