colour.io.ies_tm2714 Module

IES TM-27-14 Data Input / Output

Defines the IES_TM2714_Spd class handling IES TM-27-14 spectral data XML files.

References

[1]IES Computer Committee, & TM-27-14 Working Group. (2014). IES Standard Format for the Electronic Transfer of Spectral Data Electronic Transfer of Spectral Data (pp. 1–16). ISBN:978-0879952952
class colour.io.ies_tm2714.IES_TM2714_ElementSpecification[source]

Bases: colour.io.ies_tm2714.IES_TM2714_ElementSpecification

IES TM-27-14 spectral data XML file element specification.

Parameters:
  • attribute (object) – Associated attribute name.
  • element (unicode) – Element name.
  • attribute – Element type.
  • required (bool) – Is element required.
  • read_conversion (object) – Method to convert from XML to type on reading.
  • write_conversion (object) – Method to convert from type to XML on writing.
class colour.io.ies_tm2714.IES_TM2714_Header(manufacturer=None, catalog_number=None, description=None, document_creator=None, unique_identifier=None, measurement_equipment=None, laboratory=None, report_number=None, report_date=None, document_creation_date=None, comments=None)[source]

Bases: object

Defines the header object for a IES TM-27-14 spectral power distribution.

Parameters:
  • manufacturer (unicode, optional) – Manufacturer of the device under test.
  • catalog_number (unicode, optional) – Manufacturer’s product catalog number.
  • description (unicode, optional) – Description of the spectral data in the spectral data XML file.
  • document_creator (unicode, optional) – Creator of the spectral data XML file, which may be a test lab, a research group, a standard body, a company or an individual.
  • unique_identifier (unicode, optional) – Description of the equipment used to measure the spectral data.
  • measurement_equipment (unicode, optional) – Description of the equipment used to measure the spectral data.
  • laboratory (unicode, optional) – Testing laboratory name that performed the spectral data measurements.
  • report_number (unicode, optional) – Testing laboratory report number.
  • report_date (unicode, optional) – Testing laboratory report date using the XML DateTime Data Type, YYYY-MM-DDThh:mm:ss.
  • document_creation_date (unicode, optional) – Spectral data XML file creation date using the XML DateTime Data Type, YYYY-MM-DDThh:mm:ss.
  • comments (unicode, optional) – Additional information relating to the tested and reported data.
mapping[source]
manufacturer[source]
catalog_number[source]
description[source]
document_creator[source]
unique_identifier[source]
measurement_equipment[source]
laboratory[source]
report_number[source]
report_date[source]
document_creation_date[source]
comments[source]

Examples

>>> IES_TM2714_Header('colour-science')  
<...IES_TM2714_Header object at 0x...>
>>> IES_TM2714_Header('colour-science').manufacturer  
'colour-science'
catalog_number[source]

Property for self.__catalog_number private attribute.

Returns:self.__catalog_number.
Return type:unicode
comments[source]

Property for self.__comments private attribute.

Returns:self.__comments.
Return type:unicode
description[source]

Property for self.__description private attribute.

Returns:self.__description.
Return type:unicode
document_creation_date[source]

Property for self.__document_creation_date private attribute.

Returns:self.__document_creation_date.
Return type:unicode
document_creator[source]

Property for self.__document_creator private attribute.

Returns:self.__document_creator.
Return type:unicode
laboratory[source]

Property for self.__laboratory private attribute.

Returns:self.__laboratory.
Return type:unicode
manufacturer[source]

Property for self.__manufacturer private attribute.

Returns:self.__manufacturer.
Return type:unicode
mapping[source]

Property for self.mapping attribute.

Return type:Structure

Warning

IES_TM2714_Header.mapping is read only.

measurement_equipment[source]

Property for self.__measurement_equipment private attribute.

Returns:self.__measurement_equipment.
Return type:unicode
report_date[source]

Property for self.__report_date private attribute.

Returns:self.__report_date.
Return type:unicode
report_number[source]

Property for self.__report_number private attribute.

Returns:self.__report_number.
Return type:unicode
unique_identifier[source]

Property for self.__unique_identifier private attribute.

Returns:self.__unique_identifier.
Return type:unicode
class colour.io.ies_tm2714.IES_TM2714_Spd(path=None, header=None, spectral_quantity=None, reflection_geometry=None, transmission_geometry=None, bandwidth_FWHM=None, bandwidth_corrected=None)[source]

Bases: colour.colorimetry.spectrum.SpectralPowerDistribution

Defines a IES TM-27-14 spectral power distribution.

This class can read and write IES TM-27-14 spectral data XML files.

