DrPlantabyte / simple-si-units

A simple, stable, statically-typed scientific unit library for Rust
Mozilla Public License 2.0
3 stars 0 forks source link

Luminosity and Luminous Intensity are not the same unit #52

Open TheComamba opened 6 months ago

TheComamba commented 6 months ago

Hello there. This crate defines Luminosity as having the units of candela here, and specifies LuminousIntensity as the corresponding uom struct. As far as I understand it, Luminosity is a measure for the energy output, and is therefore measured in Watts, while Luminous Intensity is a conversion of that output taking into account the wavelength of emitted light, to get a measure for the brightness of an object as perceived by the human eye, which is then measured in candela (compare this stackexchange). As far as I can see, this crate does not provide any complicated conversions for the Luminosity struct, so it should be correct to just rename Luminosity -> LuminousIntensity. The next logic step would be to introduce a Luminosity struct that stores units of Watt. This is a breaking change of course, which is a bit inconvenient.

DrPlantabyte commented 2 months ago

Hi Comamba,

Sorry for taking a VERY long time to respond (I've been busy with other things).

Thank you for bringing this to my attention. Looks like "Luminosity" is equivalent to power. What I want is to use a common name for Candela (maybe "brightness"?). Measurements dependent on specra are beyond the scope of this crate, so the way forward is to come up with a new name, type alias the old name to it, and then flag it as deprecated to warn that it shouldn't be used.

As an aside, in my own work as a photosynthesis researcher we define light as number of (usable) photons per area per time (photon flux density) because the photochemical reactions in plants (and most of biology) are quantum reactions that capture the same amount of energy regardless of the energy of the photon (eg both a red and a blue photon hitting Photosystem 2 result in a single Mn-O chemical bond breaking, even though the blue photons technically have twice the energy)

TheComamba commented 2 months ago

No problem, thanks for getting back. :) I could have created a PR, but I as well had other things on my mind.

Glossing over the implementations, type aliasing Luminosity as LuminousIntensity and InverseLuminosity with InverseLuminousIntensity should do the trick. The definition is then consistent with that of LuminousFlux, and as far as I can see, there is no other unit conversion currently involving Luminosity.

I stumbled over this because I am (sometimes) working on a program to display a night sky, and a large but cool star can be very bright in infrared and thus have a high luminosity, but it can at the same time be rather dim in visible light, giving it a low luminous intensity in that band. And in astronomy you have these beasts called "apparent and absolute magnitude".