def plotAreaVsStraddling(straddling_dictionary, sizes, savefilename=''):

    X=np.zeros((len(sizes)))
    Y=np.zeros((len(sizes)))
    idx=0
    for name, video in straddling_dictionary.iteritems():

        dims=sizes[name]

        X[idx]=dims[0]*dims[1]

        measure= interpolateToFixedLength(video['origin'])
        Y[idx]=measure.mean()

        idx=idx+1

    plt.scatter(X,Y)
    plt.title('Effect of the size ')
    plt.xlabel('Area, pixels')
    plt.ylabel('Average straddling measure')
    plt.xlim([0, 30000])

    if savefilename=='':
        plt.show()
    else:
        plt.savefig(savefilename)
Exemple #2
0
def plotAreaVsStraddling(straddling_dictionary, sizes, savefilename=''):

    X = np.zeros((len(sizes)))
    Y = np.zeros((len(sizes)))
    idx = 0
    for name, video in straddling_dictionary.iteritems():

        dims = sizes[name]

        X[idx] = dims[0] * dims[1]

        measure = interpolateToFixedLength(video['origin'])
        Y[idx] = measure.mean()

        idx = idx + 1

    plt.scatter(X, Y)
    plt.title('Effect of the size ')
    plt.xlabel('Area, pixels')
    plt.ylabel('Average straddling measure')
    plt.xlim([0, 30000])

    if savefilename == '':
        plt.show()
    else:
        plt.savefig(savefilename)
Exemple #3
0
def plotAverages(dictionary, title='No Title', savefilename=''):

    #dictionary=dict()

    experiment_names = list()
    for value in dictionary.itervalues():
        num_experiments = len(value)

        for key in value.iterkeys():
            experiment_names.append(key)

    n = 100
    X = np.zeros((num_experiments, n))

    counts = np.zeros((num_experiments))

    for video_dictionary in dictionary.itervalues():

        for key, index in zip(video_dictionary.iterkeys(),
                              range(0, num_experiments)):
            xs = interpolateToFixedLength(video_dictionary[key], n)

            if xs is not None:
                X[index, ] = X[index, ] + xs
                counts[index] = counts[index] + 1

    y = np.linspace(0, 1, n)

    values = np.zeros((num_experiments))

    for i in range(0, num_experiments):
        z = X[i, ] / counts[i]

        values[i] = simps(z, y)

    fig = plt.figure()
    sort_index = np.argsort(values)
    values = values[sort_index]

    labels = list()

    for i in range(0, len(sort_index)):
        labels.append(experiment_names[sort_index[i]])

    values = values[::-1]

    labels = list(reversed(labels))

    width = 0.3
    ind = np.arange(len(values))
    plt.bar(ind, values, align="center")
    plt.xticks(ind, labels)
    plt.title(title)
    #fig.autofmt_xdate()

    if savefilename != '':
        plt.savefig(savefilename)
    else:
        plt.show()
def plotAverages(dictionary,title='No Title',savefilename=''):

    #dictionary=dict()

    experiment_names=list()
    for value in dictionary.itervalues():
        num_experiments=len(value)

        for key in value.iterkeys():
            experiment_names.append(key)

    n = 100
    X=np.zeros((num_experiments,n))

    counts=np.zeros((num_experiments))

    for video_dictionary in dictionary.itervalues():

        for key,index in zip(video_dictionary.iterkeys(),range(0,num_experiments)):
            xs = interpolateToFixedLength(video_dictionary[key], n)

            if xs is not None:
                X[index,]= X[index,]+xs
                counts[index]= counts[index]+1

    y = np.linspace(0, 1, n)

    values = np.zeros((num_experiments))

    for i in range(0,num_experiments):
        z=X[i,]/counts[i]

        values[i]=simps(z,y)

    fig = plt.figure()
    sort_index = np.argsort(values)
    values=values[sort_index]



    labels=list()

    for i in range(0,len(sort_index)):
        labels.append(experiment_names[sort_index[i]])


    values= values[::-1]

    labels=list(reversed(labels))

    width = 0.3
    ind = np.arange(len(values))
    plt.bar(ind, values,align="center")
    plt.xticks(ind, labels)
    plt.title(title)
    #fig.autofmt_xdate()

    if savefilename!='':
        plt.savefig(savefilename)
    else:
        plt.show()