Blame view

Modules/Generation.py 694 Bytes
7030f150   Thomas Fitoussi   Full reorganisati...
1
2
from numpy import shape, arange
from matplotlib.pyplot import figure, show, hist
631c85a9   Thomas Fitoussi   Ad generation com...
3
from Read import ReadGeneration
7030f150   Thomas Fitoussi   Full reorganisati...
4

7030f150   Thomas Fitoussi   Full reorganisati...
5
def drawGeneration(files):
f4246390   Thomas Fitoussi   Improve angular d...
6
7
8
9
10
   '''
      Plot histogram of particles'generations
      Input: list of directories
      Output: histogram of generations
   '''
7030f150   Thomas Fitoussi   Full reorganisati...
11
12
   fig = figure()
   ax = fig.add_subplot(111)
7030f150   Thomas Fitoussi   Full reorganisati...
13
   for fileId in files:
631c85a9   Thomas Fitoussi   Ad generation com...
14
15
16
      i=1
      for powerlaw_index in [1,1.5,2,2.5]: 
         generation, ratio = ReadGeneration(fileId,[0,i])
6633967c   Thomas Fitoussi   Correction on the...
17
         ax.plot(generation,ratio,drawstyle='steps-mid',label="p=%.1f"%powerlaw_index)
7030f150   Thomas Fitoussi   Full reorganisati...
18
19
20

   xtick=arange(9)
   ax.legend(loc='best')
6633967c   Thomas Fitoussi   Correction on the...
21
   ax.set_yscale('log')
7030f150   Thomas Fitoussi   Full reorganisati...
22
   ax.set_xlabel("Generation")
631c85a9   Thomas Fitoussi   Ad generation com...
23
   ax.set_ylabel("Ratio of events [%]")
7030f150   Thomas Fitoussi   Full reorganisati...
24
25

   show()