Last active
May 17, 2023 18:05
-
-
Save jgphilpott/76f16fe012a7d60125ead3d178f52c27 to your computer and use it in GitHub Desktop.
A collection of functions for converting between different units of illumination.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Illumination Conversions ### | |
convertIllumination = | |
phot: {} | |
lux: {} | |
nox: {} | |
flame: {} | |
### Phot Conversions ### | |
convertIllumination.phot.phot = ph$ph = (ph) -> ph # Phot to Phot | |
convertIllumination.phot.lux = ph$lx = (ph) -> ph * 1e+4 # Phot to Lux | |
convertIllumination.phot.nox = ph$nox = (ph) -> ph * 1e+7 # Phot to Nox | |
convertIllumination.phot.flame = ph$flame = (ph) -> ph * 232.2576 # Phot to Flame | |
### Lux Conversions ### | |
convertIllumination.lux.phot = lx$ph = (lx) -> lx / 1e+4 # Lux to Phot | |
convertIllumination.lux.lux = lx$lx = (lx) -> lx # Lux to Lux | |
convertIllumination.lux.nox = lx$nox = (lx) -> lx * 1e+4 # Lux to Nox | |
convertIllumination.lux.flame = lx$flame = (lx) -> lx / 43.055641667 # Lux to Flame | |
### Nox Conversions ### | |
convertIllumination.nox.phot = nox$ph = (nox) -> nox / 1e+7 # Nox to Phot | |
convertIllumination.nox.lux = nox$lx = (nox) -> nox / 1e+4 # Nox to Lux | |
convertIllumination.nox.nox = nox$nox = (nox) -> nox # Nox to Nox | |
convertIllumination.nox.flame = nox$flame = (nox) -> nox / 43055.641667 # Nox to Flame | |
### Flame Conversions ### | |
convertIllumination.flame.phot = flame$ph = (flame) -> flame / 232.2576 # Flame to Phot | |
convertIllumination.flame.lux = flame$lx = (flame) -> flame * 43.055641667 # Flame to Lux | |
convertIllumination.flame.nox = flame$nox = (flame) -> flame * 43055.641667 # Flame to Nox | |
convertIllumination.flame.flame = flame$flame = (flame) -> flame # Flame to Flame |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Illumination Conversions */ | |
var convertIllumination, flame$flame, flame$lx, flame$nox, flame$ph, lx$flame, lx$lx, lx$nox, lx$ph, nox$flame, nox$lx, nox$nox, nox$ph, ph$flame, ph$lx, ph$nox, ph$ph; | |
convertIllumination = { | |
phot: {}, | |
lux: {}, | |
nox: {}, | |
flame: {} | |
}; | |
/* Phot Conversions */ | |
convertIllumination.phot.phot = ph$ph = function(ph) { | |
return ph; // Phot to Phot | |
}; | |
convertIllumination.phot.lux = ph$lx = function(ph) { | |
return ph * 1e+4; // Phot to Lux | |
}; | |
convertIllumination.phot.nox = ph$nox = function(ph) { | |
return ph * 1e+7; // Phot to Nox | |
}; | |
convertIllumination.phot.flame = ph$flame = function(ph) { | |
return ph * 232.2576; // Phot to Flame | |
}; | |
/* Lux Conversions */ | |
convertIllumination.lux.phot = lx$ph = function(lx) { | |
return lx / 1e+4; // Lux to Phot | |
}; | |
convertIllumination.lux.lux = lx$lx = function(lx) { | |
return lx; // Lux to Lux | |
}; | |
convertIllumination.lux.nox = lx$nox = function(lx) { | |
return lx * 1e+4; // Lux to Nox | |
}; | |
convertIllumination.lux.flame = lx$flame = function(lx) { | |
return lx / 43.055641667; // Lux to Flame | |
}; | |
/* Nox Conversions */ | |
convertIllumination.nox.phot = nox$ph = function(nox) { | |
return nox / 1e+7; // Nox to Phot | |
}; | |
convertIllumination.nox.lux = nox$lx = function(nox) { | |
return nox / 1e+4; // Nox to Lux | |
}; | |
convertIllumination.nox.nox = nox$nox = function(nox) { | |
return nox; // Nox to Nox | |
}; | |
convertIllumination.nox.flame = nox$flame = function(nox) { | |
return nox / 43055.641667; // Nox to Flame | |
}; | |
/* Flame Conversions */ | |
convertIllumination.flame.phot = flame$ph = function(flame) { | |
return flame / 232.2576; // Flame to Phot | |
}; | |
convertIllumination.flame.lux = flame$lx = function(flame) { | |
return flame * 43.055641667; // Flame to Lux | |
}; | |
convertIllumination.flame.nox = flame$nox = function(flame) { | |
return flame * 43055.641667; // Flame to Nox | |
}; | |
convertIllumination.flame.flame = flame$flame = function(flame) { | |
return flame; // Flame to Flame | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment