diff --git a/catkit2/services/oceanoptics_spectrometer/oceanoptics_spectrometer.py b/catkit2/services/oceanoptics_spectrometer/oceanoptics_spectrometer.py index 9b12364d..0356d6fd 100644 --- a/catkit2/services/oceanoptics_spectrometer/oceanoptics_spectrometer.py +++ b/catkit2/services/oceanoptics_spectrometer/oceanoptics_spectrometer.py @@ -158,10 +158,10 @@ def exposure_time(self, exposure_time: int): This property can be used to set the exposure time of the spectrometer. - If exposure_time parameter is inferior to the minimum allowed exposure time for this - spectrometer (set by ocean optics), it is set to the minimum allowed exposure time. - If exposure_time is larger to the maximum allowed exposure time, it is set to the - minimum allowed exposure time. + If the `exposure_time` parameter is inferior to the minimum allowed exposure time for this + spectrometer (set by Ocean Optics), it is set to the minimum allowed exposure time. + If the `exposure_time` is larger than the maximum allowed exposure time, it is set to the + maximum allowed exposure time. Parameters ---------- diff --git a/catkit2/services/oceanoptics_spectrometer_sim/oceanoptics_spectrometer_sim.py b/catkit2/services/oceanoptics_spectrometer_sim/oceanoptics_spectrometer_sim.py index c8c1b9f0..1403432f 100644 --- a/catkit2/services/oceanoptics_spectrometer_sim/oceanoptics_spectrometer_sim.py +++ b/catkit2/services/oceanoptics_spectrometer_sim/oceanoptics_spectrometer_sim.py @@ -7,10 +7,7 @@ class OceanOpticsSpectrometerSim(Service): ''' - Service for Ocean Optics Spectrometer. - - This service is a wrapper around the python seabreeze package. - It provides a simple interface to control the spectrometer and acquire spectra. + Service for simulated Ocean Optics Spectrometer. Attributes ---------- @@ -98,8 +95,9 @@ def main(self): ''' while not self.should_shut_down: intensities = self.take_one_spectrum(self.pixels_number) - self.is_saturating.submit_data(np.array([0], dtype='int8')) self.spectra.submit_data(np.array(intensities, dtype='float32')) + self.is_saturating.submit_data(np.array([0], dtype='int8')) + self.sleep(self.interval) def take_one_spectrum(self): @@ -107,7 +105,7 @@ def take_one_spectrum(self): Measure and return one spectrum. Simulated service: random numpy array. ''' - return np.random.random(self.pixels_number) + return np.random.random(self.pixels_number) + 1000 @property def wavelengths(self): @@ -143,7 +141,6 @@ def exposure_time(self, exposure_time: int): ---------- exposure_time : int The exposure time in microseconds. - ''' self._exposure_time = exposure_time diff --git a/docs/services/oceanoptics_spectrometer.rst b/docs/services/oceanoptics_spectrometer.rst index 30e983d6..6a6ef97f 100644 --- a/docs/services/oceanoptics_spectrometer.rst +++ b/docs/services/oceanoptics_spectrometer.rst @@ -1,5 +1,5 @@ Ocean Optics Spectrometer -==================== +========================= This service controls an Ocean Optics Spectrometer. It is a wrapper around the python-seabreeze package. The python-seabreeze package needs to be installed first, and the page also explain how to install the @@ -19,8 +19,8 @@ Configuration spectrometer: service_type: oceanoptics_spectrometer simulated_service_type: oceanoptics_spectrometer_sim - requires_safety: false interface: oceanoptics_spectrometer + requires_safety: false serial_number: USB4C01580 # Serial number of the spectrometer. exposure_time: 1000 # Exposure time of the spectrometer in microseconds. @@ -39,4 +39,4 @@ Datastreams ----------- ``spectra``: Spectra acquired by the camera. -``is_saturating``: If the intensity as reach the maximum value of the spectrometer. \ No newline at end of file +``is_saturating``: If the intensity as reached the maximum value of the spectrometer. \ No newline at end of file diff --git a/environment.yml b/environment.yml index 7947b6f7..4fae0f1a 100644 --- a/environment.yml +++ b/environment.yml @@ -16,6 +16,7 @@ dependencies: - conda-forge::pyvisa>=1.10 - conda-forge::pyvisa-py - conda-forge::nidaqmx-python + - conda-forge::seabreeze - pyserial - pysnmp - requests