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
df3c91e6
Commit
df3c91e6
authored
Jul 11, 2018
by
Martin Drechsler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Main change: save and load functions addes.
parent
376b2636
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
46 deletions
+18
-46
myWidgets.py
myWidgets.py
+18
-46
No files found.
myWidgets.py
View file @
df3c91e6
...
...
@@ -14,16 +14,20 @@ from PyQt5.QtWidgets import (QPushButton, QWidget)
#An example of a class
class
anal_control_signal
(
QWidget
):
def
__init__
(
self
,
name
,
channel
):
_registry
=
[]
def
__init__
(
self
,
name
,
channel
,
out_minimum
=
-
10
,
out_maximum
=
10
,
out_step
=
0.1
):
super
()
.
__init__
()
self
.
_registry
.
append
(
self
)
self
.
name
=
name
self
.
ch
=
channel
self
.
initial_value
=
0
self
.
max
=
10
self
.
min
=
-
10
self
.
step
=
0.1
self
.
max
=
out_maximum
self
.
min
=
out_minimum
self
.
step
=
out_step
self
.
siPrefix
=
True
self
.
suffix
=
'V'
...
...
@@ -43,6 +47,14 @@ class anal_control_signal(QWidget):
self
.
scan_direction
=
0
self
.
scan_button
.
clicked
.
connect
(
self
.
doAction
)
self
.
sb
.
sigValueChanging
.
connect
(
self
.
sb_analog_change
)
self
.
spin_boxes
=
[(
'sb'
,
self
.
sb
),
(
'scan_sb_start'
,
self
.
scan_sb_start
),
(
'scan_sb_stop'
,
self
.
scan_sb_stop
),
(
'scan_sb_period'
,
self
.
scan_sb_period
)]
def
sb_analog_change
(
self
):
self
.
AO
.
set_out
(
self
.
sb
.
val
)
def
set_name
(
self
,
name
):
self
.
name
=
name
...
...
@@ -50,15 +62,8 @@ class anal_control_signal(QWidget):
def
set_initial_value
(
self
,
value
):
self
.
initial_value
=
value
def
set_max
(
self
,
value
):
self
.
max
=
value
def
set_min
(
self
,
value
):
self
.
min
=
value
def
set_step
(
self
,
value
):
self
.
step
=
value
def
set_siPrefix
(
self
,
value
):
self
.
siPrefix
=
value
...
...
@@ -114,37 +119,4 @@ class digital_control_signal(QWidget):
self
.
name
=
name
def
set_initial_value
(
self
,
value
):
self
.
initial_value
=
value
"""
class analog_scan:
def __init__(self, signal):
self.signal = signal
self.sb_start = pg.SpinBox(value = 0, bounds=[signal.min, signal.max], step = signal.step, siPrefix = signal.siPrefix, suffix = signal.suffix)
self.sb_stop = pg.SpinBox(value = 0, bounds=[signal.min, signal.max], step = signal.step, siPrefix = signal.siPrefix, suffix = signal.suffix)
self.sb_period = pg.SpinBox(value = 1, bounds=[0, 100], step = 0.1, siPrefix = True, suffix = 's')
self.cb = QtGui.QCheckBox()
self.cb.stateChanged.connect(self.scan)
def scan(self):
ao = self.signal
start, stop, period = self.sb_start.value(), self.sb_stop.value(), self.sb_period.value()
dt = 1e-3
n = period / (2*dt)
voltages = np.linspace(start, stop, n)
i = 0
scanning = self.cb.isChecked()
while(scanning):
while( i<len(voltages)-1 ):
ao.set_out(voltages[i])
i = i + 1
time.sleep(dt)
while(i>0):
ao.set_out(voltages[i])
i = i - 1
time.sleep(dt)
scanning = self.cb.isChecked()
"""
\ No newline at end of file
self
.
initial_value
=
value
\ No newline at end of file
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