#### Formula

\Omega_{sr} = 2\cdot\pi\cdot(1-\cos(\frac{\theta}{2}))

I_{v} = \frac{\Phi_v}{\Omega_{sr}}

where:

- \theta is the
*apex angle* in radians - \Omega_{sr} is the
*solid angle *in Steradians - \Phi_v is the
*luminous flux* in lux (*lx*). - I_{v} is the
*luminous intensity* in candela (*cd*).

#### Python code

You can use the UliEngineering library like this:

from UliEngineering.Physics.Light import lumen_to_candela_by_apex_angle
from UliEngineering.EngineerIO import auto_format, auto_print
# These are equivalent:
intensity = lumen_to_candela_by_apex_angle("25 lm", "120°") # intensity = 7.9577 (cd)
intensity = lumen_to_candela_by_apex_angle(25.0, 120.0) # intensity = 7.9577 (cd)
# ... or get out a human-readable value:
intensity_str = auto_format(lumen_to_candela_by_apex_angle, "25 lm", "120°") # "7.96 cd"
# ... or print directly
auto_print(lumen_to_candela_by_apex_angle, "25 lm", "120°") # prints "7.96 cd"

In case you can’t use *UliEngineering*, use this Python function:

import math
def lumen_to_candela_by_apex_angle(flux, angle):
"""
Compute the luminous intensity from the luminous flux,
assuming that the flux of <flux> is distributed equally around
a cone with apex angle <angle>.
Keyword parameters
------------------
flux : value, engineer string or NumPy array
The luminous flux in Lux.
angle : value, engineer string or NumPy array
The apex angle of the emission cone, in degrees
For many LEDs, this is
>>> lumen_to_candela_by_apex_angle(25., 120.)
7.957747154594769
"""
solid_angle = 2*math.pi*(1.-math.cos((angle*math.pi/180.)/2.0))
return flux / solid_angle
# Usage example
print(lumen_to_candela_by_apex_angle(25., 120.)) # Prints 7.957747154594769 (cd)