Calculations
Hi all
This might help new users populating google sheets like me.
I had some trouble with adding calculations to the LIMS. I do have them in excel format and working well.
But I am not sure how to translate the data into the format the LIMS needs it. I am busy teaching myself the python language but I’m not fully there YET!
With some luck I managed to come to the conclusion that the standard math option is ok. However calculating a ryznar and langelier saturation index is intimidating to say the least for someone that has no experience in python or any programming. To make things easier for myself I broke up the calculations into different analysis services and I just add them up with the "final" calculation. I know this
can be more efficient, I just need to verify if this calculation actually works then I can do it as a single calculation
I did give it a go but I don’t know how to check if the calculation is going to work as I have only submitted the google sheets.
Comments
Thanks for posting Francois
Thus far we got to do most calculation formulas with standard mathematical operators, but had to make sure about Langelier’s that we encountered earlier and actually brag about in the manual
We did use log10 and exp functions… here’s the formula, with some extra spaces:
[InitialpH] - ( ( math.log10( 100000 / [CaH] ) ) + ( math.log10 ( 50000 / [TotalAlkalinity] ) ) + ( 2.6045 * math.exp ( ( - 0.0108 * [TemperatureInitial] ) ) + ( 0.0144 * [TDS]** 0.4545 ) ) + ( math.log10 ( 1 + ( ( 10** - ( 10.6 - [InitialpH] ) ) * ( 1 + [TemperatureInitial] / 30 ) ) * 2 ) ) )
The AS keywords in order of appearance pH, Calcium Hardness, Total Alkalinity, Temperature and Total dissolved solids
The test parameters in the demo config
Please post us the formula for Ryznar's, and your keywords and we'll have a go at that
I actually think I nailed it:
The formula for Langelier I use is pH - calculated pH
Calculated pH = (math.log10(100000 / [CaHard])) + (math.log10(50000 / [Alk])) + (2.6045 * math.exp( ( -0.0108 * [pHT]))) + (0.0144 * [TDS] **0.4545) + (math.log10(1 + ( (10 ** - (10.6 - [pH]) ) * (1 + [pHT] / ) ) * 2)
For Ryznar the formula is 2 * pH - Calculated pH
See below how I went about:
The keywords are different as mine is set up with different keywords
Cool. We must take these up in the standard setup data sheets...
Please x-check whether I have Ryznar's correct
RSI = 2 * ((9.3 + ((log10(TDS)-1) / 10) + ((-13.12 * log10(Temp +273)) + 34.55)) - ((log10(CaH) - 0.4) + (log10(MAlk)))) - pHa
or in Bika-speak
RSI = 2 * ((9.3 + ((math.log10([TDS])-1) / 10) + ((-13.12 * math.log10([Temp] +273)) + 34.55)) - ((math.log10([CaH]) - 0.4) + (math.log10([M-Alk])))) -[pHa]
Algebra1help.com (!) writes it out in book notation for easier evaluation
Just remembered more complex results interpretation, colony diameter interpretation https://www.bikalims.org/manual/senaite-health/antibiotic-susceptibility-testing-AST
[DIAMETER] <= [LOWER_LIMIT]
and "{0:0.0f} mm - Resistant ( Resistant: <= {1} )".format([DIAMETER], [LOWER_LIMIT]) or ([DIAMETER] > [LOWER_LIMIT] and [DIAMETER] < [UPPER_LIMIT])
and "{0:0.0f} mm - Intermediate ( Intermediate: >{1}, <{2} )".format([DIAMETER], [LOWER_LIMIT], [UPPER_LIMIT]) or [DIAMETER] >= [UPPER_LIMIT]
and "{0:0.0f} mm - Sensitive ( Sensitive: >= {1} )".format([DIAMETER], [UPPER_LIMIT])