Hello,
I built a Model Builder tool that performs a number of operations on a FGDB feature class that contains geochemical analyzes. I want to calculate a geochemical index called Eu/Eu * on the basis of the contents of europium (Eu), samarium (Sm) and gadolinium (Gd), according to the following formula: Eu/Eu * = (Eu/0.058)/math.sqrt((Sm/0.153) * (Gd/0.2055)).
To note :
• Values below a detection limit are negative.
• For a same element, this detection threshold varies depending on the analysis method. For example, for platinum Pt, it is -0.1 and -70.
• Since the square root (in the equation) of a negative value does not exist, then my Model Builder tool crashes.

This is why I tried to introduce a small boolean python script in the "Calculate Field" box (figure below), so that if one of the 3 elements is negative, then it must then put zero in the Eu_Eu field created previously (Float type). Otherwise (i.e. actually all 3 are positive) it calculates the above formula.
def calcul(Eu_Eu):
if (!Eu!<=0 or !Gd!<=0 or !Sm!<=0):
return 0
else:
return (!Eu!/0.058)/math.sqrt((!Sm!/0.153)*(!Gd!/0.2055))
The problem is that, besides not really knowing if my script is correct (I'm just a beginner...), it puts me error 000989 (figure below) according to which there would be a problem with the syntax, which I unfortunately cannot locate. To my knowledge, field names should be placed between two exclamation points in a Python script, right? I say that because by putting "‘ ", the error disappears, but the calculation still crashes.



Thank you in advance for your precious help!