Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,20 @@ Actuators
Viewer1D
++++++++

* **ShamrockCCD**: Shamrock series of spectrometer using the Andor CCD cameras (built using double inheritance)
* **ShamrockSCMOS**: Shamrock series of spectrometer using the Andor SCMOS cameras (Not tested) (built using double inheritance)
* **ShamrockCCDComposition**: Shamrock series of spectrometer using the Andor CCD cameras (built using CCD camera inheritance and Shamrock composition)
* **ShamrockSCMOSComposition**: Shamrock series of spectrometer using the Andor SCMOS cameras (Not tested) (built using SCMOS camera inheritance and Shamrock composition)
* **ShamrockCCDLegacy**: Shamrock series of spectrometer using the Andor CCD cameras (built using double inheritance), this
is a legacy plugin don't use it anymore
* **ShamrockSCMOSLegacy**: Shamrock series of spectrometer using the Andor SCMOS cameras (Not tested)
(built using double inheritance), this is a legacy plugin don't use it anymore
* **ShamrockCCD**: Shamrock series of spectrometer using the Andor CCD cameras
(built using CCD camera inheritance and Shamrock composition)
* **ShamrockSCMOS**: Shamrock series of spectrometer using the Andor SCMOS cameras (Not tested)
(built using SCMOS camera inheritance and Shamrock composition)

Viewer2D
++++++++

