Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1 lumen does not equal 1 candela (1 lm -> cd returns 1 cd) #225

Closed
varenc opened this issue Apr 9, 2020 · 6 comments
Closed

1 lumen does not equal 1 candela (1 lm -> cd returns 1 cd) #225

varenc opened this issue Apr 9, 2020 · 6 comments

Comments

@varenc
Copy link

varenc commented Apr 9, 2020

I haven't looked into this thoroughly at all, but insect seems to define 1 lumen as 1 candela in some cases?

>>> 1 lm -> cd

  1 lm ➞ cd

   = 1 cd

That's incorrect. It should return an error as that's an invalid conversion.

But also, this does work correctly:

>>> 1 lm / (1 radian)^2 -> cd

  1 lm / (1 rad)^2 ➞ cd

   = 1 cd

So at some level insect must know a 1 lumen = cd ⋅(angle)^2.

@varenc varenc changed the title 1 lumen does not equal 1 candela (1 lm -> cd return 1 cd) 1 lumen does not equal 1 candela (1 lm -> cd returns 1 cd) Apr 9, 2020
@varenc
Copy link
Author

varenc commented Apr 9, 2020

Another silly example where insect thinks 1 lm = 1 cd:

>>> (1 lumen ) * 1 hogshead -> cd * hogshead

  1 lm × 1 hogshead ➞ cd × hogshead

   = 1 cd·hogshead

But then it also does this silly unit math correctly:

>>> ((1 lumen ) * 1 hogshead)/(1 radian)^2 -> cd * hogshead

  1 lm × 1 hogshead / (1 rad)^2 ➞ cd × hogshead

   = 1 cd·hogshead

@sharkdp
Copy link
Owner

sharkdp commented Apr 9, 2020

Thank you for your feedback.

insect seems to define 1 lumen as 1 candela in some cases

As per the SI standard, Insect defines 1 lumen to be 1 candela · sr and 1 sr (steradian) is defined as 1 m²/m². So

1 lumen = 1 candela · sr = 1 candela · 1 m²/m² = 1 candela

That's incorrect. It should return an error as that's an invalid conversion.

I don't think so.

I see how that can be confusing if you think of radian and steradian as fundamental base units (measuring angle or solid angle). But they are not. They are derived units defined as m/m and m²/m², respectively. In a physics calculation, it is useful to explicitly write rad or sr at some places, but mathematically, these units are just placeholders for a 1. And (solid) angles are really just dimensionless quantities.

All of the calculations you performed above are completely correct. If you want Insect to keep rad or sr = rad², you can simply ask for it in the conversion (5 lm -> cd · rad²).

Note that everything also works fine if you use degree instead of radian. Insect will perform the degree => radian conversion for you:

>>> 400 cd * (5°)^2 -> lm

  400 cd × (5°)^2 ➞ lm

   = 3.04617 lm

See also:

  • Entry in the FAQs: What is the relation between the units RPM, rad/s, deg/s and Hz?
  • #50: Radians per second to Hertz conversion
  • Radian-squared bug #152: Radian-squared bug

@sharkdp
Copy link
Owner

sharkdp commented Apr 24, 2020

Any feedback?

@varenc
Copy link
Author

varenc commented Apr 25, 2020

Thank you for the detailed response! That was....illuminating.

What you say does make total sense now and perfectly explains why it seemed to work in some cases and not in others. So basically when I see a plain 1 cd, the sr/rad unit is implied. (because it's not a real unit)

My only feedback is that maybe this isn't a common interpretation/convention? I lack the context to say though. Wolfram alpha behaves the way I expect and tells you these units are incompatible. If you google basic questions like "convert candela to lumen" the results are usually from flashlight forums and the answer is that you need to know the beam angle. Insect's behavior is is unusual to me, but I'm no physicist and maybe I'm not like a typical insect user either! And thanks to your helpful response it's no longer confusing either.

Cheers!

@sharkdp
Copy link
Owner

sharkdp commented Apr 29, 2020

Thank you for the feedback.

maybe this isn't a common interpretation/convention?

That's certainly possible.

Wolfram alpha behaves the way I expect and tells you these units are incompatible.

Hm. In this example, I certainly see the appeal of Wolfram Alpha's "interpretation". User of Insect might accidentally forget to multiply by "angle squared".

However, consider this example: A trigonometric function like "tan" turns "angles into ratios". The inverse, "atan", turns "ratios into angles". Let's say I have a flashlight beam that creates a circle of radius 1 m on a wall in 10 m distance. The angle of the cone would be atan(1 m / 10 m). In Insect, I could simply call:

≫ 400 cd * atan(1 m / 10 m)^2 to lm

   = 3.97354 lm

In Wolfram Alpha, for the same query, I get "cd (candela) and lm (lumens) are not compatible". I have to use something like

400 cd * atan(1 m / 10 m)^2 * rad^2 to lm

= 3.974 lm

to make it work.

@sharkdp
Copy link
Owner

sharkdp commented Sep 28, 2023

@varenc It's been over three years, but ... there is now a completely new version of this project called Numbat. It currently still follows Insects way of defining units — which is how the current SI standard defines those units. But Numbat is much more flexible in this respect and users can change/customize the complete unit system.

This allows us to try alternative proposals on how units should be defined in the SI standard. In particular, there is a whole line of research which indicates that angles should not be treated as dimensionless. For Numbat, I wrote a version of its unit system that follows the proposal outlined in this paper. You can read more about the details, advantages, and drawbacks in the PR: sharkdp/numbat#167. But there is one advantage that directly relates to this ticket: if angles are treated as having their own base dimension, then lumen can not be converted to candela.

You can try out this version of Numbat here: https://numbat.dev/angles/

Things to try:

image

Anyway. Thought you might be interested.

I see how that can be confusing if you think of radian and steradian as fundamental base units (measuring angle or solid angle). But they are not. They are derived units defined as m/m and m²/m², respectively. In a physics calculation, it is useful to explicitly write rad or sr at some places, but mathematically, these units are just placeholders for a 1. And (solid) angles are really just dimensionless quantities.

Re-reading my comment from above.. I now have a slightly different view on this topic after reading all of these papers. I'm not 100% convinced this modification should make it to the SI standard, but when dealing with units in software, it's certainly a very valuable approach.

Wolfram alpha behaves the way I expect and tells you these units are incompatible.

Interestingly, that is actually not the case anymore. It currently results in 0.07958 cd (1/4pi)?!?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants