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
e5c1f542
Commit
e5c1f542
authored
May 01, 2019
by
Martin Drechsler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some changes
parent
63640556
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
38 deletions
+36
-38
cameraGui.py
cameraGui.py
+19
-20
zylaCameraWorker.py
zylaCameraWorker.py
+17
-18
No files found.
cameraGui.py
View file @
e5c1f542
...
...
@@ -46,17 +46,12 @@ class CameraGuiMainWindow(QMainWindow):
self
.
d2
=
dockarea
.
Dock
(
"Zyla Camera Analysis"
)
self
.
d3
=
dockarea
.
Dock
(
"Zyla Camera Control"
)
self
.
d4
=
dockarea
.
Dock
(
"Measurement and saving"
)
self
.
area
.
addDock
(
self
.
d1
)
self
.
area
.
addDock
(
self
.
d2
,
"left"
,
self
.
d1
)
self
.
area
.
addDock
(
self
.
d3
,
"right"
,
self
.
d1
)
self
.
area
.
addDock
(
self
.
d4
,
"bottom"
,
self
.
d3
)
## button spinbox and label
# button spinbox and label
self
.
cameraButton
=
QPushButton
(
"Start Acquisition"
)
self
.
isCameraAcquiring
=
False
self
.
d3
.
addWidget
(
self
.
cameraButton
)
...
...
@@ -85,7 +80,7 @@ class CameraGuiMainWindow(QMainWindow):
# self.p.setRange(xRange = (0, 10), yRange = (0, 255))
self
.
curve
=
self
.
p
.
plot
(
pen
=
"y"
)
#
#
rOI
# rOI
self
.
rois
=
[]
self
.
rois
.
append
(
CustomRectangularROI
([
0
,
0
]))
for
r
in
self
.
rois
:
...
...
@@ -99,15 +94,15 @@ class CameraGuiMainWindow(QMainWindow):
self
.
_initialize_image
()
def
make_connections
(
self
,
backend
):
#
#
backend connections
#
backend connections
backend
.
imageReadySignal
.
connect
(
self
.
updateImage
)
#
#
internal connections
#
internal connections
self
.
frames_checker_timer
.
timeout
.
connect
(
self
.
frame_counter
)
self
.
cameraButton
.
clicked
.
connect
(
self
.
camera_button_pressed
)
self
.
cameraButton
.
clicked
.
connect
(
self
.
camera_button_pressed
)
self
.
console
=
console
.
ConsoleWidget
(
namespace
=
{
'np'
:
np
,
'cam'
:
backend
.
cam
,
'roi'
:
self
.
rois
[
0
]})
self
.
console
=
console
.
ConsoleWidget
(
namespace
=
{
'np'
:
np
,
'cam'
:
backend
.
cam
,
'roi'
:
self
.
rois
[
0
]}
)
self
.
d4
.
addWidget
(
self
.
console
)
def
camera_button_pressed
(
self
):
...
...
@@ -123,8 +118,9 @@ class CameraGuiMainWindow(QMainWindow):
self
.
previous_frame_index
=
0
self
.
frames_checker_timer
.
start
(
1000
)
self
.
isCameraAcquiring
=
True
def
_initialize_image
(
self
):
#
#
lock the aspect ratio so pixels are always square
# lock the aspect ratio so pixels are always square
self
.
view
.
setAspectLocked
(
True
)
self
.
view
.
addItem
(
self
.
img
)
...
...
@@ -145,7 +141,10 @@ class CameraGuiMainWindow(QMainWindow):
old_size
=
self
.
current_image_size
aux_dict
=
{
'1x1'
:
2048
,
'2x2'
:
1024
,
'4x4'
:
512
,
'8x8'
:
256
}
new_size
=
aux_dict
[
self
.
param_tree
.
p
.
child
(
'Basic acq parameters'
)
.
child
(
'Pixel Binning'
)
.
value
()]
new_size
=
aux_dict
[
self
.
param_tree
.
p
.
child
(
'Basic acq parameters'
)
.
child
(
'Pixel Binning'
)
.
value
()
]
print
(
'sizes:'
,
old_size
,
new_size
)
for
roi
in
self
.
rois
:
x
,
y
,
sx
,
sy
=
roi
.
pos
()[
0
],
roi
.
pos
()[
1
],
roi
.
size
()[
0
],
roi
.
size
()[
1
]
...
...
@@ -164,7 +163,7 @@ class CameraGuiMainWindow(QMainWindow):
)
# n = 1024
self
.
img
.
setImage
(
image
,
autoDownsample
=
True
)
self
.
img
.
setImage
(
image
,
autoDownsample
=
True
)
self
.
updateRois
()
self
.
frame_index
=
self
.
frame_index
+
1
self
.
current_image_size
=
image
.
shape
[
0
]
...
...
zylaCameraWorker.py
View file @
e5c1f542
...
...
@@ -11,7 +11,7 @@ Created on Thu Apr 4 11:10:20 2019
import
numpy
as
np
from
PyQt5
import
QtCore
#from drivers.andorzyla import AndorZyla
#
from drivers.andorzyla import AndorZyla
from
dummyAndor
import
AndorZyla
import
threading
...
...
@@ -24,7 +24,6 @@ class CameraWorker(QtCore.QObject):
self
.
cam
=
AndorZyla
(
0
)
self
.
cam
.
Init
()
#self.cam.ExposureTime.setValue(0.1)
print
(
"camera worker initialized"
)
def
make_connections
(
self
,
frontend
):
...
...
@@ -37,7 +36,7 @@ class CameraWorker(QtCore.QObject):
def
__del__
(
self
):
print
(
"adios camera worker"
)
#@QtCore.pyqtSlot()
#
@QtCore.pyqtSlot()
def
run
(
self
,
params
):
if
self
.
cam
.
CameraAcquiring
.
getValue
():
self
.
_stop_acquisition_loop
()
...
...
@@ -46,7 +45,9 @@ class CameraWorker(QtCore.QObject):
else
:
self
.
_configure_acq_parameters
(
params
)
self
.
_start_acquisition_loop
()
self
.
acq_thread
=
threading
.
Thread
(
target
=
self
.
cam
.
live_acquisition_loop
)
self
.
acq_thread
=
threading
.
Thread
(
target
=
self
.
cam
.
live_acquisition_loop
)
self
.
acq_thread
.
start
()
print
(
"acquisiting now starting"
)
...
...
@@ -62,24 +63,22 @@ class CameraWorker(QtCore.QObject):
self
.
cam
.
AcquisitionStop
()
self
.
cam
.
_flush
()
def
_configure_acq_parameters
(
self
,
params
):
print
(
'Acq parameters: '
)
for
p
in
params
.
children
()[
0
]
.
children
():
print
(
p
.
name
(),
p
.
value
())
params
.
child
(
'Basic acq parameters'
)
.
child
(
'Camera name'
)
.
setValue
(
self
.
cam
.
CameraModel
.
getValue
())
self
.
cam
.
ExposureTime
.
setValue
(
params
.
child
(
'Basic acq parameters'
)
.
child
(
'Exposure Time'
)
.
value
()
)
self
.
cam
.
FrameRate
.
setValue
(
self
.
cam
.
FrameRate
.
max
()
params
.
child
(
'Basic acq parameters'
)
.
child
(
'Camera name'
)
.
setValue
(
self
.
cam
.
CameraModel
.
getValue
())
self
.
cam
.
ExposureTime
.
setValue
(
params
.
child
(
'Basic acq parameters'
)
.
child
(
'Exposure Time'
)
.
value
()
)
params
.
child
(
'Basic acq parameters'
)
.
child
(
'Frame Rate'
)
.
setValue
(
self
.
cam
.
FrameRate
.
getValue
())
self
.
cam
.
AOIBinning
.
setString
(
params
.
child
(
'Basic acq parameters'
)
.
child
(
'Pixel Binning'
)
.
value
()
self
.
cam
.
FrameRate
.
setValue
(
self
.
cam
.
FrameRate
.
max
())
params
.
child
(
'Basic acq parameters'
)
.
child
(
'Frame Rate'
)
.
setValue
(
self
.
cam
.
FrameRate
.
getValue
())
self
.
cam
.
AOIBinning
.
setString
(
params
.
child
(
'Basic acq parameters'
)
.
child
(
'Pixel Binning'
)
.
value
()
)
@
QtCore
.
pyqtSlot
(
int
)
def
new_image_acquired
(
self
,
acq_index
):
self
.
imageReadySignal
.
emit
(
self
.
cam
.
acq_queue
.
get
(),
acq_index
)
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