Ejemplo n.º 1
0
def getMinString(inFile, stringSize):
    l = getCompSizes(inFile, stringSize)
    i = l.index(min(l))

    f = open(inFile)
    f.seek(i)

    s = f.read(stringSize)

    f.close()

    return s
Ejemplo n.º 2
0
def getMinString(inFile, stringSize):
  l= getCompSizes(inFile,stringSize)
  i = l.index(min(l))
  
  f=open(inFile)
  f.seek(i)
  
  s=f.read(stringSize)
  
  f.close()
  
  return s
Ejemplo n.º 3
0
def main():
  t=time.time()
  l = getCompSizes(sys.argv[1],int(sys.argv[2]))
  t=time.time()-t
  
  plt.plot(l,'green')#,marker=u'.')
  plt.plot(len(l)*[mean(l)],label='mean')
  plt.plot(len(l)*[median(l)], 'r--',label='median')
  plt.legend()
  plt.ylabel('Compressed Size')
  plt.xlabel('Position')
  plt.show()
  print t
  return
Ejemplo n.º 4
0
import matplotlib.pyplot as plt
from getStats import *
from varyGraph import getCompSizes
import matplotlib.mlab as mlab
import sys,math

l = getCompSizes(sys.argv[1],int(sys.argv[2]))
n, bins, patches = plt.hist(l,50,normed=True)
#y = mlab.normpdf(bins, mean(l),deviation(l))

plt.xlabel('Compressed string length')

#plt.plot(bins, y, 'r')
plt.show()
Ejemplo n.º 5
0
import sys
from getStats import *
from varyGraph import getCompSizes
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab

stringSize=int(sys.argv[1])
l = getCompSizes('englishText.txt', stringSize)
n = getCompSizes('spanishText.txt', stringSize)

m, bins, p = plt.hist(l,50,normed=True,visible=False)
m1, bins1, p1 = plt.hist(n,50,normed=True,visible=False)

y = mlab.normpdf(bins, mean(l),deviation(l))
y1 = mlab.normpdf(bins1, mean(n),deviation(n))

plt.plot(bins,y,label='English')
plt.plot(bins1,y1,'b--',label='Spanish')

plt.xlabel('Compressed Size')
plt.legend()
plt.show()
Ejemplo n.º 6
0
import sys
from getStats import deviation
from varyGraph import getCompSizes

f = open('standardDeviations.csv', 'a')
for i in range(2, 8):
    f.write(
        str(i) + ',' + str(deviation(getCompSizes(sys.argv[1], 2**i))) + '\n')
f.close()
Ejemplo n.º 7
0
import sys
from getStats import *
from varyGraph import getCompSizes
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab

stringSize = int(sys.argv[1])
l = getCompSizes('englishText.txt', stringSize)
n = getCompSizes('spanishText.txt', stringSize)

m, bins, p = plt.hist(l, 50, normed=True, visible=False)
m1, bins1, p1 = plt.hist(n, 50, normed=True, visible=False)

y = mlab.normpdf(bins, mean(l), deviation(l))
y1 = mlab.normpdf(bins1, mean(n), deviation(n))

plt.plot(bins, y, label='English')
plt.plot(bins1, y1, 'b--', label='Spanish')

plt.xlabel('Compressed Size')
plt.legend()
plt.show()
Ejemplo n.º 8
0
from varyGraph import getCompSizes
import matplotlib.pyplot as plt
from getStats import mean
x,res=[],[]
for i in range(1,100):
  l = getCompSizes('genome.fa',i)
  print i,mean(l)
  res+=[i/mean(l)]
  x+=[i]
  
plt.plot(x,res)

plt.ylabel('Mean Compression Rate')
plt.xlabel('String Length')
plt.show()
Ejemplo n.º 9
0
import matplotlib.pyplot as plt
from getStats import *
from varyGraph import getCompSizes
import matplotlib.mlab as mlab
import sys, math

l = getCompSizes(sys.argv[1], int(sys.argv[2]))
n, bins, patches = plt.hist(l, 50, normed=True)
#y = mlab.normpdf(bins, mean(l),deviation(l))

plt.xlabel('Compressed string length')

#plt.plot(bins, y, 'r')
plt.show()