Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CFA Analysis
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
JOSSOUD Olivier
CFA Analysis
Commits
df5dbe12
Commit
df5dbe12
authored
5 years ago
by
JOSSOUD Olivier
Browse files
Options
Downloads
Patches
Plain Diff
Pumpcalib. Linear regression line. (+legend, not really working)
parent
f254288d
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
pyqt/mainwindow.ui
+9
-9
9 additions, 9 deletions
pyqt/mainwindow.ui
src/gui/uimainwindow.py
+7
-7
7 additions, 7 deletions
src/gui/uimainwindow.py
src/main.py
+1
-1
1 addition, 1 deletion
src/main.py
src/uim/pumpcalibuim.py
+41
-10
41 additions, 10 deletions
src/uim/pumpcalibuim.py
with
58 additions
and
27 deletions
pyqt/mainwindow.ui
+
9
−
9
View file @
df5dbe12
...
...
@@ -176,7 +176,7 @@
<x>
10
</x>
<y>
20
</y>
<width>
371
</width>
<height>
3
1
</height>
<height>
3
2
</height>
</rect>
</property>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_4"
>
...
...
@@ -207,7 +207,7 @@
<rect>
<x>
15
</x>
<y>
70
</y>
<width>
2
8
1
</width>
<width>
2
7
1
</width>
<height>
161
</height>
</rect>
</property>
...
...
@@ -221,10 +221,10 @@
</property>
<property
name=
"geometry"
>
<rect>
<x>
30
1
</x>
<x>
29
1
</x>
<y>
70
</y>
<width>
8
1
</width>
<height>
2
3
</height>
<width>
9
1
</width>
<height>
3
1
</height>
</rect>
</property>
<property
name=
"text"
>
...
...
@@ -459,8 +459,8 @@
<rect>
<x>
10
</x>
<y>
10
</y>
<width>
1
1
1
</width>
<height>
22
</height>
<width>
1
4
1
</width>
<height>
31
</height>
</rect>
</property>
<item>
...
...
@@ -483,7 +483,7 @@
<property
name=
"geometry"
>
<rect>
<x>
10
</x>
<y>
4
0
</y>
<y>
5
0
</y>
<width>
831
</width>
<height>
431
</height>
</rect>
...
...
@@ -508,7 +508,7 @@
<x>
0
</x>
<y>
0
</y>
<width>
1355
</width>
<height>
2
0
</height>
<height>
2
6
</height>
</rect>
</property>
<widget
class=
"QMenu"
name=
"menuInstrument"
>
...
...
This diff is collapsed.
Click to expand it.
src/gui/uimainwindow.py
+
7
−
7
View file @
df5dbe12
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '..
\
pyqt
\
mainwindow.ui'
# Form implementation generated from reading ui file '..
/
pyqt
/
mainwindow.ui'
#
# Created by: PyQt5 UI code generator 5.11.3
#
...
...
@@ -75,7 +75,7 @@ class Ui_MainWindow(object):
self
.
explo_groupbox_setups
.
setGeometry
(
QtCore
.
QRect
(
950
,
10
,
391
,
241
))
self
.
explo_groupbox_setups
.
setObjectName
(
"
explo_groupbox_setups
"
)
self
.
horizontalLayoutWidget_4
=
QtWidgets
.
QWidget
(
self
.
explo_groupbox_setups
)
self
.
horizontalLayoutWidget_4
.
setGeometry
(
QtCore
.
QRect
(
10
,
20
,
371
,
3
1
))
self
.
horizontalLayoutWidget_4
.
setGeometry
(
QtCore
.
QRect
(
10
,
20
,
371
,
3
2
))
self
.
horizontalLayoutWidget_4
.
setObjectName
(
"
horizontalLayoutWidget_4
"
)
self
.
horizontalLayout_4
=
QtWidgets
.
QHBoxLayout
(
self
.
horizontalLayoutWidget_4
)
self
.
horizontalLayout_4
.
setContentsMargins
(
0
,
0
,
0
,
0
)
...
...
@@ -91,12 +91,12 @@ class Ui_MainWindow(object):
self
.
explo_pushbutton_setup_save
.
setObjectName
(
"
explo_pushbutton_setup_save
"
)
self
.
horizontalLayout_4
.
addWidget
(
self
.
explo_pushbutton_setup_save
)
self
.
explo_listwidget_setup_list
=
QtWidgets
.
QListWidget
(
self
.
explo_groupbox_setups
)
self
.
explo_listwidget_setup_list
.
setGeometry
(
QtCore
.
QRect
(
15
,
70
,
2
8
1
,
161
))
self
.
explo_listwidget_setup_list
.
setGeometry
(
QtCore
.
QRect
(
15
,
70
,
2
7
1
,
161
))
self
.
explo_listwidget_setup_list
.
setSelectionBehavior
(
QtWidgets
.
QAbstractItemView
.
SelectRows
)
self
.
explo_listwidget_setup_list
.
setObjectName
(
"
explo_listwidget_setup_list
"
)
self
.
explo_pushbutton_setup_load
=
QtWidgets
.
QPushButton
(
self
.
explo_groupbox_setups
)
self
.
explo_pushbutton_setup_load
.
setEnabled
(
False
)
self
.
explo_pushbutton_setup_load
.
setGeometry
(
QtCore
.
QRect
(
30
1
,
70
,
8
1
,
2
3
))
self
.
explo_pushbutton_setup_load
.
setGeometry
(
QtCore
.
QRect
(
29
1
,
70
,
9
1
,
3
1
))
self
.
explo_pushbutton_setup_load
.
setObjectName
(
"
explo_pushbutton_setup_load
"
)
self
.
tabWidget
.
addTab
(
self
.
tab_explo
,
""
)
self
.
tab_conductcalib
=
QtWidgets
.
QWidget
()
...
...
@@ -178,13 +178,13 @@ class Ui_MainWindow(object):
self
.
tab_pumpcalib
=
QtWidgets
.
QWidget
()
self
.
tab_pumpcalib
.
setObjectName
(
"
tab_pumpcalib
"
)
self
.
pump_combobox_pump
=
QtWidgets
.
QComboBox
(
self
.
tab_pumpcalib
)
self
.
pump_combobox_pump
.
setGeometry
(
QtCore
.
QRect
(
10
,
10
,
1
1
1
,
22
))
self
.
pump_combobox_pump
.
setGeometry
(
QtCore
.
QRect
(
10
,
10
,
1
4
1
,
31
))
self
.
pump_combobox_pump
.
setObjectName
(
"
pump_combobox_pump
"
)
self
.
pump_combobox_pump
.
addItem
(
""
)
self
.
pump_combobox_pump
.
addItem
(
""
)
self
.
pump_combobox_pump
.
addItem
(
""
)
self
.
pump_graphicsview_runs
=
PlotWidget
(
self
.
tab_pumpcalib
)
self
.
pump_graphicsview_runs
.
setGeometry
(
QtCore
.
QRect
(
10
,
4
0
,
831
,
431
))
self
.
pump_graphicsview_runs
.
setGeometry
(
QtCore
.
QRect
(
10
,
5
0
,
831
,
431
))
self
.
pump_graphicsview_runs
.
setObjectName
(
"
pump_graphicsview_runs
"
)
self
.
pump_graphicsview_repro
=
PlotWidget
(
self
.
tab_pumpcalib
)
self
.
pump_graphicsview_repro
.
setGeometry
(
QtCore
.
QRect
(
10
,
490
,
831
,
431
))
...
...
@@ -192,7 +192,7 @@ class Ui_MainWindow(object):
self
.
tabWidget
.
addTab
(
self
.
tab_pumpcalib
,
""
)
MainWindow
.
setCentralWidget
(
self
.
centralwidget
)
self
.
menubar
=
QtWidgets
.
QMenuBar
(
MainWindow
)
self
.
menubar
.
setGeometry
(
QtCore
.
QRect
(
0
,
0
,
1355
,
2
0
))
self
.
menubar
.
setGeometry
(
QtCore
.
QRect
(
0
,
0
,
1355
,
2
6
))
self
.
menubar
.
setObjectName
(
"
menubar
"
)
self
.
menuInstrument
=
QtWidgets
.
QMenu
(
self
.
menubar
)
self
.
menuInstrument
.
setObjectName
(
"
menuInstrument
"
)
...
...
This diff is collapsed.
Click to expand it.
src/main.py
+
1
−
1
View file @
df5dbe12
...
...
@@ -14,7 +14,7 @@ from dataprovider.pumpcalibprovider import PumpCalibProvider
from
uim.conductcalibuim
import
ConductCalibUim
from
uim.explouim
import
ExploUim
from
uim.pumpcalibim
import
PumpCalibUim
from
uim.pumpcalib
u
im
import
PumpCalibUim
########################################################################################################################
# CONFIG
...
...
This diff is collapsed.
Click to expand it.
src/uim/pumpcalibim.py
→
src/uim/pumpcalib
u
im.py
+
41
−
10
View file @
df5dbe12
import
datetime
import
re
from
math
import
atan
,
degrees
import
pyqtgraph
as
pg
from
PyQt5.QtWidgets
import
*
from
PyQt5.QtGui
import
QColor
...
...
@@ -65,19 +66,49 @@ class PumpCalibUim:
self
.
runs_points_list
=
[]
def
__update_runs_plot__
(
self
,
runs_df
:
pd
.
DataFrame
,
coef_df
:
pd
.
DataFrame
)
->
None
:
# Create the color scale
color_map
=
pg
.
ColorMap
(
pos
=
[
runs_df
[
"
calib_id_int
"
].
min
(),
runs_df
[
"
calib_id_int
"
].
max
()],
color
=
[[
0
,
0
,
255
],
[
0
,
255
,
0
]])
brushes
=
[
pg
.
mkBrush
(
color
=
color
)
for
color
in
color_map
.
mapToQColor
(
runs_df
[
"
calib_id_int
"
])]
runs_points
=
pg
.
ScatterPlotItem
(
runs_df
[
"
rpm
"
],
runs_df
[
"
flow
"
],
size
=
5
,
brush
=
brushes
)
self
.
plot_item
.
addItem
(
runs_points
)
# Add legend
# self.plot_item.addLegend((100,60), offset=(70,30))
# self.plot_item.plot([1, 3, 2, 4], pen='r', name='red plot')
# l = pg.LegendItem((100,60), offset=(70,30)) # args are (size, offset)
l
=
pg
.
LegendItem
()
# args are (size, offset)
l
.
setParentItem
(
self
.
plot_item
.
graphicsItem
())
# Note we do NOT call plt.addItem in this case
# Add linear regression line
# self.linear_line = pg.PlotCurveItem()
# plot_item.addItem(self.linear_line)
for
row_id
,
row
in
coef_df
.
iterrows
():
reg_line
=
pg
.
InfiniteLine
(
pos
=
QPointF
(
0
,
row
[
"
intercept
"
]),
angle
=
degrees
(
atan
(
row
[
"
slope
"
])),
pen
=
pg
.
mkPen
(
color
=
color_map
.
mapToQColor
(
row
[
"
calib_id_int
"
])),
name
=
row
[
"
calib_id_str
"
])
self
.
plot_item
.
addItem
(
reg_line
)
# Add runs points
for
calib_id
in
runs_df
[
"
calib_id_int
"
].
unique
():
run_df
=
runs_df
[
runs_df
[
"
calib_id_int
"
]
==
calib_id
]
# brushes = [pg.mkBrush(color=color) for color in color_map.mapToQColor(runs_df["calib_id_int"])]
run_points
=
pg
.
ScatterPlotItem
(
run_df
[
"
rpm
"
],
run_df
[
"
flow
"
],
size
=
6
,
brush
=
color_map
.
mapToQColor
(
calib_id
),
name
=
run_df
[
"
calib_id_str
"
].
unique
())
l
.
addItem
(
run_points
,
run_df
[
"
calib_id_str
"
].
unique
())
self
.
plot_item
.
addItem
(
run_points
)
# Add runs text
# for row_id, row in runs_df.iterrows():
# if row_id != 1:
# continue
# run_text = pg.TextItem(text=row["calib_id_str"],
# # color=color_map.mapToQColor(row["calib_id_int"]),
# anchor=QPointF(row["rpm"], row["flow"]))
# # self.plot_item.getViewBox().disableAutoRange()
# self.plot_item.addItem(run_text)
# # self.plot_item.addItem(run_text, ignoreBounds=True)
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