create_mumpower_bdf_file.py
Go to the documentation of this file.
1 # Author: M. Reichert
2 # Date : 03.06.2024
3 # Convert beta delayed fission file of Mumpower et al. 2022 into a WinNet readable format.
4 # The Mumpower et al. 2022 file can be accessed at :
5 # https://journals.aps.org/prc/supplemental/10.1103/PhysRevC.106.065805
6 import numpy as np
7 import pandas as pd
8 from class_files.nucleus_class import nucleus
9 
10 
11 path = "mumpower_beoh350_bdf_frdm2012_bstr12-gtff_frldm2015.dat"
12 
13 
14 # Columns of the file
15 columns = ["name", "Z", "N", "A", "P0", "P1", "P2", "P3", "P4", "P5", "P6", "P7", "P8", "P9", "P10",
16  "P0f", "P1f", "P2f", "P3f", "P4f", "P5f", "P6f", "P7f", "P8f", "P9f", "P10f"]
17 
18 total_data =[]
19 rate_counter = 0
20 
21 # Open and parse through the file
22 with open(path,"r") as f:
23  lines = f.readlines()
24  for l in lines:
25  if (l[0] == "#") or (l.strip()==""):
26  continue
27  else:
28  data = np.array(l.split()).astype(float)
29  if len(data) == 16:
30  # Get the nucleus name
31  nucleus_name = nucleus(Z=int(data[0]), N=int(data[1])).get_name()
32  # Create the first part of the entry
33  entry = [nucleus_name]+list(data[0:14])
34  else:
35  # Create the second part of the entry
36  entry = entry+list(data)
37  # Add it to the total data
38  total_data.append(entry)
39  rate_counter += 1
40 
41 # Create a pandas dataframe
42 df = pd.DataFrame(total_data, columns=columns)
43 
44 # Calculate the total fission probability
45 df["Total_pf"] = df["P0f"]+df["P1f"]+df["P2f"]+df["P3f"]+df["P4f"]+df["P5f"]+df["P6f"]+df["P7f"]+df["P8f"]+df["P9f"]+df["P10f"]
46 # Drop entries that have no fission probability
47 df = df[df["Total_pf"]>0]
48 
49 
50 # Create the file
51 fcont = ""
52 
53 # Go through the dataframe
54 for it, row in df.iterrows():
55  fcont = fcont + row["name"].rjust(5) + 4*" "+4*" "+"mp22\n"
56  for i in range(10):
57  fcont = fcont + f"{row[f'P{i}f']:.3f}"+4*" "
58  fcont = fcont + "\n"
59 
60 # Write to file
61 with open("fission_rates_bdf_mp22.dat","w") as f:
62  f.write(fcont)
63 
64 # Say something
65 print(f"File fission_rates_bdf_mp22.dat created with {rate_counter} entries.")
bin.create_alpha_decay_file.get_name
def get_name(Z, N, Zdict, Ndict)
Definition: create_alpha_decay_file.py:116
bin.class_files.nucleus_class.nucleus
Definition: nucleus_class.py:9