'Hampel weighting function for the IRLS algorithm
The psi function scaled by z
Parameters
z : array-like
1d array
Returns
weights : array
weights(z) = 1                            for \|z\| <= a
weights(z) = a/\|z\|                        for a < \|z\| <= b
weights(z) = a*(c - \|z\|)/(\|z\|*(c-b))      for b < \|z\| <= c
weights(z) = 0                            for \|z\| > c'

def weights(self, z):

    z = np.asarray(z)
    a = self.a
    b = self.b
    c = self.c
    (t1, t2, t3) = self._subset(z)
    v = ((t1 + ((t2 * a) / np.fabs(z))) + (((t3 * a) * (c - np.fabs(z))) / (np.fabs(z) * (c - b))))
    v[np.where(np.isnan(v))] = 1.0
    return v
