I have a dummy_calcurve.csv
file with parameters for a set of calibration curves as follows:
repeat,method,slope,intercept
a,linear,2,3
b,linear,4,5
I want to get a calcurve : dict
of lambda
-functions from this, such that I can calibrate for condition 'a'
as follows: y=calcurve['a'](x)
.
I did the following:
calcurve = {}
ccs = pd.read_csv('dummy_calcurve.csv', index_col=0)
for repeat in ccs.index:
slope = ccs.slope[repeat]
intercept = ccs.intercept[repeat]
print(repeat, slope, intercept)
calcurve[repeat] = lambda x : slope * x + intercept
print(calcurve['a'](0))
print(calcurve['b'](0))
>>> a 2 3
>>> b 4 5
>>> 5
>>> 5
I would expect the final outputs to be 3
and 5
. In other words, both calibration curves appear to be the second one (for b
), while the intermediate print statements suggest otherwise.
What am I missing here?