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
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Authors

* Sebastien J. Weber
* Nicolas Tappy
* Arnaud Meyer

Instruments
===========
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@


class DAQ_1DViewer_Seabreeze(DAQ_Viewer_base):
"""
"""
"""PyMoDAQ 1DViewer class for devices supported by the Seabreeze library."""

# Upon initialisation
devices = list_devices()

#Supports pseudo hardware-averaging
# Supports pseudo hardware-averaging
hardware_averaging = True

# Adjustable parameters
params = comon_parameters + [
{'title': 'Device:', 'name': 'device', 'type': 'list', 'limits': devices},
{'title': 'Integration (ms):', 'name': 'integration', 'type': 'float', 'value': 1.0},
Expand All @@ -28,7 +29,7 @@ class DAQ_1DViewer_Seabreeze(DAQ_Viewer_base):
{'title': 'Non Linearity correction:', 'name': 'correct_non_linearity', 'type': 'bool', 'value': False},
{'title': 'Max Intensity', 'name': 'max_intensity', 'type': "float", 'value': 65535, 'readonly': True},
{'title': 'Pixels:', 'name': 'pixels', 'type': 'int', 'value': 2048, 'readonly': True},
{'title': 'Dark Channels:', 'name': 'dark_channels', 'type': 'int', 'value': 10, 'readonly': True},
{'title': 'Dark Channels:', 'name': 'dark_channels', 'type': 'str', 'value': '', 'readonly': True},
{'title': 'Readout Time (ms)', 'name': 'readout_time', 'type': 'float', 'value': 666, 'readonly': True},
]}
]
Expand Down Expand Up @@ -59,23 +60,27 @@ def ini_detector(self, controller=None):
* controller (object) initialized controller
*initialized: (bool): False if initialization failed otherwise True
"""
self.ini_detector_init(controller, None)

if self.is_master:
# From what I understand this will just get the spectro currently selected in the list
dvc = self.settings['device']
self.controller = Spectrometer(dvc)
self.controller.open()
#####################################
#self.controller.open()

else:
self.controller = controller

# Oceanoptics spectrometers (at least the ones i Know) have fixed axis
# get inactive pixels
c0 = self.controller.f.spectrometer.get_electric_dark_pixel_indices()[-1]
self.settings.child('advanced').child('dark_channels').setValue(c0)
# get index of inactive pixels
dark_indices = self.controller.f.spectrometer.get_electric_dark_pixel_indices()
self.settings.child('advanced').child('dark_channels').setValue(", ".join([str(x) for x in dark_indices]))
# get the x_axis
data_x_axis = self.controller.wavelengths() # Way to get the x axis
data_x_axis = data_x_axis[c0:] * 1e9 # Get rid of the dark pixels
self.x_axis = Axis(data=data_x_axis, label='wavelength', units='m', index=0)
# keep range without dark pixels
x_indices = np.arange(data_x_axis.shape[0])
self.valid_range = np.setdiff1d(x_indices, dark_indices)
data_x_axis = data_x_axis[self.valid_range]
# generate PyMoDAQ axis
self.x_axis = Axis(data=data_x_axis * 1e-9, label='wavelength', units='m', index=0)

# Get the name
specname = f"Ocean Insight {self.controller.model}"
Expand Down Expand Up @@ -134,16 +139,18 @@ def grab_data(self, Naverage = 1, **kwargs):
kwargs: (dict) of others optionals arguments
"""
nlc = self.settings.child('advanced').child('correct_non_linearity').value()
c0 = self.settings.child('advanced').child('dark_channels').value()
#c0 = self.settings.child('advanced').child('dark_channels').value()

# synchrone version (blocking function)
# Pseudo-hardware-averaging
if Naverage > 1:
data = [self.controller.intensities(correct_nonlinearity=nlc)[c0:] for i in range(Naverage)]
data = [self.controller.intensities(correct_nonlinearity=nlc)[self.valid_range]
for i in range(Naverage)]
data = np.array(data)
data = data.mean(0)
# Otherwise normal single-acquisition
else:
data = self.controller.intensities(correct_nonlinearity=nlc)[c0:]
data = self.controller.intensities(correct_nonlinearity=nlc)[self.valid_range]

self.dte_signal.emit(DataToExport('Spectro', data=[
DataFromPlugins(name='oceanseabreeze', data=[data], dim='Data1D',
Expand Down
Loading