def stability(pts):
    """See condition Eq. 12.10"""
    if pts['dphi'][-1] > DS.pars['dphi_thresh']:
        print "No steady state"
        return
    phi = pts['phi'][-1]
    print "Final, steady state phi =", pts['phi'][-1]
    a1 = DS.pars['a1']
    a2 = DS.pars['a2']
    sigma = DS.pars['sigma']
    cond = -(a2-a1)*sin(sigma)*sin(phi) - (a1+a2)*cos(sigma)*cos(phi)
    if cond < 0:
        result = '(stable)'
    else:
        result = '(unstable)'
    print 'd/d phi (D2(-phi) - H1(phi)) = %.3f' % cond, result


#-------------------------------------------
dataset/ETHPy150Open robclewley/compneuro/Ch12_phase.py/stability/original