In [1]: ir = B.in_between(-0.1, 0.3, I) # select current between -0.1 and 0.3 In [2]: l1 = B.linefit(V[ir], I[ir], sig_I[Ir]) # fit the line