Commit ad864252 authored by Martin Drechsler's avatar Martin Drechsler

some log test and backend

parent 5af0befe
......@@ -12,22 +12,26 @@ from controlGui import ControlGui
import logging
from logging.handlers import SocketHandler
from lantz.core.log import DEBUG, log_to_socket, log_to_screen
if __name__ == "__main__":
log = logging.getLogger('Main logger')
gui_log = log.getChild("GUI logger")
worker_log = log.getChild("Worker logger")
acq_log = log.getChild("Acquisition logger")
log.setLevel(1) # to send all records to cutelog
socket_handler = SocketHandler('127.0.0.1', 19996) # default listening address
log.addHandler(socket_handler)
log.info('Hello world!')
gui_log.info('hello')
worker_log.info('hello')
acq_log.info('hello')
# log = logging.getLogger('Main logger')
# gui_log = log.getChild("GUI logger")
# worker_log = log.getChild("Worker logger")
# acq_log = log.getChild("Acquisition logger")
# log.setLevel(1) # to send all records to cutelog
# socket_handler = SocketHandler('127.0.0.1', 19996) # default listening address
# log.addHandler(socket_handler)
# log.info('Hello world!')
# gui_log.info('hello')
# worker_log.info('hello')
# acq_log.info('hello')
log_to_screen(DEBUG)
import sys
app = QtGui.QApplication([])
......
......@@ -16,9 +16,9 @@ from MCDAQcontrolsignals import anal_control_signal
from resources.messages import show_warning
from resources.scanFunctions import create_measurement_array, yield_array
from resources.storage import Storage
from lantz.qt.app import Backend
class CameraWorker(QtCore.QObject):
class CameraWorker(Backend):
imageReadySignal = QtCore.pyqtSignal(np.ndarray, int)
measurementStartingSignal = QtCore.pyqtSignal()
measurementEndingSignal = QtCore.pyqtSignal()
......@@ -31,11 +31,13 @@ class CameraWorker(QtCore.QObject):
self.cam.SensorCooling.setValue(True)
print("camera worker initialized")
self.storage = Storage()
self.storageTxtTxt = Storage()
self.ao_to_scan = None
self.scan_array_gen = None
self._lock = threading.Lock()
self.measure_params = dict()
self.log_debug('hola')
self.log_info('hola')
def make_connections(self, frontend):
# frontend connections
......@@ -140,9 +142,9 @@ class CameraWorker(QtCore.QObject):
self.scan_array_gen = yield_array(create_measurement_array(start, end, step_num))
self.ao_to_scan.go_softly_to_value(start)
self.storage.set_directory(measure_params['directory'])
self.storage.create_data_file('Time', measure_params['signal_to_scan'], 'Roi data')
self.storage.append_metadata_to_current_file(self.cam.GetMetaData(), self.measure_params)
self.storageTxt.set_directory(measure_params['directory'])
self.storageTxt.create_data_file('Time', measure_params['signal_to_scan'], 'Roi data')
self.storageTxt.append_metadata_to_current_file(self.cam.GetMetaData(), self.measure_params)
self.cam.TriggerMode.setString('Software')
......@@ -185,7 +187,7 @@ class CameraWorker(QtCore.QObject):
@QtCore.pyqtSlot(float)
def save_data_from_scan_step(self, roiData):
row = [time.time(), self.ao_to_scan.AO.current_value, roiData]
self.storage.append_data_to_current_file(row)
self.storageTxt.append_data_to_current_file(row)
self.simple_scan_measurement_step()
......@@ -196,8 +198,8 @@ class CameraWorker(QtCore.QObject):
@QtCore.pyqtSlot(str)
def permanent_save_measurement(self, comment=''):
self.storage.append_metadata_to_current_file(
self.storageTxt.append_metadata_to_current_file(
{'Final comment': comment}
)
self.storage.permanent_save_current_data()
self.storageTxt.permanent_save_current_data()
\ No newline at end of file
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