Esempio n. 1
0
def pct_updig(checked, kbouts=2, maxsep=50):
    ad = submit_summarize_runs.analysis_dir_from_donebase(
        checked.rsplit('.', 1)[0])
    #config = eval(open(checked.split('l1800')[0]+'config.dict').read())

    newact_tarf = glob(ad + '/newact_ols_postsummary-*.tar')[0]

    newact_tarh = tarfile.open(newact_tarf)
    newacts = Util.tar2obj_all(newact_tarh)

    SHAPE = eval(open(ad + '/SHAPE').read())
    cm = vidtools.calc_coordMat(SHAPE)
    centroids = [
        vidtools.centroid(reduce(lambda x, y: x + y, l), SHAPE, cm)
        for l in newacts if len(l) > 0
    ]

    #pdy = config['predug'][1][1]

    #return len(filter(lambda x:x<pdy, \
    #                  [y for x,y in centroids]))/float(len(centroids))
    k = trial_from_filename(glob(ad + '/*hwc4*hmcdNone*dig_areas.list')[0])
    y_offsets = [
        p1[1] - p2[1]
        for p1, p2 in zip(centroids[:-kbouts], centroids[kbouts:])
        if vidtools.hypotenuse(p1, p2) < maxsep
    ]

    return k, len(filter(lambda x: x > 0, y_offsets)) / float(len(y_offsets))
Esempio n. 2
0
def nearest_point_on_line(lpt1,lpt2,qpt):
    h = vidtools.hypotenuse(lpt1,lpt2)
Esempio n. 3
0
def calc_chord_stats(tun,cm_factor):
    h = vidtools.hypotenuse(tun[0],tun[-1])
Esempio n. 4
0
def calc_chord_stats(tun):
    h = vidtools.hypotenuse(tun[0],tun[-1])
Esempio n. 5
0
ar = numpy.asarray(Image.open(im).convert(mode='L'))
from PIL import Image
ar = numpy.asarray(Image.open(im).convert(mode='L'))
matshow(ar)
fig = plt.figure(1)
def onclick(event):
    print 'button=%d, x=%d, y=%d, xdata=%f, ydata=%f'%(
        event.button, event.x, event.y, event.xdata, event.ydata)
cid = fig.canvas.mpl_connect('button_press_event', onclick)

fig.canvas.mpl_disconnect(cid)
pylab.ginput(2,0)
p1,p2 = _
from video_analysis import vidtools
from video_analysis import vidtools, viz_vidtools
vidtools.hypotenuse(p1,p2)
p0,p1,p10 = ginput(3,0
)
cm_dists = {}
cm_dists['bot1'] = vidtools.hypotenuse(p0,p1)/1
cm_dists['bot10'] = vidtools.hypotenuse(p0,p10)/1
cm_dists
p0,p1,p10 = ginput(3,0
)
cm_dists['rt1'] = vidtools.hypotenuse(p0,p1)/1
cm_dists['rt10'] = vidtools.hypotenuse(p0,p10)/1
cm_dists
mean([cm_dists['bot1'],cm_dists['bot1'],cm_dists['bot1'],)
cm_dists['bot10'] = vidtools.hypotenuse(p0,p10)/10
cm_dists['rt10'] = vidtools.hypotenuse(p0,p10)/10
cm_dists
def pct_updig(checked,kbouts=2,maxsep=50):
    ad = submit_summarize_runs.analysis_dir_from_donebase(checked.rsplit('.',1)[0])
    #config = eval(open(checked.split('l1800')[0]+'config.dict').read())

    newact_tarf = glob(ad+'/newact_ols_postsummary-*.tar')[0]

    newact_tarh = tarfile.open(newact_tarf)
    newacts = Util.tar2obj_all(newact_tarh)


    SHAPE = eval(open(ad+'/SHAPE').read())
    cm = vidtools.calc_coordMat(SHAPE)
    centroids = [vidtools.centroid(reduce(lambda x,y:x+y, l),SHAPE,cm) for l in newacts if len(l)>0]
    
    #pdy = config['predug'][1][1]
    
    #return len(filter(lambda x:x<pdy, \
    #                  [y for x,y in centroids]))/float(len(centroids))
    k = trial_from_filename(glob(ad+'/*hwc4*hmcdNone*dig_areas.list')[0])
    y_offsets = [p1[1]-p2[1] for p1,p2 in zip(centroids[:-kbouts],centroids[kbouts:]) if vidtools.hypotenuse(p1,p2)<maxsep]

    return k,len(filter(lambda x:x>0,y_offsets))/float(len(y_offsets))