msl.equipment.resources.avantes.avaspec module
Wrapper around the avaspec.dll
SDK from Avantes.
The wrapper was written using v9.7.0.0 of the SDK.
- class msl.equipment.resources.avantes.avaspec.DeviceStatus(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
IntEnum
DeviceStatus enum.
- UNKNOWN = 0
- USB_AVAILABLE = 1
- USB_IN_USE_BY_APPLICATION = 2
- USB_IN_USE_BY_OTHER = 3
- ETH_AVAILABLE = 4
- ETH_IN_USE_BY_APPLICATION = 5
- ETH_IN_USE_BY_OTHER = 6
- ETH_ALREADY_IN_USE_USB = 7
- class msl.equipment.resources.avantes.avaspec.InterfaceType(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
IntEnum
InterfaceType enum.
- RS232 = 0
- USB5216 = 1
- USBMINI = 2
- USB7010 = 3
- ETH7010 = 4
- class msl.equipment.resources.avantes.avaspec.SensType(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
IntEnum
SensType enum.
- SENS_HAMS8378_256 = 1
- SENS_HAMS8378_1024 = 2
- SENS_ILX554 = 3
- SENS_HAMS9201 = 4
- SENS_TCD1304 = 5
- SENS_TSL1301 = 6
- SENS_TSL1401 = 7
- SENS_HAMS8378_512 = 8
- SENS_HAMS9840 = 9
- SENS_ILX511 = 10
- SENS_HAMS10420_2048X64 = 11
- SENS_HAMS11071_2048X64 = 12
- SENS_HAMS7031_1024X122 = 13
- SENS_HAMS7031_1024X58 = 14
- SENS_HAMS11071_2048X16 = 15
- SENS_HAMS11155_2048 = 16
- SENS_SU256LSB = 17
- SENS_SU512LDB = 18
- SENS_HAMS11638 = 21
- SENS_HAMS11639 = 22
- SENS_HAMS12443 = 23
- SENS_HAMG9208_512 = 24
- SENS_HAMG13913 = 25
- SENS_HAMS13496 = 26
- class msl.equipment.resources.avantes.avaspec.AvsIdentityType[source]
Bases:
Structure
IdentityType Structure.
- SerialNumber
Structure/Union member
- Status
Structure/Union member
- UserFriendlyName
Structure/Union member
- class msl.equipment.resources.avantes.avaspec.BroadcastAnswerType[source]
Bases:
Structure
BroadcastAnswerType Structure.
- InterfaceType
Structure/Union member
- LocalIp
Structure/Union member
- RemoteHostIp
Structure/Union member
- port
Structure/Union member
- reserved
Structure/Union member
- serial
Structure/Union member
- status
Structure/Union member
- class msl.equipment.resources.avantes.avaspec.ControlSettingsType[source]
Bases:
Structure
ControlSettingsType Structure.
- m_LaserDelay
Structure/Union member
- m_LaserWaveLength
Structure/Union member
- m_LaserWidth
Structure/Union member
- m_StoreToRam
Structure/Union member
- m_StrobeControl
Structure/Union member
- class msl.equipment.resources.avantes.avaspec.DarkCorrectionType[source]
Bases:
Structure
DarkCorrectionType Structure.
- m_Enable
Structure/Union member
- m_ForgetPercentage
Structure/Union member
- class msl.equipment.resources.avantes.avaspec.DetectorType[source]
Bases:
Structure
DetectorType Structure.
- m_DefectivePixels
Structure/Union member
- m_ExtOffset
Structure/Union member
- m_Gain
Structure/Union member
- m_NLEnable
Structure/Union member
- m_NrPixels
Structure/Union member
- m_Offset
Structure/Union member
- m_Reserved
Structure/Union member
- m_SensorType
Structure/Union member
- m_aFit
Structure/Union member
- m_aHighNLCounts
Structure/Union member
- m_aLowNLCounts
Structure/Union member
- m_aNLCorrect
Structure/Union member
- class msl.equipment.resources.avantes.avaspec.SmoothingType[source]
Bases:
Structure
SmoothingType Structure.
- m_SmoothModel
Structure/Union member
- m_SmoothPix
Structure/Union member
- class msl.equipment.resources.avantes.avaspec.SpectrumCalibrationType[source]
Bases:
Structure
SpectrumCalibrationType Structure.
- m_CalInttime
Structure/Union member
- m_Smoothing
Structure/Union member
- m_aCalibConvers
Structure/Union member
- class msl.equipment.resources.avantes.avaspec.IrradianceType[source]
Bases:
Structure
IrradianceType Structure.
- m_CalibrationType
Structure/Union member
- m_FiberDiameter
Structure/Union member
- m_IntensityCalib
Structure/Union member
- class msl.equipment.resources.avantes.avaspec.SpectrumCorrectionType[source]
Bases:
Structure
SpectrumCorrectionType Structure.
- m_aSpectrumCorrect
Structure/Union member
- class msl.equipment.resources.avantes.avaspec.TriggerType[source]
Bases:
Structure
TriggerType Structure.
- m_Mode
Structure/Union member
- m_Source
Structure/Union member
- m_SourceType
Structure/Union member
- class msl.equipment.resources.avantes.avaspec.MeasConfigType[source]
Bases:
Structure
MeasConfigType Structure.
- m_Control
Structure/Union member
- m_CorDynDark
Structure/Union member
- m_IntegrationDelay
Structure/Union member
- m_IntegrationTime
Structure/Union member
- m_NrAverages
Structure/Union member
- m_SaturationDetection
Structure/Union member
- m_Smoothing
Structure/Union member
- m_StartPixel
Structure/Union member
- m_StopPixel
Structure/Union member
- m_Trigger
Structure/Union member
- class msl.equipment.resources.avantes.avaspec.TimeStampType[source]
Bases:
Structure
TimeStampType Structure.
- m_Date
Structure/Union member
- m_Time
Structure/Union member
- class msl.equipment.resources.avantes.avaspec.StandAloneType[source]
Bases:
Structure
StandAloneType Structure.
- m_Enable
Structure/Union member
- m_Meas
Structure/Union member
- m_Nmsr
Structure/Union member
- class msl.equipment.resources.avantes.avaspec.DynamicStorageType[source]
Bases:
Structure
DynamicStorageType Structure.
- m_Nmsr
Structure/Union member
- m_Reserved
Structure/Union member
- class msl.equipment.resources.avantes.avaspec.TempSensorType[source]
Bases:
Structure
TempSensorType Structure.
- m_aFit
Structure/Union member
- class msl.equipment.resources.avantes.avaspec.TecControlType[source]
Bases:
Structure
TecControlType Structure.
- m_Enable
Structure/Union member
- m_Setpoint
Structure/Union member
- m_aFit
Structure/Union member
- class msl.equipment.resources.avantes.avaspec.ProcessControlType[source]
Bases:
Structure
ProcessControlType Structure.
- m_AnalogHigh
Structure/Union member
- m_AnalogLow
Structure/Union member
- m_DigitalHigh
Structure/Union member
- m_DigitalLow
Structure/Union member
- class msl.equipment.resources.avantes.avaspec.EthernetSettingsType[source]
Bases:
Structure
EthernetSettingsType Structure.
- m_DhcpEnabled
Structure/Union member
- m_Gateway
Structure/Union member
- m_IpAddr
Structure/Union member
- m_LinkStatus
Structure/Union member
- m_NetMask
Structure/Union member
- m_TcpPort
Structure/Union member
- class msl.equipment.resources.avantes.avaspec.OemDataType[source]
Bases:
Structure
OemDataType Structure.
- m_data
Structure/Union member
- class msl.equipment.resources.avantes.avaspec.HeartbeatRespType[source]
Bases:
Structure
HeartbeatRespType Structure.
- m_BitMatrix
Structure/Union member
- m_Reserved
Structure/Union member
- class msl.equipment.resources.avantes.avaspec.DeviceConfigType[source]
Bases:
Structure
DeviceConfigType Structure.
- m_ConfigVersion
Structure/Union member
- m_Detector
Structure/Union member
- m_DynamicStorage
Structure/Union member
- m_EthernetSettings
Structure/Union member
- m_Irradiance
Structure/Union member
- m_Len
Structure/Union member
- m_OemData
Structure/Union member
- m_ProcessControl
Structure/Union member
- m_Reflectance
Structure/Union member
- m_SpectrumCorrect
Structure/Union member
- m_StandAlone
Structure/Union member
- m_TecControl
Structure/Union member
- m_aReserved
Structure/Union member
- m_aTemperature
Structure/Union member
- m_aUserFriendlyId
Structure/Union member
- msl.equipment.resources.avantes.avaspec.MeasureCallback
Used as a decorator for a callback function when a scan is available.
- class msl.equipment.resources.avantes.avaspec.Avantes(record)[source]
Bases:
ConnectionSDK
Wrapper around the
avaspec.dll
SDK from Avantes.The
properties
for an Avantes connection supports the following key-value pairs in the Connections Database:'port_id': int, One of -1 (Ethernet+USB), 0 (USB) or 256 (Ethernet) [default: -1] 'activate': bool, Whether to automatically activate the connection [default: True]
Do not instantiate this class directly. Use the
connect()
method to connect to the equipment.- Parameters:
record (
EquipmentRecord
) – A record from an Equipment-Register Database.
- WM_MEAS_READY = 32769
- SETTINGS_RESERVED_LEN = 9720
- INVALID_AVS_HANDLE_VALUE = 1000
- USER_ID_LEN = 64
- AVS_SERIAL_LEN = 10
- MAX_TEMP_SENSORS = 3
- ROOT_NAME_LEN = 6
- VERSION_LEN = 16
- AVASPEC_ERROR_MSG_LEN = 8
- AVASPEC_MIN_MSG_LEN = 6
- OEM_DATA_LEN = 4096
- NR_WAVELEN_POL_COEF = 5
- NR_NONLIN_POL_COEF = 8
- MAX_VIDEO_CHANNELS = 2
- NR_DEFECTIVE_PIXELS = 30
- MAX_NR_PIXELS = 4096
- NR_TEMP_POL_COEF = 5
- NR_DAC_POL_COEF = 2
- SAT_PEAK_INVERSION = 2
- SW_TRIGGER_MODE = 0
- HW_TRIGGER_MODE = 1
- SS_TRIGGER_MODE = 2
- EXTERNAL_TRIGGER = 0
- SYNC_TRIGGER = 1
- EDGE_TRIGGER_SOURCE = 0
- LEVEL_TRIGGER_SOURCE = 1
- ILX_FIRST_USED_DARK_PIXEL = 2
- ILX_USED_DARK_PIXELS = 14
- ILX_TOTAL_DARK_PIXELS = 18
- TCD_FIRST_USED_DARK_PIXEL = 0
- TCD_USED_DARK_PIXELS = 12
- TCD_TOTAL_DARK_PIXELS = 13
- HAMS9840_FIRST_USED_DARK_PIXEL = 0
- HAMS9840_USED_DARK_PIXELS = 8
- HAMS9840_TOTAL_DARK_PIXELS = 8
- HAMS10420_FIRST_USED_DARK_PIXEL = 0
- HAMS10420_USED_DARK_PIXELS = 4
- HAMS10420_TOTAL_DARK_PIXELS = 4
- HAMS11071_FIRST_USED_DARK_PIXEL = 0
- HAMS11071_USED_DARK_PIXELS = 4
- HAMS11071_TOTAL_DARK_PIXELS = 4
- HAMS7031_FIRST_USED_DARK_PIXEL = 0
- HAMS7031_USED_DARK_PIXELS = 4
- HAMS7031_TOTAL_DARK_PIXELS = 4
- HAMS11155_TOTAL_DARK_PIXELS = 20
- MIN_ILX_INTTIME = 1.1
- MILLI_TO_MICRO = 1000
- NR_DIGITAL_OUTPUTS = 13
- NR_DIGITAL_INPUTS = 13
- NTC1_ID = 0
- NTC2_ID = 1
- TEC_ID = 2
- NR_ANALOG_OUTPUTS = 2
- ETH_CONN_STATUS_CONNECTING = 0
- ETH_CONN_STATUS_CONNECTED = 1
- ETH_CONN_STATUS_CONNECTED_NOMON = 2
- ETH_CONN_STATUS_NOCONNECTION = 3
- class DeviceStatus(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
IntEnum
DeviceStatus enum.
- UNKNOWN = 0
- USB_AVAILABLE = 1
- USB_IN_USE_BY_APPLICATION = 2
- USB_IN_USE_BY_OTHER = 3
- ETH_AVAILABLE = 4
- ETH_IN_USE_BY_APPLICATION = 5
- ETH_IN_USE_BY_OTHER = 6
- ETH_ALREADY_IN_USE_USB = 7
- class InterfaceType(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
IntEnum
InterfaceType enum.
- RS232 = 0
- USB5216 = 1
- USBMINI = 2
- USB7010 = 3
- ETH7010 = 4
- class SensType(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
IntEnum
SensType enum.
- SENS_HAMS8378_256 = 1
- SENS_HAMS8378_1024 = 2
- SENS_ILX554 = 3
- SENS_HAMS9201 = 4
- SENS_TCD1304 = 5
- SENS_TSL1301 = 6
- SENS_TSL1401 = 7
- SENS_HAMS8378_512 = 8
- SENS_HAMS9840 = 9
- SENS_ILX511 = 10
- SENS_HAMS10420_2048X64 = 11
- SENS_HAMS11071_2048X64 = 12
- SENS_HAMS7031_1024X122 = 13
- SENS_HAMS7031_1024X58 = 14
- SENS_HAMS11071_2048X16 = 15
- SENS_HAMS11155_2048 = 16
- SENS_SU256LSB = 17
- SENS_SU512LDB = 18
- SENS_HAMS11638 = 21
- SENS_HAMS11639 = 22
- SENS_HAMS12443 = 23
- SENS_HAMG9208_512 = 24
- SENS_HAMG13913 = 25
- SENS_HAMS13496 = 26
- class AvsIdentityType
Bases:
Structure
IdentityType Structure.
- SerialNumber
Structure/Union member
- Status
Structure/Union member
- UserFriendlyName
Structure/Union member
- class BroadcastAnswerType
Bases:
Structure
BroadcastAnswerType Structure.
- InterfaceType
Structure/Union member
- LocalIp
Structure/Union member
- RemoteHostIp
Structure/Union member
- port
Structure/Union member
- reserved
Structure/Union member
- serial
Structure/Union member
- status
Structure/Union member
- class ControlSettingsType
Bases:
Structure
ControlSettingsType Structure.
- m_LaserDelay
Structure/Union member
- m_LaserWaveLength
Structure/Union member
- m_LaserWidth
Structure/Union member
- m_StoreToRam
Structure/Union member
- m_StrobeControl
Structure/Union member
- class DarkCorrectionType
Bases:
Structure
DarkCorrectionType Structure.
- m_Enable
Structure/Union member
- m_ForgetPercentage
Structure/Union member
- class DetectorType
Bases:
Structure
DetectorType Structure.
- m_DefectivePixels
Structure/Union member
- m_ExtOffset
Structure/Union member
- m_Gain
Structure/Union member
- m_NLEnable
Structure/Union member
- m_NrPixels
Structure/Union member
- m_Offset
Structure/Union member
- m_Reserved
Structure/Union member
- m_SensorType
Structure/Union member
- m_aFit
Structure/Union member
- m_aHighNLCounts
Structure/Union member
- m_aLowNLCounts
Structure/Union member
- m_aNLCorrect
Structure/Union member
- class SmoothingType
Bases:
Structure
SmoothingType Structure.
- m_SmoothModel
Structure/Union member
- m_SmoothPix
Structure/Union member
- class SpectrumCalibrationType
Bases:
Structure
SpectrumCalibrationType Structure.
- m_CalInttime
Structure/Union member
- m_Smoothing
Structure/Union member
- m_aCalibConvers
Structure/Union member
- class IrradianceType
Bases:
Structure
IrradianceType Structure.
- m_CalibrationType
Structure/Union member
- m_FiberDiameter
Structure/Union member
- m_IntensityCalib
Structure/Union member
- class SpectrumCorrectionType
Bases:
Structure
SpectrumCorrectionType Structure.
- m_aSpectrumCorrect
Structure/Union member
- class TriggerType
Bases:
Structure
TriggerType Structure.
- m_Mode
Structure/Union member
- m_Source
Structure/Union member
- m_SourceType
Structure/Union member
- class MeasConfigType
Bases:
Structure
MeasConfigType Structure.
- m_Control
Structure/Union member
- m_CorDynDark
Structure/Union member
- m_IntegrationDelay
Structure/Union member
- m_IntegrationTime
Structure/Union member
- m_NrAverages
Structure/Union member
- m_SaturationDetection
Structure/Union member
- m_Smoothing
Structure/Union member
- m_StartPixel
Structure/Union member
- m_StopPixel
Structure/Union member
- m_Trigger
Structure/Union member
- class TimeStampType
Bases:
Structure
TimeStampType Structure.
- m_Date
Structure/Union member
- m_Time
Structure/Union member
- class StandAloneType
Bases:
Structure
StandAloneType Structure.
- m_Enable
Structure/Union member
- m_Meas
Structure/Union member
- m_Nmsr
Structure/Union member
- class DynamicStorageType
Bases:
Structure
DynamicStorageType Structure.
- m_Nmsr
Structure/Union member
- m_Reserved
Structure/Union member
- class TecControlType
Bases:
Structure
TecControlType Structure.
- m_Enable
Structure/Union member
- m_Setpoint
Structure/Union member
- m_aFit
Structure/Union member
- class ProcessControlType
Bases:
Structure
ProcessControlType Structure.
- m_AnalogHigh
Structure/Union member
- m_AnalogLow
Structure/Union member
- m_DigitalHigh
Structure/Union member
- m_DigitalLow
Structure/Union member
- class EthernetSettingsType
Bases:
Structure
EthernetSettingsType Structure.
- m_DhcpEnabled
Structure/Union member
- m_Gateway
Structure/Union member
- m_IpAddr
Structure/Union member
- m_LinkStatus
Structure/Union member
- m_NetMask
Structure/Union member
- m_TcpPort
Structure/Union member
- class HeartbeatRespType
Bases:
Structure
HeartbeatRespType Structure.
- m_BitMatrix
Structure/Union member
- m_Reserved
Structure/Union member
- class DeviceConfigType
Bases:
Structure
DeviceConfigType Structure.
- m_ConfigVersion
Structure/Union member
- m_Detector
Structure/Union member
- m_DynamicStorage
Structure/Union member
- m_EthernetSettings
Structure/Union member
- m_Irradiance
Structure/Union member
- m_Len
Structure/Union member
- m_OemData
Structure/Union member
- m_ProcessControl
Structure/Union member
- m_Reflectance
Structure/Union member
- m_SpectrumCorrect
Structure/Union member
- m_StandAlone
Structure/Union member
- m_TecControl
Structure/Union member
- m_aReserved
Structure/Union member
- m_aTemperature
Structure/Union member
- m_aUserFriendlyId
Structure/Union member
- activate()[source]
Activates the spectrometer for communication.
- Raises:
AvantesError – If there was an error.
- get_analog_in(analog_id)[source]
Get the status of the specified analog input.
- Parameters:
analog_id (
int
) –The identifier of the analog input to get.
AS5216:
0 = thermistor on optical bench (NIR 2.0 / NIR2.2 / NIR 2.5 / TEC)
1 = 1V2
2 = 5VIO
3 = 5VUSB
4 = AI2 = pin 18 at 26-pins connector
5 = AI1 = pin 9 at 26-pins connector
6 = NTC1 onboard thermistor
7 = Not used
Mini:
0 = NTC1 onboard thermistor
1 = Not used
2 = Not used
3 = Not used
4 = AI2 = pin 13 on micro HDMI = pin 11 on HDMI Terminal
5 = AI1 = pin 16 on micro HDMI = pin 17 on HDMI Terminal
6 = Not used
7 = Not used
AS7010:
0 = thermistor on optical bench (NIR 2.0 / NIR2.2 / NIR 2.5 / TEC)
1 = Not used
2 = Not used
3 = Not used
4 = AI2 = pin 18 at 26-pins connector
5 = AI1 = pin 9 at 26-pins connector
6 = digital temperature sensor, returns degrees Celsius, not Volts
7 = Not used
- Returns:
float
– The analog input value [Volts or degrees Celsius].- Raises:
AvantesError – If there was an error.
- get_com_port_name()[source]
Get the IP address of the device.
- Returns:
str
– The IP address of the device.- Raises:
AvantesError – If there was an error.
- get_com_type()[source]
Get the communication protocol.
- Returns:
str
– The communication type as defined below:RS232 = 0
USB5216 = 1
USBMINI = 2
USB7010 = 3
ETH7010 = 4
UNKNOWN = -1
- Raises:
AvantesError – If there was an error.
- get_dark_pixel_data()[source]
Get the optically black pixel values of the last performed measurement.
You must call
get_data()
before you call this method.- Returns:
numpy.ndarray
– The dark pixels.- Raises:
AvantesError – If there was an error.
- get_digital_in(digital_id)[source]
Get the status of the specified digital input.
- Parameters:
digital_id (
int
) –The identifier of the digital input to get.
AS5216:
0 = DI1 = Pin 24 at 26-pins connector
1 = DI2 = Pin 7 at 26-pins connector
2 = DI3 = Pin 16 at 26-pins connector
Mini:
0 = DI1 = Pin 7 on Micro HDMI = Pin 5 on HDMI terminal
1 = DI2 = Pin 5 on Micro HDMI = Pin 3 on HDMI Terminal
2 = DI3 = Pin 3 on Micro HDMI = Pin 1 on HDMI Terminal
3 = DI4 = Pin 1 on Micro HDMI = Pin 19 on HDMI Terminal
4 = DI5 = Pin 4 on Micro HDMI = Pin 2 on HDMI Terminal
5 = DI6 = Pin 2 on Micro HDMI = Pin 14 on HDMI Terminal
AS7010:
0 = DI1 = Pin 24 at 26-pins connector
1 = DI2 = Pin 7 at 26-pins connector
2 = DI3 = Pin 16 at 26-pins
- Returns:
int
– The digital input value.- Raises:
AvantesError – If there was an error.
- get_handle_from_serial(serial=None)[source]
Get the handle ID for the specified serial number.
- Parameters:
serial (
str
) – The serial number. Default is to get the status for this object.- Returns:
int
– The handle.- Raises:
AvantesError – If there was an error.
- static find(path='avaspecx64.dll', port_id=-1, nmax=16)[source]
Returns device information for each spectrometer that is connected.
- Parameters:
path (
str
) – The path to the Avantes SDK.port_id (
int
) –ID of port to be used. One of:
-1: Use both Ethernet (AS7010) and USB ports
0: Use USB port
1..255: Not supported in v9.7 of the SDK
256: Use Ethernet port (AS7010)
nmax (
int
, optional) – The maximum number of devices that can be in the list.
- Returns:
list
ofAvsIdentityType
– The information about the devices.
- get_status_by_serial(serial=None)[source]
Get the handle ID for the specified serial number.
- Parameters:
serial (
str
, optional) – The serial number. Default is to get the status for this object.- Returns:
int
– The status.- Raises:
AvantesError – If there was an error.
- get_ip_config()[source]
Retrieve IP settings from the spectrometer.
Use this function to read the Ethernet settings of the spectrometer, without having to read the complete device configuration structure.
- Returns:
EthernetSettingsType
– The Ethernet settings of the spectrometer.- Raises:
AvantesError – If there was an error.
- get_lambda()[source]
Returns the wavelength values corresponding to the pixels if available.
- Returns:
numpy.ndarray
– The wavelength value of each pixel.- Raises:
AvantesError – If there was an error.
- get_num_devices()[source]
Scans for attached devices and returns the number of devices detected.
Deprecated function, replaced by
update_usb_devices()
. The functionality is identical.- Returns:
int
– The number of devices found.
- get_oem_parameter()[source]
Returns the OEM data structure available on the spectrometer.
- Returns:
OemDataType
– The OEM parameters.- Raises:
AvantesError – If there was an error.
- get_parameter()[source]
Returns the device information of the spectrometer.
- Returns:
DeviceConfigType
– The device parameters.- Raises:
AvantesError – If there was an error.
- get_saturated_pixels()[source]
Returns, for each pixel, if a pixel was saturated (1) or not (0).
- Returns:
numpy.ndarray
– The saturation state of each pixel.- Raises:
AvantesError – If there was an error.
- get_version_info()[source]
Returns software version information.
- Returns:
- Raises:
AvantesError – If there was an error.
- get_data()[source]
Returns the pixel values of the last performed measurement.
- Returns:
int
– Tick count the last pixel of the spectrum was received by the microcontroller. Ticks are in 10 microsecond units since the spectrometer started.numpy.ndarray
– The pixel values.
- Raises:
AvantesError – If there was an error.
- get_num_pixels()[source]
Returns the number of pixels of a spectrometer.
- Raises:
AvantesError – If there was an error.
- heartbeat(req_type)[source]
Monitor the (heartbeat) functions of the spectrometer.
This function applies only to the AS7010 platform. See the DLL manual for more details.
- Parameters:
req_type (
int
) – The heartbeat request values used to control heartbeat functions.- Returns:
HeartbeatRespType
– The heartbeat response structure received from the spectrometer.- Raises:
AvantesError – If there was an error.
- init(port_id)[source]
Initializes the communication interface with the spectrometers and the internal data structures.
For Ethernet devices this function will create a list of available Ethernet spectrometers within all the network interfaces of the host.
- Parameters:
port_id (
int
) –ID of port to be used. One of:
-1: Use both Ethernet (AS7010) and USB ports
0: Use USB port
1..255: Not supported in v9.7 of the SDK
256: Use Ethernet port (AS7010)
- Returns:
int
– On success, the number of connected or found devices.- Raises:
AvantesError – If no devices were found.
- measure(num_measurements, window_handle=None)[source]
Starts measurement on the spectrometer.
- Parameters:
num_measurements (
int
) – Number of measurements to acquire. Use -1 to measure continuously untilstop_measure()
is called.window_handle (
ctypes.c_void_p
, optional) – Window handle to notify application measurement result data is available. The DLL sends a message to the window with command: WM_MEAS_READY, with SUCCESS (0
), the number of scans that were saved in RAM (if m_StoreToRAM parameter > 0, seeControlSettingsType
), or INVALID_MEAS_DATA as WPARM value and a_hDevice as LPARM value. Set this value toNone
if a callback is not needed.
- Raises:
AvantesError – If there was an error.
- measure_callback(num_measurements, callback=None)[source]
Starts measurement on the spectrometer.
- Parameters:
num_measurements (
int
) – Number of measurements to acquire. Use -1 to measure continuously untilstop_measure()
is called.callback (
MeasureCallback
, optional) – A function to notify application measurement result data is available. The DLL will call the given function to notify a measurement is ready and pass two parameters. The first parameter is a reference to the DLL handle. The second parameter is a reference to an integer value: SUCCESS (0
) if a new scan is available, or the number of scans that were saved in RAM (if m_StoreToRAM parameter > 0, seeControlSettingsType
), or INVALID_MEAS_DATA (-8
). Set this value toNone
if a callback is not needed.
Examples
from msl.equipment.resources.avantes import MeasureCallback @MeasureCallback def avantes_callback(handle, info): print('The DLL handle is:', handle.contents.value) if info.contents.value == 0: # equals 0 if everything is okay print(' callback data:', ava.get_data()) # here "ava" is a reference to the AvaSpec class ava.measure_callback(-1, avantes_callback)
- Raises:
AvantesError – If there was an error.
- poll_scan()[source]
Determines if new measurement results are available.
- Returns:
int
– Whether there is a scan available: 0 (No) or 1 (Yes).- Raises:
AvantesError – If there was an error.
- prepare_measure(config)[source]
Prepares measurement on the spectrometer using the specified measurement configuration.
- Parameters:
config (
MeasConfigType
) – The measurement configuration.- Raises:
AvantesError – If there was an error.
- register(handle)[source]
Installs an application windows handle to which device attachment/removal messages have to be sent.
- Parameters:
handle (
ctypes.c_void_p
) – Application window handle.- Raises:
AvantesError – If there was an error.
- reset_device()[source]
Performs a hard reset on the given spectrometer.
This function only works with the AS7010 platform.
During reset of the spectrometer, all spectrometer HW modules (microprocessor and USB controller) will be reset at once. The spectrometer will start its reset procedure right after sending the command response back to the host.
- Raises:
AvantesError – If there was an error.
- set_analog_out(port_id, value)[source]
Sets the analog output value for the specified analog identifier.
- Parameters:
port_id (
int
) –Identifier for one of the two output signals:
AS5216:
0 = AO1 = pin 17 at 26-pins connector
1 = AO2 = pin 26 at 26-pins connector
Mini:
0 = AO1 = Pin 12 on Micro HDMI = Pin 10 on HDMI terminal
1 = AO2 = Pin 14 on Micro HDMI = Pin 12 on HDMI terminal
AS7010:
0 = AO1 = pin 17 at 26-pins connector
1 = AO2 = pin 26 at 26-pins connector
value (
float
) – DAC value to be set in Volts (internally an 8-bits DAC is used) with range 0 - 5.0V.
- Raises:
AvantesError – If there was an error.
- set_digital_out(port_id, value)[source]
Sets the digital output value for the specified digital identifier.
- Parameters:
port_id (
int
) –Identifier for one of the 10 output signals:
AS5216:
0 = DO1 = pin 11 at 26-pins connector
1 = DO2 = pin 2 at 26-pins connector
2 = DO3 = pin 20 at 26-pins connector
3 = DO4 = pin 12 at 26-pins connector
4 = DO5 = pin 3 at 26-pins connector
5 = DO6 = pin 21 at 26-pins connector
6 = DO7 = pin 13 at 26-pins connector
7 = DO8 = pin 4 at 26-pins connector
8 = DO9 = pin 22 at 26-pins connector
9 = DO10 = pin 25 at 26-pins connector
Mini:
0 = DO1 = Pin 7 on Micro HDMI = Pin 5 on HDMI terminal
1 = DO2 = Pin 5 on Micro HDMI = Pin 3 on HDMI Terminal
2 = DO3 = Pin 3 on Micro HDMI = Pin 1 on HDMI Terminal
3 = DO4 = Pin 1 on Micro HDMI = Pin 19 on HDMI Terminal
4 = DO5 = Pin 4 on Micro HDMI = Pin 2 on HDMI Terminal
5 = DO6 = Pin 2 on Micro HDMI = Pin 14 on HDMI Terminal
6 = Not used
7 = Not used
8 = Not used
9 = Not used
AS7010:
0 = DO1 =pin 11 at 26-pins connector
1 = DO2 = pin 2 at 26-pins connector
2 = DO3 = pin 20 at 26-pins connector
3 = DO4 = pin 12 at 26-pins connector
4 = DO5 = pin 3 at 26-pins connector
5 = DO6 = pin 21 at 26-pins connector
6 = DO7 = pin 13 at 26-pins connector
7 = DO8 = pin 4 at 26-pins connector
8 = DO9 = pin 22 at 26-pins connector
9 = DO10 = pin 25 at 26-pins connector
value (
int
) – The value to be set (0 or 1).
- Raises:
AvantesError – If there was an error.
- set_oem_parameter(parameter)[source]
Sends the OEM data structure to the spectrometer.
- Parameters:
parameter (
OemDataType
) – The OEM data structure.- Raises:
AvantesError – If there was an error.
- set_parameter(parameter)[source]
Overwrites the device configuration.
Please note that
OemDataType
is part of the DeviceConfigType in EEPROM (see section 3.5 of DLL manual). Precautions must be taken to prevent OEM data overwrites when usingset_parameter()
method together withset_oem_parameter()
.- Parameters:
parameter (
DeviceConfigType
) – The device parameters.- Raises:
AvantesError – If there was an error.
- set_prescan_mode(boolean)[source]
If a prescan is set, the first measurement result will be skipped.
This function is only useful for the AvaSpec-3648 because this detector can be operated in prescan mode, or clear-buffer mode (see DLL manual).
- Parameters:
boolean (
bool
) – IfTrue
, the first measurement result will be skipped (prescan mode), else the detector will be cleared before each new scan (clear-buffer mode).- Raises:
AvantesError – If there was an error.
- set_pwm_out(port_id, frequency, duty_cycle)[source]
Selects the PWM functionality for the specified digital output.
The PWM functionality is not supported on the Mini.
- Parameters:
port_id (
int
) –Identifier for one of the 6 PWM output signals:
0 = DO1 = pin 11 at 26-pins connector
1 = DO2 = pin 2 at 26-pins connector
2 = DO3 = pin 20 at 26-pins connector
4 = DO5 = pin 3 at 26-pins connector
5 = DO6 = pin 21 at 26-pins connector
6 = DO7 = pin 13 at 26-pins connector
frequency (
int
) – Desired PWM frequency (500 - 300000) [Hz]. For the AS5216, the frequency of outputs 0, 1 and 2 is the same (the last specified frequency is used) and also the frequency of outputs 4, 5 and 6 is the same. For the AS7010, you can define six different frequencies.duty_cycle (
int
) – Percentage high time in one cycle (0 - 100). For the AS5216, channels 0, 1 and 2 have a synchronized rising edge, the same holds for channels 4, 5 and 6. For the AS7010, rising edges are unsynchronized.
- Raises:
AvantesError – If there was an error.
- set_sensitivity_mode(value)[source]
Set the sensitivity mode.
This method is supported by the following detector types: HAMS9201, HAMG9208_512, SU256LSB and SU512LDB with the appropriate firmware version.
- Parameters:
value (
int
) – 0 for low noise, >0 for high sensitivity- Raises:
AvantesError – If there was an error.
- set_sync_mode(enable)[source]
Disables/enables support for synchronous measurement.
- Parameters:
enable (
bool
) –False
to disable sync mode,True
to enable sync mode.- Raises:
AvantesError – If there was an error.
- stop_measure()[source]
Stops the measurement.
- Raises:
AvantesError – If there was an error.
- suppress_stray_light(factor)[source]
Returns the stray light corrected pixel values of a dark corrected measurement.
- Parameters:
factor (
float
) – Multiplication factor for the stray light algorithm.- Returns:
numpy.ndarray
– Scope minus dark.numpy.ndarray
– Stray light suppressed.
- Raises:
AvantesError – If there was an error.
- update_eth_devices(nmax=16)[source]
Return the number of Ethernet devices that are connected to the computer.
Internally checks the list of connected Ethernet devices and returns the number of devices attached. If the
properties
attribute contains a key'port_id'
with a value of-1
then the returned value also includes the number of USB devices.- Parameters:
nmax (
int
, optional) – The maximum number of devices that can be found.- Returns:
list
ofBroadcastAnswerType
– The information about the devices.
- update_usb_devices()[source]
Return the number of USB devices that are connected to the computer.
Internally checks the list of connected USB devices and returns the number of devices attached. If the
properties
attribute contains a key'port_id'
with a value of-1
then the returned value also includes the number of Ethernet devices.- Returns:
int
– The number of devices found.
- use_high_res_adc(enable)[source]
Enable the 16-bit AD converter.
When using the 16 bit ADC in full High Resolution mode (0..65535), please note that the irradiance intensity calibration, as well as the nonlinearity calibration are based on the 14bit ADC range. Therefore, if using the nonlinearity correction or irradiance calibration in your own software using the High Resolution mode, you need to apply the additional correction with ADCFactor (= 4.0), as explained in detail in section 4.6.1 and 4.6.3 of the manual.
- Parameters:
enable (
bool
) – IfTrue
use a 16-bit AD converter, otherwise use a 14-bit ADC.- Raises:
AvantesError – If there was an error.