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
eacef26f
Commit
eacef26f
authored
May 19, 2019
by
Martin Drechsler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
linux driver for mccdaq added. Also some changes for visualisation of camera.
parent
0ae0b306
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
134 additions
and
8 deletions
+134
-8
cameraGui.py
cameraGui.py
+2
-1
ADoutputs_linux.py
drivers/ADoutputs_linux.py
+124
-0
dummyAndor.py
drivers/dummyAndor.py
+3
-3
imageview_example.py
examples/imageview_example.py
+3
-2
main.py
main.py
+2
-2
No files found.
cameraGui.py
View file @
eacef26f
...
...
@@ -234,7 +234,8 @@ class CameraGuiMainWindow(QMainWindow):
%
(
self
.
frame_index
,
acq_index
)
)
self
.
img
.
setImage
(
image
,
autoDownsample
=
True
)
self
.
img
.
setImage
(
image
,
autoDownsample
=
True
,
autoHistogramRange
=
False
,
autoLevels
=
False
,
autoRange
=
False
)
self
.
updatePlots
()
self
.
frame_index
=
self
.
frame_index
+
1
...
...
drivers/ADoutputs_linux.py
0 → 100644
View file @
eacef26f
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 22 16:29:22 2019
@author: liaf-ankylosaurus-admin
"""
from
uldaq
import
(
get_daq_device_inventory
,
DaqDevice
,
InterfaceType
,
DigitalDirection
,
DigitalPortIoType
,
AOutFlag
,
Range
)
#empty some variables and defining interface type
daq_device
=
None
dio_device
=
None
port_to_write
=
None
port_info
=
None
interface_type
=
InterfaceType
.
USB
descriptor_index
=
0
port_types_index
=
0
# Get descriptors for all of the available DAQ devices.
devices
=
get_daq_device_inventory
(
interface_type
)
number_of_devices
=
len
(
devices
)
if
number_of_devices
==
0
:
raise
Exception
(
'Error: No DAQ devices found'
)
print
(
'Found'
,
number_of_devices
,
'DAQ device(s):'
)
for
i
in
range
(
number_of_devices
):
print
(
' '
,
devices
[
i
]
.
product_name
,
' ('
,
devices
[
i
]
.
unique_id
,
')'
,
sep
=
''
)
# Create the DAQ device object associated with the specified descriptor index.
daq_device
=
DaqDevice
(
devices
[
descriptor_index
])
# Get the DioDevice object and verify that it is valid.
dio_device
=
daq_device
.
get_dio_device
()
if
dio_device
is
None
:
raise
Exception
(
'Error: The device does not support digital output'
)
# Create a aoDevice object from the first descriptor.
ao_device
=
daq_device
.
get_ao_device
()
# Verify the specified DAQ device supports analog output.
if
ao_device
is
None
:
raise
Exception
(
'Error: The DAQ device does not support analog output'
)
ao_info
=
ao_device
.
get_info
()
# Establish a connection to the DAQ device.
descriptor
=
daq_device
.
get_descriptor
()
if
not
daq_device
.
is_connected
():
print
(
'
\n
Connecting to'
,
descriptor
.
dev_string
,
'- please wait...'
)
daq_device
.
connect
()
print
(
'
\n
'
,
descriptor
.
dev_string
,
'ready'
)
def
_configure_digital_outs
():
global
port_types_index
# Get the port types for the device(AUXPORT, FIRSTPORTA, ...)
dio_info
=
dio_device
.
get_info
()
port_types
=
dio_info
.
get_port_types
()
if
port_types_index
>=
len
(
port_types
):
port_types_index
=
len
(
port_types
)
-
1
port_to_write
=
port_types
[
port_types_index
]
# Get the port I/O type and the number of bits for the first port.
port_info
=
dio_info
.
get_port_info
(
port_to_write
)
# If the port is bit configurable, then configure the individual bits
# for output; otherwise, configure the entire port for output.
if
port_info
.
port_io_type
==
DigitalPortIoType
.
BITIO
:
# Configure all of the bits for output for the first port.
for
bit_number
in
range
(
port_info
.
number_of_bits
):
dio_device
.
d_config_bit
(
port_to_write
,
bit_number
,
DigitalDirection
.
OUTPUT
)
elif
port_info
.
port_io_type
==
DigitalPortIoType
.
IO
:
# Configure the entire port for output.
dio_device
.
d_config_port
(
port_to_write
,
DigitalDirection
.
OUTPUT
)
_configure_digital_outs
()
class
daq_AO
(
object
):
def
__init__
(
self
,
out_num
,
min_value
=
-
10
,
max_value
=
10
,
output_range
=
Range
.
BIP10VOLTS
):
self
.
out_num
=
out_num
self
.
output_range
=
output_range
self
.
max
=
max_value
self
.
min
=
min_value
self
.
current_value
=
0
#methods
def
set_out
(
self
,
value
):
try
:
ao_device
.
a_out
(
self
.
out_num
,
self
.
output_range
,
AOutFlag
.
DEFAULT
,
float
(
value
))
self
.
current_value
=
value
except
:
raise
(
"Failing to set analog output
%
i"
,
self
.
out_num
)
# def set_out(self, value):
# print('Analog out %i set to %f' % (self.out_num, value) )
# return value, self.out_num
class
daq_DO
(
object
):
global
port_types_index
,
dio_device
def
__init__
(
self
,
out_num
):
self
.
out_num
=
out_num
self
.
dio_info
=
dio_device
.
get_info
()
self
.
port_types
=
self
.
dio_info
.
get_port_types
()
self
.
port_to_write
=
self
.
port_types
[
port_types_index
]
def
set_out
(
self
,
bit_value
):
try
:
# Output the value to the board
dio_device
.
d_bit_out
(
self
.
port_to_write
,
self
.
out_num
,
bit_value
)
except
:
raise
(
"Failing to set digital output
%
i"
,
self
.
out_num
)
# def set_out(self, bit_value):
# print('Digital out %i set to %s' % (self.out_num, bit_value) )
# return bit_value, self.out_num
#
drivers/dummyAndor.py
View file @
eacef26f
...
...
@@ -93,10 +93,10 @@ class AndorZyla:
def
_twoD_gaussian
(
self
,
lim
=
10
,
sigma
=
1
,
x0
=
0
,
y0
=
0
):
N
=
self
.
ImageArea
.
getValue
()
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
(
5
*
(
x
-
x0
)
**
2
+
(
y
-
y0
)
**
2
)
g
=
np
.
exp
(
-
((
d
)
**
2
/
(
2.0
*
sigma
**
2
)))
noise
=
np
.
random
.
rand
(
N
,
N
)
return
np
.
int8
(
g
+
noise
)
noise
=
np
.
random
.
normal
(
size
=
(
N
,
N
)
)
return
g
+
noise
def
trigger
(
self
):
self
.
current_image
=
self
.
images_array
[
self
.
acq_index_i
%
10
]
...
...
examples/imageview_example.py
View file @
eacef26f
...
...
@@ -21,7 +21,7 @@ import pyqtgraph.ptime as ptime
def
_twoD_gaussian
(
lim
=
10
,
sigma
=
1
,
x0
=
0
,
y0
=
0
):
N
=
600
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
(
5
*
(
x
-
x0
)
**
2
+
(
y
-
y0
)
**
2
)
g
=
np
.
exp
(
-
((
d
)
**
2
/
(
2.0
*
sigma
**
2
)))
noise
=
np
.
random
.
normal
(
size
=
(
N
,
N
))
/
10
return
g
+
noise
...
...
@@ -32,6 +32,7 @@ app = QtGui.QApplication([])
win
=
QtGui
.
QMainWindow
()
win
.
resize
(
800
,
800
)
imv
=
pg
.
ImageView
()
win
.
setCentralWidget
(
imv
)
win
.
show
()
win
.
setWindowTitle
(
'pyqtgraph example: ImageView'
)
...
...
@@ -50,7 +51,7 @@ def updateData():
## Display the data
imv
.
setImage
(
data
[
i
],
autoHistogramRange
=
False
,
autoLevels
=
False
,
autoRange
=
False
autoRange
=
False
,
rot
)
i
=
(
i
+
1
)
%
data
.
shape
[
0
]
...
...
main.py
View file @
eacef26f
from
PyQt5
import
QtGui
,
QtCore
#
from drivers.andorzyla import AndorZyla
from
drivers.dummyAndor
import
AndorZyla
from
drivers.andorzyla
import
AndorZyla
#
from drivers.dummyAndor import AndorZyla
from
cameraGui
import
CameraGuiMainWindow
from
zylaCameraWorker
import
CameraWorker
...
...
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