Advertisement
Guest User

Herp Derp I'm a Codec

a guest
Nov 8th, 2015
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. '''
  2. Onyxia, 2005, 1, 30, 1,
  3. Molten Core, 2005, 4, 25, 10,
  4. Zul'Gurub, 2005, 9, 13, 10,
  5. Blackwing Lair, 2005, 9, 26, 8,
  6. AQ20, 2006, 1, 3, 6,
  7. AQ40, 2006, 4, 25, 9,
  8. Naxxramas, 2006, 9, 9, 15,
  9. Karazhan, 2007, 1, 28, 11,
  10. Gruul, 2007, 2, 3, 2,
  11. Magtheridon, 2007, 2, 24, 1,
  12. Serpentshrine Cavern, 2007, 3, 29, 6,
  13. Tempest Keep, 2007, 5, 25, 5,
  14. Black Temple, 2007, 6, 5, 9,
  15. Hyjal, 2007, 6, 9, 5,
  16. Zul'Aman, 2007, 11, 13, 6,
  17. Sunwell, 2008, 5, 25, 5,
  18. Sartharion, 2008, 11, 13, 1,
  19. Malygos, 2008, 11, 13, 1,
  20. Ulduar, 2009, 7, 7, 14,
  21. Trial of the Crusader, 2009, 9, 17, 5,
  22. Icecrown Citadel, 2010, 3, 26, 12,
  23. Halion, 2010, 6, 30, 1,
  24. Blackwing Descent, 2011, 2, 11, 6,
  25. Bastion of Twilight, 2011, 2, 2, 5,
  26. Throne of the Four Winds, 2011, 1, 24, 2,
  27. Firelands, 2011, 7, 22, 7,
  28. Dragon Soul, 2011, 12, 26, 8,
  29. Mogu'Shan Vaults, 2012, 10, 13, 6,
  30. Heart of Fear, 2012, 11, 11, 6,
  31. Terrace of Endless Spring, 2012, 11, 25, 4,
  32. Throne of Thunder, 2013, 4, 17, 13,
  33. Siege of Orgrimmar, 2013, 10, 5, 14,
  34. Highmaul, 2014, 12, 14, 7,
  35. Blackrock Foundry, 2015, 2, 20, 10,
  36. Hellfire Citadel, 2015, 7, 16, 13,
  37. Legion, 2016, 9, 21, 10
  38. '''
  39.  
  40. days = [31,28,31,30,31,30,31,31,30,31,30,31]
  41.  
  42. d = open("data.txt","r")
  43. data = d.read()
  44. d.close()
  45.  
  46. sldata = data.split(",")
  47.  
  48. n = len(sldata)/5 #number of rows
  49. names, T, dT, Y = [],[],[],[]
  50.  
  51. for i in range(n):
  52. names.append(sldata[5*i][1:])
  53. y = int(sldata[5*i+1])
  54. m = int(sldata[5*i+2])
  55. d = int(sldata[5*i+3])
  56.  
  57. T.append(y + (m*days[m-1] + d)/365.0)
  58. Y.append(int(sldata[5*i+4]))
  59.  
  60. dT.append(T[1]-T[0])
  61. for i in range(1,n-1):
  62. dT.append((T[i+1]-T[i-1])/2)
  63. dT.append(T[n-1]-T[n-2])
  64.  
  65. Yw = []
  66. for i in range(0,n):
  67. Yw.append(Y[i]/dT[i])
  68.  
  69. from numpy import *
  70. from matplotlib.pyplot import *
  71.  
  72. xd = linspace(T[0]-0.1,T[n-1]+0.1,2500)
  73. pdf = Y[0]*np.exp(-(xd-T[0])**2/Y[0]/0.00001)
  74. for i in range(1,n):
  75. pdf+= Y[i]*np.exp(-(xd-T[i])**2/Y[i]/0.00001)
  76.  
  77. fig, ax = subplots()
  78. plot(xd,pdf)
  79. ylabel('B',rotation=0)
  80. xlabel('Year')
  81. ylim(-0.01,max(pdf)+1.5)
  82. xlim(T[0]-0.1,T[n-1]+0.1)
  83. x_formatter = matplotlib.ticker.ScalarFormatter(useOffset=False)
  84. ax.xaxis.set_major_formatter(x_formatter)
  85.  
  86. def randcolor():
  87. r = lambda: random.randint(0,255)
  88. return('#%02X%02X%02X' % (r(),r(),r()))
  89.  
  90. for i in range(n):
  91. ax.annotate(names[i],xy=(T[i],Y[i]),
  92. xytext=(T[i]-random.rand(),Y[i]+0.3+abs(1.75*sin(random.rand()*pi))),
  93. arrowprops=dict(arrowstyle="->", connectionstyle="arc3", color=randcolor()),
  94. )
  95.  
  96. show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement