3 Created on Wed Jan 9 16:23:44 2019
5 @author: Ocean Insight Inc.
9 from ctypes
import cdll, c_int, c_ushort, c_uint, c_long, create_string_buffer, c_ulong, c_ubyte, c_double, c_float, c_longlong, POINTER, byref
10 from enum
import Enum,auto
11 from oceandirect.sdk_properties
import oceandirect_dll
12 from oceandirect.od_logger
import od_logger
18 An error code and error message object wrapper.
22 super(OceanDirectError, self).
__init__(errorMsg)
33 self.
oceandirectoceandirect = cdll.LoadLibrary(oceandirect_dll)
41 Closes all open devices and the odapi singleton.
46 except Exception
as e:
47 exe_msg = traceback.format_exc()
48 sdk_data_json = json.dumps(exe_msg)
49 logger.error(sdk_data_json)
53 Closes all opened devices.
60 Release any remaining used resources before shutting down the program.
68 Loads and initializes the OceanDirect dll and initializes internal variables.
71 if not OceanDirectAPI.instance:
75 return getattr(self.
instanceinstance, name)
79 OceanDirectAPI returns an error code if something goes wrong. This function will decode
80 that error to a readable string.
82 @param errno: The error code generated by OceanDirect api.
84 @param caller: The caller which produces the error code. Use for debugging purposes only.
88 error_str_len = self.oceandirect.odapi_get_error_string_length(errno)
89 errstr_cp = create_string_buffer(b
'\000'*error_str_len)
90 self.oceandirect.odapi_get_error_string(errno, errstr_cp, error_str_len)
91 errstr = (
"%s errcode(%d): %s" % (caller, errno, errstr_cp.value.decode()))
103 self.oceandirect.odapi_get_rc_version_number.argtypes = [POINTER(c_uint)]
104 self.oceandirect.odapi_get_rc_version_number( byref(point) )
110 Return OceanDirect api version information.
112 @return An integer tuple of major, minor, and point value.
119 self.oceandirect.odapi_get_api_version_numbers.argtypes = [POINTER(c_uint), POINTER(c_uint), POINTER(c_uint)]
120 self.oceandirect.odapi_get_api_version_numbers(byref(major), byref(minor), byref(point) )
122 return (major.value, minor.value, point.value)
126 Attach to a device discovered by probe_devices or get_device_ids. It also saves it to a map
127 keyed off of the device id.
129 @param[in] device_id The device id.
130 @return The device object.
133 if device_id
in self.open_devices:
134 device = self.open_devices[device_id]
139 self.open_devices[device_id] = device
144 Manually create an instance of the network attached device and then open it using
145 the openDevice() function. It is the responsiblitiy of the user to ensure that
146 the device exist and configured properly.
148 @param[in] ipAddressStr The ip address of the device to be opened.
149 @param[in] deviceTypeStr The device type could be OceanFX or OceanHDX. This is case sensitive.
152 if not ipAddressStr
or not deviceTypeStr:
153 error_msg = self.
decode_errordecode_error(15,
"add_network_device")
156 err_cp = (c_long * 1)(0)
157 self.oceandirect.odapi_add_network_devices(ipAddressStr.encode(
'utf-8'), deviceTypeStr.encode(
'utf-8'), err_cp)
160 error_msg = self.
decode_errordecode_error(err_cp[0],
"add_network_device")
165 Detach from the device indicated by device_id. This persists the device for later use.
167 @param[in] device_id The id of the device to be closed.
170 if device_id
in self.open_devices:
171 device = self.open_devices[device_id]
172 device.close_device()
176 Lists defined details of all active devices.
178 for dev
in self.open_devices:
179 self.open_devices[dev].details()
183 Closes the connection to OceanDirectAPI. This is the last to be called before the program terminates.
185 self.oceandirect.odapi_shutdown()
189 Finds all available Ocean devices by scanning on USB for devices with Ocean drivers, finding
190 devices that respond to UDP multicast (FX and HDX), and also returning IDs for any TCP-enabled
191 devices that have been manually specified using addTCPDeviceLocation().
193 @return Number of devices found.
197 self.
tcpip_devicestcpip_devices = self.oceandirect.odapi_detect_network_devices()
198 except Exception
as e:
199 exe_msg = traceback.format_exc()
200 sdk_data_json = json.dumps(exe_msg)
201 logger.error(sdk_data_json)
204 self.
usb_devicesusb_devices = self.oceandirect.odapi_probe_devices()
205 except Exception
as e:
206 exe_msg = traceback.format_exc()
207 sdk_data_json = json.dumps(exe_msg)
208 logger.error(sdk_data_json)
213 Finds all available Ocean devices by scanning on USB for devices with Ocean drivers.
215 @return Number of devices found.
219 self.
usb_devicesusb_devices = self.oceandirect.odapi_probe_devices()
220 except Exception
as e:
221 exe_msg = traceback.format_exc()
222 sdk_data_json = json.dumps(exe_msg)
223 logger.error(sdk_data_json)
228 Manually create an instance of the network attached device and then open it using the openDevice() function. It
229 is the responsiblitiy of the user to ensure that the device exist and configured properly.
231 @param[in] ipAddress The ip address as string (ex: "10.20.30.100" ) of the device to be opened.
232 @param[in] deviceType The device type could be OceanFX or OceanHDX. This is case sensitive.
233 @return The device id.
237 err_cp = (c_long * 1)(0)
239 if not ipAddress
or not deviceType:
241 error_msg = self.
decode_errordecode_error(15,
"add_network_device")
245 deviceId = self.oceandirect.odapi_add_network_devices(ipAddress.encode(
'utf-8'), deviceType.encode(
'utf-8'), err_cp)
246 except Exception
as e:
247 exe_msg = traceback.format_exc()
248 sdk_data_json = json.dumps(exe_msg)
249 logger.error(sdk_data_json)
252 error_msg = self.
decode_errordecode_error(err_cp[0],
"add_network_device")
259 Returns the number of devices available.
261 @return The number of connected(discovered) devices.
265 self.
num_devicesnum_devices = self.oceandirect.odapi_get_number_of_device_ids()
266 except Exception
as e:
267 exe_msg = traceback.format_exc()
268 sdk_data_json = json.dumps(exe_msg)
269 logger.error(sdk_data_json)
275 Return a list of device ids from devices that were both probe or manually added.
277 @return List of device id's.
282 ids_cp = (c_long * num_ids)()
283 err_cp = (c_long * 1)()
284 n = self.oceandirect.odapi_get_device_ids(ids_cp, err_cp)
291 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_device_ids")
298 Return a spectrometer object associated with device id. User should not call this function. This function is
299 used internally in OceanDirect.
301 @param[in] serial_num The device serial number.
302 @return The spectrometer object if found, None otherwise.
309 for dev_id
in devids:
311 od_status = dev.status
315 if (od_status ==
'closed'):
321 Adds a device connected via RS 232 to the device list. Untested.
323 @param[in] device_type The name of a type of device. This can be one of the following: QE-PRO, STS.
324 @param[in] bus_path The location of the device on the RS232 bus. This will be a platform-specific
325 location. Under Windows, this may be COM1, COM2, etc. Under Linux, this might
326 be /dev/ttyS0, /dev/ttyS1,
327 @param[in] baud The baud rate. See device manual for supported baud rate.
330 dev_type_cp = create_string_buffer(str.encode(device_type), len(device_type))
331 bus_path_cp = create_string_buffer(str.encode(bus_path), len(bus_path))
332 added = self.oceandirect.odapi_add_RS232_device_location(dev_type_cp, bus_path_cp, baud)
335 error_msg = self.
decode_errordecode_error(added,
"add_rs232_device")
337 logger.info(
"Add for %s at bus path %s result %d" % (device_type, bus_path, added))
341 Gets the serial number of a specified device. This is used internally to find the desired device.
343 @param[in] dev_id The id of a device.
344 @return The device serial number if found, None otherwise.
348 if dev_id
in self.open_devices:
349 serial_number = self.open_devices[dev_id].serial_number
350 if serial_number
is None:
351 serial_cp = create_string_buffer(b
'\000'*32)
352 err_cp = (c_long * 1)()
353 self.oceandirect.odapi_get_serial_number(dev_id, err_cp, serial_cp, 32)
355 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_serial_number")
357 serial_number = serial_cp.value
363 An enumerated class for feature id. Use the method "is_feature_id()" and the id's below to check
364 if a feature is supported by the device or not.
367 Do not change the values and order below without synchronizing the changes from the C files.
370 SPECTROMETER = auto()
371 THERMOELECTRIC = auto()
372 IRRADIANCE_CAL = auto()
375 WAVELENGTH_CAL = auto()
376 NONLINEARITY_CAL = auto()
377 STRAYLIGHT_CAL = auto()
378 RAW_BUS_ACCESS = auto()
379 CONTINUOUS_STROBE = auto()
380 LIGHT_SOURCE = auto()
382 OPTICAL_BENCH = auto()
386 ACQUISITION_DELAY = auto()
387 PIXEL_BINNING = auto()
389 SINGLE_STROBE = auto()
390 QUERY_STATUS = auto()
391 BACK_TO_BACK = auto()
392 LED_ACTIVITY = auto()
396 IPV4_ADDRESS = auto()
398 AUTO_NULLING = auto()
400 DEVICE_INFORMATION = auto()
401 DEVICE_ALIAS = auto()
403 SPECTRUM_ACQUISITION_CONTROL = auto()
407 if not isinstance(obj, FeatureID):
408 raise TypeError(
'not a FeatureID enumeration')
409 return c_int32(obj.value)
414 Class that models the individual spectrometer. Should be created by OceanDirectAPI instance. This
415 has an inner class called "Advanced" that contains functions to access other features of the device.
441 Read the device serial number.
443 @return The serial number.
446 serial_cp = create_string_buffer(b
'\000'*32)
447 err_cp = (c_long * 1)(0)
448 self.
oceandirectoceandirect.odapi_get_serial_number(self.
device_iddevice_id, err_cp, serial_cp, 32)
451 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_serial_number")
459 Read the device type.
461 @return The device type.
464 device_type = create_string_buffer(b
'\000' * 32)
465 err_cp = (c_long * 1)(0)
466 self.
oceandirectoceandirect.odapi_get_device_type(self.
device_iddevice_id, err_cp, device_type, 32)
469 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_device_type")
472 return device_type.value.decode()
476 Read the correct spectrometer model name assigned.
478 @return The device model name.
481 model_cp = create_string_buffer(b
'\000'*32)
482 err_cp = (c_long * 1)(0)
483 self.
oceandirectoceandirect.odapi_get_device_name(self.
device_iddevice_id, err_cp, model_cp, 32)
486 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_serial_number")
489 self.
model_namemodel_name = model_cp.value.decode()
494 Decodes the error string returned from device calls.
496 @param[in] errno The error code.
497 @param[in] caller The method name that calls this function.
498 @return The string description of the error code.
501 error_str_len = self.
oceandirectoceandirect.odapi_get_error_string_length(errno)
502 errstr_cp = create_string_buffer(b
'\000'*error_str_len)
503 self.
oceandirectoceandirect.odapi_get_error_string(errno, errstr_cp, error_str_len)
505 return errstr_cp.value.decode()
509 Open the current device associated with this spectrometer object.
512 err_cp = (c_long * 1)(0)
516 logger.error(
"open_device %s" % self.
decode_errordecode_error(err_cp[0],
"open_device"))
517 error_msg = self.
decode_errordecode_error(err_cp[0],
"open_device")
520 self.
statusstatus =
'open'
521 err_cp = (c_long * 1)(0)
524 self.
decode_errordecode_error(err_cp[0],
"get_formatted_spectrum_length")
527 error_msg = self.
decode_errordecode_error(err_cp[0],
"odapi_get_unformatted_spectrum_length")
535 Detaches the device to free it up for other users. This function must be called when you're done using the device.
538 err_cp = (c_long * 1)(0)
539 if self.
statusstatus ==
'open':
542 error_msg = self.
decode_errordecode_error(err_cp[0],
"close_device")
544 self.
statusstatus =
'closed'
548 Determine if nonlinearity correction should be used in calculations. Typically should be set to true.
550 @param[in] nonlinearity_flag True to enable nonlinearity correction otherwise it's False.
554 if nonlinearity_flag:
561 Sets the number of spectra to average.
563 @param[in] newScanToAverage The number of spectra to average.
566 err_cp = (c_long * 1)(0)
567 self.
oceandirectoceandirect.odapi_set_scans_to_average(self.
device_iddevice_id, err_cp, newScanToAverage)
570 error_msg = self.
decode_errordecode_error(err_cp[0],
"set_scans_to_average")
575 Gets the number of spectra to average.
577 @return The number of spectra to average.
580 err_cp = (c_long * 1)(0)
581 scanToAverage = self.
oceandirectoceandirect.odapi_get_scans_to_average(self.
device_iddevice_id, err_cp)
584 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_scans_to_average")
591 Sets the boxcar width to average the spectral data.
593 @param[in] newBoxcarWidth The boxcar width.
596 err_cp = (c_long * 1)(0)
597 self.
oceandirectoceandirect.odapi_set_boxcar_width(self.
device_iddevice_id, err_cp, newBoxcarWidth)
600 error_msg = self.
decode_errordecode_error(err_cp[0],
"set_boxcar_width")
605 Read the current boxcar width setting.
607 @return The boxcar width.
610 err_cp = (c_long * 1)(0)
611 boxcarWidth = self.
oceandirectoceandirect.odapi_get_boxcar_width(self.
device_iddevice_id, err_cp)
614 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_boxcar_width")
621 Returns the maximum pixel value the detector can read.
623 @return The maximum intensity.
626 self.
oceandirectoceandirect.odapi_get_maximum_intensity.restype = c_double
627 err_cp = (c_long * 1)(0)
628 max_intensity = self.
oceandirectoceandirect.odapi_get_maximum_intensity(self.
device_iddevice_id, err_cp)
631 error_msg = self.
decode_errordecode_error(err_cp[0],
"max_intensity")
637 Return a formatted spectrum.
639 @return The formatted spectrum.
643 err_cp = (c_long * 1)(0)
646 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_formatted_spectrum")
652 Return the formatted spectra length.
654 @return The spectra length.
661 This computes the wavelengths for the spectrometer and fills in the
662 provided array (up to the given length) with those values.
664 @return The wavelength values for the device in a python list.
669 err_cp = (c_long * 1)(0)
673 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_wavelengths")
681 Returns the minimum allowable integration time on the device.
683 @return The minimum integration time.
686 err_cp = (c_long * 1)(0)
687 int_time_min = self.
oceandirectoceandirect.odapi_get_minimum_integration_time_micros(self.
device_iddevice_id, err_cp)
690 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_minimum_integration_time")
697 Returns the maximum allowable integration time on the device.
699 @return The maximum integration time.
702 err_cp = (c_long * 1)(0)
703 int_time_max = self.
oceandirectoceandirect.odapi_get_maximum_integration_time_micros(self.
device_iddevice_id, err_cp)
706 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_maximum_integration_time")
713 This function returns the smallest integration time setting, in microseconds, that is valid for the spectrometer.
714 NOTE: some devices that make use of onboard functionality to perform averaging have
715 a different, larger, minimum integration time for acquisition when averaging is enabled.
716 Refer to the documentation for your spectrometer to see if this is the case.
717 The minimum integration time when averaging is enabled can be determined
718 using odapi_get_minimum_averaging_integration_time_micros.
720 @return The minimum integration time.
723 err_cp = (c_long * 1)(0)
724 int_time_min = self.
oceandirectoceandirect.odapi_get_minimum_averaging_integration_time_micros(self.
device_iddevice_id, err_cp)
727 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_minimum_averaging_integration_time")
733 Sets the integration time on the device. This should be verified to be within range prior
734 to calling this function.
736 @param[in] int_time The new integration time in microseconds. See device manual for supported integration increment.
740 err_cp = (c_long * 1)(0)
741 error_msg = self.
oceandirectoceandirect.odapi_set_integration_time_micros(self.
device_iddevice_id, err_cp, c_ulong(int_time))
744 error_msg = self.
decode_errordecode_error(err_cp[0],
"set_integration_time")
749 Returns the current integration time on the device.
751 @return The integration time in microsecond.
754 err_cp = (c_long * 1)(0)
755 int_time = self.
oceandirectoceandirect.odapi_get_integration_time_micros(self.
device_iddevice_id, err_cp)
758 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_integration_time")
765 Returns the integration time increment on the device.
767 @return The integration time increment in microsecond.
770 err_cp = (c_long * 1)(0)
771 int_time = self.
oceandirectoceandirect.odapi_get_integration_time_increment_micros(self.
device_iddevice_id, err_cp)
774 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_integration_time_increment")
781 Set the device trigger mode.
783 @param[in] mode Trigger mode. See device manual for the supported trigger mode.
786 err_cp = (c_long * 1)(0)
790 error_msg = self.
decode_errordecode_error(err_cp[0],
"set_trigger_mode")
795 Returns the current trigger mode from the device. If this function is not
796 supported by the device then an exception will be thrown.
798 @return The trigger mode.
801 err_cp = (c_long * 1)(0)
802 trigger = self.
oceandirectoceandirect.odapi_adv_get_trigger_mode(self.
device_iddevice_id, err_cp)
805 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_trigger_mode")
812 Given an approximate wavelength, finds the closest wavelength and returns the index (pixel number) of that
813 wavelength, and the exact wavelength as an ordered pair
815 @param[in] wavelength A double value containing a best guess or approximate (this should be within bounds
816 of the entire wavelength array or an error is generated).
817 @return A pair value (tuple) of index (pixel) and wavelength value.
820 new_wl = (c_double * 1)(0)
821 err_cp = (c_long * 1)(0)
822 index = self.
oceandirectoceandirect.odapi_get_index_at_wavelength(self.
device_iddevice_id, err_cp, new_wl, c_double(wavelength))
825 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_index_at_wavelength")
827 return index, new_wl[0]
831 Given a list of approximate wavelengths, finds the closest wavelengths and returns the indices (pixel numbers) of those
832 wavelengths, and the exact wavelength as an ordered pair of lists
834 @param[in] wavelengths List of approximate wavelengths.
835 @return A pair value (tuple) of list(indices) and list(actual_wavelengths).
838 length = len(wavelengths)
839 c_indices = (c_int * wavelengthCount)()
840 c_wavelength = (c_double * wavelengthCount)(*wavelengths)
842 err_cp = (c_long * 1)(0)
843 indexCount = self.
oceandirectoceandirect.odapi_get_indices_at_wavelengths(self.
device_iddevice_id, err_cp, c_indices, length, c_wavelength, length)
846 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_indices_at_wavelengths")
850 return list(c_indices[:indexCount]), list(c_wavelength[:indexCount])
854 Given a list of approximate wavelengths, finds the closest wavelengths and returns the indices
855 (pixel numbers) of those wavelengths, and the exact wavelength as an ordered pair of lists.
857 @param[in] lo Wavelength lower limit.
858 @param[in] hi Wavelength upper limit.
859 @param[in] length The number of wavelengths to return.
860 @return A pair value (tuple) of list(indices) and list(actual_wavelengths)
864 c_indices = (c_int * wavelengthCount)()
865 c_wavelength = (c_double * wavelengthCount)()
866 err_cp = (c_long * 1)(0)
867 wavelengthFoundCount = self.
oceandirectoceandirect.odapi_get_indices_at_wavelength_range(self.
device_iddevice_id, err_cp, c_indices, wavelengthCount,
868 c_wavelength, wavelengthCount, c_double(lo), c_double(hi))
871 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_indices_at_wavelength_range")
874 if wavelengthFoundCount == 0:
875 return list(), list()
876 elif wavelengthFoundCount < length:
877 return list(c_indices[:wavelengthFoundCount]), list(c_wavelength[:wavelengthFoundCount])
879 return list(c_indices[:length]), list(c_wavelength[:length])
883 This returns the number of pixels that are electrically active but optically
884 masked (a.k.a. electric dark pixels). Note that not all detectors have optically masked pixels;
885 in that case, this function will return zero.
887 @return The number of electric dark pixels on the spectrometer.
890 err_cp = (c_long * 1)(0)
894 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_number_electric_dark_pixels")
901 This returns array (up to the given length) with the indices of the pixels that are electrically active
902 but optically masked (a.k.a. electric dark pixels). Note that not all detectors have optically
903 masked pixels; in that case, this function will return zero.
905 @return A list of pixels that are electric dark on that spectrometer.
911 err_cp = (c_long * 1)(0)
915 error_msg = self.
decode_errordecode_error(err_cp[0],
"electric_dark_pixel_count")
923 Prints the defined set of details about the device.
926 logger.info(
"Device ID : %d status %s" % (self.
device_iddevice_id, self.
statusstatus))
928 logger.info(
"Model : %s" % self.
get_modelget_model())
933 Check if the given feature ID is supported by the device or not.
934 @param[in] featureID An id from FeatureID enum.
935 @return True if the feature is supported otherwise it's false.
937 err_cp = (c_long * 1)(0)
938 feature_supported =self.
oceandirectoceandirect.odapi_is_feature_enabled(self.
device_iddevice_id, err_cp, featureID.value)
941 error_msg = self.
decode_errordecode_error(err_cp[0],
"is_feature_id_enabled")
944 return bool(c_ubyte(feature_supported))
948 Set the acquisition delay in microseconds. This may also be referred to as the
949 trigger delay. In any event, it is the time between some event (such as a request
950 for data, or an external trigger pulse) and when data acquisition begins.
952 @param[in] delayMicrosecond The new delay to use in microseconds.
955 err_cp = (c_long * 1)(0)
956 self.
oceandirectoceandirect.odapi_set_acquisition_delay_microseconds(self.
device_iddevice_id, err_cp, c_ulong(delayMicrosecond))
959 error_msg = self.
decode_errordecode_error(err_cp[0],
"set_acquisition_delay_microseconds")
964 Get the acquisition delay in microseconds. This may also be referred to as the
965 trigger delay. In any event, it is the time between some event (such as a request
966 for data, or an external trigger pulse) and when data acquisition begins.
968 Note that not all devices support reading this value back. In these cases, the
969 returned value will be the last value sent to odapi_adv_set_acquisition_delay_microseconds().
970 If no value has been set and the value cannot be read back, this function will
973 @return The acquisition delay in microseconds.
976 err_cp = (c_long * 1)(0)
977 delay_microsecond = self.
oceandirectoceandirect.odapi_get_acquisition_delay_microseconds(self.
device_iddevice_id, err_cp)
980 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_acquisition_delay_microseconds")
982 return delay_microsecond
986 Get the allowed step size for the acquisition delay in microseconds.
988 @return The acquisition delay step size in microseconds.
991 err_cp = (c_long * 1)(0)
992 delay_increment_microsecond = self.
oceandirectoceandirect.odapi_get_acquisition_delay_increment_microseconds(self.
device_iddevice_id, err_cp)
995 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_acquisition_delay_increment_microseconds")
997 return delay_increment_microsecond
1001 Get the maximum allowed acquisition delay in microseconds.
1003 @return The maximum acquisition delay in microseconds.
1006 err_cp = (c_long * 1)(0)
1007 delay_maximum_microsecond = self.
oceandirectoceandirect.odapi_get_acquisition_delay_maximum_microseconds(self.
device_iddevice_id, err_cp)
1010 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_acquisition_delay_maximum_microseconds")
1012 return delay_maximum_microsecond
1016 Get the minimum allowed acquisition delay in microseconds.
1018 @return The minimum acquisition delay in microseconds.
1021 err_cp = (c_long * 1)(0)
1022 delay_minimum_microsecond = self.
oceandirectoceandirect.odapi_get_acquisition_delay_minimum_microseconds(self.
device_iddevice_id, err_cp)
1025 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_acquisition_delay_minimum_microseconds")
1027 return delay_minimum_microsecond
1031 Store a dark spectrum for use in subsequent corrections i.e. dark correction and nonlinearity correction.
1032 @see getStoredDarkSpectrum.
1033 @param darkSpectrum[in] the buffer that contains the dark spectrum to be stored.
1036 if len(darkSpectrum) == 0:
1038 error_msg = self.
decode_errordecode_error(10,
"set_stored_dark_spectrum")
1041 err_cp = (c_long * 1)(0)
1042 double_array_count = len(darkSpectrum)
1043 double_array = (c_double * double_array_count)(0)
1044 for x
in range(double_array_count):
1045 double_array[x] = darkSpectrum[x]
1047 self.
oceandirectoceandirect.odapi_set_stored_dark_spectrum(self.
device_iddevice_id, err_cp, double_array, double_array_count)
1050 error_msg = self.
decode_errordecode_error(err_cp[0],
"set_stored_dark_spectrum")
1055 Retrieve a previously stored dark spectrum for use in subsequent corrections i.e. dark correction and nonlinearity correction.
1056 @see setStoredDarkSpectrum.
1058 @return The dark spectrum.
1062 err_cp = (c_long * 1)(0)
1065 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_stored_dark_spectrum")
1067 return list(double_array)
1071 Acquire a spectrum and use the supplied dark spectrum to perform a dark correction then return the dark corrected spectrum.
1073 @param darkSpectrum[in] the buffer that contains the dark spectrum to be used for the dark correction.
1074 @return The dark corrected spectrum.
1077 if len(darkSpectrum) == 0:
1079 error_msg = self.
decode_errordecode_error(10,
"get_dark_corrected_spectrum1")
1083 dark_spectrum_array_count = len(darkSpectrum)
1084 dark_spectrum_array = (c_double * dark_spectrum_array_count)()
1085 err_cp = (c_long * 1)(0)
1086 for x
in range(dark_spectrum_array_count):
1087 dark_spectrum_array[x] = darkSpectrum[x]
1089 self.
oceandirectoceandirect.odapi_get_dark_corrected_spectrum1(self.
device_iddevice_id, err_cp, dark_spectrum_array, dark_spectrum_array_count,
1092 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_dark_corrected_spectrum1")
1094 return list(corrected_spectrum_array)
1098 Dark correct a previously acquired illuminated spectrum and using a stored dark spectrum.
1099 @see setStoredDarkSpectrum
1101 @param illuminatedSpectrum[in] the buffer that contains the illuminated spectrum to be corrected.
1102 @return The dark corrected spectrum.
1105 if len(illuminatedSpectrum) == 0:
1107 error_msg = self.
decode_errordecode_error(10,
"dark_correct_spectrum1")
1111 illuminated_spectrum_array_count = len(illuminatedSpectrum)
1112 illuminated_spectrum_array = (c_double * illuminated_spectrum_array_count)()
1113 err_cp = (c_long * 1)(0)
1114 for x
in range(illuminated_spectrum_array_count):
1115 illuminated_spectrum_array[x] = illuminatedSpectrum[x]
1117 self.
oceandirectoceandirect.odapi_dark_correct_spectrum1(self.
device_iddevice_id, err_cp, illuminated_spectrum_array, illuminated_spectrum_array_count,
1120 error_msg = self.
decode_errordecode_error(err_cp[0],
"dark_correct_spectrum1")
1122 return list(corrected_spectrum_array)
1126 Acquire a spectrum and use the previously stored dark spectrum to perform a dark correction then return the dark corrected spectrum.
1127 @see setStoredDarkSpectrum.
1129 @return The dark corrected spectrum.
1133 err_cp = (c_long * 1)(0)
1136 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_dark_corrected_spectrum2")
1138 return list(corrected_spectrum_array)
1142 Dark correct a previously acquired illuminated spectrum and using a previously acquired dark spectrum.
1144 @param darkSpectrum[in] the buffer that contains the dark spectrum to be used for the dark correction.
1145 @param illuminatedSpectrum[in] the buffer that contains the illuminated spectrum to be corrected.
1147 @return The dark corrected spectrum.
1150 if len(darkSpectrum) == 0
or len(illuminatedSpectrum) == 0:
1152 error_msg = self.
decode_errordecode_error(10,
"dark_correct_spectrum2")
1156 dark_spectrum_array_count = len(darkSpectrum)
1157 dark_spectrum_array = (c_double * dark_spectrum_array_count)()
1158 illuminated_spectrum_array_count = len(illuminatedSpectrum)
1159 illuminated_spectrum_array = (c_double * illuminated_spectrum_array_count)()
1160 err_cp = (c_long * 1)(0)
1161 for x
in range(dark_spectrum_array_count):
1162 dark_spectrum_array[x] = darkSpectrum[x]
1164 for x
in range(illuminated_spectrum_array_count):
1165 illuminated_spectrum_array[x] = illuminatedSpectrum[x]
1167 self.
oceandirectoceandirect.odapi_dark_correct_spectrum2(self.
device_iddevice_id, err_cp, dark_spectrum_array, dark_spectrum_array_count,
1168 illuminated_spectrum_array, illuminated_spectrum_array_count,
1171 error_msg = self.
decode_errordecode_error(err_cp[0],
"dark_correct_spectrum2")
1173 return list(corrected_spectrum_array)
1177 Acquire a spectrum and use the supplied dark spectrum to perform a dark correction
1178 followed by the nonlinearity correction then return the nonlinearity corrected spectrum.
1180 @param darkSpectrum[in] the buffer that contains the dark spectrum to be used for the dark correction.
1181 @return The nonlinearity corrected spectrum.
1184 if len(darkSpectrum) == 0:
1186 error_msg = self.
decode_errordecode_error(10,
"get_nonlinearity_corrected_spectrum1")
1190 dark_spectrum_array_count = len(darkSpectrum)
1191 dark_spectrum_array = (c_double * dark_spectrum_array_count)()
1192 err_cp = (c_long * 1)(0)
1193 for x
in range(dark_spectrum_array_count):
1194 dark_spectrum_array[x] = darkSpectrum[x]
1196 self.
oceandirectoceandirect.odapi_get_nonlinearity_corrected_spectrum1(self.
device_iddevice_id, err_cp, dark_spectrum_array, dark_spectrum_array_count,
1199 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_nonlinearity_corrected_spectrum1")
1201 return list(corrected_spectrum_array)
1205 Nonlinearity correct a previously acquired illuminated spectrum using a stored dark spectrum.
1206 This function performs a dark correction using a previously stored dark spectrum prior to performing the nonlinearity correction.
1207 @see setStoredDarkSpectrum
1209 @param illuminatedSpectrum[in] the buffer that contains the illuminated spectrum to be corrected.
1210 @return The nonlinearity corrected spectrum.
1212 if len(illuminatedSpectrum) == 0:
1214 error_msg = self.
decode_errordecode_error(10,
"nonlinearity_correct_spectrum1")
1218 illuminated_spectrum_array_count = len(illuminatedSpectrum)
1219 illuminated_spectrum_array = (c_double * illuminated_spectrum_array_count)()
1220 err_cp = (c_long * 1)(0)
1221 for x
in range(illuminated_spectrum_array_count):
1222 illuminated_spectrum_array[x] = illuminatedSpectrum[x]
1224 self.
oceandirectoceandirect.odapi_nonlinearity_correct_spectrum1(self.
device_iddevice_id, err_cp, illuminated_spectrum_array, illuminated_spectrum_array_count,
1227 error_msg = self.
decode_errordecode_error(err_cp[0],
"nonlinearity_correct_spectrum1")
1229 return list(corrected_spectrum_array)
1233 Acquire a spectrum and use the previously stored dark spectrum to perform a dark correction
1234 followed by a nonlinearity correction then return the nonlinearity corrected spectrum.
1235 @see setStoredDarkSpectrum.
1237 @return The nonlinearity corrected spectrum.
1241 err_cp = (c_long * 1)(0)
1245 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_nonlinearity_corrected_spectrum2")
1247 return list(corrected_spectrum_array)
1251 Nonlinearity correct a previously acquired illuminated spectrum after dark correction using a previously acquired dark spectrum.
1253 @param darkSpectrum[in] the buffer that contains the dark spectrum to be used prior to the nonlinearity correction.
1254 @param illuminatedSpectrum[in] the buffer that contains the illuminated spectrum to be corrected.
1255 @return The nonlinearity corrected spectrum.
1257 if len(darkSpectrum) == 0
or len(illuminatedSpectrum) == 0:
1259 error_msg = self.
decode_errordecode_error(10,
"nonlinearity_correct_spectrum2")
1263 dark_spectrum_array_count = len(darkSpectrum)
1264 dark_spectrum_array = (c_double * dark_spectrum_array_count)()
1265 illuminated_spectrum_array_count = len(illuminatedSpectrum)
1266 illuminated_spectrum_array = (c_double * illuminated_spectrum_array_count)()
1267 err_cp = (c_long * 1)(0)
1269 for x
in range(dark_spectrum_array_count):
1270 dark_spectrum_array[x] = darkSpectrum[x]
1272 for x
in range(illuminated_spectrum_array_count):
1273 illuminated_spectrum_array[x] = illuminatedSpectrum[x]
1275 self.
oceandirectoceandirect.odapi_nonlinearity_correct_spectrum2(self.
device_iddevice_id, err_cp, dark_spectrum_array, dark_spectrum_array_count,
1276 illuminated_spectrum_array, illuminated_spectrum_array_count,
1279 error_msg = self.
decode_errordecode_error(err_cp[0],
"nonlinearity_correct_spectrum2")
1281 return list(corrected_spectrum_array)
1285 Enable or disable an electric dark correction.
1287 @param[in] isEnabled True to enable electric dark correction otherwise it's False.
1290 err_cp = (c_long * 1)(0)
1291 self.
oceandirectoceandirect.odapi_apply_electric_dark_correction_usage(self.
device_iddevice_id, err_cp, isEnabled)
1294 error_msg = self.
decode_errordecode_error(err_cp[0],
"set_electric_dark_correction_usage")
1299 Return electric dark correction usage.
1301 @return True if electric dark connection is applied otherwise it's False.
1304 err_cp = (c_long * 1)(0)
1305 correctionState = self.
oceandirectoceandirect.odapi_get_electric_dark_correction_usage(self.
device_iddevice_id, err_cp)
1308 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_electric_dark_correction_usage")
1311 return bool(c_ubyte(correctionState))
1315 Enable or disable nonlinearity correction.
1317 @param[in] isEnabled True to enable nonlinearity correction otherwise it's False.
1320 err_cp = (c_long * 1)(0)
1321 self.
oceandirectoceandirect.odapi_apply_nonlinearity_correct_usage(self.
device_iddevice_id, err_cp, isEnabled)
1324 error_msg = self.
decode_errordecode_error(err_cp[0],
"set_nonlinearity_correction_usage")
1329 Return nonlinearity correction usage.
1331 @return True if nonlinearity connection is applied otherwise it's False.
1334 err_cp = (c_long * 1)(0)
1335 correctionState = self.
oceandirectoceandirect.odapi_get_nonlinearity_correct_usage(self.
device_iddevice_id, err_cp)
1338 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_nonlinearity_correction_usage")
1341 return bool(c_ubyte(correctionState))
1346 Subclass containing advanced features that may or may not be in the spectrometer. The spectrometer
1347 specification guide (manual) should be consulted prior to using any of these features.
1350 lamp_on = c_ubyte(1)
1351 lamp_off = c_ubyte(0)
1352 num_nonlinearity_coeffs = 8
1360 This returns an integer denoting the length of a raw spectrum (as returned by get_unformatted_spectrum(...)).
1362 @return The length of an unformatted spectrum.
1365 err_cp = (c_long * 1)(0)
1366 unformatted_length = self.
devicedevice.oceandirect.odapi_get_unformatted_spectrum_length(self.
devicedevice.device_id, err_cp)
1369 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_unformatted_spectrum_length")
1372 return unformatted_length
1376 Return raw spectra. Spectra format may vary depending on device type. For spectra that has metadata, that
1377 section is stripped out. User should never use this method. This is use for debugging and performance testing.
1379 @return An unformatted spectra (an array of bytes).
1382 spd_c = (c_double * self.
devicedevice.pixel_count_unformatted)()
1383 err_cp = (c_long * 1)(0)
1384 spectra_count = self.
devicedevice.oceandirect.odapi_get_unformatted_spectrum(self.
devicedevice.device_id, err_cp, spd_c,
1385 self.
devicedevice.pixel_count_unformatted)
1394 Enable or disable the lamp.
1396 @param[in] enable True to enable lamp, False otherwise.
1399 err_cp = (c_long * 1)(0)
1402 self.
devicedevice.oceandirect.odapi_adv_set_lamp_enable(self.
devicedevice.device_id, err_cp, self.
lamp_onlamp_on)
1404 self.
devicedevice.oceandirect.odapi_adv_set_lamp_enable(self.
devicedevice.device_id, err_cp, self.
lamp_offlamp_off)
1412 Return the lamp state.
1414 @return True if lamp is ON otherwise False.
1417 err_cp = (c_long * 1)(0)
1418 enabled = self.
devicedevice.oceandirect.odapi_adv_get_lamp_enable(self.
devicedevice.device_id, err_cp)
1423 return bool(c_ubyte(enabled))
1427 Read the wavelength coefficients from the device. This command is being used in OBP-2.0 enabled devices.
1428 If the device don't support this command then a non-zero error code will be returned.
1430 @return List of wavelength coefficient values.
1433 wl_c = (c_double * 20)()
1434 err_cp = (c_long * 1)(0)
1435 buffer_size = self.
devicedevice.oceandirect.odapi_get_wavelength_coeffs(self.
devicedevice.device_id, err_cp, wl_c, 20)
1437 logger.info(
"Buffer size returned: %d " % (buffer_size))
1442 return list(wl_c)[:buffer_size]
1446 Set the nonlinearity coefficients data into the device. This command is being used in OBP-2.0 enabled devices.
1447 If the device don't support this command then a non-zero error code will be returned.
1449 @param[in] wavelengthCoeffs The wavelength coefficients data which is an array of float.
1450 @return Number of bytes written to the device.
1453 err_cp = (c_long * 1)(0)
1454 double_array_count = len(wavelengthCoeffs)
1455 double_array = (c_double * double_array_count)(0)
1456 for x
in range(double_array_count):
1457 double_array[x] = wavelengthCoeffs[x]
1459 self.
devicedevice.oceandirect.odapi_set_wavelength_coeffs(self.
devicedevice.device_id, err_cp, double_array, double_array_count)
1467 Read the nonlinearity coefficients stored in the device. This command is being used in OBP-2.0 enabled devices.
1468 If the device don't support this command then a non-zero error code will be returned.
1470 @return A list of nonlinearity coefficients.
1474 nl_coeff = (c_double * num_coeffs)(0)
1475 err_cp = (c_long * 1)(0)
1476 self.
devicedevice.oceandirect.odapi_adv_get_nonlinearity_coeffs(self.
devicedevice.device_id, err_cp, nl_coeff, num_coeffs)
1482 return list(nl_coeff)
1486 Set the nonlinearity coefficients data into the device. This command is being used in OBP-2.0 enabled devices.
1487 If the device don't support this command then a non-zero error code will be returned.
1489 @param[in] nonlinearityCoeffs The nonlinearity coefficients data which is an array of float.
1490 @return Number of bytes written to the device.
1493 err_cp = (c_long * 1)(0)
1494 double_array_count = len(nonlinearityCoeffs)
1495 double_array = (c_double * double_array_count)(0)
1496 for x
in range(double_array_count):
1497 double_array[x] = nonlinearityCoeffs[x]
1499 byte_write_count = self.
devicedevice.oceandirect.odapi_adv_set_nonlinearity_coeffs(self.
devicedevice.device_id, err_cp, double_array, double_array_count)
1504 return byte_write_count
1508 Read the nonlinearity coefficients count from the device. This command is being used in legacy devices.
1509 If the device don't support this command then a non-zero error code will be returned.
1511 @return The nonlinearity coefficients count.
1514 err_cp = (c_long * 1)(0)
1515 nl_count = self.
devicedevice.oceandirect.odapi_adv_get_nonlinearity_coeffs_count1(self.
devicedevice.device_id, err_cp)
1518 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_nonlinearity_coeffs_count1")
1525 Read the nonlinearity coefficients count of a given position from the device. This command is being used in legacy devices.
1526 If the device don't support this command then a non-zero error code will be returned. Use the function
1527 "get_nonlinearity_coeffs_count1()" to get the correct range of the index value.
1529 @param[in] index A zero based value referring to the coefficient position.
1530 @return The nonlinearity coefficients.
1533 self.
devicedevice.oceandirect.odapi_adv_get_nonlinearity_coeffs1.restype = c_double
1535 err_cp = (c_long * 1)(0)
1536 nl_coefficient = self.
devicedevice.oceandirect.odapi_adv_get_nonlinearity_coeffs1(self.
devicedevice.device_id, err_cp, c_int(index))
1542 return nl_coefficient
1546 Set the nonlinearity coefficient of the given index position. This command is being used in legacy devices.
1547 If the device don't support this command then a non-zero error code will be returned. Use the function
1548 "get_nonlinearity_coeffs_count1()" to get the correct range of the index value.
1550 @param[in] index A zero based value referring to the coefficient position.
1551 @param[in] nl_coefficient The coefficient value.
1554 err_cp = (c_long * 1)(0)
1555 self.
devicedevice.oceandirect.odapi_adv_set_nonlinearity_coeffs1(self.
devicedevice.device_id, err_cp, c_int(index), c_double(nl_coefficient))
1563 Returns the temperature reading (celsius) of a detector thermistor. This is equivalent to calling
1564 get_temperature(index) where the "index" is a detector thermistor index. If this function is not
1565 supported by the device then an exception will be thrown.
1567 @return The temperature in degrees celsius.
1570 self.
devicedevice.oceandirect.odapi_adv_tec_read_temperature_degrees_C.restype = c_double
1571 err_cp = (c_long * 1)(0)
1572 temp = self.
devicedevice.oceandirect.odapi_adv_tec_read_temperature_degrees_C(self.
devicedevice.device_id, err_cp)
1575 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_tec_temperature_degrees_C")
1581 Apply the setpoint temperature (Celsius) in the thermo-electric cooler. If this function is not
1582 supported by the device then an exception will be thrown.
1584 @param[in] temp_C The setpoint temperature in celsius.
1587 err_cp = (c_long * 1)(0)
1588 temp = self.
devicedevice.oceandirect.odapi_adv_tec_set_temperature_setpoint_degrees_C(self.
devicedevice.device_id, err_cp, c_double(temp_C))
1597 Enable or disable the thermo-electric cooler attached to the detector. If this function is not
1598 supported by the device then an exception will be thrown.
1600 @param[in] coolerEnable True to enable the cooler, False otherwise.
1603 err_cp = (c_long * 1)(0)
1604 self.
devicedevice.oceandirect.odapi_adv_tec_set_enable(self.
devicedevice.device_id, err_cp, c_ubyte(coolerEnable))
1612 Read the state of the thermo-electric cooler whether it's enable or disable. If this function
1613 is not supported by the device then an exception will be thrown.
1615 @return True if the thermo-electric cooler is enabled, False otherwise.
1618 err_cp = (c_long * 1)(0)
1619 enabled = self.
devicedevice.oceandirect.odapi_adv_tec_get_enable(self.
devicedevice.device_id, err_cp)
1624 return bool(c_ubyte(enabled))
1628 Read the set point temperature of the thermo-electric cooler. If this function is not supported
1629 by the device then an exception will be thrown.
1631 @return The temperature value in celsius.
1634 self.
devicedevice.oceandirect.odapi_adv_tec_get_setpoint.restype = c_float
1635 err_cp = (c_long * 1)(0)
1636 temp = self.
devicedevice.oceandirect.odapi_adv_tec_get_setpoint(self.
devicedevice.device_id, err_cp)
1645 Returns the state of thermo-electric cooler temperature on whether it reached the stable
1646 temperature or not. If this function is not supported by the device then an exception will be thrown.
1648 @return True if it's stable, False otherwise.
1651 err_cp = (c_long * 1)(0)
1652 enabled = self.
devicedevice.oceandirect.odapi_adv_tec_get_stable(self.
devicedevice.device_id, err_cp)
1657 return bool(c_ubyte(enabled))
1661 Returns the thermo-electric cooler fan state whether it's enabled or not. Few devices have cooler fan.
1662 If this function is not supported by the device then an exception will be thrown.
1664 @return True if the fan is enabled, False otherwise.
1667 err_cp = (c_long * 1)(0)
1668 enabled = self.
devicedevice.oceandirect.odapi_adv_tec_get_fan_enable(self.
devicedevice.device_id, err_cp)
1673 return bool(c_ubyte(enabled))
1677 Enable or disable the thermo-electric cooler fan. Not all device have fan so running this command
1678 may fail. If this function is not supported by the device then an exception will be thrown.
1680 @param[in] fanEnable True will enable the fan, False otherwise.
1683 err_cp = (c_long * 1)(0)
1684 enabled = self.
devicedevice.oceandirect.odapi_adv_tec_set_fan_enable(self.
devicedevice.device_id, err_cp, c_ubyte(fanEnable))
1693 Reads out the number of indexed temperatures available from the device's internal
1694 memory if that feature is supported.
1696 @return The number of temperatures available
1699 err_cp = (c_long * 1)(0)
1703 tc = self.
devicedevice.oceandirect.odapi_adv_get_temperature_count(self.
devicedevice.device_id, err_cp)
1713 Reads out an indexed temperature from the device's internal memory if that feature is supported.
1715 @param[in] index An index for the device's temperature sensors. Index starts with 0 value.
1716 @return The temperature in celsius.
1719 self.
devicedevice.oceandirect.odapi_adv_get_temperature.restype = c_double
1720 err_cp = (c_long * 1)(0)
1727 temp_i = self.
devicedevice.oceandirect.odapi_adv_get_temperature(self.
devicedevice.device_id, err_cp, index)
1729 error_msg = self.
devicedevice.
decode_error(err_cp[0], (
"get_temperature(%d) error: %d " % (index, err_cp[0])))
1733 logger.warning(
"get_temperature(%d) error: index is out of bounds, count is: %d" % (index, tc))
1738 Get the irradiance calibration data from the device.
1740 @return The irradiance calibration data which is an array of float.
1743 err_cp = (c_long * 1)(0)
1744 pixel_count = self.
devicedevice.pixel_count_formatted
1745 irad_cal = (c_float * pixel_count)(0)
1746 bufferSize = self.
devicedevice.oceandirect.odapi_adv_get_irrad_calibration(self.
devicedevice.device_id, err_cp, irad_cal, c_int(pixel_count))
1752 if bufferSize != pixel_count:
1753 irad_cal_list = list()
1754 for i
in range(bufferSize):
1755 irad_cal_list.append(irad_cal[i])
1757 return irad_cal_list
1759 return list(irad_cal)
1763 Set the irradiance calibration data into the device.
1765 @param[in] iradCal The irradiance calibration data which is an array of float.
1768 err_cp = (c_long * 1)(0)
1769 float_array_count = len(iradCal)
1770 float_array = (c_float * float_array_count)(0)
1771 for x
in range(float_array_count):
1772 float_array[x] = iradCal[x]
1774 buffer_size = self.
devicedevice.oceandirect.odapi_adv_set_irrad_calibration(self.
devicedevice.device_id, err_cp, float_array, float_array_count)
1783 Get the irradiance calibration data count.
1785 @return The calibration data count.
1788 err_cp = (c_long * 1)(0)
1789 self.
devicedevice.oceandirect.odapi_adv_get_irrad_calibration_size.restype = c_int
1790 cal_count = self.
devicedevice.oceandirect.odapi_adv_get_irrad_calibration_size(self.
devicedevice.device_id, err_cp)
1799 Get the irradiance calibration collection area from the device.
1801 @return The collection area value.
1804 err_cp = (c_long * 1)(0)
1805 self.
devicedevice.oceandirect.odapi_adv_get_irrad_collection_area.restype = c_float
1807 collection_area = 0.0
1810 collection_area = self.
devicedevice.oceandirect.odapi_adv_get_irrad_collection_area(self.
devicedevice.device_id, err_cp)
1812 logger.warning(
"get_irrad_calibration_collection_area: No collection area")
1814 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_irrad_calibration_collection_area")
1816 return collection_area
1820 Set the irradiance calibration collection area to the device.
1822 @param[in] area The collection area.
1825 err_cp = (c_long * 1)(0)
1829 self.
devicedevice.oceandirect.odapi_adv_set_irrad_collection_area(self.
devicedevice.device_id, err_cp, c_float(area))
1831 logger.warning(
"set_irrad_calibration_collection_area: No collection area")
1834 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"set_irrad_calibration_collection_area")
1840 Get the state on whether the irradiance calibration collection area exists or not.
1842 @return True if the collection area value is present otherwise it's False.
1845 err_cp = (c_long * 1)(0)
1846 has_ca = self.
devicedevice.oceandirect.odapi_adv_has_irrad_collection_area(self.
devicedevice.device_id, err_cp)
1849 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"has_irrad_calibration_collection_area")
1851 return bool(c_ubyte(has_ca))
1855 Reads out the optical bench slit width in microns. If this function is not supported by the device
1856 then an exception will be thrown. If this field in the device is not yet populated then a
1857 non-zero(6) code will be returned.
1859 @return The width in microns.
1862 err_cp = (c_long * 1)(0)
1863 slit_width = self.
devicedevice.oceandirect.odapi_adv_get_optical_bench_slit_width_microns(self.
devicedevice.device_id, err_cp)
1872 Writes out the optical bench slit width in microns. If this function is not supported by the device
1873 then an exception will be thrown. If this field in the device is not yet populated then a
1874 non-zero(6) code will be returned.
1876 @param[in] widthMicrons The optical bench width.
1879 err_cp = (c_long * 1)(0)
1881 self.
devicedevice.oceandirect.odapi_adv_set_optical_bench_slit_width_microns(self.
devicedevice.device_id, err_cp, c_ushort(widthMicrons))
1884 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"set_optical_bench_slit_width")
1889 Reads the optical bench serial number. If this function is not supported by the device then an
1890 exception will be thrown.
1892 @return The serial number
1895 buffer = create_string_buffer(b
'\000'*40)
1896 err_cp = (c_long * 1)(0)
1897 self.
devicedevice.oceandirect.odapi_adv_get_optical_bench_serial_number(self.
devicedevice.device_id, err_cp, buffer, 40)
1900 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_optical_bench_serial_number")
1902 return buffer.value.decode()
1906 Writes out the optical bench serial number. If this function is not supported by the device
1907 then an exception will be thrown.
1909 @param[in] benchSerialNumber The optical bench serial number.
1912 if not benchSerialNumber:
1917 err_cp = (c_long * 1)(0)
1918 self.
devicedevice.oceandirect.odapi_adv_set_optical_bench_serial_number(self.
devicedevice.device_id, err_cp, benchSerialNumber.encode(
'utf-8'), len(benchSerialNumber))
1921 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"set_optical_bench_serial_number")
1926 Read the optical bench coating descriptions. If this function is not supported by the device
1927 then an exception will be thrown.
1929 @return The bench coating.
1932 buffer = create_string_buffer(b
'\000'*40)
1933 err_cp = (c_long * 1)(0)
1934 self.
devicedevice.oceandirect.odapi_adv_get_optical_bench_coating(self.
devicedevice.device_id, err_cp, buffer, 40)
1939 return buffer.value.decode()
1943 Writes out the optical bench coating descriptions. If this function is not supported by the device
1944 then an exception will be thrown.
1946 @param[in] benchCoating The optical bench coating.
1949 if not benchCoating:
1954 err_cp = (c_long * 1)(0)
1955 self.
devicedevice.oceandirect.odapi_adv_set_optical_bench_coating(self.
devicedevice.device_id, err_cp, benchCoating.encode(
'utf-8'), len(benchCoating))
1963 Read the optical bench filter descriptions. If this function is not supported by the device
1964 then an exception will be thrown.
1966 @return The bench filter.
1969 buffer = create_string_buffer(b
'\000'*40)
1970 err_cp = (c_long * 1)(0)
1971 self.
devicedevice.oceandirect.odapi_adv_get_optical_bench_filter(self.
devicedevice.device_id, err_cp, buffer, 40)
1976 return buffer.value.decode()
1980 Writes out the optical bench filter descriptions. If this function is not supported by the device
1981 then an exception will be thrown.
1983 @param[in] benchFilter The optical bench filter.
1991 err_cp = (c_long * 1)(0)
1992 self.
devicedevice.oceandirect.odapi_adv_set_optical_bench_filter(self.
devicedevice.device_id, err_cp, benchFilter.encode(
'utf-8'), len(benchFilter))
2000 Read the optical bench grating descriptions. If this function is not supported by the device
2001 then an exception will be thrown.
2003 @return The bench grating.
2006 buffer = create_string_buffer(b
'\000'*40)
2007 err_cp = (c_long * 1)(0)
2008 self.
devicedevice.oceandirect.odapi_adv_get_optical_bench_grating(self.
devicedevice.device_id, err_cp, buffer, 40)
2013 return buffer.value.decode()
2017 Writes out the optical bench grating descriptions. If this function is not supported by the device
2018 then an exception will be thrown.
2020 @param[in] benchGrating The optical bench grating.
2023 if not benchGrating:
2028 err_cp = (c_long * 1)(0)
2029 self.
devicedevice.oceandirect.odapi_adv_set_optical_bench_grating(self.
devicedevice.device_id, err_cp, benchGrating.encode(
'utf-8'), len(benchGrating))
2037 Read the optical bench fiber diameter. If this function is not supported by the device
2038 then an exception will be thrown.
2040 @return The bench fiber diameter.
2043 err_cp = (c_long * 1)(0)
2044 fiber_diameter = self.
devicedevice.oceandirect.odapi_adv_get_optical_bench_fiber_diameter(self.
devicedevice.device_id, err_cp)
2047 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_optical_bench_fiber_diameter")
2049 return fiber_diameter
2053 Writes out the optical bench fiber diameter. If this function is not supported by the device
2054 then an exception will be thrown.
2056 @param[in] diameterMicrons The optical bench fiber diameter in microns.
2059 err_cp = (c_long * 1)(0)
2061 self.
devicedevice.oceandirect.odapi_adv_set_optical_bench_fiber_diameter(self.
devicedevice.device_id, err_cp, c_ushort(diameterMicrons))
2064 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"set_optical_bench_fiber_diameter")
2069 Read the optical bench id. If this function is not supported by the device then an exception will be thrown.
2071 @return The bench id.
2074 err_cp = (c_long * 1)(0)
2075 bench_id_cp = create_string_buffer(b
'\000' * 100)
2076 benchId = self.
devicedevice.oceandirect.odapi_adv_get_optical_bench_id(self.
devicedevice.device_id, err_cp, bench_id_cp, 100)
2082 return bench_id_cp.value.decode()
2086 Writes out the optical bench id. If this function is not supported by the device
2087 then an exception will be thrown.
2089 @param[in] benchID The optical bench id.
2097 err_cp = (c_long * 1)(0)
2098 self.
devicedevice.oceandirect.odapi_adv_set_optical_bench_id(self.
devicedevice.device_id, err_cp, benchID.encode(
'utf-8'), len(benchID))
2116 Gets the number of light sources that are represented by the given featureID. Such
2117 light sources could be individual LEDs, light bulbs, lasers, etc. Each of these light
2118 sources may have different capabilities, such as programmable intensities and enables,
2119 which should be queried before they are used.
2121 @return The number of light sources (e.g. bulbs) in the indicated feature
2124 err_cp = (c_long * 1)(0)
2125 light_source_count = self.
devicedevice.oceandirect.odapi_adv_get_light_source_count(self.
devicedevice.device_id, err_cp)
2130 return light_source_count
2134 Queries whether the indicated light source within the given feature instance has a usable
2135 enable/disable control. If this returns False (meaning no enable available) then calling enable_light_source()
2136 or is_light_source_enabled() is likely to result in an error.
2138 @param[in] light_source_index Which of potentially many light sources (LEDs, lasers, light bulbs)
2139 within the indicated feature instance to query
2140 @return False to indicate specified light source cannot be enabled/disabled. True to indicate specified
2141 light source can be enabled/disabled with enable_light_source()
2144 err_cp = (c_long * 1)(0)
2145 status = self.
devicedevice.oceandirect.odapi_adv_light_source_has_enable(self.
devicedevice.device_id, err_cp, light_source_index)
2154 Queries whether the indicated light source within the given feature instance is enabled (energized).
2156 @param[in] light_source_index Which of potentially many light sources (LEDs, lasers, light bulbs)
2157 within the indicated feature instance to query.
2158 @return False to indicate specified light source is disabled (should emit no light). True to indicate
2159 specified light source is enabled (should emit light depending on configured intensity setting).
2162 err_cp = (c_long * 1)(0)
2163 status = self.
devicedevice.oceandirect.odapi_adv_light_source_is_enabled(self.
devicedevice.device_id, err_cp, light_source_index)
2172 Attempts to enable or disable the indicated light source within the given feature instance. Not
2173 all light sources have an enable/disable control, and this capability can be queried with has_light_source_enable().
2174 Note that an enabled light source should emit light according to its last (or default) intensity
2175 setting which might be the minimum; in this case, the light source might appear to remain off.
2177 @param[in] light_source_index Which of potentially many light sources (LEDs, lasers, light bulbs) within
2178 the indicated feature instance to query.
2179 @param[in] enable Whether to enable the light source. A value of False will attempt to disable the
2180 light source, and any other value will enable it.
2183 err_cp = (c_long * 1)(0)
2186 self.
devicedevice.oceandirect.odapi_adv_light_source_set_enable(self.
devicedevice.device_id, err_cp, light_source_index, self.
lamp_onlamp_on)
2188 self.
devicedevice.oceandirect.odapi_adv_light_source_set_enable(self.
devicedevice.device_id, err_cp, light_source_index, self.
lamp_offlamp_off)
2196 Queries whether the indicated light source within the given feature instance has a usable intensity
2197 control. If this returns False (meaning no control available) then calling set_light_source_intensity()
2198 or get_light_source_intensity() is likely to result in an error.
2200 @param[in] light_source_index Which of potentially many light sources (LEDs, lasers, light bulbs) within the
2201 indicated feature instance to query.
2202 @return False to indicate specified light source cannot have its intensity changed. True to indicate
2203 the specified light source can have its intensity controlled with set_light_source_intensity().
2206 err_cp = (c_long * 1)(0)
2207 status = self.
devicedevice.oceandirect.odapi_adv_light_source_has_variable_intensity(self.
devicedevice.device_id, err_cp, light_source_index)
2210 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"light_source_has_variable_intensity")
2216 Queries the intensity level of the indicated light source within the given feature instance. The
2217 intensity is normalized over the range [0, 1], with 0 as the minimum and 1 as the maximum.
2219 SAFETY WARNING: a light source at its minimum intensity (0) might still emit light, and in some
2220 cases, this may be harmful radiation. A value of 0 indicates the minimum of the programmable
2221 range for the light source, and does not necessarily turn the light source off. To disable a light
2222 source completely, use enable_light_source() if the device supports this feature, or
2223 provide some other mechanism to allow the light to be disabled or blocked by the operator.
2225 In some `cases, the intensity may refer to the duty cycle of a pulsed light source instead of a
2226 continuous power rating. The actual power output of the light source might not vary linearly with
2227 the reported intensity, so independent measurement or calibration of the light source may be
2230 @param[in] light_source_index Which of potentially many light sources (LEDs, lasers, light bulbs)
2231 within the indicated feature instance to query.
2232 @return Real-valued result (as a double-precision floating point number) over the range [0, 1]
2233 where 0 represents the minimum programmable intensity level and 1 indicates the maximum.
2234 Note that the minimum intensity level might still allow the light source to produce light.
2237 err_cp = (c_long * 1)(0)
2238 light_intensity = self.
devicedevice.oceandirect.odapi_adv_light_source_get_intensity(self.
devicedevice.device_id, err_cp, light_source_index)
2243 return light_intensity
2247 Sets the intensity level of the indicated light source within the given feature instance. The
2248 intensity is normalized over the range [0, 1], with 0 as the minimum and 1 as the maximum.
2250 SAFETY WARNING: a light source at its minimum intensity (0) might still emit light, and in some
2251 cases, this may be harmful radiation. A value of 0 indicates the minimum of the programmable range
2252 for the light source, and does not necessarily turn the light source off. To disable a light source
2253 completely, use enable_light_source() if the device supports this feature, or provide some other
2254 mechanism to allow the light to be disabled or blocked by the operator.
2256 In some cases, the intensity may refer to the duty cycle of a pulsed light source instead of a
2257 continuous power rating. The actual power output of the light source might not vary linearly
2258 with the reported intensity, so independent measurement or calibration of the light source may be
2261 @param[in] light_source_index Which of potentially many light sources (LEDs, lasers, light bulbs)
2262 within the indicated feature instance to query.
2263 @param[in] intensity The target intensity of the light source in the range [0, 1].
2266 err_cp = (c_long * 1)(0)
2267 self.
devicedevice.oceandirect.odapi_adv_light_source_set_intensity(self.
devicedevice.device_id, err_cp,
2268 light_source_index, c_double(intensity))
2275 Set the enable status of the single strobe signal. Note that on some
2276 devices the enable control is shared with other signals (e.g. lamp
2277 enable and continuous strobe) so this may have some side-effects and
2278 changing those features may affect the single strobe as well.
2280 @param[in] enable True to enable single strobe otherwise use False.
2283 err_cp = (c_long * 1)(0)
2286 self.
devicedevice.oceandirect.odapi_adv_set_single_strobe_enable(self.
devicedevice.device_id, err_cp, self.
lamp_onlamp_on)
2288 self.
devicedevice.oceandirect.odapi_adv_set_single_strobe_enable(self.
devicedevice.device_id, err_cp, self.
lamp_offlamp_off)
2296 Set the amount of time, in microseconds, that should elapse after a starting event before
2297 the single strobe should have a rising edge.
2299 @param[in] delayMicrosecond The delay, in microseconds, that the single strobe should wait before
2303 err_cp = (c_long * 1)(0)
2304 self.
devicedevice.oceandirect.odapi_adv_set_single_strobe_delay(self.
devicedevice.device_id, err_cp, c_ulong(delayMicrosecond))
2312 Set the amount of time, in microseconds, that the single strobe pulse should remain high after it begins.
2314 @param[in] widthMicrosecond The duration, in microseconds, of the single strobe pulse after
2315 the rising edge occurs. Once this duration elapses, a falling edge
2319 err_cp = (c_long * 1)(0)
2320 self.
devicedevice.oceandirect.odapi_adv_set_single_strobe_width(self.
devicedevice.device_id, err_cp, c_ulong(widthMicrosecond))
2328 Get the enable status of the single strobe signal. Note that on some
2329 devices the enable control is shared with other signals (e.g. lamp
2330 enable and continuous strobe) so this may have some side-effects and
2331 changing those features may affect the single strobe as well.
2333 @return True if single strobe is enabled otherwise it's False.
2336 err_cp = (c_long * 1)(0)
2337 enable = self.
devicedevice.oceandirect.odapi_adv_get_single_strobe_enable(self.
devicedevice.device_id, err_cp)
2342 return bool(c_ubyte(enable))
2346 Get the amount of time, in microseconds, that should elapse after
2347 a starting event before the single strobe should have a rising edge
2349 @return The delay in microseconds.
2352 err_cp = (c_long * 1)(0)
2353 delay_microsecond = self.
devicedevice.oceandirect.odapi_adv_get_single_strobe_delay(self.
devicedevice.device_id, err_cp)
2358 return delay_microsecond
2362 Get the amount of time, in microseconds, that the single strobe pulse
2363 should remain high after it begins.
2365 @return The pulse width in microseconds.
2368 err_cp = (c_long * 1)(0)
2369 width_microsecond = self.
devicedevice.oceandirect.odapi_adv_get_single_strobe_width(self.
devicedevice.device_id, err_cp)
2374 return width_microsecond
2378 Get the minimum amount of time, in microseconds, that should elapse after
2379 a starting event before the single strobe should have a rising edge.
2381 @return The minimum delay in microseconds.
2384 err_cp = (c_long * 1)(0)
2385 minimum_microseconds = self.
devicedevice.oceandirect.odapi_adv_get_single_strobe_delay_minimum(self.
devicedevice.device_id, err_cp)
2388 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_single_strobe_delay_minimum")
2390 return minimum_microseconds
2394 Get the maximum amount of time, in microseconds, that should elapse after
2395 a starting event before the single strobe should have a rising edge.
2397 @return The maximum delay in microseconds.
2400 err_cp = (c_long * 1)(0)
2401 maximum_microseconds = self.
devicedevice.oceandirect.odapi_adv_get_single_strobe_delay_maximum(self.
devicedevice.device_id, err_cp)
2404 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_single_strobe_delay_maximum")
2406 return maximum_microseconds
2410 Gets the single strobe delay increment in microseconds.
2412 @return The delay increment.
2414 err_cp = (c_long * 1)(0)
2415 delay_increment = self.
devicedevice.oceandirect.odapi_adv_get_single_strobe_delay_increment(self.
devicedevice.device_id, err_cp)
2418 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_single_strobe_delay_increment")
2420 return delay_increment
2424 Get the minimum amount of time, in microseconds, that the single strobe pulse
2425 should remain high after it begins.
2427 @return The minimum width in microseconds.
2430 err_cp = (c_long * 1)(0)
2431 width_minimum = self.
devicedevice.oceandirect.odapi_adv_get_single_strobe_width_minimum(self.
devicedevice.device_id, err_cp)
2434 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_single_strobe_width_minimum")
2436 return width_minimum
2440 Get the maximum amount of time, in microseconds, that the single strobe pulse
2441 should remain high after it begins.
2443 @return The maximum width in microseconds.
2445 err_cp = (c_long * 1)(0)
2446 width_maximum = self.
devicedevice.oceandirect.odapi_adv_get_single_strobe_width_maximum(self.
devicedevice.device_id, err_cp)
2449 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_single_strobe_width_maximum")
2451 return width_maximum
2455 Get the single strobe width increment.
2457 @return The width increment.
2459 err_cp = (c_long * 1)(0)
2460 width_increment = self.
devicedevice.oceandirect.odapi_adv_get_single_strobe_width_increment(self.
devicedevice.device_id, err_cp)
2463 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_single_strobe_width_increment")
2465 return width_increment
2469 Gets the single strobe cycle maximum in microseconds.
2471 @return The maximum cycle value.
2474 err_cp = (c_long * 1)(0)
2475 cyle_maximum = self.
devicedevice.oceandirect.odapi_adv_get_single_strobe_cycle_maximum(self.
devicedevice.device_id, err_cp)
2478 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_single_strobe_cycle_maximum")
2484 Sets the continuous strobe period in microseconds.
2486 @param[in] period The new period of the continuous strobe measured in microseconds
2489 err_cp = (c_long * 1)(0)
2490 self.
devicedevice.oceandirect.odapi_adv_set_continuous_strobe_period_micros(self.
devicedevice.device_id, err_cp, period)
2493 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"set_continuous_strobe_period_micros")
2498 Sets the continuous strobe enable state on the device.
2500 @param[in] enable A boolean used for denoting the desired state (on/off) of the continuous
2501 strobe generator. If the value of enable is nonzero, then the continuous
2502 strobe will operate. If the value of enable is zero, then the continuous
2503 strobe will stop. Note that on some devices the continuous strobe enable
2504 is tied to other enables (such as lamp enable or single strobe enable)
2505 which may cause side effects.
2508 err_cp = (c_long * 1)(0)
2511 self.
devicedevice.oceandirect.odapi_adv_set_continuous_strobe_enable(self.
devicedevice.device_id, err_cp, self.
lamp_onlamp_on)
2513 self.
devicedevice.oceandirect.odapi_adv_set_continuous_strobe_enable(self.
devicedevice.device_id, err_cp, self.
lamp_offlamp_off)
2516 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"set_continuous_strobe_enable")
2521 Get the continuous strobe period in microseconds.
2523 @return the period in microseconds.
2526 err_cp = (c_long * 1)(0)
2527 period_microsecond = self.
devicedevice.oceandirect.odapi_adv_get_continuous_strobe_period_micros(self.
devicedevice.device_id, err_cp)
2530 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_continuous_strobe_period")
2532 return period_microsecond
2536 Gets the continuous strobe state (enabled or disabled) of the device.
2538 @return True if continuous strobe is enabled otherwise it's False.
2541 err_cp = (c_long * 1)(0)
2542 enable = self.
devicedevice.oceandirect.odapi_adv_get_continuous_strobe_enable(self.
devicedevice.device_id, err_cp)
2547 return bool(c_ubyte(enable))
2551 Gets the minimum continuous strobe period of the device in microseconds.
2553 @return The minimum strobe period in microseconds.
2556 err_cp = (c_long * 1)(0)
2557 minimum_microsecond = self.
devicedevice.oceandirect.odapi_adv_get_continuous_strobe_period_minimum_micros(self.
devicedevice.device_id, err_cp)
2560 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_continuous_strobe_period_minimum")
2562 return minimum_microsecond
2566 Gets the maximum continuous strobe period of the device in microseconds.
2568 @return The maximum strobe period in microseconds.
2571 err_cp = (c_long * 1)(0)
2572 maximum_microsecond = self.
devicedevice.oceandirect.odapi_adv_get_continuous_strobe_period_maximum_micros(self.
devicedevice.device_id, err_cp)
2575 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_continuous_strobe_period_maximum")
2577 return maximum_microsecond
2581 This function gets the current size of the strobe period increment of the device in microseconds.
2582 The increment is dependent on the strobe period. Small strobe periods i.e. less than about 1ms
2583 will have a small increment, typically 1 microsecond. Larger strobe periods will have larger
2584 increments, typically 1ms.
2586 @return The current strobe period increment in microseconds.
2589 err_cp = (c_long * 1)(0)
2590 increment_microsecond = self.
devicedevice.oceandirect.odapi_adv_get_continuous_strobe_period_increment_micros(self.
devicedevice.device_id, err_cp)
2593 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_continuous_strobe_period_increment")
2595 return increment_microsecond
2599 Gets the strobe width of the device in microseconds.
2601 @return The current strobe width in microseconds.
2603 err_cp = (c_long * 1)(0)
2604 width_microsecond = self.
devicedevice.oceandirect.odapi_adv_get_continuous_strobe_width_micros(self.
devicedevice.device_id, err_cp)
2609 return width_microsecond
2613 Sets the continuous strobe width on the device.
2615 @param[in] widthMicrosecond The new width of the continuous strobe measured in microseconds.
2618 err_cp = (c_long * 1)(0)
2619 self.
devicedevice.oceandirect.odapi_adv_set_continuous_strobe_width_micros(self.
devicedevice.device_id, err_cp, c_ulong(widthMicrosecond))
2627 Clear the data buffer. An exception will be thrown if the command is not supported by the device.
2630 err_cp = (c_long * 1)(0)
2631 self.
devicedevice.oceandirect.odapi_adv_clear_data_buffer(self.
devicedevice.device_id, err_cp)
2639 Get the number of data elements currently in the buffer. An exception will be thrown if
2640 the command is not supported by the device.
2642 @return A count of how many items are available for retrieval from the buffer.
2645 err_cp = (c_long * 1)(0)
2646 number_of_elements = self.
devicedevice.oceandirect.odapi_adv_get_data_buffer_number_of_elements(self.
devicedevice.device_id, err_cp)
2649 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_data_buffer_number_of_elements")
2651 return number_of_elements
2655 Get the present limit of how many data elements will be retained by the buffer. This value can be
2656 changed with set_data_buffer_capacity(). An exception will be thrown if the command is
2657 not supported by the device.
2659 @return A count of how many items the buffer will store before data may be lost.
2662 err_cp = (c_long * 1)(0)
2663 maximum_buffer = self.
devicedevice.oceandirect.odapi_adv_get_data_buffer_capacity(self.
devicedevice.device_id, err_cp)
2668 return maximum_buffer
2672 Get the maximum possible configurable size for the data buffer. An exception will be thrown if
2673 the command is not supported by the device.
2675 @return The largest value that may be set with set_data_buffer_capacity().
2678 err_cp = (c_long * 1)(0)
2679 maximum_buffer_capacity = self.
devicedevice.oceandirect.odapi_adv_get_data_buffer_capacity_maximum(self.
devicedevice.device_id, err_cp)
2682 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_data_buffer_capacity_maximum")
2684 return maximum_buffer_capacity
2688 Get the minimum possible configurable size for the data buffer. An exception will be thrown if
2689 the command is not supported by the device.
2691 @return The smallest value that may be set with set_data_buffer_capacity().
2694 err_cp = (c_long * 1)(0)
2695 minimum_buffer_capacity = self.
devicedevice.oceandirect.odapi_adv_get_data_buffer_capacity_minimum(self.
devicedevice.device_id, err_cp)
2698 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_data_buffer_capacity_minimum")
2700 return minimum_buffer_capacity
2704 Set the number of data elements that the buffer should retain. This function must be used
2705 with "set_number_of_backtoback_scans()". An exception will be thrown if the command is
2706 not supported by the device.
2708 @param[in] capacity Limit on the number of data elements to store. This is bounded by what is returned
2709 by get_data_buffer_capacity_minimum() and get_data_buffer_capacity_maximum().
2712 err_cp = (c_long * 1)(0)
2713 self.
devicedevice.oceandirect.odapi_adv_set_data_buffer_capacity(self.
devicedevice.device_id, err_cp, capacity)
2721 Enable or disable data buffering. An exception will be thrown if the command is
2722 not supported by the device.
2724 @param[in] enable True enable the buffer. False disable the buffer.
2727 err_cp = (c_long * 1)(0)
2728 self.
devicedevice.oceandirect.odapi_adv_set_data_buffer_enable(self.
devicedevice.device_id, err_cp, enable)
2736 Reads the device data buffering enable state. An exception will be thrown if the command
2737 is not supported by the device.
2739 @return True if data buffering is enabled otherwise it's False.
2742 err_cp = (c_long * 1)(0)
2743 dataBufferState = self.
devicedevice.oceandirect.odapi_adv_get_data_buffer_enable(self.
devicedevice.device_id, err_cp)
2748 return bool(c_ubyte(dataBufferState))
2752 Abort spectra acquisition and put the device into an idle state. To resume spectra acquisition,
2753 you have to call acquire_spectra_to_buffer() first before calling the get spectra command. Very
2754 few devices supported this command.
2757 err_cp = (c_long * 1)(0)
2758 self.
devicedevice.oceandirect.odapi_adv_abort_acquisition(self.
devicedevice.device_id, err_cp)
2766 Start spectra acquisition. This would transition the device into a non-idle state. Very
2767 few devices supported this command. An exception will be thrown if the command is
2768 not supported by the device.
2771 err_cp = (c_long * 1)(0)
2772 self.
devicedevice.oceandirect.odapi_adv_acquire_spectra_to_buffer(self.
devicedevice.device_id, err_cp)
2780 Return device idle state. Very few devices supported this command. An exception will be thrown if
2781 the command is not supported by the device.
2783 @return True if the device is idle otherwise it's False.
2786 err_cp = (c_long * 1)(0)
2787 retval = self.
devicedevice.oceandirect.odapi_adv_get_device_idle_state(self.
devicedevice.device_id, err_cp)
2793 return bool(c_ubyte(retval))
2797 Get the number of back-to-back scans. See device manual if data buffering is supported.
2799 @return The back-to-back scan value.
2802 err_cp = (c_long * 1)(0)
2803 retval = self.
devicedevice.oceandirect.odapi_adv_get_number_of_backtoback_scans(self.
devicedevice.device_id, err_cp)
2806 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_number_of_backtoback_scans")
2813 Set the number of spectra that the device will capture per trigger event. This function requires
2814 data buffer to be enabled. See "set_data_buffer_enable()". See device manual if data buffering is supported.
2816 @param[in] numScans The back-to-back scan value.
2819 err_cp = (c_long * 1)(0)
2820 self.
devicedevice.oceandirect.odapi_adv_set_number_of_backtoback_scans(self.
devicedevice.device_id, err_cp, numScans)
2823 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"set_number_of_backtoback_scans")
2828 Returns spectra with metadata information. For older devices such as FX/HDX, read a maximum of 15
2829 spectra from the data buffer. This function requires that both back to back scans and data buffer
2830 be enabled. See "set_data_buffer_enable()" and "set_number_of_backtoback_scans()". For newer devices
2831 such as Ocean SR2, you can call this function right away. See device manual if this command is supported.
2833 @param[in] list_raw_spectra The spectra output buffer.
2834 @param[in] list_timestamp The timestamp output buffer of each spectra.
2835 @param[in] buffer_size The buffer array size (maximum is 15).
2836 @return The number of spectra read. It can be zero.
2839 buffer = (POINTER(c_double) * buffer_size)()
2840 for x
in range(buffer_size):
2841 buffer[x] = (c_double * self.
devicedevice.pixel_count_formatted)()
2843 timestamp = (c_longlong * buffer_size)(0)
2844 err_cp = (c_long * 1)(0)
2845 spectraCount = self.
devicedevice.oceandirect.odapi_get_raw_spectrum_with_metadata(self.
devicedevice.device_id, err_cp, buffer, buffer_size,
2846 self.
devicedevice.pixel_count_formatted, timestamp, buffer_size)
2849 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_raw_spectrum_with_metadata")
2852 for x
in range(spectraCount):
2853 list_raw_spectra.append(buffer[x])
2854 list_timestamp.append(timestamp[x])
2860 This function returns the usb primary OUT endpoint for the type specified. If the type is not
2861 supported by the device, a zero is returned. 0 is normally the control endpoint. That
2862 value is not valid in this context.
2864 @return The usb endpoint address.
2867 err_cp = (c_long * 1)(0)
2868 usb_primary_endpoint_out = self.
devicedevice.oceandirect.odapi_get_device_usb_endpoint_primary_out(self.
devicedevice.device_id, err_cp)
2871 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_usb_endpoint_primary_out")
2873 return usb_primary_endpoint_out
2877 This function returns the usb primary IN endpoint for the type specified. If the type is not
2878 supported by the device, a zero is returned. 0 is normally the control endpoint. That
2879 value is not valid in this context.
2881 @return The usb endpoint address.
2884 err_cp = (c_long * 1)(0)
2885 usb_primary_endpoint_in = self.
devicedevice.oceandirect.odapi_get_device_usb_endpoint_primary_in(self.
devicedevice.device_id, err_cp)
2890 return usb_primary_endpoint_in
2894 This function returns the usb secondary OUT endpoint for the type specified. If the type is
2895 not supported by the device, a zero is returned. 0 is normally the control endpoint. That
2896 value is not valid in this context.
2898 @return The usb endpoint address.
2901 err_cp = (c_long * 1)(0)
2902 usb_secondary_endpoint_out = self.
devicedevice.oceandirect.odapi_get_device_usb_endpoint_secondary_out(self.
devicedevice.device_id, err_cp)
2905 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_usb_endpoint_secondary_out")
2907 return usb_secondary_endpoint_out
2911 This function returns the usb secondary IN endpoint for the type specified. If the type is
2912 not supported by the device, a zero is returned. 0 is normally the control endpoint. That
2913 value is not valid in this context.
2915 @return The usb endpoint address.
2918 err_cp = (c_long * 1)(0)
2920 usb_secondary_endpoint_in = self.
devicedevice.oceandirect.odapi_get_device_usb_endpoint_secondary_in(self.
devicedevice.device_id, err_cp)
2922 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_usb_endpoint_secondary_in")
2924 return usb_secondary_endpoint_in
2928 Reads data from eeprom slot. Since the value read from the slot can be of any type, this function
2929 will just returns a byte array and the caller must do the necessary data
2930 transformation (ex: convert it to float or int).
2932 @param[in] slot_number The slot number.
2933 @param[in] data_size The number of bytes to read.
2934 @return An array of bytes.
2937 err_cp = (c_long * 1)(0)
2938 buffer = (c_ubyte * data_size)()
2939 self.
devicedevice.oceandirect.odapi_adv_eeprom_read_slot(self.
devicedevice.device_id, err_cp, slot_number, buffer, data_size)
2948 Reads out the hardware revision from the device's internal memory if that feature is supported. If the device don't
2949 support this command then an exception will be thrown.
2951 @return The hardware revision.
2954 err_cp = (c_long * 1)(0)
2955 hw_revision_cp = create_string_buffer(b
'\000' * 100)
2956 revision_hardware = self.
devicedevice.oceandirect.odapi_adv_get_revision_hardware(self.
devicedevice.device_id, err_cp, hw_revision_cp, 100)
2961 return hw_revision_cp.value.decode()
2965 Reads out the firmware revision from the device's internal memory if that feature is supported.
2967 @return The firmware revision.
2970 err_cp = (c_long * 1)(0)
2971 fw_revision_cp = create_string_buffer(b
'\000' * 100)
2972 bytesRead = self.
devicedevice.oceandirect.odapi_adv_get_revision_firmware(self.
devicedevice.device_id, err_cp, fw_revision_cp, 100)
2977 return fw_revision_cp.value.decode()
2981 Reads out the FPGA revision from the device's internal memory if that feature is supported.
2983 @return The fpga revision.
2986 err_cp = (c_long * 1)(0)
2987 fpga_revision_cp = create_string_buffer(b
'\000' * 100)
2988 bytesRead = self.
devicedevice.oceandirect.odapi_adv_get_revision_fpga(self.
devicedevice.device_id, err_cp, fpga_revision_cp, 100)
2993 return fpga_revision_cp.value.decode()
2997 Check to see if DHCP (client) is enabled on the specified interface. If DHCP is enabled then the
2998 device will be able to receive an IP address from a DHCP server in the network it is connected to. See
2999 device manual if TCP/IP connection is supported.
3001 @param[in] ifNum The interface number: 0 for Ethernet, 1 for wi-fi.
3002 @return True if DHCP is enabled on the specified interface otherwise it's False.
3005 err_cp = (c_long * 1)(0)
3006 enable = self.
devicedevice.oceandirect.odapi_adv_ipv4_is_dhcp_enabled(self.
devicedevice.device_id, err_cp, c_ubyte(ifNum))
3011 return bool(c_ubyte(enable))
3015 Turn the DHCP client on or off for the device on the specified interface. See device manual if TCP/IP
3016 connection is supported.
3018 @param[in] ifNum The interface number: 0 for Ethernet, 1 for wi-fi.
3019 @param[in] enabled False turns the DHCP client off. True turns the DHCP client on.
3022 err_cp = (c_long * 1)(0)
3023 self.
devicedevice.oceandirect.odapi_adv_ipv4_set_dhcp_enable(self.
devicedevice.device_id, err_cp, ifNum, enabled)
3031 Get the number of IP addresses available on the specified interface. If DHCP is enabled on the
3032 specified interface then index 0 represents the DHCP address and the following addresses
3033 will be any static IP addresses. See device manual if TCP/IP connection is supported.
3035 @param[in] ifNum The interface number: 0 for Ethernet, 1 for wi-fi.
3036 @return The number of IP addresses on the specified interface.
3039 err_cp = (c_long * 1)(0)
3040 numIpAddress = self.
devicedevice.oceandirect.odapi_adv_ipv4_get_number_of_ip_addresses(self.
devicedevice.device_id, err_cp, ifNum)
3043 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"ipv4_get_number_of_ip_addresses")
3045 return numIpAddress;
3049 Get the assigned ip address provided by the index of a particular interface. See device manual if
3050 TCP/IP connection is supported.
3052 @param[in] ifNum The network interface. 0 for ethernet, 1 for wifi.
3053 @param[in] addressIndex The location of the ip address. Starts with 0.
3054 @param[out] outIpAddress The ip address which is a list of 4 numbers.
3055 @param[out] outNetmask The network mask of the ip address. Value range is from 0-32
3057 err_cp = (c_long * 1)(0)
3058 netmask_cp = (c_uint * 1)(0)
3059 ip_address_cp = (c_ubyte * 4)(0)
3060 self.
devicedevice.oceandirect.odapi_adv_ipv4_read_ip_address(self.
devicedevice.device_id, err_cp, c_ubyte(ifNum), c_ubyte(addressIndex),
3061 ip_address_cp, 4, netmask_cp)
3064 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"ipv4_get_number_of_ip_addresses")
3067 outNetmask = netmask_cp[0]
3068 for i
in range(len(ip_address_cp)):
3069 outIpAddress.append(ip_address_cp[i])
3073 Add a static IP address to the specified interface. The IP address is specified as 4 bytes in an
3074 array. The leading part of the IP address must contain the first element of the array, followed by the
3075 remaining parts in order to the last part of the IP address in the fourth element of the array. See
3076 device manual if TCP/IP connection is supported.
3078 @param[in] ifNum The interface number: 0 for Ethernet, 1 for wi-fi.
3079 @param[in] ipAddress The static IP address to be added. This is 4-byte array data.
3080 @param[in] netmask An 8-bit network mask specifying the subnet of the network the device is on.
3083 err_cp = (c_long * 1)(0)
3085 if len(ipAddress) != 4:
3086 error_msg =
"ipv4_add_static_ip_address() error: ipAddress must be an array of 4 bytes long."
3089 ip_address_cp = (c_ubyte * 4)(0)
3091 ip_address_cp[i] = ipAddress[i]
3094 self.
devicedevice.oceandirect.odapi_adv_ipv4_add_static_ip_address(self.
devicedevice.device_id, err_cp, c_ubyte(ifNum), ip_address_cp, 4, c_uint(netmask))
3101 Delete a static IP address on the specified interface. See device manual if TCP/IP connection is supported.
3103 @param[in] ifNum The interface number: 0 for Ethernet, 1 for wi-fi.
3104 @param[in] addressIndex The index of the address to be deleted.
3107 err_cp = (c_long * 1)(0)
3109 self.
devicedevice.oceandirect.odapi_adv_ipv4_delete_static_ip_address(self.
devicedevice.device_id, err_cp, c_ubyte(ifNum), c_ubyte(addressIndex))
3111 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"ipv4_delete_static_ip_address")
3118 @return The pin count.
3121 err_cp = (c_long * 1)(0)
3122 gpioPinCount = self.
devicedevice.oceandirect.odapi_adv_get_gpio_pin_count(self.
devicedevice.device_id, err_cp)
3132 Sets the GPIO bit direction to either output or input.
3134 @param[in] bit The bit position.
3135 @param[in] isOutput The bit value which could be true(output) or false(input).
3138 err_cp = (c_long * 1)(0)
3139 self.
devicedevice.oceandirect.odapi_adv_gpio_set_output_enable1(self.
devicedevice.device_id, err_cp, bit, isOutput)
3147 Get GPIO bit direction.
3149 @param[in] bit The bit position.
3150 @return The bit direction which could be True(out) or False(in)
3153 err_cp = (c_long * 1)(0)
3154 bitDirection = self.
devicedevice.oceandirect.odapi_adv_gpio_get_output_enable1(self.
devicedevice.device_id, err_cp, bit)
3160 return bool(c_ubyte(bitDirection))
3164 Set the direction (input/output) of the GPIO pins.
3166 @param[in] bitmask The bit mask specifying the pin directions i.e. the nth bit set to 1 sets the nth pin to output.
3169 err_cp = (c_long * 1)(0)
3170 self.
devicedevice.oceandirect.odapi_adv_gpio_set_output_enable2(self.
devicedevice.device_id, err_cp, c_int(bitmask))
3178 Get all GPIO bit direction.
3180 @return All bit (int) direction where each bit could be True(out) or False(in).
3183 err_cp = (c_long * 1)(0)
3184 allBitDirection = self.
devicedevice.oceandirect.odapi_adv_gpio_get_output_enable2(self.
devicedevice.device_id, err_cp)
3190 return allBitDirection
3194 Sets the GPIO bit value to either high or low.
3196 @param[in] bit The bit position.
3197 @param[in] isHigh The bit value which could be true(high) or false(low).
3200 err_cp = (c_long * 1)(0)
3201 self.
devicedevice.oceandirect.odapi_adv_gpio_set_value1(self.
devicedevice.device_id, err_cp, bit, isHigh)
3209 Get the GPIO bit value in whether it's high(true) or low(false).
3211 @param[in] bit The bit position.
3212 @return The bit value. True for high and False for low.
3215 err_cp = (c_long * 1)(0)
3216 bitValue = self.
devicedevice.oceandirect.odapi_adv_gpio_get_value1(self.
devicedevice.device_id, err_cp, bit)
3222 return bool(c_ubyte(bitValue))
3226 Set the logic value for all GPIO pins.
3228 @param[in] bitmask The bit mask specifying the logic level of each GPIO pin.
3231 err_cp = (c_long * 1)(0)
3232 self.
devicedevice.oceandirect.odapi_adv_gpio_set_value2(self.
devicedevice.device_id, err_cp, c_int(bitmask))
3240 Get all GPIO bit values.
3242 @return All bit value (int) where each bit could be True(high) or False(low).
3245 err_cp = (c_long * 1)(0)
3246 allBitValue = self.
devicedevice.oceandirect.odapi_adv_gpio_get_value2(self.
devicedevice.device_id, err_cp)
3256 Enable or disable device LED. If the device don't have an LED then an exception will be thrown.
3258 @param[in] isEnabled True to enable LED blinking otherwise it's False.
3261 err_cp = (c_long * 1)(0)
3262 self.
devicedevice.oceandirect.odapi_adv_set_led_enable(self.
devicedevice.device_id, err_cp, isEnabled)
3270 Get device LED state. If the device don't have an LED then an exception will be thrown.
3272 @return True if LED is enabled otherwise it's False.
3275 err_cp = (c_long * 1)(0)
3276 ledState = self.
devicedevice.oceandirect.odapi_adv_get_led_enable(self.
devicedevice.device_id, err_cp)
3282 return bool(c_ubyte(ledState))
3286 Get the original vendor id (VID) of the device.
3291 err_cp = (c_long * 1)(0)
3292 orig_vid = self.
devicedevice.oceandirect.odapi_adv_get_device_original_vid(self.
devicedevice.device_id, err_cp)
3302 Get the original product id (PID) of the device.
3307 err_cp = (c_long * 1)(0)
3308 orig_pid = self.
devicedevice.oceandirect.odapi_adv_get_device_original_pid(self.
devicedevice.device_id, err_cp)
3318 Get the current vendor id (VID) of the device.
3323 err_cp = (c_long * 1)(0)
3324 vid = self.
devicedevice.oceandirect.odapi_adv_get_device_vid(self.
devicedevice.device_id, err_cp)
3334 Get the current product id (PID) of the device.
3339 err_cp = (c_long * 1)(0)
3340 pid = self.
devicedevice.oceandirect.odapi_adv_get_device_pid(self.
devicedevice.device_id, err_cp)
3350 Get the original manufacturer string of the device.
3352 @return The manufacturer string.
3355 orig_manufacturer = create_string_buffer(b
'\000'*50)
3356 err_cp = (c_long * 1)(0)
3357 self.
devicedevice.oceandirect.odapi_adv_get_device_original_manufacturer_string(self.
devicedevice.device_id, err_cp, orig_manufacturer, 50)
3360 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_device_original_manufacturer_string")
3363 return orig_manufacturer.value.decode()
3367 Get the original model string of the device.
3369 @return The model string.
3372 orig_model = create_string_buffer(b
'\000'*50)
3373 err_cp = (c_long * 1)(0)
3374 self.
devicedevice.oceandirect.odapi_adv_get_device_original_model_string(self.
devicedevice.device_id, err_cp, orig_model, 50)
3377 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_device_original_model_string")
3380 return orig_model.value.decode()
3384 Get the current manufacturer string of the device.
3386 @return The manufacturer string.
3389 manufacturer = create_string_buffer(b
'\000'*50)
3390 err_cp = (c_long * 1)(0)
3391 self.
devicedevice.oceandirect.odapi_adv_get_device_manufacturer_string(self.
devicedevice.device_id, err_cp, manufacturer, 50)
3394 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_device_manufacturer_string")
3397 return manufacturer.value.decode()
3401 Get the current model string of the device.
3403 @return The model string.
3406 model = create_string_buffer(b
'\000'*50)
3407 err_cp = (c_long * 1)(0)
3408 self.
devicedevice.oceandirect.odapi_adv_get_device_model_string(self.
devicedevice.device_id, err_cp, model, 50)
3411 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_device_original_model_string")
3414 return model.value.decode()
3418 Set the current manufacturer string of the device.
3420 @param[in] manufacturer The new manufacturer string.
3423 if not manufacturer:
3426 err_cp = (c_long * 1)(0)
3427 self.
devicedevice.oceandirect.odapi_adv_set_device_manufacturer_string(self.
devicedevice.device_id, err_cp, manufacturer.encode(
'utf-8'), len(manufacturer))
3430 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"set_device_manufacturer_string")
3435 Set the current model string of the device.
3437 @param[in] model The new model string.
3443 err_cp = (c_long * 1)(0)
3444 self.
devicedevice.oceandirect.odapi_adv_set_device_model_string(self.
devicedevice.device_id, err_cp, model.encode(
'utf-8'), len(model))
3488 Read a list of commands supported by the device.
3490 @return A list of command code.
3493 err_cp = (c_long * 1)(0)
3495 command_array = (c_uint * command_count)(0)
3496 bufferSize = self.
devicedevice.oceandirect.odapi_adv_get_command_list(self.
devicedevice.device_id, err_cp, command_array, c_int(command_count))
3502 if bufferSize != command_count:
3503 command_list = list()
3504 for i
in range(bufferSize):
3505 command_list.append(command_array[i])
3509 return list(command_array)
3513 Sets the serial number of the device.
3515 @param[in] serialNumber The serial number. If value is empty then an exception will be thrown.
3518 if not serialNumber:
3523 err_cp = (c_long * 1)(0)
3524 error_msg = self.
devicedevice.oceandirect.odapi_set_serial_number(self.
devicedevice.device_id, err_cp, serialNumber.encode(
'utf-8'), len(serialNumber))
3532 Read the device alias from the device. If this field in the device is not yet populated then a non-zero(6) code will be returned.
3534 @return The device alias.
3537 device_alias = create_string_buffer(b
'\000'*50)
3538 err_cp = (c_long * 1)(0)
3539 self.
devicedevice.oceandirect.odapi_adv_get_device_alias(self.
devicedevice.device_id, err_cp, device_alias, 50)
3545 return device_alias.value.decode()
3549 Set a new device alias to the device.
3551 @param[in] deviceAlias The device alias. If value is empty then an exception will be thrown.
3559 err_cp = (c_long * 1)(0)
3560 self.
devicedevice.oceandirect.odapi_adv_set_device_alias(self.
devicedevice.device_id, err_cp, deviceAlias.encode(
'utf-8'), len(deviceAlias))
3568 Restarts the device.
3571 err_cp = (c_long * 1)(0)
3572 self.
devicedevice.oceandirect.odapi_adv_reset_device(self.
devicedevice.device_id, err_cp)
3580 Read the user string from the device. If this field in the device is not yet populated then a
3581 non-zero(6) code will be returned. This is the command supported for the newer OBP2.0 enabled devices.
3583 @return The user string.
3586 user_string = create_string_buffer(b
'\000'*50)
3587 err_cp = (c_long * 1)(0)
3588 self.
devicedevice.oceandirect.odapi_get_user_string(self.
devicedevice.device_id, err_cp, user_string, 50)
3594 return user_string.value.decode()
3598 Set a new user string to the device. The maximum string length is 16. This is the command supported
3599 for the newer OBP2.0 enabled devices.
3601 @param[in] userString The user string. If value is empty then an exception will be thrown.
3609 err_cp = (c_long * 1)(0)
3610 self.
devicedevice.oceandirect.odapi_set_user_string(self.
devicedevice.device_id, err_cp, userString.encode(
'utf-8'), len(userString))
3618 Read the total user string count from the device. If the device don't support this command
3619 then a non-zero error code will be returned. This command is used by legacy devices.
3621 @return The string count.
3624 err_cp = (c_long * 1)(0)
3625 string_count = self.
devicedevice.oceandirect.odapi_get_user_string_count1(self.
devicedevice.device_id, err_cp)
3635 Read the user string from the device. If this field in the device is not yet populated then a
3636 non-zero(6) code will be returned. If the device don't support this command then a non-zero
3637 error code will be returned. This command is used by legacy devices.
3639 @return The user string.
3642 user_string = create_string_buffer(b
'\000'*50)
3643 err_cp = (c_long * 1)(0)
3644 self.
devicedevice.oceandirect.odapi_get_user_string1(self.
devicedevice.device_id, err_cp, c_int(index), user_string, 50)
3650 return user_string.value.decode()
3654 Write the user string to the device. The maximum string length is 16. If the device don't support this command
3655 then a non-zero error code will be returned. This command is used by legacy devices.
3657 @param[in] index The user string index. If index is less than 0 then an exception will be thrown.
3658 @param[in] userString The user string. If value is empty then an exception will be thrown.
3661 if index < 0
or not userString:
3666 err_cp = (c_long * 1)(0)
3667 self.
devicedevice.oceandirect.odapi_set_user_string1(self.
devicedevice.device_id, err_cp, c_int(index), userString.encode(
'utf-8'), len(userString))
3675 Read the maximum ADC counts.
3677 @return The ADC counts.
3680 err_cp = (c_long * 1)(0)
3681 adcCount = self.
devicedevice.oceandirect.odapi_adv_get_autonull_maximum_adc_count(self.
devicedevice.device_id, err_cp)
3684 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_autonull_maximum_adc_count")
3691 Set the new baseline level.
3693 @param[in] baselineLevel The baseline value.
3696 err_cp = (c_long * 1)(0)
3697 self.
devicedevice.oceandirect.odapi_adv_set_autonull_baseline_level(self.
devicedevice.device_id, err_cp, c_int(baselineLevel))
3705 Read the baseline level.
3707 @return The baseline level.
3710 err_cp = (c_long * 1)(0)
3711 baseline = self.
devicedevice.oceandirect.odapi_adv_get_autonull_baseline_level(self.
devicedevice.device_id, err_cp)
3721 Set the new saturation level.
3723 @param[in] saturation The saturation value.
3726 err_cp = (c_long * 1)(0)
3727 self.
devicedevice.oceandirect.odapi_adv_set_autonull_saturation_level(self.
devicedevice.device_id, err_cp, c_int(saturation))
3730 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"set_autonull_saturation_level")
3735 Read the saturation level. Most devices returns 65535.
3737 @return The saturation level.
3740 err_cp = (c_long * 1)(0)
3741 saturation = self.
devicedevice.oceandirect.odapi_adv_get_autonull_saturation_level(self.
devicedevice.device_id, err_cp)
3744 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_autonull_saturation_level")
3751 Read the device RS-232 baud rate. Not all devices supported this command.
3753 @return The baud rate.
3756 err_cp = (c_long * 1)(0)
3757 baud_rate = self.
devicedevice.oceandirect.odapi_adv_get_baud_rate(self.
devicedevice.device_id, err_cp)
3767 Set a new baud rate for the RS-232 port. Not all devices supported this command.
3769 @param[in] baudRate The baud rate value.
3772 err_cp = (c_long * 1)(0)
3773 self.
devicedevice.oceandirect.odapi_adv_set_baud_rate(self.
devicedevice.device_id, err_cp, c_int(baudRate))
3781 Save settings to flash. Not all devices supported this command.
3784 err_cp = (c_long * 1)(0)
3785 self.
devicedevice.oceandirect.odapi_adv_save_settings_to_flash(self.
devicedevice.device_id, err_cp)
3793 Read the active pixel range from the sensor pixel array. This command is being used in OBP-2.0 enabled devices.
3794 If the device don't support this command then a non-zero error code will be returned.
3796 @return A list of active pixel range.
3799 range = (c_int * 10)(0)
3800 err_cp = (c_long * 1)(0)
3801 elementCopied = self.
devicedevice.oceandirect.odapi_get_active_pixel_range(self.
devicedevice.device_id, err_cp, range, 10)
3807 return list(range)[0:elementCopied]
3811 Read the optical dark pixel range from the sensor pixel array. This command is being used in OBP-2.0 enabled devices.
3812 If the device don't support this command then a non-zero error code will be returned.
3814 @return A list of optical dark pixel range.
3817 range = (c_int * 10)(0)
3818 err_cp = (c_long * 1)(0)
3819 elementCopied = self.
devicedevice.oceandirect.odapi_get_optical_dark_pixel_range(self.
devicedevice.device_id, err_cp, range, 10)
3825 return list(range)[0:elementCopied]
3829 Read the transition pixel range from the sensor pixel array. This command is being used in OBP-2.0 enabled devices.
3830 If the device don't support this command then a non-zero error code will be returned.
3832 @return A list of transition pixel range.
3835 range = (c_int * 10)(0)
3836 err_cp = (c_long * 1)(0)
3837 elementCopied = self.
devicedevice.oceandirect.odapi_get_transition_pixel_range(self.
devicedevice.device_id, err_cp, range, 10)
3843 return list(range)[0:elementCopied]
3847 Read bad pixel indices from the sensor pixel array. This command is being used in OBP-2.0 enabled devices.
3848 If the device don't support this command then a non-zero error code will be returned.
3850 @return A list of bad pixel indices.
3853 range = (c_int * 10)(0)
3854 err_cp = (c_long * 1)(0)
3855 elementCopied = self.
devicedevice.oceandirect.odapi_get_bad_pixel_indices(self.
devicedevice.device_id, err_cp, range, 10)
3861 return list(range)[0:elementCopied]
3865 Mark the given pixel indices as bad pixels. This command is being used in OBP-2.0 enabled devices.
3866 If the device don't support this command then a non-zero error code will be returned.
3868 @param[in] badPixelIndices nonlinearityCoeffs The nonlinearity coefficients data which is an array of float.
3869 @return Number of bytes written to the device.
3872 err_cp = (c_long * 1)(0)
3873 int_array_count = len(badPixelIndices)
3874 int_array = (c_int * int_array_count)(0)
3875 for x
in range(int_array_count):
3876 int_array[x] = badPixelIndices[x]
3878 byte_write_count = self.
devicedevice.oceandirect.odapi_set_bad_pixel_indices(self.
devicedevice.device_id, err_cp, int_array, int_array_count)
3883 return byte_write_count
An enumerated class for feature id.
def close_all_devices(self)
def decode_error(self, errno, caller)
def close_device(self, device_id)
Detach from the device indicated by device_id.
def add_network_device(self, ipAddressStr, deviceTypeStr)
Manually create an instance of the network attached device and then open it using the openDevice() fu...
def open_device(self, device_id)
Attach to a device discovered by probe_devices or get_device_ids.
def find_devices(self)
Finds all available Ocean devices by scanning on USB for devices with Ocean drivers,...
def get_device_ids(self)
Return a list of device ids from devices that were both probe or manually added.
def list_all_devices(self)
Lists defined details of all active devices.
def get_serial_number(self, dev_id)
Gets the serial number of a specified device.
def add_rs232_device(self, device_type, bus_path, baud)
Adds a device connected via RS 232 to the device list.
def get_number_devices(self)
Returns the number of devices available.
def shutdown(self)
Closes the connection to OceanDirectAPI.
def __getattr__(self, name)
def get_api_version_numbers(self)
Return OceanDirect api version information.
def get_api_rc_version_number(self)
def find_usb_devices(self)
Finds all available Ocean devices by scanning on USB for devices with Ocean drivers.
def from_serial_number(self, serial_num)
Return a spectrometer object associated with device id.
An error code and error message object wrapper.
def get_error_details(self)
def __init__(self, errorCode, errorMsg)
Subclass containing advanced features that may or may not be in the spectrometer.
def get_data_buffer_capacity_minimum(self)
Get the minimum possible configurable size for the data buffer.
def get_optical_bench_grating(self)
Read the optical bench grating descriptions.
def reset_device(self)
Restarts the device.
def set_serial_number(self, serialNumber)
Sets the serial number of the device.
def get_unformatted_spectrum(self)
Return raw spectra.
def get_device_alias(self)
Read the device alias from the device.
def set_bad_pixel_indices(self, badPixelIndices)
Mark the given pixel indices as bad pixels.
def set_optical_bench_filter(self, benchFilter)
Writes out the optical bench filter descriptions.
def set_continuous_strobe_width(self, widthMicrosecond)
Sets the continuous strobe width on the device.
def gpio_get_output_enable1(self, bit)
Get GPIO bit direction.
def get_device_model_string(self)
Get the current model string of the device.
def get_single_strobe_width(self)
Get the amount of time, in microseconds, that the single strobe pulse should remain high after it beg...
def set_led_enable(self, isEnabled)
Enable or disable device LED.
def get_usb_endpoint_primary_out(self)
This function returns the usb primary OUT endpoint for the type specified.
def get_single_strobe_delay_maximum(self)
Get the maximum amount of time, in microseconds, that should elapse after a starting event before the...
def ipv4_get_number_of_ip_addresses(self, ifNum)
Get the number of IP addresses available on the specified interface.
def set_single_strobe_delay(self, delayMicrosecond)
Set the amount of time, in microseconds, that should elapse after a starting event before the single ...
def get_tec_temperature_degrees_C(self)
Returns the temperature reading (celsius) of a detector thermistor.
def set_baud_rate(self, baudRate)
Set a new baud rate for the RS-232 port.
def get_optical_bench_slit_width(self)
Reads out the optical bench slit width in microns.
def gpio_get_value1(self, bit)
Get the GPIO bit value in whether it's high(true) or low(false).
def get_irrad_calibration_size(self)
Get the irradiance calibration data count.
def get_device_pid(self)
Get the current product id (PID) of the device.
def get_optical_bench_filter(self)
Read the optical bench filter descriptions.
def get_user_string_count2(self)
Read the total user string count from the device.
def get_nonlinearity_coeffs(self)
Read the nonlinearity coefficients stored in the device.
def get_single_strobe_delay(self)
Get the amount of time, in microseconds, that should elapse after a starting event before the single ...
def get_single_strobe_width_minimum(self)
Get the minimum amount of time, in microseconds, that the single strobe pulse should remain high afte...
def gpio_get_output_enable2(self)
Get all GPIO bit direction.
def set_continuous_strobe_enable(self, enable)
Sets the continuous strobe enable state on the device.
def get_device_original_manufacturer_string(self)
Get the original manufacturer string of the device.
def set_continuous_strobe_period(self, period)
Sets the continuous strobe period in microseconds.
def acquire_spectra_to_buffer(self)
Start spectra acquisition.
def get_tec_fan_enable(self)
Returns the thermo-electric cooler fan state whether it's enabled or not.
def get_continuous_strobe_period_maximum(self)
Gets the maximum continuous strobe period of the device in microseconds.
def get_autonull_baseline_level(self)
Read the baseline level.
def get_wavelength_coeffs(self)
Read the wavelength coefficients from the device.
def abort_acquisition(self)
Abort spectra acquisition and put the device into an idle state.
def get_revision_fpga(self)
Reads out the FPGA revision from the device's internal memory if that feature is supported.
def gpio_set_output_enable2(self, bitmask)
Set the direction (input/output) of the GPIO pins.
def get_device_vid(self)
Get the current vendor id (VID) of the device.
def gpio_set_value2(self, bitmask)
Set the logic value for all GPIO pins.
def set_data_buffer_capacity(self, capacity)
Set the number of data elements that the buffer should retain.
def read_eeprom_slot(self, slot_number, data_size)
Reads data from eeprom slot.
def set_single_strobe_width(self, widthMicrosecond)
Set the amount of time, in microseconds, that the single strobe pulse should remain high after it beg...
def get_unformatted_spectrum_length(self)
This returns an integer denoting the length of a raw spectrum (as returned by get_unformatted_spectru...
def get_usb_endpoint_primary_in(self)
This function returns the usb primary IN endpoint for the type specified.
def enable_light_source(self, light_source_index, enable)
Attempts to enable or disable the indicated light source within the given feature instance.
def get_number_of_backtoback_scans(self)
Get the number of back-to-back scans.
def set_device_model_string(self, model)
Set the current model string of the device.
def get_nonlinearity_coeffs1(self, index)
Read the nonlinearity coefficients count of a given position from the device.
def get_single_strobe_cycle_maximum(self)
Gets the single strobe cycle maximum in microseconds.
def set_autonull_baseline_level(self, baselineLevel)
Set the new baseline level.
def get_tec_stable(self)
Returns the state of thermo-electric cooler temperature on whether it reached the stable temperature ...
def set_nonlinearity_coeffs1(self, index, nl_coefficient)
Set the nonlinearity coefficient of the given index position.
def get_data_buffer_enable(self)
Reads the device data buffering enable state.
def set_data_buffer_enable(self, enable)
Enable or disable data buffering.
def get_led_enable(self)
Get device LED state.
def get_autonull_maximum_adc_count(self)
Read the maximum ADC counts.
def get_continuous_strobe_enable(self)
Gets the continuous strobe state (enabled or disabled) of the device.
def get_active_pixel_range(self)
Read the active pixel range from the sensor pixel array.
def set_optical_bench_serial_number(self, benchSerialNumber)
Writes out the optical bench serial number.
def get_usb_endpoint_secondary_in(self)
This function returns the usb secondary IN endpoint for the type specified.
def get_device_original_model_string(self)
Get the original model string of the device.
def set_device_alias(self, deviceAlias)
Set a new device alias to the device.
def get_continuous_strobe_period_increment(self)
This function gets the current size of the strobe period increment of the device in microseconds.
def get_temperature(self, index)
Reads out an indexed temperature from the device's internal memory if that feature is supported.
def get_temperature_count(self)
Reads out the number of indexed temperatures available from the device's internal memory if that feat...
def get_nonlinearity_coeffs_count1(self)
Read the nonlinearity coefficients count from the device.
def set_number_of_backtoback_scans(self, numScans)
Set the number of spectra that the device will capture per trigger event.
def has_irrad_calibration_collection_area(self)
Get the state on whether the irradiance calibration collection area exists or not.
def get_optical_bench_fiber_diameter(self)
Read the optical bench fiber diameter.
def set_tec_enable(self, coolerEnable)
Enable or disable the thermo-electric cooler attached to the detector.
def set_optical_bench_id(self, benchID)
Writes out the optical bench id.
def gpio_set_value1(self, bit, isHigh)
Sets the GPIO bit value to either high or low.
def set_user_string(self, userString)
Set a new user string to the device.
def get_data_buffer_capacity_maximum(self)
Get the maximum possible configurable size for the data buffer.
def get_revision_hardware(self)
Reads out the hardware revision from the device's internal memory if that feature is supported.
def ipv4_read_ip_address(self, ifNum, addressIndex, outIpAddress, outNetmask)
Get the assigned ip address provided by the index of a particular interface.
def set_enable_lamp(self, enable)
Enable or disable the lamp.
def get_irrad_calibration(self)
Get the irradiance calibration data from the device.
def set_nonlinearity_coeffs(self, nonlinearityCoeffs)
Set the nonlinearity coefficients data into the device.
def get_device_original_pid(self)
Get the original product id (PID) of the device.
def is_light_source_enabled(self, light_source_index)
Queries whether the indicated light source within the given feature instance is enabled (energized).
def set_device_manufacturer_string(self, manufacturer)
Set the current manufacturer string of the device.
def get_continuous_strobe_period_minimum(self)
Gets the minimum continuous strobe period of the device in microseconds.
def set_irrad_calibration(self, iradCal)
Set the irradiance calibration data into the device.
def clear_data_buffer(self)
Clear the data buffer.
def set_irrad_calibration_collection_area(self, area)
Set the irradiance calibration collection area to the device.
def get_optical_bench_id(self)
Read the optical bench id.
def get_single_strobe_enable(self)
Get the enable status of the single strobe signal.
def get_data_buffer_number_of_elements(self)
Get the number of data elements currently in the buffer.
def set_user_string2(self, index, userString)
Write the user string to the device.
def get_irrad_calibration_collection_area(self)
Get the irradiance calibration collection area from the device.
def get_optical_dark_pixel_range(self)
Read the optical dark pixel range from the sensor pixel array.
def ipv4_is_dhcp_enabled(self, ifNum)
Check to see if DHCP (client) is enabled on the specified interface.
def has_light_source_enable(self, light_source_index)
Queries whether the indicated light source within the given feature instance has a usable enable/disa...
def get_device_original_vid(self)
Get the original vendor id (VID) of the device.
def get_enable_lamp(self)
Return the lamp state.
def set_wavelength_coeffs(self, wavelengthCoeffs)
Set the nonlinearity coefficients data into the device.
def set_autonull_saturation_level(self, saturation)
Set the new saturation level.
def ipv4_add_static_ip_address(self, ifNum, ipAddress, netmask)
Add a static IP address to the specified interface.
def get_light_source_count(self)
Gets the number of light sources that are represented by the given featureID.
def get_tec_setpoint(self)
Read the set point temperature of the thermo-electric cooler.
def get_raw_spectrum_with_metadata(self, list_raw_spectra, list_timestamp, buffer_size)
Returns spectra with metadata information.
def get_light_source_intensity(self, light_source_index)
Queries the intensity level of the indicated light source within the given feature instance.
def get_device_idle_state(self)
Return device idle state.
def get_gpio_pin_count(self)
Get GPIO pin count.
def get_user_string(self)
Read the user string from the device.
def gpio_set_output_enable1(self, bit, isOutput)
Sets the GPIO bit direction to either output or input.
def get_device_manufacturer_string(self)
Get the current manufacturer string of the device.
def save_settings_to_flash(self)
Save settings to flash.
def get_command_list(self)
Read a list of commands supported by the device.
def light_source_has_variable_intensity(self, light_source_index)
Queries whether the indicated light source within the given feature instance has a usable intensity c...
def get_autonull_saturation_level(self)
Read the saturation level.
def set_tec_fan_enable(self, fanEnable)
Enable or disable the thermo-electric cooler fan.
def set_tec_setpoint(self, temp_C)
Apply the setpoint temperature (Celsius) in the thermo-electric cooler.
def get_usb_endpoint_secondary_out(self)
This function returns the usb secondary OUT endpoint for the type specified.
def get_continuous_strobe_width(self)
Gets the strobe width of the device in microseconds.
def get_optical_bench_serial_number(self)
Reads the optical bench serial number.
def get_single_strobe_delay_minimum(self)
Get the minimum amount of time, in microseconds, that should elapse after a starting event before the...
def ipv4_delete_static_ip_address(self, ifNum, addressIndex)
Delete a static IP address on the specified interface.
def set_optical_bench_slit_width(self, widthMicrons)
Writes out the optical bench slit width in microns.
def get_single_strobe_width_maximum(self)
Get the maximum amount of time, in microseconds, that the single strobe pulse should remain high afte...
def set_optical_bench_coating(self, benchCoating)
Writes out the optical bench coating descriptions.
def get_optical_bench_coating(self)
Read the optical bench coating descriptions.
def set_optical_bench_fiber_diameter(self, diameterMicrons)
Writes out the optical bench fiber diameter.
def set_optical_bench_grating(self, benchGrating)
Writes out the optical bench grating descriptions.
def get_revision_firmware(self)
Reads out the firmware revision from the device's internal memory if that feature is supported.
def get_single_strobe_width_increment(self)
Get the single strobe width increment.
def set_single_strobe_enable(self, enable)
Set the enable status of the single strobe signal.
def get_single_strobe_delay_increment(self)
Gets the single strobe delay increment in microseconds.
def gpio_get_value2(self)
Get all GPIO bit values.
def get_bad_pixel_indices(self)
Read bad pixel indices from the sensor pixel array.
def get_tec_enable(self)
Read the state of the thermo-electric cooler whether it's enable or disable.
def get_transition_pixel_range(self)
Read the transition pixel range from the sensor pixel array.
def get_continuous_strobe_period(self)
Get the continuous strobe period in microseconds.
def set_light_source_intensity(self, light_source_index, intensity)
Sets the intensity level of the indicated light source within the given feature instance.
int num_nonlinearity_coeffs
def get_data_buffer_capacity(self)
Get the present limit of how many data elements will be retained by the buffer.
def ipv4_set_dhcp_enable(self, ifNum, enabled)
Turn the DHCP client on or off for the device on the specified interface.
def get_baud_rate(self)
Read the device RS-232 baud rate.
def __init__(self, device)
def get_user_string2(self, index)
Read the user string from the device.
Class that models the individual spectrometer.
def get_model(self)
Read the correct spectrometer model name assigned.
def get_acquisition_delay(self)
Get the acquisition delay in microseconds.
def get_scans_to_average(self)
Gets the number of spectra to average.
def dark_correct_spectrum1(self, illuminatedSpectrum)
Dark correct a previously acquired illuminated spectrum and using a stored dark spectrum.
def get_acquisition_delay_maximum(self)
Get the maximum allowed acquisition delay in microseconds.
def get_indices_at_wavelengths(self, wavelengths)
Given a list of approximate wavelengths, finds the closest wavelengths and returns the indices (pixel...
def get_electric_dark_pixel_indices(self)
This returns array (up to the given length) with the indices of the pixels that are electrically acti...
def is_feature_id_enabled(self, featureID)
Check if the given feature ID is supported by the device or not.
def get_boxcar_width(self)
Read the current boxcar width setting.
def set_electric_dark_correction_usage(self, isEnabled)
Enable or disable an electric dark correction.
def get_nonlinearity_correction_usage(self)
Return nonlinearity correction usage.
def get_integration_time_increment(self)
Returns the integration time increment on the device.
def set_trigger_mode(self, mode)
Set the device trigger mode.
def set_stored_dark_spectrum(self, darkSpectrum)
Store a dark spectrum for use in subsequent corrections i.e.
def get_dark_corrected_spectrum1(self, darkSpectrum)
Acquire a spectrum and use the supplied dark spectrum to perform a dark correction then return the da...
def get_minimum_integration_time(self)
Returns the minimum allowable integration time on the device.
def get_formatted_spectrum(self)
Return a formatted spectrum.
def dark_correct_spectrum2(self, darkSpectrum, illuminatedSpectrum)
Dark correct a previously acquired illuminated spectrum and using a previously acquired dark spectrum...
def close_device(self)
Detaches the device to free it up for other users.
def get_formatted_spectrum_length(self)
Return the formatted spectra length.
def get_serial_number(self)
Read the device serial number.
def get_maximum_integration_time(self)
Returns the maximum allowable integration time on the device.
def get_electric_dark_correction_usage(self)
Return electric dark correction usage.
def details(self)
Prints the defined set of details about the device.
def nonlinearity_correct_spectrum2(self, darkSpectrum, illuminatedSpectrum)
Nonlinearity correct a previously acquired illuminated spectrum after dark correction using a previou...
def get_nonlinearity_corrected_spectrum2(self)
Acquire a spectrum and use the previously stored dark spectrum to perform a dark correction followed ...
def __init__(self, dev_id, oceandirect)
def get_dark_corrected_spectrum2(self)
Acquire a spectrum and use the previously stored dark spectrum to perform a dark correction then retu...
def get_nonlinearity_corrected_spectrum1(self, darkSpectrum)
Acquire a spectrum and use the supplied dark spectrum to perform a dark correction followed by the no...
def get_stored_dark_spectrum(self)
Retrieve a previously stored dark spectrum for use in subsequent corrections i.e.
def get_wavelengths(self)
This computes the wavelengths for the spectrometer and fills in the provided array (up to the given l...
def set_acquisition_delay(self, delayMicrosecond)
Set the acquisition delay in microseconds.
def get_acquisition_delay_minimum(self)
Get the minimum allowed acquisition delay in microseconds.
def nonlinearity_correct_spectrum1(self, illuminatedSpectrum)
Nonlinearity correct a previously acquired illuminated spectrum using a stored dark spectrum.
def set_integration_time(self, int_time)
Sets the integration time on the device.
def set_nonlinearity_correction_usage(self, isEnabled)
Enable or disable nonlinearity correction.
def get_device_type(self)
Read the device type.
def decode_error(self, errno, caller)
Decodes the error string returned from device calls.
def get_trigger_mode(self)
Returns the current trigger mode from the device.
def set_boxcar_width(self, newBoxcarWidth)
Sets the boxcar width to average the spectral data.
def get_indices_at_wavelength_range(self, lo, hi, length)
Given a list of approximate wavelengths, finds the closest wavelengths and returns the indices (pixel...
def get_number_electric_dark_pixels(self)
This returns the number of pixels that are electrically active but optically masked (a....
def set_scans_to_average(self, newScanToAverage)
Sets the number of spectra to average.
def get_index_at_wavelength(self, wavelength)
Given an approximate wavelength, finds the closest wavelength and returns the index (pixel number) of...
def get_max_intensity(self)
Returns the maximum pixel value the detector can read.
def use_nonlinearity(self, nonlinearity_flag)
Determine if nonlinearity correction should be used in calculations.
def get_acquisition_delay_increment(self)
Get the allowed step size for the acquisition delay in microseconds.
def open_device(self)
Open the current device associated with this spectrometer object.
def get_minimum_averaging_integration_time(self)
This function returns the smallest integration time setting, in microseconds, that is valid for the s...
def get_integration_time(self)
Returns the current integration time on the device.