In [1]:
data = open("/home/mvoorhie/Projects/Courses/PracticalBioinformatics/python/webroot/htdocs/data/example2").read()
In [2]:
len(data)
Out[2]:
3284814
In [3]:
data[:100]
Out[3]:
'RIFFF\x1f2\x00WAVEfmt \x10\x00\x00\x00\x01\x00\x02\x00D\xac\x00\x00\x10\xb1\x02\x00\x04\x00\x10\x00LIST\x1a\x00\x00\x00INFOISFT\x0e\x00\x00\x00Lavf56.40.101\x00data\x00\x1f2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
In [4]:
data[36:40]
Out[4]:
'LIST'
In [5]:
data[70:74]
Out[5]:
'data'
In [6]:
def littleBytes(a):
    r = 0
    for i in reversed(a):
        r = r << 8
        r += ord(i)
    return r
In [7]:
littleBytes(data[74:78])
Out[7]:
3284736
In [8]:
%matplotlib notebook
In [9]:
import matplotlib.pyplot as plt
In [10]:
x = [littleBytes(data[i:i+4]) for i in xrange(78,10078)]
In [11]:
min(x)
Out[11]:
0
In [12]:
max(x)
Out[12]:
4294967295
In [13]:
256**4
Out[13]:
4294967296
In [14]:
plt.plot(x[:1000])
Out[14]:
[<matplotlib.lines.Line2D at 0x7f18c4df9a50>]
In [15]:
a = 256**4
In [16]:
fig = plt.figure()
plt.plot([(i - a/2) % a for i in x])
Out[16]:
[<matplotlib.lines.Line2D at 0x7f18c4db2990>]
In [ ]: