I keep getting the runtime warning about division. In the code below, I used the answer of a question from this forum and even imported warnings error from this.
def alpha_n(V):
with np.errstate(divide='ignore'):
alph = np.where(V!= -55, 0.01*(V+55)/(1-np.exp(-0.1*(V+55))), 0.1)
return alph
RuntimeWarning: invalid value encountered in true_divide
How could I define the function properly to avoid warnings?
alpha_nnp.whereto avoid bad values is not a good idea. They are still evaluated. An alternative is usenp.divideufunc with its ownwhere(andout) parameters.