Commit aa590276 authored by Martin Drechsler's avatar Martin Drechsler

reorganized files

parent bda91449
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 11 16:14:02 2016
@author: Admin
"""
......@@ -16,8 +16,8 @@ from pyqtgraph_subclasses import CustomRectangularROI
from zylaCameraWorker import CameraWorker
from cameraParameterTree import CameraParameterTree
from drivers.andorzyla import AndorZyla
#from dummyAndor import AndorZyla
#from drivers.andorzyla import AndorZyla
from dummyAndor import AndorZyla
import sys
import numpy as np
......
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 11 16:14:02 2016
@author: Admin
"""
# -*- coding: utf-8 -*-
"""
This example demonstrates the use of pyqtgraph's parametertree system. This provides
a simple way to generate user interfaces that control sets of parameters. The example
demonstrates a variety of different parameter types (int, float, list, etc.)
as well as some customized parameter types
"""
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
app = QtGui.QApplication([])
from pyqtgraph.parametertree import Parameter, ParameterTree, registerParameterType
from ADoutputs import daq_AO, daq_DO
params = [
{'name': 'laser_parameters_397', 'type': 'group', 'title': '397 laser parameters', 'children': [
{'name': 'piezoA', 'type': 'float', 'value': 0, 'step': 0.2, 'limits': (-10, 10), 'siPrefix': True, 'suffix': 'V'},
{'name': 'piezoB', 'type': 'float', 'value': 0, 'step': 0.05, 'limits': (-1, 1), 'siPrefix': True, 'suffix': 'V'},
{'name': 'shutter1', 'type': 'bool', 'value': True, 'tip': "This is a checkbox"},
{'name': 'shutter2', 'type': 'bool', 'value': True, 'tip': "This is a checkbox"},
]},
{'name': '866 laser parameters', 'type': 'group', 'children': [
{'name': 'piezoA', 'type': 'float', 'value': 0, 'step': 0.05, 'limits': (-1, 1), 'siPrefix': True, 'suffix': 'V'},
{'name': 'piezoB', 'type': 'float', 'value': 0, 'step': 0.05, 'limits': (-1, 1), 'siPrefix': True, 'suffix': 'V'},
{'name': 'shutter1', 'type': 'bool', 'value': True, 'tip': "This is a checkbox"},
{'name': 'shutter2', 'type': 'bool', 'value': True, 'tip': "This is a checkbox"},
]},
{'name': '423 laser parameters', 'type': 'group', 'children': [
{'name': 'piezo', 'type': 'float', 'value': 0, 'step': 0.05, 'limits': (-1, 1), 'siPrefix': True, 'suffix': 'V'},
{'name': 'shutter1', 'type': 'bool', 'value': True, 'tip': "This is a checkbox"},
]},
{'name': 'Save/Restore functionality', 'type': 'group', 'children': [
{'name': 'Save State', 'type': 'action'},
{'name': 'Restore State', 'type': 'action', 'children': [
{'name': 'Add missing items', 'type': 'bool', 'value': True},
{'name': 'Remove extra items', 'type': 'bool', 'value': True},
]},
]},
]
## Create tree of Parameter objects
p = Parameter.create(name='params', type='group', children=params)
"""
## If anything changes in the tree, print a message
def change(param, changes):
print("tree changes:")
for param, change, data in changes:
path = p.childPath(param)
if path is not None:
childName = '_'.join(path)
else:
childName = param.name()
#print(' parameter: %s'% childName)
#print(' change: %s'% change)
#print(' data: %s'% str(data))
#print(path)
myDict[childName].set_analog_out(data)
#print(' ----------')
p.sigTreeStateChanged.connect(change)
def valueChanging(param, value):
print("Value changing (not finalized): %s %s" % (param, value))
"""
def valueChanging(box):
#print(box.name())
#print(box.value())
laser_parameters_397_piezoA.set_analog_out(box.value())
p.children()[0].children()[0].sigValueChanging.connect(valueChanging)
laser_parameters_397_piezoA = daq_AO(0)
myDict = {'laser_parameters_397_piezoA': laser_parameters_397_piezoA}
#def whenChange(sb):
# analog0.set_analog_out(sb.value())
#spin.sigValueChanging.connect(whenChange)
def save():
global state
state = p.saveState()
def restore():
global state
add = p['Save/Restore functionality', 'Restore State', 'Add missing items']
rem = p['Save/Restore functionality', 'Restore State', 'Remove extra items']
p.restoreState(state, addChildren=add, removeChildren=rem)
p.param('Save/Restore functionality', 'Save State').sigActivated.connect(save)
p.param('Save/Restore functionality', 'Restore State').sigActivated.connect(restore)
## Create ParameterTree widgets
t = ParameterTree()
t.setParameters(p, showTop=False)
t.setWindowTitle('pyqtgraph example: Parameter Tree')
win = QtGui.QWidget()
layout = QtGui.QGridLayout()
win.setLayout(layout)
layout.addWidget(QtGui.QLabel("These are two views of the same data. They should always display the same values."), 0, 0, 1, 2)
layout.addWidget(t, 1, 0, 1, 1)
win.show()
win.resize(800,800)
## test save/restore
s = p.saveState()
p.restoreState(s)
## Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__':
import sys
if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
QtGui.QApplication.instance().exec_()
......@@ -38,6 +38,7 @@ class AndorZyla:
self.ImageArea.setValue(2048)
self.CameraModel.setValue('dummy')
self.images_array = []
def Init(self):
print("Dummy camera initialized")
......@@ -45,8 +46,11 @@ class AndorZyla:
def live_acquisition_loop(self):
t = threading.currentThread()
for i in range(10):
self.images_array.append(self._twoD_gaussian())
while getattr(t, "do_run", True):
self.current_image = self._twoD_gaussian()
self.current_image = self.images_array[self.acq_index_i%10]
self.acq_queue.put(self.current_image)
self.helper.imageAquiredSignal.emit(self.acq_index_i)
self.acq_index_i = self.acq_index_i + 1
......@@ -80,7 +84,7 @@ class AndorZyla:
noise = np.random.rand(N, N)
end = time.time()
time.sleep(self.ExposureTime.getValue())
return noise * 10
return np.int8(g + noise)
class AndorFeats:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment