Classes of Submodules

Submodule eyeone

The submodule eyeone is a standalone python package. It controls our photometer i1 Basic Pro that we use to do all the luminance measurements in our color laboratory. Some notes on its performance can be found here.

EyeOne

This module provides a class that wraps the i1 Pro dll file.

class achrolab.eyeone.eyeone.EyeOne(dummy=False)

Encapsulates the functions of eyeone.dll.

EyeOne gives you an object eyeone with the following methods available. For the methods ctype prototypes are defined.

  • I1_IsConnected – checks if i1 Pro is connected
  • I1_KeyPressed – checks if key on i1 Pro has been pressed
  • I1_GetNumberOfAvailableSamples
  • I1_Calibrate – triggers calibration
  • I1_TriggerMeasurement – triggers measurement
  • I1_GetSpectrum – gets spectrum
  • I1_GetTriStimulus – gets color vector
  • I1_GetDensities
  • I1_SetSubstrate
  • I1_SetOption – sets options
  • I1_GetOption – gets options

Additionally, there are some methods for convenience:

calibrate: calibrates the i1 Pro is_calibrated: bool, which states if the i1 Pro is calibrated

Example:

>>> import eyeone, constants
>>> from ctypes import c_float
>>> eo = eyeone.EyeOne()
>>> if eo.I1_IsConnected() == constants.eNoError:
...     print("i1 Pro is connected.")
>>> eo.I1_Calibrate()
>>> eo.I1_TriggerMeasurement()
>>> spectrum = (c_float * constants.SPECTRUM_SIZE)()
>>> eo.I1_GetSpectrum(spectrum, 0)
>>> print("This is a spectrum:")
>>> print([float(f) for f in spectrum])
I1_Calibrate()

Calibrates i1 Pro.

Returns enum I1_ErrorType (c_int). eNoError (0), if no error occurs during calibration.

For details, see constants.py

I1_GetDensities(densities, index)

Gets all densities (cyan, magenta, yellow, black) of a previous triggered measurement.

Input: densities is a c_float array with DENSITY_SIZE elements. index is a c_int. Color values are stored in array.

Returns enum I1_ErrorType (c_int). eNoError (0), if no error occurs; eNoDataAvailable (8), if no measurement has been triggered or if specified index is out of range.

General remarks: Use 0 as index to fetch the result of a previously triggered single measurement. To fetch a result of a previously triggered scan specify an index between 0 and (I1_GetNumberOfScannedSamples() - 1).

If pxAutoDensity is not null, *pxAutoDensity will be set accordingly.

For details, see constants.py

I1_GetNumberOfAvailableSamples()

Returns amount of currently available samples (c_long).

I1_GetOption(option)

Gets option/key (c_char_p).

Possible options (see SDK manual or constants.py for possible values):

  • COLOR_SPACE_KEY

  • ILLUMINATION_KEY

  • OBSERVER_KEY

  • DENSITY_STANDARD_KEY

  • DENSITY_FILTER_MODE_KEY

  • I1_MEASUREMENT_MODE (I1_SINGLE_EMISSION, I1_SINGLE_REFLECTANCE

    (default), I1_SCANNING_REFLECTANCE)

  • I1_IS_RECOGNITION_ENABLED (I1_YES, I1_NO (default))

Returns value (c_char_p).

For details, see constants.py

I1_GetSpectrum(spectrum, index)

Gets spectrum of a previous triggered measurement.

Input: spectrum is a c_float array with SPECTRUM_SIZE elements. index is a c_int. Spectrum values are stored in array.

Returns enum I1_ErrorType (c_int). eNoError (0), if no error occurs; eNoDataAvailable (8), if no measurement has been triggered or if specified index is out of range.

General remarks: Use 0 as Index to fetch the result of a previously triggered single measurement. To fetch a result of a previously triggered scan specify an index between 0 and (I1_GetNumberOfScannedSamples() - 1).

For details, see constants.py

I1_GetTriStimulus(tri_stimulus, index)

Gets color vector of a previously triggered measurement.

Input: tri_stimulus is a c_float array with TRISTIMULUS_SIZE elements. index is a c_int. Color values are stored in array.

Returns enum I1_ErrorType (c_int). eNoError (0), if no error occurs; eNoDataAvailable (8), if no measurement has been triggered or if specified index is out of range.

General remarks: Use 0 as Index to fetch the result of a previously triggered single measurement. To fetch a result of a previously triggered scan specify an index between 0 and (I1_GetNumberOfScannedSamples() - 1).

For details, see constants.py

I1_IsConnected()

Tests if i1 Pro is connected.

Returns enum I1_ErrorType (c_int). eNoError (0), if connected. eDeviceNotConnected (2), if no i1 Pro is present.

For details, see constants.py

I1_KeyPressed()

Tests if key has been pressed.

Returns enum I1_ErrorType (c_int). eNoError (0), if button was pressed. eKeyNotPressed (4), if button was not pressed.

For dummy, key stays always pressed.

For details, see constants.py

I1_SetOption(option, value)

Sets given option/key (c_char_p) to given value (c_char_p).

Possible options (see SDK manual or constants.py for possible values):

  • COLOR_SPACE_KEY

  • ILLUMINATION_KEY

  • OBSERVER_KEY

  • DENSITY_STANDARD_KEY

  • DENSITY_FILTER_MODE_KEY

  • I1_MEASUREMENT_MODE (I1_SINGLE_EMISSION, I1_SINGLE_REFLECTANCE

    (default), I1_SCANNING_REFLECTANCE)

  • I1_IS_RECOGNITION_ENABLED (I1_YES, I1_NO (default))

Returns enum I1_ErrorType (c_int). eNoError (0), if no error occurs.

For details, see constants.py

I1_SetSubstrate(substrate_spectrum)

Sets substrate spectrum for density calculations.

Input: substrate_spectrum is a c_float array with SPECTRUM_SIZE elements.

Returns enum I1_ErrorType (c_int). eNoError (0), if no error occurs.

SetSubstrate(substrate_spectrum) has to be called before the first call of GetDensity().

I1_TriggerMeasurement()

Triggers measurement.

Triggers measurement depending on measurement mode set by I1_SetOption. If measurement mode is set to I1_SINGLE_EMISSION or I1_SCANNING_REFLECTANCE it is necessary to calibrate the i1 Pro before any measurement can be triggered. Use GetSpectrum(index), I1_GetTriStimulus(index), or I1_GetDensity(index) to fetch results.

Returns enum I1_ErrorType (c_int). eNoError (0), if no error occurs during calibration; eDeviceNotConnected (2), if no device is available; eDeviceNotCalibrated (3), if a (re)calibration is necessary.

For details, see constants.py

calibrate(measurement_mode='SingleEmission', color_space='CIExyY', final_prompt='nPlease put i1 Pro in measurement positionand hit button to start measurement.')

Sets i1 Pro to measurement mode and color space and calibrates i1 Pro for use.

Parameters:
measurement_mode: eyeone.constants.I1_SINGLE_EMISSION
or other string defined in eyeone.constants
color_space: eyeone.constants.COLOR_SPACE_CIExyY
or other string defined in eyeone.constants
final_prompt: string or None
the final prompt is printed to stdout in the end and the i1 Pro waits for a button press. If None nothing is printed and i1 Pro does not wait for button press.

If successful, method returns True, otherwise False. Check also the attribute EyeOne.is_calibrated. It stores a boolean, which is True, when the i1 Pro is already calibrated.

Submodule wasco

We use the submodule wasco to control the multifunction card ADIODA-PCIF12 MDA PCI that drives our dimmable tubes. We use four sets of tubes each with three Osram T8 fluorescent tubes red (58W / color 60), green (58W / color 66), and blue (58W / color 67).

Wasco

class achrolab.wasco.wasco.Wasco(dummy=False)

Gives you an object wasco which is a handle for wasco card and already initialized.

It also gives you the boardId and boardInfo in the variables boardId and boardInfo.

In principle, some definitions from wasco.h are taken, then dll is loaded using ctypes, and card is initialized.

wasco_inportW(board_id, port_offset)

Dummy function is only called when dummy=True.

Returns:
c_long (WORD) with corresponding value
wasco_outportW(board_id, channel, value)

Dummy function is only called when dummy=True.

wasco_readAnalogInp(board_id, hCallBack, channel, value, flags)

Dummy function is only called when dummy=True.