Skip to content

Instantly share code, notes, and snippets.

@wlach
Created April 28, 2014 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wlach/11382767 to your computer and use it in GitHub Desktop.
Save wlach/11382767 to your computer and use it in GitHub Desktop.
import matplotlib
import videocapture
import pandas as pd
import numpy
import scipy.stats
import requests
import math
%matplotlib inline
# Make graphs prettier
pd.set_option('display.max_columns', 15)
pd.set_option('display.line_width', 400)
pd.set_option('display.mpl_style', 'default')
def get_entropy_pvalues(entropies, window_size=10):
pvalues = []
for i in range(window_size, len(entropies)-window_size):
previousrange = entropies[i-window_size:i]
nextrange = entropies[i:i+window_size]
# use welch's ttest, which does not assume equal variance between
# populations
pvalue = scipy.stats.ttest_ind(nextrange, previousrange, equal_var=False)[1]
pvalues.append(pvalue)
return pvalues
hash = '7c5e49eac4a111e3851df0def1767b24'
def get_metadata(hash):
baseurl = 'http://eideticker.mozilla.org/b2g'
url = baseurl + '/metadata/%s.json' % hash
r = requests.get(url)
return r.json()
metadata = get_metadata(hash)
pvalues = get_entropy_pvalues(metadata['framesobelentropies'])
for (i, pvalue) in enumerate(pvalues):
print "%s,%s" % (i/60.0,-math.log10(pvalue))
pd.Series(pvalues).plot()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment