Open bl454 opened 5 years ago
Does the code work if you download the original fe I provided?
I copied and pasted it but it’s having a syntax error on the def pH_open
I assume it is an indenting error. Thus I suggest you download the original code and see if it works on your computer.
I did that and also tried different combinations of indenting and it is still failing
Whatever technique you used to copy and paste the code is replacing spaces with underscores. I suggest downloading the file and testing that.
I was searching through the aguaclara folder and was not able to find the pH_open function
The code is posted on the course website.
I'm returning an error of cannot convert equivalents/L to dimensionless even though i used the magnitude command.
Can you paste the code that you are using here or send me the code that you are using?
from aguaclara.core.units import unit_registry as u u.define('equivalent = mole = eq') import aguaclara.research.environmental_processes_analysis as epa from aguaclara.research.environmental_processes_analysis import * from scipy import optimize
CayugaANC = 1.6*10(-3).8 - .210(-3.5)u.eq/u.L WolfANC = 7010(-6).8 - .210(-3.5)*u.eq/u.L
def ANC_zeroed(pHguess, ANC): return ((epa.ANC_open(pHguess) - ANC.to(u.mol/u.L)).magnitude
Now we use root finding to find the pH that results in the known ANC.
Our function will call the ANC_zeroed function. The pHguess is the first
input of the ANC_zeroed function and the range on that is set by the next
two inputs in the optimize.brentq function. The ANC is passed as an
additional argument.
def pH_open(ANC): return optimize.brentq(ANC_zeroed, 0, 14,args=(ANC))
CayugapH = pH_open(CayugaANC) WolfpH = pH_open(WolfANC)
File "", line 20
def pH_open(ANC):
^
SyntaxError: invalid syntax