Plot_me.py
Go to the documentation of this file.
1 # Author: M. Reichert
2 import numpy as np
3 import matplotlib.pyplot as plt
4 
5 
6 def sum_over(A,X):
7  """
8  Sum mass fractions over equal mass numbers
9  """
10  max_A = max(A)
11  X_new = np.zeros([max_A+1,])
12  for i in range(len(A)):
13  X_new[int(A[i])] += X[i]
14  return np.array(range(max_A+1)),X_new
15 
16 # Load the final abundances of SkyNet (without calculating detailed balance there)
17 A,Z,N,Y,X = np.loadtxt("finab_SkyNet.dat",unpack=True)
18 
19 # Sum over equal A's
20 A_summed, X_summed = sum_over(A.astype(int),X)
21 
22 # Plot SkyNet
23 plt.plot(A_summed,X_summed,label="SkyNet")
24 
25 # Load WinNet
26 A,Z,N,Y,X = np.loadtxt("finab.dat",unpack=True)
27 
28 # Sum over equal A's
29 A_summed, X_summed = sum_over(A.astype(int),X)
30 
31 # Plot WinNet
32 plt.plot(A_summed,X_summed,label="WinNet")
33 
34 # Show the legend
35 plt.legend()
36 plt.xlabel("Mass number A")
37 plt.ylabel("Mass fraction X")
38 plt.ylim(1e-10,1)
39 plt.yscale("log")
40 plt.savefig("comparison_SkyNet_WinNet.pdf",bbox_inches="tight")
41 plt.show()
Plot_me.sum_over
def sum_over(A, Y)
Definition: Plot_me.py:11