def METHOD_NAME(self, tper, fmag, nobs, mrate=0.0, bval=1.0,
                       itstab=1E-5, maxiter=1000):
    """
    Weichert algorithm
    :param tper: length of observation period corresponding to magnitude
    :type tper: numpy.ndarray (float)
    :param fmag: central magnitude
    :type fmag: numpy.ndarray (float)
    :param nobs: number of events in magnitude increment
    :type nobs: numpy.ndarray (int)
    :keyword mrate: reference magnitude
    :type mrate: float
    :keyword bval: initial value for b-value
    :type beta: float
    :keyword itstab: stabilisation tolerance
    :type itstab: float
    :keyword maxiter: Maximum number of iterations
    :type maxiter: Int
    :returns: b-value, sigma_b, a-value, sigma_a
    :rtype: float
    """
    beta = bval * np.log(10.)
    d_m = fmag[1] - fmag[0]
    itbreak = 0
    snm = np.sum(nobs * fmag)
    nkount = np.sum(nobs)
    iteration = 1
    while (itbreak != 1):
        beta_exp = np.exp(-beta * fmag)
        tjexp = tper * beta_exp
        tmexp = tjexp * fmag
        sumexp = np.sum(beta_exp)
        stmex = np.sum(tmexp)
        sumtex = np.sum(tjexp)
        stm2x = np.sum(fmag * tmexp)
        dldb = stmex / sumtex
        if np.isnan(stmex) or np.isnan(sumtex):
            warnings.warn('NaN occurs in Weichert iteration')
            return np.nan, np.nan, np.nan, np.nan, np.nan, np.nan
            # raise ValueError('NaN occers in Weichert iteration')
        d2ldb2 = nkount * ((dldb ** 2.0) - (stm2x / sumtex))
        dldb = (dldb * nkount) - snm
        betl = np.copy(beta)
        beta = beta - (dldb / d2ldb2)
        sigbeta = np.sqrt(-1. / d2ldb2)
        if np.abs(beta - betl) <= itstab:
            # Iteration has reached convergence
            bval = beta / np.log(10.0)
            sigb = sigbeta / np.log(10.)
            fngtm0 = nkount * (sumexp / sumtex)
            fn0 = fngtm0 * np.exp((beta) * (fmag[0] - (d_m / 2.0)))
            stdfn0 = fn0 / np.sqrt(nkount)
            a_m = fngtm0 * np.exp((-beta) * (mrate -
                                             (fmag[0] - (d_m / 2.0))))
            siga_m = a_m / np.sqrt(nkount)
            itbreak = 1
        else:
            iteration += 1
            if iteration > maxiter:
                warnings.warn('Maximum Number of Iterations reached')
                return np.nan, np.nan, np.nan, np.nan, np.nan, np.nan
    return bval, sigb, a_m, siga_m, fn0, stdfn0