Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
total_control_app
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Martin Drechsler
total_control_app
Commits
fdc8f820
Commit
fdc8f820
authored
May 15, 2019
by
Martin Drechsler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rolling examples
parent
e0874f10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
122 additions
and
0 deletions
+122
-0
rolling1.py
examples/rolling1.py
+56
-0
rolling_rois.py
examples/rolling_rois.py
+66
-0
No files found.
examples/rolling1.py
0 → 100644
View file @
fdc8f820
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun May 12 20:54:18 2019
@author: martindrech
"""
# -*- coding: utf-8 -*-
"""
Various methods of drawing scrolling plots.
"""
import
pyqtgraph
as
pg
from
pyqtgraph.Qt
import
QtCore
,
QtGui
import
numpy
as
np
from
PyQt5
import
QtGui
import
sys
app
=
QtGui
.
QApplication
(
sys
.
argv
)
win
=
pg
.
GraphicsLayoutWidget
()
win
.
setWindowTitle
(
'pyqtgraph example: Scrolling Plots'
)
# 1) Simplest approach -- update data in the array such that plot appears to scroll
# In these examples, the array size is fixed.
p1
=
win
.
addPlot
()
p2
=
win
.
addPlot
()
#data1 = np.random.normal(size=2000)
data1
=
np
.
zeros
(
1000
)
curve1
=
p1
.
plot
(
data1
)
curve2
=
p2
.
plot
(
data1
)
ptr1
=
0
def
update1
():
global
data1
,
ptr1
data1
=
np
.
roll
(
data1
,
-
1
)
# shift data in the array one sample left
data1
[
-
1
]
=
5
+
np
.
random
.
rand
()
# (see also: np.roll)
curve1
.
setData
(
data1
)
ptr1
+=
1
curve2
.
setData
(
data1
)
curve2
.
setPos
(
ptr1
,
0
)
def
update
():
update1
()
timer
=
pg
.
QtCore
.
QTimer
()
timer
.
timeout
.
connect
(
update
)
timer
.
start
(
50
)
win
.
show
()
## Start Qt event loop unless running in interactive mode or using pyside.
if
__name__
==
'__main__'
:
import
sys
if
(
sys
.
flags
.
interactive
!=
1
)
or
not
hasattr
(
QtCore
,
'PYQT_VERSION'
):
QtGui
.
QApplication
.
instance
()
.
exec_
()
examples/rolling_rois.py
0 → 100644
View file @
fdc8f820
# -*- coding: utf-8 -*-
"""
Various methods of drawing scrolling plots.
"""
import
pyqtgraph
as
pg
from
pyqtgraph.Qt
import
QtCore
,
QtGui
import
numpy
as
np
from
PyQt5
import
QtGui
import
sys
app
=
QtGui
.
QApplication
(
sys
.
argv
)
win
=
pg
.
GraphicsLayoutWidget
()
win
.
setWindowTitle
(
'pyqtgraph example: Scrolling Plots'
)
# 2) Allow data to accumulate. In these examples, the array doubles in length
# whenever it is full.
win
.
nextRow
()
p3
=
win
.
addPlot
()
p4
=
win
.
addPlot
()
# Use automatic downsampling and clipping to reduce the drawing load
p3
.
setDownsampling
(
mode
=
'peak'
)
p4
.
setDownsampling
(
mode
=
'peak'
)
p3
.
setClipToView
(
True
)
p4
.
setClipToView
(
True
)
p3
.
setRange
(
xRange
=
[
-
200
,
0
])
p3
.
setLimits
(
xMax
=
0
)
curve3
=
p3
.
plot
()
curve4
=
p4
.
plot
()
data3
=
np
.
empty
(
200
)
ptr3
=
0
def
update1
():
global
data3
,
ptr3
data3
[
ptr3
]
=
5
*
np
.
sin
(
ptr3
/
5
)
+
np
.
random
.
normal
()
ptr3
+=
1
if
ptr3
>=
data3
.
shape
[
0
]:
tmp
=
data3
data3
=
np
.
empty
(
data3
.
shape
[
0
]
*
2
)
data3
[:
tmp
.
shape
[
0
]]
=
tmp
curve3
.
setData
(
data3
[:
ptr3
])
curve3
.
setPos
(
-
ptr3
,
0
)
if
ptr3
<
100
:
curve4
.
setData
(
data3
[:
ptr3
])
else
:
curve4
.
setData
(
data3
[
ptr3
-
100
:
ptr3
])
timer
=
pg
.
QtCore
.
QTimer
()
timer
.
timeout
.
connect
(
update1
)
timer
.
start
(
50
)
win
.
show
()
## Start Qt event loop unless running in interactive mode or using pyside.
if
__name__
==
'__main__'
:
import
sys
if
(
sys
.
flags
.
interactive
!=
1
)
or
not
hasattr
(
QtCore
,
'PYQT_VERSION'
):
QtGui
.
QApplication
.
instance
()
.
exec_
()
Write
Preview
Markdown
is supported
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