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
0ae0b306
Commit
0ae0b306
authored
May 17, 2019
by
Martin Drechsler
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://code.df.uba.ar/martindrech/total_control_app
parents
9b046dd7
5a2ae12c
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
296 additions
and
213 deletions
+296
-213
MCDAQcontrolsignals.py
MCDAQcontrolsignals.py
+15
-4
cameraGui.py
cameraGui.py
+2
-0
controlGui.py
controlGui.py
+3
-4
andorzyla.py
drivers/andorzyla.py
+2
-1
main.py
main.py
+16
-16
myToolbar.py
resources/myToolbar.py
+29
-4
storage.py
resources/storage.py
+16
-2
webcams.py
resources/webcams.py
+2
-2
cameraParameterTree.py
subclasses/cameraParameterTree.py
+1
-1
controllayouts.py
subclasses/controllayouts.py
+206
-177
zylaCameraWorker.py
zylaCameraWorker.py
+4
-2
No files found.
MCDAQcontrolsignals.py
View file @
0ae0b306
...
...
@@ -2,7 +2,11 @@
"""
Here the class of control signals are created. There are two types: analog and digital.
"""
from
drivers.ADoutputs
import
daq_AO
,
daq_DO
import
sys
if
sys
.
platform
==
'linux'
:
from
drivers.ADoutputs_linux
import
daq_AO
,
daq_DO
else
:
from
drivers.ADoutputs
import
daq_AO
,
daq_DO
from
PyQt5
import
QtCore
from
subclasses.controllayouts
import
LaserControlLayout
from
subclasses.controllayouts
import
LaserScanLayout
...
...
@@ -104,7 +108,7 @@ class anal_control_signal(QtCore.QObject):
class
digital_control_signal
(
QtCore
.
QObject
):
_registry
=
[]
def
__init__
(
self
,
name
,
channel
,
inverse
=
Fals
e
):
def
__init__
(
self
,
name
,
channel
,
inverse
=
Tru
e
):
super
()
.
__init__
()
self
.
_registry
.
append
(
self
)
...
...
@@ -112,6 +116,7 @@ class digital_control_signal(QtCore.QObject):
self
.
ch
=
channel
self
.
initial_value
=
0
self
.
DO
=
daq_DO
(
self
.
ch
)
self
.
inverse
=
inverse
def
make_connections
(
self
,
frontend
):
...
...
@@ -122,6 +127,12 @@ class digital_control_signal(QtCore.QObject):
@
QtCore
.
pyqtSlot
(
int
)
def
when_change_digital
(
self
,
state
):
if
state
==
QtCore
.
Qt
.
Checked
:
self
.
DO
.
set_out
(
True
)
if
self
.
inverse
:
self
.
DO
.
set_out
(
True
)
else
:
self
.
DO
.
set_out
(
False
)
else
:
self
.
DO
.
set_out
(
False
)
\ No newline at end of file
if
self
.
inverse
:
self
.
DO
.
set_out
(
False
)
else
:
self
.
DO
.
set_out
(
True
)
\ No newline at end of file
cameraGui.py
View file @
0ae0b306
...
...
@@ -89,6 +89,7 @@ class CameraGuiMainWindow(QMainWindow):
# image layout
self
.
img
=
pg
.
ImageItem
(
border
=
"w"
)
self
.
img
.
rotate
(
90
)
self
.
imv
=
pg
.
ImageView
(
imageItem
=
self
.
img
,
view
=
self
.
imageView
)
self
.
imv
.
ui
.
roiBtn
.
setText
(
'Useless'
)
self
.
dCameraView
.
addWidget
(
self
.
imv
)
...
...
@@ -271,6 +272,7 @@ class CameraGuiMainWindow(QMainWindow):
#@QtCore.pyqtSlot()
def
measurement_ending
(
self
):
print
(
'entering gui measure ending'
)
self
.
cameraButton
.
setEnabled
(
True
)
self
.
measurementFrame
.
startMeasureButton
.
setEnabled
(
True
)
self
.
measurementFrame
.
saveMeasureButton
.
setEnabled
(
True
)
...
...
controlGui.py
View file @
0ae0b306
...
...
@@ -56,12 +56,12 @@ class ControlGui(QtGui.QFrame):
self
.
laser397_control_layout
=
LaserControlLayout
(
'397'
,
checkboxes
=
[
'shutter397'
],
spinboxes
=
[
'piezoA397'
,
'piezoB397'
])
self
.
laser397_scan_layout
=
LaserScanLayout
(
name
=
'piezo
A
397'
,
signal_to_scan_layout
=
self
.
laser397_control_layout
)
self
.
laser397_scan_layout
=
LaserScanLayout
(
name
=
'piezo
B
397'
,
signal_to_scan_layout
=
self
.
laser397_control_layout
)
self
.
dock_397
.
addWidget
(
self
.
laser397_control_layout
,
0
,
0
)
self
.
dock_397_scan
.
addWidget
(
self
.
laser397_scan_layout
,
0
,
1
)
self
.
laser866_control_layout
=
LaserControlLayout
(
'866'
,
checkboxes
=
[
'shutter866'
,
'shut
er866WM'
],
spinboxes
=
[
'piezoA866'
,
'piezoB
866'
])
self
.
laser866_scan_layout
=
LaserScanLayout
(
name
=
'piezo
A
866'
,
signal_to_scan_layout
=
self
.
laser866_control_layout
)
self
.
laser866_control_layout
=
LaserControlLayout
(
'866'
,
checkboxes
=
[
'shutter866'
,
'shut
ter866WM'
],
spinboxes
=
[
'piezoA866'
,
'piezoB866'
],
blinkCheckbox
=
[
'shutter
866'
])
self
.
laser866_scan_layout
=
LaserScanLayout
(
name
=
'piezo
B
866'
,
signal_to_scan_layout
=
self
.
laser866_control_layout
)
self
.
dock_866
.
addWidget
(
self
.
laser866_control_layout
)
self
.
dock_866_scan
.
addWidget
(
self
.
laser866_scan_layout
)
...
...
@@ -87,7 +87,6 @@ class ControlGui(QtGui.QFrame):
self
.
electrodes_control_layout
.
addWidget
(
self
.
electrodes_control_layout
.
spinboxes
[
'compExYb'
],
1
,
5
)
self
.
toolbar
=
myToolbarMenu
(
self
)
self
.
toolbar
.
load
()
self
.
autosave_timer
=
QtCore
.
QTimer
()
self
.
autosave_timer
.
timeout
.
connect
(
lambda
:
self
.
toolbar
.
save
(
'config.ini'
))
self
.
autosave_timer
.
start
(
10000
)
...
...
drivers/andorzyla.py
View file @
0ae0b306
...
...
@@ -749,10 +749,11 @@ class AndorBase(SDK3Camera):
def
live_acquisition_loop
(
self
):
t
=
threading
.
currentThread
()
timeout
=
self
.
ExposureTime
.
getValue
()
*
5000
while
getattr
(
t
,
"do_run"
,
True
):
a_s
,
px_encoding
,
xs
,
ys
,
bufs
=
self
.
_live_acq_auxs
try
:
pData
,
lData
=
SDK3
.
WaitBuffer
(
self
.
handle
,
10000
)
pData
,
lData
=
SDK3
.
WaitBuffer
(
self
.
handle
,
int
(
timeout
)
)
except
:
return
img
=
create_aligned_array
(
xs
*
ys
,
'uint16'
)
...
...
main.py
View file @
0ae0b306
...
...
@@ -5,7 +5,6 @@ from drivers.dummyAndor import AndorZyla
from
cameraGui
import
CameraGuiMainWindow
from
zylaCameraWorker
import
CameraWorker
#from measurement import MeasurementWorker, MeasurementGui
from
MCDAQcontrolsignals
import
anal_control_signal
from
MCDAQcontrolsignals
import
digital_control_signal
from
controlGui
import
ControlGui
...
...
@@ -20,24 +19,24 @@ if __name__ == "__main__":
camera
=
AndorZyla
(
0
)
piezoA397
=
anal_control_signal
(
'piezoA397'
,
channel
=
0
,
ao_type
=
'cavity_piezo'
,
out_minimum
=
0
,
out_maximum
=
4
)
piezoB397
=
anal_control_signal
(
'piezoB397'
,
channel
=
1
,
ao_type
=
'cavity_piezo'
)
piezoA866
=
anal_control_signal
(
'piezoA866'
,
channel
=
2
,
ao_type
=
'cavity_piezo'
,
out_minimum
=
0
,
out_maximum
=
4
)
piezoB866
=
anal_control_signal
(
'piezoB866'
,
channel
=
3
,
ao_type
=
'cavity_piezo'
)
piezo423
=
anal_control_signal
(
'piezo423'
,
channel
=
4
,
ao_type
=
'laser_piezo'
)
piezoA397
=
anal_control_signal
(
'piezoA397'
,
channel
=
13
,
ao_type
=
'cavity_piezo'
,
out_minimum
=
0
,
out_maximum
=
4
)
piezoB397
=
anal_control_signal
(
'piezoB397'
,
channel
=
7
,
ao_type
=
'cavity_piezo'
)
piezoA866
=
anal_control_signal
(
'piezoA866'
,
channel
=
14
,
ao_type
=
'cavity_piezo'
,
out_minimum
=
0
,
out_maximum
=
4
)
piezoB866
=
anal_control_signal
(
'piezoB866'
,
channel
=
9
,
ao_type
=
'cavity_piezo'
,
out_minimum
=
-
2
,
out_maximum
=
10
)
piezo423
=
anal_control_signal
(
'piezo423'
,
channel
=
3
,
ao_type
=
'laser_piezo'
)
trapDCA
=
anal_control_signal
(
'dcA'
,
channel
=
5
,
ao_type
=
'electrode'
)
trapDCB
=
anal_control_signal
(
'dcB'
,
channel
=
6
,
ao_type
=
'electrode'
)
trapCOMPC
=
anal_control_signal
(
'compC'
,
channel
=
7
,
ao_type
=
'electrode'
)
trapCOMPD
=
anal_control_signal
(
'compD'
,
channel
=
8
,
ao_type
=
'electrode'
)
trapOven
=
anal_control_signal
(
'compOven'
,
channel
=
9
,
ao_type
=
'electrode'
)
trapExYb
=
anal_control_signal
(
'compExYb'
,
channel
=
10
,
ao_type
=
'electrode'
)
trapDCA
=
anal_control_signal
(
'dcA'
,
channel
=
2
,
ao_type
=
'electrode'
)
trapDCB
=
anal_control_signal
(
'dcB'
,
channel
=
1
,
ao_type
=
'electrode'
)
trapCOMPC
=
anal_control_signal
(
'compC'
,
channel
=
4
,
ao_type
=
'electrode'
)
trapCOMPD
=
anal_control_signal
(
'compD'
,
channel
=
5
,
ao_type
=
'electrode'
)
trapOven
=
anal_control_signal
(
'compOven'
,
channel
=
0
,
ao_type
=
'electrode'
)
trapExYb
=
anal_control_signal
(
'compExYb'
,
channel
=
6
,
ao_type
=
'electrode'
)
shutter866
=
digital_control_signal
(
'shutter866'
,
channel
=
0
)
shutter397
=
digital_control_signal
(
'shutter397'
,
channel
=
1
)
shutter423
=
digital_control_signal
(
'shutter423'
,
channel
=
2
)
shutter866WM
=
digital_control_signal
(
'shutter866WM'
,
channel
=
3
)
shutter866
=
digital_control_signal
(
'shutter866'
,
channel
=
2
,
inverse
=
False
)
shutter397
=
digital_control_signal
(
'shutter397'
,
channel
=
0
,
inverse
=
False
)
shutter423
=
digital_control_signal
(
'shutter423'
,
channel
=
1
,
inverse
=
False
)
shutter866WM
=
digital_control_signal
(
'shutter866WM'
,
channel
=
3
,
inverse
=
False
)
controlGui
=
ControlGui
()
mcDAQthread
=
QtCore
.
QThread
()
...
...
@@ -65,5 +64,6 @@ if __name__ == "__main__":
cameraThread
.
start
()
mcDAQthread
.
start
()
controlGui
.
toolbar
.
load
()
sys
.
exit
(
app
.
exec_
())
resources/myToolbar.py
View file @
0ae0b306
...
...
@@ -7,10 +7,9 @@ Created on Thu Jul 5 12:17:30 2018
from
PyQt5.QtCore
import
QSettings
from
PyQt5
import
QtGui
from
PyQt5.QtWidgets
import
QAction
,
QFileDialog
,
QInputDialog
,
QWidget
from
PyQt5.QtWidgets
import
QAction
,
QFileDialog
,
QWidget
from
threading
import
Thread
from
subclasses.controllayouts
import
LaserControlLayout
from
subclasses.controllayouts
import
LaserControlLayout
,
LaserScanLayout
#%%
class
myToolbarMenu
(
QWidget
):
...
...
@@ -23,14 +22,29 @@ class myToolbarMenu(QWidget):
self
.
MainGuiWindow
=
win
self
.
sbsDicc
=
dict
()
self
.
cbsDicc
=
dict
()
self
.
incorporate_toolbar
(
self
.
MainGuiWindow
)
self
.
fillSpinBoxesDict
()
self
.
fillCheckBoxesDict
()
def
fillSpinBoxesDict
(
self
):
for
l
in
LaserControlLayout
.
_registry
:
for
sb_name
in
l
.
spinboxes
:
self
.
sbsDicc
[
sb_name
]
=
l
.
spinboxes
[
sb_name
]
for
l
in
LaserScanLayout
.
_registry
:
for
sb_name
in
l
.
spinboxes
:
self
.
sbsDicc
[
'_'
.
join
([
l
.
name
,
sb_name
])]
=
l
.
spinboxes
[
sb_name
]
def
fillCheckBoxesDict
(
self
):
for
l
in
LaserControlLayout
.
_registry
:
for
cb_name
in
l
.
checkboxes
:
self
.
cbsDicc
[
cb_name
]
=
l
.
checkboxes
[
cb_name
]
def
createElectrodesDict
(
self
):
d
=
dict
()
...
...
@@ -83,6 +97,9 @@ class myToolbarMenu(QWidget):
for
text
,
spinb
in
self
.
sbsDicc
.
items
():
settings
.
setValue
(
text
,
spinb
.
value
())
for
text
,
checkb
in
self
.
cbsDicc
.
items
():
settings
.
setValue
(
text
,
checkb
.
isChecked
())
settings
.
endGroup
()
...
...
@@ -98,6 +115,14 @@ class myToolbarMenu(QWidget):
spinb
.
setValue
(
float
(
spinbox_saved_value
)
)
except
TypeError
:
spinb
.
setValue
(
float
(
spinb
.
value
())
)
for
text
,
checkb
in
self
.
cbsDicc
.
items
():
checkbox_saved_value
=
settings
.
value
(
text
)
if
checkbox_saved_value
in
[
'true'
,
'True'
,
True
]:
checkb
.
setChecked
(
True
)
else
:
checkb
.
setChecked
(
False
)
settings
.
endGroup
()
def
save_as
(
self
,
window
):
...
...
resources/storage.py
View file @
0ae0b306
...
...
@@ -22,13 +22,19 @@ class Storage(object):
Class to handle data saving.
"""
def
__init__
(
self
):
self
.
directory
=
'.'
"""
By default, directory is set to the current directory.
"""
self
.
directory
=
os
.
getcwd
()
def
set_directory
(
self
,
directory
):
self
.
directory
=
directory
def
create_data_file
(
self
,
*
args
):
"""
Creates a file to store data. Name is set automatically.
*args should be strings, with the column titles of the data to be saved.
"""
saving_directory
=
"/"
.
join
([
self
.
directory
,
self
.
get_date_string
()])
if
not
os
.
path
.
exists
(
saving_directory
):
os
.
makedirs
(
saving_directory
)
...
...
@@ -51,12 +57,20 @@ class Storage(object):
def
append_data_to_current_file
(
self
,
row
):
"""
This will append a row to the last data file created.
row should be a list with the values to append.
"""
with
open
(
self
.
get_current_data_filename
(),
'ab'
)
as
f
:
#data = np.column_stack(args)
np
.
savetxt
(
f
,
[
row
])
f
.
flush
()
def
append_metadata_to_current_file
(
self
,
*
args
):
"""
This appends metadata to the last metadata file created.
*args should be dictionaries, each of them will be stored.
"""
for
arg
in
args
:
for
key
,
value
in
arg
.
items
():
with
open
(
self
.
get_current_metadata_filename
(),
'a'
)
as
f
:
...
...
resources/webcams.py
View file @
0ae0b306
...
...
@@ -7,8 +7,8 @@ This is a temporary script file.
import
cv2
cap
=
cv2
.
VideoCapture
(
0
)
cap1
=
cv2
.
VideoCapture
(
1
)
cap
=
cv2
.
VideoCapture
(
2
)
cap1
=
cv2
.
VideoCapture
(
3
)
while
(
True
):
# Capture frame-by-frame
...
...
subclasses/cameraParameterTree.py
View file @
0ae0b306
...
...
@@ -26,7 +26,7 @@ class BasicAcquisitonParameters(pTypes.GroupParameter):
[
'12-bit (high well capacity)'
,
'12-bit (low noise)'
,
'16-bit (low noise & high well capacity)'
]}
)
self
.
addChild
({
'name'
:
'Readout Time'
,
'type'
:
'float'
,
'value'
:
0
,
'readonly'
:
True
})
self
.
addChild
({
'name'
:
'Spurious Noise Filter'
,
'type'
:
'list'
,
'values'
:
[
'True'
,
'False'
]})
self
.
addChild
({
'name'
:
'Spurious Noise Filter'
,
'type'
:
'list'
,
'values'
:
[
True
,
False
]})
self
.
addChild
({
'name'
:
'Sensor Temperature'
,
'type'
:
'float'
,
'value'
:
25
,
'readonly'
:
True
})
self
.
addChild
({
'name'
:
'Temperature Status'
,
'type'
:
'str'
,
'value'
:
'?'
,
'readonly'
:
True
})
...
...
subclasses/controllayouts.py
View file @
0ae0b306
This diff is collapsed.
Click to expand it.
zylaCameraWorker.py
View file @
0ae0b306
...
...
@@ -110,9 +110,9 @@ class CameraWorker(QtCore.QObject):
)
self
.
cam
.
SimplePreAmpGainControl
.
setString
(
params
.
child
(
'Basic acq parameters'
)
.
child
(
'Dynamic Range'
)
.
value
()
)
)
self
.
cam
.
SpuriousNoiseFilter
.
setValue
(
params
.
child
(
'Basic acq parameters'
)
.
child
(
'Spurious Noise Filter'
)
.
value
()
params
.
child
(
'Basic acq parameters'
)
.
child
(
'Spurious Noise Filter'
)
.
value
()
==
'True'
)
@
QtCore
.
pyqtSlot
(
int
)
...
...
@@ -157,11 +157,13 @@ class CameraWorker(QtCore.QObject):
def
simple_scan_measurement_end
(
self
):
self
.
_stop_acquisition_loop
()
self
.
cam
.
TriggerMode
.
setString
(
'Internal'
)
self
.
cam
.
helper
.
imageAquiredSignal
.
disconnect
(
self
.
new_image_acquired_with_trigger
)
self
.
cam
.
helper
.
imageAquiredSignal
.
connect
(
self
.
new_image_acquired
)
self
.
measurementEndingSignal
.
emit
()
print
(
'exiting scan ending in worker'
)
def
simple_scan_measurement_step
(
self
):
try
:
...
...
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