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
e54ea7ca
Commit
e54ea7ca
authored
Apr 23, 2019
by
Martin Drechsler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Now it works with the Zyla, maybe not with the dummy.
parent
07ac6e35
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
18 deletions
+32
-18
cameraGui.py
cameraGui.py
+8
-3
cameraParameterTree.py
cameraParameterTree.py
+9
-10
andorzyla.py
drivers/andorzyla.py
+3
-0
dummyAndor.py
dummyAndor.py
+4
-1
zylaCameraWorker.py
zylaCameraWorker.py
+8
-4
No files found.
cameraGui.py
View file @
e54ea7ca
...
@@ -11,6 +11,8 @@ from PyQt5.QtWidgets import QMainWindow, QPushButton, QLabel
...
@@ -11,6 +11,8 @@ from PyQt5.QtWidgets import QMainWindow, QPushButton, QLabel
from
pyqtgraph.Qt
import
QtGui
,
QtCore
from
pyqtgraph.Qt
import
QtGui
,
QtCore
from
pyqtgraph
import
dockarea
from
pyqtgraph
import
dockarea
import
pyqtgraph
as
pg
import
pyqtgraph
as
pg
from
pyqtgraph
import
console
from
pyqtgraph_sublasses
import
CustomRectangularROI
from
zylaCameraWorker
import
CameraWorker
from
zylaCameraWorker
import
CameraWorker
from
cameraParameterTree
import
CameraParameterTree
from
cameraParameterTree
import
CameraParameterTree
...
@@ -61,7 +63,7 @@ class GuiMainWindow(QMainWindow):
...
@@ -61,7 +63,7 @@ class GuiMainWindow(QMainWindow):
self
.
label
=
QLabel
(
"Counter of frames"
)
self
.
label
=
QLabel
(
"Counter of frames"
)
self
.
d1
.
addWidget
(
self
.
label
)
self
.
d1
.
addWidget
(
self
.
label
)
self
.
param_tree
=
CameraParameterTree
()
self
.
param_tree
=
CameraParameterTree
()
self
.
d3
.
addWidget
(
self
.
param_tree
.
t
)
self
.
d3
.
addWidget
(
self
.
param_tree
.
t
)
...
@@ -86,7 +88,7 @@ class GuiMainWindow(QMainWindow):
...
@@ -86,7 +88,7 @@ class GuiMainWindow(QMainWindow):
## rOI
## rOI
self
.
rois
=
[]
self
.
rois
=
[]
self
.
rois
.
append
(
pg
.
TestROI
([
0
,
0
],
[
10
,
10
],
pen
=
(
0
,
9
)
))
self
.
rois
.
append
(
CustomRectangularROI
([
0
,
0
]
))
for
r
in
self
.
rois
:
for
r
in
self
.
rois
:
self
.
view
.
addItem
(
r
)
self
.
view
.
addItem
(
r
)
# r.sigRegionChanged.connect(self.updateRoi)
# r.sigRegionChanged.connect(self.updateRoi)
...
@@ -105,6 +107,9 @@ class GuiMainWindow(QMainWindow):
...
@@ -105,6 +107,9 @@ class GuiMainWindow(QMainWindow):
self
.
camera_button_pressed
self
.
camera_button_pressed
)
)
self
.
console
=
console
.
ConsoleWidget
(
namespace
=
{
'np'
:
np
,
'cam'
:
backend
.
cam
})
self
.
d4
.
addWidget
(
self
.
console
)
def
camera_button_pressed
(
self
):
def
camera_button_pressed
(
self
):
if
self
.
isCameraAcquiring
:
if
self
.
isCameraAcquiring
:
...
@@ -136,7 +141,7 @@ class GuiMainWindow(QMainWindow):
...
@@ -136,7 +141,7 @@ class GuiMainWindow(QMainWindow):
self
.
ROIdata
[
self
.
iROIdata
]
=
self
.
newData
self
.
ROIdata
[
self
.
iROIdata
]
=
self
.
newData
self
.
iROIdata
=
np
.
mod
(
self
.
frame_index
+
1
,
len
(
self
.
ROIdata
))
self
.
iROIdata
=
np
.
mod
(
self
.
frame_index
+
1
,
len
(
self
.
ROIdata
))
self
.
curve
.
setData
(
self
.
ROIdata
)
self
.
curve
.
setData
(
self
.
ROIdata
)
@
QtCore
.
pyqtSlot
(
np
.
ndarray
,
int
)
@
QtCore
.
pyqtSlot
(
np
.
ndarray
,
int
)
def
updateImage
(
self
,
image
,
acq_index
):
def
updateImage
(
self
,
image
,
acq_index
):
...
...
cameraParameterTree.py
View file @
e54ea7ca
...
@@ -29,31 +29,30 @@ class BasicAcquisitonParameters(pTypes.GroupParameter):
...
@@ -29,31 +29,30 @@ class BasicAcquisitonParameters(pTypes.GroupParameter):
self
.
addChild
({
'name'
:
'Pixel Binning'
,
'type'
:
'list'
,
'values'
:
[
'1x1'
,
'2x2'
,
'4x4'
,
'8x8'
]})
self
.
addChild
({
'name'
:
'Pixel Binning'
,
'type'
:
'list'
,
'values'
:
[
'1x1'
,
'2x2'
,
'4x4'
,
'8x8'
]})
self
.
addChild
({
'name'
:
'Image Area'
,
'type'
:
'list'
,
'values'
:
[
'2048x2048'
,
'1024x1024'
,
'512x512'
,
'256x256'
],
'readonly'
:
True
})
self
.
addChild
({
'name'
:
'Image Area'
,
'type'
:
'list'
,
'values'
:
[
'2048x2048'
,
'1024x1024'
,
'512x512'
,
'256x256'
],
'readonly'
:
True
})
self
.
addChild
({
'name'
:
'Exposure Time'
,
'type'
:
'float'
,
'value'
:
.1
,
'suffix'
:
's'
,
'siPrefix'
:
True
,
'step'
:
0.05
})
self
.
addChild
({
'name'
:
'Exposure Time'
,
'type'
:
'float'
,
'value'
:
.1
,
'suffix'
:
's'
,
'siPrefix'
:
True
,
'step'
:
0.05
})
self
.
addChild
({
'name'
:
'Frame Rate'
,
'type'
:
'float'
,
'value'
:
1
0
,
'readonly'
:
True
})
self
.
addChild
({
'name'
:
'Frame Rate'
,
'type'
:
'float'
,
'value'
:
0
,
'readonly'
:
True
})
#exposure time and frame rate connected because they are the inverse of each other
#exposure time and frame rate connected because they are the inverse of each other
#later, they should be set so that the framerate is the maximum possible value given an exposure time
#later, they should be set so that the framerate is the maximum possible value given an exposure time
self
.
exposureTimeWidget
=
self
.
param
(
'Exposure Time'
)
#
self.exposureTimeWidget = self.param('Exposure Time')
self
.
frameRateWidget
=
self
.
param
(
'Frame Rate'
)
#
self.frameRateWidget = self.param('Frame Rate')
self
.
exposureTimeWidget
.
sigValueChanged
.
connect
(
self
.
expTimeChanged
)
#
self.exposureTimeWidget.sigValueChanged.connect(self.expTimeChanged)
self
.
frameRateWidget
.
sigValueChanged
.
connect
(
self
.
frameRateChanged
)
#
self.frameRateWidget.sigValueChanged.connect(self.frameRateChanged)
#set image area according to binning
#set image area according to binning
self
.
param
(
'Pixel Binning'
)
.
sigValueChanged
.
connect
(
self
.
binningChanged
)
self
.
param
(
'Pixel Binning'
)
.
sigValueChanged
.
connect
(
self
.
binningChanged
)
def
expTimeChanged
(
self
):
#
def expTimeChanged(self):
self
.
frameRateWidget
.
setValue
(
1.0
/
self
.
exposureTimeWidget
.
value
(),
blockSignal
=
self
.
frameRateChanged
)
#
self.frameRateWidget.setValue(1.0 / self.exposureTimeWidget.value(), blockSignal=self.frameRateChanged)
def
frameRateChanged
(
self
):
#
def frameRateChanged(self):
self
.
exposureTimeWidget
.
setValue
(
1.0
/
self
.
frameRateWidget
.
value
(),
blockSignal
=
self
.
expTimeChanged
)
#
self.exposureTimeWidget.setValue(1.0 / self.frameRateWidget.value(), blockSignal=self.expTimeChanged)
def
binningChanged
(
self
):
def
binningChanged
(
self
):
if
self
.
param
(
'Pixel Binning'
)
.
value
()
==
'1x1'
:
if
self
.
param
(
'Pixel Binning'
)
.
value
()
==
'1x1'
:
self
.
param
(
'Image Area'
)
.
setValue
(
'2048x2048'
)
self
.
param
(
'Image Area'
)
.
setValue
(
'2048x2048'
)
if
self
.
param
(
'Pixel Binning'
)
.
value
()
==
'2x2'
:
if
self
.
param
(
'Pixel Binning'
)
.
value
()
==
'2x2'
:
print
(
'hola 2x2'
)
self
.
param
(
'Image Area'
)
.
setValue
(
'1024x1024'
)
self
.
param
(
'Image Area'
)
.
setValue
(
'1024x1024'
)
if
self
.
param
(
'Pixel Binning'
)
.
value
()
==
'4x4'
:
if
self
.
param
(
'Pixel Binning'
)
.
value
()
==
'4x4'
:
self
.
param
(
'Image Area'
)
.
setValue
(
'512x512'
)
self
.
param
(
'Image Area'
)
.
setValue
(
'512x512'
)
...
...
drivers/andorzyla.py
View file @
e54ea7ca
...
@@ -80,7 +80,9 @@ class AndorBase(SDK3Camera):
...
@@ -80,7 +80,9 @@ class AndorBase(SDK3Camera):
def
__init__
(
self
,
camNum
):
def
__init__
(
self
,
camNum
):
#some helper attributes (Martin)
self
.
helper
=
Helper_messager
()
self
.
helper
=
Helper_messager
()
self
.
acq_queue
=
Queue
.
Queue
(
maxsize
=
10
)
self
.
current_image
=
None
self
.
current_image
=
None
...
@@ -758,6 +760,7 @@ class AndorBase(SDK3Camera):
...
@@ -758,6 +760,7 @@ class AndorBase(SDK3Camera):
px_encoding
,
'Mono16'
)
px_encoding
,
'Mono16'
)
img
.
shape
=
(
ys
,
xs
)
img
.
shape
=
(
ys
,
xs
)
self
.
current_image
=
img
self
.
current_image
=
img
self
.
acq_queue
.
put
(
self
.
current_image
)
SDK3
.
QueueBuffer
(
self
.
handle
,
bufs
[
self
.
acq_index_i
%
len
(
bufs
)]
.
ctypes
.
data_as
(
SDK3
.
POINTER
(
SDK3
.
AT_U8
)),
bufs
[
self
.
acq_index_i
%
len
(
bufs
)]
.
nbytes
)
SDK3
.
QueueBuffer
(
self
.
handle
,
bufs
[
self
.
acq_index_i
%
len
(
bufs
)]
.
ctypes
.
data_as
(
SDK3
.
POINTER
(
SDK3
.
AT_U8
)),
bufs
[
self
.
acq_index_i
%
len
(
bufs
)]
.
nbytes
)
self
.
helper
.
imageAquiredSignal
.
emit
(
self
.
acq_index_i
)
self
.
helper
.
imageAquiredSignal
.
emit
(
self
.
acq_index_i
)
...
...
dummyAndor.py
View file @
e54ea7ca
...
@@ -24,7 +24,7 @@ class AndorZyla:
...
@@ -24,7 +24,7 @@ class AndorZyla:
self
.
ImageArea
=
AndorFeats
()
self
.
ImageArea
=
AndorFeats
()
self
.
CameraName
=
'Dummy'
self
.
CameraName
=
'Dummy'
self
.
acq_queue
=
Queue
(
maxsize
=
5
)
self
.
acq_queue
=
Queue
(
maxsize
=
10
)
self
.
helper
=
Helper_messager
()
self
.
helper
=
Helper_messager
()
self
.
current_image
=
None
self
.
current_image
=
None
...
@@ -64,11 +64,14 @@ class AndorZyla:
...
@@ -64,11 +64,14 @@ class AndorZyla:
pass
pass
def
_twoD_gaussian
(
self
,
lim
=
10
,
sigma
=
1
,
x0
=
0
,
y0
=
0
):
def
_twoD_gaussian
(
self
,
lim
=
10
,
sigma
=
1
,
x0
=
0
,
y0
=
0
):
start
=
time
.
time
()
N
=
self
.
ImageArea
.
getValue
()
N
=
self
.
ImageArea
.
getValue
()
x
,
y
=
np
.
meshgrid
(
np
.
linspace
(
-
lim
,
lim
,
N
),
np
.
linspace
(
-
lim
,
lim
,
N
))
x
,
y
=
np
.
meshgrid
(
np
.
linspace
(
-
lim
,
lim
,
N
),
np
.
linspace
(
-
lim
,
lim
,
N
))
d
=
np
.
sqrt
((
x
-
x0
)
**
2
+
(
y
-
y0
)
**
2
)
d
=
np
.
sqrt
((
x
-
x0
)
**
2
+
(
y
-
y0
)
**
2
)
g
=
np
.
exp
(
-
((
d
)
**
2
/
(
2.0
*
sigma
**
2
)))
g
=
np
.
exp
(
-
((
d
)
**
2
/
(
2.0
*
sigma
**
2
)))
noise
=
np
.
random
.
rand
(
N
,
N
)
noise
=
np
.
random
.
rand
(
N
,
N
)
end
=
time
.
time
()
print
(
end
-
start
)
time
.
sleep
(
self
.
ExposureTime
.
getValue
())
time
.
sleep
(
self
.
ExposureTime
.
getValue
())
return
g
+
noise
return
g
+
noise
...
...
zylaCameraWorker.py
View file @
e54ea7ca
...
@@ -11,8 +11,8 @@ Created on Thu Apr 4 11:10:20 2019
...
@@ -11,8 +11,8 @@ Created on Thu Apr 4 11:10:20 2019
import
numpy
as
np
import
numpy
as
np
from
PyQt5
import
QtCore
from
PyQt5
import
QtCore
#
from drivers.andorzyla import AndorZyla
from
drivers.andorzyla
import
AndorZyla
from
dummyAndor
import
AndorZyla
#
from dummyAndor import AndorZyla
import
threading
import
threading
...
@@ -67,11 +67,15 @@ class CameraWorker(QtCore.QObject):
...
@@ -67,11 +67,15 @@ class CameraWorker(QtCore.QObject):
print
(
'Acq parameters: '
)
print
(
'Acq parameters: '
)
for
p
in
params
.
children
()[
0
]
.
children
():
for
p
in
params
.
children
()[
0
]
.
children
():
print
(
p
.
name
(),
p
.
value
())
print
(
p
.
name
(),
p
.
value
())
params
.
child
(
'Basic acq parameters'
)
.
child
(
'Camera name'
)
.
setValue
(
self
.
cam
.
Camera
Name
)
params
.
child
(
'Basic acq parameters'
)
.
child
(
'Camera name'
)
.
setValue
(
self
.
cam
.
Camera
Model
.
getValue
()
)
self
.
cam
.
ExposureTime
.
setValue
(
params
.
child
(
'Basic acq parameters'
)
self
.
cam
.
ExposureTime
.
setValue
(
params
.
child
(
'Basic acq parameters'
)
.
child
(
'Exposure Time'
)
.
value
()
.
child
(
'Exposure Time'
)
.
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
()
)
...
...
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