Heaviside Step Function between 0 and 1 in Python (if else mathematical expression)
The numpy.sign() function returns a result between -1 and 1 which was not useful in my case…
To limit the outcomes in the range of 0 and 1 you could still use the numpy.sign() function and write it as follows:
(0.5 * (np.sign(var) + 1))
Cheers
Tags: function, heavyside, python, sing, step
Trackback from your site.