API Reference¶
The public api of seabreeze is provided by the seabreeze.spectrometers submodule. The basic features to acquire a spectrum are provided for all spectrometer models independent of the backend.
spectrometers¶
list_devices¶
Provides a list of available instances of SeaBreezeDevice
Spectrometer¶
The Spectrometer class is used to access spectrometer features.
-
class
seabreeze.spectrometers.
Spectrometer
(device)[source]¶ Spectrometer class for all supported spectrometers
-
__init__
(device)[source]¶ create a Spectrometer instance for the provided device
The Spectrometer class provides a thin abstraction layer for the basic spectrometer feature of the provided SeaBreezeDevice.
- Parameters
device (seabreeze.spectrometers.SeaBreezeDevice) – a SeaBreezeDevice as returned from list_devices
-
classmethod
from_first_available
()[source]¶ open first available spectrometer
- Returns
spectrometer (Spectrometer) – the first available supported spectrometer
-
classmethod
from_serial_number
(serial=None)[source]¶ open the spectrometer matching the provided serial number
Allows to open a specific spectrometer if multiple are connected. Spectrometer serial numbers are visible in the repr string of each SeaBreezeDevice or their serial_number attribute.
- Parameters
serial (str, optional) – the spectrometer’s serial number. If None (default) it returns the first available unopened spectrometer.
- Returns
spectrometer (Spectrometer) – the spectrometer with the requested serial number
-
wavelengths
()[source]¶ wavelength array of the spectrometer
wavelengths in (nm) corresponding to each pixel of the spectrometer
- Returns
wavelengths (numpy.ndarray) – wavelengths in (nm)
-
intensities
(correct_dark_counts=False, correct_nonlinearity=False)[source]¶ measured intensity array in (a.u.)
Measured intensities as numpy array returned by the spectrometer. The measuring behavior can be adjusted by setting the trigger mode. Pixels at the start and end of the array might not be optically active so interpret their returned measurements with care. Refer to the spectrometer’s datasheet for further information.
Notes
Intensities are in arbitrary units and the range depends on the ADC bit resolution of the hardware used in the specific spectrometer. Some spectrometers store a saturation value in their eeprom, which is used to rescale the raw ADC output to the full bit range. (This is done in libseabreeze and therefore also in cseabreeze — for compatibility reasons the same is done in pyseabreeze) I.e. this means that a 16bit (max value 65535) spectrometer with a saturation value of ~30000 is effectively only returning ~15bit resolution raw readings. While most of the lower bits are dominated by noise anyways, it’s just something to keep in mind. Refer to pyseabreeze.features.spectrometer._SeaBreezeSpectrometerSaturationMixin for the implementation.
- Parameters
correct_dark_counts (bool) – If requested and supported the average value of electric dark pixels on the ccd of the spectrometer is subtracted from the measurements to remove the noise floor in the measurements caused by non optical noise sources.
correct_nonlinearity (bool) – Some spectrometers store non linearity correction coefficients in their eeprom. If requested and supported by the spectrometer the readings returned by the spectrometer will be linearized using the stored coefficients.
- Returns
intensities (numpy.ndarray) – measured intensities in (a.u.)
-
property
max_intensity
¶ return the maximum intensity of the spectrometer
- Returns
max_intensity (float) – the maximum intensity that can be returned by the spectrometer in (a.u.) It’s possible that the spectrometer saturates already at lower values.
-
spectrum
(correct_dark_counts=False, correct_nonlinearity=False)[source]¶ returns wavelengths and intensities as single array
Convenience method to allow:
>>> spec = Spectrometer.from_first_available() >>> wavelengths, intensities = spec.spectrum()
- Parameters
correct_dark_counts (bool) – see Spectrometer.intensities
correct_nonlinearity (bool) – see Spectrometer.intensities
- Returns
spectrum (numpy.ndarray) – combined array of wavelengths and measured intensities
-
integration_time_micros
(integration_time_micros)[source]¶ set the integration time in microseconds
- Parameters
integration_time_micros (int) – integration time in microseconds
-
property
integration_time_micros_limits
¶ return the hardcoded minimum and maximum integration time
- Returns
integration_time_micros_min_max (tuple[int, int]) – min and max integration time in micro seconds
-
trigger_mode
(mode)[source]¶ set the trigger mode of the device
- Parameters
mode (int) – refer to your spectrometer’s datasheet to determine the correct value for the trigger mode you want to use.
-
property
serial_number
¶ the spectrometer’s serial number
-
property
model
¶ the spectrometer’s model type
-
property
pixels
¶ the spectrometer’s number of pixels
-
property
features
¶ return a dictionary of all supported features
this returns a dictionary with all supported Features of the spectrometer and gives direct access to the features provided by the backend interface.
- Returns
features (dict [str, seabreeze.SeaBreezeFeature])
-
property
f
¶ convenience assess to features via attributes
this allows you to access a feature like this:
>>> spec = Spectrometer.from_first_available() >>> # via .features >>> spec.features['eeprom'][0].eeprom_read_slot(4) >>> # via .f >>> spec.f.eeprom.eeprom_read_slot(4)
-
open
()[source]¶ open the connection to the SeaBreezeDevice
Notes
Normally you do not have to call this function manually. If you’re trying to use the same spectrometer from multiple processes (honestly, why would you?) then this might come in handy. But I’ll leave the lock/semaphore handling to you.
-
close
()[source]¶ close the connection to the SeaBreezeDevice
Notes
Normally you do not have to call this function manually. If you’re trying to use the same spectrometer from multiple processes (honestly, why would you?) then this might come in handy. But I’ll leave the lock/semaphore handling to you.
-