def attest_rel (a,b,dimension=None,printit=0,name1='Samp1',name2='Samp2',writemode='a'):
    if dimension == None:
        a = N.ravel(a)
        b = N.ravel(b)
        dimension = 0
    if len(a)<>len(b):
        raise ValueError, 'Unequal length arrays.'
    x1 = amean(a,dimension)
    x2 = amean(b,dimension)
    v1 = avar(a,dimension)
    v2 = avar(b,dimension)
    n = a.shape[dimension]
    df = float(n-1)
    d = (a-b).astype('d')

    denom = N.sqrt((n*N.add.reduce(d*d,dimension) - N.add.reduce(d,dimension)**2) /df)
    zerodivproblem = N.equal(denom,0)
    denom = N.where(zerodivproblem,1,denom)  # avoid zero-division in 1st place
    t = N.add.reduce(d,dimension) / denom      # N-D COMPUTATION HERE!!!!!!
    t = N.where(zerodivproblem,1.0,t)     # replace NaN/wrong t-values with 1.0
    probs = abetai(0.5*df,0.5,float(df)/(df+t*t))
    if type(t) == N.ndarray:
        probs = N.reshape(probs,t.shape)
    if probs.shape == (1,):
        probs = probs[0]

    if printit <> 0:
        statname = 'Related samples T-test.'
        outputpairedstats(printit,writemode,
                          name1,n,x1,v1,N.minimum.reduce(N.ravel(a)),
                          N.maximum.reduce(N.ravel(a)),
                          name2,n,x2,v2,N.minimum.reduce(N.ravel(b)),
                          N.maximum.reduce(N.ravel(b)),
                          statname,t,probs)
        return
    return t, probs
Helper context manager to send all posted events to the event queue
dataset/ETHPy150Open radlab/sparrow/src/main/python/third_party/stats.py/attest_rel--crossover with--dataset/ETHPy150Open enthought/pyface/pyface/ui/qt4/util/gui_test_assistant.py/GuiTestAssistant.event_loop_with_timeout