This site has been pretty deserted lately. Sorry about that. I have been spending too much time on work and none on documentation.

Today, I ported a script I made in Swift 3 into Python 3.5. It calculates exposure in the absence of one variable. I had written complex control logic into the function in Swift, but my recent research into functional and asynchronous architectures has shown me that a separate control flow function that calls each equation to be more scalable and elegant.

The Python code:

`import math`

` import fractions`

`def lVtoLux(lV): #working`

` return ((pow(lV, 2))*2.5)`

`def lVtoFC(lV): #working`

` return (((pow(lV, 2))*2.5)/10.76)`

`def lVtoLumens(lV): #working`

` return ((pow(lV, 2))*2.5)`

` def stopCalc(lV, iSO, shutterTime): # calculate T-Stop`

` return((math.sqrt(((math.pow(2, lV))*(iSO*shutterTime))/100.0)*100.0)/100.0)`

`def shutterCalc(lV, aperture, iSO): # calculate shutter speed in fractions of a second`

` return(Fraction((100*(math.pow(aperture, 2)) / (math.pow(2, lV)))/iSO).limit_denominator(8000))`

`def iSOCalc(lV, aperture, shutterTime): # calculate EV/LV/Lux`

` return((100*((math.pow(aperture, 2))) / (math.pow(2, lV))/shutterTime))`

`def lvCalc(aperture, iSO, shutterTime): # calculate EV/LV/Lux`

` return(math.log2((100*(pow(aperture,2)))/(iSO*(shutterTime))))`

`def fcCalc(aperture, iSO, shutterTime): # calculate Footcandles`

` return(lVtoFC(math.log2((100*(pow(aperture,2)))/(iSO*(shutterTime)))))`

and here it is in Swift 3 (there may be some errors because I just fixed this stuff to exclude the control flow part.)

`func stopCalc(ISO iSO: Double,shutter shutterTime: Double, eV:Double) -> Double {`

` return(round((sqrt(((exp2(eV))*(iSO*shutterTime))/100)*100.0)/100.0))`

`}`

`func isoCalc(tStop aperture: Double,shutter shutterTime: Double, eV: Double) -> Double {`

` return(round((100*((pow(aperture, 2))) / (exp2(eV))/shutterTime)))`

`}`

`func shutterCalc(tStop aperture: Double, ISO iSO: Double, eV:Double) -> Double {`

` return((100*(pow(aperture, 2)) / (exp2(eV)))/iSO)`

`}`

`func lVCalc(tStop aperture: Double, ISO iSO: Double,shutter shutterTime: Double) -> Double {`

` return(log2((100*(pow(aperture,2)))/(iSO*shutterTime)))`

`}`

`func fCCalc(tStop aperture: Double, ISO iSO: Double,shutter shutterTime: Double) -> Double {`

` return(((pow(2, (log2((100*(pow(aperture,2)))/(iSO*shutterTime)))))*2.5)/10.76)`

`}`

I think I will do that with every piece of code I write, but I also want to get into the world of functional programming, which may cause me to go back to the drawing board in each language.

Category Theory is absolutely insane, but apparently, it allows for complex mappings and behaviors in software that would, for example, allow me to quickly go through all of the permutations in a piece of software.

So far, I know pieces of BASIC, C/C++ (for Arduino), Swift 4, and I am just starting with Python 3.5. This is just a short post to get me back in the rhythm of it again.