Parameters:
  • path (unicode, optional) – Spectral data XML file path.
  • header (IES_TM2714_Header, optional) – IES TM-27-14 spectral power distribution header.
  • spectral_quantity (unicode, optional) – {‘flux’, ‘absorptance’, ‘transmittance’, ‘reflectance’, ‘intensity’, ‘irradiance’, ‘radiance’, ‘exitance’, ‘R-Factor’, ‘T-Factor’, ‘relative’, ‘other’}, Quantity of measurement for each element of the spectral data.
  • reflection_geometry (unicode, optional) – {‘di:8’, ‘de:8’, ‘8:di’, ‘8:de’, ‘d:d’, ‘d:0’, ‘45a:0’, ‘45c:0’, ‘0:45a’, ‘45x:0’, ‘0:45x’, ‘other’}, Spectral reflectance factors geometric conditions.
  • transmission_geometry (unicode, optional) – {‘0:0’, ‘di:0’, ‘de:0’, ‘0:di’, ‘0:de’, ‘d:d’, ‘other’}, Spectral transmittance factors geometric conditions.
  • bandwidth_FWHM (numeric, optional) – Spectroradiometer full-width half-maximum bandwidth in nanometers.
  • bandwidth_corrected (bool, optional) – Specifies if bandwidth correction has been applied to the measured data.
mapping[source]
path[source]
header[source]
spectral_quantity[source]
reflection_geometry[source]
transmission_geometry[source]
bandwidth_FWHM[source]
bandwidth_corrected[source]
read()[source]
write()[source]

Notes

Reflection Geometry

  • di:8: Diffuse / eight-degree, specular component included.
  • de:8: Diffuse / eight-degree, specular component excluded.
  • 8:di: Eight-degree / diffuse, specular component included.
  • 8:de: Eight-degree / diffuse, specular component excluded.
  • d:d: Diffuse / diffuse.
  • d:0: Alternative diffuse.
  • 45a:0: Forty-five degree annular / normal.
  • 45c:0: Forty-five degree circumferential / normal.
  • 0:45a: Normal / forty-five degree annular.
  • 45x:0: Forty-five degree directional / normal.
  • 0:45x: Normal / forty-five degree directional.
  • other: User-specified in comments.

Transmission Geometry

  • 0:0: Normal / normal.
  • di:0: Diffuse / normal, regular component included.
  • de:0: Diffuse / normal, regular component excluded.
  • 0:di: Normal / diffuse, regular component included.
  • 0:de: Normal / diffuse, regular component excluded.
  • d:d: Diffuse / diffuse.
  • other: User-specified in comments.

Examples

>>> from os.path import dirname, join
>>> directory = join(dirname(__file__), 'tests', 'resources')
>>> spd = IES_TM2714_Spd(join(directory, 'Fluorescent.spdx'))
>>> spd.read()
True
>>> spd.header.manufacturer
'Unknown'
>>> # Doctests ellipsis for Python 2.x compatibility.
>>> spd[501.7]  
array(0.095...)
bandwidth_FWHM[source]

Property for self.__bandwidth_FWHM private attribute.

Returns:self.__bandwidth_FWHM.
Return type:numeric
bandwidth_corrected[source]

Property for self.__bandwidth_corrected private attribute.

Returns:self.__bandwidth_corrected.
Return type:bool
header[source]

Property for self.__header private attribute.

Returns:self.__header.
Return type:IES_TM2714_Header
mapping[source]

Property for self.mapping attribute.

Return type:Structure

Warning

IES_TM2714_Spd.mapping is read only.

path[source]

Property for self.__path private attribute.

Returns:self.__path.
Return type:unicode
read()[source]

Reads and parses the spectral data XML file path.

Returns:Definition success.
Return type:bool

Examples

>>> from os.path import dirname, join
>>> directory = join(dirname(__file__), 'tests', 'resources')
>>> spd = IES_TM2714_Spd(join(directory, 'Fluorescent.spdx'))
>>> spd.read()
True
>>> spd.header.description
'Rare earth fluorescent lamp'
>>> # Doctests ellipsis for Python 2.x compatibility.
>>> spd[400]  
array(0.034...)
reflection_geometry[source]

Property for self.__reflection_geometry private attribute.

Returns:self.__reflection_geometry.
Return type:unicode
spectral_quantity[source]

Property for self.__spectral_quantity private attribute.

Returns:self.__spectral_quantity.
Return type:unicode
transmission_geometry[source]

Property for self.__transmission_geometry private attribute.

Returns:self.__transmission_geometry.
Return type:unicode
write()[source]

Write the spd spectral data to XML file path.

Returns:Definition success.
Return type:bool

Examples

>>> from os.path import dirname, join
>>> from shutil import rmtree
>>> from tempfile import mkdtemp
>>> directory = join(dirname(__file__), 'tests', 'resources')
>>> spd = IES_TM2714_Spd(join(directory, 'Fluorescent.spdx'))
>>> spd.read()
True
>>> temporary_directory = mkdtemp()
>>> spd.path = join(temporary_directory, 'Fluorescent.spdx')
>>> spd.write()
True
>>> rmtree(temporary_directory)