luox: validated reference open-access and open-source web platform for calculating and sharing physiologically relevant quantities for light and lighting

Light exposure has a profound impact on human physiology and behaviour. For example, light exposure at the wrong time can disrupt our circadian rhythms and acutely suppress the production of melatonin. In turn, appropriately timed light exposure can support circadian photoentrainment. Beginning with the discovery that melatonin production is acutely suppressed by bright light more than 40 years ago, understanding which aspects of light drive the 'non-visual' responses to light remains a highly active research area, with an important translational dimension and implications for "human-centric" or physiologically inspired architectural lighting design. In 2018, the International Commission on Illumination (CIE) standardised the spectral sensitivities for predicting the non-visual effects of a given spectrum of light with respect to the activation of the five photoreceptor classes in the human retina: the L, M and S cones, the rods, and the melanopsin-containing intrinsically photosensitive retinal ganglion cells (ipRGCs). Here, we described a novel, lean, user-friendly, open-access and open-source platform for calculating quantities related to light. The platform, called luox, enables researchers and research users in vision science, lighting research, chronobiology, sleep research and adjacent fields to turn spectral measurements into reportable quantities. The luox code base, released under the GPL-3.0 License, is modular and therefore extendable to other spectrum-derived quantities. luox calculations of CIE quantities and indices have been endorsed by the CIE following black-box validation.


v3
Abstract Light exposure has a profound impact on human physiology and behaviour. For example, light exposure at the wrong time can disrupt our circadian rhythms and acutely suppress the production of melatonin. In turn, appropriately timed light exposure can support circadian photoentrainment. Beginning with the discovery that melatonin production is acutely suppressed by bright light more than 40 years ago, understanding which aspects of light drive the 'nonvisual' responses to light remains a highly active research area, with an important translational dimension and implications for "humancentric" or physiologically inspired architectural lighting design. In 2018, the International Commission on Illumination (CIE) standardised the spectral sensitivities for predicting the non-visual effects of a given spectrum of light with respect to the activation of the five photoreceptor classes in the human retina: the L, M and S cones, the rods, and the melanopsin-containing intrinsically photosensitive

Introduction
Light profoundly affects human physiology and behaviour 1 . Exposure to light in the evening and at night can suppress the production of melatonin 2-6 and delay phase of the circadian rhythm 3,7-13 , while morning light exposure advances the circadian phase 10-12 . Additionally, exposure to light modulates alertness [14][15][16] , and there is emerging evidence for a direct role of light in regulating mood 1,17,18 . These 'non-visual effects' of light are mediated by a subset of the retinal ganglion cells which express the photopigment melanopsin 19-24 , a shortwavelength sensitive pigment with a peak spectral sensitivity near 480 nm 20,25,26 . Importantly, melanopsin provides a pathway for signalling environmental illumination that is independent of the 'canonical' photoreceptors in the retina, the cones, of which there are three types that differ in their spectral tuning (the, L, M and S cones), and the rods.
The modulation of non-visual physiology by melanopsin is supported by a set of key studies in the early 2000s led by Brainard and colleagues 4,5 (data reanalysed in 27-29), and by Skene and colleagues 6 (data reanalysed in 27) which determined the action spectrum for acute human melatonin suppression during night-time light exposure, showing a clear short-wavelength peak. Action spectrum data for circadian phase shifting is limited 7,30,31 , not least due to the complexity in implementing protocols to assess light-induced circadian phase shifts, though existing data are consistent with a dominant role of melanopsin 7,29-31 . Furthermore, melatonin suppression responses to bright evening light persist in patients without demonstrable cone and rod function 32,33 , clearly supporting the role of melanopsin in non-visual responses in retinal and ocular disease 34 .
While many fundamental aspects of the non-visual effects of light have been characterised in experimental and field studies, there are many unknowns and understanding the effects of light on human physiology and behaviour remains a highly active area of investigation. Recent studies have investigated temporal integration properties of the human circadian system 8,35-39 , and have exploited silent-substitution techniques or metameric lights to characterise the non-visual response to pairs of lights that differ only in melanopsin stimulation 40,41 or S cone stimulation 42 .
With many response characteristics still being under investigation, mechanistic insights about the non-visual effects of light exposure are now increasingly finding their way into real-world applications. A recent international consensus statement identified criterion light levels to minimise the detrimental effects of light at the wrong time and maximise the positive ones 43 . At the same time, principled approaches to realising physiologically inspired lighting based on scientific evidence are emerging (e.g. see 44). Both the development of recommendations and applying basic neuroscience findings in architectural lighting design require the ability to use a common currency to quantitatively describe the effect of light on people.
Science is a cumulative effort that requires the aggregation of studies to facilitate meta-analytic efforts and evidence synthesis (see, e.g., 27 and 45 for recent efforts to aggregate data). To enable a clear interpretation of the results and "future-proof" 46 research efforts requires adequate documentation of study conditions going well beyond current standard practice. A recent examination of 71 studies on the biological effects of light revealed that 55% (39/71) did not report any information about spectrum, and an overwhelming majority (87%; 62/71) only reported light levels in lux 47 , representing a quantity weighting L and M cone activity, which is inappropriate given the converging evidence of the dominant role of melanopsin [27][28][29]48 . Furthermore, there is large variability in what is considered "dim light", with light levels called "dim" in practice spanning almost two log units 47 . Since a key biomarker for circadian phase, the "dim light melatonin onset" (DLMO) 49,50 , hinges upon data collection in dim lighting conditions.
Recommendations and guidelines for the measurement, recording and reporting of the lighting conditions have been made independently by Spitschan et al. 51 and Knoop et al. 52 , with a more recent comprehensive guide, also encompassing study characteristics other than light, being published by the International Commission on Illumination (CIE) 53 . However, while recommendations and guidelines are quite important, they are only one aspect, and to make them easy to be applied, tooling is often required. To support adoption of the recent CIE standard S 026 54 , the CIE recently released an Excel spreadsheet 55 , requiring the proprietary Excel software. There are also a range of tools available for calculations to run locally on the user's computer, such as the Python package colour, requiring a functional Python installation.
Here, we introduce a novel web-based platform called luox for calculating, reporting and sharing physiological quantities related to light. All calculations are performed in a modern browser and require no software installations on the user side.

Amendments from Version 2
This revision of the report on the luox platform includes a range of updates implemented by Somang Nam (S.N.) and Jennifer Veitch (J.A.V.) in collaboration with the original author (M.S.). This major revision concerns the inclusion of a D uv (closest distance of the chromaticity coordinates of a source from the Planckian), T cp (Correlated Color Temperature, CCT), R a (CIE General Colour Rendering Index) and R f (CIE General Colour Fidelity Index). As part of these calculations, the CIE 1960 UCs chromaticity values (u, v) and the CIE 1976 UCS chromaticity values (u', v') were also included. Various quantities from IES TM-30-20 are also included in this revision as output. Additionally, a new power-user mode has been introduced.

Methods
Implementation luox (RRID: SCR_020994) is implemented in JavaScript, HTML & CSS using React and chart.js. The source code is available under the GPL-3.0 License at GitHub 56 . luox is deployed at https://luox.app/. Further details on implementation are given on the about page.
Operation luox can be accessed online using any contemporary browser. The operational workflow is shown in Figure 1. The user measures an irradiance or radiance spectrum using their spectroradiometer and stores the spectrum in a CSV file. This file is then uploaded into the platform, which performs a series of calculations (detailed below) and visualises the spectrum in a report. This report can then be viewed in the browser, but also downloaded as a CSV file for sharing, e.g. as supplementary CSV file. The platform also allows for downloading the spectrum again as a CSV file. In addition, luox generates a shareable URL, which encodes the uploaded spectra in a URL (see below). A DOI can be requested which redirects to the shareable URL. The graphical user face is shown in Figure 2.

Use case
The luox platform includes a wizard, which details the requirements for files and expected file formats, and also includes a sample file containing three CIE Illuminants in the F series in 5 nm spacing. Upon uploading the file, calculations are performed, giving access to the workflow described above and in Figure 1.

Calculations
The platform implements as a set of photometric, colorimetric, colour rendition and α-opic calculations based on a user-supplied irradiance [W/m 2 /nm] or radiance [W/m 2 /sr/nm] spectral power distribution S(λ). Photometry. luox implements the following photometric calculations: • Illuminance [lux] or luminance [cd/m 2 ]. Illuminance (for irradiance spectra) and luminance (for radiance spectra) corresponds to the spectrum weighted by the photopic luminosity function, V(λ), and multiplied by the constant 683 lm/W. V(λ) is based on psychophysical measurements (for a review, see 57) and was first standardised by the CIE in 1924 58 and forms the basis of current photometry 59 .
Colorimetry and colour rendering. We implement the following colorimetric calculations: • CIE 1931 xy chromaticity (2° observer). The chromaticity coordinates are a way to identify the colour appearance of a spectrum. The CIE 1931 xy chromaticity diagram, also called the horseshoe, is based on the XYZ colour matching functions standardised by the CIE in 1931 60 based on 2° colour matching experiments by Wright 61 and Guild 62 . The chromaticity coordinates are calculated by weighting the spectrum by the x (λ), y (λ), and z (λ) colour matching functions, yielding tristimulus coordinates X, Y and Z and then normalising: It is useful to note that CIE 1931 y (λ) and CIE 1924 V(λ) are equivalent.
• CIE 1964 x 10 y 10 chromaticity (10° observer). The CIE has also standardised 10° colour matching functions x 10 (λ), y 10 (λ), and z 10 (λ), and associated chromaticity coordinates x 10 and x 10 63 .  66 . These are derived as part of the calculations below. The CIE-defined quantities D uv , T cp , R f and R a were included in the 2022 CIE evaluation of luox.
• D uv represents the distance of the chromaticity coordinates of a light source to the Planckian locus 66 . The sign (+/-) of D uv determines whether the light source is above/below the Planckian locus in the CIE u', v' chromaticity diagram. luox calculates D uv using the Ohno method 67 .
• Correlated Colour Temperature (CCT, T cp ) is the temperature, expressed in kelvin (K) of a blackbody (Planckian) radiator with the chromaticity nearest the chromaticity of the test spectral distribution. luox calculates CCT with two methods, the Robertson method 68  For CCT values below 4000 K, the reference spectrum is the Planckian curve and for values above 5000 K the reference spectrum is a daylight reference. For source SPDs with CCTs between 4000 K and 5000 K, the reference spectrum is a combination of a Planckian illuminant and a daylight illuminant with a linear transition from a Planckian reference to a daylight reference (i.e., weights are equal at 4500 K). R f calculation in IES TM-30-20 is conceptually the same as the CIE index, but differs slightly in that the transition range for reference spectra in the IES-TM-30-20 calculation is between 4500 K and 5500K. The sub-index R f,h1 describes the local colour fidelity for a set of reflectance spectra designated h1 among 16 hue angle bins in the CIE CAM02-UCS a', b' colour space into which the 99 colour evaluation samples have been divided. The h1 bin is a set of red-appearing samples.
luox also calculates the IES gamut index R g . which is an averaged measure of the area spanned by the a', b' coordinates for each of the 16 hue angle bins for the test spectrum, compared to the area spanned by the reference spectrum 75 . luox also reports one related subindex, R cs,h1 , which is the relative average local chroma shift for the h1 bin CES for the test spectrum in comparison to the reference spectrum. The α-opic irradiance or radiance of a spectrum is the weighted sum of the spectrum and the α-opic spectral sensitivity.
Here and in the definitions for EDI/EDL and ELR below, "α-opic" is a placeholder term that can be filled by any of the five photoreceptors, the L, M and S cones, the rods and melanopsin. For example, the spectral irradiance or radiance weighted by the L cone spectral sensitivity is called the L-cone-opic irradiance or radiance, and the spectral irradiance or radiance weighted by the melanopsin spectral sensitivity is called the L-cone-opic irradiance or radiance.
• α-opic equivalent daylight illuminance (EDI) and luminance (EDL). The α-opic equivalent daylight illuminance (EDI) or luminance (EDL) calculates the photopic (il)luminance of a standard daylight spectrum (CIE Standard Illuminant D65, corresponding approximately to daylight with a correlated colour temperature of 6500K) that matches the α-opic (ir)radiance. Alternatively stated, the EDI/EDL tells us the (il)luminance that a daylight would have to have to yield the same α-opic (ir)radiance.
• α-opic efficacy of luminous radiation (ELR). The α-opic efficacy of luminous radiation is the ratio between the α-opic (ir)radiance and photopic (il)luminance, providing a simple, normalised indicator of the α-opic "content" of a spectrum. The melanopic ELR, i.e. the melanopic efficacy of luminous radiation, is similar to the the M/P ratio method proposed elsewhere 84 .

Concerning precision and benchmarking against other tools
The JavaScript numbers are always stored as double precision floating point numbers, following the IEEE 754 standard 73,85 . This format allows a total of 64 binary bits to represent a number as follows: 1 bit for the sign, 11 bits for the exponent, followed by 52 bits for the significand. The possible ranges of numbers which can be represented under the double precision will then be limited to approximately 16 decimal places of precision. This limited precision may result in rounding errors during arithmetic calculations performed in many stages 86 . Some of the errors may include a random introduced value at the end of each variable, which might occur in the conversion between binary bits to decimal representations. Lastly, the calculated D uv values may show differences depending on the Planckian table mapping values. In our white box testing, the differences can come from the distance between steps (i.e., 1% and 0.25%). In addition, differences were also found when the distance was directly calculated from u' and v' compared to a direct value replicated from the CIE 2017 Colour Fidelity Index Calculator. Such findings may lead to additional differences in further stages of calculations that use the D uv and CCT values.
In addition to linear notation, it is possible to toggle the display to exponential notation. While display of the calculated values is truncated to four decimal digits, the downloaded report, and indeed all underlying calculations, includes the numbers up to floating point precision (double-precision 64-bit binary format IEEE 754).

Power user mode
The power user mode removes the limit on the number of input spectra to be used at one time. The input file can contain any number of spectra, and the calculations are performed using parallel processing without requiring any additional inputs. Because of the complexity of simultaneously displaying multiple spectra, visualizations of the uploaded spectral data are disabled in the power user mode. In a testing environment, the processing time was under 11 seconds for the calculation from a csv file with 100 spectra.
If the option to display IES TM-30 calculations has been checked, each test spectrum generates a CVG, and there will be multiple CVGs if there are multiple test spectra. The section will display one image at a time, along with the paginated links to load other images. Users can manually download images individually by clicking the icon at the top right corner of the CVG interface. There is no option for multiple image download.
Encoding of spectral power distributions for sharing Spectral power distributions are typically stored as files in an MS Excel spreadsheet, comma-separated (CSV), XML (e.g. 87), JSON or other schema-based formats (e.g. 88). Storage of files requires an infrastructure, e.g., a server. To lose this requirement and enable the sharing of spectral power distribution data without sharing files, we (M.H.) developed a library with no external dependencies called spdurl written in JavaScript. spdurl encodes a spectral power distribution in a URL accurately and concisely. While the RFC for URLs (RFC 2616 89 ) does not specify an upper length limit, many web browsers may truncate it to 2 kB, which we pragmatically adopt as the limit for URLs here.
spdurl exploits the following aspects of spectral distributions: • Wavelength sampling: Wavelengths are assumed to be uniformly spaced, allowing us to write only the first value and an increment, with the total number of samples implicit in the number of samples given. Some spectroradiometers produce nonuniform wavelength spacing, so we expect these users to resample to a uniform spacing, as with the rest of luox.
• Compression: We compress the spectra using a scheme that encodes spectral bands in two URL-safe bytes each, across a variety of units. The measurement process within CCD spectrometers uses a shared shutter for all elements in the array, allowing us to share an exponent for all values. This is also often done in HDR formats, like Radiance RGBE 90 . As a base for our shared exponent, we chose 2 , sacrificing 1/8 bit to quantisation, rather than 1/2 bit if we had used 2 as a base. We do not constrain the exponent value (large exponents just use more bytes), so extremely small and large values can be represented, but most exponents use one or two bytes. In this way, energy can be stored as a linear value even at very small irradiances without worrying about range limits. While the best available CCD spectrometer arrays are specified to measure 16 linear bits, real-life signal to noise is much lower. We began with an 18-bit mantissa, but subsequently determined that for most uses, 12 bits of gamma-encoded data were sufficient for our calculations. To balance the accuracy of smaller and larger values, we informally determined that γ = 2.0 gave lower error than linear or cubic encodings. We perform rounding to 12 bits to avoid quantisation bias, which may result in small changes in the spectrum and derived quantities.
• String encoding: We encode the resulting string as a URL-safe base64 (RFC 4648 91 ), meaning that each 12-bit value can be written using two bytes, with no padding.
• Spectral resolution limits: Since we use two bytes per value, this means that visible spectra can be encoded in a valid URL (2kB) down to about 0.5 nm spacing. Meters that have high spectral resolution may wish to resample to fewer values before encoding.
• Spectral units: We use a dictionary of datatypes (30 to date), which can represent spectral quantities (so that "/nm" is common to all) using just 2-3 bytes. For instance, the shorthand "uwi" is used to represent "uW/cm 2 /nm". Additionally, action spectra, transmittance, radiance, and quantal units are available using similar short abbreviation given in the software. Many file formats assume the reader knows the units in use; in spdurl, we make no such assumption, and so, this field is required.
• Meta-data specification: Measurement conditions, like time zone, date, location, and user-specified name are allowed as optional metadata, when there is space at the end.
As an example, our library can encode a spectral radiance distribution specified between 380 and 780 nm with 1 nm spacing using 804 bytes, and a 10 nm sample (36 bands) from an X-Rite meter can occupy only 90 bytes, as succinct as the following:

Discussion
Here, we present the luox platform for facilitating and sharing calculations of physiologically relevant quantities related to light and lighting. luox is open-access and open-source. luox is fully functional and modular, enabling the incorporation of other spectrally derived quantities in the future.

Data availability
No data are associated with this article.

Software availability
Software

Timothy Brown
Faculty of Biology Medicine and Health, University of Manchester, Manchester, UK