from looksAnalysis import *
import numpy as np
from datetime import datetime

la = looksAnalysis('save/la_ocv_v4.pkl')
path = '../faces/'
date_time = datetime.strptime('2012-11-27 11:27:00', '%Y-%m-%d %H:%M:%S')
observerId = '35'
observedId = '03'
la.showPhotos(path, date_time, observerId, observedId)
from looksAnalysis import *
import sys
import numpy as np
import scipy.stats as stats

filename = sys.argv[1]

la = looksAnalysis(filename)

def per(f,n):
    return float(f)/float(n)*100

def print_result(title, res, decimals=1, tex=None, write=True):
    nCols = len(res[0])
    print
    print title
    colLen = [0 for i in range(nCols)]
    for row in res:
        colLen = [max(cL, len(str(r))) for cL, r in zip(colLen,row)]
    print '-'*(np.sum(colLen) + 3*len(row) + 1)
    for row in res:
        print '| ' + ' | '.join([('{'+str(n)+':' + str(colLen[n]) + '.' + str(decimals) + 'f}') if isinstance(row[n], float) else ('{'+str(n)+':' + str(colLen[n]) + '}') for n in range(len(row))]).format(*row) + ' |'
    print '-'*(np.sum(colLen) + 3*len(row) + 1)

    #tex
    t = ''
    if not tex is None:
        if nCols < 2:
            t = '\\begin{table}[h!]\n\\begin{center}\n\\begin{tabular}{|c|}\n\\hline\n'
        else:
            t = '\\begin{table}[h!]\n\\begin{center}\n\\begin{tabular}{|l|' + '|'.join(['r' for i in range(nCols-1)]) + '|}\n\\hline\n'
Esempio n. 3
0
from looksAnalysis import *
import sys

filename = sys.argv[1]

la = looksAnalysis()

la.setTimetable('horario2.csv', 'bloques2.csv')
la.setPeople('personas.csv')
la.setVideos('duracion_videos_completo.csv')
la.setLooks('matrices.csv', delta=60, useVideos=False)

la.save(filename)

print len(la.looks)
from looksAnalysis import *

#cargar archivos
la1 = looksAnalysis('la_v10_sininfo.pkl')
la2 = looksAnalysis('la_v10_coninfo.pkl')

#buscar en la1 bloques con interacciones que no estan en la2

blocks1 = set([(l.observer._id, str(l.date_time.date()), l.block or 'None') for l in la1.looks])
blocks2 = set([(l.observer._id, str(l.date_time.date()), l.block or 'None') for l in la2.looks])

difference = blocks1 - blocks2

filteredBlocks = set(['r1', 'r2', 'al'])

outfile = 'errors.csv'
with open(outfile, 'w') as o:
    l = ','.join(['id','fecha','bloque','inicio','fin']) + '\n'
    o.write(l)
    for d in difference:
        if d[2] in filteredBlocks: continue
        if d[2] == 'None':
            times = ['' , '']
        else:
            times = [str(t) for t in la1.getTimes(d[2])]
        d = list(d)
        d.extend(list(times))
        l = ','.join(d) + '\n'
        o.write(l)