* **AndorCCD**: Andor CCD camera using the SDK2
* **AndorSCMOS**: Andor CCD camera using the SDK3
* **AndorSCMOSPll**: Andor CCD camera using the SDK3 through the pylablib driver (experimental but already in use,
subject to changes)

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ name = "pymodaq_plugins_andor"
description = 'Set of PyMoDAQ plugins for Andor Camera (CCD camera using SDK2, SCMOS cameras using SDK3...)'
dependencies = [
"pymodaq>=5.0.0",
"pylablib",
#todo: list here all dependencies your package may have
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@

from pymodaq_gui.parameter import utils as putils

from pymodaq.utils.data import Axis, DataFromPlugins
from pymodaq.control_modules.viewer_utility_classes import main
from pymodaq.utils.data import Axis, DataFromPlugins, DataToExport
from pymodaq.control_modules.viewer_utility_classes import main, DAQ_Viewer_base, comon_parameters

from pymodaq_plugins_andor.daq_viewer_plugins.plugins_2D.daq_2Dviewer_AndorCCD import DAQ_2DViewer_AndorCCD
from pymodaq_plugins_andor.daq_move_plugins.daq_move_Shamrock import DAQ_Move_Shamrock


logger = set_logger(get_module_name(__file__))


class DAQ_1DViewer_ShamrockCCD(DAQ_2DViewer_AndorCCD, DAQ_Move_Shamrock):
class DAQ_1DViewer_ShamrockCCD(DAQ_2DViewer_AndorCCD):
"""
=============== ==================

Expand All @@ -38,27 +37,28 @@ class DAQ_1DViewer_ShamrockCCD(DAQ_2DViewer_AndorCCD, DAQ_Move_Shamrock):
d['visible'] = True

params = [{'title': 'Get Calibration:', 'name': 'get_calib', 'type': 'bool_push', 'value': False,
'label': 'Update!'}] + param_camera + params_shamrock
'label': 'Update!'},] + param_camera + [
{'title': 'Shamrock Settings:', 'name': 'sham_settings', 'type': 'group', 'children': params_shamrock},
]

def __init__(self, parent=None, params_state=None):
DAQ_Move_Shamrock.__init__(self, parent, params_state)
DAQ_2DViewer_AndorCCD.__init__(self, parent, params_state)

self.camera_controller = None # this will be the controller attribute of the DAQ_2DViewer_AndorCCD instance
self.shamrock_controller = None # this will be the controller attribute of the DAQ_Move_Shamrock instance
# both plugins don't have the generic controller name 'controller' but specific one for this reason
def ini_attributes(self):
self.controller: DAQ_2DViewer_AndorCCD = None
self.shamrock_controller: DAQ_Move_Shamrock = None

self.x_axis: Axis = None
self.is_calibrated = False

super().ini_attributes()

def commit_settings(self, param):

if param.name() == 'flip_wavelength':
self.get_xaxis()
elif 'camera_settings' in putils.get_param_path(param):
DAQ_2DViewer_AndorCCD.commit_settings(self, param)
super().commit_settings(param)
elif 'spectro_settings' in putils.get_param_path(param):
DAQ_Move_Shamrock.commit_settings(self, param)
self.shamrock_controller.commit_settings(param)
QtWidgets.QApplication.processEvents()
if param.name() == 'spectro_wl':
self.is_calibrated = False
Expand All @@ -76,34 +76,36 @@ def commit_settings(self, param):
param.setValue(False)

def ini_detector(self, controller=None):
_, shamrock_initialized = DAQ_Move_Shamrock.ini_stage(self, controller)
cam_status, cam_init = super().ini_detector(controller)
QtWidgets.QApplication.processEvents()
# if status_shamrock.initialized:
# self.move_Home()

_, camera_initialized = DAQ_2DViewer_AndorCCD.ini_detector(self, controller)
self.shamrock_controller = DAQ_Move_Shamrock(None, self.settings.child('sham_settings').saveState())
self.shamrock_controller.settings = self.settings.child('sham_settings')
self.shamrock_controller.emit_status = self.emit_status
sham_status, sham_init = self.shamrock_controller.ini_stage(controller)

QtWidgets.QApplication.processEvents()

initialized = shamrock_initialized and camera_initialized

initialized = sham_init and cam_init

self.setCalibration()
#self.emit_status(ThreadCommand('close_splash'))
return '', initialized
return sham_status + cam_status, initialized

def setCalibration(self):
#setNpixels
width, height = self.get_pixel_size()
err = self.shamrock_controller.SetNumberPixelsSR(0, self.get_ROI_size_x())
err = self.shamrock_controller.SetPixelWidthSR(0, width)
err = self.shamrock_controller.controller.SetNumberPixelsSR(0, self.get_ROI_size_x())
err = self.shamrock_controller.controller.SetPixelWidthSR(0, width)

self.get_wavelength()
self.shamrock_controller.get_wavelength()
self.x_axis = self.get_xaxis()


def getCalibration(self):

if self.shamrock_controller is not None:
(err, calib) = self.shamrock_controller.GetCalibrationSR(0, self.get_ROI_size_x())
if self.shamrock_controller is not None and self.shamrock_controller.controller is not None:
(err, calib) = self.shamrock_controller.controller.GetCalibrationSR(0, self.get_ROI_size_x())
if err != "SHAMROCK_SUCCESS":
raise Exception(err)

Expand All @@ -123,17 +125,19 @@ def get_xaxis(self):
Contains a vector of integer corresponding to the horizontal camera pixels.
"""

if np.abs(self.settings.child('spectro_settings', 'spectro_wl').value()) < 1e-3:
DAQ_2DViewer_AndorCCD.get_xaxis(self)
if self.shamrock_controller is None or np.abs(self.settings.child('sham_settings', 'spectro_settings', 'spectro_wl').value()) < 1e-3:
nx = self.get_ROI_size_x()
calib = np.linspace(0, nx, nx-1)
self.x_axis = Axis(data=calib, label='Wavelength (nm)')
else:
calib = self.getCalibration()

if (calib.astype('int') != 0).all(): # check if calib values are equal to zero
if self.settings.child('spectro_settings', 'flip_wavelength').value():
if self.settings.child('sham_settings', 'spectro_settings', 'flip_wavelength').value():
calib = calib[::-1]

else:
self.settings.child('spectro_settings', 'flip_wavelength').setValue(False)
self.settings.child('sham_settings', 'spectro_settings', 'flip_wavelength').setValue(False)
#self.emit_status(ThreadCommand('Update_Status', ['Impossible to flip wavelength', "log"]))

self.x_axis = Axis(data=calib, label='Wavelength (nm)')
Expand All @@ -149,18 +153,21 @@ def set_exposure_ms(self, exposure):
self.emit_status(ThreadCommand('exposure_ms', [self.settings.child('camera_settings', 'exposure').value()]))

def stop(self):
DAQ_2DViewer_AndorCCD.stop(self)
if self.controller is not None:
super().stop()
if self.shamrock_controller is not None:
self.shamrock_controller.stop()

def close(self):
if self.camera_controller is not None:
DAQ_2DViewer_AndorCCD.stop(self)
self.stop()
if self.shamrock_controller is not None:
DAQ_Move_Shamrock.stop(self)
self.shamrock_controller.close()
super().close()

def grab_data(self, Naverage=1, **kwargs):
if not self.is_calibrated:
self.get_xaxis()
DAQ_2DViewer_AndorCCD.grab_data(self, Naverage, **kwargs)
super().grab_data( Naverage, **kwargs)

def emit_data(self):
"""
Expand All @@ -170,12 +177,16 @@ def emit_data(self):
self.ind_grabbed += 1
sizey = self.settings.child('camera_settings', 'image_size', 'Ny').value()
sizex = self.settings.child('camera_settings', 'image_size', 'Nx').value()
self.camera_controller.GetAcquiredDataNumpy(self.data_pointer, sizex * sizey)
self.data_grabed_signal.emit([DataFromPlugins(name='Camera',
data=[np.squeeze(
self.data.reshape((sizey, sizex)).astype(float))],
dim=self.data_shape,
axes=[self.x_axis]),])
self.controller.GetAcquiredDataNumpy(self.data_pointer, sizex * sizey)
self.dte_signal.emit(
DataToExport('Spectro',
data=[
DataFromPlugins(name='Camera',
data=[np.atleast_1d(np.squeeze(self.data.reshape(
(sizey, sizex)))).astype(float)],
dim=self.data_shape,
axes=[self.x_axis]),
]))
QtWidgets.QApplication.processEvents() # here to be sure the timeevents are executed even if in continuous grab mode

except Exception as e:
Expand Down
Loading
Loading