示例#1
0
 def logp(prob_tc=prob_tc, prob_gc=prob_gc, prob_dp=prob_dp, 
          samebias=prob_sb, tau_h=tau_h, eff=eff, tau_f=tau_f, 
          tau_d=tau_d, a=a, tau_x=tau_x, tau_u=tau_u, 
          nov_img=nov_img, fam_img=fam_img, off_img=off_img,
          guide_buff=guide_buff, look_mod=look_mod, value=observations):
     rtf_func = lambda x: x
     sac = SalSacc(prob_tc, prob_gc, prob_dp, samebias, tau_h, rtf_func, eff, 
                   tau_f, tau_d, a, tau_x=tau_x, tau_u=tau_u)
     init_h = [0., 0., 0.]
     rs = [off_img, nov_img, fam_img]
     pardict = {'tend':prestime, 'tstep':tstep, 'gbuff':guide_buff}
     useguides = random.sample(observations, samp_pres)
     if par:
         outs = sac.simulate_many_par(samp_pres, rs, look_mod, init_h, 
                                      pardict, pool=send_pool, 
                                      guides=useguides)
     else:
         outs = sac.simulate_many(samp_pres, rs, look_mod, init_h, 
                                  pardict, guides=useguides)
     ts, hs_3d, lps_2d, looks_2d, saccts, fixes, ps = proc_many_outs(outs)
     logps = np.log(np.mean(ps))
     if np.isnan(logps):
         print 'nantrip'
         logps = eps
     print logps
     return logps
示例#2
0
def sample_eyetrace(prob_tc=prob_tc, prob_gc=prob_gc, prob_dp=prob_dp, 
                    samebias=prob_sb, tau_h=tau_h, eff=eff, tau_f=tau_f, 
                    tau_d=tau_d, a=a, tau_x=tau_x, tau_u=tau_u, 
                    nov_img=nov_img, fam_img=fam_img, off_img=off_img):
    rtf_func = lambda x: x
    sac = SalSacc(prob_tc, prob_gc, prob_dp, samebias, tau_h, rtf_func, eff, 
                  tau_f, tau_d, a, tau_x=tau_x, tau_u=tau_u)
    init_h = [0., 0., 0.]
    rs = [off_img, nov_img, fam_img]
    pardict = {'tend':prestime, 'tstep':tstep}
    print 'beg sim'
    outs = sac.simulate_many_par(samp_pres, rs, look_mod, init_h, pardict,
                                 pool=send_pool)
    ts, hs_3d, lps_2d, looks_2d, saccts, fixes = proc_many_outs(outs)
    print 'end sim'
    hs = hs_3d.mean(2)
    plooks = np.zeros(hs.shape)
    for i, row in enumerate(plooks):
        row[:] = np.mean(looks_2d == i, axis=0)
    fixarr = np.zeros(sacclen)
    fixarr[:] = np.nan
    fixarr[:len(fixes)] = fixes
    return plooks, fixarr