convert_marketin_beta_decays.py
Go to the documentation of this file.
1 # Author: M. Reichert
2 # Date : 30.03.2023
3 # Convert beta decay file of Marketin into a WinNet readable format.
4 # The Marketing file can be accessed at :
5 # https://journals.aps.org/prc/supplemental/10.1103/PhysRevC.93.025805
6 import numpy as np
7 import matplotlib.pyplot as plt
8 import pandas as pd
9 
10 # Names of the elements
11 elname = ['neutron','h','he','li','be','b','c','n','o','f','ne','na','mg','al','si','p','s','cl','ar','k','ca','sc','ti','v','cr','mn','fe',
12  'co','ni','cu','zn','ga','ge','as','se','br','kr','rb','sr','y','zr','nb','mo','tc','ru','rh','pd','ag','cd','in','sn','sb',
13  'te', 'i','xe','cs','ba','la','ce','pr','nd','pm','sm','eu','gd','tb','dy','ho','er','tm','yb','lu','hf','ta','w','re','os',
14  'ir','pt','au','hg','tl','pb','bi','po','at','rn','fr','ra','ac','th','pa','u','np','pu','am','cm','bk','cf','es','fm','md',
15  'no','lr','rf','db','sg','bh','hs','mt','ds','rg','ub','ut','uq','up','uh','us','uo']
16 
17 
18 
19 # The file with the marketin rates
20 path = "betadecay_supplemental_material.dat"
21 # Get the column names
22 with open(path,"r") as f:
23  lines = f.readlines()
24 
25  for line in lines:
26  if len(line.split(" "))>2:
27  linesplit = line.split(" ")[1:]
28  linesplit = list(map(lambda x: x.strip(),linesplit))
29 
30  if "Z" in linesplit:
31  linesplit = np.array(["name"]+linesplit)
32  header = linesplit[linesplit!=""]
33  break
34 
35 df = pd.read_csv(path,names=header, comment='#',delim_whitespace=True)
36 
37 out = ""
38 for ind, row in df.iterrows():
39  ztmp = int(row["Z"])
40  atmp = int(row["A"])
41  name = elname[ztmp]+str(atmp)
42 
43  halflive = row["T_1/2 [s]"]
44  Etot = row[["<E_e> [MeV]","<E_nu> [MeV]", "<E_gamma> [MeV]"]].sum()
45  Enu = row["<E_nu> [MeV]"]
46  if halflive == 1e100:
47  print("Skipped "+str(name)+" due to large halflife.")
48  continue
49  print(Etot,Enu,Enu/Etot)
50  out+=name.rjust(5)+" "*4+"{:12.6e}".format(halflive)+" "+"{:10.6e}".format(Etot)+" "+"{:10.6e}".format(Enu)+"\n"
51  pns = np.zeros(11)
52  for i in range(6):
53  pns[i] = row["P"+str(i)+"n"]
54  for p in pns:
55  out+="{:1.4f}".format(p)+" "
56  out+="\n"
57 
58 
59 with open("marketin.dat","w") as f:
60  f.write(out)
61 
62